12345678910111213141516171819202122232425262728293031323334353637383940 |
- var __vite_style__=document.createElement("style");__vite_style__.innerHTML='@charset "UTF-8";.status-bar-tools{position:absolute;margin:10px;padding:10px;background:rgba(49,49,49,.8);border:1px solid rgb(32,32,32);border-radius:4px;z-index:10}.lk-status-bar{position:absolute;bottom:0;width:100%;background-color:#3a3939cc;text-align:right;font-size:.9rem;color:#fff;padding:3px 0}.lk-status-bar .status-all{float:left;padding:0 10px;color:#08df08}.lk-status-bar .status-position{padding:0 5px}.lk-status-bar .status-position span{padding:0 5px}.lk-status-bar .status-scale{display:inline-flex;align-items:flex-end;margin-right:10px}.lk-status-bar .status-scale .scale-border{border:2px solid rgb(243,242,242);border-top:0;height:6px;line-height:1px;padding:0 5px;margin:3px 0;font-size:.5rem}.cesium-viewer-toolbar,.cesium-viewer-animationContainer,.cesium-viewer-timelineContainer,.cesium-viewer-bottom{display:none}.cesium-performanceDisplay-defaultContainer{top:auto;bottom:30px;right:10px}.cesium-performanceDisplay-throttled{display:none}.cesium-viewer-fullscreenContainer{position:absolute;top:-999em}.MultiField-popup{position:absolute;z-index:999}.MultiField-popup .MultiField-popup-header{background:rgb(15,85,195);color:#fff;font-size:15px;padding:10px;text-align:left}.MultiField-popup .MultiField-popup-header .leaflet-popup-close-button{position:absolute;right:10px;cursor:pointer}.MultiField-popup .MultiField-popup-content{padding:5px;background:rgba(5,45,115,.7);color:#a0ffff}.MultiField-popup .MultiField-popup-tip{position:absolute;bottom:-25px;left:50%;margin-left:-15px;width:0;height:0;border-left:15px solid transparent;border-right:15px solid transparent;border-top:25px solid rgba(5,45,115,.7)}.MultiField-popup .MultiField-popup-content .table-popup{border-collapse:collapse;text-align:center}.MultiField-popup .MultiField-popup-content .table-popup tr{border:1px solid #cad9ea;color:#a0ffff;height:30px;padding:5px}.MultiField-popup .MultiField-popup-content .table-popup .title-popup{width:100px;background-color:#052d73b3}.MultiField-popup .MultiField-popup-content .table-popup .value-popup{width:120px}.vjs-modal-dialog .vjs-modal-dialog-content,.video-js .vjs-modal-dialog,.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-button>.vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{text-align:center}@font-face{font-family:VideoJS;src:url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABDkAAsAAAAAG6gAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAPgAAAFZRiV3hY21hcAAAAYQAAADaAAADPv749/pnbHlmAAACYAAAC3AAABHQZg6OcWhlYWQAAA3QAAAAKwAAADYZw251aGhlYQAADfwAAAAdAAAAJA+RCLFobXR4AAAOHAAAABMAAACM744AAGxvY2EAAA4wAAAASAAAAEhF6kqubWF4cAAADngAAAAfAAAAIAE0AIFuYW1lAAAOmAAAASUAAAIK1cf1oHBvc3QAAA/AAAABJAAAAdPExYuNeJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGS7wTiBgZWBgaWQ5RkDA8MvCM0cwxDOeI6BgYmBlZkBKwhIc01hcPjI+FGJHcRdyA4RZgQRADK3CxEAAHic7dFZbsMgAEXRS0ycyZnnOeG7y+qC8pU1dHusIOXxuoxaOlwZYWQB0Aea4quIEN4E9LzKbKjzDeM6H/mua6Lmc/p8yhg0lvdYx15ZG8uOLQOGjMp3EzqmzJizYMmKNRu27Nhz4MiJMxeu3Ljz4Ekqm7T8P52G8PP3lnTOVk++Z6iN6QZzNN1F7ptuN7eGOjDUoaGODHVsuvU8MdTO9Hd5aqgzQ50b6sJQl4a6MtS1oW4MdWuoO0PdG+rBUI+GejLUs6FeDPVqqDdDvRvqw1CfhpqM9At0iFLaAAB4nJ1YDXBTVRZ+5/22TUlJ8we0pHlJm7RJf5O8F2j6EymlSPkpxaL8U2xpa3DKj0CBhc2IW4eWKSokIoLsuMqssM64f+jA4HSdWXXXscBq67IOs3FXZ1ZYWVyRFdo899yXtIBQZ90k7717zz3v3HPPOfd854YCCj9cL9dL0RQFOqCbGJnrHb5EayiKIWN8iA/hWBblo6hUWm8TtCDwE80WMJus/irwyxOdxeB0MDb14VNJHnXYoLLSl6FfCUYO9nYPTA8Epg9090LprfbBbZ2hY0UlJUXHQp3/vtWkS6EBv8+rPMq5u9692f/dNxJNiqwC1xPE9TCUgCsSdQWgE3XQD25lkG4CN2xmTcOXWBOyser6RN6KnGbKSbmQ3+d0OI1m2W8QzLLkI2sykrWAgJJEtA8vGGW/2Q+CmT3n8zS9wZwu2DCvtuZKZN3xkrLh36yCZuUomQSqGpY8t/25VfHVhw8z4ebGBtfLb0ya9PCaDc+8dGTvk2dsh6z7WzvowlXKUSWo9MJ15a3KrEP2loOr2Ojhw6iW6hf2BDdEccQvZGpaAy7YovSwq8kr7HGllxpd71rkS6G0Sf11sl9OvMK1+jwPPODxjUwkOim9CU3ix1wNjXDfmJSEn618Bs6lpWwUpU+8PCqLMY650zjq8VhCIP17NEKTx3eaLL+s5Pi6yJWaWjTHLR1jYzPSV9VF/6Ojdb/1kO3Mk3uhHC0x6gc1BjlKQ+nQFxTYdaJkZ7ySVxLBbhR1dsboNXp1tCYKW2LRaEzpYcIx2BKNxaL0ZaUnSqfFoiNhHKR/GkX6PWUSAaJelQaqZL1EpoHNsajSEyPSoJ9IjhIxTdjHLmwZvhRDOiFTY/YeQnvrVZmiTQtGncECXtFTBZLOVwwMRgoXHAkXzMzPn1nAJJ8jYSbMDaqN2waGLzNhih/bZynUBMpIWSg7VYi7DRx2m8ALkIdRCJwI6ArJx2EI8kaDWeTQKeAFk9fjl/1AvwktjQ1P7NjyMGQyfd4vjipX6M/i52D7Cq80kqlcxEcGXRr/FEcgs0u5uGgB4VWuMFfpdn2Re6Hi3PqzmxWKsz6+ae2Pn9hXXw/fqM859UiGC0oKYYILJBqJrsn1Z1E5qOs9rQCiUQRREjm8yJcbHF5cUJufX1vAHlefw0XgUoboS3ETfQlTxBC4SOtuE8VPRJTBSCQSjZCpk7Gqzu+masaZ2y7Zjehho4F3g82BNDkAHpORG4+OCS+f6JTPmtRn/PH1kch6d04sp7AQb25aQ/pqUyXeQ8vrebG8OYQdXOQ+585u0sdW9rqalzRURiJ+9F4MweRFrKUjl1GUYhH1A27WOHw5cTFSFPMo9EeUIGnQTZHIaJ7AHLaOKsOODaNF9jkBjYG2QEsQ2xjMUAx2bBEbeTBWMHwskBjngq56S/yfgkBnWBa4K9sqKtq2t1UI8S9He5XuBRbawAdatrQEAi30Aks2+LM8WeCbalVZkWNylvJ+dqJnzVb+OHlSoKW8nPCP7Rd+CcZ2DdWAGqJ2CBFOphgywFFCFBNtfAbGtNPBCwxvygHeYMZMY9ZboBqwq/pVrsbgN5tkv152ODlbMfiqwGMBgxa4Exz3QhovRIUp6acqZmQzRq0ypDXS2TPLT02YIkQETnOE445oOGxOmXAqUJNNG7XgupMjPq2ua9asrj5yY/yuKteO1Kx0YNJTufrirLe1mZnat7OL6rnUdCWenpW6I8mAnbsY8KWs1PuSovCW9A/Z25PQ24a7cNOqgmTkLmBMgh4THgc4b9k2IVv1/g/F5nGljwPLfOgHAzJzh45V/4+WenTzmMtR5Z7us2Tys909UHqrPY7KbckoxRvRHhmVc3cJGE97uml0R1S0jdULVl7EvZtDFVBF35N9cEdjpgmAiOlFZ+Dtoh93+D3zzHr8RRNZQhnCNMNbcegOvpEwZoL+06cJQ07h+th3fZ/7PVbVC6ngTAV/KoLFuO6+2KFcU651gEb5ugPSIb1D+Xp8V4+k3sEIGnw5mYe4If4k1lFYr6SCzmM2EQ8iWtmwjnBI9kTwe1TlfAmXh7H02by9fW2gsjKwtv0aaURKil4OdV7rDL1MXIFNrhdxohcZXYTnq47WisrKitaObbf5+yvkLi5J6lCNZZ+B6GC38VNBZBDidSS/+mSvh6s+srgC8pyKMvDtt+de3c9fU76ZPfuM8ud4Kv0fyP/LqfepMT/3oZxSqpZaTa1DaQYLY8TFsHYbWYsPoRhRWfL5eSSQbhUGgGC3YLbVMk6PitTFNGpAsNrC6D1VNBKgBHMejaiuRWEWGgsSDBTJjqWIl8kJLlsaLJ2tXDr6xGfT85bM2Q06a46x2HTgvdnV8z5YDy/27J4zt6x2VtkzjoYpkq36kaBr4eQSg7tyiVweWubXZugtadl58ydapfbORfKsDTuZ0OBgx4cfdjCf5tbWNITnL120fdOi1RV1C3uKGzNdwYLcMvZ3BxoPyTOCD1XvXTp7U10gWCVmTV9b3r2z0SkGWovb2hp9I89O8a2smlyaO8muMU+dRmtzp60IzAoFpjLr1n388boLyf0dRvxhsHZ0qbWqDkwqvvpkj4l0fY6EIXRi5sQSrAvsVYwXRy4qJ2EVtD1AN7a0HWth9ymvL1xc3WTUKK/TAHA/bXDVtVWfOMfuGxGZv4Ln/jVr9jc3j1yMv0tndmyt9Vq88Y9gH1wtLX3KWjot5++jWHgAoZZkQ14wGQ20Fli71UmKJAy4xKMSTGbVdybW7FDDAut9XpD5AzWrYO7zQ8qffqF8+Ynd/clrHcdyxGy3a/3+mfNnzC/cBsveTjnTvXf1o6vzOlZw7WtqtdmPK/Errz/6NNtD72zmNOZfbmYdTGHfoofqI79Oc+R2n1lrnL6pOm0Up7kwxhTW12Amm7WYkXR2qYrF2AmgmbAsxZjwy1xpg/m1Je2vrp8v/nz2xpmlBg4E9hrMU341wVpTOh/OfmGvAnra8q6uctr60ZQHV3Q+WMQJykMj8ZsWn2QBOmmHMB+m5pDIpTFonYigiaKAhGEiAHF7EliVnQkjoLVIMPtJpBKHYd3A8GYH9jJzrWwmHx5Qjp7vDAX0suGRym1vtm/9W1/HyR8vczfMs6Sk8DSv855/5dlX9oQq52hT8syyp2rx5Id17IAyAM3wIjQPMOHzytEB64q6D5zT91yNbnx3V/nqnd017S9Y0605k3izoXLpsxde2n38yoOV9s1LcjwzNjbdX6asnBVaBj/6/DwKwPkpcqbDG7BnsXoSqWnUAmottYF6jMSdVyYZh3zVXCjwTiwwHH6sGuRiEHQGzuRX6whZkp123oy1BWE2mEfJ/tvIRtM4ZM5bDXiMsPMaAKOTyc5uL57rqyyc5y5JE5pm1i2S2iUX0CcaQ6lC6Zog7JqSqZmYlosl2K6pwNA84zRnQW6SaALYZQGW5lhCtU/W34N6o+bKfZ8cf3/Cl/+iTX3wBzpOY4mRkeNf3rptycGSshQWgGbYt5jFc2e0+DglIrwl6DVWQ7BuwaJ3Xk1J4VL5urnLl/Wf+gHU/hZoZdKNym6lG+I34FaNeZKcSpJIo2IeCVvpdsDGfKvzJnAwmeD37Ow65ZWwSowpgwX5T69s/rB55dP5BcpgDKFV8p7q2sn/1uc93bVzT/w6UrCqDTWvfCq/oCD/qZXNoUj8BL5Kp6GU017frfNXkAtiiyf/SOCEeLqnd8R/Ql9GlCRfctS6k5chvIBuQ1zCCjoCHL2DHNHIXxMJ3kQeO8lbsUXONeSfA5EjcG6/E+KdhN4bP04vBhdi883+BFBzQbxFbvZzQeY9LNBZc0FNfn5NwfDn6rCTnTw6R8o+gfpf5hCom33cRuiTlss3KHmZjD+BPN+5gXuA2ziS/Q73mLxUkpbKN/eqwz5uK0X9F3h2d1V4nGNgZGBgAOJd776+iue3+crAzc4AAje5Bfcg0xz9YHEOBiYQBQA8FQlFAHicY2BkYGBnAAGOPgaG//85+hkYGVCBMgBGGwNYAAAAeJxjYGBgYB8EmKOPgQEAQ04BfgAAAAAAAA4AaAB+AMwA4AECAUIBbAGYAcICGAJYArQC4AMwA7AD3gQwBJYE3AUkBWYFigYgBmYGtAbqB1gIEghYCG4IhAi2COh4nGNgZGBgUGYoZWBnAAEmIOYCQgaG/2A+AwAYCQG2AHicXZBNaoNAGIZfE5PQCKFQ2lUps2oXBfOzzAESyDKBQJdGR2NQR3QSSE/QE/QEPUUPUHqsvsrXjTMw83zPvPMNCuAWP3DQDAejdm1GjzwS7pMmwi75XngAD4/CQ/oX4TFe4Qt7uMMbOzjuDc0EmXCP/C7cJ38Iu+RP4QEe8CU8pP8WHmOPX2EPz87TPo202ey2OjlnQSXV/6arOjWFmvszMWtd6CqwOlKHq6ovycLaWMWVydXKFFZnmVFlZU46tP7R2nI5ncbi/dDkfDtFBA2DDXbYkhKc+V0Bqs5Zt9JM1HQGBRTm/EezTmZNKtpcAMs9Yu6AK9caF76zoLWIWcfMGOSkVduvSWechqZsz040Ib2PY3urxBJTzriT95lipz+TN1fmAAAAeJxtkMl2wjAMRfOAhABlKm2h80C3+ajgCKKDY6cegP59TYBzukAL+z1Zsq8ctaJTTKPrsUQLbXQQI0EXKXroY4AbDDHCGBNMcYsZ7nCPB8yxwCOe8IwXvOIN7/jAJ76wxHfUqWX+OzgumWAjJMV17i0Ndlr6irLKO+qftdT7i6y4uFSUvCknay+lFYZIZaQcmfH/xIFdYn98bqhra1aKTM/6lWMnyaYirx1rFUQZFBkb2zJUtoXeJCeg0WnLtHeSFc3OtrnozNwqi0TkSpBMDB1nSde5oJXW23hTS2/T0LilglXX7dmFVxLnq5U0vYATHFk3zX3BOisoQHNDFDeZnqKDy9hRNawN7Vh727hFzcJ5c8TILrKZfH7tIPxAFP0BpLeJPA==) format("woff");font-weight:normal;font-style:normal}.vjs-icon-play,.video-js .vjs-play-control .vjs-icon-placeholder,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-play:before,.video-js .vjs-play-control .vjs-icon-placeholder:before,.video-js .vjs-big-play-button .vjs-icon-placeholder:before{content:"\\f101"}.vjs-icon-play-circle{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-play-circle:before{content:"\\f102"}.vjs-icon-pause,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-pause:before,.video-js .vjs-play-control.vjs-playing .vjs-icon-placeholder:before{content:"\\f103"}.vjs-icon-volume-mute,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-volume-mute:before,.video-js .vjs-mute-control.vjs-vol-0 .vjs-icon-placeholder:before{content:"\\f104"}.vjs-icon-volume-low,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-volume-low:before,.video-js .vjs-mute-control.vjs-vol-1 .vjs-icon-placeholder:before{content:"\\f105"}.vjs-icon-volume-mid,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-volume-mid:before,.video-js .vjs-mute-control.vjs-vol-2 .vjs-icon-placeholder:before{content:"\\f106"}.vjs-icon-volume-high,.video-js .vjs-mute-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-volume-high:before,.video-js .vjs-mute-control .vjs-icon-placeholder:before{content:"\\f107"}.vjs-icon-fullscreen-enter,.video-js .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-fullscreen-enter:before,.video-js .vjs-fullscreen-control .vjs-icon-placeholder:before{content:"\\f108"}.vjs-icon-fullscreen-exit,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-fullscreen-exit:before,.video-js.vjs-fullscreen .vjs-fullscreen-control .vjs-icon-placeholder:before{content:"\\f109"}.vjs-icon-square{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-square:before{content:"\\f10a"}.vjs-icon-spinner{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-spinner:before{content:"\\f10b"}.vjs-icon-subtitles,.video-js .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-subtitles-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-subtitles:before,.video-js .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-GB) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-IE) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-AU) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js.video-js:lang(en-NZ) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-subtitles-button .vjs-icon-placeholder:before{content:"\\f10c"}.vjs-icon-captions,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder,.video-js .vjs-captions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-captions:before,.video-js:lang(en) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js:lang(fr-CA) .vjs-subs-caps-button .vjs-icon-placeholder:before,.video-js .vjs-captions-button .vjs-icon-placeholder:before{content:"\\f10d"}.vjs-icon-chapters,.video-js .vjs-chapters-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-chapters:before,.video-js .vjs-chapters-button .vjs-icon-placeholder:before{content:"\\f10e"}.vjs-icon-share{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-share:before{content:"\\f10f"}.vjs-icon-cog{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-cog:before{content:"\\f110"}.vjs-icon-circle,.vjs-seek-to-live-control .vjs-icon-placeholder,.video-js .vjs-volume-level,.video-js .vjs-play-progress{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-circle:before,.vjs-seek-to-live-control .vjs-icon-placeholder:before,.video-js .vjs-volume-level:before,.video-js .vjs-play-progress:before{content:"\\f111"}.vjs-icon-circle-outline{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-circle-outline:before{content:"\\f112"}.vjs-icon-circle-inner-circle{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-circle-inner-circle:before{content:"\\f113"}.vjs-icon-hd{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-hd:before{content:"\\f114"}.vjs-icon-cancel,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-cancel:before,.video-js .vjs-control.vjs-close-button .vjs-icon-placeholder:before{content:"\\f115"}.vjs-icon-replay,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-replay:before,.video-js .vjs-play-control.vjs-ended .vjs-icon-placeholder:before{content:"\\f116"}.vjs-icon-facebook{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-facebook:before{content:"\\f117"}.vjs-icon-gplus{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-gplus:before{content:"\\f118"}.vjs-icon-linkedin{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-linkedin:before{content:"\\f119"}.vjs-icon-twitter{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-twitter:before{content:"\\f11a"}.vjs-icon-tumblr{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-tumblr:before{content:"\\f11b"}.vjs-icon-pinterest{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-pinterest:before{content:"\\f11c"}.vjs-icon-audio-description,.video-js .vjs-descriptions-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-audio-description:before,.video-js .vjs-descriptions-button .vjs-icon-placeholder:before{content:"\\f11d"}.vjs-icon-audio,.video-js .vjs-audio-button .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-audio:before,.video-js .vjs-audio-button .vjs-icon-placeholder:before{content:"\\f11e"}.vjs-icon-next-item{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-next-item:before{content:"\\f11f"}.vjs-icon-previous-item{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-previous-item:before{content:"\\f120"}.vjs-icon-picture-in-picture-enter,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-picture-in-picture-enter:before,.video-js .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:"\\f121"}.vjs-icon-picture-in-picture-exit,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder{font-family:VideoJS;font-weight:normal;font-style:normal}.vjs-icon-picture-in-picture-exit:before,.video-js.vjs-picture-in-picture .vjs-picture-in-picture-control .vjs-icon-placeholder:before{content:"\\f122"}.video-js{display:block;vertical-align:top;box-sizing:border-box;color:#fff;background-color:#000;position:relative;padding:0;font-size:10px;line-height:1;font-weight:normal;font-style:normal;font-family:Arial,Helvetica,sans-serif;word-break:initial}.video-js:-moz-full-screen{position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js[tabindex="-1"]{outline:none}.video-js *,.video-js *:before,.video-js *:after{box-sizing:inherit}.video-js ul{font-family:inherit;font-size:inherit;line-height:inherit;list-style-position:outside;margin:0}.video-js.vjs-fluid,.video-js.vjs-16-9,.video-js.vjs-4-3,.video-js.vjs-9-16,.video-js.vjs-1-1{width:100%;max-width:100%}.video-js.vjs-fluid:not(.vjs-audio-only-mode),.video-js.vjs-16-9:not(.vjs-audio-only-mode),.video-js.vjs-4-3:not(.vjs-audio-only-mode),.video-js.vjs-9-16:not(.vjs-audio-only-mode),.video-js.vjs-1-1:not(.vjs-audio-only-mode){height:0}.video-js.vjs-16-9:not(.vjs-audio-only-mode){padding-top:56.25%}.video-js.vjs-4-3:not(.vjs-audio-only-mode){padding-top:75%}.video-js.vjs-9-16:not(.vjs-audio-only-mode){padding-top:177.7777777778%}.video-js.vjs-1-1:not(.vjs-audio-only-mode){padding-top:100%}.video-js.vjs-fill:not(.vjs-audio-only-mode){width:100%;height:100%}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js.vjs-audio-only-mode .vjs-tech{display:none}body.vjs-full-window{padding:0;margin:0;height:100%}.vjs-full-window .video-js.vjs-fullscreen{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0}.video-js.vjs-fullscreen:not(.vjs-ios-native-fs){width:100%!important;height:100%!important;padding-top:0!important}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-hidden{display:none!important}.vjs-disabled{opacity:.5;cursor:default}.video-js .vjs-offscreen{height:1px;left:-9999px;position:absolute;top:0;width:1px}.vjs-lock-showing{display:block!important;opacity:1!important;visibility:visible!important}.vjs-no-js{padding:20px;color:#fff;background-color:#000;font-size:18px;font-family:Arial,Helvetica,sans-serif;text-align:center;width:300px;height:150px;margin:0 auto}.vjs-no-js a,.vjs-no-js a:visited{color:#66a8cc}.video-js .vjs-big-play-button{font-size:3em;line-height:1.5em;height:1.63332em;width:3em;display:block;position:absolute;top:10px;left:10px;padding:0;cursor:pointer;opacity:1;border:.06666em solid #fff;background-color:#2b333f;background-color:#2b333fb3;border-radius:.3em;transition:all .4s}.vjs-big-play-centered .vjs-big-play-button{top:50%;left:50%;margin-top:-.81666em;margin-left:-1.5em}.video-js:hover .vjs-big-play-button,.video-js .vjs-big-play-button:focus{border-color:#fff;background-color:#73859f;background-color:#73859f80;transition:all 0s}.vjs-controls-disabled .vjs-big-play-button,.vjs-has-started .vjs-big-play-button,.vjs-using-native-controls .vjs-big-play-button,.vjs-error .vjs-big-play-button{display:none}.vjs-has-started.vjs-paused.vjs-show-big-play-button-on-pause .vjs-big-play-button{display:block}.video-js button{background:none;border:none;color:inherit;display:inline-block;font-size:inherit;line-height:inherit;text-transform:none;text-decoration:none;transition:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vjs-control .vjs-button{width:100%;height:100%}.video-js .vjs-control.vjs-close-button{cursor:pointer;height:3em;position:absolute;right:0;top:.5em;z-index:2}.video-js .vjs-modal-dialog{background:rgba(0,0,0,.8);background:linear-gradient(180deg,rgba(0,0,0,.8),rgba(255,255,255,0));overflow:auto}.video-js .vjs-modal-dialog>*{box-sizing:border-box}.vjs-modal-dialog .vjs-modal-dialog-content{font-size:1.2em;line-height:1.5;padding:20px 24px;z-index:1}.vjs-menu-button{cursor:pointer}.vjs-menu-button.vjs-disabled{cursor:default}.vjs-workinghover .vjs-menu-button.vjs-disabled:hover .vjs-menu{display:none}.vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;font-family:Arial,Helvetica,sans-serif;overflow:auto}.vjs-menu .vjs-menu-content>*{box-sizing:border-box}.vjs-scrubbing .vjs-control.vjs-menu-button:hover .vjs-menu{display:none}.vjs-menu li{list-style:none;margin:0;padding:.2em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.vjs-menu li.vjs-menu-item:focus,.vjs-menu li.vjs-menu-item:hover,.js-focus-visible .vjs-menu li.vjs-menu-item:hover{background-color:#73859f;background-color:#73859f80}.vjs-menu li.vjs-selected,.vjs-menu li.vjs-selected:focus,.vjs-menu li.vjs-selected:hover,.js-focus-visible .vjs-menu li.vjs-selected:hover{background-color:#fff;color:#2b333f}.video-js .vjs-menu *:not(.vjs-selected):focus:not(:focus-visible),.js-focus-visible .vjs-menu *:not(.vjs-selected):focus:not(.focus-visible){background:none}.vjs-menu li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:bold;cursor:default}.vjs-menu-button-popup .vjs-menu{display:none;position:absolute;bottom:0;width:10em;left:-3em;height:0em;margin-bottom:1.5em;border-top-color:#2b333fb3}.vjs-menu-button-popup .vjs-menu .vjs-menu-content{background-color:#2b333f;background-color:#2b333fb3;position:absolute;width:100%;bottom:1.5em;max-height:15em}.vjs-layout-tiny .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:5em}.vjs-layout-small .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:10em}.vjs-layout-medium .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:14em}.vjs-layout-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-x-large .vjs-menu-button-popup .vjs-menu .vjs-menu-content,.vjs-layout-huge .vjs-menu-button-popup .vjs-menu .vjs-menu-content{max-height:25em}.vjs-workinghover .vjs-menu-button-popup.vjs-hover .vjs-menu,.vjs-menu-button-popup .vjs-menu.vjs-lock-showing{display:block}.video-js .vjs-menu-button-inline{transition:all .4s;overflow:hidden}.video-js .vjs-menu-button-inline:before{width:2.222222222em}.video-js .vjs-menu-button-inline:hover,.video-js .vjs-menu-button-inline:focus,.video-js .vjs-menu-button-inline.vjs-slider-active,.video-js.vjs-no-flex .vjs-menu-button-inline{width:12em}.vjs-menu-button-inline .vjs-menu{opacity:0;height:100%;width:auto;position:absolute;left:4em;top:0;padding:0;margin:0;transition:all .4s}.vjs-menu-button-inline:hover .vjs-menu,.vjs-menu-button-inline:focus .vjs-menu,.vjs-menu-button-inline.vjs-slider-active .vjs-menu{display:block;opacity:1}.vjs-no-flex .vjs-menu-button-inline .vjs-menu{display:block;opacity:1;position:relative;width:auto}.vjs-no-flex .vjs-menu-button-inline:hover .vjs-menu,.vjs-no-flex .vjs-menu-button-inline:focus .vjs-menu,.vjs-no-flex .vjs-menu-button-inline.vjs-slider-active .vjs-menu{width:auto}.vjs-menu-button-inline .vjs-menu-content{width:auto;height:100%;margin:0;overflow:hidden}.video-js .vjs-control-bar{display:none;width:100%;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#2b333f;background-color:#2b333fb3}.vjs-has-started .vjs-control-bar,.vjs-audio-only-mode .vjs-control-bar{display:flex;visibility:visible;opacity:1;transition:visibility .1s,opacity .1s}.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{visibility:visible;opacity:0;pointer-events:none;transition:visibility 1s,opacity 1s}.vjs-controls-disabled .vjs-control-bar,.vjs-using-native-controls .vjs-control-bar,.vjs-error .vjs-control-bar{display:none!important}.vjs-audio.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar,.vjs-audio-only-mode.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{opacity:1;visibility:visible;pointer-events:auto}.vjs-has-started.vjs-no-flex .vjs-control-bar{display:table}.video-js .vjs-control{position:relative;text-align:center;margin:0;padding:0;height:100%;width:4em;flex:none}.video-js .vjs-control.vjs-visible-text{width:auto;padding-left:1em;padding-right:1em}.vjs-button>.vjs-icon-placeholder:before{font-size:1.8em;line-height:1.67}.vjs-button>.vjs-icon-placeholder{display:block}.video-js .vjs-control:focus:before,.video-js .vjs-control:hover:before,.video-js .vjs-control:focus{text-shadow:0em 0em 1em white}.video-js *:not(.vjs-visible-text)>.vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.vjs-no-flex .vjs-control{display:table-cell;vertical-align:middle}.video-js .vjs-custom-control-spacer{display:none}.video-js .vjs-progress-control{cursor:pointer;flex:auto;display:flex;align-items:center;min-width:4em;touch-action:none}.video-js .vjs-progress-control.disabled{cursor:default}.vjs-live .vjs-progress-control{display:none}.vjs-liveui .vjs-progress-control{display:flex;align-items:center}.vjs-no-flex .vjs-progress-control{width:auto}.video-js .vjs-progress-holder{flex:auto;transition:all .2s;height:.3em}.video-js .vjs-progress-control .vjs-progress-holder{margin:0 10px}.video-js .vjs-progress-control:hover .vjs-progress-holder{font-size:1.6666666667em}.video-js .vjs-progress-control:hover .vjs-progress-holder.disabled{font-size:1em}.video-js .vjs-progress-holder .vjs-play-progress,.video-js .vjs-progress-holder .vjs-load-progress,.video-js .vjs-progress-holder .vjs-load-progress div{position:absolute;display:block;height:100%;margin:0;padding:0;width:0}.video-js .vjs-play-progress{background-color:#fff}.video-js .vjs-play-progress:before{font-size:.9em;position:absolute;right:-.5em;top:-.3333333333em;z-index:1}.video-js .vjs-load-progress{background:rgba(115,133,159,.5)}.video-js .vjs-load-progress div{background:rgba(115,133,159,.75)}.video-js .vjs-time-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-progress-holder:focus .vjs-time-tooltip{display:none}.video-js .vjs-progress-control:hover .vjs-time-tooltip,.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip{display:block;font-size:.6em;visibility:visible}.video-js .vjs-progress-control.disabled:hover .vjs-time-tooltip{font-size:1em}.video-js .vjs-progress-control .vjs-mouse-display{display:none;position:absolute;width:1px;height:100%;background-color:#000;z-index:1}.vjs-no-flex .vjs-progress-control .vjs-mouse-display{z-index:0}.video-js .vjs-progress-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-progress-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.video-js.vjs-user-inactive.vjs-no-flex .vjs-progress-control .vjs-mouse-display{display:none}.vjs-mouse-display .vjs-time-tooltip{color:#fff;background-color:#000;background-color:#000c}.video-js .vjs-slider{position:relative;cursor:pointer;padding:0;margin:0 .45em;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#73859f;background-color:#73859f80}.video-js .vjs-slider.disabled{cursor:default}.video-js .vjs-slider:focus{text-shadow:0em 0em 1em white;box-shadow:0 0 1em #fff}.video-js .vjs-mute-control{cursor:pointer;flex:none}.video-js .vjs-volume-control{cursor:pointer;margin-right:1em;display:flex}.video-js .vjs-volume-control.vjs-volume-horizontal{width:5em}.video-js .vjs-volume-panel .vjs-volume-control{visibility:visible;opacity:0;width:1px;height:1px;margin-left:-1px}.video-js .vjs-volume-panel{transition:width 1s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control,.video-js .vjs-volume-panel:active .vjs-volume-control,.video-js .vjs-volume-panel:focus .vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control:active,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active{visibility:visible;opacity:1;position:relative;transition:visibility .1s,opacity .1s,height .1s,width .1s,left 0s,top 0s}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-horizontal,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-horizontal,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-horizontal{width:5em;height:3em;margin-right:0}.video-js .vjs-volume-panel.vjs-hover .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:active .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel:focus .vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control:active.vjs-volume-vertical,.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control~.vjs-volume-control.vjs-volume-vertical,.video-js .vjs-volume-panel .vjs-volume-control.vjs-slider-active.vjs-volume-vertical{left:-3.5em;transition:left 0s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active{width:10em;transition:width .1s}.video-js .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-mute-toggle-only{width:4em}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{height:8em;width:3em;left:-3000em;transition:visibility 1s,opacity 1s,height 1s 1s,width 1s 1s,left 1s 1s,top 1s 1s}.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{transition:visibility 1s,opacity 1s,height 1s 1s,width 1s,left 1s 1s,top 1s 1s}.video-js.vjs-no-flex .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal{width:5em;height:3em;visibility:visible;opacity:1;position:relative;transition:none}.video-js.vjs-no-flex .vjs-volume-control.vjs-volume-vertical,.video-js.vjs-no-flex .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical{position:absolute;bottom:3em;left:.5em}.video-js .vjs-volume-panel{display:flex}.video-js .vjs-volume-bar{margin:1.35em .45em}.vjs-volume-bar.vjs-slider-horizontal{width:5em;height:.3em}.vjs-volume-bar.vjs-slider-vertical{width:.3em;height:5em;margin:1.35em auto}.video-js .vjs-volume-level{position:absolute;bottom:0;left:0;background-color:#fff}.video-js .vjs-volume-level:before{position:absolute;font-size:.9em;z-index:1}.vjs-slider-vertical .vjs-volume-level{width:.3em}.vjs-slider-vertical .vjs-volume-level:before{top:-.5em;left:-.3em;z-index:1}.vjs-slider-horizontal .vjs-volume-level{height:.3em}.vjs-slider-horizontal .vjs-volume-level:before{top:-.3em;right:-.5em}.video-js .vjs-volume-panel.vjs-volume-panel-vertical{width:4em}.vjs-volume-bar.vjs-slider-vertical .vjs-volume-level{height:100%}.vjs-volume-bar.vjs-slider-horizontal .vjs-volume-level{width:100%}.video-js .vjs-volume-vertical{width:3em;height:8em;bottom:8em;background-color:#2b333f;background-color:#2b333fb3}.video-js .vjs-volume-horizontal .vjs-menu{left:-2em}.video-js .vjs-volume-tooltip{background-color:#fff;background-color:#fffc;border-radius:.3em;color:#000;float:right;font-family:Arial,Helvetica,sans-serif;font-size:1em;padding:6px 8px 8px;pointer-events:none;position:absolute;top:-3.4em;visibility:hidden;z-index:1}.video-js .vjs-volume-control:hover .vjs-volume-tooltip,.video-js .vjs-volume-control:hover .vjs-progress-holder:focus .vjs-volume-tooltip{display:block;font-size:1em;visibility:visible}.video-js .vjs-volume-vertical:hover .vjs-volume-tooltip,.video-js .vjs-volume-vertical:hover .vjs-progress-holder:focus .vjs-volume-tooltip{left:1em;top:-12px}.video-js .vjs-volume-control.disabled:hover .vjs-volume-tooltip{font-size:1em}.video-js .vjs-volume-control .vjs-mouse-display{display:none;position:absolute;width:100%;height:1px;background-color:#000;z-index:1}.video-js .vjs-volume-horizontal .vjs-mouse-display{width:1px;height:100%}.vjs-no-flex .vjs-volume-control .vjs-mouse-display{z-index:0}.video-js .vjs-volume-control:hover .vjs-mouse-display{display:block}.video-js.vjs-user-inactive .vjs-volume-control .vjs-mouse-display{visibility:hidden;opacity:0;transition:visibility 1s,opacity 1s}.video-js.vjs-user-inactive.vjs-no-flex .vjs-volume-control .vjs-mouse-display{display:none}.vjs-mouse-display .vjs-volume-tooltip{color:#fff;background-color:#000;background-color:#000c}.vjs-poster{display:inline-block;vertical-align:middle;background-repeat:no-repeat;background-position:50% 50%;background-size:contain;background-color:#000;cursor:pointer;margin:0;padding:0;position:absolute;top:0;right:0;bottom:0;left:0;height:100%}.vjs-has-started .vjs-poster,.vjs-using-native-controls .vjs-poster{display:none}.vjs-audio.vjs-has-started .vjs-poster,.vjs-has-started.vjs-audio-poster-mode .vjs-poster{display:block}.video-js .vjs-live-control{display:flex;align-items:flex-start;flex:auto;font-size:1em;line-height:3em}.vjs-no-flex .vjs-live-control{display:table-cell;width:auto;text-align:left}.video-js:not(.vjs-live) .vjs-live-control,.video-js.vjs-liveui .vjs-live-control{display:none}.video-js .vjs-seek-to-live-control{align-items:center;cursor:pointer;flex:none;display:inline-flex;height:100%;padding-left:.5em;padding-right:.5em;font-size:1em;line-height:3em;width:auto;min-width:4em}.vjs-no-flex .vjs-seek-to-live-control{display:table-cell;width:auto;text-align:left}.video-js.vjs-live:not(.vjs-liveui) .vjs-seek-to-live-control,.video-js:not(.vjs-live) .vjs-seek-to-live-control{display:none}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge{cursor:auto}.vjs-seek-to-live-control .vjs-icon-placeholder{margin-right:.5em;color:#888}.vjs-seek-to-live-control.vjs-control.vjs-at-live-edge .vjs-icon-placeholder{color:red}.video-js .vjs-time-control{flex:none;font-size:1em;line-height:3em;min-width:2em;width:auto;padding-left:1em;padding-right:1em}.vjs-live .vjs-time-control{display:none}.video-js .vjs-current-time,.vjs-no-flex .vjs-current-time{display:none}.video-js .vjs-duration,.vjs-no-flex .vjs-duration{display:none}.vjs-time-divider{display:none;line-height:3em}.vjs-live .vjs-time-divider{display:none}.video-js .vjs-play-control{cursor:pointer}.video-js .vjs-play-control .vjs-icon-placeholder{flex:none}.vjs-text-track-display{position:absolute;bottom:3em;left:0;right:0;top:0;pointer-events:none}.video-js.vjs-controls-disabled .vjs-text-track-display,.video-js.vjs-user-inactive.vjs-playing .vjs-text-track-display{bottom:1em}.video-js .vjs-text-track{font-size:1.4em;text-align:center;margin-bottom:.1em}.vjs-subtitles{color:#fff}.vjs-captions{color:#fc6}.vjs-tt-cue{display:block}video::-webkit-media-text-track-display{transform:translateY(-3em)}.video-js.vjs-controls-disabled video::-webkit-media-text-track-display,.video-js.vjs-user-inactive.vjs-playing video::-webkit-media-text-track-display{transform:translateY(-1.5em)}.video-js .vjs-picture-in-picture-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-picture-in-picture-control{display:none}.video-js .vjs-fullscreen-control{cursor:pointer;flex:none}.video-js.vjs-audio-only-mode .vjs-fullscreen-control{display:none}.vjs-playback-rate>.vjs-menu-button,.vjs-playback-rate .vjs-playback-rate-value{position:absolute;top:0;left:0;width:100%;height:100%}.vjs-playback-rate .vjs-playback-rate-value{pointer-events:none;font-size:1.5em;line-height:2;text-align:center}.vjs-playback-rate .vjs-menu{width:4em;left:0em}.vjs-error .vjs-error-display .vjs-modal-dialog-content{font-size:1.4em;text-align:center}.vjs-error .vjs-error-display:before{color:#fff;content:"X";font-family:Arial,Helvetica,sans-serif;font-size:4em;left:0;line-height:1;margin-top:-.5em;position:absolute;text-shadow:.05em .05em .1em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;opacity:.85;text-align:left;border:6px solid rgba(43,51,63,.7);box-sizing:border-box;background-clip:padding-box;width:50px;height:50px;border-radius:25px;visibility:hidden}.vjs-seeking .vjs-loading-spinner,.vjs-waiting .vjs-loading-spinner{display:block;-webkit-animation:vjs-spinner-show 0s linear .3s forwards;animation:vjs-spinner-show 0s linear .3s forwards}.vjs-loading-spinner:before,.vjs-loading-spinner:after{content:"";position:absolute;margin:-6px;box-sizing:inherit;width:inherit;height:inherit;border-radius:inherit;opacity:1;border:inherit;border-color:transparent;border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:before,.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:after{-webkit-animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite;animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}.vjs-seeking .vjs-loading-spinner:before,.vjs-waiting .vjs-loading-spinner:before{border-top-color:#fff}.vjs-seeking .vjs-loading-spinner:after,.vjs-waiting .vjs-loading-spinner:after{border-top-color:#fff;-webkit-animation-delay:.44s;animation-delay:.44s}@keyframes vjs-spinner-show{to{visibility:visible}}@-webkit-keyframes vjs-spinner-show{to{visibility:visible}}@keyframes vjs-spinner-spin{to{transform:rotate(360deg)}}@-webkit-keyframes vjs-spinner-spin{to{-webkit-transform:rotate(360deg)}}@keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}@-webkit-keyframes vjs-spinner-fade{0%{border-top-color:#73859f}20%{border-top-color:#73859f}35%{border-top-color:#fff}60%{border-top-color:#73859f}to{border-top-color:#73859f}}.video-js.vjs-audio-only-mode .vjs-captions-button{display:none}.vjs-chapters-button .vjs-menu ul{width:24em}.video-js.vjs-audio-only-mode .vjs-descriptions-button{display:none}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-subs-caps-button+.vjs-menu .vjs-captions-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:"\\f10d";font-size:1.5em;line-height:inherit}.video-js.vjs-audio-only-mode .vjs-subs-caps-button{display:none}.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder{vertical-align:middle;display:inline-block;margin-bottom:-.1em}.video-js .vjs-audio-button+.vjs-menu .vjs-main-desc-menu-item .vjs-menu-item-text .vjs-icon-placeholder:before{font-family:VideoJS;content:" \\f11d";font-size:1.5em;line-height:inherit}.video-js.vjs-layout-small .vjs-current-time,.video-js.vjs-layout-small .vjs-time-divider,.video-js.vjs-layout-small .vjs-duration,.video-js.vjs-layout-small .vjs-remaining-time,.video-js.vjs-layout-small .vjs-playback-rate,.video-js.vjs-layout-small .vjs-volume-control,.video-js.vjs-layout-x-small .vjs-current-time,.video-js.vjs-layout-x-small .vjs-time-divider,.video-js.vjs-layout-x-small .vjs-duration,.video-js.vjs-layout-x-small .vjs-remaining-time,.video-js.vjs-layout-x-small .vjs-playback-rate,.video-js.vjs-layout-x-small .vjs-volume-control,.video-js.vjs-layout-tiny .vjs-current-time,.video-js.vjs-layout-tiny .vjs-time-divider,.video-js.vjs-layout-tiny .vjs-duration,.video-js.vjs-layout-tiny .vjs-remaining-time,.video-js.vjs-layout-tiny .vjs-playback-rate,.video-js.vjs-layout-tiny .vjs-volume-control{display:none}.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-x-small .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:hover,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal:active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-slider-active,.video-js.vjs-layout-tiny .vjs-volume-panel.vjs-volume-panel-horizontal.vjs-hover{width:auto;width:initial}.video-js.vjs-layout-x-small .vjs-progress-control,.video-js.vjs-layout-tiny .vjs-progress-control{display:none}.video-js.vjs-layout-x-small .vjs-custom-control-spacer{flex:auto;display:block}.video-js.vjs-layout-x-small.vjs-no-flex .vjs-custom-control-spacer{width:auto}.vjs-modal-dialog.vjs-text-track-settings{background-color:#2b333f;background-color:#2b333fbf;color:#fff;height:70%}.vjs-text-track-settings .vjs-modal-dialog-content{display:table}.vjs-text-track-settings .vjs-track-settings-colors,.vjs-text-track-settings .vjs-track-settings-font,.vjs-text-track-settings .vjs-track-settings-controls{display:table-cell}.vjs-text-track-settings .vjs-track-settings-controls{text-align:right;vertical-align:bottom}@supports (display: grid){.vjs-text-track-settings .vjs-modal-dialog-content{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr;padding:20px 24px 0}.vjs-track-settings-controls .vjs-default-button{margin-bottom:20px}.vjs-text-track-settings .vjs-track-settings-controls{grid-column:1/-1}.vjs-layout-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-x-small .vjs-text-track-settings .vjs-modal-dialog-content,.vjs-layout-tiny .vjs-text-track-settings .vjs-modal-dialog-content{grid-template-columns:1fr}}.vjs-track-setting>select{margin-right:1em;margin-bottom:.5em}.vjs-text-track-settings fieldset{margin:5px;padding:3px;border:none}.vjs-text-track-settings fieldset span{display:inline-block}.vjs-text-track-settings fieldset span>select{max-width:7.3em}.vjs-text-track-settings legend{color:#fff;margin:0 0 5px}.vjs-text-track-settings .vjs-label{position:absolute;clip:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px);display:block;margin:0 0 5px;padding:0;border:0;height:1px;width:1px;overflow:hidden}.vjs-track-settings-controls button:focus,.vjs-track-settings-controls button:active{outline-style:solid;outline-width:medium;background-image:linear-gradient(0deg,#fff 88%,#73859f 100%)}.vjs-track-settings-controls button:hover{color:#2b333fbf}.vjs-track-settings-controls button{background-color:#fff;background-image:linear-gradient(-180deg,#fff 88%,#73859f 100%);color:#2b333f;cursor:pointer;border-radius:2px}.vjs-track-settings-controls .vjs-default-button{margin-right:1em}@media print{.video-js>*:not(.vjs-tech):not(.vjs-poster){visibility:hidden}}.vjs-resize-manager{position:absolute;top:0;left:0;width:100%;height:100%;border:none;z-index:-1000}.js-focus-visible .video-js *:focus:not(.focus-visible){outline:none}.video-js *:focus:not(:focus-visible){outline:none}.popup-video{position:absolute;z-index:999}.popup-video .popup-video-header{background:rgb(15,85,195);color:#fff;font-size:15px;padding:10px;text-align:left}.popup-video .popup-video-header .popup-video-close-button{position:absolute;right:10px;cursor:pointer}.popup-video .popup-video-content{padding:0;width:400px}.popup-video .popup-video-tip{position:absolute;bottom:-25px;left:50%;margin-left:-15px;width:0;height:0;border-left:15px solid transparent;border-right:15px solid transparent;border-top:25px solid rgb(15,85,195)}.popup-video2{position:absolute;z-index:999;background:linear-gradient(180deg,rgba(5,31,72,.8) 0%,rgba(1,12,31,.8) 100%);border:1px solid #2177f5;color:#fff}.popup-video2 .rightLine-1{position:absolute;top:0;background:#2177f5;width:4em;right:-4em;height:.2em}.popup-video2 .rightLine-2{position:absolute;top:2.2em;right:-9em;background:#2177f5;width:6em;height:.2em;transform:rotate(47deg);-ms-transform:rotate(47deg);-moz-transform:rotate(47deg);-webkit-transform:rotate(47deg);-o-transform:rotate(47deg)}.popup-video2 .rightLine-3{position:absolute;top:4em;right:-8.6em;width:1em;height:1em;background:#2177f5;background-size:100% 100%;border:solid 4px rgb(250,172,47);border-radius:100%}.popup-video2 .popup-header{width:100%;height:30px;line-height:30px;text-align:center;background:linear-gradient(180deg,rgba(5,31,72,.8) 0%,rgba(1,12,31,.8) 100%)}.popup-video2 .popup-header .popup-title{float:left;padding-left:10px}.popup-video2 .popup-header .popup-close-button{float:right;padding-right:10px;cursor:pointer}.popup-video2 .popup-content{padding:0;width:400px}.popup1{position:absolute;z-index:999}.popup1 .popup-header{background:rgb(15,85,195);color:#fff;font-size:15px;padding:10px;text-align:left}.popup1 .popup-header .leaflet-popup-close-button{position:absolute;right:10px;cursor:pointer}.popup1 .popup-content{padding:5px;background:rgba(5,45,115,.7);color:#a0ffff;text-align:left}.popup1 .popup-tip{position:absolute;bottom:-25px;left:50%;margin-left:-15px;width:0;height:0;border-left:15px solid transparent;border-right:15px solid transparent;border-top:25px solid rgba(5,45,115,.7)}.popup2{position:absolute;z-index:999;background:linear-gradient(180deg,rgba(5,31,72,.8) 0%,rgba(1,12,31,.8) 100%);border:1px solid #2177f5;color:#fff}.popup2 .rightLine-1{position:absolute;top:0;background:#2177f5;width:4em;right:-4em;height:.2em}.popup2 .rightLine-2{position:absolute;top:2.2em;right:-9em;background:#2177f5;width:6em;height:.2em;transform:rotate(47deg);-ms-transform:rotate(47deg);-moz-transform:rotate(47deg);-webkit-transform:rotate(47deg);-o-transform:rotate(47deg)}.popup2 .rightLine-3{position:absolute;top:4em;right:-8.6em;width:1em;height:1em;background:#2177f5;background-size:100% 100%;border:solid 4px rgb(250,172,47);border-radius:100%}.popup2 .popup-header{width:100%;height:30px;line-height:30px;text-align:center;background:linear-gradient(180deg,rgba(5,31,72,.8) 0%,rgba(1,12,31,.8) 100%)}.popup2 .popup-header .popup-title{float:left;padding-left:10px}.popup2 .popup-header .popup-close-button{float:right;padding-right:10px;cursor:pointer}.popup2 .popup-content{padding:5px;width:360px;height:200px;overflow:auto}.popup3{position:absolute;z-index:999;background:linear-gradient(180deg,rgba(5,31,72,.8) 0%,rgba(1,12,31,.8) 100%);border-bottom:3px solid rgb(250,172,47);color:#fff}.popup3 .leftLine-1{position:absolute;bottom:-2.55em;left:-4.6em;background:rgb(250,172,47);width:6em;height:.2em;transform:rotate(125deg);-ms-transform:rotate(125deg);-moz-transform:rotate(125deg);-webkit-transform:rotate(125deg);-o-transform:rotate(125deg)}.popup3 .leftLine-2{position:absolute;bottom:-5.6em;left:-4em;width:1em;height:1em;background:#fff;background-size:100% 100%;border:4px solid rgb(250,172,47);border-radius:100%}.popup3 .popup-header{width:100%;height:30px;line-height:30px;text-align:center;background:rgba(31,63,142,1)}.popup3 .popup-header .popup-title{float:left;padding-left:10px}.popup3 .popup-header .popup-close-button{float:right;padding-right:10px;cursor:pointer}.popup3 .popup-content{padding:5px;width:360px;height:200px;overflow:auto}\n',document.head.appendChild(__vite_style__),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).MyLib={})}(this,(function(e){"use strict";function i(e){return null!=e&&""!==e}function n(e){let t;this.name="DeveloperError",this.message=e;try{throw new Error}catch(i){t=i.stack}this.stack=t}i(Object.create)&&(n.prototype=Object.create(Error.prototype),n.prototype.constructor=n),n.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return i(this.stack)&&(e+=`\n${this.stack.toString()}`),e},n.throwInstantiationError=function(){throw new n("This function defines an interface and should not be called directly.")};const r={};function o(e,t,i){return`Expected ${i} to be typeof ${t}, actual typeof was ${e}`}r.typeOf={},r.defined=function(e,t){if(!i(t))throw new n(function(e){return`${e} is required, actual value was undefined`}(e))},r.typeOf.func=function(e,t){if("function"!=typeof t)throw new n(o(typeof t,"function",e))},r.typeOf.string=function(e,t){if("string"!=typeof t)throw new n(o(typeof t,"string",e))},r.typeOf.number=function(e,t){if("number"!=typeof t)throw new n(o(typeof t,"number",e))},r.typeOf.number.lessThan=function(e,t,i){if(r.typeOf.number(e,t),t>=i)throw new n(`Expected ${e} to be less than ${i}, actual value was ${t}`)},r.typeOf.number.lessThanOrEquals=function(e,t,i){if(r.typeOf.number(e,t),t>i)throw new n(`Expected ${e} to be less than or equal to ${i}, actual value was ${t}`)},r.typeOf.number.greaterThan=function(e,t,i){if(r.typeOf.number(e,t),t<=i)throw new n(`Expected ${e} to be greater than ${i}, actual value was ${t}`)},r.typeOf.number.greaterThanOrEquals=function(e,t,i){if(r.typeOf.number(e,t),t<i)throw new n(`Expected ${e} to be greater than or equal to ${i}, actual value was ${t}`)},r.typeOf.object=function(e,t){if("object"!=typeof t)throw new n(o(typeof t,"object",e))},r.typeOf.bool=function(e,t){if("boolean"!=typeof t)throw new n(o(typeof t,"boolean",e))},r.typeOf.bigint=function(e,t){if("bigint"!=typeof t)throw new n(o(typeof t,"bigint",e))},r.typeOf.number.equals=function(e,t,i,o){if(r.typeOf.number(e,i),r.typeOf.number(t,o),i!==o)throw new n(`${e} must be equal to ${t}, the actual values are ${i} and ${o}`)};const s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");class a{static uuid(e="D"){let t,i=[];i[8]=i[13]=i[18]=i[23]="-",i[14]="4";for(let n=0;n<36;n++)i[n]||(t=0|16*Math.random(),i[n]=s[19==n?3&t|8:t]);return e+"-"+i.join("")}static merge(e,...t){let i,n,r,o;for(n=0,r=t.length;n<r;n++)for(i in o=t[n],o)e[i]=o[i];return e}static trim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}static splitWords(e){return this.trim(e).split(/\s+/)}static setOptions(e,t){for(var i in e.hasOwnProperty("options")||(e.options=e.options?create(e.options):{}),t)e.options[i]=t[i];return e.options}static checkPosition(e){return e&&e.hasOwnProperty("_lng")&&e.hasOwnProperty("_lat")&&e.hasOwnProperty("_alt")}static checkPositions(e){return e&&("string"==typeof e||Array.isArray(e))}static checkViewer(e){return e&&e.delegate&&e.canvas}}class l{static get(e){return"string"==typeof e?document.getElementById(e):e}static getStyle(e,t){var i=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!i||"auto"===i)&&document.defaultView){var n=document.defaultView.getComputedStyle(e,null);i=n?n[t]:null}return"auto"===i?null:i}static create(e,t,i){var n=document.createElement(e);return n.className=t||"",i&&i.appendChild(n),n}static remove(e){var t=e.parentNode;t&&t.removeChild(e)}static empty(e){for(;e.firstChild;)e.removeChild(e.firstChild)}hasClass(e,t){if(void 0!==e.classList)return e.classList.contains(t);var i=getClass(e);return i.length>0&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(i)}static addClass(e,t){if(void 0!==e.classList){let i=a.splitWords(t);for(let t=0,n=i.length;t<n;t++)e.classList.add(i[t])}else if(!this.hasClass(e,t)){let i=this.getClass(e);this.setClass(e,(i?i+" ":"")+t)}}static removeClass(e,t){void 0!==e.classList?e.classList.remove(t):this.setClass(e,a.trim((" "+this.getClass(e)+" ").replace(" "+t+" "," ")))}static setClass(e,t){void 0===e.className.baseVal?e.className=t:e.className.baseVal=t}static getClass(e){return e.correspondingElement&&(e=e.correspondingElement),void 0===e.className.baseVal?e.className:e.className.baseVal}static createSvg(e,t,i,n){let r=document.createElementNS("http://www.w3.org/2000/svg","svg:svg");r.setAttribute("class","svg-path"),r.setAttribute("width",e),r.setAttribute("height",t),r.setAttribute("viewBox",`0 0 ${e} ${t}`);let o=document.createElementNS("http://www.w3.org/2000/svg","path");return o.setAttribute("d",i),r.appendChild(o),n&&n.appendChild(r),r}}class u{constructor(e){if(!e)throw new Error("viewer is required!");this._viewer=e,this._show=!1,this._handler,this._posX,this._posY,this._cameraHeight,this._pitch,this._heading,this._scale,this.initListener()}get params(){return{posX:this._posX,posY:this._posY,cameraHeight:this._cameraHeight,pitch:this._pitch,heading:this._heading,scale:this._scale}}get statusDom(){return`<span class="status-all">状态:正常</span>\n <span class="status-position">\n <span>经度:${this._posX}</span>\n <span>纬度:${this._posY}</span>\n <span>相机高度:${this._cameraHeight}</span>\n <span>方向:${this._pitch}</span>\n <span>俯仰角:${this._heading}</span>\n </span>\n <span class="status-scale">\n 比例尺:\n <span class="scale-border">\n ${this._scale}\n </span>\n </span>`}get show(){return this._show}set show(e){e?this.createStatusBar():this.removeStatusBar(),this._show=e}initListener(){const e=this,t=this._viewer.scene;this._scaleListener=function(){let i=t.canvas.clientWidth,n=t.canvas.clientHeight,r=t.camera.getPickRay(new Cesium.Cartesian2(i/2|0,n-1)),o=t.camera.getPickRay(new Cesium.Cartesian2(1+i/2|0,n-1)),s=t.globe,a=s.pick(r,t),l=s.pick(o,t);if(a&&l){let t=new Cesium.EllipsoidGeodesic,i=s.ellipsoid.cartesianToCartographic(a),n=s.ellipsoid.cartesianToCartographic(l);t.setEndPoints(i,n);let r=t.surfaceDistance,o=e.closest(r/10);e._scale=o<1?1e3*o+"m":o+"km"}}}createStatusBar(){const e=this._viewer;this.initHandler(e),this.initScale(e,!0),this._domContainer=l.create("div","lk-status-bar",document.getElementById(this._viewer._container.id))}removeStatusBar(){this.initScale(this._viewer,!1),this._handler&&this._handler.destroy(),this._domContainer&&l.remove(this._domContainer)}initHandler(e){const t=this;this._handler=new Cesium.ScreenSpaceEventHandler(e.scene.canvas);this._handler.setInputAction((function(i){let n=i.endPosition;const r=e.scene.camera.pickEllipsoid(n,e.scene.globe.ellipsoid);if(r){let i=Cesium.Cartographic.fromCartesian(r);t._posX=Cesium.Math.toDegrees(i.longitude).toFixed(5),t._posY=Cesium.Math.toDegrees(i.latitude).toFixed(5);const n=e.camera.positionCartographic.height;t._cameraHeight=n<1e3?n.toFixed(2)+"m":(n/1e3).toFixed(2)+"km",t._pitch=Number(e.scene.camera.pitch).toFixed(2),t._heading=Number(e.scene.camera.heading).toFixed(2),t._domContainer.innerHTML=t.statusDom}}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)}initScale(e,t){const i=e.scene;t?i.postRender.addEventListener(this._scaleListener):i.postRender.removeEventListener(this._scaleListener)}closest(e){const t=[.001,.002,.003,.005,.01,.015,.02,.025,.03,.035,.04,.045,.05,.06,.07,.08,.09,.1,.12,.15,.2,.25,.3,.5,1,2,3,5,10,15,20,25,30,35,40,45,50,60,70,80,90,100,120,150,200,250,300,500,1e3,2e3,5e3,1e4,1e5,5e5,1e6];let i=t[0],n=Math.abs(i-e);for(let r=1;r<t.length;r++){let o=Math.abs(t[r]-e);o<n&&(n=o,i=t[r])}return i}}class c{constructor(e){if(!i(e)||!i(e.container))throw new n("options.container is required.");if(Cesium.Ion.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxNzM5YjQ3MC03YmMxLTRmMjAtOTk4Yi0yNDMyMDZlOTQzYTYiLCJpZCI6NTU5MjAsImlhdCI6MTYyNDI0NTM5NX0.diydVWFzw5C5rQlHaFYkdDJoSorcdex81KpWcntyICo",this._viewer=this._initMap(e),this._imageryLayers=this._viewer.imageryLayers,this._primitives=this._viewer.scene.primitives,this._entities=this._viewer.entities,this._dataSources=this._viewer.dataSources,this._defaultSkyBox=this._viewer.scene.skyBox,this.statusBar=new u(this._viewer),i(e.imageryProviderType)){if(!i(e.imageryProviderUrl))throw new n("imageryProviderType and imageryProviderUrl are required.");var t=void 0;"SingleTileImageryProvider"==e.imageryProviderType?t=new Cesium.SingleTileImageryProvider({url:e.imageryProviderUrl}):"OpenStreetMapImageryProvider"==e.imageryProviderType?t=new Cesium.OpenStreetMapImageryProvider({url:e.imageryProviderUrl}):"ArcGisMapServerImageryProvider"==e.imageryProviderType&&(t=new Cesium.ArcGisMapServerImageryProvider({url:e.imageryProviderUrl})),this._imageryLayers.addImageryProvider(t)}console.log(Cesium.buildModuleUrl.getCesiumBaseUrl())}_initMap(e){let t=new Cesium.Viewer(e.container,{animation:!0,timeline:!0,shadows:!1,shouldAnimate:!1,baseLayerPicker:!1,navigationHelpButton:!1,homeButton:!1,fullscreenButton:!1,sceneModePicker:!1,scene3DOnly:!0,infoBox:!1,clampToGround:!0,geocoder:!1,selectionIndicator:!1,contextOptions:{webgl:{alpha:!0,depth:!0,stencil:!0,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,failIfMajorPerformanceCaveat:!0}}});function i(e,t,i){var n=new Cesium.JulianDate;Cesium.JulianDate.addHours(e,8,n);var r,o=Cesium.JulianDate.toGregorianDate(n);if(i)r="";else if(r=new Date(o.year,o.month-1,o.day),r=o.year+"-"+r.toLocaleString("zh-cn",{month:"short"}).split("月").join("-")+o.day+" ",t||o.hour+o.minute===0)return r;let s,a,l;return s=o.hour<10?`0${o.hour}`:o.hour,a=o.minute<10?`0${o.minute}`:o.minute,l=o.second<10?`0${o.second}`:o.second,r+s+":"+a+":"+l}return t._cesiumWidget._creditContainer.style.display="none",t.scene.globe.show=!0,t.scene.globe.depthTestAgainstTerrain=!0,t.scene.globe.enableLighting=!1,t.scene.debugShowFramesPerSecond=!0,t.scene.skyAtmosphere.show=!1,t.scene.skyBox.show=!0,t.scene.sun.show=!0,t.scene.moon.show=!0,t.scene.requestRenderMode=!0,t.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),t.animation.viewModel.dateFormatter=i,t.animation.viewModel.timeFormatter=function(e,t){return i(e,t,!0)},t.timeline.makeLabel=i,t}_setView(e){if(!i(e.longitude)&&!i(e.latitude))throw new n("longitude and latitude are required.");r.typeOf.number("longitude",e.longitude),r.typeOf.number("latitude",e.latitude),this._viewer.camera.setView({destination:Cesium.Cartesian3.fromDegrees(e.longitude,e.latitude,e.height),orientation:{heading:Cesium.Math.toRadians(Cesium.defaultValue(e.heading,0)),pitch:Cesium.Math.toRadians(Cesium.defaultValue(e.pitch,-90)),roll:e.roll}})}_getChinaPostion(){return Cesium.Cartesian3.fromDegrees(116.435314,40.960521,1e7)}_flytoChina(){this._viewer.camera.flyTo({destination:this._getChinaPostion(),duration:8})}}Object.assign(c.prototype,{setViewChina:function(){this._setView({longitude:103.84,latitude:31.15,height:24e6,heading:0,pitch:-90,roll:0})},fullMap:function(e){return new Promise(((t,i)=>{let n=this;this._entities.removeById("fullMapRectangle"),e.isRemove=Cesium.defaultValue(e.isRemove,!0),e.duration=Cesium.defaultValue(e.duration,3),e.heading=Cesium.defaultValue(e.heading,0),e.pitch=Cesium.defaultValue(e.pitch,-90),e.range=Cesium.defaultValue(e.range,0);var r=Cesium.Rectangle.fromDegrees(e.west,e.south,e.east,e.north),o=this._entities.add({id:"fullMapRectangle",name:"fullMapRectangle",rectangle:{coordinates:r,material:Cesium.Color.GREEN.withAlpha(0),height:10,outline:!1}});this._viewer.flyTo(o,{duration:e.duration,offset:{heading:Cesium.Math.toRadians(e.heading),pitch:Cesium.Math.toRadians(e.pitch),range:e.range}}).then((function(i){i&&(e.isRemove&&o&&(n._entities.remove(o),o=null),t(!0))})).catch((function(e){console.log(e)}))}))}});const h=52.35987755982988,d=3.141592653589793,p=6378245,f=.006693421622965943;class m{static BD09ToGCJ02(e,t){let i=+e-.0065,n=+t-.006,r=Math.sqrt(i*i+n*n)-2e-5*Math.sin(n*h),o=Math.atan2(n,i)-3e-6*Math.cos(i*h);return[r*Math.cos(o),r*Math.sin(o)]}static GCJ02ToBD09(e,t){t=+t,e=+e;let i=Math.sqrt(e*e+t*t)+2e-5*Math.sin(t*h),n=Math.atan2(t,e)+3e-6*Math.cos(e*h);return[i*Math.cos(n)+.0065,i*Math.sin(n)+.006]}static WGS84ToGCJ02(e,t){if(t=+t,e=+e,this.out_of_china(e,t))return[e,t];{let i=this.delta(e,t);return[e+i[0],t+i[1]]}}static GCJ02ToWGS84(e,t){if(t=+t,e=+e,this.out_of_china(e,t))return[e,t];{let i=this.delta(e,t);return[2*e-(e+i[0]),2*t-(t+i[1])]}}static delta(e,t){let i=this.transformLng(e-105,t-35),n=this.transformLat(e-105,t-35);const r=t/180*d;let o=Math.sin(r);o=1-f*o*o;const s=Math.sqrt(o);return i=180*i/(p/s*Math.cos(r)*d),n=180*n/(p*(1-f)/(o*s)*d),[i,n]}static transformLng(e,t){let i=300+(e=+e)+2*(t=+t)+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*d)+20*Math.sin(2*e*d))/3,i+=2*(20*Math.sin(e*d)+40*Math.sin(e/3*d))/3,i+=2*(150*Math.sin(e/12*d)+300*Math.sin(e/30*d))/3,i}static transformLat(e,t){let i=2*(e=+e)-100+3*(t=+t)+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return i+=2*(20*Math.sin(6*e*d)+20*Math.sin(2*e*d))/3,i+=2*(20*Math.sin(t*d)+40*Math.sin(t/3*d))/3,i+=2*(160*Math.sin(t/12*d)+320*Math.sin(t*d/30))/3,i}static out_of_china(e,t){return t=+t,!((e=+e)>73.66&&e<135.05&&t>3.86&&t<53.55)}static getCatesian3FromPX(e,t){let i=e.scene.drillPick(t),n=null,r=!1,o=!1;for(let a in i){let o=i[a];if((o&&o.primitive instanceof Cesium.Cesium3DTileFeature||o&&o.primitive instanceof Cesium.Cesium3DTileset||o&&o.primitive instanceof Cesium.Model)&&(r=!0),r&&(e.scene.pick(t),n=e.scene.pickPosition(t),n)){let e=Cesium.Cartographic.fromCartesian(n);e.height<0&&(e.height=0);let t=Cesium.Math.toDegrees(e.longitude),i=Cesium.Math.toDegrees(e.latitude),r=e.height;n=this.transformWGS84ToCartesian({lng:t,lat:i,alt:r})}}let s=e.terrainProvider instanceof Cesium.EllipsoidTerrainProvider;if(!r&&!s){let i=e.scene.camera.getPickRay(t);if(!i)return null;n=e.scene.globe.pick(i,e.scene),o=!0}if(r||o||!s||(n=e.scene.camera.pickEllipsoid(t,e.scene.globe.ellipsoid)),n){let e=this.transformCartesianToWGS84(n);return e.alt<0&&(n=this.transformWGS84ToCartesian(e,.1)),n}return!1}static transformWGS84ToCartesian(e,t){return e?Cesium.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=t||e.alt,Cesium.Ellipsoid.WGS84):Cesium.Cartesian3.ZERO}static transformCartesianToWGS84(e){let t=Cesium.Ellipsoid.WGS84.cartesianToCartographic(e);return{lng:Cesium.Math.toDegrees(t.longitude),lat:Cesium.Math.toDegrees(t.latitude),alt:t.height}}static Cartesian3ListToWGS84(e){let t=Cesium.Ellipsoid.WGS84,i=[];for(let n=0;n<e.length;n++){const r=e[n];let o=t.cartesianToCartographic(r);i.push({lng:Cesium.Math.toDegrees(o.longitude),lat:Cesium.Math.toDegrees(o.latitude),alt:o.height})}return i}static Degrees2DMS(e){let t=Math.floor(e),i=60*(e-t),n=Math.floor(i),r=60*(i-n),o=Math.round(r);var s=Cesium.Math.toRadians(e),a=Cesium.Math.toDegrees(e);return console.log(s),console.log(a),{degrees:t,minutes:n,seconds:o}}static DMS2Degrees(e){let t=parseFloat(e.degrees)+parseFloat(e.minutes)/60+parseFloat(e.seconds)/3600;return parseFloat(t).toFixed(6)}}class g{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e}_addImageryProvider(e,t){let i;return i=this._viewer.imageryLayers.addImageryProvider(t),window[e]=i,e}_removeImageryProvider(e){this._viewer.imageryLayers.remove(window[e])}_addTerrainProvider(e){this._viewer.terrainProvider=e}_setEllipsoidTerrain(){this._viewer.terrainProvider=new Cesium.EllipsoidTerrainProvider({})}_addScenePrimitives(e,t){let i;return i=this._viewer.scene.primitives.add(t),window[e]=i,e}_removeScenePrimitives(e){this._viewer.scene.primitives.remove(window[e]),this._viewer.scene.requestRender()}_guid(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}_transformProjection(e){let t=e.tilingScheme._projection;return t.x_project=t.project,t.project=function(e){let i;return i=m.WGS84ToGCJ02(Cesium.Math.toDegrees(e.longitude),Cesium.Math.toDegrees(e.latitude)),t.x_project(new Cesium.Cartographic(Cesium.Math.toRadians(i[0]),Cesium.Math.toRadians(i[1])))},t.x_unproject=t.unproject,t.unproject=function(e){let i,n=t.x_unproject(e);return i=m.GCJ02ToWGS84(Cesium.Math.toDegrees(n.longitude),Cesium.Math.toDegrees(n.latitude)),new Cesium.Cartographic(Cesium.Math.toRadians(i[0]),Cesium.Math.toRadians(i[1]))},e}}Object.assign(g.prototype,{addTerrain(e){if(!i(e)||!i(e.url))throw new n("options.url is required.");var t=new Cesium.CesiumTerrainProvider({url:e.url,requestVertexNormals:!0,requestWaterMask:!0});this._addTerrainProvider(t)},addMapboxLayer(e,t){if(!i(e)||!i(e.styleId))throw new n("options.styleId is required.");if(!i(e.accessToken))throw new n("options.accessToken is required.");e.id=e.id||this._guid();var r=new Cesium.MapboxStyleImageryProvider({url:e.url,username:e.username,styleId:e.styleId,accessToken:e.accessToken,scaleFactor:e.scaleFactor});let o=this._addImageryProvider(e.id,r);t&&t(o)},addUrlTemplateImagery:function(e,t){if(!i(e)||!i(e.url))throw new n("options.url is required.");e.id=e.id||this._guid(),e.CRS=e.CRS||"";var r=new Cesium.UrlTemplateImageryProvider({url:e.url,tilingScheme:new Cesium.WebMercatorTilingScheme,minimumLevel:Cesium.defaultValue(e.minimumLevel,0),maximumLevel:e.maximumLevel});"WGS84"===e.CRS.toUpperCase()&&r.readyPromise.then((()=>{this._transformProjection(r)}));let o=this._addImageryProvider(e.id,r);t&&t(o)},addTileMapServiceImagery:function(e,t){if(!i(e)||!i(e.url))throw new n("options.url is required.");e.id=e.id||this._guid();var r=new Cesium.TileMapServiceImageryProvider({url:e.url,fileExtension:"png",minimumLevel:Cesium.defaultValue(e.minimumLevel,0),maximumLevel:e.maximumLevel});let o=this._addImageryProvider(e.id,r);t&&t(o)},addWebMapTileService:function(e,t){if(!i(e)||!i(e.url))throw new n("options.url is required.");e.id=e.id||this._guid();let r=new Cesium.WebMapTileServiceImageryProvider({url:e.url,layer:e.layers,style:e.layerstyle,tileMatrixSetID:e.tileMatrixSetID,tileMatrixLabels:e.tileMatrixLabels,format:Cesium.defaultValue(e.format,"image/png"),minimumLevel:Cesium.defaultValue(e.minimumLevel,0),maximumLevel:e.maximumLevel}),o=this._addImageryProvider(e.id,r);t&&t(o)},addWebMapService:function(e,t){if(!i(e)||!i(e.url))throw new n("options.url is required.");if(!i(e.layers))throw new n("options.layers is required.");e.id=e.id||this._guid();let r=new Cesium.WebMapServiceImageryProvider({url:e.url,layers:e.layers,parameters:{transparent:!0,request:"GetMap",format:"image/png"},minimumLevel:Cesium.defaultValue(e.minimumLevel,0),maximumLevel:e.maximumLevel}),o=this._addImageryProvider(e.id,r);t&&t(o)},addArcGisMapServer:function(e,t){if(!i(e)||!i(e.url))throw new n("options.url is required.");e.id=e.id||this._guid();let r=new Cesium.ArcGisMapServerImageryProvider({url:e.url,layers:e.layers}),o=this._addImageryProvider(e.id,r);t&&t(o)},addCesium3DTileset:function(e,t){if(!i(e)||!i(e.url))throw new n("options.url is required.");e.id=e.id||this._guid();let r=new Cesium.Cesium3DTileset({url:e.url,skipLevelOfDetail:!0,maximumScreenSpaceError:Cesium.defaultValue(e.maximumScreenSpaceError,16)}),o=this._addScenePrimitives(e.id,r);t&&t(o)},addCesium3DTilesetBm:function(e,t){if(!i(e)||!i(e.url))throw new n("options.url is required.");e.id=e.id||this._guid();let r=new Cesium.Cesium3DTileset({url:e.url,skipLevelOfDetail:!0,maximumScreenSpaceError:Cesium.defaultValue(e.maximumScreenSpaceError,16)}),o=this._addScenePrimitives(e.id,r);t&&t(o)}}),Object.assign(g.prototype,{set3DTilesetStyle:function(e){if(!i(e)||!i(e.serviceId))throw new n("options.serviceId is required.");e.color=e.color?"vec4("+e.color[0]+"/255, "+e.color[1]+"/255, "+e.color[2]+"/255, "+e.color[3]+")":"vec4(0.0, 0.58, 0.86, 1.0)",window[e.serviceId].readyPromise.then((t=>{t.boundingSphere.radius,t.boundingSphere.radius>1e4&&t.boundingSphere.radius,t.style=new Cesium.Cesium3DTileStyle({color:e.color}),t.tileVisible.addEventListener((e=>{let t=e.content,i=t.featuresLength;for(let n=0;n<i;n+=2){const e=t.getFeature(n),i=e.content._model;i&&i._sourcePrograms&&i._rendererResources&&(Object.keys(i._sourcePrograms).forEach((t=>{const n=i._sourcePrograms[t],r=i._rendererResources.sourceShaders[n.fragmentShader];let o="";-1!==r.indexOf(" v_positionEC;")?o="v_positionEC":-1!==r.indexOf(" v_pos;")&&(o="v_pos");const s=`vec4(${e.color.toString()})`;i._rendererResources.sourceShaders[n.fragmentShader]=`\n\t\t\t\t\t\t\t\t\t\t\t\t varying vec3 ${o};\n\t\t\t\t\t\t\t\t\t\t\t\t void main(void){\n\t\t\t\t\t\t\t\t\t\t\t\t\tvec4 v_helsing_position = czm_inverseModelView * vec4(${o},1); \n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tfloat _baseHeight = -30.0;\n\t\t\t\t\t\t\t\t\t\t\t\t\tfloat vtxf_height = v_helsing_position.z - _baseHeight;\n\t\t\t\t\t\t\t\t\t\t\t\t\tfloat stc_pl = fract(czm_frameNumber / 120.0) * 3.14159265 * 2.0;\n\t\t\t\t\t\t\t\t\t\t\t\t\tfloat stc_sd = vtxf_height / 30.0 + sin(stc_pl) * 0.1;\n\t\t\t\t\t\t\t\t\t\t\t\t\tgl_FragColor = ${s};\n\t\t\t\t\t\t\t\t\t\t\t\t\tgl_FragColor *= vec4(stc_sd, stc_sd, stc_sd, 1.0);\n\t\t\t\t\t\t\t\t\t\t\t\t\t/* 扫描线 */\n\t\t\t\t\t\t\t\t\t\t\t\t\tfloat glowRange = 80.0;\n\t\t\t\t\t\t\t\t\t\t\t\t\tfloat stc_a13 = fract(czm_frameNumber / 460.0);\n\t\t\t\t\t\t\t\t\t\t\t\t\tfloat stc_h = clamp(v_helsing_position.z / glowRange, 0.0, 1.0);\n\t\t\t\t\t\t\t\t\t\t\t\t\tstc_a13 = abs(stc_a13 - 0.5) * 1.0;\n\t\t\t\t\t\t\t\t\t\t\t\t\tfloat stc_diff = step(0.003, abs(stc_h - stc_a13));\n\t\t\t\t\t\t\t\t\t\t\t\t\tgl_FragColor.rgb += gl_FragColor.rgb * (1.0 - stc_diff);\n\t\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t\t`})),i._shouldRegenerateShaders=!0)}}))})),this._viewer.scene.requestRender()},set3DTilePosition:function(e){if(!i(e)||!i(e.serviceId))throw new n("options.serviceId is required.");window[e.serviceId].readyPromise.then((function(){let t=window[e.serviceId].boundingSphere,i=Cesium.Cartographic.fromCartesian(t.center),n=Cesium.Cartesian3.fromRadians(i.longitude,i.latitude,e.height),r=Cesium.Cartesian3.fromRadians(i.longitude,i.latitude,0),o=Cesium.Cartesian3.subtract(n,r,new Cesium.Cartesian3);window[e.serviceId].modelMatrix=Cesium.Matrix4.fromTranslation(o)})),this._viewer.scene.requestRender()},setLayersStyle(e){if(!i(e)||!i(e.serviceId))throw new n("options.serviceId is required.");let t=window[e.serviceId];i(e.alpha)&&r.typeOf.number("alpha",e.alpha),e.alpha=Cesium.defaultValue(e.alpha,1),t.alpha=e.alpha,i(e.brightness)&&r.typeOf.number("brightness",e.brightness),e.brightness=Cesium.defaultValue(e.brightness,1),t.brightness=e.brightness,i(e.contrast)&&r.typeOf.number("contrast",e.contrast),e.contrast=Cesium.defaultValue(e.contrast,1),t.contrast=e.contrast,i(e.gamma)&&r.typeOf.number("gamma",e.gamma),e.gamma=Cesium.defaultValue(e.gamma,1),t.gamma=e.gamma,i(e.hue)&&r.typeOf.number("hue",e.hue),e.hue=Cesium.defaultValue(e.hue,0),t.hue=e.hue,i(e.saturation)&&r.typeOf.number("saturation",e.saturation),e.saturation=Cesium.defaultValue(e.saturation,1),t.saturation=e.saturation},set3DTileStyle(e){if(!i(e)||!i(e.serviceId))throw new n("options.serviceId is required.");i(e.alpha)&&r.typeOf.number("alpha",e.alpha),e.alpha=Cesium.defaultValue(e.alpha,1),window[e.serviceId].style=new Cesium.Cesium3DTileStyle({color:"color('rgba(255,255,255,"+e.alpha+")')"})},removeImageryProvider(e){return new Promise(((t,r)=>{if(!i(e)||!i(e.serviceId))throw new n("options.serviceId is required.");this._removeImageryProvider(e.serviceId),t(!0)}))},removeTerrain(){return new Promise(((e,t)=>{this._setEllipsoidTerrain(),e(!0)}))},removeScenePrimitives(e){return new Promise(((t,r)=>{if(!i(e)||!i(e.serviceId))throw new n("options.serviceId is required.");this._removeScenePrimitives(e.serviceId),t(!0)}))}}),Date.prototype.Format=function(e){var t={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),S:this.getMilliseconds()};for(var i in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length))),t)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?t[i]:("00"+t[i]).substr((""+t[i]).length)));return e};class v{constructor({viewer:e,url:t,opacity:i=.75,show:n=!0}={}){this._viewer=e,this._url=t,this._opacity=i,this._renderName=this._guid();let r=new Cesium.CustomDataSource(this._renderName);this._viewer.dataSources.add(r),this._entities=r.entities,this._renderEntities=new Map,this._isUpdateTile=n,this._isDebug=!1,this._init()}_init(){let e=this;this._provider=new Cesium.ArcGisMapServerImageryProvider({url:e._url}),this._provider.readyPromise.then((function(t){e._rectangle=e._provider.rectangle,e._isDebug&&e._printDebug(),e._viewer.scene.postRender.addEventListener((()=>{e._isUpdateTile&&(e._isUpdateTile=!1,e._renderTiles())}))}))}_guid(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}_printDebug(){this._provider.tilingScheme;let e=new Cesium.GeographicTilingScheme;this._drawDebugRectangle(this._rectangle,Cesium.Color.GREEN),e.tileXYToRectangle(1696,312,10)}_drawDebugRectangle(e,t){let i=this._calculateRectangleOutlineCoordinates(e),n=new Cesium.Entity({name:this._renderName,polyline:{positions:i,material:t,width:10,clampToGround:!0}});this._entities.add(n)}_console(...e){this._isDebug&&console.log("==="+(new Date).Format("yyyy-MM-dd HH:mm:ss")+">>>",e)}_renderTiles(){let e=this,t=this._viewer.scene.globe._surface._tilesToRender;void 0!==t&&0!==t.length?new Promise(((e,i)=>{t.sort((function(e,t){return parseInt(e.level)-parseInt(t.level)})),e(t)})).then((t=>{e._asyncProjectionTiles(t)})):this._isUpdateTile=!0}_createKey(e,t,i){return`${this._renderName}_${e}_${t}_${i}`}_asyncProjectionTiles(e){let t=[];for(let r of e){let e=this._projectionTile(r);for(let i of e){let e=this._createKey(i.x,i.y,i.level);if(void 0===t.find((e=>e.x===i.x&&e.y===i.y))){let n=!1;for(let r of t)if(Cesium.Rectangle.intersection(r.rectangle,i.rectangle)){r.childTiles.push(e),n=!0;break}n||t.push({key:e,x:i.x,y:i.y,level:i.level,rectangle:i.rectangle,childTiles:[]})}}}let i=t.length,n=[];for(;i--;){let e=t[i];if(e.childTiles.length>=1){let r=this._createFourTiles(e);for(let e of r)n.push(e);t.splice(i,1)}}for(let r of n)t.push(r);t.sort((function(e,t){return parseInt(e.level)-parseInt(t.level)})),this._renderTilesToViewer(t)}_createTileByRectangleAndLevel(e,t){let i=Cesium.Rectangle.center(e),n=parseInt(t)+1,r=this._provider.tilingScheme.positionToTileXY(i,n);if(void 0!==r)return{key:this._createKey(r.x,r.y,n),x:r.x,y:r.y,level:n,rectangle:e,childTiles:[]}}_createFourTiles(e){let t=[],i=[],n=e.rectangle;t.push(Cesium.Rectangle.subsection(n,0,0,.5,.5)),t.push(Cesium.Rectangle.subsection(n,.5,0,1,.5)),t.push(Cesium.Rectangle.subsection(n,0,.5,.5,1)),t.push(Cesium.Rectangle.subsection(n,.5,.5,1,1));for(let r of t)if(Cesium.Rectangle.intersection(r,this._rectangle)){let t=this._createTileByRectangleAndLevel(r,e.level);void 0!==t&&i.push(t)}return i}_renderTilesToViewer(e){let t=this,i=[];for(let[n,r]of this._renderEntities){void 0===e.find((e=>e.key===n))&&i.push(n)}for(let n of i)this._renderEntities.delete(n),this._entities.removeById(n);for(let n of e)if(!this._renderEntities.has(n.key)){let e=this._renderSimpleTileToViewer(n);this._renderEntities.set(n.key,e);let i=new Blob([`(${y.toString()})()`]),r=new Worker(URL.createObjectURL(i));r.postMessage({key:n.key,url:this._url,x:n.x,y:n.y,level:n.level}),r.onmessage=function(e){t._console(`render x:${e.data.x} y:${e.data.y} level:${e.data.level}`);let i=t._entities.getById(e.data.key);if(void 0!==i){e.data.key;const n=t._createCanvas(e.data,e.data.image,t._isDebug);i.rectangle.material=n}r.terminate()}}this._isUpdateTile=!0}_renderSimpleTileToViewer(e){const t=this._createCanvas(e,void 0,this._isDebug);let i=this._calculateRectangleOutlineCoordinates(e.rectangle),n=new Cesium.Entity({name:this._renderName,id:e.key,rectangle:{coordinates:e.rectangle,material:t},polyline:{positions:i,material:Cesium.Color.YELLOW.withAlpha(this._isDebug?1:0),width:1,clampToGround:!0}});return this._entities.add(n)}_createCanvas(e,t,i){let n=this._provider;const r=document.createElement("canvas");r.width=n.tileWidth,r.height=n.tileHeight;const o=r.getContext("2d");return void 0!==t&&(o.globalAlpha=this._opacity,o.drawImage(event.data.image,0,0,r.width,r.height)),void 0!==i&&!0===i&&(o.globalAlpha=1,o.font="20px Arial",o.textAlign="center",o.fillStyle="rgba(255,255,0)",o.strokeStyle="rgba(255,255,255,1)",o.lineWidth=2,o.strokeText(`L: ${e.level}`,126,86),o.fillText(`L: ${e.level}`,126,86),o.strokeText(`X: ${e.x}`,126,136),o.fillText(`X: ${e.x}`,126,136),o.strokeText(`Y: ${e.y}`,126,186),o.fillText(`Y: ${e.y}`,126,186)),r}_projectionTile(e){let t=e._rectangle,i=parseInt(e.level),n=this._provider.tilingScheme,r=[];if(void 0===Cesium.Rectangle.intersection(t,this._rectangle))return r;let o=n.positionToTileXY(Cesium.Rectangle.northwest(t),i),s=n.positionToTileXY(Cesium.Rectangle.southeast(t),i);if(void 0!==o&&void 0!==s)for(let a=o.x;a<=s.x;a++)for(let e=o.y;e<=s.y;e++){let t=n.tileXYToRectangle(a,e,i);Cesium.Rectangle.intersection(t,this._rectangle)&&r.push({x:a,y:e,level:i,rectangle:t})}else if(void 0!==o){let e=n.tileXYToRectangle(o.x,o.y,i);Cesium.Rectangle.intersection(e,this._rectangle)&&r.push({x:o.x,y:o.y,level:i,rectangle:e})}else if(void 0!==s){let e=n.tileXYToRectangle(s.x,s.y,i);Cesium.Rectangle.intersection(e,this._rectangle)&&r.push({x:s.x,y:s.y,level:i,rectangle:e})}return r}_calculateRectangleOutlineCoordinates(e){let t=Cesium.Rectangle.southeast(e),i=Cesium.Cartographic.toCartesian(t),n=Cesium.Rectangle.southwest(e),r=Cesium.Cartographic.toCartesian(n),o=Cesium.Rectangle.northeast(e),s=Cesium.Cartographic.toCartesian(o),a=Cesium.Rectangle.northwest(e);return[r,i,s,Cesium.Cartographic.toCartesian(a),r]}_removeEntityByName(e){var t=this._entities;if(t&&t.values){for(var i=[],n=0;n<t.values.length;n++)t.values[n].name==e&&i.push(t.values[n]);for(n=0;n<i.length;n++)t.remove(i[n])}}}function y(){onmessage=function(e){let t=e.data,i=t.url+"/tile/"+t.level+"/"+t.y+"/"+t.x,n=new XMLHttpRequest;n.open("get",i,!0),n.responseType="blob",n.onload=function(){if(200===this.status){var e=this.response;createImageBitmap(e,{imageOrientation:"none",premultiplyAlpha:"none",colorSpaceConversion:"default"}).then((function(e){let i={key:t.key,x:t.x,y:t.y,level:t.level,image:e};postMessage(i)}))}else console.log("===>>>",i+" Not found")},n.send()}}Object.assign(v.prototype,{hide:function(){this._console("隐藏"),this._isUpdateTile=!1,this._removeEntityByName(this._renderName),this._renderEntities.clear()},show:function(){this._console("显示"),this._isUpdateTile=!0},setOpacity:function(e){void 0!==e&&"number"==typeof e&&(e>=1&&(this._opacity=1),e<=0&&(this._opacity=0),this._opacity=parseFloat(e))}});class _{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._locationEntity=null}}Object.assign(_.prototype,{flyToPoint:function(e){return new Promise(((t,r)=>{if(!i(e)||!i(e.longitude)||!i(e.latitude))throw new n("options.longitude and options.latitude are required.");e.height=Cesium.defaultValue(e.height,0),e.heading=Cesium.defaultValue(e.heading,0),e.pitch=Cesium.defaultValue(e.pitch,-90),e.range=Cesium.defaultValue(e.range,0),e.duration=Cesium.defaultValue(e.duration,3);var o=new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(e.longitude,e.latitude,e.height),0);this._viewer.camera.flyToBoundingSphere(o,{duration:e.duration,complete:function(){t(!0)},offset:{heading:Cesium.Math.toRadians(e.heading),pitch:Cesium.Math.toRadians(e.pitch),range:e.range}})}))},flyToEntityByPoints:function(e,t,i){return new Promise(((n,r)=>{let o=this;if(i=i||{},void 0===e||void 0===e.length)return void r("输入的坐标集合异常!");let s=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));switch(o._locationEntity&&o._viewer.entities.remove(o._locationEntity),t){case"point":o._locationEntity=o._viewer.entities.add({position:s[0],point:{pixelSize:1}});break;case"polyline":s.length<2?r("线对象定位,点数至少2个"):o._locationEntity=o._viewer.entities.add({polyline:{positions:s,clampToGround:!0,material:new Cesium.Color(255,0,0,.5),width:1}});break;case"polygon":s.length<3?r("面对象定位,点数至少3个"):o._locationEntity=o._viewer.entities.add({polygon:{hierarchy:{positions:s},material:new Cesium.Color(255,0,0,.5),outline:!0}});break;default:r("坐标异常!")}i.duration=Cesium.defaultValue(i.duration,3),i.heading=Cesium.defaultValue(i.heading,0),i.pitch=Cesium.defaultValue(i.pitch,-90),i.range=Cesium.defaultValue(i.range,0),o._viewer.flyTo(o._locationEntity,{duration:i.duration,offset:{heading:Cesium.Math.toRadians(i.heading),pitch:Cesium.Math.toRadians(i.pitch),range:i.range}}).then((function(){n(!0)}))}))},flyToEntity:function(e,t){return new Promise(((i,n)=>{let r=this;t=t||{},r._locationEntity&&r._viewer.entities.remove(r._locationEntity),r._locationEntity=e,t.duration=Cesium.defaultValue(t.duration,3),t.heading=Cesium.defaultValue(t.heading,0),t.pitch=Cesium.defaultValue(t.pitch,-90),t.range=Cesium.defaultValue(t.range,0),r._viewer.flyTo(r._locationEntity,{duration:t.duration,offset:{heading:Cesium.Math.toRadians(t.heading),pitch:Cesium.Math.toRadians(t.pitch),range:t.range}}).then((function(){i(r._locationEntity)}))}))}});const b=function(e,t,i){let n,r,o,s,a=document.getElementById("toolTip");if(e&&"object"==typeof e&&(n=e),n&&n.origin?("center"===n.origin&&(r=15,o=-12),"top"===n.origin&&(r=15,o=-44),"bottom"===n.origin&&(r=15,o=20)):(r=15,o=20),n&&n.color?("white"===n.color&&(s="background: rgba(255, 255, 255, 0.8);color: black;"),"black"===n.color&&(s="background: rgba(0, 0, 0, 0.5);color: white;"),"yellow"===n.color&&(s="color: black;background-color: #ffcc33;border: 1px solid white;")):s="background: rgba(0, 0, 0, 0.5);color: white;",!a){const e=document.getElementsByClassName("cesium-viewer")[0];let t=document.createElement("div");e.append(t);let i='<div id="toolTip" style="display: none;pointer-events: none;position: absolute;z-index: 1000;opacity: 0.8;border-radius: 4px;padding: 4px 8px;white-space: nowrap;font-family:黑体;color:white;font-weight: bolder;font-size: 14px;'+s+'"></div>';e.insertAdjacentHTML("beforeend",i),a=document.getElementById("toolTip")}return i?(a.innerHTML=e,a.style.left=t.x+r+"px",a.style.top=t.y+o+"px",a.style.display="block"):a.style.display="none",{tooltip:a,style:n,showAt:function(e,t){this.tooltip.innerHTML=t,this.style&&this.style.origin?("center"===this.style.origin&&(r=15,o=-this.tooltip.offsetHeight/2),"top"===this.style.origin&&(r=15,o=-this.tooltip.offsetHeight-20),"bottom"===this.style.origin&&(r=15,o=20)):(r=15,o=-this.tooltip.offsetHeight/2),this.tooltip.style.left=e.x+r+"px",this.tooltip.style.top=e.y+o+"px",this.tooltip.style.display="block"},show:function(e){this.tooltip.style.display=e?"block":"none"}}};class C{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._resultObject={viewPoint:void 0,targetPoints:[],targetPoint:void 0,objectExclude:[],entities:[]}}_distance(e,t){let i=Cesium.Cartographic.fromCartesian(e),n=Cesium.Cartographic.fromCartesian(t),r=new Cesium.EllipsoidGeodesic;r.setEndPoints(i,n);let o=r.surfaceDistance;return o=Math.sqrt(Math.pow(o,2)+Math.pow(n.height-i.height,2)),o}}
- /*!
- * author: [object Object]
- * @sakitam-gis/kriging v0.1.0
- * build-time: 2019-7-6 20:41
- * LICENSE: MIT
- * (c) 2019-2019 https://github.com/sakitam-gis/kriging.js
- */
- function T(e){return Math.max.apply(null,e)}function w(e){return Math.min.apply(null,e)}function E(e,t){for(var i=[],n=0;n<t;n++)i.push(e);return i}function S(e,t,i){for(var n=0,r=e.length-1,o=!1,s=e.length;n<s;r=n++)e[n][1]>i!=e[r][1]>i&&t<(e[r][0]-e[n][0])*(i-e[n][1])/(e[r][1]-e[n][1])+e[n][0]&&(o=!o);return o}function k(e,t){for(var i=0,n=E(0,t*t);i<t;i++)n[i*t+i]=e;return n}function P(e,t,i){for(var n,r=0,o=Array(i*t);r<t;r++)for(n=0;n<i;n++)o[n*t+r]=e[r*i+n];return o}function A(e,t,i,n){for(var r,o=0,s=Array(i*n);o<i;o++)for(r=0;r<n;r++)s[o*n+r]=e[o*n+r]+t[o*n+r];return s}function x(e,t,i,n,r){for(var o,s,a=0,l=Array(i*r);a<i;a++)for(o=0;o<r;o++)for(l[a*r+o]=0,s=0;s<n;s++)l[a*r+o]+=e[a*n+s]*t[s*r+o];return l}function I(e,t){var i,n,r,o=Array(t);for(i=0;i<t;i++)o[i]=e[i*t+i];for(i=0;i<t;i++){for(n=0;n<i;n++)o[i]-=e[i*t+n]*e[i*t+n];if(o[i]<=0)return!1;for(o[i]=Math.sqrt(o[i]),n=i+1;n<t;n++){for(r=0;r<i;r++)e[n*t+i]-=e[n*t+r]*e[i*t+r];e[n*t+i]/=o[i]}}for(i=0;i<t;i++)e[i*t+i]=o[i];return!0}function M(e,t){var i,n,r,o;for(i=0;i<t;i++)for(e[i*t+i]=1/e[i*t+i],n=i+1;n<t;n++){for(o=0,r=i;r<n;r++)o-=e[n*t+r]*e[r*t+i];e[n*t+i]=o/e[n*t+n]}for(i=0;i<t;i++)for(n=i+1;n<t;n++)e[i*t+n]=0;for(i=0;i<t;i++){for(e[i*t+i]*=e[i*t+i],r=i+1;r<t;r++)e[i*t+i]+=e[r*t+i]*e[r*t+i];for(n=i+1;n<t;n++)for(r=n;r<t;r++)e[i*t+n]+=e[r*t+i]*e[r*t+n]}for(i=0;i<t;i++)for(n=0;n<i;n++)e[i*t+n]=e[n*t+i]}function L(e,t){var i,n,r,o,s,a,l,u,c,h=t,d=Array(t*t),p=Array(t),f=Array(t),m=Array(t),g=0,v=0;for(i=0;i<t;i++)for(n=0;n<t;n++)d[i*t+n]=i===n?1:0;for(n=0;n<t;n++)m[n]=0;for(i=0;i<t;i++){for(a=0,n=0;n<t;n++)if(1!==m[n])for(r=0;r<t;r++)0===m[r]&&Math.abs(e[n*t+r])>=a&&(a=Math.abs(e[n*t+r]),v=n,g=r);if(++m[g],v!==g){for(o=0;o<t;o++)c=e[v*t+o],e[v*t+o]=e[g*t+o],e[g*t+o]=c;for(o=0;o<h;o++)c=d[v*t+o],d[v*t+o]=d[g*t+o],d[g*t+o]=c}if(f[i]=v,p[i]=g,0===e[g*t+g])return!1;for(u=1/e[g*t+g],e[g*t+g]=1,o=0;o<t;o++)e[g*t+o]*=u;for(o=0;o<h;o++)d[g*t+o]*=u;for(s=0;s<t;s++)if(s!==g){for(l=e[s*t+g],e[s*t+g]=0,o=0;o<t;o++)e[s*t+o]-=e[g*t+o]*l;for(o=0;o<h;o++)d[s*t+o]-=d[g*t+o]*l}}for(o=t-1;o>=0;o--)if(f[o]!==p[o])for(r=0;r<t;r++)c=e[r*t+f[o]],e[r*t+f[o]]=e[r*t+p[o]],e[r*t+p[o]]=c;return!0}function D(e,t,i,n,r){return t+(n-t)/i*(1-Math.exp(-1/r*Math.pow(e/i,2)))}function O(e,t,i,n,r){return t+(n-t)/i*(1-Math.exp(-1/r*(e/i)))}function j(e,t,i,n){return e>i?t+(n-t)/i:t+(n-t)/i*(e/i*1.5-.5*Math.pow(e/i,3))}function R(e,t,i){var n,r=Array(i.n);for(n=0;n<i.n;n++)r[n]=i.model(Math.pow(Math.pow(e-i.x[n],2)+Math.pow(t-i.y[n],2),.5),i.nugget,i.range,i.sill,i.A);return x(r,i.M,1,i.n,1)[0]}Object.assign(C.prototype,{startSightLine(){let e=this,t="左键点击创建视角起点",i=new Cesium.ScreenSpaceEventHandler(e._viewer.canvas);i.setInputAction((i=>{let n=m.getCatesian3FromPX(e._viewer,i.position);if(t="左键创建视角终点,右键结束通视分析",n)if(e._resultObject.viewPoint){e._resultObject.targetPoint=n;let t=e._viewer.entities.add({position:n,point:{color:Cesium.Color.YELLOW,pixelSize:5},label:{text:"目标位置",font:"12px sans-serif",fillColor:new Cesium.Color(255,255,255,1),outlineColor:new Cesium.Color(0,154,94,1),style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:1,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffset:new Cesium.Cartesian2(0,-28),showBackground:!0,backgroundColor:new Cesium.Color(0,0,0,.6),disableDepthTestDistance:Number.POSITIVE_INFINITY}});e._resultObject.objectExclude.push(t),e._resultObject.entities.push(t);let i=Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(e._resultObject.targetPoint,e._resultObject.viewPoint,new Cesium.Cartesian3),new Cesium.Cartesian3),r=new Cesium.Ray(e._resultObject.viewPoint,i),o=e._viewer.scene.pickFromRay(r,e._resultObject.objectExclude);if(o){let t=e._distance(e._resultObject.viewPoint,e._resultObject.targetPoint),i=e._distance(e._resultObject.viewPoint,o.position),r=e._distance(o.position,e._resultObject.targetPoint);if(console.log(t,i,r),t>i){let s=e._viewer.entities.add({polyline:{positions:[e._resultObject.viewPoint,o.position],material:Cesium.Color.GREEN,width:3}});e._resultObject.entities.push(s);let a=e._viewer.entities.add({polyline:{positions:[o.position,e._resultObject.targetPoint],material:Cesium.Color.RED,width:3}});e._resultObject.entities.push(a),e._resultObject.targetPoints.push({targetPoint:n,visual:!1,distance:[t,i,r]})}else{let o=e._viewer.entities.add({polyline:{positions:[e._resultObject.viewPoint,e._resultObject.targetPoint],material:Cesium.Color.GREEN,width:3}});e._resultObject.entities.push(o),e._resultObject.targetPoints.push({targetPoint:n,visual:!0,distance:[t,i,r]})}}}else{e._resultObject.viewPoint=n;let t=e._viewer.entities.add({position:n,point:{color:Cesium.Color.YELLOW,pixelSize:5},label:{text:"观察位置",font:"12px sans-serif",fillColor:new Cesium.Color(255,255,255,1),outlineColor:new Cesium.Color(0,154,94,1),style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:1,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffset:new Cesium.Cartesian2(0,-28),showBackground:!0,backgroundColor:new Cesium.Color(0,0,0,.6),disableDepthTestDistance:Number.POSITIVE_INFINITY}});e._resultObject.objectExclude.push(t),e._resultObject.entities.push(t)}}),Cesium.ScreenSpaceEventType.LEFT_CLICK),i.setInputAction((function(e){b(t,e.endPosition,!0)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE),i.setInputAction((e=>{b(t,e.endPosition,!1),i.destroy()}),Cesium.ScreenSpaceEventType.RIGHT_CLICK)},clearAll(){this._resultObject.entities.forEach((e=>{this._viewer.entities.remove(e)})),this._resultObject={viewPoint:void 0,targetPoints:[],targetPoint:void 0,objectExclude:[],entities:[]}}});var N={train:function(e,t,i,n,r,o){var s,a,l,u,c={t:e,x:t,y:i,nugget:0,range:0,sill:0,A:1/3,n:0,model:O,K:[],M:[]};switch(n){case"gaussian":c.model=D;break;case"exponential":c.model=O;break;case"spherical":c.model=j;break;default:c.model=O}var h=e.length,d=Array((h*h-h)/2);for(s=0,l=0;s<h;s++)for(a=0;a<s;a++,l++)d[l]=Array(2),d[l][0]=Math.pow(Math.pow(t[s]-t[a],2)+Math.pow(i[s]-i[a],2),.5),d[l][1]=Math.abs(e[s]-e[a]);d.sort((function(e,t){return e[0]-t[0]})),c.range=d[(h*h-h)/2-1][0];var p=(h*h-h)/2>30?30:(h*h-h)/2,f=c.range/p,m=E(0,p),g=E(0,p);if(p<30)for(u=0;u<p;u++)m[u]=d[u][0],g[u]=d[u][1];else{for(s=0,a=0,l=0,u=0;s<p&&a<(h*h-h)/2;s++,l=0){for(;d[a][0]<=(s+1)*f&&(m[u]+=d[a][0],g[u]+=d[a][1],l++,!(++a>=(h*h-h)/2)););l>0&&(m[u]/=l,g[u]/=l,u++)}if(u<2)return c}h=u,c.range=m[h-1]-m[0];var v=E(1,2*h),y=Array(h),_=c.A;for(s=0;s<h;s++){switch(n){case"gaussian":v[2*s+1]=1-Math.exp(-1/_*Math.pow(m[s]/c.range,2));break;case"exponential":v[2*s+1]=1-Math.exp(-1/_*m[s]/c.range);break;case"spherical":v[2*s+1]=m[s]/c.range*1.5-.5*Math.pow(m[s]/c.range,3)}y[s]=g[s]}var b=P(v,h,2),C=x(b,v,2,h,2),T=(C=A(C,k(1/o,2),2,2)).slice(0);I(C,2)?M(C,2):(L(T,2),C=T);var w=x(x(C,b,2,2,h),y,2,h,1);c.nugget=w[0],c.sill=w[1]*c.range+c.nugget,c.n=t.length,h=t.length;var S=Array(h*h);for(s=0;s<h;s++){for(a=0;a<s;a++)S[s*h+a]=c.model(Math.pow(Math.pow(t[s]-t[a],2)+Math.pow(i[s]-i[a],2),.5),c.nugget,c.range,c.sill,c.A),S[a*h+s]=S[s*h+a];S[s*h+s]=c.model(0,c.nugget,c.range,c.sill,c.A)}var R=A(S,k(r,h),h,h),N=R.slice(0);I(R,h)?M(R,h):(L(N,h),R=N);var U=R.slice(0),B=x(R,e,h,h,1);return c.K=U,c.M=B,c},predict:R,variance:function(e,t,i){var n,r=Array(i.n);for(n=0;n<i.n;n++)r[n]=i.model(Math.pow(Math.pow(e-i.x[n],2)+Math.pow(t-i.y[n],2),.5),i.nugget,i.range,i.sill,i.A);var o=x(x(r,i.K,1,i.n,i.n),r,1,i.n,1)[0];return i.model(0,i.nugget,i.range,i.sill,i.A)+o},grid:function(e,t,i){var n,r,o,s=e.length;if(0!==s){var a,l,u=[e[0][0][0],e[0][0][0]],c=[e[0][0][1],e[0][0][1]];for(n=0;n<s;n++)for(r=0;r<e[n].length;r++)e[n][r][0]<u[0]&&(u[0]=e[n][r][0]),e[n][r][0]>u[1]&&(u[1]=e[n][r][0]),e[n][r][1]<c[0]&&(c[0]=e[n][r][1]),e[n][r][1]>c[1]&&(c[1]=e[n][r][1]);var h=Array(2),d=Array(2),p=Array(2),f=Array(2),m=Math.ceil((u[1]-u[0])/i),g=Math.ceil((c[1]-c[0])/i),v=Array(m+1);for(n=0;n<=m;n++)v[n]=Array(g+1);for(n=0;n<s;n++){for(p[0]=e[n][0][0],p[1]=p[0],f[0]=e[n][0][1],f[1]=f[0],r=1;r<e[n].length;r++)e[n][r][0]<p[0]&&(p[0]=e[n][r][0]),e[n][r][0]>p[1]&&(p[1]=e[n][r][0]),e[n][r][1]<f[0]&&(f[0]=e[n][r][1]),e[n][r][1]>f[1]&&(f[1]=e[n][r][1]);for(h[0]=Math.floor((p[0]-(p[0]-u[0])%i-u[0])/i),h[1]=Math.ceil((p[1]-(p[1]-u[1])%i-u[0])/i),d[0]=Math.floor((f[0]-(f[0]-c[0])%i-c[0])/i),d[1]=Math.ceil((f[1]-(f[1]-c[1])%i-c[0])/i),r=h[0];r<=h[1];r++)for(o=d[0];o<=d[1];o++)a=u[0]+r*i,l=c[0]+o*i,S(e[n],a,l)&&(v[r][o]=R(a,l,t))}return{xlim:u,ylim:c,width:i,data:v,zlim:[w(t.t),T(t.t)]}}},plot:function(e,t,i,n,r){var o=e.getContext("2d"),s=t.data,a=t.zlim,l=t.width;if(o){o.clearRect(0,0,e.width,e.height);var u=[i[1]-i[0],n[1]-n[0],a[1]-a[0]],c=void 0,h=void 0,d=void 0,p=void 0,f=void 0,m=s.length,g=s[0].length,v=Math.ceil(l*e.width/(i[1]-i[0])),y=Math.ceil(l*e.height/(n[1]-n[0]));for(c=0;c<m;c++)for(h=0;h<g;h++)void 0!==s[c][h]&&(d=e.width*(c*l+t.xlim[0]-i[0])/u[0],p=e.height*(1-(h*l+t.ylim[0]-n[0])/u[1]),(f=(s[c][h]-a[0])/u[2])<0&&(f=0),f>1&&(f=1),o.fillStyle=r[Math.floor((r.length-1)*f)],o.fillRect(Math.round(d-v/2),Math.round(p-y/2),v,y))}},max:T,min:w,pip:S,rep:E,matrixDiag:k,matrixTranspose:P,matrixAdd:A,matrixMultiply:x,matrixChol:I,matrixChol2inv:M,matrixSolve:L,variogramGaussian:D,variogramExponential:O,variogramSpherical:j},U=6371008.8,B={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*U,kilometers:6371.0088,kilometres:6371.0088,meters:U,metres:U,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:U/1852,radians:1,yards:6967335.223679999};function F(e,t,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}function W(e,t,i){if(void 0===i&&(i={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!q(e[0])||!q(e[1]))throw new Error("coordinates must contain numbers");return F({type:"Point",coordinates:e},t,i)}function H(e,t,i){void 0===i&&(i={});for(var n=0,r=e;n<r.length;n++){var o=r[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return F({type:"Polygon",coordinates:e},t,i)}function V(e,t,i){if(void 0===i&&(i={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");return F({type:"LineString",coordinates:e},t,i)}function G(e,t){void 0===t&&(t={});var i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function z(e){return 180*(e%(2*Math.PI))/Math.PI}function Y(e){return e%360*Math.PI/180}function q(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}function X(e,t,i){if(null!==e)for(var n,r,o,s,a,l,u,c,h=0,d=0,p=e.type,f="FeatureCollection"===p,m="Feature"===p,g=f?e.features.length:1,v=0;v<g;v++){a=(c=!!(u=f?e.features[v].geometry:m?e.geometry:e)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var y=0;y<a;y++){var _=0,b=0;if(null!==(s=c?u.geometries[y]:u)){l=s.coordinates;var C=s.type;switch(h=!i||"Polygon"!==C&&"MultiPolygon"!==C?0:1,C){case null:break;case"Point":if(!1===t(l,d,v,_,b))return!1;d++,_++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],d,v,_,b))return!1;d++,"MultiPoint"===C&&_++}"LineString"===C&&_++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-h;r++){if(!1===t(l[n][r],d,v,_,b))return!1;d++}"MultiLineString"===C&&_++,"Polygon"===C&&b++}"Polygon"===C&&_++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(b=0,r=0;r<l[n].length;r++){for(o=0;o<l[n][r].length-h;o++){if(!1===t(l[n][r][o],d,v,_,b))return!1;d++}b++}_++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===X(s.geometries[n],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Z(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length&&!1!==t(e.features[i],i);i++);}function Q(e,t){!function(e,t){var i,n,r,o,s,a,l,u,c,h,d=0,p="FeatureCollection"===e.type,f="Feature"===e.type,m=p?e.features.length:1;for(i=0;i<m;i++){for(a=p?e.features[i].geometry:f?e.geometry:e,u=p?e.features[i].properties:f?e.properties:{},c=p?e.features[i].bbox:f?e.bbox:void 0,h=p?e.features[i].id:f?e.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,r=0;r<s;r++)if(null!==(o=l?a.geometries[r]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,d,u,c,h))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===t(o.geometries[n],d,u,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,d,u,c,h))return!1;d++}}(e,(function(e,i,n,r,o){var s,a=null===e?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==t(F(e,n,{bbox:r,id:o}),i,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<e.coordinates.length;l++){var u=e.coordinates[l];if(!1===t(F({type:s,coordinates:u},n),i,l))return!1}}))}function K(e){var t=[1/0,1/0,-1/0,-1/0];return X(e,(function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])})),t}function J(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function $(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ee(e){return"Feature"===e.type?e.geometry:e}K.default=K;var te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ie(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ne(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})})),t}var re={exports:{}};function oe(e,t,i,n,r){se(e,t,i||0,n||e.length-1,r||le)}function se(e,t,i,n,r){for(;n>i;){if(n-i>600){var o=n-i+1,s=t-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);se(e,t,Math.max(i,Math.floor(t-s*l/o+u)),Math.min(n,Math.floor(t+(o-s)*l/o+u)),r)}var c=e[t],h=i,d=n;for(ae(e,i,t),r(e[n],c)>0&&ae(e,i,n);h<d;){for(ae(e,h,d),h++,d--;r(e[h],c)<0;)h++;for(;r(e[d],c)>0;)d--}0===r(e[i],c)?ae(e,i,d):ae(e,++d,n),d<=t&&(i=d+1),t<=d&&(n=d-1)}}function ae(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function le(e,t){return e<t?-1:e>t?1:0}function ue(e,t,i){if(!i)return t.indexOf(e);for(let n=0;n<t.length;n++)if(i(e,t[n]))return n;return-1}function ce(e,t){he(e,0,e.children.length,t,e)}function he(e,t,i,n,r){r||(r=be(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=t;o<i;o++){const t=e.children[o];de(r,e.leaf?n(t):t)}return r}function de(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function pe(e,t){return e.minX-t.minX}function fe(e,t){return e.minY-t.minY}function me(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function ge(e){return e.maxX-e.minX+(e.maxY-e.minY)}function ve(e,t){const i=Math.max(e.minX,t.minX),n=Math.max(e.minY,t.minY),r=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,r-i)*Math.max(0,o-n)}function ye(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function _e(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function be(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Ce(e,t,i,n,r){const o=[t,i];for(;o.length;){if((i=o.pop())-(t=o.pop())<=n)continue;const s=t+Math.ceil((i-t)/n/2)*n;oe(e,s,t,i,r),o.push(t,s,s,i)}}var Te=ne(Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const i=[];if(!_e(e,t))return i;const n=this.toBBox,r=[];for(;t;){for(let o=0;o<t.children.length;o++){const s=t.children[o],a=t.leaf?n(s):s;_e(e,a)&&(t.leaf?i.push(s):ye(e,a)?this._all(s,i):r.push(s))}t=r.pop()}return i}collides(e){let t=this.data;if(!_e(e,t))return!1;const i=[];for(;t;){for(let n=0;n<t.children.length;n++){const r=t.children[n],o=t.leaf?this.toBBox(r):r;if(_e(e,o)){if(t.leaf||ye(e,o))return!0;i.push(r)}}t=i.pop()}return!1}load(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}else this.data=t;return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=be([]),this}remove(e,t){if(!e)return this;let i=this.data;const n=this.toBBox(e),r=[],o=[];let s,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],s=o.pop(),l=!0),i.leaf){const n=ue(e,i.children,t);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!ye(i,n)?a?(s++,i=a.children[s],l=!1):i=null:(r.push(i),o.push(s),s=0,a=i,i=i.children[0])}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,n){const r=i-t+1;let o,s=this._maxEntries;if(r<=s)return o=be(e.slice(t,i+1)),ce(o,this.toBBox),o;n||(n=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,n-1))),o=be([]),o.leaf=!1,o.height=n;const a=Math.ceil(r/s),l=a*Math.ceil(Math.sqrt(s));Ce(e,t,i,l,this.compareMinX);for(let u=t;u<=i;u+=l){const t=Math.min(u+l-1,i);Ce(e,u,t,a,this.compareMinY);for(let i=u;i<=t;i+=a){const r=Math.min(i+a-1,t);o.children.push(this._build(e,i,r,n-1))}}return ce(o,this.toBBox),o}_chooseSubtree(e,t,i,n){for(;n.push(t),!t.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let a=0;a<t.children.length;a++){const l=t.children[a],u=me(l),c=(r=e,o=l,(Math.max(o.maxX,r.maxX)-Math.min(o.minX,r.minX))*(Math.max(o.maxY,r.maxY)-Math.min(o.minY,r.minY))-u);c<s?(s=c,n=u<n?u:n,i=l):c===s&&u<n&&(n=u,i=l)}t=i||t.children[0]}var r,o;return t}_insert(e,t,i){const n=i?e:this.toBBox(e),r=[],o=this._chooseSubtree(n,this.data,t,r);for(o.children.push(e),de(o,n);t>=0&&r[t].children.length>this._maxEntries;)this._split(r,t),t--;this._adjustParentBBoxes(n,r,t)}_split(e,t){const i=e[t],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),s=be(i.children.splice(o,i.children.length-o));s.height=i.height,s.leaf=i.leaf,ce(i,this.toBBox),ce(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(i,s)}_splitRoot(e,t){this.data=be([e,t]),this.data.height=e.height+1,this.data.leaf=!1,ce(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let n,r=1/0,o=1/0;for(let s=t;s<=i-t;s++){const t=he(e,0,s,this.toBBox),a=he(e,s,i,this.toBBox),l=ve(t,a),u=me(t)+me(a);l<r?(r=l,n=s,o=u<o?u:o):l===r&&u<o&&(o=u,n=s)}return n||i-t}_chooseSplitAxis(e,t,i){const n=e.leaf?this.compareMinX:pe,r=e.leaf?this.compareMinY:fe;this._allDistMargin(e,t,i,n)<this._allDistMargin(e,t,i,r)&&e.children.sort(n)}_allDistMargin(e,t,i,n){e.children.sort(n);const r=this.toBBox,o=he(e,0,t,r),s=he(e,i-t,i,r);let a=ge(o)+ge(s);for(let l=t;l<i-t;l++){const t=e.children[l];de(o,e.leaf?r(t):t),a+=ge(o)}for(let l=i-t-1;l>=t;l--){const t=e.children[l];de(s,e.leaf?r(t):t),a+=ge(s)}return a}_adjustParentBBoxes(e,t,i){for(let n=i;n>=0;n--)de(t[n],e)}_condense(e){for(let t,i=e.length-1;i>=0;i--)0===e[i].children.length?i>0?(t=e[i-1].children,t.splice(t.indexOf(e[i]),1)):this.clear():ce(e[i],this.toBBox)}}}));function we(e,t){return e<t?-1:e>t?1:0}var Ee=ne(Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:class{constructor(e=[],t=we){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,n=t[e];for(;e>0;){const r=e-1>>1,o=t[r];if(i(n,o)>=0)break;t[e]=o,e=r}t[e]=n}_down(e){const{data:t,compare:i}=this,n=this.length>>1,r=t[e];for(;e<n;){let n=1+(e<<1),o=t[n];const s=n+1;if(s<this.length&&i(t[s],o)<0&&(n=s,o=t[s]),i(o,r)>=0)break;t[e]=o,e=n}t[e]=r}}})),Se={exports:{}},ke=function(e,t,i,n){var r=e[0],o=e[1],s=!1;void 0===i&&(i=0),void 0===n&&(n=t.length);for(var a=(n-i)/2,l=0,u=a-1;l<a;u=l++){var c=t[i+2*l+0],h=t[i+2*l+1],d=t[i+2*u+0],p=t[i+2*u+1];h>o!=p>o&&r<(d-c)*(o-h)/(p-h)+c&&(s=!s)}return s},Pe=function(e,t,i,n){var r=e[0],o=e[1],s=!1;void 0===i&&(i=0),void 0===n&&(n=t.length);for(var a=n-i,l=0,u=a-1;l<a;u=l++){var c=t[l+i][0],h=t[l+i][1],d=t[u+i][0],p=t[u+i][1];h>o!=p>o&&r<(d-c)*(o-h)/(p-h)+c&&(s=!s)}return s};Se.exports=function(e,t,i,n){return t.length>0&&Array.isArray(t[0])?Pe(e,t,i,n):ke(e,t,i,n)},Se.exports.nested=Pe,Se.exports.flat=ke;var Ae={exports:{}};(function(e){const t=134217729,i=33306690738754706e-32;function n(e,t,i,n,r){let o,s,a,l,u=t[0],c=n[0],h=0,d=0;c>u==c>-u?(o=u,u=t[++h]):(o=c,c=n[++d]);let p=0;if(h<e&&d<i)for(c>u==c>-u?(a=o-((s=u+o)-u),u=t[++h]):(a=o-((s=c+o)-c),c=n[++d]),o=s,0!==a&&(r[p++]=a);h<e&&d<i;)c>u==c>-u?(a=o-((s=o+u)-(l=s-o))+(u-l),u=t[++h]):(a=o-((s=o+c)-(l=s-o))+(c-l),c=n[++d]),o=s,0!==a&&(r[p++]=a);for(;h<e;)a=o-((s=o+u)-(l=s-o))+(u-l),u=t[++h],o=s,0!==a&&(r[p++]=a);for(;d<i;)a=o-((s=o+c)-(l=s-o))+(c-l),c=n[++d],o=s,0!==a&&(r[p++]=a);return 0===o&&0!==p||(r[p++]=o),p}function r(e){return new Float64Array(e)}const o=33306690738754716e-32,s=22204460492503146e-32,a=11093356479670487e-47,l=r(4),u=r(8),c=r(12),h=r(16),d=r(4);e.orient2d=function(e,r,p,f,m,g){const v=(r-g)*(p-m),y=(e-m)*(f-g),_=v-y;if(0===v||0===y||v>0!=y>0)return _;const b=Math.abs(v+y);return Math.abs(_)>=o*b?_:-function(e,r,o,p,f,m,g){let v,y,_,b,C,T,w,E,S,k,P,A,x,I,M,L,D,O;const j=e-f,R=o-f,N=r-m,U=p-m;C=(M=(E=j-(w=(T=t*j)-(T-j)))*(k=U-(S=(T=t*U)-(T-U)))-((I=j*U)-w*S-E*S-w*k))-(P=M-(D=(E=N-(w=(T=t*N)-(T-N)))*(k=R-(S=(T=t*R)-(T-R)))-((L=N*R)-w*S-E*S-w*k))),l[0]=M-(P+C)+(C-D),C=(x=I-((A=I+P)-(C=A-I))+(P-C))-(P=x-L),l[1]=x-(P+C)+(C-L),C=(O=A+P)-A,l[2]=A-(O-C)+(P-C),l[3]=O;let B=function(e,t){let i=t[0];for(let n=1;n<e;n++)i+=t[n];return i}(4,l),F=s*g;if(B>=F||-B>=F)return B;if(v=e-(j+(C=e-j))+(C-f),_=o-(R+(C=o-R))+(C-f),y=r-(N+(C=r-N))+(C-m),b=p-(U+(C=p-U))+(C-m),0===v&&0===y&&0===_&&0===b)return B;if(F=a*g+i*Math.abs(B),(B+=j*b+U*v-(N*_+R*y))>=F||-B>=F)return B;C=(M=(E=v-(w=(T=t*v)-(T-v)))*(k=U-(S=(T=t*U)-(T-U)))-((I=v*U)-w*S-E*S-w*k))-(P=M-(D=(E=y-(w=(T=t*y)-(T-y)))*(k=R-(S=(T=t*R)-(T-R)))-((L=y*R)-w*S-E*S-w*k))),d[0]=M-(P+C)+(C-D),C=(x=I-((A=I+P)-(C=A-I))+(P-C))-(P=x-L),d[1]=x-(P+C)+(C-L),C=(O=A+P)-A,d[2]=A-(O-C)+(P-C),d[3]=O;const W=n(4,l,4,d,u);C=(M=(E=j-(w=(T=t*j)-(T-j)))*(k=b-(S=(T=t*b)-(T-b)))-((I=j*b)-w*S-E*S-w*k))-(P=M-(D=(E=N-(w=(T=t*N)-(T-N)))*(k=_-(S=(T=t*_)-(T-_)))-((L=N*_)-w*S-E*S-w*k))),d[0]=M-(P+C)+(C-D),C=(x=I-((A=I+P)-(C=A-I))+(P-C))-(P=x-L),d[1]=x-(P+C)+(C-L),C=(O=A+P)-A,d[2]=A-(O-C)+(P-C),d[3]=O;const H=n(W,u,4,d,c);C=(M=(E=v-(w=(T=t*v)-(T-v)))*(k=b-(S=(T=t*b)-(T-b)))-((I=v*b)-w*S-E*S-w*k))-(P=M-(D=(E=y-(w=(T=t*y)-(T-y)))*(k=_-(S=(T=t*_)-(T-_)))-((L=y*_)-w*S-E*S-w*k))),d[0]=M-(P+C)+(C-D),C=(x=I-((A=I+P)-(C=A-I))+(P-C))-(P=x-L),d[1]=x-(P+C)+(C-L),C=(O=A+P)-A,d[2]=A-(O-C)+(P-C),d[3]=O;const V=n(H,c,4,d,h);return h[V-1]}(e,r,p,f,m,g,b)},e.orient2dfast=function(e,t,i,n,r,o){return(t-o)*(i-r)-(e-r)*(n-o)},Object.defineProperty(e,"__esModule",{value:!0})})(Ae.exports);var xe=Te,Ie=Ee,Me=Se.exports,Le=Ae.exports.orient2d;function De(e,t,i){t=Math.max(0,void 0===t?2:t),i=i||0;var n=function(e){for(var t=e[0],i=e[0],n=e[0],r=e[0],o=0;o<e.length;o++){var s=e[o];s[0]<t[0]&&(t=s),s[0]>n[0]&&(n=s),s[1]<i[1]&&(i=s),s[1]>r[1]&&(r=s)}var a=[t,i,n,r],l=a.slice();for(o=0;o<e.length;o++)Me(e[o],a)||l.push(e[o]);return function(e){e.sort(ze);for(var t=[],i=0;i<e.length;i++){for(;t.length>=2&&Be(t[t.length-2],t[t.length-1],e[i])<=0;)t.pop();t.push(e[i])}for(var n=[],r=e.length-1;r>=0;r--){for(;n.length>=2&&Be(n[n.length-2],n[n.length-1],e[r])<=0;)n.pop();n.push(e[r])}return n.pop(),t.pop(),t.concat(n)}(l)}(e),r=new xe(16);r.toBBox=function(e){return{minX:e[0],minY:e[1],maxX:e[0],maxY:e[1]}},r.compareMinX=function(e,t){return e[0]-t[0]},r.compareMinY=function(e,t){return e[1]-t[1]},r.load(e);for(var o,s=[],a=0;a<n.length;a++){var l=n[a];r.remove(l),o=We(l,o),s.push(o)}var u=new xe(16);for(a=0;a<s.length;a++)u.insert(Fe(s[a]));for(var c=t*t,h=i*i;s.length;){var d=s.shift(),p=d.p,f=d.next.p,m=He(p,f);if(!(m<h)){var g=m/c;(l=Oe(r,d.prev.p,p,f,d.next.next.p,g,u))&&Math.min(He(l,p),He(l,f))<=g&&(s.push(d),s.push(We(l,d)),r.remove(l),u.remove(d),u.insert(Fe(d)),u.insert(Fe(d.next)))}}d=o;var v=[];do{v.push(d.p),d=d.next}while(d!==o);return v.push(d.p),v}function Oe(e,t,i,n,r,o,s){for(var a=new Ie([],je),l=e.data;l;){for(var u=0;u<l.children.length;u++){var c=l.children[u],h=l.leaf?Ve(c,i,n):Re(i,n,c);h>o||a.push({node:c,dist:h})}for(;a.length&&!a.peek().node.children;){var d=a.pop(),p=d.node,f=Ve(p,t,i),m=Ve(p,n,r);if(d.dist<f&&d.dist<m&&Ue(i,p,s)&&Ue(n,p,s))return p}(l=a.pop())&&(l=l.node)}return null}function je(e,t){return e.dist-t.dist}function Re(e,t,i){if(Ne(e,i)||Ne(t,i))return 0;var n=Ge(e[0],e[1],t[0],t[1],i.minX,i.minY,i.maxX,i.minY);if(0===n)return 0;var r=Ge(e[0],e[1],t[0],t[1],i.minX,i.minY,i.minX,i.maxY);if(0===r)return 0;var o=Ge(e[0],e[1],t[0],t[1],i.maxX,i.minY,i.maxX,i.maxY);if(0===o)return 0;var s=Ge(e[0],e[1],t[0],t[1],i.minX,i.maxY,i.maxX,i.maxY);return 0===s?0:Math.min(n,r,o,s)}function Ne(e,t){return e[0]>=t.minX&&e[0]<=t.maxX&&e[1]>=t.minY&&e[1]<=t.maxY}function Ue(e,t,i){for(var n,r,o,s,a=Math.min(e[0],t[0]),l=Math.min(e[1],t[1]),u=Math.max(e[0],t[0]),c=Math.max(e[1],t[1]),h=i.search({minX:a,minY:l,maxX:u,maxY:c}),d=0;d<h.length;d++)if(n=h[d].p,r=h[d].next.p,o=e,n!==(s=t)&&r!==o&&Be(n,r,o)>0!=Be(n,r,s)>0&&Be(o,s,n)>0!=Be(o,s,r)>0)return!1;return!0}function Be(e,t,i){return Le(e[0],e[1],t[0],t[1],i[0],i[1])}function Fe(e){var t=e.p,i=e.next.p;return e.minX=Math.min(t[0],i[0]),e.minY=Math.min(t[1],i[1]),e.maxX=Math.max(t[0],i[0]),e.maxY=Math.max(t[1],i[1]),e}function We(e,t){var i={p:e,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(i.next=t.next,i.prev=t,t.next.prev=i,t.next=i):(i.prev=i,i.next=i),i}function He(e,t){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n}function Ve(e,t,i){var n=t[0],r=t[1],o=i[0]-n,s=i[1]-r;if(0!==o||0!==s){var a=((e[0]-n)*o+(e[1]-r)*s)/(o*o+s*s);a>1?(n=i[0],r=i[1]):a>0&&(n+=o*a,r+=s*a)}return(o=e[0]-n)*o+(s=e[1]-r)*s}function Ge(e,t,i,n,r,o,s,a){var l,u,c,h,d=i-e,p=n-t,f=s-r,m=a-o,g=e-r,v=t-o,y=d*d+p*p,_=d*f+p*m,b=f*f+m*m,C=d*g+p*v,T=f*g+m*v,w=y*b-_*_,E=w,S=w;0===w?(u=0,E=1,h=T,S=b):(h=y*T-_*C,(u=_*T-b*C)<0?(u=0,h=T,S=b):u>E&&(u=E,h=T+_,S=b)),h<0?(h=0,-C<0?u=0:-C>y?u=E:(u=-C,E=y)):h>S&&(h=S,-C+_<0?u=0:-C+_>y?u=E:(u=-C+_,E=y));var k=(1-(c=0===h?0:h/S))*r+c*s-((1-(l=0===u?0:u/E))*e+l*i),P=(1-c)*o+c*a-((1-l)*t+l*n);return k*k+P*P}function ze(e,t){return e[0]===t[0]?e[1]-t[1]:e[0]-t[0]}Ie.default&&(Ie=Ie.default),re.exports=De,re.exports.default=De;var Ye=re.exports;function qe(e,t,i){if(void 0===i&&(i={}),!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var n=J(e),r=ee(t),o=r.type,s=t.bbox,a=r.coordinates;if(s&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(n,s))return!1;"Polygon"===o&&(a=[a]);for(var l=!1,u=0;u<a.length&&!l;u++)if(Xe(n,a[u][0],i.ignoreBoundary)){for(var c=!1,h=1;h<a[u].length&&!c;)Xe(n,a[u][h],!i.ignoreBoundary)&&(c=!0),h++;c||(l=!0)}return l}function Xe(e,t,i){var n=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var r=0,o=t.length-1;r<t.length;o=r++){var s=t[r][0],a=t[r][1],l=t[o][0],u=t[o][1];if(e[1]*(s-l)+a*(l-e[0])+u*(e[0]-s)==0&&(s-e[0])*(l-e[0])<=0&&(a-e[1])*(u-e[1])<=0)return!i;a>e[1]!=u>e[1]&&e[0]<(l-s)*(e[1]-a)/(u-a)+s&&(n=!n)}return n}function Ze(e,t,i){void 0===i&&(i={});var n=J(e),r=J(t),o=Y(r[1]-n[1]),s=Y(r[0]-n[0]),a=Y(n[1]),l=Y(r[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(e,t){void 0===t&&(t="kilometers");var i=B[t];if(!i)throw new Error(t+" units is invalid");return e*i}(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),i.units)}function Qe(e,t,i,n){void 0===n&&(n={});var r=J(e),o=Y(r[0]),s=Y(r[1]),a=Y(i),l=function(e,t){void 0===t&&(t="kilometers");var i=B[t];if(!i)throw new Error(t+" units is invalid");return e/i}(t,n.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return W([z(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u))),z(u)],n.properties)}function Ke(e,t,i){if(void 0===i&&(i={}),!0===i.final)return function(e,t){var i=Ke(t,e);return i=(i+180)%360}(e,t);var n=J(e),r=J(t),o=Y(n[0]),s=Y(r[0]),a=Y(n[1]),l=Y(r[1]),u=Math.sin(s-o)*Math.cos(l),c=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return z(Math.atan2(u,c))}function Je(e,t){return Qe(e,Ze(e,t)/2,Ke(e,t))}function $e(e,t){void 0===t&&(t={});var i=0,n=0,r=0;return X(e,(function(e){i+=e[0],n+=e[1],r++}),!0),W([i/r,n/r],t.properties)}function et(e,t){switch(void 0===t&&(t={}),function(e,t){return"FeatureCollection"===e.type?"FeatureCollection":"GeometryCollection"===e.type?"GeometryCollection":"Feature"===e.type&&null!==e.geometry?e.geometry.type:e.type}(e)){case"Point":return W(J(e),t.properties);case"Polygon":var i=[];X(e,(function(e){i.push(e)}));var n,r,o,s,a,l,u,c,h=$e(e,{properties:t.properties}),d=h.geometry.coordinates,p=0,f=0,m=0,g=i.map((function(e){return[e[0]-d[0],e[1]-d[1]]}));for(n=0;n<i.length-1;n++)s=(r=g[n])[0],l=r[1],a=(o=g[n+1])[0],m+=c=s*(u=o[1])-a*l,p+=(s+a)*c,f+=(l+u)*c;if(0===m)return h;var v=1/(6*(.5*m));return W([d[0]+v*p,d[1]+v*f],t.properties);default:var y=function(e,t){void 0===t&&(t={}),t.concavity=t.concavity||1/0;var i=[];if(X(e,(function(e){i.push([e[0],e[1]])})),!i.length)return null;var n=Ye(i,t.concavity);return n.length>3?H([n]):null}(e);return y?et(y,{properties:t.properties}):$e(e,{properties:t.properties})}}function tt(e){if(!e)throw new Error("geojson is required");var t=[];return Q(e,(function(e){!function(e,t){var i=[],n=e.geometry;if(null!==n){switch(n.type){case"Polygon":i=$(n);break;case"LineString":i=[$(n)]}i.forEach((function(i){(function(e,t){var i=[];return e.reduce((function(e,n){var r,o,s,a,l,u,c=V([e,n],t);return c.bbox=(o=n,s=(r=e)[0],a=r[1],l=o[0],u=o[1],[s<l?s:l,a<u?a:u,s>l?s:l,a>u?a:u]),i.push(c),n})),i})(i,e.properties).forEach((function(e){e.id=t.length,t.push(e)}))}))}}(e,t)})),G(t)}var it={exports:{}};function nt(e,t,i,n,r){rt(e,t,i||0,n||e.length-1,r||st)}function rt(e,t,i,n,r){for(;n>i;){if(n-i>600){var o=n-i+1,s=t-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);rt(e,t,Math.max(i,Math.floor(t-s*l/o+u)),Math.min(n,Math.floor(t+(o-s)*l/o+u)),r)}var c=e[t],h=i,d=n;for(ot(e,i,t),r(e[n],c)>0&&ot(e,i,n);h<d;){for(ot(e,h,d),h++,d--;r(e[h],c)<0;)h++;for(;r(e[d],c)>0;)d--}0===r(e[i],c)?ot(e,i,d):ot(e,++d,n),d<=t&&(i=d+1),t<=d&&(n=d-1)}}function ot(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function st(e,t){return e<t?-1:e>t?1:0}function at(e,t,i){if(!i)return t.indexOf(e);for(let n=0;n<t.length;n++)if(i(e,t[n]))return n;return-1}function lt(e,t){ut(e,0,e.children.length,t,e)}function ut(e,t,i,n,r){r||(r=yt(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=t;o<i;o++){const t=e.children[o];ct(r,e.leaf?n(t):t)}return r}function ct(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function ht(e,t){return e.minX-t.minX}function dt(e,t){return e.minY-t.minY}function pt(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function ft(e){return e.maxX-e.minX+(e.maxY-e.minY)}function mt(e,t){const i=Math.max(e.minX,t.minX),n=Math.max(e.minY,t.minY),r=Math.min(e.maxX,t.maxX),o=Math.min(e.maxY,t.maxY);return Math.max(0,r-i)*Math.max(0,o-n)}function gt(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function vt(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function yt(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _t(e,t,i,n,r){const o=[t,i];for(;o.length;){if((i=o.pop())-(t=o.pop())<=n)continue;const s=t+Math.ceil((i-t)/n/2)*n;nt(e,s,t,i,r),o.push(t,s,s,i)}}var bt=ne(Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const i=[];if(!vt(e,t))return i;const n=this.toBBox,r=[];for(;t;){for(let o=0;o<t.children.length;o++){const s=t.children[o],a=t.leaf?n(s):s;vt(e,a)&&(t.leaf?i.push(s):gt(e,a)?this._all(s,i):r.push(s))}t=r.pop()}return i}collides(e){let t=this.data;if(!vt(e,t))return!1;const i=[];for(;t;){for(let n=0;n<t.children.length;n++){const r=t.children[n],o=t.leaf?this.toBBox(r):r;if(vt(e,o)){if(t.leaf||gt(e,o))return!0;i.push(r)}}t=i.pop()}return!1}load(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}else this.data=t;return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=yt([]),this}remove(e,t){if(!e)return this;let i=this.data;const n=this.toBBox(e),r=[],o=[];let s,a,l;for(;i||r.length;){if(i||(i=r.pop(),a=r[r.length-1],s=o.pop(),l=!0),i.leaf){const n=at(e,i.children,t);if(-1!==n)return i.children.splice(n,1),r.push(i),this._condense(r),this}l||i.leaf||!gt(i,n)?a?(s++,i=a.children[s],l=!1):i=null:(r.push(i),o.push(s),s=0,a=i,i=i.children[0])}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,n){const r=i-t+1;let o,s=this._maxEntries;if(r<=s)return o=yt(e.slice(t,i+1)),lt(o,this.toBBox),o;n||(n=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,n-1))),o=yt([]),o.leaf=!1,o.height=n;const a=Math.ceil(r/s),l=a*Math.ceil(Math.sqrt(s));_t(e,t,i,l,this.compareMinX);for(let u=t;u<=i;u+=l){const t=Math.min(u+l-1,i);_t(e,u,t,a,this.compareMinY);for(let i=u;i<=t;i+=a){const r=Math.min(i+a-1,t);o.children.push(this._build(e,i,r,n-1))}}return lt(o,this.toBBox),o}_chooseSubtree(e,t,i,n){for(;n.push(t),!t.leaf&&n.length-1!==i;){let i,n=1/0,s=1/0;for(let a=0;a<t.children.length;a++){const l=t.children[a],u=pt(l),c=(r=e,o=l,(Math.max(o.maxX,r.maxX)-Math.min(o.minX,r.minX))*(Math.max(o.maxY,r.maxY)-Math.min(o.minY,r.minY))-u);c<s?(s=c,n=u<n?u:n,i=l):c===s&&u<n&&(n=u,i=l)}t=i||t.children[0]}var r,o;return t}_insert(e,t,i){const n=i?e:this.toBBox(e),r=[],o=this._chooseSubtree(n,this.data,t,r);for(o.children.push(e),ct(o,n);t>=0&&r[t].children.length>this._maxEntries;)this._split(r,t),t--;this._adjustParentBBoxes(n,r,t)}_split(e,t){const i=e[t],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);const o=this._chooseSplitIndex(i,r,n),s=yt(i.children.splice(o,i.children.length-o));s.height=i.height,s.leaf=i.leaf,lt(i,this.toBBox),lt(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(i,s)}_splitRoot(e,t){this.data=yt([e,t]),this.data.height=e.height+1,this.data.leaf=!1,lt(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let n,r=1/0,o=1/0;for(let s=t;s<=i-t;s++){const t=ut(e,0,s,this.toBBox),a=ut(e,s,i,this.toBBox),l=mt(t,a),u=pt(t)+pt(a);l<r?(r=l,n=s,o=u<o?u:o):l===r&&u<o&&(o=u,n=s)}return n||i-t}_chooseSplitAxis(e,t,i){const n=e.leaf?this.compareMinX:ht,r=e.leaf?this.compareMinY:dt;this._allDistMargin(e,t,i,n)<this._allDistMargin(e,t,i,r)&&e.children.sort(n)}_allDistMargin(e,t,i,n){e.children.sort(n);const r=this.toBBox,o=ut(e,0,t,r),s=ut(e,i-t,i,r);let a=ft(o)+ft(s);for(let l=t;l<i-t;l++){const t=e.children[l];ct(o,e.leaf?r(t):t),a+=ft(o)}for(let l=i-t-1;l>=t;l--){const t=e.children[l];ct(s,e.leaf?r(t):t),a+=ft(s)}return a}_adjustParentBBoxes(e,t,i){for(let n=i;n>=0;n--)ct(t[n],e)}_condense(e){for(let t,i=e.length-1;i>=0;i--)0===e[i].children.length?i>0?(t=e[i-1].children,t.splice(t.indexOf(e[i]),1)):this.clear():lt(e[i],this.toBBox)}}})),Ct={};!function(e){function t(e,t,i){void 0===i&&(i={});var n={type:"Feature"};return(0===i.id||i.id)&&(n.id=i.id),i.bbox&&(n.bbox=i.bbox),n.properties=t||{},n.geometry=e,n}function i(e,i,n){if(void 0===n&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d(e[0])||!d(e[1]))throw new Error("coordinates must contain numbers");return t({type:"Point",coordinates:e},i,n)}function n(e,i,n){void 0===n&&(n={});for(var r=0,o=e;r<o.length;r++){var s=o[r];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return t({type:"Polygon",coordinates:e},i,n)}function r(e,i,n){if(void 0===n&&(n={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");return t({type:"LineString",coordinates:e},i,n)}function o(e,t){void 0===t&&(t={});var i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function s(e,i,n){return void 0===n&&(n={}),t({type:"MultiLineString",coordinates:e},i,n)}function a(e,i,n){return void 0===n&&(n={}),t({type:"MultiPoint",coordinates:e},i,n)}function l(e,i,n){return void 0===n&&(n={}),t({type:"MultiPolygon",coordinates:e},i,n)}function u(t,i){void 0===i&&(i="kilometers");var n=e.factors[i];if(!n)throw new Error(i+" units is invalid");return t*n}function c(t,i){void 0===i&&(i="kilometers");var n=e.factors[i];if(!n)throw new Error(i+" units is invalid");return t/n}function h(e){return 180*(e%(2*Math.PI))/Math.PI}function d(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=6371008.8,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:1.0936*e.earthRadius},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1.0936133},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},e.feature=t,e.geometry=function(e,t,o){switch(e){case"Point":return i(t).geometry;case"LineString":return r(t).geometry;case"Polygon":return n(t).geometry;case"MultiPoint":return a(t).geometry;case"MultiLineString":return s(t).geometry;case"MultiPolygon":return l(t).geometry;default:throw new Error(e+" is invalid")}},e.point=i,e.points=function(e,t,n){return void 0===n&&(n={}),o(e.map((function(e){return i(e,t)})),n)},e.polygon=n,e.polygons=function(e,t,i){return void 0===i&&(i={}),o(e.map((function(e){return n(e,t)})),i)},e.lineString=r,e.lineStrings=function(e,t,i){return void 0===i&&(i={}),o(e.map((function(e){return r(e,t)})),i)},e.featureCollection=o,e.multiLineString=s,e.multiPoint=a,e.multiPolygon=l,e.geometryCollection=function(e,i,n){return void 0===n&&(n={}),t({type:"GeometryCollection",geometries:e},i,n)},e.round=function(e,t){if(void 0===t&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var i=Math.pow(10,t||0);return Math.round(e*i)/i},e.radiansToLength=u,e.lengthToRadians=c,e.lengthToDegrees=function(e,t){return h(c(e,t))},e.bearingToAzimuth=function(e){var t=e%360;return t<0&&(t+=360),t},e.radiansToDegrees=h,e.degreesToRadians=function(e){return e%360*Math.PI/180},e.convertLength=function(e,t,i){if(void 0===t&&(t="kilometers"),void 0===i&&(i="kilometers"),!(e>=0))throw new Error("length must be a positive number");return u(c(e,t),i)},e.convertArea=function(t,i,n){if(void 0===i&&(i="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=e.areaFactors[i];if(!r)throw new Error("invalid original units");var o=e.areaFactors[n];if(!o)throw new Error("invalid final units");return t/r*o},e.isNumber=d,e.isObject=function(e){return!!e&&e.constructor===Object},e.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!d(e))throw new Error("bbox must only contain numbers")}))},e.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")}}(Ct);var Tt={};Object.defineProperty(Tt,"__esModule",{value:!0});var wt=Ct;function Et(e,t,i){if(null!==e)for(var n,r,o,s,a,l,u,c,h=0,d=0,p=e.type,f="FeatureCollection"===p,m="Feature"===p,g=f?e.features.length:1,v=0;v<g;v++){a=(c=!!(u=f?e.features[v].geometry:m?e.geometry:e)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var y=0;y<a;y++){var _=0,b=0;if(null!==(s=c?u.geometries[y]:u)){l=s.coordinates;var C=s.type;switch(h=!i||"Polygon"!==C&&"MultiPolygon"!==C?0:1,C){case null:break;case"Point":if(!1===t(l,d,v,_,b))return!1;d++,_++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(!1===t(l[n],d,v,_,b))return!1;d++,"MultiPoint"===C&&_++}"LineString"===C&&_++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(r=0;r<l[n].length-h;r++){if(!1===t(l[n][r],d,v,_,b))return!1;d++}"MultiLineString"===C&&_++,"Polygon"===C&&b++}"Polygon"===C&&_++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(b=0,r=0;r<l[n].length;r++){for(o=0;o<l[n][r].length-h;o++){if(!1===t(l[n][r][o],d,v,_,b))return!1;d++}b++}_++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===Et(s.geometries[n],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function St(e,t){var i;switch(e.type){case"FeatureCollection":for(i=0;i<e.features.length&&!1!==t(e.features[i].properties,i);i++);break;case"Feature":t(e.properties,0)}}function kt(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length&&!1!==t(e.features[i],i);i++);}function Pt(e,t){var i,n,r,o,s,a,l,u,c,h,d=0,p="FeatureCollection"===e.type,f="Feature"===e.type,m=p?e.features.length:1;for(i=0;i<m;i++){for(a=p?e.features[i].geometry:f?e.geometry:e,u=p?e.features[i].properties:f?e.properties:{},c=p?e.features[i].bbox:f?e.bbox:void 0,h=p?e.features[i].id:f?e.id:void 0,s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,r=0;r<s;r++)if(null!==(o=l?a.geometries[r]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,d,u,c,h))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===t(o.geometries[n],d,u,c,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,d,u,c,h))return!1;d++}}function At(e,t){Pt(e,(function(e,i,n,r,o){var s,a=null===e?null:e.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==t(wt.feature(e,n,{bbox:r,id:o}),i,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var l=0;l<e.coordinates.length;l++){var u={type:s,coordinates:e.coordinates[l]};if(!1===t(wt.feature(u,n),i,l))return!1}}))}function xt(e,t){At(e,(function(e,i,n){var r=0;if(e.geometry){var o=e.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,l=0,u=0;return!1!==Et(e,(function(o,c,h,d,p){if(void 0===s||i>a||d>l||p>u)return s=o,a=i,l=d,u=p,void(r=0);var f=wt.lineString([s,o],e.properties);if(!1===t(f,i,n,p,r))return!1;r++,s=o}))&&void 0}}}))}function It(e,t){if(!e)throw new Error("geojson is required");At(e,(function(e,i,n){if(null!==e.geometry){var r=e.geometry.type,o=e.geometry.coordinates;switch(r){case"LineString":if(!1===t(e,i,n,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===t(wt.lineString(o[s],e.properties),i,n,s))return!1}}}))}Tt.coordAll=function(e){var t=[];return Et(e,(function(e){t.push(e)})),t},Tt.coordEach=Et,Tt.coordReduce=function(e,t,i,n){var r=i;return Et(e,(function(e,n,o,s,a){r=0===n&&void 0===i?e:t(r,e,n,o,s,a)}),n),r},Tt.featureEach=kt,Tt.featureReduce=function(e,t,i){var n=i;return kt(e,(function(e,r){n=0===r&&void 0===i?e:t(n,e,r)})),n},Tt.findPoint=function(e,t){if(t=t||{},!wt.isObject(t))throw new Error("options is invalid");var i,n=t.featureIndex||0,r=t.multiFeatureIndex||0,o=t.geometryIndex||0,s=t.coordIndex||0,a=t.properties;switch(e.type){case"FeatureCollection":n<0&&(n=e.features.length+n),a=a||e.features[n].properties,i=e.features[n].geometry;break;case"Feature":a=a||e.properties,i=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":i=e;break;default:throw new Error("geojson is invalid")}if(null===i)return null;var l=i.coordinates;switch(i.type){case"Point":return wt.point(l,a,t);case"MultiPoint":return r<0&&(r=l.length+r),wt.point(l[r],a,t);case"LineString":return s<0&&(s=l.length+s),wt.point(l[s],a,t);case"Polygon":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s),wt.point(l[o][s],a,t);case"MultiLineString":return r<0&&(r=l.length+r),s<0&&(s=l[r].length+s),wt.point(l[r][s],a,t);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),s<0&&(s=l[r][o].length-s),wt.point(l[r][o][s],a,t)}throw new Error("geojson is invalid")},Tt.findSegment=function(e,t){if(t=t||{},!wt.isObject(t))throw new Error("options is invalid");var i,n=t.featureIndex||0,r=t.multiFeatureIndex||0,o=t.geometryIndex||0,s=t.segmentIndex||0,a=t.properties;switch(e.type){case"FeatureCollection":n<0&&(n=e.features.length+n),a=a||e.features[n].properties,i=e.features[n].geometry;break;case"Feature":a=a||e.properties,i=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":i=e;break;default:throw new Error("geojson is invalid")}if(null===i)return null;var l=i.coordinates;switch(i.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=l.length+s-1),wt.lineString([l[s],l[s+1]],a,t);case"Polygon":return o<0&&(o=l.length+o),s<0&&(s=l[o].length+s-1),wt.lineString([l[o][s],l[o][s+1]],a,t);case"MultiLineString":return r<0&&(r=l.length+r),s<0&&(s=l[r].length+s-1),wt.lineString([l[r][s],l[r][s+1]],a,t);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),s<0&&(s=l[r][o].length-s-1),wt.lineString([l[r][o][s],l[r][o][s+1]],a,t)}throw new Error("geojson is invalid")},Tt.flattenEach=At,Tt.flattenReduce=function(e,t,i){var n=i;return At(e,(function(e,r,o){n=0===r&&0===o&&void 0===i?e:t(n,e,r,o)})),n},Tt.geomEach=Pt,Tt.geomReduce=function(e,t,i){var n=i;return Pt(e,(function(e,r,o,s,a){n=0===r&&void 0===i?e:t(n,e,r,o,s,a)})),n},Tt.lineEach=It,Tt.lineReduce=function(e,t,i){var n=i;return It(e,(function(e,r,o,s){n=0===r&&void 0===i?e:t(n,e,r,o,s)})),n},Tt.propEach=St,Tt.propReduce=function(e,t,i){var n=i;return St(e,(function(e,r){n=0===r&&void 0===i?e:t(n,e,r)})),n},Tt.segmentEach=xt,Tt.segmentReduce=function(e,t,i){var n=i,r=!1;return xt(e,(function(e,o,s,a,l){n=!1===r&&void 0===i?e:t(n,e,o,s,a,l),r=!0})),n};var Mt={};Object.defineProperty(Mt,"__esModule",{value:!0});var Lt=Tt;function Dt(e){var t=[1/0,1/0,-1/0,-1/0];return Lt.coordEach(e,(function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])})),t}Dt.default=Dt,Mt.default=Dt;var Ot=bt,jt=Ct,Rt=Tt,Nt=Mt.default,Ut=Rt.featureEach;Rt.coordEach;var Bt=jt.featureCollection;function Ft(e){var t=new Ot(e);return t.insert=function(e){if("Feature"!==e.type)throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Nt(e),Ot.prototype.insert.call(this,e)},t.load=function(e){var t=[];return Array.isArray(e)?e.forEach((function(e){if("Feature"!==e.type)throw new Error("invalid features");e.bbox=e.bbox?e.bbox:Nt(e),t.push(e)})):Ut(e,(function(e){if("Feature"!==e.type)throw new Error("invalid features");e.bbox=e.bbox?e.bbox:Nt(e),t.push(e)})),Ot.prototype.load.call(this,t)},t.remove=function(e,t){if("Feature"!==e.type)throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Nt(e),Ot.prototype.remove.call(this,e,t)},t.clear=function(){return Ot.prototype.clear.call(this)},t.search=function(e){var t=Ot.prototype.search.call(this,this.toBBox(e));return Bt(t)},t.collides=function(e){return Ot.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Ot.prototype.all.call(this);return Bt(e)},t.toJSON=function(){return Ot.prototype.toJSON.call(this)},t.fromJSON=function(e){return Ot.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var t;if(e.bbox)t=e.bbox;else if(Array.isArray(e)&&4===e.length)t=e;else if(Array.isArray(e)&&6===e.length)t=[e[0],e[1],e[3],e[4]];else if("Feature"===e.type)t=Nt(e);else{if("FeatureCollection"!==e.type)throw new Error("invalid geojson");t=Nt(e)}return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}},t}it.exports=Ft,it.exports.default=Ft;var Wt=it.exports;function Ht(e,t){var i={},n=[];if("LineString"===e.type&&(e=F(e)),"LineString"===t.type&&(t=F(t)),"Feature"===e.type&&"Feature"===t.type&&null!==e.geometry&&null!==t.geometry&&"LineString"===e.geometry.type&&"LineString"===t.geometry.type&&2===e.geometry.coordinates.length&&2===t.geometry.coordinates.length){var r=Vt(e,t);return r&&n.push(r),G(n)}var o=Wt();return o.load(tt(t)),Z(tt(e),(function(e){Z(o.search(e),(function(t){var r=Vt(e,t);if(r){var o=$(r).join(",");i[o]||(i[o]=!0,n.push(r))}}))})),G(n)}function Vt(e,t){var i=$(e),n=$(t);if(2!==i.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==n.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var r=i[0][0],o=i[0][1],s=i[1][0],a=i[1][1],l=n[0][0],u=n[0][1],c=n[1][0],h=n[1][1],d=(h-u)*(s-r)-(c-l)*(a-o),p=(c-l)*(o-u)-(h-u)*(r-l),f=(s-r)*(o-u)-(a-o)*(r-l);if(0===d)return null;var m=p/d,g=f/d;return m>=0&&m<=1&&g>=0&&g<=1?W([r+m*(s-r),o+m*(a-o)]):null}function Gt(e,t,i){void 0===i&&(i={});for(var n=J(e),r=$(t),o=0;o<r.length-1;o++){var s=!1;if(i.ignoreEndVertices&&(0===o&&(s="start"),o===r.length-2&&(s="end"),0===o&&o+1===r.length-1&&(s="both")),zt(r[o],r[o+1],n,s,void 0===i.epsilon?null:i.epsilon))return!0}return!1}function zt(e,t,i,n,r){var o=i[0],s=i[1],a=e[0],l=e[1],u=t[0],c=t[1],h=u-a,d=c-l,p=(i[0]-a)*d-(i[1]-l)*h;if(null!==r){if(Math.abs(p)>r)return!1}else if(0!==p)return!1;return n?"start"===n?Math.abs(h)>=Math.abs(d)?h>0?a<o&&o<=u:u<=o&&o<a:d>0?l<s&&s<=c:c<=s&&s<l:"end"===n?Math.abs(h)>=Math.abs(d)?h>0?a<=o&&o<u:u<o&&o<=a:d>0?l<=s&&s<c:c<s&&s<=l:"both"===n&&(Math.abs(h)>=Math.abs(d)?h>0?a<o&&o<u:u<o&&o<a:d>0?l<s&&s<c:c<s&&s<l):Math.abs(h)>=Math.abs(d)?h>0?a<=o&&o<=u:u<=o&&o<=a:d>0?l<=s&&s<=c:c<=s&&s<=l}function Yt(e,t){var i=ee(e),n=ee(t),r=i.type,o=n.type;switch(r){case"Point":switch(o){case"MultiPoint":return function(e,t){var i,n=!1;for(i=0;i<t.coordinates.length;i++)if(Xt(t.coordinates[i],e.coordinates)){n=!0;break}return n}(i,n);case"LineString":return Gt(i,n,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return qe(i,n,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return function(e,t){for(var i=0;i<e.coordinates.length;i++){for(var n=!1,r=0;r<t.coordinates.length;r++)Xt(e.coordinates[i],t.coordinates[r])&&(n=!0);if(!n)return!1}return!0}(i,n);case"LineString":return function(e,t){for(var i=!1,n=0;n<e.coordinates.length;n++){if(!Gt(e.coordinates[n],t))return!1;i||(i=Gt(e.coordinates[n],t,{ignoreEndVertices:!0}))}return i}(i,n);case"Polygon":case"MultiPolygon":return function(e,t){for(var i=!0,n=!1,r=0;r<e.coordinates.length;r++){if(!(n=qe(e.coordinates[1],t))){i=!1;break}n=qe(e.coordinates[1],t,{ignoreBoundary:!0})}return i&&n}(i,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(e,t){for(var i=0;i<e.coordinates.length;i++)if(!Gt(e.coordinates[i],t))return!1;return!0}(i,n);case"Polygon":case"MultiPolygon":return function(e,t){var i=K(t),n=K(e);if(!qt(i,n))return!1;for(var r=!1,o=0;o<e.coordinates.length-1;o++){if(!qe(e.coordinates[o],t))return!1;if(r||(r=qe(e.coordinates[o],t,{ignoreBoundary:!0})),!r)r=qe(Zt(e.coordinates[o],e.coordinates[o+1]),t,{ignoreBoundary:!0})}return r}(i,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(e,t){var i=K(e);if(!qt(K(t),i))return!1;for(var n=0;n<e.coordinates[0].length;n++)if(!qe(e.coordinates[0][n],t))return!1;return!0}(i,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+r+" geometry not supported")}}function qt(e,t){return!(e[0]>t[0])&&(!(e[2]<t[2])&&(!(e[1]>t[1])&&!(e[3]<t[3])))}function Xt(e,t){return e[0]===t[0]&&e[1]===t[1]}function Zt(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}function Qt(e,t){void 0===t&&(t={});var i=ee(e);switch(t.properties||"Feature"!==e.type||(t.properties=e.properties),i.type){case"Polygon":return function(e,t){void 0===t&&(t={});var i=ee(e).coordinates,n=t.properties?t.properties:"Feature"===e.type?e.properties:{};return Kt(i,n)}(i,t);case"MultiPolygon":return function(e,t){void 0===t&&(t={});var i=ee(e).coordinates,n=t.properties?t.properties:"Feature"===e.type?e.properties:{},r=[];return i.forEach((function(e){r.push(Kt(e,n))})),G(r)}(i,t);default:throw new Error("invalid poly")}}function Kt(e,t){return e.length>1?function(e,t,i){return void 0===i&&(i={}),F({type:"MultiLineString",coordinates:e},t,i)}(e,t):V(e[0],t)}function Jt(e,t){var i=!0;return Q(e,(function(e){Q(t,(function(t){if(!1===i)return!1;i=function(e,t){switch(e.type){case"Point":switch(t.type){case"Point":return i=e.coordinates,n=t.coordinates,!(i[0]===n[0]&&i[1]===n[1]);case"LineString":return!$t(t,e);case"Polygon":return!qe(e,t)}break;case"LineString":switch(t.type){case"Point":return!$t(e,t);case"LineString":return!function(e,t){if(Ht(e,t).features.length>0)return!0;return!1}(e,t);case"Polygon":return!ei(t,e)}break;case"Polygon":switch(t.type){case"Point":return!qe(t,e);case"LineString":return!ei(e,t);case"Polygon":return!function(e,t){for(var i=0,n=e.coordinates[0];i<n.length;i++){if(qe(n[i],t))return!0}for(var r=0,o=t.coordinates[0];r<o.length;r++){if(qe(o[r],e))return!0}if(Ht(Qt(e),Qt(t)).features.length>0)return!0;return!1}(t,e)}}var i,n;return!1}(e.geometry,t.geometry)}))})),i}function $t(e,t){for(var i=0;i<e.coordinates.length-1;i++)if(ti(e.coordinates[i],e.coordinates[i+1],t.coordinates))return!0;return!1}function ei(e,t){for(var i=0,n=t.coordinates;i<n.length;i++){if(qe(n[i],e))return!0}return Ht(t,Qt(e)).features.length>0}function ti(e,t,i){var n=i[0]-e[0],r=i[1]-e[1],o=t[0]-e[0],s=t[1]-e[1];return 0==n*s-r*o&&(Math.abs(o)>=Math.abs(s)?o>0?e[0]<=i[0]&&i[0]<=t[0]:t[0]<=i[0]&&i[0]<=e[0]:s>0?e[1]<=i[1]&&i[1]<=t[1]:t[1]<=i[1]&&i[1]<=e[1])}function ii(e,t){var i=!1;return Q(e,(function(e){Q(t,(function(t){if(!0===i)return!0;i=!Jt(e.geometry,t.geometry)}))})),i}function ni(e,t,i){return void 0===i&&(i={}),function(e,t,i,n){void 0===n&&(n={});for(var r=[],o=e[0],s=e[1],a=e[2],l=e[3],u=t/Ze([o,s],[a,s],n)*(a-o),c=i/Ze([o,s],[o,l],n)*(l-s),h=a-o,d=l-s,p=Math.floor(h/u),f=Math.floor(d/c),m=(d-f*c)/2,g=o+(h-p*u)/2,v=0;v<p;v++){for(var y=s+m,_=0;_<f;_++){var b=H([[[g,y],[g,y+c],[g+u,y+c],[g+u,y],[g,y]]],n.properties);n.mask?ii(n.mask,b)&&r.push(b):r.push(b),y+=c}g+=u}return G(r)}(e,t,t,i)}class ri{constructor(e){if(!e)throw new n("no viewer object!");this.viewer=e,this.handler=void 0,this.lightCamera,this.pyramid,this.frustumPrimitive,this.viewershedPolygon}initHandler(){this.handler&&(this.handler.destroy(),this.handler=void 0);let e=document.getElementById("canvasMap");null==e&&(e=document.createElement("canvas"),e.id="canvasMap",e.style.display="none",e.style.top="0px",e.style.position="absolute",document.body.append(e)),this.canvasEle=e}ReturnDistance(e,t){let i=Cesium.Cartographic.fromCartesian(e),n=Cesium.Cartographic.fromCartesian(t),r=new Cesium.EllipsoidGeodesic;return r.setEndPoints(i,n),r.surfaceDistance}getHeight(e,t,i){let n=Cesium.Cartographic.fromDegrees(e,t);return this.viewer.scene.sampleHeight(n,i)}cartesian3ToDegree(e){let t=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),i=Cesium.Math.toDegrees(t.latitude);return[Cesium.Math.toDegrees(t.longitude),i,t.height]}getAngle(e,t,i,n){let r=Math.atan2(Math.abs(e-i),Math.abs(t-n));return r=i>=e?n<t?Math.PI-r:r:n>=t?2*Math.PI-r:Math.PI+r,r=180*r/Math.PI,r}getPitch(e,t){let i=Cesium.Transforms.eastNorthUpToFixedFrame(e);const n=Cesium.Cartesian3.subtract(t,e,new Cesium.Cartesian3);let r=Cesium.Matrix4.multiplyByPointAsVector(Cesium.Matrix4.inverse(i,i),n,n);return Cesium.Cartesian3.normalize(r,r),Cesium.Math.PI_OVER_TWO-Cesium.Math.acosClamped(r.z)}updateViewShed(){this.clear(),this.setLightCamera(),this.addVisualPyramid(),this.createFrustum()}clear(){this.pyramid&&(this.viewer.entities.removeById(this.pyramid.id),this.pyramid=void 0),this.frustumPrimitive&&(this.viewer.scene.primitives.remove(this.frustumPrimitive),this.frustumPrimitive=void 0),this.debugModelMatrixPrimitive&&(this.viewer.scene.primitives.remove(this.debugModelMatrixPrimitive),this.debugModelMatrixPrimitive=void 0)}addVisualPyramid(){let e=this.ViewShedOptions,t=e.viewPosition,i=Number(e.visualRange),n=Cesium.Transforms.eastNorthUpToFixedFrame(t);this.debugModelMatrixPrimitive=this.viewer.scene.primitives.add(new Cesium.DebugModelMatrixPrimitive({modelMatrix:n,length:5}));const r=e.horizontalViewAngle/2,o=e.verticalViewAngle/2,s=Cesium.Math.toDegrees(e.pitch),a=new Cesium.EllipsoidGraphics({radii:new Cesium.Cartesian3(i,i,i),minimumClock:Cesium.Math.toRadians(90-e.direction-r),maximumClock:Cesium.Math.toRadians(90-e.direction+r),minimumCone:Cesium.Math.toRadians(90-s-o),maximumCone:Cesium.Math.toRadians(90-s+o),fill:!1,outline:!0,subdivisions:256,stackPartitions:64,slicePartitions:64,outlineColor:Cesium.Color.YELLOWGREEN.withAlpha(.5)}),l=new Cesium.Entity({position:t,ellipsoid:a});this.pyramid=this.viewer.entities.add(l)}setLightCamera(){this.lightCamera||(this.lightCamera=new Cesium.Camera(this.viewer.scene));let e=this.ViewShedOptions,t=Number(e.visualRange);this.lightCamera.position=e.viewPosition,this.lightCamera.frustum.near=.1,this.lightCamera.frustum.far=t;const i=Cesium.Math.toRadians(e.horizontalViewAngle),n=Cesium.Math.toRadians(e.verticalViewAngle);this.lightCamera.frustum.aspectRatio=t*Math.tan(i/2)*2/(t*Math.tan(n/2)*2),this.lightCamera.frustum.fov=i>n?i:n,this.lightCamera.setView({destination:e.viewPosition,orientation:{heading:Cesium.Math.toRadians(e.direction||0),pitch:e.pitch||0,roll:0}})}createFrustum(){const e=new Cesium.Cartesian3,t=new Cesium.Matrix3,i=new Cesium.Quaternion,n=this.lightCamera.directionWC,r=this.lightCamera.upWC;let o=this.lightCamera.rightWC;o=Cesium.Cartesian3.negate(o,e);let s=t;Cesium.Matrix3.setColumn(s,0,o,s),Cesium.Matrix3.setColumn(s,1,r,s),Cesium.Matrix3.setColumn(s,2,n,s);let a=Cesium.Quaternion.fromRotationMatrix(s,i),l=new Cesium.GeometryInstance({geometry:new Cesium.FrustumOutlineGeometry({frustum:this.lightCamera.frustum,origin:this.ViewShedOptions.viewPosition,orientation:a}),id:"视椎体轮廓线"+Math.random().toString(36).substr(2),attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(0,1,0,1)),show:new Cesium.ShowGeometryInstanceAttribute(!0)}});this.frustumPrimitive=this.viewer.scene.primitives.add(new Cesium.Primitive({geometryInstances:l,appearance:new Cesium.PerInstanceColorAppearance({flat:!0,translucent:!1,closed:!0})}))}addViewershedPolygon(e){let t=new Cesium.PolygonGeometry({polygonHierarchy:new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(e)),height:0,extrudedHeight:0,vertexFormat:Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,stRotation:0,ellipsoid:Cesium.Ellipsoid.WGS84,granularity:Cesium.Math.RADIANS_PER_DEGREE,perPositionHeight:!1,closeTop:!0,closeBottom:!0,arcType:Cesium.ArcType.GEODESIC}),i=new Cesium.GeometryInstance({geometry:t,name:"ViewershedPolygon",attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.BLUE.withAlpha(.6)),show:new Cesium.ShowGeometryInstanceAttribute(!0)}});this.viewershedPolygon=this.viewer.scene.primitives.add(new Cesium.GroundPrimitive({geometryInstances:i,appearance:new Cesium.EllipsoidSurfaceAppearance({aboveGround:!0,material:new Cesium.Material({fabric:{type:"Image",uniforms:{image:this.returnImgae()}}})})}))}drawViewershed(e){const t=this.cartesian3ToDegree(this.ViewShedOptions.viewPosition),i=this.ViewShedOptions.visualRange,n=this.ViewShedOptions.direction;let r=this.computeBoundaryOptions(t,i,n);const o=r.bbox;let s=H([r.boundaryPoints]);const a=this.ViewShedOptions.visualRange/(1e3*e);let l=function(e,t,i){void 0===i&&(i={}),i.mask&&!i.units&&(i.units="kilometers");for(var n=[],r=e[0],o=e[1],s=e[2],a=e[3],l=t/Ze([r,o],[s,o],i)*(s-r),u=t/Ze([r,o],[r,a],i)*(a-o),c=s-r,h=a-o,d=Math.floor(c/l),p=(h-Math.floor(h/u)*u)/2,f=r+(c-d*l)/2;f<=s;){for(var m=o+p;m<=a;){var g=W([f,m],i.properties);i.mask?Yt(g,i.mask)&&n.push(g):n.push(g),m+=u}f+=l}return G(n)}(o,a,{mask:s});console.log(this.ViewShedOptions.visualRange,e,a);let u=this.createTargetPoints(l,a,t),c=N.train(u.values,u.lngs,u.lats,"exponential",0,100),h=N.grid([r.boundaryPoints],c,a/1e3);this.canvasEle.width=3840,this.canvasEle.height=2160,N.plot(this.canvasEle,h,[o[0],o[2]],[o[1],o[3]],["#ff000080","#ff000080","#ff000080","#ff000080","#ff000080","#ff000080","#00ff0080","#00ff0080","#00ff0080","#00ff0080","#00ff0080","#00ff0080"]),this.addViewershedPolygon(r.positionArr)}computeBoundaryOptions(e,t,i){let n=6356725;const r=e[0],o=e[1],s=[r,o,r,o];let a=[],l=[];a.push(r,o),l.push([r,o]);let u=i+45>360?i-45-360:i-45,c=u+90;for(let h=u;h<=c;h++){let e=t*Math.sin(h*Math.PI/180),i=t*Math.cos(h*Math.PI/180),u=n+21412*(90-o)/90,c=r+e/(u*Math.cos(o*Math.PI/180))*180/Math.PI,d=o+i/u*180/Math.PI;a.push(c,d),l.push([c,d]),this.refreshBBox(s,c,d)}return l.push([r,o]),{positionArr:a,boundaryPoints:l,bbox:s}}refreshBBox(e,t,i){e[0]=t<e[0]?t:e[0],e[1]=i<e[1]?i:e[1],e[2]=t>e[2]?t:e[2],e[3]=i>e[3]?i:e[3]}createTargetPoints(e,t,i){let n=[this.frustumPrimitive,this.pyramid,this.debugModelMatrixPrimitive],r=[],o=[],s=[],a=this.getHeight(i[0],i[1],n);[].push({x:i[0],y:i[1],z:a});let l=this.ViewShedOptions.viewPosition;for(let u=0;u<e.features.length;u++){const i=e.features[u].geometry.coordinates,a=i[0],c=i[1];let h=this.getHeight(a,c,n),d=Cesium.Cartesian3.fromDegrees(a,c,h),p=Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(d,l,new Cesium.Cartesian3),new Cesium.Cartesian3),f=new Cesium.Ray(l,p),m=this.viewer.scene.pickFromRay(f,n);if(m){this.ReturnDistance(d,m.position)>t?r.push(0):r.push(1),o.push(a),s.push(c)}}return{values:r,lngs:o,lats:s}}returnImgae(){return this.canvasEle.toDataURL("image/png")}}Object.assign(ri.prototype,{createViewshed:function(e){let t=this,i=t.viewer.scene;t.initHandler(),t.clearAll();let n=0,r="左键点击创建起点";t.handler=new Cesium.ScreenSpaceEventHandler(t.viewer.canvas),t.handler.setInputAction((o=>{if(n++,1===n){r="左键点击创建终点";let e=i.pickPosition(o.position),n=t.cartesian3ToDegree(e);t.handler.setInputAction((function(o){b(r,o.endPosition,!0);let s=i.pickPosition(o.endPosition);if(Cesium.defined(s)){let i=t.cartesian3ToDegree(s),r=Cesium.Cartesian3.distance(s,e),o=t.getAngle(n[0],n[1],i[0],i[1]),a=t.getPitch(e,s);t.ViewShedOptions={viewPosition:e,endPosition:s,direction:o,pitch:a,horizontalViewAngle:90,verticalViewAngle:60,visibleAreaColor:Cesium.Color.GREEN,invisibleAreaColor:Cesium.Color.RED,visualRange:r},t.updateViewShed()}}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)}2===n&&(t.initHandler(),t.drawViewershed(e),b(r,o.endPosition,!1))}),Cesium.ScreenSpaceEventType.LEFT_CLICK),t.handler.setInputAction((function(e){b(r,e.endPosition,!0)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)},clearAll:function(){this.clear(),this.viewershedPolygon&&(this.viewer.scene.primitives.remove(this.viewershedPolygon),this.viewershedPolygon=void 0)}});class oi{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._stopTime=null}}Object.assign(oi.prototype,{startSunShine(e){i((e=e||{}).startTime)||(e.startTime=(new Date).getTime()),i(e.stopTime)||(e.stopTime=(new Date).getTime()+1e3),i(e.speed)||(e.speed=1600),this._stopTime?(this._viewer.clock.shouldAnimate=!0,this._viewer.clock.currentTime=this._stopTime):(this._viewer.scene.globe.enableLighting=!0,this._viewer.shadows=!0,this._viewer.clock.startTime=Cesium.JulianDate.fromDate(new Date(e.startTime)),this._viewer.clock.currentTime=Cesium.JulianDate.fromDate(new Date(e.startTime)),this._viewer.clock.stopTime=Cesium.JulianDate.fromDate(new Date(e.stopTime)),console.log(this._viewer.clock.currentTime),this._viewer.clock.clockRange=Cesium.ClockRange.LOOP_STOP,this._viewer.clock.clockStep=Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER,this._viewer.clock.multiplier=e.speed,this._viewer.clock.canAnimate=!0,this._viewer.clock.shouldAnimate=!0)},stopSunShine(){this._stopTime=this._viewer.clock.currentTime,console.log(this._viewer.clock.currentTime),this._viewer.clock.shouldAnimate=!1},removeSunShine(){this._stopTime&&(this._viewer.clock.shouldAnimate=!0,this._viewer.clock.currentTime=this._stopTime,console.log(this._viewer.clock.currentTime)),this._viewer.scene.globe.enableLighting=!1,this._viewer.shadows=!1,this._stopTime=null}}),Object.assign(oi.prototype,{start(e){document.getElementsByClassName("cesium-viewer-animationContainer").length>0&&(document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display="block"),document.getElementsByClassName("cesium-viewer-timelineContainer").length>0&&(document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display="block"),this._viewer.shadows=!0,i((e=e||{}).startTime)||(e.startTime=new Date((new Date).toLocaleDateString()).getTime(),console.log("当天凌晨0点",new Date((new Date).toLocaleDateString()))),i(e.stopTime)||(e.stopTime=new Date((new Date).toLocaleDateString()).getTime()+864e5-1,console.log("当天23点59分59秒",new Date(new Date((new Date).toLocaleDateString()).getTime()+144e5))),i(e.speed)||(e.speed=1600);let t=Cesium.JulianDate.fromDate(new Date(e.startTime)),n=Cesium.JulianDate.fromDate(new Date(e.stopTime));viewer.timeline.zoomTo(t,n);let r=viewer.clock;r.shouldAnimate=!1,r.startTime=t,r.stopTime=n,r.currentTime=t,r.clockRange=Cesium.ClockRange.UNBOUNDED,r.multiplier=e.speed},remove(){document.getElementsByClassName("cesium-viewer-animationContainer").length>0&&(document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display="none"),document.getElementsByClassName("cesium-viewer-timelineContainer").length>0&&(document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display="none"),this._viewer.shadows=!1,this._viewer.clock.currentTime=Cesium.JulianDate.fromDate(new Date((new Date).getTime())),this._viewer.clock.shouldAnimate=!1}});class si{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._profileEntities=[]}_interPoints(e,t){let i=[],n=[];for(let s=0;s<e.length;s++){const t=e[s];let n=this._viewer.scene.globe.ellipsoid.cartesianToCartographic(t);i.push(n)}for(let s=0;s<i.length;s++){const e=i[s],t=i[s+1];if(t){let i=1e7*Math.abs(e.longitude-t.longitude),r=1e7*Math.abs(e.latitude-t.latitude);i>r&&(r=i);let o=parseInt(r/2);o>1e3&&(o=1e3),o<2&&(o=2);for(let s=0;s<o;s++)n.push(new Cesium.Cartographic(Cesium.Math.lerp(e.longitude,t.longitude,s/(o-1)),Cesium.Math.lerp(e.latitude,t.latitude,s/(o-1))));n.pop()}else n.push(e)}let r=[],o=0;for(let s=0;s<n.length;s++){let e=n[s],i=this._viewer.scene.sampleHeight(e,t);const a=e.longitude/Math.PI*180,l=e.latitude/Math.PI*180;let u=Cesium.Cartesian3.fromDegrees(a,l,i),c=n[s-1];if(c){const e=c.longitude/Math.PI*180,t=c.latitude/Math.PI*180;let n=Cesium.Cartesian3.fromDegrees(e,t,i);o+=Cesium.Cartesian3.distance(n,u)}r.push({position:{lon:a,lat:l,height:i},distance:o})}return r}}Object.assign(si.prototype,{startProfileAnalysis(e,t){return new Promise(((i,n)=>{let r=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));this.removeProfileAnalysis(),t.clampToGround=!0,console.log(r);let o=this._interPoints(r,[t]);console.log(o),i(o)}))},removeProfileAnalysis(){let e=this;e._profileEntities&&e._profileEntities.length>0&&e._profileEntities.forEach((t=>{e._viewer.entities.remove(t)})),e._profileEntities=[]}});class ai{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this.delEntitys=[],this.maxHeigh=-1e6}_VolumeAnalysis(e){let t=this,i=0,n=0,r=0,o=0;const s=e.geom.indices,a=e.geom.attributes.position.values;for(let u=0;u<s.length;u+=3){const l=t._returnPosition(a,s[u]),c=t._returnPosition(a,s[u+1]),h=t._returnPosition(a,s[u+2]);let d=t._viewer.entities.add({name:"三角面",polygon:{hierarchy:[l.heightPos,c.heightPos,h.heightPos],perPositionHeight:!0,material:Cesium.Color.fromRandom(),extrudedHeight:e.height,outline:!0,outlineColor:Cesium.Color.BLACK}});t.delEntitys.push(d);const p=t._computeArea4Triangle(l.noHeightPos,c.noHeightPos,h.noHeightPos),f=(l.height+c.height+h.height)/3;if(f<e.height){r+=p;o+=p*(e.height-f)}else{i+=p;n+=p*(f-e.height)}}let l=i+r;return l=l.toFixed(2),i=i.toFixed(2),n=n.toFixed(2),r=r.toFixed(2),o=o.toFixed(2),{allArea:l,cutArea:i,cutVolume:n,fillArea:r,fillVolume:o}}_computeArea4Triangle(e,t,i){let n=Cesium.Cartesian3.distance(e,t),r=Cesium.Cartesian3.distance(t,i),o=Cesium.Cartesian3.distance(i,e),s=(n+r+o)/2;return Math.sqrt(s*(s-n)*(s-r)*(s-o))}_returnPosition(e,t){let i=new Cesium.Cartesian3(e[3*t],e[3*t+1],e[3*t+2]),n=Cesium.Cartographic.fromCartesian(i),r=this._viewer.scene.sampleHeightSupported?this._viewer.scene.sampleHeight(n):this._viewer.scene.globe.getHeight(n);return r>this.maxHeigh&&(this.maxHeigh=r),{heightPos:Cesium.Cartesian3.fromRadians(n.longitude,n.latitude,r),noHeightPos:Cesium.Cartesian3.fromRadians(n.longitude,n.latitude,0),height:r}}}Object.assign(ai.prototype,{createPolygonGeo(e,t){return new Promise(((i,n)=>{let r=this;(t=t||{}).precision=Cesium.defaultValue(t.precision,256),t.height=Cesium.defaultValue(t.height,10),r.remove();let o=[];for(let t=0;t<e.length;t++)o.push(Cesium.Cartesian3.fromDegrees(e[t][0],e[t][1]));let s=Math.PI/Math.pow(2,11);s/=t.precision;let a=new Cesium.PolygonGeometry.fromPositions({positions:o,vertexFormat:Cesium.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,granularity:s});t.geom=new Cesium.PolygonGeometry.createGeometry(a);let l=r._VolumeAnalysis(t);r._viewer.scene.globe.baseColor=new Cesium.Color(1,1,1,.9),r._viewer.scene.screenSpaceCameraController.enableCollisionDetection=!1,r._viewer.scene.globe.translucency.enabled=!0,i(l)}))},remove(){for(var e=0;e<this.delEntitys.length;e++)this._viewer.entities.remove(this.delEntitys[e]);this._viewer.scene.screenSpaceCameraController.enableCollisionDetection=!0,this._viewer.scene.globe.translucency.enabled=!1}});class li{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this.targetY=0}_setPolygon(e){let t=this;t.HiePolygon=t._viewer.entities.add({polygon:{hierarchy:new Cesium.PolygonHierarchy(t.data),material:t._handleColor("#FFF8DC",e.alpha),height:new Cesium.CallbackProperty(t._createPolygonUpdateFunction(),!1),perPositionHeight:!1,outline:!0,outlineColor:t._handleColor("red",e.alpha),outlineWidth:1}})}_createPolygonUpdateFunction(){let e=this;return function(){return e.targetY}}_handleColor(e,t){return Cesium.Color.fromCssColorString(e).withAlpha(t||1)}_getMinHeight(e){let t=0;return e.map((e=>{let i=e[2]||0;t=i,i<t&&(t=i)})),t}}Object.assign(li.prototype,{addPrimitive(e,t){this.removePrimitive(),(t=t||{}).height=Cesium.defaultValue(t.height,50),t.color=Cesium.defaultValue(t.color,"red"),t.alpha=Cesium.defaultValue(t.alpha,.6),t.baseHeight=this._getMinHeight(e);let i=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0))),n=this;n.data=i,n.baseHeight=t.baseHeight,n.targetY=t.baseHeight;let r=new Cesium.GeometryInstance({geometry:new Cesium.PolygonGeometry({polygonHierarchy:new Cesium.PolygonHierarchy(n.data),height:n.baseHeight,extrudedHeight:n.baseHeight+1e3}),attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString(t.color).withAlpha(t.alpha)),show:new Cesium.ShowGeometryInstanceAttribute(!0)}});n.limitHeightPrimitive=n._viewer.scene.primitives.add(new Cesium.ClassificationPrimitive({geometryInstances:r,releaseGeometryInstances:!1,classificationType:Cesium.ClassificationType.CESIUM_3D_TILE})),n._setPolygon(t)},removePrimitive(){this.HiePolygon&&this._viewer.entities.remove(this.HiePolygon),this.limitHeightPrimitive&&this._viewer.scene.primitives.remove(this.limitHeightPrimitive)},changeHeight(e){if(!this.limitHeightPrimitive)return;this.targetY=this.baseHeight+e;let t=Cesium.Cartographic.fromCartesian(this.limitHeightPrimitive._primitive._boundingSpheres[0].center),i=Cesium.Cartesian3.fromRadians(t.longitude,t.latitude,this.baseHeight),n=Cesium.Cartesian3.fromRadians(t.longitude,t.latitude,this.baseHeight+e),r=Cesium.Cartesian3.subtract(n,i,new Cesium.Cartesian3);this.limitHeightPrimitive._primitive.modelMatrix=Cesium.Matrix4.fromTranslation(r)}});class ui{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._camera=this._viewer.camera,this._scene=this._viewer.scene,this.targetY=0,this._mouseHandler()}_mouseHandler(){let e,t=this,i=t._viewer,n=t._scene;new Cesium.ScreenSpaceEventHandler(i.scene.canvas).setInputAction((function(t){let i=n.pick(t.position);Cesium.defined(i)&&Cesium.defined(i.id)&&Cesium.defined(i.id.plane)&&(e=i.id.plane,e.material=Cesium.Color.RED.withAlpha(.05),e.outlineColor=Cesium.Color.RED,n.screenSpaceCameraController.enableInputs=!1)}),Cesium.ScreenSpaceEventType.LEFT_DOWN),new Cesium.ScreenSpaceEventHandler(i.scene.canvas).setInputAction((function(){Cesium.defined(e)&&(e.material=Cesium.Color.RED.withAlpha(.1),e.outlineColor=Cesium.Color.RED,e=void 0),n.screenSpaceCameraController.enableInputs=!0}),Cesium.ScreenSpaceEventType.LEFT_UP),new Cesium.ScreenSpaceEventHandler(i.scene.canvas).setInputAction((function(i){if(Cesium.defined(e)){let e=i.startPosition.y-i.endPosition.y;t.targetY+=e}}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)}_createPlaneUpdateFunction(e){let t=this;return function(){return e.distance=t.targetY,e}}_createPlane(e,t,i){let n=this._getOriginCoordinateSystemPoint(e,i),r=this._getOriginCoordinateSystemPoint(t,i),o=new Cesium.Cartesian3(0,0,10),s=Cesium.Cartesian3.subtract(r,n,new Cesium.Cartesian3),a=Cesium.Cartesian3.cross(s,o,new Cesium.Cartesian3);a=Cesium.Cartesian3.normalize(a,a);let l=Cesium.Plane.fromPointNormal(n,a);return Cesium.ClippingPlane.fromPlane(l)}_getOriginCoordinateSystemPoint(e,t){let i=Cesium.Cartesian3.fromDegrees(e[0],e[1]);return Cesium.Matrix4.multiplyByPoint(t,i,new Cesium.Cartesian3(0,0,0))}_getInverseTransform(e){let t;const i=e.root.transform;return t=i&&i.equals(Cesium.Matrix4.IDENTITY)||!i?Cesium.Transforms.eastNorthUpToFixedFrame(e.boundingSphere.center):Cesium.Matrix4.fromArray(e.root.transform),Cesium.Matrix4.inverseTransformation(t,new Cesium.Matrix4)}_isDirRes(e,t){var i=[];e.forEach((e=>{i.push([e.lng,e.lat])}));let n=function(e){for(var t,i,n=$(e),r=0,o=1;o<n.length;)t=i||n[0],r+=((i=n[o])[0]-t[0])*(i[1]+t[1]),o++;return r>0}(V(i));var r=[];if(t)if(n)for(var o=0,s=e.length-1;s>=0;s--)r[o]=e[s],o++;else r=e;else if(n)r=e;else for(o=0,s=e.length-1;s>=0;s--)r[o]=e[s],o++;return r}}Object.assign(ui.prototype,{activate(e){let t=this,i=t._viewer,n=t._getInverseTransform(e);[].push(t._createPlane([121.55814450142213,37.39658788787028],[121.65814450142213,37.49658788787028],n));let r=new Cesium.ClippingPlaneCollection({planes:[new Cesium.ClippingPlane(new Cesium.Cartesian3(0,1,0),-10)],edgeWidth:1});return t.tileset=e,e.clippingPlanes=r,e.debugShowBoundingVolume=!1,e.readyPromise.then((function(){let n=e.boundingSphere,o=n.radius;if(i.zoomTo(e,new Cesium.HeadingPitchRange(.5,-.2,o/5)),!Cesium.Matrix4.equals(e.root.transform,Cesium.Matrix4.IDENTITY)){const t=Cesium.Matrix4.getTranslation(e.root.transform,new Cesium.Cartesian3),i=Cesium.Cartographic.fromCartesian(t),n=Cesium.Cartographic.fromCartesian(e.boundingSphere.center).height-i.height;r.modelMatrix=Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0,0,n))}for(let e=0;e<r.length;++e){const s=r.get(e);i.entities.add({position:n.center,plane:{dimensions:new Cesium.Cartesian2(o/10,o/10),material:Cesium.Color.WHITE.withAlpha(.1),plane:new Cesium.CallbackProperty(t._createPlaneUpdateFunction(s),!1),outline:!0,outlineColor:Cesium.Color.WHITE}})}return e}))},addTiles(e,t){let i=this,n=i._viewer,r=e;return i.polygon=t,i.tileset=r,r.readyPromise.then((function(){let e=i._getInverseTransform(r);i.polygon=i._isDirRes(i.polygon,!1);const t=[];for(let n=0;n<i.polygon.length;n++)n===i.polygon.length-1?t.push(i._createPlane(i.polygon[n],i.polygon[0],e)):t.push(i._createPlane(i.polygon[n],i.polygon[n+1],e));let o=new Cesium.ClippingPlaneCollection({planes:t,edgeWidth:1,edgeColor:Cesium.Color.RED,unionClippingRegions:!1});i.clippingPlanes=o,r.clippingPlanes=o,r.debugShowBoundingVolume=!1;let s=r.boundingSphere,a=s.radius;for(let r=0;r<o.length;++r){let e=o.get(r);n.entities.add({position:s.center,plane:{dimensions:new Cesium.Cartesian2(a/10,a/10),material:Cesium.Color.RED.withAlpha(.1),plane:new Cesium.CallbackProperty(i._createPlaneUpdateFunction(e),!1),outline:!0,outlineColor:Cesium.Color.RED}})}return r}))},addTiles2(e,t){let i=this;i._viewer;let n=e;i.polygon=t,i.tileset=n,Cesium.Matrix4.fromArray([1,5551115123125783e-31,5.898416033378595e-9,0,-6106226635438361e-31,1,-1.1355608731111744e-8,0,-5.898416061134171e-9,1.1355608731111744e-8,.9999999999999999,0,9.912469893228263,-19.08345020748675,-14.613607150502503,1]);let r=Cesium.Matrix4.fromArray([-.8874246461620654,-.46095281470464317,0,0,.2602796082288922,-.5010893346724129,.8253266045740758,0,-.3804366214290463,.7324151700322881,.5646556435405804,0,-2429070.591483741,4676437.67731705,3581165.448379543,1]),o=Cesium.Matrix4.inverseTransformation(r,new Cesium.Matrix4),s=[];for(let l=0;l<i.polygon.length-1;l++){let e=i.createPlane(i.polygon[l],i.polygon[l+1],o);s.push(e)}let a=new Cesium.ClippingPlaneCollection({planes:s,edgeWidth:1,edgeColor:Cesium.Color.RED,unionClippingRegions:!1});return i.clippingPlanes=a,n.readyPromise.then((function(){return n.clippingPlanes=a,n.debugShowBoundingVolume=!1,n.boundingSphere.radius,n}))},toggleClipping(){this.tileset=null}});class ci{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._camera=this._viewer.camera,this._scene=this._viewer.scene,this.tileset=void 0,this.targetY=0,this.planeEntities=[],this._mouseHandler()}_mouseHandler(){let e,t=this,i=t._viewer,n=t._scene;new Cesium.ScreenSpaceEventHandler(i.scene.canvas).setInputAction((function(t){let i=n.pick(t.position);Cesium.defined(i)&&Cesium.defined(i.id)&&Cesium.defined(i.id.plane)&&(e=i.id.plane,e.material=Cesium.Color.RED.withAlpha(.05),e.outlineColor=Cesium.Color.RED,n.screenSpaceCameraController.enableInputs=!1)}),Cesium.ScreenSpaceEventType.LEFT_DOWN),new Cesium.ScreenSpaceEventHandler(i.scene.canvas).setInputAction((function(){Cesium.defined(e)&&(e.material=Cesium.Color.RED.withAlpha(.1),e.outlineColor=Cesium.Color.RED,e=void 0),n.screenSpaceCameraController.enableInputs=!0}),Cesium.ScreenSpaceEventType.LEFT_UP),new Cesium.ScreenSpaceEventHandler(i.scene.canvas).setInputAction((function(i){if(Cesium.defined(e)){let e=i.startPosition.y-i.endPosition.y;t.targetY+=e}}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)}_createPlaneUpdateFunction(e){let t=this;return function(){return e.distance=t.targetY,e}}}Object.assign(ci.prototype,{activate(e,t){let i=this,n=i._viewer,r=new Cesium.ClippingPlaneCollection({planes:[new Cesium.ClippingPlane(new Cesium.Cartesian3(0,0,-1),1e5)],edgeWidth:1});return i.tileset=e,e.clippingPlanes=r,e.debugShowBoundingVolume=!1,e.readyPromise.then((function(){let t=e.boundingSphere,o=t.radius;if(!Cesium.Matrix4.equals(e.root.transform,Cesium.Matrix4.IDENTITY)){const t=Cesium.Matrix4.getTranslation(e.root.transform,new Cesium.Cartesian3),i=Cesium.Cartographic.fromCartesian(t),n=Cesium.Cartographic.fromCartesian(e.boundingSphere.center).height-i.height;r.modelMatrix=Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0,0,n))}n.zoomTo(e,new Cesium.HeadingPitchRange(.5,-.2,o/10));let s=Cesium.Cartographic.fromCartesian(t.center),a=Cesium.Math.toDegrees(s.longitude),l=Cesium.Math.toDegrees(s.latitude);s.height;var u=Cesium.Cartesian3.fromDegrees(a,l,105);for(let e=0;e<r.length;++e){let t=r.get(e),s=n.entities.add({position:u,plane:{dimensions:new Cesium.Cartesian2(o/10,o/20),material:Cesium.Color.RED.withAlpha(.1),plane:new Cesium.CallbackProperty(i._createPlaneUpdateFunction(t),!1),outline:!0,outlineColor:Cesium.Color.RED}});i.planeEntities.push(s)}return e}))},toggleClipping(){let e=this;for(let i=0;i<e.planeEntities.length;i++)e._viewer.entities.remove(e.planeEntities[i]);e.planeEntities=[],e.targetY=0;let t=e.tileset.boundingSphere;e._camera.viewBoundingSphere(t,new Cesium.HeadingPitchRange(Cesium.Math.toRadians(120),Cesium.Math.toRadians(-10),2.5*t.radius)),e._camera.lookAtTransform(Cesium.Matrix4.IDENTITY)},reset(){this.planeEntities=[],this.targetY=0}});let hi={SightLine:C,ViewShed:ri,SunshineShadow:oi,Profile:si,CutFill:ai,HeightLimit:li,Cutting:ui,GeologyClipPlan:ci};class di{constructor(e){if(!e)throw new Error("no viewer object!");this.viewer=e}prepareWell(e){let t=e.length,i=this.excavateMinHeight-this.height,n=[],r=[],o=[];for(let s=0;s<t;s++){let a=s==t-1?0:s+1,l=[Cesium.Cartographic.fromCartesian(e[s]).longitude,Cesium.Cartographic.fromCartesian(e[s]).latitude],u=[Cesium.Cartographic.fromCartesian(e[a]).longitude,Cesium.Cartographic.fromCartesian(e[a]).latitude];0==s&&(o.push(new Cesium.Cartographic(l[0],l[1])),r.push(Cesium.Cartesian3.fromRadians(l[0],l[1],i)),n.push(Cesium.Cartesian3.fromRadians(l[0],l[1],0)));for(let e=1;e<=this.splitNum;e++){let a=Cesium.Math.lerp(l[0],u[0],e/this.splitNum),c=Cesium.Math.lerp(l[1],u[1],e/this.splitNum);s==t-1&&e==this.splitNum||(o.push(new Cesium.Cartographic(a,c)),r.push(Cesium.Cartesian3.fromRadians(a,c,i)),n.push(Cesium.Cartesian3.fromRadians(a,c,0)))}}this.wellData={lerp_pos:o,bottom_pos:r,no_height_top:n}}createWell(e){let t=this;if(this.viewer.terrainProvider._layers){this.createBottomSurface(e.bottom_pos),Cesium.sampleTerrainMostDetailed(this.viewer.terrainProvider,e.lerp_pos).then((function(i){let n=[];for(let e=0;e<i.length;e++){const t=i[e];let r=Cesium.Cartesian3.fromRadians(t.longitude,t.latitude,t.height);n.push(r)}t.createWellWall(e.bottom_pos,n)}))}else this.createBottomSurface(e.bottom_pos),this.createWellWall(e.bottom_pos,e.no_height_top)}ellipsoidToDegree(e){let t=new Cesium.Cartesian3(e.x,e.y,e.z),i=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(t);return{longitude:Cesium.Math.toDegrees(i.longitude),latitude:Cesium.Math.toDegrees(i.latitude),altitude:i.height}}createBottomSurface(e){if(e.length){let t=this.getMinHeight(e),i=[];for(let s=0;s<e.length;s++){let n=this.ellipsoidToDegree(e[s]);i.push(n.longitude,n.latitude,t)}let n=new Cesium.PolygonGeometry({polygonHierarchy:new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(i)),perPositionHeight:!0}),r=new Cesium.Material({fabric:{type:"Image",uniforms:{image:this.bottomImg}}}),o=new Cesium.MaterialAppearance({translucent:!1,flat:!0,material:r});this.bottomSurface=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:Cesium.PolygonGeometry.createGeometry(n)}),appearance:o,asynchronous:!1}),this.viewer.scene.primitives.add(this.bottomSurface)}}createWellWall(e,t){let i=this.getMinHeight(e),n=[],r=[];for(let u=0;u<t.length;u++)n.push(this.ellipsoidToDegree(t[u]).altitude),r.push(i);let o=new Cesium.WallGeometry({positions:t,maximumHeights:n,minimumHeights:r}),s=Cesium.WallGeometry.createGeometry(o),a=new Cesium.Material({fabric:{type:"Image",uniforms:{image:this.wallImg}}}),l=new Cesium.MaterialAppearance({translucent:!1,flat:!0,material:a});this.wellWall=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:s,attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.GREY)},id:"PitWall"}),appearance:l,asynchronous:!1}),this.viewer.scene.primitives.add(this.wellWall)}getMinHeight(e){let t=5e6,i=null;for(let n=0;n<e.length;n++){let r=e[n].z;r<t&&(t=r,i=this.ellipsoidToDegree(e[n]))}return i.altitude}switchExcavate(e){e?(this.viewer.scene.globe.material=null,this.wellWall.show=!0,this.bottomSurface.show=!0):(this.viewer.scene.globe.material=null,this.wellWall.show=!1,this.bottomSurface.show=!1)}updateExcavateDepth(e){this.viewer.scene.primitives.remove(this.bottomSurface),this.viewer.scene.primitives.remove(this.wellWall),console.log(this.wellData,this.excavateMinHeight);let t=this.wellData.lerp_pos,i=[];for(let n=0;n<t.length;n++)i.push(Cesium.Cartesian3.fromRadians(t[n].longitude,t[n].latitude,this.excavateMinHeight-e));this.wellData.bottom_pos=i,this.createWell(this.wellData)}}Object.defineProperties(di.prototype,{show:{get:function(){return this._show},set:function(e){this._show=e,this.switchExcavate(e)}},height:{get:function(){return this._height},set:function(e){this._height=e,this.updateExcavateDepth(e)}}}),Object.assign(di.prototype,{add(e,t){t=t||{},this._height=t.excavateDepth||10,this.bottomImg=t.bottomImg||"/jt3dSDK/imgs/polygon/ground.png",this.wallImg=t.wallImg||"/jt3dSDK/imgs/polygon/ground.png",this.splitNum=Cesium.defaultValue(t.splitNum,50),e=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));let i=this.viewer;this.clear();let n=[],r=Cesium.Cartesian3.subtract(e[0],e[1],new Cesium.Cartesian3).x>0;this.excavateMinHeight=999999999;for(let o=0;o<e.length;++o){let t=(o+1)%e.length,s=Cesium.Cartesian3.midpoint(e[o],e[t],new Cesium.Cartesian3),a=Cesium.Cartographic.fromCartesian(e[o]),l=i.scene.globe.getHeight(a)||a.height;console.log(l),l<this.excavateMinHeight&&(this.excavateMinHeight=l);let u=Cesium.Cartesian3.normalize(s,new Cesium.Cartesian3),c=r?Cesium.Cartesian3.subtract(e[o],s,new Cesium.Cartesian3):Cesium.Cartesian3.subtract(e[t],s,new Cesium.Cartesian3);c=Cesium.Cartesian3.normalize(c,c);let h=Cesium.Cartesian3.cross(c,u,new Cesium.Cartesian3);h=Cesium.Cartesian3.normalize(h,h);let d=new Cesium.Plane(h,0),p=Cesium.Plane.getPointDistance(d,s);n.push(new Cesium.ClippingPlane(h,p))}this.viewer.scene.globe.clippingPlanes=new Cesium.ClippingPlaneCollection({planes:n,edgeWidth:1,edgeColor:Cesium.Color.WHITE,enabled:!0}),this.prepareWell(e),this.createWell(this.wellData)},clear(){this.viewer.scene.globe.clippingPlanes&&(this.viewer.scene.globe.clippingPlanes.removeAll(),this.viewer.scene.primitives.remove(this.bottomSurface),this.viewer.scene.primitives.remove(this.wellWall),this.viewer.scene.render())}});const pi=e=>{let t=e||32,i="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",n=i.length,r="";for(let o=0;o<t;o++)r+=i.charAt(Math.floor(Math.random()*n));return r};function fi(e){let t=(new Date).getTime(),i="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?i:3&i|8).toString(16)}));return e&&(i=i.replace(/-/g,"")),i}function mi(e,t){if(!e)throw new n("no viewer object!");if(!i(t))throw new n("points is required.");let r=[];for(let i=0;i<t.length;i++){let e=t[i][0],n=t[i][1];r.push(Cesium.Cartographic.fromDegrees(e,n))}let o=e.terrainProvider;return new Promise(((e,t)=>{new Cesium.sampleTerrainMostDetailed(o,r).then((function(t){e(t)}))}))}var gi=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",setSessionid:pi,guid:()=>{function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},getGuid:fi,getHeigthByLngLat:function(e,t){if(!e)throw new n("no viewer object!");if(!i(t.longitude)&&!i(t.latitude))throw new n("longitude and latitude are required.");t.level=Cesium.defaultValue(t.level,11);let r=Cesium.Cartographic.fromDegrees(t.longitude,t.latitude),o=e.terrainProvider;return new Promise(((e,i)=>{new Cesium.sampleTerrain(o,t.level,[r]).then((function(t){t&&e(t[0].height)}))}))},getHeigthByPoints:function(e,t){if(!e)throw new n("no viewer object!");if(!i(t))throw new n("options is required.");t.level=Cesium.defaultValue(t.level,11);let r=[],o=t.points;for(let i=0;i<o.length;i++){let e=o[i][0],t=o[i][1];r.push(Cesium.Cartographic.fromDegrees(e,t))}let s=e.terrainProvider;return new Promise(((e,i)=>{new Cesium.sampleTerrain(s,t.level,r).then((function(t){t&&e(t)}))}))},getHeigthByPointsMostDetailed:mi});class vi{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this.result=[],this.handler=void 0,this.toolTip=""}_openTip(){let e=this;this.handler=new Cesium.ScreenSpaceEventHandler(e._viewer.canvas),this.handler.setInputAction((function(t){let i=t.endPosition;var n=e._viewer.scene.pick(i);n&&n.id&&"SlopeAspect"===n.id.type?(e.toolTip=n.id.value.toFixed(2),b(e.toolTip,i,!0)):(e.toolTip="",b(e.toolTip,i,!1))}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)}_CreatePolygonOnGround(e,t,i){let n,r=this,o="左键点击开始绘制",s=[],a=!0,l=new Cesium.ScreenSpaceEventHandler(r._viewer.canvas);l.setInputAction((function(e){let i=e.position,a=m.getCatesian3FromPX(r._viewer,i);if(0==s.length){o="左键添加第二个点",s.push(a);let e=new Cesium.CallbackProperty((function(){return s.concat([s[0]])}),!1),i=new Cesium.CallbackProperty((function(){return new Cesium.PolygonHierarchy(s)}),!1);n=r._viewer.entities.add({name:"Polygon",id:t.id,polyline:{positions:e,width:t.outlineWidth,material:t.outlineColor,clampToGround:!0},polygon:{heightReference:Cesium.HeightReference.None,hierarchy:i,material:t.color}}),n.GeoType="Polygon"}else o="左键添加点,Ctrl+Z回退,右键完成绘制";s.push(a)}),Cesium.ScreenSpaceEventType.LEFT_CLICK),l.setInputAction((function(e){let t=e.endPosition;if(b(o,t,!0),Cesium.defined(n)){s.pop();let e=m.getCatesian3FromPX(r._viewer,t);s.push(e)}3===s.length&&(n.polygon.heightReference=Cesium.HeightReference.CLAMP_TO_GROUND)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE),l.setInputAction((function(t){s.pop(),n.pottingPoint=s,e.push(n),l.destroy(),b(o,t.position,!1),a=!1,"function"==typeof i&&i(n)}),Cesium.ScreenSpaceEventType.RIGHT_DOWN),document.onkeydown=function(e){if(e.ctrlKey&&90==window.event.keyCode){if(!a)return!1;s.pop(),2==s.length&&(o="左键添加第二个点")}}}_createEllipse(e){let t=this,i=[];for(let n=0;n<e.features.length;n++){const t=e.features[n].geometry.coordinates[0],r=[(t[0][0]+t[2][0])/2,(t[0][1]+t[2][1])/2];let o=Cesium.Cartographic.fromDegrees(r[0],r[1]);i.push(o);for(let e=0;e<t.length;e++){const n=t[e];let r=Cesium.Cartographic.fromDegrees(n[0],n[1]);i.push(r);const o=t[e+1];if(o){let e=[(n[0]+o[0])/2,(n[1]+o[1])/2],t=Cesium.Cartographic.fromDegrees(e[0],e[1]);i.push(t)}}}Cesium.sampleTerrainMostDetailed(t._viewer.scene.terrainProvider,i).then((e=>{let i=[],n=e.reduce((function(e,t,n,r){var o=10*n,s=o+10,a=r.slice(o,s);return 0!=a.length&&(i[n]=a),i}),[]);t._calculateSlope(n),t._openTip()}))}_createPolygonInsrance(e,t){let i=[];for(let r=1;r<e.length-1;r++){const t=e[r];i.push(Cesium.Cartographic.toCartesian(t))}let n=new Cesium.PolygonGeometry({polygonHierarchy:new Cesium.PolygonHierarchy(i)});return new Cesium.GeometryInstance({geometry:n,attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString(t)),show:new Cesium.ShowGeometryInstanceAttribute(!0)}})}_createArrowInstance(e,t,i,n,r){let o=new Cesium.Cartographic((e.longitude+t.longitude)/2,(e.latitude+t.latitude)/2,(e.height+t.height)/2),s=new Cesium.Cartographic((i.longitude+t.longitude)/2,(i.latitude+t.latitude)/2,(i.height+t.height)/2),a=n>0?[Cesium.Cartographic.toCartesian(o),Cesium.Cartographic.toCartesian(s)]:[Cesium.Cartographic.toCartesian(s),Cesium.Cartographic.toCartesian(o)];return new Cesium.GeometryInstance({id:{type:"SlopeAspect",value:r},geometry:new Cesium.GroundPolylineGeometry({positions:a,width:this.arrowWidth}),attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.BLUE.withAlpha(.6)),show:new Cesium.ShowGeometryInstanceAttribute(!0)}})}_calculateSlope(e){let t=this,i=[],n=[];for(let s=0;s<e.length;s++){const r=e[s],o=r[0];let a=0,l=0;for(let e=1;e<r.length-1;e++){let t=r[e].height-o.height;Math.abs(t)>a&&(a=t,l=e)}let u=new Cesium.Cartographic(o.longitude,o.latitude,0),c=new Cesium.Cartographic(r[l].longitude,r[l].latitude,0),h=Cesium.Cartesian3.distance(Cesium.Cartographic.toCartesian(u),Cesium.Cartographic.toCartesian(c)),d=Math.abs(a/h),p=t._calculateSlopeColor(d,.4);const f=t._createPolygonInsrance(r,p);n.push(f);let m=l>4?r[l-4]:r[l+4],g=r[l];const v=t._createArrowInstance(g,o,m,a,d);i.push(v)}const r=t._viewer.scene.primitives.add(new Cesium.GroundPrimitive({geometryInstances:n,appearance:new Cesium.PerInstanceColorAppearance({translucent:!0,closed:!1})})),o=t._viewer.scene.primitives.add(new Cesium.GroundPolylinePrimitive({geometryInstances:i,appearance:new Cesium.PolylineMaterialAppearance({material:new Cesium.Material({fabric:{type:"PolylineArrow",uniforms:{color:new Cesium.Color(1,1,0,.8)}}})})}));t.result.push(o,r)}_calculateSlopeColor(e,t){return e<.00872686779075879?"rgba(85,182,43,"+t+")":e<.03492076949174773?"rgba(135,211,43,"+t+")":e<.08748866352592401?"rgba(204,244,44,"+t+")":e<.2679491924311227?"rgba(245,233,44,"+t+")":e<.7002075382097097?"rgba(255,138,43,"+t+")":e<1.4281480067421144?"rgba(255,84,43,"+t+")":"rgba(255,32,43,"+t+")"}}Object.assign(vi.prototype,{createNew4Distance(e,t,i){(i=i||{}).distance=i.distance||.1;let n=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));this.clearAll();let r=m.Cartesian3ListToWGS84(n),o=[],s=1e4,a=1e4,l=-1e4,u=-1e3;for(let d=0;d<r.length;d++){const e=r[d],t=e.lng,i=e.lat;o.push([t,i]),s=t<s?t:s,a=i<a?i:a,l=t>l?t:l,u=i>u?i:u}o.push(o[0]);let c=[s,a,l,u];H([o]);let h=ni(c,i.distance,{});this._createEllipse(h)},createNew4Num(e,t){let i=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0))),n=this;n.clearAll();let r=m.Cartesian3ListToWGS84(i),o=[],s=1e4,a=1e4,l=-1e4,u=-1e3;for(let m=0;m<r.length;m++){const e=r[m],t=e.lng,i=e.lat;o.push([t,i]),s=t<s?t:s,a=i<a?i:a,l=t>l?t:l,u=i>u?i:u}o.push(o[0]);let c=[s,a,l,u],h=l-s,d=u-a;d=d>h?d:h;const p=d/options.num;let f=2e3*p>35?35:2e3*p;n.arrowWidth=f<15?15:f,H([o]);let g=ni(c,p,{units:"degrees"});n._createEllipse(g)},clearAll(){this.result.forEach((e=>{this._viewer.scene.primitives.remove(e)})),this.result=[],this.handler&&(this.handler.destroy(),this.handler=void 0)}});let yi={TerrainExcavation:di,SlopeAspect:vi};class _i{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e}_initRain(){this.rainStage=new Cesium.PostProcessStage({name:"jt_rain",fragmentShader:this._rain(),uniforms:{tiltAngle:()=>this.tiltAngle,rainSize:()=>this.rainSize,rainSpeed:()=>this.rainSpeed}}),this._viewer.scene.postProcessStages.add(this.rainStage)}_initSnow(){this.snowStage=new Cesium.PostProcessStage({name:"jt_snow",fragmentShader:this._snow(),uniforms:{snowSize:()=>this.snowSize,snowSpeed:()=>this.snowSpeed}}),this._viewer.scene.postProcessStages.add(this.snowStage)}_initFog(){this.fogStage=new Cesium.PostProcessStage({name:"jt_fog",fragmentShader:this._fog(),uniforms:{visibility:()=>this.visibility,fogColor:()=>this.color}}),this._viewer.scene.postProcessStages.add(this.fogStage)}_rain(){return"uniform sampler2D colorTexture;\n\t varying vec2 v_textureCoordinates;\n\t uniform float tiltAngle;\n\t uniform float rainSize;\n\t uniform float rainSpeed;\n\t float hash(float x) {\n\t return fract(sin(x * 133.3) * 13.13);\n\t }\n\t void main(void) {\n\t float time = czm_frameNumber / rainSpeed;\n\t vec2 resolution = czm_viewport.zw;\n\t vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n\t vec3 c = vec3(.6, .7, .8);\n\t float a = tiltAngle;\n\t float si = sin(a), co = cos(a);\n\t uv *= mat2(co, -si, si, co);\n\t uv *= length(uv + vec2(0, 4.9)) * rainSize + 1.;\n\t float v = 1. - sin(hash(floor(uv.x * 100.)) * 2.);\n\t float b = clamp(abs(sin(20. * time * v + uv.y * (5. / (2. + v)))) - .95, 0., 1.) * 20.;\n\t c *= v * b;\n\t gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c, 1), .5);\n\t }\n\t "}_snow(){return"uniform sampler2D colorTexture;\n varying vec2 v_textureCoordinates;\n uniform float snowSpeed;\n uniform float snowSize;\n float snow(vec2 uv,float scale)\n {\n float time=czm_frameNumber/snowSpeed;\n float w=smoothstep(1.,0.,-uv.y*(scale/10.));if(w<.1)return 0.;\n uv+=time/scale;uv.y+=time*2./scale;uv.x+=sin(uv.y+time*.5)/scale;\n uv*=scale;vec2 s=floor(uv),f=fract(uv),p;float k=3.,d;\n p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;d=length(p);k=min(d,k);\n k=smoothstep(0.,k,sin(f.x+f.y)*snowSize);\n return k*w;\n }\n void main(void){\n vec2 resolution=czm_viewport.zw;\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 finalColor=vec3(0);\n //float c=smoothstep(1.,0.3,clamp(uv.y*.3+.8,0.,.75));\n float c=0.;\n c+=snow(uv,30.)*.0;\n c+=snow(uv,20.)*.0;\n c+=snow(uv,15.)*.0;\n c+=snow(uv,10.);\n c+=snow(uv,8.);\n c+=snow(uv,6.);\n c+=snow(uv,5.);\n finalColor=(vec3(c));\n gl_FragColor=mix(texture2D(colorTexture,v_textureCoordinates),vec4(finalColor,1),.5);\n }\n "}_fog(){return"uniform sampler2D colorTexture;\n\t uniform sampler2D depthTexture;\n\t uniform float visibility;\n\t uniform vec4 fogColor;\n\t varying vec2 v_textureCoordinates; \n\t void main(void) \n\t { \n\t vec4 origcolor = texture2D(colorTexture, v_textureCoordinates); \n\t float depth = czm_readDepth(depthTexture, v_textureCoordinates); \n\t vec4 depthcolor = texture2D(depthTexture, v_textureCoordinates); \n\t float f = visibility * (depthcolor.r - 0.3) / 0.2; \n\t if (f < 0.0) f = 0.0; \n\t else if (f > 1.0) f = 1.0; \n\t gl_FragColor = mix(origcolor, fogColor, f); \n\t }\n"}_removeSnow(){this._viewer&&this.snowStage&&(this._viewer.scene.postProcessStages.remove(this.snowStage),delete this.snowSize,delete this.snowSpeed)}_removeRain(){this._viewer&&this.rainStage&&(this._viewer.scene.postProcessStages.remove(this.rainStage),delete this.tiltAngle,delete this.rainSize,delete this.rainSpeed)}_removeFog(){this._viewer&&this.fogStage&&(this._viewer.scene.postProcessStages.remove(this.fogStage),delete this.visibility,delete this.color)}}Object.assign(_i.prototype,{addRainEffect(e){e=e||{},this.tiltAngle=Cesium.defaultValue(e.tiltAngle,-.6),this.rainSize=Cesium.defaultValue(e.rainSize,.3),this.rainSpeed=Cesium.defaultValue(e.rainSpeed,60),this._initRain()},addSnowEffect(e){e=e||{},this.snowSize=Cesium.defaultValue(e.snowSize,.02),this.snowSpeed=Cesium.defaultValue(e.snowSpeed,60),this._initSnow()},addFogEffect(e){e=e||{},this.visibility=Cesium.defaultValue(e.visibility,.1),this.color=Cesium.defaultValue(e.color,new Cesium.Color(.8,.8,.8,.5)),this._show=Cesium.defaultValue(e.show,!0),this._initFog()},removeEffect(){this.snowStage&&this._removeSnow(),this.rainStage&&this._removeRain(),this.fogStage&&this._removeFog()}});const bi=Cesium.BoxGeometry,Ci=Cesium.Cartesian3,Ti=Cesium.defaultValue,wi=Cesium.defined,Ei=Cesium.destroyObject,Si=Cesium.DeveloperError,ki=Cesium.GeometryPipeline,Pi=Cesium.Matrix3,Ai=Cesium.Matrix4,xi=Cesium.Transforms,Ii=Cesium.VertexFormat,Mi=Cesium.BufferUsage,Li=Cesium.CubeMap,Di=Cesium.DrawCommand,Oi=Cesium.loadCubeMap,ji=Cesium.RenderState,Ri=Cesium.VertexArray,Ni=Cesium.BlendingState,Ui=Cesium.SceneMode,Bi=Cesium.ShaderProgram,Fi=Cesium.ShaderSource;Cesium.defined(Cesium.Matrix4.getRotation)||(Cesium.Matrix4.getRotation=Cesium.Matrix4.getMatrix3);class Wi{constructor(e){this.sources=e.sources,this._sources=void 0,this.show=Ti(e.show,!0),this._command=new Di({modelMatrix:Ai.clone(Ai.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}}const Hi=new Pi;Wi.prototype.update=function(e,t){const i=this;if(!this.show)return;if(e.mode!==Ui.SCENE3D&&e.mode!==Ui.MORPHING)return;if(!e.passes.render)return;const n=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;if(!(wi(e.positiveX)&&wi(e.negativeX)&&wi(e.positiveY)&&wi(e.negativeY)&&wi(e.positiveZ)&&wi(e.negativeZ)))throw new Si("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof e.positiveX!=typeof e.negativeX||typeof e.positiveX!=typeof e.positiveY||typeof e.positiveX!=typeof e.negativeY||typeof e.positiveX!=typeof e.positiveZ||typeof e.positiveX!=typeof e.negativeZ)throw new Si("this.sources properties must all be the same type.");"string"==typeof e.positiveX?Oi(n,this._sources).then((function(e){i._cubeMap=i._cubeMap&&i._cubeMap.destroy(),i._cubeMap=e})):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Li({context:n,source:e}))}const r=this._command;if(r.modelMatrix=xi.eastNorthUpToFixedFrame(e.camera._positionWC),!wi(r.vertexArray)){r.uniformMap={u_cubeMap:function(){return i._cubeMap},u_rotateMatrix:function(){return Ai.getRotation(r.modelMatrix,Hi)}};const e=bi.createGeometry(bi.fromDimensions({dimensions:new Ci(2,2,2),vertexFormat:Ii.POSITION_ONLY})),t=this._attributeLocations=ki.createAttributeLocations(e);r.vertexArray=Ri.fromGeometry({context:n,geometry:e,attributeLocations:t,bufferUsage:Mi._DRAW}),r.renderState=ji.fromCache({blending:Ni.ALPHA_BLEND})}if(!wi(r.shaderProgram)||this._useHdr!==t){const e=new Fi({defines:[t?"HDR":""],sources:["uniform samplerCube u_cubeMap;\n varying vec3 v_texCoord;\n void main()\n {\n vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n }\n "]});r.shaderProgram=Bi.fromCache({context:n,vertexShaderSource:"attribute vec3 position;\n varying vec3 v_texCoord;\n uniform mat3 u_rotateMatrix;\n void main()\n {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position.xyz;\n }\n ",fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return wi(this._cubeMap)?r:void 0},Wi.prototype.isDestroyed=function(){return!1},Wi.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),Ei(this)};class Vi{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._farSkyBox=e.scene.skyBox}}Object.assign(Vi.prototype,{setGroundSkyBox(e){if((e=e||{}).height=e.height||2e5,e.type=e.type||"蓝天",e.sources){if(!(i(e.sources.positiveX)&&i(e.sources.negativeX)&&i(e.sources.positiveY)&&i(e.sources.negativeY)&&i(e.sources.positiveZ)&&i(e.sources.negativeZ)))throw new n("options.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.")}else switch(e.type){case"晚霞":e.sources={positiveX:"/jt3dSDK/imgs/skybox/01/px.png",negativeX:"/jt3dSDK/imgs/skybox/01/nx.png",positiveY:"/jt3dSDK/imgs/skybox/01/py.png",negativeY:"/jt3dSDK/imgs/skybox/01/ny.png",positiveZ:"/jt3dSDK/imgs/skybox/01/pz.png",negativeZ:"/jt3dSDK/imgs/skybox/01/nz.png"};break;case"阴天":e.sources={positiveX:"/jt3dSDK/imgs/skybox/02/px.jpg",negativeX:"/jt3dSDK/imgs/skybox/02/nx.jpg",positiveY:"/jt3dSDK/imgs/skybox/02/py.jpg",negativeY:"/jt3dSDK/imgs/skybox/02/ny.jpg",positiveZ:"/jt3dSDK/imgs/skybox/02/pz.jpg",negativeZ:"/jt3dSDK/imgs/skybox/02/nz.jpg"};break;case"蓝天":e.sources={positiveX:"/jt3dSDK/imgs/skybox/03/px.jpg",negativeX:"/jt3dSDK/imgs/skybox/03/nx.jpg",positiveY:"/jt3dSDK/imgs/skybox/03/py.jpg",negativeY:"/jt3dSDK/imgs/skybox/03/ny.jpg",positiveZ:"/jt3dSDK/imgs/skybox/03/pz.jpg",negativeZ:"/jt3dSDK/imgs/skybox/03/nz.jpg"};break;case"紫色星空":e.sources={positiveX:"/jt3dSDK/imgs/skybox/04/px.jpg",negativeX:"/jt3dSDK/imgs/skybox/04/nx.jpg",positiveY:"/jt3dSDK/imgs/skybox/04/py.jpg",negativeY:"/jt3dSDK/imgs/skybox/04/ny.jpg",positiveZ:"/jt3dSDK/imgs/skybox/04/pz.jpg",negativeZ:"/jt3dSDK/imgs/skybox/04/nz.jpg"};break;case"蓝色星空":e.sources={positiveX:"/jt3dSDK/imgs/skybox/05/px.jpg",negativeX:"/jt3dSDK/imgs/skybox/05/nx.jpg",positiveY:"/jt3dSDK/imgs/skybox/05/py.jpg",negativeY:"/jt3dSDK/imgs/skybox/05/ny.jpg",positiveZ:"/jt3dSDK/imgs/skybox/05/pz.jpg",negativeZ:"/jt3dSDK/imgs/skybox/05/nz.jpg"}}let t=this,r=new Wi({sources:e.sources,show:!0});t._viewer.scene.postRender.addEventListener((()=>{var i=t._viewer.camera.position;Cesium.Cartographic.fromCartesian(i).height<e.height?t._viewer.scene.skyBox=r:t._viewer.scene.skyBox=t._defaultSkyBox}))}});let Gi={Weather:_i,SkyBox:Vi};class zi{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this.handler=null;let t=document.getElementById("slider");null==t&&(t=document.createElement("div"),t.id="slider",t.style.position="absolute",t.style.left="50%",t.style.top="0px",t.style.backgroundColor="#d3d3d3",t.style.width="5px",t.style.height="100%",t.style.zIndex="9999",t.style.display="none",t.onmouseover=function(){this.style.cursor="ew-resize"},document.getElementsByClassName("cesium-viewer")[0].append(t))}}Object.assign(zi.prototype,{addSplitLayer(e,t){let i=this;i.earthAtLeft&&i._viewer.imageryLayers.remove(i.earthAtLeft),i.earthAtRight&&i._viewer.imageryLayers.remove(i.earthAtRight),i.handler&&(i.handler.destroy(),i.handler=null),i.earthAtLeft=e,i.earthAtRight=t,i.earthAtLeft.splitDirection=Cesium.SplitDirection.LEFT,i.earthAtRight.splitDirection=Cesium.SplitDirection.RIGHT;let n=document.getElementById("slider");n.style.display="block",i._viewer.scene.splitPosition=n.offsetLeft/n.parentElement.offsetWidth;let r=!1;function o(e){if(!r)return;const t=e.endPosition.x,o=(n.offsetLeft+t)/n.parentElement.offsetWidth;n.style.left=100*o+"%",i._viewer.scene.splitPosition=o}i.handler=new Cesium.ScreenSpaceEventHandler(n),i.handler.setInputAction((function(){r=!0}),Cesium.ScreenSpaceEventType.LEFT_DOWN),i.handler.setInputAction((function(){r=!0}),Cesium.ScreenSpaceEventType.PINCH_START),i.handler.setInputAction(o,Cesium.ScreenSpaceEventType.MOUSE_MOVE),i.handler.setInputAction(o,Cesium.ScreenSpaceEventType.PINCH_MOVE),i.handler.setInputAction((function(){r=!1}),Cesium.ScreenSpaceEventType.LEFT_UP),i.handler.setInputAction((function(){r=!1}),Cesium.ScreenSpaceEventType.PINCH_END)},removeSplitLayer(){document.getElementById("slider").style.display="none",this._viewer.imageryLayers.remove(this.earthAtLeft),this._viewer.imageryLayers.remove(this.earthAtRight)}});class Yi{constructor(){}}Object.assign(Yi.prototype,{initHandler(e,t){var i=this;i.handler&&i.handler.getInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)||(i.handler1=new Cesium.ScreenSpaceEventHandler(e.scene.canvas),i.handler2=new Cesium.ScreenSpaceEventHandler(t.scene.canvas),i.handler1.setInputAction((function(i){var n=e.camera;t.camera.setView({destination:n.position,orientation:{direction:n._direction,up:n.up,heading:n.heading,pitch:n.pitch,roll:n.roll}})}),Cesium.ScreenSpaceEventType.MOUSE_MOVE),i.handler1.setInputAction((function(i){var n=e.camera;t.camera.setView({destination:n.position,orientation:{direction:n._direction,up:n.up,heading:n.heading,pitch:n.pitch,roll:n.roll}})}),Cesium.ScreenSpaceEventType.WHEEL),i.handler2.setInputAction((function(i){var n=t.camera;e.camera.setView({destination:n.position,orientation:{direction:n._direction,up:n.up,heading:n.heading,pitch:n.pitch,roll:n.roll}})}),Cesium.ScreenSpaceEventType.MOUSE_MOVE),i.handler2.setInputAction((function(i){var n=t.camera;e.camera.setView({destination:n.position,orientation:{direction:n._direction,up:n.up,heading:n.heading,pitch:n.pitch,roll:n.roll}})}),Cesium.ScreenSpaceEventType.WHEEL))},clearHandler(){var e=this;e.handler1&&(e.handler1.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE),e.handler1.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL)),e.handler2&&(e.handler2.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE),e.handler2.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL))}});let qi={ImageLayerSplit:zi,ViewerSplitScreen:Yi};class Xi{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._draw3DObj=null,this._data=[]}_startFly(e){var t=this;t.clearFlyPaths(),t._viewer.camera.setView({destination:e.position,orientation:e.orientation}),setTimeout((function(){!function(){if(!e||!e.geometry)return;{let h=function(){for(var e=new Cesium.SampledPositionProperty,t=0;t<n.length;t++){if(0===t){var i=Cesium.JulianDate.addSeconds(l,t,new Cesium.JulianDate),r=Cesium.Cartesian3.fromDegrees(n[t].x,n[t].y,n[t].z);e.addSample(i,r)}if(t<1e4&&t>0){var o=new Cesium.Cartesian3(e._property._values[3*t-3],e._property._values[3*t-2],e._property._values[3*t-1]);if(t<976)r=Cesium.Cartesian3.fromDegrees(n[t].x,n[t].y,n[t].z);else if(t>975&&t<986)r=Cesium.Cartesian3.fromDegrees(n[t].x,n[t].y,n[t].z);else if(t>985)r=Cesium.Cartesian3.fromDegrees(n[t].x,n[t].y,n[t].z);var s=[Cesium.Ellipsoid.WGS84.cartesianToCartographic(o),Cesium.Ellipsoid.WGS84.cartesianToCartographic(r)],a=new Cesium.EllipsoidGeodesic(s[0],s[1]).surfaceDistance/50;i=Cesium.JulianDate.addSeconds(e._property._times[t-1],a,new Cesium.JulianDate);e.addSample(i,r)}}return e};var i=e.geometry.coordinates,n=[];if(!(i.length>0))return;for(var r=0;r<i.length;r++){var o=i[r].lng,s=i[r].lat,a=i[r].height;n.push({x:o,y:s,z:a})}var l=Cesium.JulianDate.fromDate(new Date),u=Cesium.JulianDate.addSeconds(l,3e4,new Cesium.JulianDate);t._viewer.clock.startTime=l.clone(),t._viewer.clock.stopTime=u.clone(),t._viewer.clock.currentTime=l.clone(),t._viewer.clock.clockRange=Cesium.ClockRange.LOOP_STOP,t._viewer.clock.multiplier=5,t._viewer.clock.canAnimate=!1,t._viewer.clock.shouldAnimate=!0;var c=h();t.entityFly=t._viewer.entities.add({availability:new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({start:l,stop:u})]),position:c,orientation:new Cesium.VelocityOrientationProperty(c),point:{color:Cesium.Color.RED,outlineColor:Cesium.Color.WHITE,outlineWidth:2,pixelSize:15},path:{resolution:1,material:new Cesium.PolylineGlowMaterialProperty({glowPower:.1,color:Cesium.Color.YELLOW}),width:10}}),t._viewer.trackedEntity=t.entityFly,setTimeout((function(){t._viewer.camera.zoomOut(500)}),100)}}()}),200)}}Object.assign(Xi.prototype,{startFly(e){this._draw3DObj?this._startFly(this._draw3DObj):e.onError&&e.onError("漫游路线不存在")},pauseFly(){var e=this._viewer.clockViewModel;e.shouldAnimate?e.shouldAnimate=!1:this._viewer.clockViewModel.canAnimate&&(e.shouldAnimate=!0)},forwardFly(){var e=this._viewer.clockViewModel,t=e.multiplier;t<0&&(e.multiplier=-t),e.shouldAnimate=!0},backwardsFly(){var e=this._viewer.clockViewModel,t=e.multiplier;t>0&&(e.multiplier=-t),e.shouldAnimate=!0},outFly(){var e=Cesium.JulianDate.fromDate(new Date);this._viewer.clock.startTime=e.clone();var t=Cesium.JulianDate.addSeconds(e,3e8,new Cesium.JulianDate);this._viewer.clock.stopTime=t.clone(),this.clearFlyPaths()},drawFlyPaths(e,t){return new Promise(((t,i)=>{let n=this;n.clearFlyPaths();let r=n._viewer.camera.position;var o={orientation:{heading:n._viewer.camera.heading,pitch:n._viewer.camera.pitch,roll:n._viewer.camera.roll},position:r,geometry:{type:"LineString",coordinates:e}};n._draw3DObj=o,t(!0)}))},clearFlyPaths(){this._draw3DObj=null,this._viewer.trackedEntity=void 0,this._viewer.entities.remove(this.entityFly)}});class Zi{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._iconBlue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC"}}Object.assign(Zi.prototype,{generatePoint(e,t){return new Promise(((r,o)=>{let s=this;if(!i(e))throw new n("points is required.");let a=(t=t||{}).style||{};a.pixelSize=Cesium.defaultValue(a.pixelSize,10),a.color?a.color=new Cesium.Color(a.color[0]/255,a.color[1]/255,a.color[2]/255,a.color[3]):a.color=new Cesium.Color.fromCssColorString("#ff0000").withAlpha(1),a.outlineColor?a.outlineColor=new Cesium.Color(a.outlineColor[0]/255,a.outlineColor[1]/255,a.outlineColor[2]/255,a.outlineColor[3]):a.outlineColor=new Cesium.Color.fromCssColorString("#ffff00").withAlpha(1),a.outlineWidth=Cesium.defaultValue(a.outlineWidth,1),mi(s._viewer,[e]).then((function(i){let n=Cesium.Cartesian3.fromDegrees(e[0],e[1],i[0].height),o=new Cesium.Entity({position:n,point:{pixelSize:a.pixelSize,color:a.color,outlineColor:a.outlineColor,outlineWidth:a.outlineWidth,heightReference:Cesium.HeightReference.NONE,disableDepthTestDistance:i[0].height}});if(t.label){let e=t.label||{};e.text=Cesium.defaultValue(e.text,""),e.font=Cesium.defaultValue(e.font,"24px Helvetica"),e.fillColor?e.fillColor=new Cesium.Color(e.fillColor[0]/255,e.fillColor[1]/255,e.fillColor[2]/255,e.fillColor[3]):e.fillColor=new Cesium.Color.fromCssColorString("#fff").withAlpha(1),e.outlineColor?e.outlineColor=new Cesium.Color(e.outlineColor[0]/255,e.outlineColor[1]/255,e.outlineColor[2]/255,e.outlineColor[3]):e.outlineColor=new Cesium.Color(0,.6,.3,0),e.outlineWidth=Cesium.defaultValue(e.outlineWidth,1),e.showBackground=Cesium.defaultValue(e.showBackground,!0),e.backgroundColor?e.backgroundColor=new Cesium.Color(e.backgroundColor[0]/255,e.backgroundColor[1]/255,e.backgroundColor[2]/255,e.backgroundColor[3]):e.backgroundColor=new Cesium.Color(0,0,0,.6),e.pixelOffset=Cesium.defaultValue(e.pixelOffset,0),e.scale=Cesium.defaultValue(e.scale,1),e.near=Cesium.defaultValue(e.near,150),e.nearValue=Cesium.defaultValue(e.nearValue,1),e.far=Cesium.defaultValue(e.far,2400),e.farValue=Cesium.defaultValue(e.farValue,0),o.label={text:e.text,font:e.font,fillColor:e.fillColor,outlineColor:e.outlineColor,outlineWidth:e.outlineWidth,style:Cesium.LabelStyle.FILL_AND_OUTLINE,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,showBackground:e.showBackground,backgroundColor:e.backgroundColor,backgroundPadding:new Cesium.Cartesian2(6,6),disableDepthTestDistance:Number.POSITIVE_INFINITY,pixelOffset:new Cesium.Cartesian2(0,t.pixelOffset),scale:e.scale}}s._viewer.entities.add(o),r(o)}))}))},addBillboard(e,t){return new Promise(((i,n)=>{let r=(t=t||{}).billboard||{};r.scale=Cesium.defaultValue(r.scale,1),r.near=Cesium.defaultValue(r.near,150),r.nearValue=Cesium.defaultValue(r.nearValue,1),r.far=Cesium.defaultValue(r.far,2400),r.farValue=Cesium.defaultValue(r.farValue,0),r.imgUrl=r.imgUrl||this._iconBlue;let o=Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0),s=new Cesium.Entity({name:"add billboard",position:o,billboard:{image:r.imgUrl,horizontalOrigin:Cesium.HorizontalOrigin.CENTER,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,scale:r.scale,pixelOffset:new Cesium.Cartesian2(0,-11),disableDepthTestDistance:Number.POSITIVE_INFINITY}});if(t.label){let e=t.label||{};e.text=Cesium.defaultValue(e.text,""),e.font=Cesium.defaultValue(e.font,"24px Helvetica"),e.fillColor=Cesium.defaultValue(e.fillColor,"#FF0000"),e.outlineColor=Cesium.defaultValue(e.outlineColor,"#FFFF00"),e.outlineWidth=Cesium.defaultValue(e.outlineWidth,1),e.pixelOffset=Cesium.defaultValue(e.pixelOffset,0),e.scale=Cesium.defaultValue(e.scale,1),e.near=Cesium.defaultValue(e.near,150),e.nearValue=Cesium.defaultValue(e.nearValue,1),e.far=Cesium.defaultValue(e.far,2400),e.farValue=Cesium.defaultValue(e.farValue,0),s.label={text:e.text,font:e.font,fillColor:new Cesium.Color.fromCssColorString(e.fillColor),outlineColor:new Cesium.Color.fromCssColorString(e.outlineColor),outlineWidth:e.outlineWidth,style:Cesium.LabelStyle.FILL_AND_OUTLINE,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,showBackground:!0,backgroundColor:new Cesium.Color.fromCssColorString(e.fillColor),backgroundPadding:new Cesium.Cartesian2(6,6),disableDepthTestDistance:Number.POSITIVE_INFINITY,pixelOffset:new Cesium.Cartesian2(0,t.pixelOffset),scale:e.scale,scaleByDistance:new Cesium.NearFarScalar(e.near,e.nearValue,e.far,e.farValue)}}this._viewer.entities.add(s),i(s)}))}});class Qi{constructor(e){this.defaultColor=new Cesium.Color(255,0,0,0),e=e||{},this._definitionChanged=new Cesium.Event,this._color=void 0,this.color=e.color?Cesium.Color.fromCssColorString(e.color):this.defaultColor,this._duration=e.duration||1e3,this._image=e.imgUrl,this._count=e.count||1,this._direction=e.direction||"horizontal",this._order=e.order||"-",this._time=performance.now(),this._isImageAlpha=e.isImageAlpha||!1,this.addMaterial()}addMaterial(){Cesium.Material.PolylineTrailType="PolylineTrail",Cesium.Material.Polylineimage="images/colors.png","vertical"===this._direction?this._isImageAlpha?Cesium.Material.PolylineTrailSource="czm_material czm_getMaterial(czm_materialInput materialInput)\n\t\t\t\t\t {\n\t\t\t\t\t czm_material material = czm_getDefaultMaterial(materialInput);\n\t\t\t\t\t vec2 st = repeat * materialInput.st;\n\t\t\t\t\t\t\t\t vec4 colorImage = texture2D(image, vec2(fract(st.t "+this._order+" time), st.s));\n\t\t\t\t\t\t\t\t material.alpha = colorImage.a;\n\t\t\t\t\t\t\t\t material.diffuse = colorImage.rgb* 1.5 ;\n\t\t\t\t\t return material;\n\t\t\t\t\t }":Cesium.Material.PolylineTrailSource="czm_material czm_getMaterial(czm_materialInput materialInput)\n\t\t\t\t\t {\n\t\t\t\t\t czm_material material = czm_getDefaultMaterial(materialInput);\n\t\t\t\t\t vec2 st = repeat * materialInput.st;\n\t\t\t\t\t\t\t\t vec4 colorImage = texture2D(image, vec2(fract(st.t "+this._order+" time), st.s));\n\t\t\t\t\t\t\t\t material.alpha = colorImage.a * color.a;\n\t\t\t\t\t\t\t\t material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n\t\t\t\t\t return material;\n\t\t\t\t\t }":"horizontal"===this._direction&&(this._isImageAlpha?Cesium.Material.PolylineTrailSource="czm_material czm_getMaterial(czm_materialInput materialInput)\n\t\t\t\t {\n\t\t\t\t czm_material material = czm_getDefaultMaterial(materialInput);\n\t\t\t\t vec2 st = repeat * materialInput.st;\n\t\t\t\t\t\t\t vec4 colorImage = texture2D(image, vec2(fract(st.s "+this._order+" time), st.t));\n\t\t\t\t\t\t\t material.alpha = colorImage.a;\n\t\t\t\t\t\t\t material.diffuse = colorImage.rgb * 1.5 ;\n\t\t\t\t return material;\n\t\t\t\t }":Cesium.Material.PolylineTrailSource="czm_material czm_getMaterial(czm_materialInput materialInput)\n\t\t\t\t {\n\t\t\t\t czm_material material = czm_getDefaultMaterial(materialInput);\n\t\t\t\t vec2 st = repeat * materialInput.st;\n\t\t\t\t\t\t\t vec4 colorImage = texture2D(image, vec2(fract(st.s "+this._order+" time), st.t));\n\t\t\t\t\t\t\t material.alpha = colorImage.a * color.a;\n\t\t\t\t\t\t\t material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n\t\t\t\t return material;\n\t\t\t\t }"),Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineTrailType,{fabric:{type:Cesium.Material.PolylineTrailType,uniforms:{color:new Cesium.Color(1,0,0,.5),image:Cesium.Material.Polylineimage,time:0,repeat:new Cesium.Cartesian2(5,1),order:"-"},source:Cesium.Material.PolylineTrailSource},translucent:function(e){return!0}})}}Qi.prototype.getType=function(e){return"PolylineTrail"},Qi.prototype.getValue=function(e,t){return Cesium.defined(t)||(t={}),t.color=Cesium.Property.getValueOrClonedDefault(this._color,e,this.defaultColor,t.color),t.image=this._image,t.time=(performance.now()-this._time)%this._duration/this._duration,t.repeat=new Cesium.Cartesian2(this._count,1),t.order=this._order,t},Qi.prototype.equals=function(e){return this===e||e instanceof Qi&&Cesium.Property.equals(this._color,e._color)},Object.defineProperties(Qi.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:Cesium.createPropertyDescriptor("color")});class Ki{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e}}Object.assign(Ki.prototype,{regionRangeByGeoJson(e){return new Promise(((t,r)=>{let o=this;if(!i(e))throw new n("geoJsonUrl is required.");let s={width:5,minHeigh:0,maxHeigh:2e8,duration:3e3,isImageAlpha:!0,imgUrl:"/jt3dSDK/imgs/polylinematerial/spriteline1.png"};new Cesium.GeoJsonDataSource.load(e).then((e=>{o._viewer.dataSources.add(e);let i=e.entities.values;for(var n=0;n<i.length;n++){var r=i[n];r.polyline.distanceDisplayCondition=new Cesium.DistanceDisplayCondition(s.minHeigh,s.maxHeigh),r.polyline.clampToGround=!0,r.polyline.material=new Qi(s),r.polyline.width=s.width}t(i)}))}))},drawPolylineByGeoJson:function(e,t){return new Promise(((r,o)=>{let s=this;if(!i(e))throw new n("geoJsonUrl is required.");(t=t||{}).color=Cesium.defaultValue(t.color,"#FF0000"),t.width=Cesium.defaultValue(t.width,3),t.minHeigh=Cesium.defaultValue(t.minHeigh,0),t.maxHeigh=Cesium.defaultValue(t.maxHeigh,2e8),new Cesium.GeoJsonDataSource.load(e).then((e=>{s._viewer.dataSources.add(e);let i=e.entities.values;for(var n=0;n<i.length;n++){var o=i[n];o.polyline.distanceDisplayCondition=new Cesium.DistanceDisplayCondition(t.minHeigh,t.maxHeigh),o.polyline.clampToGround=!0,o.polyline.material=new Qi(t),o.polyline.width=t.width}r(i)}))}))},PolylineLinkPulseMaterialProperty:function(e,t){return new Promise(((r,o)=>{if(!i(e))throw new n("points is required.");e.length<2&&o("线对象,点数至少2个");let s=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));(t=t||{}).id=t.id||pi(),t.width=t.width||5,r(this._viewer.entities.add({id:t.id,name:"Pulse line",polyline:{positions:s,width:t.width,material:new Qi(t),clampToGround:!0}}))}))},PolylineArrowMaterialProperty:function(e,t){return new Promise(((r,o)=>{if(!i(e))throw new n("points is required.");e.length<2&&o("线对象,点数至少2个");let s=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));(t=t||{}).id=t.id||pi(),t.width=t.width||5,r(this._viewer.entities.add({id:t.id,name:"Pulse line",polyline:{positions:s,width:t.width,material:new Qi(t),clampToGround:!0}}))}))},drawGlowingLine(e,t){return new Promise(((r,o)=>{if(!i(e))throw new n("points is required.");e.length<2&&o("线对象,点数至少2个");let s=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));(t=t||{}).id=t.id||pi(),t.color?t.color=new Cesium.Color(t.color[0]/255,t.color[1]/255,t.color[2]/255,t.color[3]):t.color=Cesium.Color.RED,t.width=t.width||5,t.glowPower=t.glowPower||.25,t.taperPower=t.taperPower||1,r(this._viewer.entities.add({id:t.id,name:"Glowing blue line on the surface",polyline:{clampToGround:!0,positions:s,width:t.width,followSurface:!0,material:new Cesium.PolylineGlowMaterialProperty({color:t.color,glowPower:t.glowPower,taperPower:t.taperPower})}}))}))},drawSpecifyColorLine(e,t){return new Promise(((n,r)=>{i(e)||r("points is required."),e.length<2&&r("线对象,点数至少2个");let o=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));(t=t||{}).id=t.id||pi(),t.color?t.color=new Cesium.Color(t.color[0]/255,t.color[1]/255,t.color[2]/255,t.color[3]):t.color=new Cesium.Color.fromCssColorString("#ff0000").withAlpha(1),t.width=t.width||5,n(this._viewer.entities.add({id:t.id,name:"Red line on the surface",polyline:{clampToGround:!0,positions:o,width:t.width,material:t.color}}))}))},drawSpecifyColorAndOutlineColorLine(e,t){return new Promise(((r,o)=>{if(!i(e))throw new n("points is required.");e.length<2&&o("线对象,点数至少2个");let s=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));(t=t||{}).id=t.id||pi(),t.color?t.color=new Cesium.Color(t.color[0]/255,t.color[1]/255,t.color[2]/255,t.color[3]):t.color=new Cesium.Color.fromCssColorString("#ff0000").withAlpha(1),t.width=t.width||5,t.outlineColor?t.outlineColor=new Cesium.Color(t.outlineColor[0]/255,t.outlineColor[1]/255,t.outlineColor[2]/255,t.outlineColor[3]):t.outlineColor=new Cesium.Color.fromCssColorString("#ffff00").withAlpha(1),t.outlineWidth=Cesium.defaultValue(t.outlineWidth,1),r(this._viewer.entities.add({id:t.id,name:"Orange line with black outline at height and following the surface",polyline:{clampToGround:!0,positions:s,width:t.width,material:new Cesium.PolylineOutlineMaterialProperty({color:t.color,outlineWidth:t.outlineWidth,outlineColor:t.outlineColor})}}))}))},drawSpecifyColorArrowStaticStateLine(e,t){return new Promise(((r,o)=>{if(!i(e))throw new n("points is required.");e.length<2&&o("线对象,点数至少2个");let s=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));(t=t||{}).id=t.id||pi(),t.color?t.color=new Cesium.Color(t.color[0]/255,t.color[1]/255,t.color[2]/255,t.color[3]):t.color=new Cesium.Color.fromCssColorString("#ff0000").withAlpha(1),t.width=t.width||5,r(this._viewer.entities.add({id:t.id,name:"Purple straight arrow at height",polyline:{clampToGround:!0,positions:s,width:t.width,followSurface:!1,material:new Cesium.PolylineArrowMaterialProperty(t.color)}}))}))},drawDashedLine(e,t){return new Promise(((r,o)=>{if(!i(e))throw new n("points is required.");e.length<2&&o("线对象,点数至少2个");let s=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));(t=t||{}).id=t.id||pi(),t.color?t.color=new Cesium.Color(t.color[0]/255,t.color[1]/255,t.color[2]/255,t.color[3]):t.color=new Cesium.Color.fromCssColorString("#ff0000").withAlpha(1),t.width=t.width||5,t.gapColor?t.gapColor=new Cesium.Color(t.gapColor[0]/255,t.gapColor[1]/255,t.gapColor[2]/255,t.gapColor[3]):t.gapColor=Cesium.Color.TRANSPARENT,t.dashLength=t.dashLength||16,t.dashPattern=t.dashPattern||255,r(this._viewer.entities.add({id:t.id,name:"CYAN dashed line",polyline:{clampToGround:!0,positions:s,width:t.width,material:new Cesium.PolylineDashMaterialProperty({color:t.color,gapColor:t.gapColor,dashLength:t.dashLength,dashPattern:t.dashPattern})}}))}))}});class Ji{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e,this._drawEntities=[],this._polygonEntity=null}}Object.assign(Ji.prototype,{drawPolygonByGeoJson(e,t){return new Promise(((r,o)=>{let s=this;if(!i(e))throw new n("geoJsonUrl is required.");(t=t||{}).color=Cesium.defaultValue(t.color,"#FF0000"),t.outlineColor=Cesium.defaultValue(t.outlineColor,"#FFFF00"),t.outlineWidth=Cesium.defaultValue(t.outlineWidth,1),t.extrudedHeight=Cesium.defaultValue(t.extrudedHeight,0),Cesium.GeoJsonDataSource.load(e,{stroke:Cesium.Color.WHITE,strokeWidth:3,fill:Cesium.Color.RED.withAlpha(.5)}).then((e=>{s._viewer.dataSources.add(e);let i=e.entities.values;for(let n=0;n<i.length;n++){let e=i[n];e.polygon.material=new Cesium.Color.fromCssColorString(color).withAlpha(.1),e.polygon.extrudedHeight=t.extrudedHeight,e.polygon.fill=!1,e.polygon.outline=!1,e.polygon.outlineWidth=t.outlineWidth,e.polygon.outlineColor=t.outlineColor,e.polyline={positions:e.polygon.hierarchy._value.positions,width:e.polygon.outlineWidth,material:new Cesium.Color.fromCssColorString(color).withAlpha(.1),clampToGround:!0}}r(i)}))}))},generatePolygonByPoints(e,t){return new Promise(((r,o)=>{if(!i(e))throw new n("points is required.");e.length<3&&o("面对象,点数至少3个");let s=e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0)));(t=t||{}).id=t.id||pi(),t.fill=t.fill||!0,t.color?t.color=new Cesium.Color(t.color[0]/255,t.color[1]/255,t.color[2]/255,t.color[3]):t.color=new Cesium.Color.fromCssColorString("#ff0000").withAlpha(1),t.outline=t.outline||!1,t.outlineColor?t.outlineColor=new Cesium.Color(t.outlineColor[0]/255,t.outlineColor[1]/255,t.outlineColor[2]/255,t.outlineColor[3]):t.outlineColor=new Cesium.Color.fromCssColorString("#000").withAlpha(1),t.outlineWidth=Cesium.defaultValue(t.outlineWidth,1);let a=new Cesium.Entity({id:t.id,name:"Generate surfaces based on coordinate points",polygon:{hierarchy:s,material:t.color,fill:t.fill,outline:t.outline,outlineWidth:t.outlineWidth,outlineColor:t.outlineColor}});t.outline&&(a.polyline={positions:a.polygon.hierarchy._value.positions,width:t.outlineWidth,material:t.outlineColor,clampToGround:!0}),this._viewer.entities.add(a),r(a)}))}}),Cesium.Primitive.prototype.setUseGeometry=function(e){this._useGeometry=e},Cesium.Primitive.prototype.getUseGeometry=function(){return this._useGeometry};class $i{constructor(e,t){this._viewer=e,this._init(t)}_init(e){if(this._viewer.scene.globe.depthTestAgainstTerrain=!0,this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this._entities=this._viewer.entities,this._pointEntitys=[],this._sketchPointImage=void 0,this._iconNormal="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==",this._iconBlue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC",this._iconGreen="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=",this._iconViolet="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC",this._sketchEntityName="sketchEntity",this._sketchTempPoints=[],this._sketchPoints=[],this._sketchOutputPoints=[],this._sketchTempPolyline=void 0,this._sketchPolyline=void 0,this._sketchTempPolygon=void 0,this._sketchPolygon=void 0,this._sketchTempAltituePolyline=void 0,this._sketchAltitudePolyline=void 0,this._sketchAltitudeInitHeight=0,this._sketchTempSpatialPolyline=void 0,this._sketchSpatialPolyline=void 0,this._sketchTempCircle=void 0,this._sketchCircle=void 0,this._sketchTempRectangle=void 0,this._sketchRectangle=void 0,this._sketchTempTriangleAltitudePolyline=void 0,this._sketchTriangleAltituePolyline=void 0,this._sketchTempSpatialTriangle=void 0,this._sketchSpatialTriangle=void 0,this._lineLabel=void 0,this._polygonLabel=void 0,e&&e.isDrawPoint?this._isDrawPoint=e.isDrawPoint:this._isDrawPoint=!1,e&&e.isRetainDrawPoint?this._isRetainDrawPoint=e.isRetainDrawPoint:this._isRetainDrawPoint=!1,this._param={moveLineWidth:2,lineWidth:2,moveAltitudeLineWidth:2,altitudeLineWidth:2,spatialLineWidth:2,moveEllipseColor:[0,255,0,.5],moveEllipseOutline:!0,moveEllipseOutlineColor:[255,0,0,.5],moveEllipseOutlineWidth:1,spatialLineWidth:2,ellipseColor:[0,0,255,.5],ellipseOutline:!0,ellipseOutlineColor:[255,0,0,.5],ellipseOutlineWidth:1},this._setMoveLineStyle(void 0),this._setLineStyle(void 0),this._setMovePolygonStyle(void 0),this._setPolygonStyle(void 0),this._setMoveAltitudeLineStyle(void 0),this._setAltitudeLineStyle(void 0),this._setMoveEllipseStyle(void 0),this._setEllipseStyle(void 0),this._setSpatialLineStyle(void 0),e&&e.iconType)switch(e.iconType){case $i.SketchIconType.Normal:this._sketchPointImage=this._iconNormal;break;case $i.SketchIconType.Blue:this._sketchPointImage=this._iconBlue;break;case $i.SketchIconType.Green:this._sketchPointImage=this._iconGreen;break;case $i.SketchIconType.Violet:this._sketchPointImage=this._iconViolet;break;default:this._sketchPointImage=this._iconNormal}else this._sketchPointImage=this._iconNormal}_arcToDegree(e){return e/Math.PI*180}_toColor(e,t,i,n){let r=new Cesium.Color(0,0,0,1);return"number"!=typeof e||"number"!=typeof t||"number"!=typeof i||"number"!=typeof n||e<0||e>255||t<0||t>255||i<0||i>255||n<0||n>1?r:new Cesium.Color(e/255,t/255,i/255,n)}_toColorFromArray(e){if(!e||void 0===e.length||0===e.length)return new Cesium.Color(1,1,1,1);let t=255,i=255,n=255,r=1;return 1===e.length?t=parseInt(e[0]):2===e.length?(t=parseInt(e[0]),i=parseInt(e[1])):3===e.length?(t=parseInt(e[0]),i=parseInt(e[1]),n=parseInt(e[2])):e.length>=4&&(t=parseInt(e[0]),i=parseInt(e[1]),n=parseInt(e[2]),r=parseFloat(e[3])),new Cesium.Color(t/255,i/255,n/255,r)}_updateScene(){this._viewer.scene.requestRender()}_getScreenClickPosition(e){let t,i=this._viewer.scene.camera.getPickRay(e),n=this._viewer.scene.globe.pick(i,this._viewer.scene);return Cesium.Ellipsoid.WGS84.cartesianToCartographic(n),Cesium.defined(n)&&(t={x:n.x,y:n.y,z:n.z}),t}_getScreenClickPositionAndHeight(e){var t=void 0,i=void 0,n=void 0,r=this._viewer.scene.camera.getPickRay(e),o=this._viewer.scene.globe.pick(r,this._viewer.scene),s=Cesium.Ellipsoid.WGS84.cartesianToCartographic(o);if(null==this._viewer.scene.pick(e))t=this._arcToDegree(s.longitude),i=this._arcToDegree(s.latitude),n=s.height;else{var a=this._viewer.scene.pickPosition(e);if(Cesium.defined(a)){s=Cesium.Cartographic.fromCartesian(a);t=this._arcToDegree(s.longitude),i=this._arcToDegree(s.latitude),n=s.height}}return{lng:t,lat:i,height:n}}_transfromFromScreenPoint(e){let t=this._getScreenClickPositionAndHeight(e);return{gLocation:t,sLocation:Cesium.Cartesian3.fromDegrees(t.lng,t.lat,t.height)}}_removeEntityByName(e){var t=this._entities;if(t&&t.values){for(var i=[],n=0;n<t.values.length;n++)t.values[n].name==e&&i.push(t.values[n]);for(n=0;n<i.length;n++)t.remove(i[n]);this._updateScene()}}_removeEntityByObject(e){Cesium.defined(e)&&this._entities.remove(e)}_createPoint(e,t){let i=new Cesium.Entity({name:this._sketchEntityName+"_Point",position:e,billboard:{image:this._sketchPointImage,horizontalOrigin:Cesium.HorizontalOrigin.center,verticalOrigin:Cesium.VerticalOrigin.bottom,scale:.5,pixelOffset:new Cesium.Cartesian2(0,-11),disableDepthTestDistance:Number.POSITIVE_INFINITY}});t&&(i.label={text:t,font:"12px sans-serif",fillColor:this._toColor(255,255,255,1),outlineColor:this._toColor(0,154,94,1),style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:1,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffset:new Cesium.Cartesian2(0,-28),showBackground:!0,backgroundColor:this._toColor(0,0,0,.6),disableDepthTestDistance:Number.POSITIVE_INFINITY}),this._entities.add(i),this._pointEntitys.push(i),this._updateScene()}_removePointEntitys(){this._removeEntityByName(this._sketchEntityName+"_Point"),this._pointEntitys=[]}_createTempPolyline(){let e=this;Cesium.defined(this._sketchTempPolyline)||(this._sketchTempPolyline=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:new Cesium.CallbackProperty((function(){return e._sketchTempPoints}),!1),material:e._tempLineMaterial,width:e._param.moveLineWidth,clampToGround:!0}}),this._entities.add(this._sketchTempPolyline),this._updateScene())}_createPolyline(){let e=this;Cesium.defined(this._sketchPolyline)||(this._sketchPolyline=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:e._sketchPoints,material:e._lineMaterial,width:e._param.lineWidth,clampToGround:!0}}),this._entities.add(this._sketchPolyline),this._updateScene())}_createTempSpatialPolyline(){let e=this;Cesium.defined(this._sketchTempSpatialPolyline)||(this._sketchTempSpatialPolyline=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:new Cesium.CallbackProperty((function(){return e._sketchTempPoints}),!1),material:e._tempLineMaterial,width:e._param.moveLineWidth,clampToGround:!1}}),this._entities.add(this._sketchTempSpatialPolyline),this._updateScene())}_createSpatialPolyline(){let e=this;Cesium.defined(this._sketchSpatialPolyline)||(this._sketchSpatialPolyline=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:e._sketchPoints,material:e._spatialLineMaterial,width:e._param.spatialLineWidth,clampToGround:!1}}),this._entities.add(this._sketchSpatialPolyline),this._updateScene())}_createTempPolygon(){let e=this;Cesium.defined(this._sketchTempPolygon)||(this._sketchTempPolygon=new Cesium.Entity({name:e._sketchEntityName,polygon:{show:!0,hierarchy:new Cesium.CallbackProperty((function(){return{positions:e._sketchTempPoints}}),!1),material:e._tempPolygonMaterial,classificationType:Cesium.ClassificationType.BOTH}}),this._entities.add(this._sketchTempPolygon),this._updateScene())}_createPolygon(){let e=this;Cesium.defined(this._sketchPolygon)||(this._sketchPoints.push(this._sketchPoints[0]),this._sketchPolygon=new Cesium.Entity({name:e._sketchEntityName,polygon:{show:!0,hierarchy:{positions:e._sketchPoints},material:e._polygonMaterial,classificationType:Cesium.ClassificationType.BOTH},polyline:{show:!0,positions:e._sketchPoints,material:e._lineMaterial,width:e._param.lineWidth,clampToGround:!0}}),this._entities.add(this._sketchPolygon),this._updateScene())}_createPolygonBody(e){let t=this,i=parseFloat(100);e&&e.height&&"number"==typeof e.height&&(i=parseFloat(e.height));let n=[255,255,0,1],r=[0,0,255,.65];if(e&&e.color&&this._checkColorAndAlpha(e.color)&&(r=this._checkColorAndAlpha(e.color)),!Cesium.defined(this._sketchPolygon)){let e="czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n material.diffuse = color.rgb;\n material.alpha = color.a;\n return material;\n}",o=new Cesium.Material({fabric:{type:"wallMaterial",uniforms:{color:t._toColorFromArray(n),speed:100},source:e}});new Cesium.MaterialAppearance({material:o});let s=new Cesium.MaterialAppearance({material:new Cesium.Material({fabric:{type:"Color",uniforms:{color:t._toColorFromArray(r)}}})}),a=[],l=[];for(let n=0;n<t._sketchOutputPoints.length;n++){let e=parseFloat(t._sketchOutputPoints[n].height);a.push(e),l.push(e+i)}let u=parseFloat(t._sketchOutputPoints[0].height);a.push(u),l.push(u+i);let c=[];for(let i=0;i<t._sketchPoints.length;i++)c.push(t._sketchPoints[i]);c.push(t._sketchPoints[0]),new Cesium.WallGeometry({positions:c,maximumHeights:l,minimumHeights:a});let h=new Cesium.PolygonGeometry({polygonHierarchy:new Cesium.PolygonHierarchy(c),perPositionHeight:!0,extrudedHeight:Math.max.apply(null,l)}),d=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:h}),appearance:s,releaseGeometryInstances:!1});d.setUseGeometry({cPoints:t._sketchPoints,gPoints:t._sketchOutputPoints,height:i,color:r}),this._viewer.scene.primitives.add(d)}}_callUpdaeEllipseCenterPosition(){let e=this;return function(){let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[0]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]);return e._sketchEllipseCenterPosition=Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(t.longitude),Cesium.Math.toDegrees(t.latitude),i.height),e._sketchEllipseCenterPosition}}_callUpdateAltitudePolylinePositions(){let e=this;return function(){e._sketchAltitudePolylinePostions=[],e._sketchAltitudePolylinePostions.push(e._sketchTempPoints[0]);let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[0]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]),n=Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(t.longitude),Cesium.Math.toDegrees(t.latitude),i.height);return e._sketchAltitudePolylinePostions.push(n),e._sketchAltitudePolylinePostions}}_callUpdateEllipseMinorAxis(){let e=this;return function(){let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[0]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]),n=new Cesium.EllipsoidGeodesic;return n.setEndPoints(t,i),e._sketchEllipseRadius=n.surfaceDistance,e._sketchEllipseRadius<=0&&(e._sketchEllipseRadius=1),e._sketchEllipseRadius}}_callUpdateEllipseHeight(){let e=this;return function(){let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[0]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]).height-t.height;return e._sketchEllipseHeight=i+e._sketchAltitudeInitHeight,e._sketchEllipseHeight}}_createTempAltitudePolyline(){let e=this;Cesium.defined(this._sketchTempAltituePolyline)||(this._sketchTempAltituePolyline=new Cesium.Entity({name:e._sketchEntityName,position:new Cesium.CallbackProperty(e._callUpdaeEllipseCenterPosition(),!1),polyline:{show:!0,positions:new Cesium.CallbackProperty(e._callUpdateAltitudePolylinePositions(),!1),material:e._tempAlititudeLineMaterial,width:e._param.moveAltitudeLineWidth,clampToGround:!1},ellipse:{show:!0,semiMinorAxis:new Cesium.CallbackProperty(e._callUpdateEllipseMinorAxis(),!1),semiMajorAxis:new Cesium.CallbackProperty(e._callUpdateEllipseMinorAxis(),!1),height:new Cesium.CallbackProperty(e._callUpdateEllipseHeight(),!1),material:e._toColorFromArray(e._param.moveEllipseColor),outline:e._param.moveEllipseOutline,outlineWidth:e._param.moveEllipseOutlineWidth,outlineColor:e._toColorFromArray(e._param.moveEllipseOutlineColor)}}),e._entities.add(e._sketchTempAltituePolyline))}_createAltitudePolyline(){let e=this;Cesium.defined(this._sketchAltitudePolyline)||(this._sketchAltitudePolyline=new Cesium.Entity({name:e._sketchEntityName,position:e._sketchEllipseCenterPosition,polyline:{show:!0,positions:e._sketchAltitudePolylinePostions,material:e._altitudeLineMaterial,width:e._param.altitudeLineWidth,clampToGround:!1},ellipse:{show:!0,semiMinorAxis:e._sketchEllipseRadius,semiMajorAxis:e._sketchEllipseRadius,height:e._sketchEllipseHeight,material:e._toColorFromArray(e._param.ellipseColor),outline:e._param.ellipseOutline,outlineWidth:e._param.ellipseOutlineWidth,outlineColor:e._toColorFromArray(e._param.ellipseOutlineColor)}}),e._entities.add(e._sketchAltitudePolyline))}_callEllipseOutlineCoordinate(){let e=this;return function(){let t=e._sketchEllipseCenterPosition,i=e._sketchTempPoints[1];e._ellipseOutlineCoordinates=[];for(let n=5;n<360;){let r=e._rotatedPointByAngle(i,t,n);e._ellipseOutlineCoordinates.push(r),n+=5}return e._ellipseOutlineCoordinates.push(e._ellipseOutlineCoordinates[0]),e._ellipseOutlineCoordinates}}_createTempCircle(e){let t=this;Cesium.defined(this._sketchTempCircle)||(t._sketchEllipseCenterPosition=e.clone(),this._sketchTempCircle=new Cesium.Entity({name:t._sketchEntityName,position:e,polyline:{show:!0,positions:new Cesium.CallbackProperty(t._callEllipseOutlineCoordinate(),!1),material:t._tempLineMaterial,width:t._param.moveLineWidth,clampToGround:!0},ellipse:{show:!0,semiMinorAxis:new Cesium.CallbackProperty(t._callUpdateEllipseMinorAxis(),!1),semiMajorAxis:new Cesium.CallbackProperty(t._callUpdateEllipseMinorAxis(),!1),material:t._tempPolygonMaterial,classificationType:Cesium.ClassificationType.BOTH}}),t._entities.add(t._sketchTempCircle))}_rotatedPointByAngle(e,t,i){var n=Cesium.Transforms.eastNorthUpToFixedFrame(t),r=Cesium.Matrix4.inverse(n,new Cesium.Matrix4);Cesium.Matrix4.multiplyByPoint(r,t,new Cesium.Cartesian3);var o=Cesium.Matrix4.multiplyByPoint(r,e,new Cesium.Cartesian3),s=o.x*Math.cos(Cesium.Math.toRadians(i))+o.y*Math.sin(Cesium.Math.toRadians(i)),a=o.y*Math.cos(Cesium.Math.toRadians(i))-o.x*Math.sin(Cesium.Math.toRadians(i)),l=o.z;return Cesium.Matrix4.multiplyByPoint(n,new Cesium.Cartesian3(s,a,l),new Cesium.Cartesian3)}_createCircle(){let e=this;Cesium.defined(this._sketchCircle)||(this._sketchCircle=new Cesium.Entity({name:e._sketchEntityName,position:e._sketchEllipseCenterPosition,polyline:{show:!0,positions:e._ellipseOutlineCoordinates,material:e._lineMaterial,width:e._param.lineWidth,clampToGround:!0},ellipse:{show:!0,semiMinorAxis:e._sketchEllipseRadius,semiMajorAxis:e._sketchEllipseRadius,material:e._polygonMaterial,classificationType:Cesium.ClassificationType.BOTH}}),e._entities.add(e._sketchCircle))}_callUpdateRectangleCoordinates(){let e=this;return function(){let t=parseFloat(e._sketchTempPoints[0].lng),i=parseFloat(e._sketchTempPoints[0].lat),n=parseFloat(e._sketchTempPoints[1].lng),r=parseFloat(e._sketchTempPoints[1].lat);e._rectangleCoordinates=[0,0,1,1],t<n?(e._rectangleCoordinates[0]=t,e._rectangleCoordinates[2]=n):(e._rectangleCoordinates[0]=n,e._rectangleCoordinates[2]=t),i<r?(e._rectangleCoordinates[1]=i,e._rectangleCoordinates[3]=r):(e._rectangleCoordinates[1]=r,e._rectangleCoordinates[3]=i);let o=Cesium.Rectangle.fromDegrees(e._rectangleCoordinates[0],e._rectangleCoordinates[1],e._rectangleCoordinates[2],e._rectangleCoordinates[3]),s=e._calculateRectangleOutlineCoordinates(o);return e._rectangleOutlineCoordinates=s.cPoints,e._sketchOutputPoints=s.gPoints,o}}_calculateRectangleOutlineCoordinates(e){let t=Cesium.Rectangle.southeast(e),i=Cesium.Cartographic.toCartesian(t),n=Cesium.Rectangle.southwest(e),r=Cesium.Cartographic.toCartesian(n),o=Cesium.Rectangle.northeast(e),s=Cesium.Cartographic.toCartesian(o),a=Cesium.Rectangle.northwest(e),l=Cesium.Cartographic.toCartesian(a),u=[];return u.push({lng:Cesium.Math.toDegrees(n.longitude),lat:Cesium.Math.toDegrees(n.latitude),height:n.height}),u.push({lng:Cesium.Math.toDegrees(t.longitude),lat:Cesium.Math.toDegrees(t.latitude),height:t.height}),u.push({lng:Cesium.Math.toDegrees(o.longitude),lat:Cesium.Math.toDegrees(o.latitude),height:o.height}),u.push({lng:Cesium.Math.toDegrees(a.longitude),lat:Cesium.Math.toDegrees(a.latitude),height:a.height}),u.push({lng:Cesium.Math.toDegrees(n.longitude),lat:Cesium.Math.toDegrees(n.latitude),height:n.height}),{cPoints:[r,i,s,l,r],gPoints:u}}_callUpdateRectangleOutlineCoordinates(){let e=this;return function(){return e._rectangleOutlineCoordinates}}_createTempRectangle(){let e=this;Cesium.defined(this._sketchTempRectangle)||(this._sketchTempRectangle=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:new Cesium.CallbackProperty(e._callUpdateRectangleOutlineCoordinates(),!1),material:e._tempLineMaterial,width:e._param.moveLineWidth,clampToGround:!0},rectangle:{show:!0,coordinates:new Cesium.CallbackProperty(e._callUpdateRectangleCoordinates(),!1),material:e._tempPolygonMaterial,classificationType:Cesium.ClassificationType.BOTH}}),e._entities.add(e._sketchTempRectangle))}_createRectangle(){let e=this;Cesium.defined(this._sketchRectangle)||(this._sketchRectangle=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:e._rectangleOutlineCoordinates,material:e._lineMaterial,width:e._param.lineWidth,clampToGround:!0},rectangle:{show:!0,coordinates:Cesium.Rectangle.fromDegrees(e._rectangleCoordinates[0],e._rectangleCoordinates[1],e._rectangleCoordinates[2],e._rectangleCoordinates[3]),material:e._polygonMaterial,classificationType:Cesium.ClassificationType.BOTH}}),e._entities.add(e._sketchRectangle))}_callUpdaeTriangleEllipseCenterPosition(){let e=this;return function(){let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[2]);return e._sketchEllipseCenterPosition=Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(t.longitude),Cesium.Math.toDegrees(t.latitude),i.height),e._sketchEllipseCenterPosition}}_callUpdateTriangleAltitudePolylinePositions(){let e=this;return function(){e._sketchAltitudePolylinePostions=[],e._sketchAltitudePolylinePostions.push(e._sketchTempPoints[1]);let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[2]),n=Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(t.longitude),Cesium.Math.toDegrees(t.latitude),i.height);return e._sketchAltitudePolylinePostions.push(n),e._sketchAltitudePolylinePostions}}_callUpdateTriangleEllipseMinorAxis(){let e=this;return function(){let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[2]),n=new Cesium.EllipsoidGeodesic;return n.setEndPoints(t,i),e._sketchEllipseRadius=n.surfaceDistance,e._sketchEllipseRadius<=0&&(e._sketchEllipseRadius=1),e._sketchEllipseRadius}}_callUpdateTriangleEllipseHeight(){let e=this;return function(){let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[2]).height-t.height;return e._sketchEllipseHeight=i+e._sketchAltitudeInitHeight,e._sketchEllipseHeight}}_callUpdateTriangleSpatialPolylinePositions(){let e=this;return function(){return e._sketchTriangleSpatialPolylinePositions=[],e._sketchTriangleSpatialPolylinePositions.push(e._sketchTempPoints[0]),e._sketchTriangleSpatialPolylinePositions.push(e._sketchEllipseCenterPosition),e._sketchTriangleSpatialPolylinePositions}}_createTriangleSpatialPolyline(){let e=this;this._sketchSpatialPolyline=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:e._sketchTriangleSpatialPolylinePositions,material:e._spatialLineMaterial,width:e._param.spatialLineWidth,clampToGround:!1}}),this._entities.add(this._sketchSpatialPolyline)}_createTempTriangleAltitudePolylineAndSpatialPolyline(){let e=this;Cesium.defined(this._sketchTempTriangleAltitudePolyline)||Cesium.defined(this._sketchTempSpatialPolyline)||(this._sketchTempTriangleAltitudePolyline=new Cesium.Entity({name:e._sketchEntityName,position:new Cesium.CallbackProperty(e._callUpdaeTriangleEllipseCenterPosition(),!1),polyline:{show:!0,positions:new Cesium.CallbackProperty(e._callUpdateTriangleAltitudePolylinePositions(),!1),material:e._tempAlititudeLineMaterial,width:e._param.moveAltitudeLineWidth,clampToGround:!1},ellipse:{show:!0,semiMinorAxis:new Cesium.CallbackProperty(e._callUpdateTriangleEllipseMinorAxis(),!1),semiMajorAxis:new Cesium.CallbackProperty(e._callUpdateTriangleEllipseMinorAxis(),!1),height:new Cesium.CallbackProperty(e._callUpdateTriangleEllipseHeight(),!1),material:e._toColorFromArray(e._param.moveEllipseColor),outline:e._param.moveEllipseOutline,outlineWidth:e._param.moveEllipseOutlineWidth,outlineColor:e._toColorFromArray(e._param.moveEllipseOutlineColor)}}),e._entities.add(e._sketchTempTriangleAltitudePolyline),e._sketchTempSpatialPolyline=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:new Cesium.CallbackProperty(e._callUpdateTriangleSpatialPolylinePositions(),!1),material:e._tempLineMaterial,width:e._param.moveLineWidth,clampToGround:!1}}),e._entities.add(e._sketchTempSpatialPolyline))}_createTempSpatialTriangle(){let e=this;Cesium.defined(this._sketchTempSpatialTriangle)||(this._sketchTempSpatialTriangle=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:new Cesium.CallbackProperty((function(){e._sketchSpatialTrianglePositions=[],e._sketchSpatialTrianglePositions.push(e._sketchTempPoints[0].clone()),e._sketchSpatialTrianglePositions.push(e._sketchTempPoints[1].clone());let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[0]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]),n=Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(t.longitude),Cesium.Math.toDegrees(t.latitude),i.height);return e._sketchSpatialTrianglePositions.push(n),e._sketchSpatialTrianglePositions.push(e._sketchTempPoints[0].clone()),e._sketchSpatialTrianglePositions}),!1),material:e._tempLineMaterial,width:e._param.moveLineWidth,clampToGround:!1}}),this._entities.add(this._sketchTempSpatialTriangle),this._updateScene())}_createSpatialTriangle(){let e=this;Cesium.defined(this._sketchSpatialTriangle)||(this._sketchSpatialTriangle=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:e._sketchSpatialTrianglePositions,material:e._lineMaterial,width:e._param.lineWidth,clampToGround:!1}}),this._entities.add(this._sketchSpatialTriangle),this._updateScene())}_setMoveLineStyle(e){let t=this,i=[255,255,255,1],n=3,r=!1,o=.2,s=[255,0,0,1],a=1;e&&e.color&&4===e.color.length&&(i=e.color),e&&e.outline&&"boolean"==typeof e.outline&&(r=e.outline),e&&e.outlineColor&&4===e.outlineColor.length&&(s=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(a=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(n=e.lineWidth),e&&e.power&&(o=e.power),this._tempLineMaterial=r?new Cesium.PolylineOutlineMaterialProperty({color:t._toColorFromArray(i),outlineColor:t._toColorFromArray(s),outlineWidth:a}):void 0===o?new Cesium.PolylineDashMaterialProperty({color:t._toColorFromArray(i)}):new Cesium.PolylineGlowMaterialProperty({color:t._toColorFromArray(i),glowPower:o}),this._param.moveLineWidth=n}_setLineStyle(e){let t=[255,255,255,1],i=2,n=[0,255,0,.6],r=1;e&&e.color&&4===e.color.length&&(t=e.color),e&&e.outlineColor&&4===e.outlineColor.length&&(n=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(r=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(i=e.lineWidth),this._lineMaterial=new Cesium.PolylineOutlineMaterialProperty({color:this._toColorFromArray(t),outlineColor:this._toColorFromArray(n),outlineWidth:r}),this._param.lineWidth=i}_setSpatialLineStyle(e){let t=[255,255,0,1],i=2,n=[255,255,255,1],r=1;e&&e.color&&4===e.color.length&&(t=e.color),e&&e.outlineColor&&4===e.outlineColor.length&&(n=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(r=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(i=e.lineWidth),this._spatialLineMaterial=new Cesium.PolylineOutlineMaterialProperty({color:this._toColorFromArray(t),outlineColor:this._toColorFromArray(n),outlineWidth:r}),this._param.spatialLineWidth=i}_setMovePolygonStyle(e){let t=[255,0,0,.3];e&&e.color&&4===e.color.length&&(t=e.color),this._tempPolygonMaterial=new Cesium.ColorMaterialProperty(this._toColorFromArray(t))}_setPolygonStyle(e){let t=[0,0,255,.3];e&&e.color&&4===e.color.length&&(t=e.color),this._polygonMaterial=new Cesium.ColorMaterialProperty(this._toColorFromArray(t))}_setMoveAltitudeLineStyle(e){let t=this,i=[255,255,255,1],n=2,r=!0,o=[255,255,0,1],s=1;e&&e.color&&4===e.color.length&&(i=e.color),e&&e.outline&&"boolean"==typeof e.outline&&(r=e.outline),e&&e.outlineColor&&4===e.outlineColor.length&&(o=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(s=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(n=e.lineWidth),this._tempAlititudeLineMaterial=r?new Cesium.PolylineOutlineMaterialProperty({color:t._toColorFromArray(i),outlineColor:t._toColorFromArray(o),outlineWidth:s}):new Cesium.PolylineDashMaterialProperty({color:t._toColorFromArray(i)}),this._param.moveAltitudeLineWidth=n}_setAltitudeLineStyle(e){let t=[255,255,255,1],i=2,n=[0,0,255,1],r=1;e&&e.color&&4===e.color.length&&(t=e.color),e&&e.outlineColor&&4===e.outlineColor.length&&(n=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(r=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(i=e.lineWidth),this._altitudeLineMaterial=new Cesium.PolylineOutlineMaterialProperty({color:this._toColorFromArray(t),outlineColor:this._toColorFromArray(n),outlineWidth:r}),this._param.altitudeLineWidth=i}_setMoveEllipseStyle(e){e&&e.color&&4===e.color.length&&(this._param.moveEllipseColor=e.color),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(this._param.moveEllipseOutlineWidth=e.outlineWidth),e&&e.outline&&"boolean"==typeof e.outline&&(this._param.moveEllipseOutline=e.outline),e&&e.outlineColor&&4===e.outlineColor.length&&(this._param.moveEllipseOutlineColor=e.outlineColor)}_setEllipseStyle(e){e&&e.color&&4===e.color.length&&(this._param.ellipseColor=e.color),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(this._param.ellipseOutlineWidth=e.outlineWidth),e&&e.outline&&"boolean"==typeof e.outline&&(this._param.ellipseOutline=e.outline),e&&e.outlineColor&&4===e.outlineColor.length&&(this._param.ellipseOutlineColor=e.outlineColor)}_clear(e){null!=e&&!0===e&&(this._removeEntityByName(this._sketchEntityName),this._removePointEntitys()),this._sketchTempPoints=[],this._sketchPoints=[],this._sketchOutputPoints=[],this._sketchTempPolyline=void 0,this._sketchPolyline=void 0,this._sketchTempPolygon=void 0,this._sketchPolygon=void 0,this._sketchTempAltituePolyline=void 0,this._sketchAltitudePolyline=void 0,this._sketchTempSpatialPolyline=void 0,this._sketchSpatialPolyline=void 0,this._sketchTempCircle=void 0,this._sketchCircle=void 0,this._sketchTempRectangle=void 0,this._sketchRectangle=void 0,this._sketchTempTriangleAltitudePolyline=void 0,this._sketchTriangleAltituePolyline=void 0,this._sketchTempSpatialTriangle=void 0,this._sketchSpatialTriangle=void 0}}Object.assign($i.prototype,{setMoveLineStyle:function(e){this._setMoveLineStyle(e)},setLineStyle:function(e){this._setLineStyle(e)},setSpatialLineStyle:function(){this._setSpatialLineStyle(options)},setMovePolygonStyle:function(e){this._setMovePolygonStyle(e)},setPolygonStyle:function(e){this._setPolygonStyle(e)},setMoveAltitudeLineStyle:function(e){this._setMoveAltitudeLineStyle(e)},setAltitudeLineStyle:function(e){this._setAltitudeLineStyle(e)},setMoveEllipseStyle:function(e){this._setMoveEllipseStyle(e)},setEllipseStyle:function(e){this._setEllipseStyle(e)},setLabel:function(e){e||(e={lineLabel:void 0,polygonLabel:void 0}),e.lineLabel&&(this._lineLabel=e.lineLabel),e.polygonLabel&&(this._lineLabel=e.polygonLabel)}}),Object.assign($i.prototype,{_registerLeftClickEvent:function(e,t){let i=this;e&&e.setInputAction((function(e){i._lock=!0,null!=i._timer&&clearTimeout(i._timer),i._timer=setTimeout((function(){t&&t(e),i._lock=!1}),200)}),Cesium.ScreenSpaceEventType.LEFT_CLICK)},_registerLeftDoubleClickEvent:function(e,t){let i=this;e&&e.setInputAction((function(e){null!=i._timer&&clearTimeout(i._timer),i._lock=!1,t&&t(e)}),Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)},_registerMouseMoveEvent:function(e,t){let i=this;e&&e.setInputAction((function(e){void 0!==i._lock&&!1!==i._lock||t&&t(e)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)},_registerRightClickEvent:function(e,t){e&&e.setInputAction((function(e){t&&t(e)}),Cesium.ScreenSpaceEventType.RIGHT_CLICK)},_clearEvent:function(e){e&&(e.destroy(),e=null)}}),Object.assign($i.prototype,{_sketchDrawPoint(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){let r=i._transfromFromScreenPoint(n.position);Cesium.defined(r.sLocation)&&(i._isDrawPoint&&i._createPoint(r.sLocation,i._lineLabel),i._clearEvent(e),t.onComplete&&t.onComplete(r.sLocation,r.gLocation))}))},_sketchDrawMultiplePoint(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),i._sketchPoints.push(n.sLocation),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(n.sLocation,n.gLocation))})),this._registerRightClickEvent(e,(function(e){i._sketchPoints.length>0&&(i._sketchPoints.pop(),i._sketchOutputPoints.pop(),t.onUndo&&t.onUndo())})),this._registerLeftDoubleClickEvent(e,(function(e){i._clearEvent(),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints)}))},_sketchDrawPolyline(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),0===i._sketchTempPoints.length&&(i._createTempPolyline(),i._sketchTempPoints.push(n.sLocation.clone())),i._sketchTempPoints.push(n.sLocation),i._sketchPoints.push(n.sLocation.clone()),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(i._sketchPoints,i._sketchOutputPoints))})),this._registerMouseMoveEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(n.sLocation)&&Cesium.defined(i._sketchTempPolyline)&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n.sLocation),t.onMoving&&t.onMoving(n.sLocation))})),this._registerRightClickEvent(e,(function(e){if(i._sketchTempPoints.length>2){if(i._sketchPoints.pop(),i._sketchTempPoints.splice(i._sketchTempPoints.length-2,1),i._isDrawPoint){let e=i._pointEntitys[i._pointEntitys.length-1];i._entities.remove(e),i._pointEntitys.pop()}t.onUndo&&t.onUndo()}})),this._registerLeftDoubleClickEvent(e,(function(n){i._sketchPoints.length<2?t.onError&&t.onError("点数少于两个,禁止结束绘制!"):(i._removeEntityByObject(i._sketchTempPolyline),i._createPolyline(),i._isRetainDrawPoint||i._removePointEntitys(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints))}))},_sketchDrawSpatialPolyline(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),0===i._sketchTempPoints.length&&(i._createTempSpatialPolyline(),i._sketchTempPoints.push(n.sLocation.clone())),i._sketchTempPoints.push(n.sLocation),i._sketchPoints.push(n.sLocation.clone()),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(i._sketchPoints,i._sketchOutputPoints))})),this._registerMouseMoveEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(n.sLocation)&&Cesium.defined(i._sketchTempSpatialPolyline)&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n.sLocation),t.onMoving&&t.onMoving(n.sLocation))})),this._registerLeftDoubleClickEvent(e,(function(n){i._sketchPoints.length<2?t.onError&&t.onError("绘制点少于2个,禁止结束绘制!"):(i._removeEntityByObject(i._sketchTempSpatialPolyline),i._createSpatialPolyline(),i._removePointEntitys(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints))})),this._registerRightClickEvent(e,(function(e){i._sketchTempPoints.length>2&&(i._sketchPoints.pop(),i._sketchTempPoints.splice(i._sketchTempPoints.length-2,1),t.onUndo&&t.onUndo())}))},_sketchDrawPolygon(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),0===i._sketchTempPoints.length&&(i._createTempPolygon(),i._createTempPolyline(),i._sketchTempPoints.push(n.sLocation.clone())),i._sketchTempPoints.push(n.sLocation),i._sketchPoints.push(n.sLocation.clone()),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(i._sketchPoints,i._sketchOutputPoints))})),this._registerMouseMoveEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(n.sLocation)&&Cesium.defined(i._sketchTempPolygon)&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n.sLocation),t.onMoving&&t.onMoving(n.sLocation))})),this._registerRightClickEvent(e,(function(e){if(i._sketchTempPoints.length>2){if(i._sketchPoints.pop(),i._sketchTempPoints.splice(i._sketchTempPoints.length-2,1),i._isDrawPoint){let e=i._pointEntitys[i._pointEntitys.length-1];i._entities.remove(e),i._pointEntitys.pop()}t.onUndo&&t.onUndo()}})),this._registerLeftDoubleClickEvent(e,(function(n){i._sketchPoints.length<3?t.onError&&t.onError("点数少于3个,禁止结束绘制!"):(i._removeEntityByObject(i._sketchTempPolygon),i._removeEntityByObject(i._sketchTempPolyline),i._createPolygon(),i._isRetainDrawPoint||i._removePointEntitys(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints))}))},_sketchDrawCircle:function(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){if(0===i._sketchTempPoints.length){let e=i._transfromFromScreenPoint(n.position);if(!Cesium.defined(e.sLocation))return;i._isDrawPoint&&i._createPoint(e.sLocation,"起点"),i._sketchTempPoints.push(e.sLocation.clone()),i._sketchTempPoints.push(e.sLocation),i._sketchPoints.push(e.sLocation.clone()),i._sketchOutputPoints.push(e.gLocation),i._createTempCircle(e.sLocation),t.onAdded&&t.onAdded(e.sLocation)}else i._removePointEntitys(),i._removeEntityByObject(i._sketchTempCircle),i._createCircle(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchOutputPoints[0],i._sketchEllipseRadius)})),this._registerMouseMoveEvent(e,(function(e){if(Cesium.defined(i._sketchTempCircle)){var t=i._viewer.scene.pickPosition(e.endPosition);null!=t&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(t))}}))},_sketchDrawHeightPolyline:function(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){if(0===i._sketchTempPoints.length){let e=i._transfromFromScreenPoint(n.position);if(!Cesium.defined(e.sLocation))return;i._isDrawPoint&&i._createPoint(e.sLocation,"起点"),i._sketchAltitudeInitHeight=e.gLocation.height,i._sketchTempPoints.push(e.sLocation.clone()),i._sketchTempPoints.push(e.sLocation),i._sketchPoints.push(e.sLocation.clone()),t.onAdded&&t.onAdded(e.sLocation)}else i._removePointEntitys(),i._removeEntityByObject(i._sketchTempAltituePolyline),i._createAltitudePolyline(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchAltitudePolylinePostions,i._sketchEllipseCenterPosition)})),this._registerMouseMoveEvent(e,(function(e){if(null!=i._sketchTempPoints&&0!=i._sketchTempPoints.length){var n=i._viewer.scene.pickPosition(e.endPosition);null!=n&&i._sketchTempPoints.length>=2&&(Cesium.defined(i._sketchTempAltituePolyline)?(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n)):i._createTempAltitudePolyline(),t.onMoving&&t.onMoving(i._sketchAltitudePolylinePostions,i._sketchEllipseCenterPosition))}}))},_sketchDrawRectangle:function(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){if(0===i._sketchTempPoints.length){let e=i._transfromFromScreenPoint(n.position);if(!Cesium.defined(e.sLocation))return;i._isDrawPoint&&i._createPoint(e.sLocation,"起点"),i._sketchTempPoints.push(e.gLocation),i._sketchTempPoints.push(e.gLocation),i._sketchPoints.push(e.gLocation),i._createTempRectangle(),t.onAdded&&t.onAdded(e.sLocation)}else i._removePointEntitys(),i._removeEntityByObject(i._sketchTempRectangle),i._createRectangle(),e.destroy(),e=null,t.onComplete&&t.onComplete(i._sketchOutputPoints)})),this._registerMouseMoveEvent(e,(function(e){if(!Cesium.defined(i._sketchTempRectangle))return;let t=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(t.sLocation)&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(t.gLocation))}))},_sketchDrawTriangle:function(e,t){let i=this;e.setInputAction((function(e){if(Cesium.defined(i._sketchTempAltituePolyline))return;let t=i._transfromFromScreenPoint(e.position);Cesium.defined(t.sLocation)&&(0==i._sketchPoints.length?(i._createPoint(t.sLocation,"起点"),i._sketchTempPoints.push(t.sLocation.clone()),i._sketchTempPoints.push(t.sLocation),i._sketchPoints.push(t.sLocation),i._createTempPolyline()):1===i._sketchPoints.length&&(i._createPoint(t.sLocation,"高度起点"),i._entities.remove(i._sketchTempPolyline),i._sketchPoints.push(t.sLocation),i._createPolyline(),i._sketchTempPoints.push(t.sLocation.clone()),i._sketchPoints.push(t.sLocation),i._sketchAltitudeInitHeight=t.gLocation.height,i._createTempTriangleAltitudePolylineAndSpatialPolyline()))}),Cesium.ScreenSpaceEventType.LEFT_CLICK),e.setInputAction((function(e){if(void 0!==i._sketchPoints&&0!==i._sketchPoints.length){var t=i._viewer.scene.pickPosition(e.endPosition);null!=t&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(t))}}),Cesium.ScreenSpaceEventType.MOUSE_MOVE),e.setInputAction((function(n){i._sketchPoints.length<2?t.onError&&t.onError("绘制图形不完整,禁止结束绘制!"):(i._removePointEntitys(),i._removeEntityByObject(i._sketchTempTriangleAltitudePolyline),i._removeEntityByObject(i._sketchTempSpatialPolyline),i._createAltitudePolyline(),i._createTriangleSpatialPolyline(),e.destroy(),e=null,t.onComplete(i._sketchPoints,i._sketchTriangleSpatialPolylinePositions,i._sketchAltitudePolylinePostions,i._sketchEllipseCenterPosition))}),Cesium.ScreenSpaceEventType.RIGHT_CLICK)},_sketchDrawPolygonBody(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),0===i._sketchTempPoints.length&&(i._createTempPolygon(),i._createTempPolyline(),i._sketchTempPoints.push(n.sLocation.clone())),i._sketchTempPoints.push(n.sLocation),i._sketchPoints.push(n.sLocation.clone()),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(i._sketchPoints,i._sketchOutputPoints))})),this._registerMouseMoveEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(n.sLocation)&&Cesium.defined(i._sketchTempPolygon)&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n.sLocation),t.onMoving&&t.onMoving(n.sLocation))})),this._registerRightClickEvent(e,(function(e){i._sketchTempPoints.length>2&&(i._sketchPoints.pop(),i._sketchOutputPoints.pop(),i._sketchTempPoints.splice(i._sketchTempPoints.length-2,1),t.onUndo&&t.onUndo(i._sketchPoints))})),this._registerLeftDoubleClickEvent(e,(function(n){i._sketchPoints.length<3?t.onError&&t.onError("点数少于3个,禁止结束绘制!"):(i._removeEntityByObject(i._sketchTempPolygon),i._removeEntityByObject(i._sketchTempPolyline),i._createPolygonBody({height:30,color:[255,255,0,.9]}),i._removePointEntitys(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints))}))},_sketchDrawTriangleA:function(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){if(Cesium.defined(i._sketchTempAltituePolyline))return;let r=i._transfromFromScreenPoint(n.position);Cesium.defined(r.sLocation)&&(0==i._sketchPoints.length?(i._sketchTempPoints.push(r.sLocation.clone()),i._sketchTempPoints.push(r.sLocation),i._sketchPoints.push(r.sLocation),i._createTempSpatialTriangle()):i._sketchPoints.length>0&&(i._removePointEntitys(),i._removeEntityByObject(i._sketchTempSpatialTriangle),i._createSpatialTriangle(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchSpatialTrianglePositions)))})),this._registerMouseMoveEvent(e,(function(e){if(void 0!==i._sketchPoints&&0!==i._sketchPoints.length){var n=i._viewer.scene.pickPosition(e.endPosition);null!=n&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n),t.onMoving&&t.onMoving(n))}}))},sketchTools:function(e,t){let i=this;switch(this._clear(),i._sketchEventHandler=new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas),e){case $i.SketchType.Point:i._sketchDrawPoint(i._sketchEventHandler,t);break;case $i.SketchType.Line:i._sketchDrawPolyline(i._sketchEventHandler,t);break;case $i.SketchType.Polygon:i._sketchDrawPolygon(i._sketchEventHandler,t);break;case $i.SketchType.Height:i._sketchDrawHeightPolyline(i._sketchEventHandler,t);break;case $i.SketchType.Spatial:i._sketchDrawSpatialPolyline(i._sketchEventHandler,t);break;case $i.SketchType.Circle:i._sketchDrawCircle(i._sketchEventHandler,t);break;case $i.SketchType.Rectangle:i._sketchDrawRectangle(i._sketchEventHandler,t);break;case $i.SketchType.Triangle:i._sketchDrawTriangleA(i._sketchEventHandler,t);break;case $i.SketchType.PolygonBody:i._sketchDrawPolygonBody(i._sketchEventHandler,t);break;case $i.SketchType.MultiplePoint:i._sketchDrawMultiplePoint(i._sketchEventHandler,t)}},sketchDrawFeacture:function(e,t,i){let n=this;if(void 0===e||void 0===e.length||e.length<2)i&&i.onError&&i.onError("输入的坐标集合异常!");else{this._sketchPoints=[];for(let t=0;t<e.length;)this._sketchPoints.push(Cesium.Cartesian3.fromDegrees(e[t],e[t+1],e[t+2])),t+=3;switch(t){case $i.SketchType.DrawPoint:n._createPoint(n._sketchPoints[0],n._lineLabel),i&&i.onComplete&&i.onComplete();break;case $i.SketchType.DrawMultiplePoint:for(let e=0;e<n._sketchPoints.length;e++)n._createPoint(n._sketchPoints[e],n._lineLabel);i&&i.onComplete&&i.onComplete();break;case $i.SketchType.DrawPolyline:n._sketchPoints.length<2?i&&i.onError&&i.onError("点数少于2个,无法绘制!"):(n._createPolyline(),i&&i.onComplete&&i.onComplete());break;case $i.SketchType.DrawPolygon:n._sketchPoints.length<3?i&&i.onError&&i.onError("点数少于3个,无法绘制!"):(n._createPolygon(),i&&i.onComplete&&i.onComplete());break;default:i&&i.onError&&i.onError("绘制类型异常!")}}},sketchClear:function(){this._clear(!0)},sketchInit:function(){this._clear(!1)}}),Object.assign($i.prototype,{_checkColor:function(e){if(null==e)return!1;if("number"!=typeof e)return!1;let t=parseInt(e);return!(t<0||t>255)},_checkAlpha:function(e){if(null==e)return!1;if("number"!=typeof e)return!1;let t=parseFloat(e);return!(t<0||t>1)},_checkColorAndAlpha:function(e){let t;if(e&&void 0!==e.length&&0!==e.length)return 1===e.length&&this._checkColor(e[0])?t=[e[0],0,0,1]:2===e.length&&this._checkColor(e[0])&&this._checkColor(e[1])?t=[e[0],e[1],0,1]:3===e.length&&this._checkColor(e[0])&&this._checkColor(e[1])&&this._checkColor(e[2])?t=[e[0],e[1],e[2],1]:4===e.length&&this._checkColor(e[0])&&this._checkColor(e[1])&&this._checkColor(e[2])&&this._checkAlpha(e[3])&&(t=[e[0],e[1],e[2],e[3]]),t},sketchEditPickPolygonBody:function(e){let t=this._sketchPickPolygonBody;if(void 0===t)return void(e.onComplete&&e.onComplete("未拾取对象或拾取的对象不符合要求!"));let i=t._useGeometry.color,n=t._useGeometry.height;this._sketchPoints=t._useGeometry.cPoints,this._sketchOutputPoints=t._useGeometry.gPoints,e&&e.height&&"number"==typeof e.height&&(n=parseInt(e.height)),e&&e.color&&this._checkColorAndAlpha(e.color)&&(i=this._checkColorAndAlpha(e.color)),this._viewer.scene.primitives.remove(t),this._createPolygonBody({color:i,height:n}),e.onComplete&&e.onComplete(void 0)},sketchRemovePickPolygonBody:function(e){let t=this._sketchPickPolygonBody;void 0!==t?(this._viewer.scene.primitives.remove(t),e&&e(void 0)):e&&e("未拾取对象或拾取的对象不符合要求!")},sketchPick:function(e){let t=this,i=new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);i.setInputAction((function(n){let r=t._viewer.scene.pick(n.position);r&&r.primitive&&null!=r.primitive._useGeometry?(t._sketchPickPolygonBody=r.primitive,e&&e({color:r.primitive._useGeometry.color,height:r.primitive._useGeometry.height})):(t._sketchPickPolygonBody=void 0,e&&e(void 0)),i.destroy(),i=null}),Cesium.ScreenSpaceEventType.LEFT_CLICK)}}),$i.SketchType=Object.freeze({Point:"point",MultiplePoint:"multiplePoint",Line:"line",Polygon:"polygon",Height:"height",Spatial:"spatial",Circle:"circle",Rectangle:"rectangle",Triangle:"triangle",PolygonBody:"polygonBody",DrawPoint:"drawPoint",DrawMultiplePoint:"drawMultiplePoint",DrawPolyline:"drawPolyline",DrawPolygon:"drawPolygon"}),$i.SketchIconType=Object.freeze({Normal:"normal",Blue:"blue",Green:"green",Violet:"violter"});class en{constructor(e,t){this._viewer=e,this._sketchViewModel=new $i(e,{iconType:$i.SketchIconType.Blue}),t&&t.isClear&&(this._isClear=t.isClear),this._init()}_init(){this._measureEntityName="MeasureEntity",this._entities=this._viewer.entities,this._measurePointImage="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==",this._iconBlue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC",this._iconGreen="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=",this._iconViolet="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC",this._measureTempPoints=[]}_updateScene(){this._viewer.scene.requestRender()}_removeEntityByName(e){let t=this._entities;if(!t||!t.values)return;let i=[];for(let n=0;n<t.values.length;n++)t.values[n].name==e&&i.push(t.values[n]);for(let n=0;n<i.length;n++)t.remove(i[n]);this._updateScene()}_clear(e){null!=e&&!0===e&&(this._removeEntityByName(this._measureEntityName),null!=this._sketchViewModel&&this._sketchViewModel.sketchClear()),this._measureTempPoints=[],this._altitudeDynamicLabel=void 0,this._tooltipRemove()}_toColor(e,t,i,n){return new Cesium.Color(e/255,t/255,i/255,n)}_cartesianToGeography(e){let t=Cesium.Ellipsoid.WGS84.cartesianToCartographic(e),i=Cesium.Math.toDegrees(t.latitude);return{lon:Cesium.Math.toDegrees(t.longitude),lat:i,hei:t.height}}_createPoint(e,t){let i=this,n=new Cesium.Entity({name:i._measureEntityName,position:e,billboard:{image:i._iconBlue,horizontalOrigin:Cesium.HorizontalOrigin.center,verticalOrigin:Cesium.VerticalOrigin.bottom,scale:.5,pixelOffset:new Cesium.Cartesian2(0,-11),disableDepthTestDistance:Number.POSITIVE_INFINITY}});return t&&(n.label={text:t,font:"30px SimHei",scale:.5,fillColor:this._toColor(255,255,255,1),outlineColor:this._toColor(14,30,79,1),style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,showBackground:!0,backgroundColor:i._toColor(0,0,0,.6),disableDepthTestDistance:Number.POSITIVE_INFINITY,pixelOffset:new Cesium.Cartesian2(0,-28)}),this._entities.add(n),this._updateScene(),n}_createLabel(e,t){let i=new Cesium.Entity({name:this._measureEntityName,position:e,label:{text:t,font:"30px SimHei",scale:.5,fillColor:this._toColor(255,255,255,1),outlineColor:this._toColor(14,30,79,1),style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,showBackground:!0,backgroundColor:this._toColor(0,0,0,.6),disableDepthTestDistance:Number.POSITIVE_INFINITY,pixelOffset:new Cesium.Cartesian2(0,-14)}});this._entities.add(i),this._updateScene()}_createAltitudeDynamicLabel(){let e=this;this._altitudeDynamicLabel=new Cesium.Entity({name:e._measureEntityName,position:new Cesium.CallbackProperty((function(){return e._altitudeLabelPosition}),!1),label:{text:new Cesium.CallbackProperty((function(){return e._altitudeLabelText}),!1),font:"12px sans-serif",fillColor:this._toColor(255,255,255,1),outlineColor:this._toColor(0,154,94,1),style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:1,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffset:new Cesium.Cartesian2(0,-28),showBackground:!0,backgroundColor:this._toColor(0,0,0,.6),disableDepthTestDistance:Number.POSITIVE_INFINITY}}),this._entities.add(this._altitudeDynamicLabel),this._updateScene()}_measureDistance(e){let t=0;for(let i=0;i<e.length-1;i++){let n=Cesium.Cartographic.fromCartesian(e[i]),r=Cesium.Cartographic.fromCartesian(e[i+1]),o=new Cesium.EllipsoidGeodesic;o.setEndPoints(n,r);let s=o.surfaceDistance;s=Math.sqrt(Math.pow(s,2)+Math.pow(r.height-n.height,2)),t+=s}return t<1e3?t.toFixed(2)+"米":(t/1e3).toFixed(2)+"公里"}_measureSpaceDistance(e){let t=0;for(let i=0;i<e.length-1;i++){let n=e[i],r=e[i+1],o=Math.abs(n.x-r.x),s=Math.abs(n.y-r.y),a=Math.abs(n.z-r.z);t+=Math.sqrt(Math.pow(o,2)+Math.pow(s,2)+Math.pow(a,2))}return t<1e3?t.toFixed(2)+"米":(t/1e3).toFixed(2)+"公里"}_measureAreaBearing(e,t){let i=Math.PI/180,n=180/Math.PI,r=e.lat*i,o=e.lon*i,s=t.lat*i,a=t.lon*i,l=-Math.atan2(Math.sin(o-a)*Math.cos(s),Math.cos(r)*Math.sin(s)-Math.sin(r)*Math.cos(s)*Math.cos(o-a));return l<0&&(l+=2*Math.PI),l*=n,l}_calculateAreaAngle(e,t,i){let n=this._measureAreaBearing(t,e)-this._measureAreaBearing(t,i);return n<0&&(n+=360),n}_calculateDistance(e,t){let i=Cesium.Cartographic.fromCartesian(e),n=Cesium.Cartographic.fromCartesian(t),r=new Cesium.EllipsoidGeodesic;r.setEndPoints(i,n);let o=r.surfaceDistance;return o=Math.sqrt(Math.pow(o,2)+Math.pow(n.height-i.height,2)),o}_measureArea(e,t){let i=this,n=0;for(let r=0;r<e.length-2;r++){let o=(r+1)%e.length,s=(r+2)%e.length,a=i._calculateAreaAngle(e[r],e[o],e[s]);n+=i._calculateDistance(t[r],t[o])*i._calculateDistance(t[o],t[s])*Math.abs(Math.sin(a))}return n}_calculatePolylineAltitudeHeight(e){if(void 0===e||e.length<2)return-1;let t=Cesium.Cartographic.fromCartesian(e[0]),i=Cesium.Cartographic.fromCartesian(e[1]).height-t.height;return Math.abs(i).toFixed(2)+"米"}_setMousePointerStyle(){document.querySelector("body").style.cursor="crosshair"}_initMousePointerStyle(){document.querySelector("body").style.cursor="default"}}Object.assign(en.prototype,{_tooltipInit:function(e){this._tooltipId="tooltipJt";let t=document.getElementById(this._tooltipId);if(null===t){t=document.createElement("div"),t.id=this._tooltipId,document.body.appendChild(t);let e="";e+="top: 30px;",e+="left: 30px;",e+="position: absolute;",e+="display: flex;",e+="align-items: center;",e+="width: 12x0px;",e+="height: auto;",e+="background-color: rgba(0, 0, 0, 0.65);",e+="border-radius: 5px;",e+="color: rgb(255, 255, 255);",e+="font-size: 12px;",e+="font-family: 'Alimama_ShuHeiTi_Bold';",e+="padding: 8px;",e+="border:solid 1px rgb(255,0,0);",t.setAttribute("style",e)}null!=e&&(t.innerHTML=e),document.onmousemove=function(e){t.style.left=e.clientX+10+"px",t.style.top=e.clientY-t.offsetHeight/2+"px"}},_tooltipRemove:function(){let e=document.getElementById(this._tooltipId);null!=e&&document.body.removeChild(e)},_tooltipSetText:function(e){let t=document.getElementById(this._tooltipId);null!=t&&(t.innerHTML=e)}}),Object.assign(en.prototype,{clear:function(){this._clear(!0)}}),Object.assign(en.prototype,{measureLength:function(){let e=this;this._tempEntitys=[],this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始测量"),this._sketchViewModel.sketchTools($i.SketchType.Line,{onAdded:function(t,i){if(1===t.length)e._createPoint(t[0],"起点");else{let i=e._measureDistance(t),n=[t[t.length-2],t[t.length-1]];i+=" +"+e._measureDistance(n),e._tempEntitys.push(e._createPoint(t[t.length-1],i))}},onUndo:function(){e._viewer.entities.remove(e._tempEntitys[e._tempEntitys.length-1]),e._tempEntitys.pop()},onMoving:function(t,i){e._tooltipSetText("右键单击回退<br>左键双击结束绘制")},onComplete:function(t,i){e._initMousePointerStyle(),e._tooltipRemove()}})},measureSpatialLength:function(){let e=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始测量"),this._tempEntitys=[],this._sketchViewModel.sketchTools($i.SketchType.Spatial,{onAdded:function(t,i){if(1===t.length)e._createPoint(t[0],"起点");else{let i=e._measureSpaceDistance(t);e._tempEntitys.push(e._createPoint(t[t.length-1],i))}},onUndo:function(){e._viewer.entities.remove(e._tempEntitys[e._tempEntitys.length-1]),e._tempEntitys.pop()},onMoving:function(t,i){e._tooltipSetText("右键单击回退<br>左键双击结束绘制")},onComplete:function(t,i){e._initMousePointerStyle(),e._tooltipRemove()}})},measureArea:function(){let e=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始测量"),this._sketchViewModel.sketchTools($i.SketchType.Polygon,{onAdded:function(t,i){if(e._measureTempPoints.push(e._cartesianToGeography(t[t.length-1])),1===t.length)void 0===e._areaLabelEntity?(e._areaLabel="起点",e._areaLabelEntity=e._createPoint(t[0],new Cesium.CallbackProperty((function(){return e._areaLabel}),!1))):e._areaLabel="起点";else if(t.length>=3){let i=e._measureArea(e._measureTempPoints,t);e._areaLabel=i>1e5?(i/1e5).toFixed(2)+"km²":i.toFixed(2)+"m²"}},onUndo:function(){e._measureTempPoints.pop(),1===e._measureTempPoints.length&&(e._areaLabel="起点")},onMoving:function(t,i){e._tooltipSetText("右键单击回退<br>左键双击结束绘制")},onComplete:function(t,i){e._initMousePointerStyle(),e._tooltipRemove()}})},measureHeight:function(){let e=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始测量"),this._sketchViewModel.sketchTools($i.SketchType.Height,{onAdded:function(t){e._tooltipSetText("再次单击结束测量")},onMoving:function(t,i){let n=e._calculatePolylineAltitudeHeight(t);e._altitudeLabelPosition=i,e._altitudeLabelText=n,void 0===e._altitudeDynamicLabel&&e._createAltitudeDynamicLabel()},onComplete:function(t,i){let n=e._calculatePolylineAltitudeHeight(t);e._entities.remove(e._altitudeDynamicLabel),e._createLabel(i,n),e._initMousePointerStyle(),e._tooltipRemove()}})},measureTriangle:function(){let e=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始测量"),this._sketchViewModel.sketchTools($i.SketchType.Triangle,{onMoving:function(t){e._tooltipSetText("再次单击结束测量")},onComplete:function(t){e._initMousePointerStyle(),e._tooltipRemove();let i=[t[0],t[1]],n=e._measureSpaceDistance(i),r=[t[1],t[2]],o=e._measureSpaceDistance(r),s=[t[2],t[0]],a=e._calculatePolylineAltitudeHeight(s);e._createLabel(t[0],"斜距:"+n),e._createLabel(t[1],"平距:"+o),e._createLabel(t[2],"高度:"+a)}})}}),Object.assign(en.prototype,{queryByPolygon:function(e){let t=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始绘制区域"),this._sketchViewModel.sketchTools($i.SketchType.Polygon,{onMoving:function(e,i){t._tooltipSetText("右键单击回退<br>左键双击结束绘制开始查询")},onComplete:function(i,n){let r;t._initMousePointerStyle(),t._tooltipRemove();for(let e=0;e<n.length;e++){let t=n[e];void 0===r?r=t.lng+","+t.lat:r+=","+t.lng+","+t.lat}r+=","+n[0].lng+","+n[0].lat;let o=t._sketchViewModel._sketchPolygon;e&&e(r,o)}})},queryByPoint:function(e){let t=this;this._setMousePointerStyle(),this._clear(this._isClear),this._tooltipInit("点击位置进行查询"),this._sketchViewModel.sketchTools($i.SketchType.Point,{onComplete:function(i,n){t._initMousePointerStyle(),t._tooltipRemove();let r=n.lng+","+n.lat;e&&e(r)}})},queryByMultiplePoint:function(e){let t=this;this._setMousePointerStyle(),this._clear(this._isClear),this._tooltipInit("点击位置绘制<br>左键双击结束绘制"),this._tempEntitys=[],this._sketchViewModel.sketchTools($i.SketchType.MultiplePoint,{onAdded:function(e,i){let n=i.lng.toFixed(6)+","+i.lat.toFixed(6);t._tempEntitys.push(t._createPoint(e,n))},onUndo:function(){t._viewer.entities.remove(t._tempEntitys[t._tempEntitys.length-1]),t._tempEntitys.pop()},onComplete:function(i,n){t._initMousePointerStyle(),t._tooltipRemove();let r=[];for(let e=0;e<n.length;e++)r.push(n[e].lng),r.push(n[e].lat);e&&e(r)}})},queryByLine:function(e){let t=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始绘制线"),this._sketchViewModel.sketchTools($i.SketchType.Line,{onAdded:function(e,t){},onMoving:function(e,i){t._tooltipSetText("右键单击回退<br>左键双击结束绘制开始查询")},onComplete:function(i,n){let r;t._initMousePointerStyle(),t._tooltipRemove();for(let e=0;e<n.length;e++){let t=n[e];void 0===r?r=t.lng+","+t.lat:r+=","+t.lng+","+t.lat}let o=t._sketchViewModel._sketchPolyline;e&&e(r,o)}})},queryByCircle:function(e){let t=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始绘制圆"),this._sketchViewModel.sketchTools($i.SketchType.Circle,{onAdded:function(e){t._tooltipInit("再次单击结束绘制,开始查询")},onComplete:function(i,n){t._initMousePointerStyle(),t._tooltipRemove(),e&&e(i.lng+","+i.lat,n)}})},queryByRectangle:function(e){let t=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始绘制矩形"),this._sketchViewModel.sketchTools($i.SketchType.Rectangle,{onAdded:function(e){t._tooltipInit("再次单击结束绘制,开始查询")},onComplete:function(i){let n;t._initMousePointerStyle(),t._tooltipRemove();for(let e=0;e<i.length;e++){let t=i[e];void 0===n?n=t.lng+","+t.lat:n+=","+t.lng+","+t.lat}e&&e(n)}})}}),Object.assign(en.prototype,{drawPolygonBody:function(e){let t=this;this._clear(this._isClear),this._setMousePointerStyle(),this._tooltipInit("点击开始绘制"),this._sketchViewModel.sketchTools($i.SketchType.PolygonBody,{onAdded:function(e,i){0===e.length?t._tooltipInit("点击开始绘制"):e.length<3?t._tooltipInit("右键单击回退"):t._tooltipInit("右键单击回退<br>左键双击结束绘制")},onUndo:function(e){0===e.length?t._tooltipInit("点击开始绘制"):e.length<3?t._tooltipInit("右键单击回退"):t._tooltipInit("右键单击回退<br>左键双击结束绘制")},onComplete:function(i,n){t._initMousePointerStyle(),t._tooltipRemove(),e&&e()}})},drawPointFeacture:function(e,t){this._sketchViewModel.sketchDrawFeacture(e,$i.SketchType.DrawPoint,t)},drawMultiplePointFeacture:function(e,t){this._sketchViewModel.sketchDrawFeacture(e,$i.SketchType.DrawMultiplePoint,t)},drawPolylineFeacture:function(e,t){this._sketchViewModel.sketchDrawFeacture(e,$i.SketchType.DrawPolyline,t)},drawPolygonFeacture:function(e,t){this._sketchViewModel.sketchDrawFeacture(e,$i.SketchType.DrawPolygon,t)}}),Object.assign(en.prototype,{tooltipInit:function(e){this._tooltipInit(e)},tooltipRemove:function(){this._tooltipRemove()},tooltipSetText:function(e){this._tooltipSetText(e)}}),Object.assign(en.prototype,{pickPolygonBody:function(e){this._sketchViewModel.sketchPick((function(t){void 0===t?e&&e(void 0):e&&e({color:t.color,height:t.height})}))},setPolygonBody:function(e){this._sketchViewModel.sketchEditPickPolygonBody({color:e.color,height:e.height,onComplete:e.onComplete})},removePolygonBody:function(e){this._sketchViewModel.sketchRemovePickPolygonBody(e)}});class tn{constructor(e){this._viewer=e.viewer,this._definitionChanged=new Cesium.Event,this._color=void 0,this.color=e.color||Cesium.Color.BLUE,this.duration=e.duration||1e3,this.trailImage=e.trailImage,this._time=(new Date).getTime(),this._materialTypeName="jtWallMaterial",this._param={color:this.color._value.toCssColorString(),image:this.trailImage,duration:this.duration,count:0,direction:"",order:""},Cesium.Material._materialCache.addMaterial(this._materialTypeName,{fabric:{type:this._materialTypeName,uniforms:{time:-20,color:new Cesium.Color(1,0,0,.5),image:e.trailImage},source:this._getDirectionWallShader(e.param)},translucent:function(e){return!0}})}getType(e){return this._materialTypeName}getValue(e,t){return Cesium.defined(t)||(t={}),t.color=Cesium.Property.getValueOrClonedDefault(this._color,e,Cesium.Color.BLUE,t.color),t.image=this.trailImage,this.duration&&(t.time=((new Date).getTime()-this._time)%this.duration/this.duration),this._viewer.scene.requestRender(),t}equals(e){return this===e||e instanceof tn&&Cesium.Property.equals(this._color,e._color)}_getDirectionWallShader(e){let t=Cesium.defaultValue(e,{}),i=void 0!==t.count&&"number"==typeof t.count&&t.count>0?t.count:1,n="horizontal"===t.direction?"horizontal":"vertical",r="+"===t.order?"+":"-";this._param.count=i,this._param.direction=n,this._param.order=r;let o="";return o+="czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n","vertical"===n?o+=" vec4 colorImage = texture2D(image, vec2(fract(float("+i+")*st.t "+r+" time), st.t));\n":"horizontal"===n&&(o+=" vec4 colorImage = texture2D(image, vec2(fract(float("+i+")*st.s "+r+" time), st.t));\n"),o+=" vec4 fragColor;\n fragColor.rgb = color.rgb / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.alpha = colorImage.a * color.a;\n material.diffuse = color.rgb;\n material.emission = fragColor.rgb;\n return material;\n}",o}}Object.defineProperties(tn.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:Cesium.createPropertyDescriptor("color")});class nn{constructor(e){this._viewer=e.viewer,this._definitionChanged=new Cesium.Event,this._color=void 0,this.color=e.color||Cesium.Color.BLUE,this.count=e.count||1,this.duration=e.duration||1e3,this._time=(new Date).getTime(),this._materialTypeName="jtCircleMaterial",this._param={color:this.color._value.toCssColorString(),duration:this.duration,count:this.count},Cesium.Material._materialCache.addMaterial(this._materialTypeName,{fabric:{type:this._materialTypeName,uniforms:{time:0,color:new Cesium.Color(1,0,0,.5),count:1},source:this._getCircleMaterial()},translucent:function(e){return!0}})}_getCircleMaterial(){return"czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(time);\n if (abs(str.z) > 0.001)\n {\n //着色器渲染停止,不在绘制内容 \n discard;\n }\n if (dis > 0.5)\n {\n //超出半径范围时,着色器渲染停止 \n discard;\n } else {\n //把半径分成count份,每两份之间的间隔距离 \n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n //循环,最多999个环 \n for (int i = 0; i <= 999; i++)\n {\n //判断是否属于数量内的环 \n if (float(i) <= count)\n {\n disNum = perDis * float(i) - dis + per / count;\n if (disNum > 0.0)\n {\n if (disNum < perDis)\n {\n bl = 1.0 - disNum / perDis;\n } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = color.a * pow(bl, 3.0);\n }\n }\n }\n }\n return material;\n}\n"}}Object.assign(nn.prototype,{getType:function(e){return this._materialTypeName},getValue:function(e,t){return Cesium.defined(t)||(t={}),t.color=Cesium.Property.getValueOrClonedDefault(this._color,e,Cesium.Color.BLUE,t.color),t.count=this.count,this.duration&&(t.time=((new Date).getTime()-this._time)%this.duration/this.duration),this._viewer.scene.requestRender(),t},equals:function(e){return this===e||e instanceof WallMaterialProperty&&Cesium.Property.equals(this._color,e._color)}}),Object.defineProperties(nn.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}},color:Cesium.createPropertyDescriptor("color")}),Cesium.Entity.prototype.setEditType=function(e){this._editType=e},Cesium.Entity.prototype.getEditType=function(){return this._editType},Cesium.Entity.prototype.setEntityType=function(e){this._entityType=e},Cesium.Entity.prototype.getEntityType=function(e){return this._entityType},Cesium.Entity.prototype.setIsEdit=function(e){this._isEdit=e},Cesium.Entity.prototype.getIsEdit=function(){return this._isEdit},Cesium.Entity.prototype.setParams=function(e){this._params=e},Cesium.Entity.prototype.getParams=function(){return this._params},Cesium.Entity.prototype.bindEntity=function(e){this._bindEntity=e},Cesium.Entity.prototype.getBindEntity=function(){return this._bindEntity};class rn{constructor(e,t){this._viewer=e,this._init(t)}static initEditPropertyParams(){return{id:void 0,height:20,color:"rgba(255,0,255,0.8)",direction:"horizontal",order:"-",count:2,text:"",lineWidth:0,power:.25,outlineWidth:0,outlineColor:"rgba(255,0,255,0.8)"}}_init(e){if(this._viewer.scene.globe.depthTestAgainstTerrain=!0,this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this._entities=this._viewer.entities,this._pointEntitys=[],this._sketchPointImage=void 0,this._iconNormal="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==",this._iconBlue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC",this._iconGreen="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=",this._iconViolet="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC",this._sketchEntityName="drawEditEntity",this._sketchTempPoints=[],this._sketchPoints=[],this._sketchOutputPoints=[],this._sketchWallHeights=[],this._drawEntity=void 0,this._lineLabel=void 0,this._polygonLabel=void 0,e&&e.isDrawPoint?this._isDrawPoint=e.isDrawPoint:this._isDrawPoint=!1,e&&e.isRetainDrawPoint?this._isRetainDrawPoint=e.isRetainDrawPoint:this._isRetainDrawPoint=!1,this._param={moveLineWidth:3,lineWidth:3,moveAltitudeLineWidth:2,altitudeLineWidth:2,spatialLineWidth:2,moveEllipseColor:[0,255,0,.5],moveEllipseOutline:!0,moveEllipseOutlineColor:[255,0,0,.5],moveEllipseOutlineWidth:1,spatialLineWidth:2,ellipseColor:[0,0,255,.5],ellipseOutline:!0,ellipseOutlineColor:[255,0,0,.5],ellipseOutlineWidth:1},this._setMoveLineStyle(void 0),this._setLineStyle(void 0),this._setMovePolygonStyle(void 0),this._setPolygonStyle(void 0),this._setMoveAltitudeLineStyle(void 0),this._setAltitudeLineStyle(void 0),this._setMoveEllipseStyle(void 0),this._setEllipseStyle(void 0),this._setSpatialLineStyle(void 0),e&&e.iconType)switch(e.iconType){case rn.IconType.Normal:this._sketchPointImage=this._iconNormal;break;case rn.IconType.Blue:this._sketchPointImage=this._iconBlue;break;case rn.IconType.Green:this._sketchPointImage=this._iconGreen;break;case rn.IconType.Violet:this._sketchPointImage=this._iconViolet;break;default:this._sketchPointImage=this._iconNormal}else this._sketchPointImage=this._iconNormal;this._defaultHeight=50}_arcToDegree(e){return e/Math.PI*180}_toColor(e,t,i,n){let r=new Cesium.Color(0,0,0,1);return"number"!=typeof e||"number"!=typeof t||"number"!=typeof i||"number"!=typeof n||e<0||e>255||t<0||t>255||i<0||i>255||n<0||n>1?r:new Cesium.Color(e/255,t/255,i/255,n)}_toColorFromArray(e){if(!e||void 0===e.length||0===e.length)return new Cesium.Color(1,1,1,1);let t=255,i=255,n=255,r=1;return 1===e.length?t=parseInt(e[0]):2===e.length?(t=parseInt(e[0]),i=parseInt(e[1])):3===e.length?(t=parseInt(e[0]),i=parseInt(e[1]),n=parseInt(e[2])):e.length>=4&&(t=parseInt(e[0]),i=parseInt(e[1]),n=parseInt(e[2]),r=parseFloat(e[3])),new Cesium.Color(t/255,i/255,n/255,r)}_updateScene(){this._viewer.scene.requestRender()}_getScreenClickPosition(e){let t,i=this._viewer.scene.camera.getPickRay(e),n=this._viewer.scene.globe.pick(i,this._viewer.scene);return Cesium.Ellipsoid.WGS84.cartesianToCartographic(n),Cesium.defined(n)&&(t={x:n.x,y:n.y,z:n.z}),t}_getScreenClickPositionAndHeight(e){var t=void 0,i=void 0,n=void 0,r=this._viewer.scene.camera.getPickRay(e),o=this._viewer.scene.globe.pick(r,this._viewer.scene),s=Cesium.Ellipsoid.WGS84.cartesianToCartographic(o);if(s=Cesium.Cartographic.fromCartesian(o),void 0===this._viewer.scene.pick(e)&&Cesium.defined(s))t=this._arcToDegree(s.longitude),i=this._arcToDegree(s.latitude),n=s.height;else{var a=this._viewer.scene.pickPosition(e);if(Cesium.defined(a)){s=Cesium.Cartographic.fromCartesian(a);Cesium.defined(s)&&(t=this._arcToDegree(s.longitude),i=this._arcToDegree(s.latitude),n=s.height)}}return{lng:t,lat:i,height:n}}_transfromFromScreenPoint(e){let t=this._getScreenClickPositionAndHeight(e);return null!=t.lng?{gLocation:t,sLocation:Cesium.Cartesian3.fromDegrees(t.lng,t.lat,t.height)}:{gLocation:void 0,sLocation:void 0}}_removeEntityByName(e){var t=this._entities;if(t&&t.values){for(var i=[],n=0;n<t.values.length;n++)t.values[n].name==e&&i.push(t.values[n]);for(n=0;n<i.length;n++)t.remove(i[n]);this._updateScene()}}_removeEntityByObject(e){Cesium.defined(e)&&this._entities.remove(e)}_createPoint(e,t){let i=new Cesium.Entity({name:this._sketchEntityName+"_Point",position:e,billboard:{image:this._sketchPointImage,horizontalOrigin:Cesium.HorizontalOrigin.center,verticalOrigin:Cesium.VerticalOrigin.bottom,scale:.5,pixelOffset:new Cesium.Cartesian2(0,-11),disableDepthTestDistance:Number.POSITIVE_INFINITY}});t&&(i.label={text:t,font:"12px sans-serif",fillColor:this._toColor(255,255,255,1),outlineColor:this._toColor(0,154,94,1),style:Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:1,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,pixelOffset:new Cesium.Cartesian2(0,-28),showBackground:!0,backgroundColor:this._toColor(0,0,0,.6),disableDepthTestDistance:Number.POSITIVE_INFINITY}),this._entities.add(i),this._pointEntitys.push(i),this._updateScene()}_removePointEntitys(){this._removeEntityByName(this._sketchEntityName+"_Point"),this._pointEntitys=[]}_callUpdaeEllipseCenterPosition(){let e=this;return function(){let t=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[0]),i=Cesium.Cartographic.fromCartesian(e._sketchTempPoints[1]);return e._sketchEllipseCenterPosition=Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(t.longitude),Cesium.Math.toDegrees(t.latitude),i.height),e._sketchEllipseCenterPosition}}_callUpdateEllipseMinorAxis(e){let t=this;return function(){if(void 0===e||void 0===e.length||e.length<2)t._sketchEllipseRadius=0;else{let i=Cesium.Cartographic.fromCartesian(e[0]),n=Cesium.Cartographic.fromCartesian(e[1]),r=new Cesium.EllipsoidGeodesic;r.setEndPoints(i,n),t._sketchEllipseRadius=r.surfaceDistance,t._sketchEllipseRadius<=0&&(t._sketchEllipseRadius=1)}return t._sketchEllipseRadius}}_callEllipseOutlineCoordinate(e){let t=this;return function(){let i=e[0],n=e[1];t._ellipseOutlineCoordinates=[];for(let e=5;e<360;){let r=t._rotatedPointByAngle(n,i,e);t._ellipseOutlineCoordinates.push(r),e+=5}return t._ellipseOutlineCoordinates.push(t._ellipseOutlineCoordinates[0]),t._ellipseOutlineCoordinates}}_rotatedPointByAngle(e,t,i){var n=Cesium.Transforms.eastNorthUpToFixedFrame(t),r=Cesium.Matrix4.inverse(n,new Cesium.Matrix4);Cesium.Matrix4.multiplyByPoint(r,t,new Cesium.Cartesian3);var o=Cesium.Matrix4.multiplyByPoint(r,e,new Cesium.Cartesian3),s=o.x*Math.cos(Cesium.Math.toRadians(i))+o.y*Math.sin(Cesium.Math.toRadians(i)),a=o.y*Math.cos(Cesium.Math.toRadians(i))-o.x*Math.sin(Cesium.Math.toRadians(i)),l=o.z;return Cesium.Matrix4.multiplyByPoint(n,new Cesium.Cartesian3(s,a,l),new Cesium.Cartesian3)}_callUpdateRectangleCoordinates(e){let t=this;return function(){let i=Cesium.Ellipsoid.WGS84.cartesianToCartographic(e[0]),n=Cesium.Ellipsoid.WGS84.cartesianToCartographic(e[1]),r=Cesium.Math.toDegrees(i.longitude),o=Cesium.Math.toDegrees(i.latitude),s=Cesium.Math.toDegrees(n.longitude),a=Cesium.Math.toDegrees(n.latitude);t._rectangleCoordinates=[0,0,1,1],r<s?(t._rectangleCoordinates[0]=r,t._rectangleCoordinates[2]=s):(t._rectangleCoordinates[0]=s,t._rectangleCoordinates[2]=r),o<a?(t._rectangleCoordinates[1]=o,t._rectangleCoordinates[3]=a):(t._rectangleCoordinates[1]=a,t._rectangleCoordinates[3]=o);let l=Cesium.Rectangle.fromDegrees(t._rectangleCoordinates[0],t._rectangleCoordinates[1],t._rectangleCoordinates[2],t._rectangleCoordinates[3]),u=t._calculateRectangleOutlineCoordinates(l);return t._rectangleOutlineCoordinates=u.cPoints,t._sketchOutputPoints=u.gPoints,l}}_calculateRectangleOutlineCoordinates(e){let t=Cesium.Rectangle.southeast(e),i=Cesium.Cartographic.toCartesian(t),n=Cesium.Rectangle.southwest(e),r=Cesium.Cartographic.toCartesian(n),o=Cesium.Rectangle.northeast(e),s=Cesium.Cartographic.toCartesian(o),a=Cesium.Rectangle.northwest(e),l=Cesium.Cartographic.toCartesian(a),u=[];return u.push({lng:Cesium.Math.toDegrees(n.longitude),lat:Cesium.Math.toDegrees(n.latitude),height:n.height}),u.push({lng:Cesium.Math.toDegrees(t.longitude),lat:Cesium.Math.toDegrees(t.latitude),height:t.height}),u.push({lng:Cesium.Math.toDegrees(o.longitude),lat:Cesium.Math.toDegrees(o.latitude),height:o.height}),u.push({lng:Cesium.Math.toDegrees(a.longitude),lat:Cesium.Math.toDegrees(a.latitude),height:a.height}),u.push({lng:Cesium.Math.toDegrees(n.longitude),lat:Cesium.Math.toDegrees(n.latitude),height:n.height}),{cPoints:[r,i,s,l,r],gPoints:u}}_callUpdateRectangleOutlineCoordinates(){let e=this;return function(){return e._rectangleOutlineCoordinates}}_materialTextImageProperty(e){this._canvasId="canvasJt";let t=document.getElementById(this._canvasId);null!=t&&document.body.removeChild(t),t=document.createElement("canvas"),t.id=this._canvasId,t.setAttribute("width","1024px"),t.setAttribute("height","256px"),document.body.appendChild(t);let i=t.getContext("2d");i.fillStyle=void 0===e.color?"rgba(255,0,0,1)":e.color,i.font="bold 240px 微软雅黑",i.textAlign="left",i.textBaseline="bottom",i.fillText(e.text,12,250,1e3);let n=new Cesium.ImageMaterialProperty({image:t,transparent:!0});return n._param={color:i.fillStyle,text:e.text},n}_materialColorProperty(e){let t="rgba(0,255,0,1)";void 0!==e&&void 0!==e.color&&(t=e.color);let i=new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString(t));return i._param={color:t},i}_materialPolylineArrowProperty(e){let t="rgba(0,255,0,1)";void 0!==e&&void 0!==e.color&&(t=e.color);let i=new Cesium.PolylineArrowMaterialProperty(Cesium.Color.fromCssColorString(t));return i._param={color:t},i}_materialPolylineGlowProperty(e){let t="rgba(0,255,0,1)";void 0!==e&&void 0!==e.color&&(t=e.color);let i=.25;void 0!==e&&void 0!==e.power&&"number"==typeof e.power&&(i=e.power);let n=new Cesium.PolylineGlowMaterialProperty({color:Cesium.Color.fromCssColorString(t),glowPower:i});return n._param={color:t,power:i},n}_materialPolylineOutlineProperty(e){let t="rgba(0,255,0,1)",i="rgba(255,255,255,1.0)",n=1.2;void 0!==e&&void 0!==e.color&&(t=e.color),void 0!==e&&void 0!==e.outlineColor&&(i=e.outlineColor),void 0!==e&&void 0!==e.outlineWidth&&"number"==typeof e.outlineWidth&&(n=e.outlineWidth);let r=new Cesium.PolylineOutlineMaterialProperty({color:Cesium.Color.fromCssColorString(t),outlineColor:Cesium.Color.fromCssColorString(i),outlineWidth:n});return r._param={color:t,outlineColor:i,outlineWidth:n},r}_setMoveLineStyle(e){let t=this,i=[255,255,255,1],n=3,r=!1,o=.2,s=[255,0,0,1],a=1;e&&e.color&&4===e.color.length&&(i=e.color),e&&e.outline&&"boolean"==typeof e.outline&&(r=e.outline),e&&e.outlineColor&&4===e.outlineColor.length&&(s=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(a=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(n=e.lineWidth),e&&e.power&&(o=e.power),this._tempLineMaterial=r?new Cesium.PolylineOutlineMaterialProperty({color:t._toColorFromArray(i),outlineColor:t._toColorFromArray(s),outlineWidth:a}):void 0===o?new Cesium.PolylineDashMaterialProperty({color:t._toColorFromArray(i)}):new Cesium.PolylineGlowMaterialProperty({color:t._toColorFromArray(i),glowPower:o}),this._param.moveLineWidth=n}_setLineStyle(e){let t=[255,255,255,1],i=2;e&&e.color&&4===e.color.length&&(t=e.color),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(i=e.lineWidth),this._lineMaterial=this._materialColorProperty({color:this._toColorFromArray(t).toCssColorString()}),this._param.lineWidth=i}_setSpatialLineStyle(e){let t=[255,255,0,1],i=2,n=[255,255,255,1],r=1;e&&e.color&&4===e.color.length&&(t=e.color),e&&e.outlineColor&&4===e.outlineColor.length&&(n=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(r=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(i=e.lineWidth),this._spatialLineMaterial=new Cesium.PolylineOutlineMaterialProperty({color:this._toColorFromArray(t),outlineColor:this._toColorFromArray(n),outlineWidth:r}),this._param.spatialLineWidth=i}_setMovePolygonStyle(e){let t=[255,0,0,.3];e&&e.color&&4===e.color.length&&(t=e.color),this._tempPolygonMaterial=new Cesium.ColorMaterialProperty(this._toColorFromArray(t))}_setPolygonStyle(e){let t=[0,0,255,.3];e&&e.color&&4===e.color.length&&(t=e.color),this._polygonMaterial=this._materialColorProperty({color:this._toColorFromArray(t).toCssColorString()})}_setMoveAltitudeLineStyle(e){let t=this,i=[255,255,255,1],n=2,r=!0,o=[255,255,0,1],s=1;e&&e.color&&4===e.color.length&&(i=e.color),e&&e.outline&&"boolean"==typeof e.outline&&(r=e.outline),e&&e.outlineColor&&4===e.outlineColor.length&&(o=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(s=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(n=e.lineWidth),this._tempAlititudeLineMaterial=r?new Cesium.PolylineOutlineMaterialProperty({color:t._toColorFromArray(i),outlineColor:t._toColorFromArray(o),outlineWidth:s}):new Cesium.PolylineDashMaterialProperty({color:t._toColorFromArray(i)}),this._param.moveAltitudeLineWidth=n}_setAltitudeLineStyle(e){let t=[255,255,255,1],i=2,n=[0,0,255,1],r=1;e&&e.color&&4===e.color.length&&(t=e.color),e&&e.outlineColor&&4===e.outlineColor.length&&(n=e.outlineColor),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(r=e.outlineWidth),e&&e.lineWidth&&"number"==typeof e.lineWidth&&(i=e.lineWidth),this._altitudeLineMaterial=new Cesium.PolylineOutlineMaterialProperty({color:this._toColorFromArray(t),outlineColor:this._toColorFromArray(n),outlineWidth:r}),this._param.altitudeLineWidth=i}_setMoveEllipseStyle(e){e&&e.color&&4===e.color.length&&(this._param.moveEllipseColor=e.color),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(this._param.moveEllipseOutlineWidth=e.outlineWidth),e&&e.outline&&"boolean"==typeof e.outline&&(this._param.moveEllipseOutline=e.outline),e&&e.outlineColor&&4===e.outlineColor.length&&(this._param.moveEllipseOutlineColor=e.outlineColor)}_setEllipseStyle(e){e&&e.color&&4===e.color.length&&(this._param.ellipseColor=e.color),e&&e.outlineWidth&&"number"==typeof e.outlineWidth&&(this._param.ellipseOutlineWidth=e.outlineWidth),e&&e.outline&&"boolean"==typeof e.outline&&(this._param.ellipseOutline=e.outline),e&&e.outlineColor&&4===e.outlineColor.length&&(this._param.ellipseOutlineColor=e.outlineColor)}_clear(e){null!=e&&!0===e&&(this._removeEntityByName(this._sketchEntityName),this._removePointEntitys()),this._sketchTempPoints=[],this._sketchPoints=[],this._sketchOutputPoints=[],this._sketchWallHeights=[],this._drawEntity=void 0}}Object.assign(rn.prototype,{setMoveLineStyle:function(e){this._setMoveLineStyle(e)},setLineStyle:function(e){this._setLineStyle(e)},setSpatialLineStyle:function(){this._setSpatialLineStyle(options)},setMovePolygonStyle:function(e){this._setMovePolygonStyle(e)},setPolygonStyle:function(e){this._setPolygonStyle(e)},setMoveAltitudeLineStyle:function(e){this._setMoveAltitudeLineStyle(e)},setAltitudeLineStyle:function(e){this._setAltitudeLineStyle(e)},setMoveEllipseStyle:function(e){this._setMoveEllipseStyle(e)},setEllipseStyle:function(e){this._setEllipseStyle(e)},setLabel:function(e){e||(e={lineLabel:void 0,polygonLabel:void 0}),e.lineLabel&&(this._lineLabel=e.lineLabel),e.polygonLabel&&(this._lineLabel=e.polygonLabel)}}),Object.assign(rn.prototype,{_registerLeftClickEvent:function(e,t){let i=this;e&&e.setInputAction((function(e){i._lock=!0,clearTimeout(i._timer),i._timer=setTimeout((function(){t&&t(e),i._lock=!1}),200)}),Cesium.ScreenSpaceEventType.LEFT_CLICK)},_registerLeftDoubleClickEvent:function(e,t){let i=this;e&&e.setInputAction((function(e){clearTimeout(i._timer),i._lock=!1,t&&t(e)}),Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)},_registerMouseMoveEvent:function(e,t){let i=this;e&&e.setInputAction((function(e){void 0!==i._lock&&!1!==i._lock||t&&t(e)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)},_registerRightClickEvent:function(e,t){e&&e.setInputAction((function(e){t&&t(e)}),Cesium.ScreenSpaceEventType.RIGHT_CLICK)},_registerLeftDownEvent:function(e,t){e&&e.setInputAction((function(e){t&&t(e)}),Cesium.ScreenSpaceEventType.LEFT_DOWN)},_registerLeftUpEvent:function(e,t){e&&e.setInputAction((function(e){t&&t(e)}),Cesium.ScreenSpaceEventType.LEFT_UP)},_clearEvent:function(e){e&&(e.destroy(),e=null)}}),Object.assign(rn.prototype,{_createPolyline:function(e){let t=this,i=t._param.moveLineWidth,n=this._materialColorProperty({color:"rgba(255,255,0,0.7)"});void 0!==e&&e===rn.PolylineType.ArrowsPolyline?(n=this._materialPolylineArrowProperty({color:"rgba(255,255,0,0.7)"}),i=8):void 0!==e&&e===rn.PolylineType.GrowPolyline?(n=this._materialPolylineGlowProperty({color:"rgba(255,255,0,0.7)",power:.75}),i=8):void 0!==e&&e===rn.PolylineType.OutlinePolyline?(n=this._materialPolylineOutlineProperty({color:"rgba(0,255,0,0.7)",outlineColor:"rgba(255,255,0,1.0)",outlineWidth:1}),i=4):void 0!==e&&e===rn.PolylineType.DynamicPolyline&&(n=new tn({viewer:t._viewer,trailImage:"/jt3dSDK/imgs/polylinematerial/image.png",duration:1500,color:Cesium.Color.fromCssColorString("rgba(0, 255, 0, 0.7)"),param:{direction:"horizontal",count:1,order:"-"}}),i=2);let r=new Cesium.Entity({name:t._sketchEntityName,polyline:{show:!0,positions:new Cesium.CallbackProperty((function(){return t._sketchTempPoints}),!1),material:n,width:i,clampToGround:!0}});this._drawEntity=this._entities.add(r)},_updatePolyline:function(e){this._drawEntity.polyline.positions=this._sketchPoints,this._drawEntity.setEntityType(rn.DrawType.Polyline),null!=e&&!0===e&&(this._removePointEntitys(),this._setEntityIsEdit(this._drawEntity))},_createSpatialPolyline:function(){let e=this,t=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:new Cesium.CallbackProperty((function(){return e._sketchTempPoints}),!1),material:e._tempLineMaterial,width:e._param.moveLineWidth,clampToGround:!1}});this._drawEntity=this._entities.add(t)},_updateSpatialPolyline:function(e){this._drawEntity.polyline.positions=this._sketchPoints,this._drawEntity.polyline.material=this._lineMaterial,this._drawEntity.polyline.width=this._param.lineWidth,this._drawEntity.setEntityType(rn.DrawType.SpatialLine),null!=e&&!0===e&&(this._removePointEntitys(),this._setEntityIsEdit(this._drawEntity))},_createPolygon:function(e){let t=this,i=new Cesium.Entity({name:t._sketchEntityName,polygon:{show:!0,hierarchy:new Cesium.CallbackProperty((function(){return{positions:t._sketchTempPoints}}),!1),material:t._tempPolygonMaterial,classificationType:Cesium.ClassificationType.BOTH},polyline:{show:!0,positions:new Cesium.CallbackProperty((function(){return t._sketchTempPoints}),!1),material:t._tempLineMaterial,width:t._param.moveLineWidth,clampToGround:!0}});this._drawEntity=this._entities.add(i),void 0===e||e===rn.PolygonType.NormalPolygon?this._drawEntity.setEntityType(rn.DrawType.Polygon):null!=e&&e===rn.PolygonType.HousePolygon&&this._drawEntity.setEntityType(rn.DrawType.House)},_updatePolygon:function(e){let t=this,i=this._drawEntity.getEntityType();if(i===rn.DrawType.Polygon)this._drawEntity.polygon.hierarchy={positions:t._sketchPoints},this._drawEntity.polygon.material=this._polygonMaterial,this._drawEntity.polyline.positions=this._sketchPoints,this._drawEntity.polyline.material=this._lineMaterial,this._drawEntity.polyline.width=this._param.lineWidth;else if(i===rn.DrawType.House){this._removeEntityByObject(this._drawEntity);let e=parseFloat(this._sketchOutputPoints[0].height),n=e+30,r=new Cesium.Entity({name:t._sketchEntityName,polygon:{show:!0,hierarchy:{positions:t._sketchPoints},extrudedHeight:n,material:t._polygonMaterial}});this._drawEntity=this._entities.add(r),this._drawEntity.setEntityType(i),this._drawEntity.setParams({bottomHeight:e,appendHeight:30})}null!=e&&!0===e&&(this._removePointEntitys(),this._setEntityIsEdit(this._drawEntity))},_createRectangle:function(){let e=this,t=new Cesium.Entity({name:e._sketchEntityName,polyline:{show:!0,positions:new Cesium.CallbackProperty(e._callUpdateRectangleOutlineCoordinates(),!1),material:e._tempLineMaterial,width:e._param.moveLineWidth,clampToGround:!0},rectangle:{show:!0,coordinates:new Cesium.CallbackProperty(e._callUpdateRectangleCoordinates(e._sketchTempPoints),!1),material:e._tempPolygonMaterial,classificationType:Cesium.ClassificationType.BOTH}});this._drawEntity=this._entities.add(t)},_updateRectangle(e){this._drawEntity.polyline.positions=this._rectangleOutlineCoordinates,this._drawEntity.polyline.material=this._lineMaterial,this._drawEntity.polyline.width=this._param.lineWidth;let t=this._rectangleCoordinates;this._drawEntity.rectangle.coordinates=Cesium.Rectangle.fromDegrees(t[0],t[1],t[2],t[3]),this._drawEntity.rectangle.material=this._polygonMaterial,this._drawEntity.setEntityType(rn.DrawType.Rectangle),null!=e&&!0===e&&this._setEntityIsEdit(this._drawEntity)},_createCircle:function(e,t){let i=this,n=this._materialColorProperty({color:"rgba(0,255,0,0.6)"});null!=t&&t===rn.CircleType.DynamicCircle&&(n=new nn({viewer:i._viewer,duration:2e3,color:i._toColor(0,255,0,.6),count:1})),this._sketchEllipseCenterPosition=e.clone();let r=new Cesium.Entity({name:i._sketchEntityName,position:e,ellipse:{show:!0,semiMinorAxis:new Cesium.CallbackProperty(i._callUpdateEllipseMinorAxis(i._sketchTempPoints),!1),semiMajorAxis:new Cesium.CallbackProperty(i._callUpdateEllipseMinorAxis(i._sketchTempPoints),!1),material:n,classificationType:Cesium.ClassificationType.BOTH}});void 0!==t&&t!==rn.CircleType.ColorCircle||(r.polyline={show:!0,positions:new Cesium.CallbackProperty(i._callEllipseOutlineCoordinate(i._sketchTempPoints),!1),material:i._tempLineMaterial,width:i._param.moveLineWidth,clampToGround:!0}),this._drawEntity=this._entities.add(r),void 0===t||t===rn.CircleType.ColorCircle?this._drawEntity.setEntityType(rn.DrawType.Circle):null!=t&&t===rn.CircleType.DynamicCircle&&this._drawEntity.setEntityType(rn.DrawType.DynamicCircle)},_updateCircle(e){this._drawEntity.position=this._sketchEllipseCenterPosition,null!=this._drawEntity.polyline&&(this._drawEntity.polyline.positions=this._ellipseOutlineCoordinates,this._drawEntity.polyline.material=this._lineMaterial,this._drawEntity.polyline.width=this._param.lineWidth),this._drawEntity.ellipse.semiMajorAxis=this._sketchEllipseRadius,this._drawEntity.ellipse.semiMinorAxis=this._sketchEllipseRadius,null!=e&&!0===e&&this._setEntityIsEdit(this._drawEntity)},_createWall:function(e){let t=this,i=this._materialColorProperty({color:"rgba(0,255,0,0.75)"});void 0!==e&&e===rn.WallType.TextWall?i=this._materialTextImageProperty({color:"rgba(255,255,0,0.75)",text:"金田产业集团"}):void 0!==e&&e===rn.WallType.DynamicWall&&(i=new tn({viewer:t._viewer,trailImage:"/jt3dSDK/imgs/polylinematerial/image.png",duration:1500,color:t._toColor(0,255,0,.6),param:{count:1,direction:"horizontalA",order:"-"}}));let n=new Cesium.Entity({name:t._sketchEntityName,wall:{show:!0,positions:new Cesium.CallbackProperty((function(){return t._sketchTempPoints}),!1),minimumHeights:new Cesium.CallbackProperty((function(){return t._sketchWallHeights}),!1),maximumHeights:new Cesium.CallbackProperty((function(){t._sketchWallMaxHeights=[];for(let e=0;e<t._sketchWallHeights.length;e++)t._sketchWallMaxHeights.push(t._sketchWallHeights[e]+t._defaultHeight);return t._sketchWallMaxHeights}),!1),material:i}});this._drawEntity=this._entities.add(n),void 0===e||e===rn.WallType.ColorWall?this._drawEntity.setEntityType(rn.DrawType.NormalWall):void 0!==e&&e===rn.WallType.DynamicWall?this._drawEntity.setEntityType(rn.DrawType.DynamicWall):void 0!==e&&e===rn.WallType.TextWall&&this._drawEntity.setEntityType(rn.DrawType.TextWall)},_updateWall:function(e){let t=this._sketchWallHeights.length,i=this._sketchWallMaxHeights.length,n=this._sketchPoints.length;t===i&&t-n==1?(this._sketchWallHeights.pop(),this._sketchWallMaxHeights.pop(),this._drawEntity.wall.positions=this._sketchPoints,this._drawEntity.wall.minimumHeights=this._sketchWallHeights,this._drawEntity.wall.maximumHeights=this._sketchWallMaxHeights,null!=e&&!0===e&&(this._removePointEntitys(),this._setEntityIsEdit(this._drawEntity))):console.log(t,i,n)},_createVideoWall:function(){let e=this,t=new Cesium.Entity({name:e._sketchEntityName,position:e._sketchOutputPoints[0],wall:{show:!0,positions:new Cesium.CallbackProperty((function(){let t=e._sketchOutputPoints[0],i=e._sketchOutputPoints[1];return e._wallPositions=[],e._wallPositions.push(Cesium.Cartesian3.fromDegrees(t.lng,t.lat,t.height)),e._wallPositions.push(Cesium.Cartesian3.fromDegrees(i.lng,i.lat,t.height)),e._wallPositions}),!1),maximumHeights:new Cesium.CallbackProperty((function(){e._sketchWallHeights=[];let t=e._sketchOutputPoints[0];return e._sketchWallHeights.push(t.height),e._sketchWallHeights.push(t.height),e._sketchWallHeights}),!1),minimumHeights:new Cesium.CallbackProperty((function(){e._sketchWallMaxHeights=[];let t=e._sketchOutputPoints[1];return e._sketchWallMaxHeights.push(t.height),e._sketchWallMaxHeights.push(t.height),e._sketchWallMaxHeights}),!1),material:e._toColor(255,0,0,1),outline:!0,outlineColor:e._toColor(0,255,0,1),outlineWidth:1e3}});e._drawEntity=e._entities.add(t)},_updateVideoWall:function(e){let t=document.getElementById("wallVideo");null!==t&&document.body.removeChild(t),t=document.createElement("video"),t.id="wallVideo",t.setAttribute("width","1024px"),t.setAttribute("height","256px"),t.setAttribute("controls","controls"),t.setAttribute("src","../public/video/jt.mp4"),t.play(),document.body.appendChild(t),this._drawEntity.wall.positions=this._wallPositions,this._drawEntity.wall.minimumHeights=this._sketchWallHeights,this._drawEntity.wall.maximumHeights=this._sketchWallMaxHeights,this._drawEntity.wall.material=t,this._removePointEntitys(),this._drawEntity.setEntityType(rn.DrawType.VideoWall),this._drawEntity.setParams({moveX:0,moveY:0,moveZ:0}),null!=e&&!0===e&&this._setEntityIsEdit(this._drawEntity)}}),Object.assign(rn.prototype,{_sketchDrawPoint(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){let r=i._transfromFromScreenPoint(n.position);if(!Cesium.defined(r.sLocation))return;let o=i._viewer.scene;if(o.mode!==Cesium.SceneMode.MORPHING){var s=o.pick(n.position);if(o.pickPositionSupported&&Cesium.defined(s)){var a=o.pickPosition(n.position);if(Cesium.defined(a)){var l=Cesium.Cartographic.fromCartesian(a),u=Cesium.Math.toDegrees(l.longitude),c=Cesium.Math.toDegrees(l.latitude),h=l.height;i._sketchOutputPoints.push({lng:u,lat:c,height:h})}i._createPoint(a,"点"),i._sketchPoints.push(a.clone()),i._sketchPoints.length>=2&&(i._createVideoWall(),i._clearEvent(e))}}t.onComplete&&t.onComplete(r.sLocation,r.gLocation)}))},_sketchDrawMultiplePoint(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),i._sketchPoints.push(n.sLocation),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(n.sLocation,n.gLocation))})),this._registerRightClickEvent(e,(function(e){i._sketchPoints.length>0&&(i._sketchPoints.pop(),i._sketchOutputPoints.pop(),t.onUndo&&t.onUndo())})),this._registerLeftDoubleClickEvent(e,(function(e){i._clearEvent(),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints)}))},_sketchDrawPolyline(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),0===i._sketchTempPoints.length&&(i._createPolyline(t.polylineType),i._sketchTempPoints.push(n.sLocation.clone())),i._sketchTempPoints.push(n.sLocation),i._sketchPoints.push(n.sLocation.clone()),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(i._sketchPoints,i._sketchOutputPoints))})),this._registerMouseMoveEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(n.sLocation)&&i._sketchTempPoints.length>1&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n.sLocation),t.onMoving&&t.onMoving(n.sLocation))})),this._registerRightClickEvent(e,(function(e){if(i._sketchTempPoints.length>2){if(i._sketchPoints.pop(),i._sketchTempPoints.splice(i._sketchTempPoints.length-2,1),i._isDrawPoint){let e=i._pointEntitys[i._pointEntitys.length-1];i._entities.remove(e),i._pointEntitys.pop()}t.onUndo&&t.onUndo()}})),this._registerLeftDoubleClickEvent(e,(function(n){i._sketchPoints.length<2?t.onError&&t.onError("点数少于两个,禁止结束绘制!"):(i._updatePolyline(t.isEdit),i._isRetainDrawPoint||i._removePointEntitys(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints))}))},_sketchDrawSpatialPolyline(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),0===i._sketchTempPoints.length&&(i._createSpatialPolyline(),i._sketchTempPoints.push(n.sLocation.clone())),i._sketchTempPoints.push(n.sLocation),i._sketchPoints.push(n.sLocation.clone()),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(i._sketchPoints,i._sketchOutputPoints))})),this._registerMouseMoveEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(n.sLocation)&&i._sketchTempPoints.length>1&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n.sLocation),t.onMoving&&t.onMoving(n.sLocation))})),this._registerLeftDoubleClickEvent(e,(function(n){i._sketchPoints.length<2?t.onError&&t.onError("绘制点少于2个,禁止结束绘制!"):(i._updateSpatialPolyline(t.isEdit),i._removePointEntitys(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints))})),this._registerRightClickEvent(e,(function(e){i._sketchTempPoints.length>2&&(i._sketchPoints.pop(),i._sketchTempPoints.splice(i._sketchTempPoints.length-2,1),t.onUndo&&t.onUndo())}))},_sketchDrawPolygon(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),0===i._sketchTempPoints.length&&(i._createPolygon(t.polygonType),i._sketchTempPoints.push(n.sLocation.clone())),i._sketchTempPoints.push(n.sLocation),i._sketchPoints.push(n.sLocation.clone()),i._sketchOutputPoints.push(n.gLocation),t.onAdded&&t.onAdded(i._sketchPoints,i._sketchOutputPoints))})),this._registerMouseMoveEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(n.sLocation)&&i._sketchTempPoints.length>1&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(n.sLocation),t.onMoving&&t.onMoving(n.sLocation))})),this._registerRightClickEvent(e,(function(e){if(i._sketchTempPoints.length>2){if(i._sketchPoints.pop(),i._sketchTempPoints.splice(i._sketchTempPoints.length-2,1),i._isDrawPoint){let e=i._pointEntitys[i._pointEntitys.length-1];i._entities.remove(e),i._pointEntitys.pop()}t.onUndo&&t.onUndo()}})),this._registerLeftDoubleClickEvent(e,(function(n){i._sketchPoints.length<3?t.onError&&t.onError("点数少于3个,禁止结束绘制!"):(i._updatePolygon(t.isEdit),i._isRetainDrawPoint||i._removePointEntitys(),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchPoints,i._sketchOutputPoints))}))},_sketchDrawCircle:function(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){if(0===i._sketchTempPoints.length){let e=i._transfromFromScreenPoint(n.position);if(!Cesium.defined(e.sLocation))return;i._isDrawPoint&&i._createPoint(e.sLocation,"起点"),i._sketchTempPoints.push(e.sLocation.clone()),i._sketchTempPoints.push(e.sLocation),i._sketchPoints.push(e.sLocation.clone()),i._sketchOutputPoints.push(e.gLocation),i._createCircle(e.sLocation,t.circleType),t.onAdded&&t.onAdded(e.sLocation)}else i._removePointEntitys(),i._removeEntityByObject(i._sketchTempCircle),i._updateCircle(t.isEdit),i._clearEvent(e),t.onComplete&&t.onComplete(i._sketchOutputPoints[0],i._sketchEllipseRadius)})),this._registerMouseMoveEvent(e,(function(e){if(!(i._sketchTempPoints.length<=0)){var t=i._viewer.scene.pickPosition(e.endPosition);null!=t&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(t))}}))},_sketchDrawRectangle:function(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){if(0===i._sketchTempPoints.length){let e=i._transfromFromScreenPoint(n.position);if(!Cesium.defined(e.sLocation))return;i._isDrawPoint&&i._createPoint(e.sLocation,"起点"),i._sketchTempPoints.push(e.sLocation),i._sketchTempPoints.push(e.sLocation),i._sketchPoints.push(e.gLocation),i._createRectangle(),t.onAdded&&t.onAdded(e.sLocation)}else i._removePointEntitys(),i._removeEntityByObject(i._sketchTempRectangle),i._updateRectangle(t.isEdit),e.destroy(),e=null,t.onComplete&&t.onComplete(i._sketchOutputPoints)})),this._registerMouseMoveEvent(e,(function(e){if(i._sketchTempPoints.length<1)return;let t=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(t.sLocation)&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(t.sLocation))}))},_sketchDrawWall:function(e,t){let i=this;this._registerLeftClickEvent(e,(function(e){let n=i._transfromFromScreenPoint(e.position);Cesium.defined(n.sLocation)&&(i._isDrawPoint&&i._createPoint(n.sLocation,i._lineLabel),0===i._sketchTempPoints.length&&(i._createWall(t.wallType),i._sketchTempPoints.push(n.sLocation.clone()),i._sketchWallHeights.push(n.gLocation.height)),i._sketchTempPoints.push(n.sLocation),i._sketchWallHeights.push(n.gLocation.height),i._sketchPoints.push(n.sLocation.clone()))})),this._registerMouseMoveEvent(e,(function(e){let t=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(t.sLocation)&&i._sketchTempPoints.length>1&&(i._sketchTempPoints.pop(),i._sketchTempPoints.push(t.sLocation),i._sketchWallHeights.pop(),i._sketchWallHeights.push(t.gLocation.height))})),this._registerRightClickEvent(e,(function(e){if(i._sketchTempPoints.length>2&&(i._sketchPoints.pop(),i._sketchTempPoints.splice(i._sketchTempPoints.length-2,1),i._sketchWallHeights.splice(i._sketchWallHeights.length-2,1),i._isDrawPoint)){let e=i._pointEntitys[i._pointEntitys.length-1];i._entities.remove(e),i._pointEntitys.pop()}})),this._registerLeftDoubleClickEvent(e,(function(n){i._sketchPoints.length<2?t.onError&&t.onError("点数少于两个,禁止结束绘制!"):(i._updateWall(t.isEdit),i._isRetainDrawPoint||i._removePointEntitys(),i._clearEvent(e))}))},_sketchDrawVideoWall:function(e,t){let i=this;this._registerLeftClickEvent(e,(function(n){let r=i._transfromFromScreenPoint(n.position);Cesium.defined(r.sLocation)&&(i._isDrawPoint&&i._createPoint(r.sLocation,i._lineLabel),0===i._sketchOutputPoints.length?(i._sketchOutputPoints.push(r.gLocation),i._sketchOutputPoints.push(r.gLocation),i._createVideoWall()):(i._updateVideoWall(t.isEdit),i._clearEvent(e)))})),this._registerMouseMoveEvent(e,(function(e){let t=i._transfromFromScreenPoint(e.endPosition);Cesium.defined(t.sLocation)&&i._sketchOutputPoints.length>1&&(i._sketchOutputPoints.pop(),i._sketchOutputPoints.push(t.gLocation))}))},draw:function(e,t){let i=this;switch(this._clear(),i._drawEventHandler=new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas),e){case rn.DrawType.Point:i._sketchDrawPoint(i._drawEventHandler,t);break;case rn.DrawType.Polyline:t.polylineType=rn.PolylineType.NormalPolyline,i._sketchDrawPolyline(i._drawEventHandler,t);break;case rn.DrawType.ArrowPolyline:t.polylineType=rn.PolylineType.ArrowsPolyline,i._sketchDrawPolyline(i._drawEventHandler,t);break;case rn.DrawType.DynamicPolyline:t.polylineType=rn.PolylineType.DynamicPolyline,i._sketchDrawPolyline(i._drawEventHandler,t);break;case rn.DrawType.GrowPolyline:t.polylineType=rn.PolylineType.GrowPolyline,i._sketchDrawPolyline(i._drawEventHandler,t);break;case rn.DrawType.OultliePolyline:t.polylineType=rn.PolylineType.OutlinePolyline,i._sketchDrawPolyline(i._drawEventHandler,t);break;case rn.DrawType.Polygon:t.polygonType=rn.PolygonType.NormalPolygon,i._sketchDrawPolygon(i._drawEventHandler,t);break;case rn.DrawType.SpatialLine:i._sketchDrawSpatialPolyline(i._drawEventHandler,t);break;case rn.DrawType.Circle:t.circleType=rn.CircleType.ColorCircle,i._sketchDrawCircle(i._drawEventHandler,t);break;case rn.DrawType.Rectangle:i._sketchDrawRectangle(i._drawEventHandler,t);break;case rn.DrawType.NormalWall:t.wallType=rn.WallType.ColorWall,i._sketchDrawWall(i._drawEventHandler,t);break;case rn.DrawType.DynamicWall:t.wallType=rn.WallType.DynamicWall,i._sketchDrawWall(i._drawEventHandler,t);break;case rn.DrawType.TextWall:t.wallType=rn.WallType.TextWall,i._sketchDrawWall(i._drawEventHandler,t);break;case rn.DrawType.DynamicCircle:t.circleType=rn.CircleType.DynamicCircle,i._sketchDrawCircle(i._drawEventHandler,t);break;case rn.DrawType.House:t.polygonType=rn.PolygonType.HousePolygon,i._sketchDrawPolygon(i._drawEventHandler,t);break;case rn.DrawType.VideoWall:i._sketchDrawVideoWall(i._drawEventHandler,t)}},Clear:function(){this._clear(!0),this._unActivateEdit(),this._removeCoorinateAxis()},sketchInit:function(){this._clear(!1)}}),Object.assign(rn.prototype,{_tooltipInit:function(e,t){this._tooltipId="tooltipSketchmodel";let i=document.getElementById(this._tooltipId);if(null===i){i=document.createElement("div"),i.id=this._tooltipId,document.body.appendChild(i);let e="";e+="top: 30px;",e+="left: 30px;",e+="position: absolute;",e+="display: flex;",e+="align-items: center;",e+="width: 12x0px;",e+="height: auto;",e+="background-color: rgba(0, 0, 0, 0.65);",e+="border-radius: 5px;",e+="color: rgb(255, 255, 255);",e+="font-size: 12px;",e+="font-family: 'Alimama_ShuHeiTi_Bold';",e+="padding: 8px;",e+="border:solid 1px rgb(255,0,0);",i.setAttribute("style",e)}null!=e&&(i.innerHTML=e),void 0===t?document.onmousemove=function(e){i.style.left=e.clientX+10+"px",i.style.top=e.clientY-i.offsetHeight/2+"px"}:(i.style.left=t.x+10+"px",i.style.top=t.y-i.offsetHeight/2+"px")},_tooltipRemove:function(){let e=document.getElementById(this._tooltipId);null!=e&&document.body.removeChild(e)},_tooltipSetText:function(e,t){let i=document.getElementById(this._tooltipId);null!=i&&(null!=e&&(i.innerHTML=e),null!=t&&(i.style.left=t.x+10+"px",i.style.top=t.y-i.offsetHeight/2+"px"))},_setMousePointerStyle:function(){document.querySelector("body").style.cursor="crosshair"},_setMouseDefaultStyle:function(){document.querySelector("body").style.cursor="default"}}),Object.assign(rn.prototype,{_createSingleCoordinateAxisArrow(e,t,i){let n=new Cesium.Entity({id:i,name:this._coordinateAxisEntityName,position:e[0],polyline:{positions:e,width:10,material:this._materialPolylineArrowProperty({color:t})}});return n.setEditType({type:rn.EditPointType.CoordinateAxis}),this._entities.add(n)},_getTranslatePostion:function(e,t){let i=Cesium.Transforms.eastNorthUpToFixedFrame(e),n=new Cesium.Matrix4;Cesium.Matrix4.setTranslation(Cesium.Matrix4.IDENTITY,t,n);let r=Cesium.Matrix4.multiply(i,n,i),o=new Cesium.Cartesian3(0,0,0);return Cesium.Matrix4.getTranslation(r,o),o},_createCoordinateAxis:function(e){this._removeCoorinateAxis();let t=this;this._coordinateAxisEntityId_x="coordinateAxisId_x",this._coordinateAxisEntityId_y="coordinateAxisId_y",this._coordinateAxisEntityId_z="coordinateAxisId_z",this._coordinateAxisEntityName="coordinateAxisEntity";let i=new Cesium.Cartesian3(150,0,0),n=this._getTranslatePostion(e,i);const r=[e,n];this._coordinateEntity_x=this._createSingleCoordinateAxisArrow(r,"rgba(0,255,0,1.0)",this._coordinateAxisEntityId_x),this._coordinateAxisBindEntity(this._coordinateEntity_x),i=new Cesium.Cartesian3(0,150,0),n=this._getTranslatePostion(e,i);const o=[e,n];this._coordinateEntity_y=this._createSingleCoordinateAxisArrow(o,"rgba(0,0,255,1.0)",this._coordinateAxisEntityId_y),this._coordinateAxisBindEntity(this._coordinateEntity_y),i=new Cesium.Cartesian3(0,0,150),n=this._getTranslatePostion(e,i);const s=[e,n];this._coordinateEntity_z=this._createSingleCoordinateAxisArrow(s,"rgba(255,0,0,1.0)",this._coordinateAxisEntityId_z),this._coordinateAxisBindEntity(this._coordinateEntity_z),this._eventCoorinateAxis=new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas),this._registerLeftDownEvent(this._eventCoorinateAxis,(function(e){t._coorinateAxisMouseDown(e)})),this._registerMouseMoveEvent(this._eventCoorinateAxis,(function(e){t._coorinateAxisMouseMove(e)})),this._registerLeftUpEvent(this._eventCoorinateAxis,(function(e){t._coorinateAxisMouseUp(e)})),this._registerRightClickEvent(this._eventCoorinateAxis,(function(e){t._removeCoorinateAxis()}))},_coordinateAxisBindEntity:function(e){if(void 0===this._editEntity)return;let t=this._editEntity.getEntityType();void 0!==t&&t===rn.DrawType.VideoWall&&e.bindEntity(this._editEntity)},_coorinateAxisMouseDown:function(e){let t=this,i=this._viewer.scene.pick(e.position);if(console.log("===Feature>>>",i),void 0!==i&&null!=i.id&&i.id instanceof Cesium.Entity){if(this._viewer.scene.screenSpaceCameraController.enableRotate=!1,i.id.getEditType().type!==rn.EditPointType.CoordinateAxis)return;this._editCoorinateAxis=i.id,this._editCoorinateAxis.polyline.width=15,this._coordinateAxisMoveStartPosition=this._viewer.scene.camera.pickEllipsoid(e.position,this._viewer.scene.globe.ellipsoid),this._coordinateAxisMoveStartScreen=e.position,this._coorinateAxisPosition=this._editCoorinateAxis.position._value,this._coordinateEntity_x.polyline.positions=new Cesium.CallbackProperty((function(){let e=new Cesium.Cartesian3(150,0,0),i=t._getTranslatePostion(t._coorinateAxisPosition,e);return[t._coorinateAxisPosition,i]}),!1),this._coordinateEntity_y.polyline.positions=new Cesium.CallbackProperty((function(){let e=new Cesium.Cartesian3(0,150,0),i=t._getTranslatePostion(t._coorinateAxisPosition,e);return[t._coorinateAxisPosition,i]}),!1),this._coordinateEntity_z.polyline.positions=new Cesium.CallbackProperty((function(){let e=new Cesium.Cartesian3(0,0,150),i=t._getTranslatePostion(t._coorinateAxisPosition,e);return[t._coorinateAxisPosition,i]}),!1),this._coordinateAxisActivateEditEntity(this._editCoorinateAxis)}},_coorinateAxisMouseMove:function(e){if(!Cesium.defined(this._editCoorinateAxis))return;let t=this._viewer.scene.camera.pickEllipsoid(e.endPosition,this._viewer.scene.globe.ellipsoid);if(!t)return;let i=this._cartesian3ToGeo(this._coordinateAxisMoveStartPosition),n=this._cartesian3ToGeo(t),r=this._editCoorinateAxis.id,o=this._editCoorinateAxis.position._value,s=this._cartesian3ToGeo(o),a=0;if(r===this._coordinateAxisEntityId_x){let e=i.longitude-n.longitude;s.longitude=s.longitude-e}else if(r===this._coordinateAxisEntityId_y){let e=i.latitude-n.latitude;s.latitude=s.latitude-e}else r===this._coordinateAxisEntityId_z&&(a=e.endPosition.y-this._coordinateAxisMoveStartScreen.y,a*=.5,s.height=s.height-a);this._coorinateAxisPosition=Cesium.Cartesian3.fromDegrees(s.longitude,s.latitude,s.height),this._moveEditEntityByCoordinateAxis(o,this._coorinateAxisPosition,a)},_coorinateAxisMouseUp:function(e){if(this._viewer.scene.screenSpaceCameraController.enableRotate=!0,void 0!==this._editCoorinateAxis){this._editCoorinateAxis.polyline.width=10;let e=new Cesium.Cartesian3(150,0,0),t=this._getTranslatePostion(this._coorinateAxisPosition,e);this._coordinateEntity_x.polyline.positions=[this._coorinateAxisPosition,t],e=new Cesium.Cartesian3(0,150,0),t=this._getTranslatePostion(this._coorinateAxisPosition,e),this._coordinateEntity_y.polyline.positions=[this._coorinateAxisPosition,t],e=new Cesium.Cartesian3(0,0,150),t=this._getTranslatePostion(this._coorinateAxisPosition,e),this._coordinateEntity_z.polyline.positions=[this._coorinateAxisPosition,t],this._coordinateEntity_x.position=this._coorinateAxisPosition,this._coordinateEntity_y.position=this._coorinateAxisPosition,this._coordinateEntity_z.position=this._coorinateAxisPosition,this._coordinateAxisUpdateEditEntity(this._editCoorinateAxis),this._editCoorinateAxis=void 0}},_moveEditEntityByCoordinateAxis:function(e,t,i){let n=Cesium.Cartesian3.subtract(t,e,new Cesium.Cartesian3);for(let r=0;r<this._moveInitPositions.length;r++){let e=Cesium.Cartesian3.add(this._moveInitPositions[r],n,new Cesium.Cartesian3);this._moveUpdatePositions[r]=e.clone()}for(let r=0;r<this._moveInitHeights.length;r++)this._moveUpdateHeights[r]=parseFloat(this._moveInitHeights[r])+-1*i},_coordinateAxisActivateEditEntity:function(e){let t=this,i=e.getBindEntity();if(void 0!==i&&i.getEntityType()===rn.DrawType.VideoWall){let e=i.wall;this._moveInitPositions=e.positions._value,this._moveInitHeights=e.minimumHeights._value,this._moveInitHeight=e.maximumHeights._value[0]-e.minimumHeights._value[0],this._moveUpdatePositions=[];for(let t=0;t<this._moveInitPositions.length;t++)this._moveUpdatePositions.push(this._moveInitPositions[t].clone());e.positions=new Cesium.CallbackProperty((function(){return t._moveUpdatePositions}),!1),this._moveUpdateHeights=[];for(let t=0;t<this._moveInitHeights.length;t++)this._moveUpdateHeights.push(this._moveInitHeights[t]);e.minimumHeights=new Cesium.CallbackProperty((function(){return t._moveUpdateHeights}),!1),e.maximumHeights=new Cesium.CallbackProperty((function(){let e=[];for(let i=0;i<t._moveUpdateHeights.length;i++)e.push(parseFloat(t._moveUpdateHeights[i])+t._moveInitHeight);return e}),!1)}},_coordinateAxisUpdateEditEntity:function(e){let t=e.getBindEntity();if(void 0!==t&&t.getEntityType()===rn.DrawType.VideoWall){let e=t.wall;e.positions=this._moveUpdatePositions,e.minimumHeights=this._moveUpdateHeights;let i=[];for(let t=0;t<this._moveUpdateHeights.length;t++)i.push(parseFloat(this._moveUpdateHeights[t])+this._moveInitHeight);e.maximumHeights=i}},_coordinateCalculateEntityOrientation:function(e,t){let i=e.position._value,n=void 0===e.orientation?new Cesium.Cartesian3(0,0,0):e.orientation._value,r=Cesium.Matrix4.fromTranslationQuaternionRotationScale(i,n,new Cesium.Cartesian3(1,1,1),new Cesium.Matrix4),o=Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(t.x)),s=Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(t.y)),a=Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(t.z));r=Cesium.Matrix4.multiplyByMatrix3(r,o,r),r=Cesium.Matrix4.multiplyByMatrix3(r,s,r),r=Cesium.Matrix4.multiplyByMatrix3(r,a,r);let l=Cesium.Matrix4.getRotation(r,new Cesium.Matrix3),u=new Cesium.Quaternion;return Cesium.Quaternion.fromRotationMatrix(l,u),u},_removeCoorinateAxis:function(){void 0!==this._coordinateAxisEntityName&&this._removeEntityByName(this._coordinateAxisEntityName),void 0!==this._eventCoorinateAxis&&(this._clearEvent(this._eventCoorinateAxis),this._eventCoorinateAxis=void 0)}}),Object.assign(rn.prototype,{_setEntityIsEdit(e){let t=this;e.setIsEdit(!0),this._unActivateEdit(),this._activateEdit(e);let i=new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);this._registerLeftClickEvent(i,(function(e){let i=t._viewer.scene.pick(e.position);if(void 0===i)t._unActivateEdit();else if(i.id instanceof Cesium.Entity){let e=i.id.getEntityType();if(void 0===i.id.getIsEdit()||!1===i.id.getIsEdit()||void 0===e)return void t._unActivateEdit();let n=rn.initEditPropertyParams();if(n.id=e,e===rn.DrawType.NormalWall||e===rn.DrawType.DynamicWall||e===rn.DrawType.TextWall){let e=i.id.wall.material,t=i.id.wall.material._param,r=(i.id.wall.maximumHeights._value[0]-i.id.wall.minimumHeights._value[0]).toFixed(2);n.height=r,n.color=t.color,e instanceof Cesium.ImageMaterialProperty?n.text=t.text:e instanceof tn?(n.count=t.count,n.direction=t.direction,n.order=t.order):Cesium.ColorMaterialProperty}else if(e===rn.DrawType.Circle||e===rn.DrawType.DynamicCircle){let e=i.id.ellipse.material,t=i.id.ellipse.material._param;e instanceof nn?(n.color=t.color,n.count=t.count):e instanceof Cesium.ColorMaterialProperty&&(n.color=t.color,void 0!==i.id.polyline&&(n.outlineColor=i.id.polyline.material._param.color,n.outlineWidth=i.id.polyline.width))}else if(e===rn.DrawType.House){let e=i.id.getParams(),t=i.id.polygon.material._param;n.height=e.appendHeight,n.color=t.color}else if(e===rn.DrawType.Polygon){let e=i.id.polygon.material._param;n.color=e.color,void 0!==i.id.polyline&&(n.outlineWidth=i.id.polyline.width,n.outlineColor=i.id.polyline.material._param.color)}else if(e===rn.DrawType.VideoWall){let e=i.id.getParams();n.moveX=e.moveX,n.moveY=e.moveY,n.moveZ=e.moveZ}else if(e===rn.DrawType.Polyline){let e=i.id.polyline.material;n.lineWidth=i.id.polyline.width._value,e instanceof Cesium.ColorMaterialProperty?(n.color=e._param.color,n.id=rn.DrawType.Polyline):e instanceof Cesium.PolylineArrowMaterialProperty?(n.id=rn.DrawType.ArrowPolyline,n.color=e._param.color):e instanceof tn?(n.id=rn.DrawType.DynamicPolyline,n.color=e._param.color,n.count=e._param.count,n.order=e._param.order):e instanceof Cesium.PolylineGlowMaterialProperty?(n.id=rn.DrawType.GrowPolyline,n.color=e._param.color,n.power=e._param.power):e instanceof Cesium.PolylineOutlineMaterialProperty&&(n.id=rn.DrawType.OultliePolyline,n.color=e._param.color,n.outlineWidth=e._param.outlineWidth,n.outlineColor=e._param.outlineColor)}else if(e===rn.DrawType.Rectangle){let e=i.id.rectangle.material._param;n.color=e.color,void 0!==i.id.polyline&&(n.outlineWidth=i.id.polyline.width,n.outlineColor=i.id.polyline.material._param.color)}else if(e===rn.DrawType.SpatialLine){let e=i.id.polyline.material._param;n.lineWidth=i.id.polyline.width._value,n.color=e.color}else n=void 0;void 0!==n&&void 0!==t.onEditProperty&&t.onEditProperty(n),t._unActivateEdit(),t._activateEdit(i.id)}else t._unActivateEdit()}))},updateEditEntityProperty:function(e){let t=this;if(void 0===this._editEntity)return;if(void 0===this._editEntity.getIsEdit()||!1===this._editEntity.getIsEdit())return;let i=this._editEntity.getEntityType();if(void 0!==i)if(i===rn.DrawType.NormalWall||i===rn.DrawType.DynamicWall||i===rn.DrawType.TextWall){let i=this._editEntity.wall.minimumHeights._value,n=[];for(let t=0;t<i.length;t++)n.push(i[t]+parseFloat(e.height));this._editEntity.wall.maximumHeights=n,this._sketchWallMaxHeights=n;let r=this._editEntity.wall.material;if(r instanceof Cesium.ImageMaterialProperty){let t=this._materialTextImageProperty({color:e.color,text:e.text});this._editEntity.wall.material=t}else if(r instanceof tn){let i=new tn({viewer:t._viewer,trailImage:"/jt3dSDK/imgs/polylinematerial/image.png",duration:1500,color:Cesium.Color.fromCssColorString(e.color),param:{count:parseFloat(e.count),direction:e.direction,order:e.order}});this._editEntity.wall.material=i}else if(r instanceof Cesium.ColorMaterialProperty){let t=this._materialColorProperty({color:e.color});this._editEntity.wall.material=t}}else if(i===rn.DrawType.Circle||i===rn.DrawType.DynamicCircle){let i=this._editEntity.ellipse.material;if(i instanceof nn){let i=new nn({viewer:t._viewer,duration:1500,color:Cesium.Color.fromCssColorString(e.color),count:parseFloat(e.count)});this._editEntity.ellipse.material=i}else if(i instanceof Cesium.ColorMaterialProperty){let i=t._materialColorProperty({color:e.color});if(this._editEntity.ellipse.material=i,void 0!==this._editEntity.polyline){let t=this._materialColorProperty({color:e.outlineColor});this._editEntity.polyline.material=t,this._editEntity.polyline.width=parseFloat(e.outlineWidth)}}}else if(i===rn.DrawType.House){let t=this._editEntity.getParams();if(this._editEntity.polygon.material instanceof Cesium.ColorMaterialProperty){let i=this._materialColorProperty({color:e.color});this._editEntity.polygon.material=i,this._editEntity.polygon.extrudedHeight=parseFloat(e.height)+parseFloat(t.bottomHeight),this._editEntity.setParams({bottomHeight:t.bottomHeight,appendHeight:e.height})}}else if(i===rn.DrawType.VideoWall);else if(i===rn.DrawType.Polyline){let i,n=this._editEntity.polyline.material;n instanceof Cesium.ColorMaterialProperty?i=this._materialColorProperty({color:e.color}):n instanceof Cesium.PolylineArrowMaterialProperty?i=this._materialPolylineArrowProperty({color:e.color}):n instanceof tn?i=new tn({viewer:t._viewer,trailImage:"/jt3dSDK/imgs/polylinematerial/image.png",duration:1500,color:Cesium.Color.fromCssColorString(e.color),param:{count:parseInt(e.count),direction:"horizontal",order:e.order}}):n instanceof Cesium.PolylineGlowMaterialProperty?i=this._materialPolylineGlowProperty({color:e.color,power:parseFloat(e.power)}):n instanceof Cesium.PolylineOutlineMaterialProperty&&(i=this._materialPolylineOutlineProperty({color:e.color,outlineWidth:parseFloat(e.outlineWidth),outlineColor:e.outlineColor})),void 0!==i&&(this._editEntity.polyline.material=i),this._editEntity.polyline.width=e.lineWidth}else if(i===rn.DrawType.Polygon){if(this._editEntity.polygon.material instanceof Cesium.ColorMaterialProperty){let t=this._materialColorProperty({color:e.color});this._editEntity.polygon.material=t}if(void 0!==this._editEntity.polyline){let t=this._materialColorProperty({color:e.outlineColor});this._editEntity.polyline.material=t,this._editEntity.polyline.width=parseFloat(e.outlineWidth)}}else if(i===rn.DrawType.Rectangle){if(this._editEntity.rectangle.material instanceof Cesium.ColorMaterialProperty){let t=this._materialColorProperty({color:e.color});this._editEntity.rectangle.material=t}if(void 0!==this._editEntity.polyline){let t=this._materialColorProperty({color:e.outlineColor});this._editEntity.polyline.material=t,this._editEntity.polyline.width=parseFloat(e.outlineWidth)}}else if(i===rn.DrawType.SpatialLine){let t;this._editEntity.polyline.material instanceof Cesium.ColorMaterialProperty&&(t=this._materialColorProperty({color:e.color})),void 0!==t&&(this._editEntity.polyline.material=t),this._editEntity.polyline.width=parseFloat(e.lineWidth)}},rotationEntity(e){if(console.log("===旋转实体>>>",this._editEntity),void 0===this._editEntity)return;let t=this._coordinateCalculateEntityOrientation(this._editEntity,e);console.log("===旋转>>>",t)},_getEntityEditData:function(e){if(e instanceof Cesium.Entity){let t=e.getEntityType();if(t===rn.DrawType.Polyline||t===rn.DrawType.SpatialLine)return e.polyline.positions._value;if(t===rn.DrawType.Polygon||t===rn.DrawType.House){let t=e.polygon.hierarchy._value.positions;return t[0].x!==t[t.length-1].x&&t.push(t[0].clone()),t}if(t===rn.DrawType.Rectangle){let t=e.rectangle.coordinates._value,i=Cesium.Rectangle.northwest(t);if(i.height<=0){let e=this._queryHeightFromGeo(Cesium.Math.toDegrees(i.longitude),Cesium.Math.toDegrees(i.latitude));i.height=e}let n=Cesium.Cartesian3.fromRadians(i.longitude,i.latitude,i.height),r=Cesium.Rectangle.southeast(t);if(r.height<=0){let e=this._queryHeightFromGeo(Cesium.Math.toDegrees(r.longitude),Cesium.Math.toDegrees(r.latitude));r.height=e}return[n,Cesium.Cartesian3.fromRadians(r.longitude,r.latitude,r.height)]}if(t===rn.DrawType.Circle||t===rn.DrawType.DynamicCircle){let t=e.position._value,i=e.ellipse.semiMajorAxis._value;return[t,this._calculateCircleBoundaryPoint(t,i)]}if(t===rn.DrawType.NormalWall||t===rn.DrawType.DynamicWall||t===rn.DrawType.TextWall){this._sketchWallHeights=[],this._sketchWallMaxHeights=[];let t=e.wall.minimumHeights._value,i=e.wall.maximumHeights._value;for(let e=0;e<t.length;e++)this._sketchWallHeights.push(t[e]),this._sketchWallMaxHeights.push(i[e]);return e.wall.positions._value}if(t===rn.DrawType.VideoWall){return[e.wall.positions._value[0].clone()]}return[]}return[]},_calculateCircleBoundaryPoint:function(e,t){let i=Cesium.Ellipsoid.WGS84.cartesianToCartographic(e),n=Qe(W([Cesium.Math.toDegrees(i.longitude),Cesium.Math.toDegrees(i.latitude)]),t/1e3,90,{units:"kilometers"}).geometry.coordinates,r=this._queryHeightFromGeo(n[0],n[1]);return Cesium.Cartesian3.fromDegrees(n[0],n[1],r)},_calculateCenterPosition:function(e){if(void 0!==e&&0!==e.length){if(1===e.length)return e[0];if(2===e.length){let t=this._cartesian3ToGeo(e[0]),i=this._cartesian3ToGeo(e[1]),n=Je(W([t.longitude,t.latitude]),W([i.longitude,i.latitude])).geometry.coordinates,r=this._queryHeightFromGeo(n[0],n[1]);return Cesium.Cartesian3.fromDegrees(n[0],n[1],r)}{let t=[[]];for(let r=0;r<e.length;r++){let i=this._cartesian3ToGeo(e[r]);t[0].push([i.longitude,i.latitude])}t[0].push(t[0][0]);let i=et(H(t)).geometry.coordinates,n=this._queryHeightFromGeo(i[0],i[1]);return Cesium.Cartesian3.fromDegrees(i[0],i[1],n)}}},_calculateTransformPosition:function(e,t,i,n){let r=this._cartesian3ToGeo(e),o=Qe(W([r.longitude,r.latitude]),t,i,n).geometry.coordinates,s=r.height;return void 0!==n&&void 0!==n.calculateHeight&&!0===n.calculateHeight&&(s=this._queryHeightFromGeo(o[0],o[1])),Cesium.Cartesian3.fromDegrees(o[0],o[1],s)},_unActivateEdit:function(){this._clearEditPoint()},_activateEdit:function(e){let t=e.getEntityType(),i=e.getIsEdit();if(void 0===i||void 0===t||!1===i)return void console.log("===>>>","该实体不可编辑");let n=this,r=this._getEntityEditData(e);if(this._removePointEntitys(),this._editEntity=e,t===rn.DrawType.Circle||t===rn.DrawType.DynamicCircle)this._createEditCenterPoint(r[0]),this._createEditNodePoint(r,1);else if(t===rn.DrawType.VideoWall){let e=r[0];this._removeCoorinateAxis(),this._createCoordinateAxis(e)}else{this._createEditNodePoint(r);let e=this._calculateCenterPosition(r);void 0!==e&&this._createEditCenterPoint(e)}t!==rn.DrawType.Rectangle&&t!==rn.DrawType.Circle&&t!==rn.DrawType.DynamicCircle&&t!==rn.DrawType.VideoWall&&(t===rn.DrawType.SpatialLine?this._createEditMiddlePoint(r,!0):this._createEditMiddlePoint(r)),void 0===this._sketchEditHandler&&(this._sketchEditHandler=new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas)),this._registerLeftDownEvent(this._sketchEditHandler,(function(e){let t=n._viewer.scene.pick(e.position);if(console.log("===选中的节点>>>",t),null!=t&&t.id instanceof Cesium.Entity){let i=t.id.getEditType();if(console.log("===>>>",i),void 0===i)return;n._viewer.scene.screenSpaceCameraController.enableRotate=!1;let r=t.id.position._value;if(n._editPointEntity=t.id,n._setMousePointerStyle(),i.type===rn.EditPointType.Node||i.type===rn.EditPointType.Middle?(n._entityCallbackPropertyByMouseDown(),n._removeEntityByObject(n._editPointEntity),null!=n._sketchEditEntitySpatialName&&n._removeEntityByName(n._sketchEditEntitySpatialName)):i.type===rn.EditPointType.Center&&n._entityCenterMouseDownEvent(),i.type===rn.EditPointType.Middle){let t=i.index;if(n._sketchEditPoints.splice(t,0,r),n._sketchEditIndex=t,null!=n._sketchWallHeights&&n._sketchWallHeights.length>0){let e=n._cartesian3ToGeo(r),i=n._queryHeightFromGeo(e.longitude,e.latitude);n._sketchWallHeights.splice(t,0,i);let o=n._sketchWallMaxHeights[0]-n._sketchWallHeights[0];n._sketchWallMaxHeights.splice(t,0,i+o)}n._tooltipInit("拖动中点,改变形状",e.position)}else i.type===rn.EditPointType.Node?(n._sketchEditIndex=i.index,n._tooltipInit("拖动节点,改变形状",e.position)):i.type===rn.EditPointType.Spatial?(n._sketchEditIndex=i.index,n._tooltipInit("拖动节点,改变高度",e.position)):i.type===rn.EditPointType.CoordinateAxis&&n._tooltipInit("拖动坐标轴,改变位置",e.position)}})),this._registerMouseMoveEvent(this._sketchEditHandler,(function(e){if(null!=n._editPointEntity){let t=n._transfromFromScreenPoint(e.endPosition);if(!Cesium.defined(t.sLocation))return;n._editPosition=t.sLocation;let i=n._editPointEntity.getEditType();if(i.type===rn.EditPointType.Node){n._sketchEditPoints[n._sketchEditIndex]=t.sLocation;let e=n._editEntity.getEntityType();e!=rn.DrawType.Rectangle&&e!=rn.DrawType.Circle&&e!=rn.DrawType.DynamicCircle&&(e!==rn.DrawType.Polygon&&e!==rn.DrawType.House||0!==n._sketchEditIndex?e!==rn.DrawType.NormalWall&&e!==rn.DrawType.DynamicWall&&e!==rn.DrawType.TextWall||(n._sketchWallHeights[n._sketchEditIndex]=t.gLocation.height):n._sketchEditPoints[n._sketchEditPoints.length-1]=t.sLocation,n._removeEntityByName(n._sketchEditEntityMiddleName),e===rn.DrawType.SpatialLine?n._createEditMiddlePoint(n._sketchEditPoints,!0):n._createEditMiddlePoint(n._sketchEditPoints))}else if(i.type===rn.EditPointType.Middle)n._sketchEditPoints[n._sketchEditIndex]=t.sLocation;else if(i.type===rn.EditPointType.Center)n._entityCenterMouseMoveEvent(e);else if(i.type===rn.EditPointType.Spatial){let t=n._viewer.scene.globe.ellipsoid,i=n._viewer.camera.pickEllipsoid(e.endPosition,t),r=n._sketchEditPoints[n._sketchEditIndex],o=i.z-r.z;if(o>0&&o<500)for(let e=0;e<n._sketchWallHeights.length;e++)n._sketchWallMaxHeights[e]=n._sketchWallHeights[e]+o}n._tooltipInit("抬起鼠标,完成更改",e.endPosition)}})),this._registerLeftUpEvent(this._sketchEditHandler,(function(e){if(null!=n._editPointEntity){n._viewer.scene.screenSpaceCameraController.enableRotate=!0,n._tooltipRemove(),n._setMouseDefaultStyle();let i=n._editPointEntity.getEditType().type;if(i===rn.EditPointType.CoordinateAxis);else{if(i===rn.EditPointType.Node||i===rn.EditPointType.Middle?n._entityCallbackPropertyByMouseUp():i===rn.EditPointType.Center&&n._entityCenterMouseUpEvent(e),n._removeEntityByName(n._sketchEditEntityNodeName),n._removeEntityByName(n._sketchEditEntityMiddleName),n._removeEntityByName(n._sketchEditEntityCenterName),t===rn.DrawType.Circle||t===rn.DrawType.DynamicCircle){let e=n._editEntity.position._value,t=n._calculateCircleBoundaryPoint(e,n._sketchEllipseRadius);n._sketchEditPoints[0]=e,n._sketchEditPoints[1]=t,n._createEditNodePoint(n._sketchEditPoints,1),n._createEditCenterPoint(e)}else{n._createEditNodePoint(n._sketchEditPoints);let e=n._calculateCenterPosition(n._sketchEditPoints);n._createEditCenterPoint(e)}t!=rn.DrawType.Rectangle&&t!=rn.DrawType.Circle&&t!=rn.DrawType.DynamicCircle&&(t===rn.DrawType.SpatialLine?n._createEditMiddlePoint(n._sketchEditPoints,!0):n._createEditMiddlePoint(n._sketchEditPoints))}n._editPointEntity=void 0}}))},_entityCenterMouseDownEvent:function(){let e=this,t=this._editEntity.position._value;this._removeEntityByName(this._sketchEditEntityNodeName),this._removeEntityByName(this._sketchEditEntityMiddleName),this._removeEntityByName(this._sketchEditEntityCenterName),this._startPoint=t,this._startMovePoints=[],this._movePoint=t;let i=this._editEntity.getEntityType();if(i===rn.DrawType.Circle||i===rn.DrawType.DynamicCircle){if(void 0!==this._editEntity.polyline){for(let e=0;e<this._ellipseOutlineCoordinates.length;e++)this._startMovePoints.push(this._ellipseOutlineCoordinates[e]);this._editEntity.polyline.positions=new Cesium.CallbackProperty((function(){return e._ellipseOutlineCoordinates}),!1)}this._editEntity.position=new Cesium.CallbackProperty((function(){return e._movePoint}),!1)}else if(i===rn.DrawType.Polygon||i===rn.DrawType.House){for(let e=0;e<this._sketchEditPoints.length;e++)this._startMovePoints.push(this._sketchEditPoints[e]);e._editEntity.polygon.hierarchy=new Cesium.CallbackProperty((function(){return{positions:e._sketchEditPoints}}),!1),null!=e._editEntity.polyline&&(e._editEntity.polyline.positions=new Cesium.CallbackProperty((function(){return e._sketchEditPoints}),!1))}else if(i===rn.DrawType.Polyline||i===rn.DrawType.SpatialLine){for(let e=0;e<this._sketchEditPoints.length;e++)this._startMovePoints.push(this._sketchEditPoints[e]);e._editEntity.polyline.positions=new Cesium.CallbackProperty((function(){return e._sketchEditPoints}),!1)}else if(i===rn.DrawType.Rectangle){for(let e=0;e<this._sketchEditPoints.length;e++)this._startMovePoints.push(this._sketchEditPoints[e]);e._editEntity.rectangle.coordinates=new Cesium.CallbackProperty(e._callUpdateRectangleCoordinates(e._sketchEditPoints),!1),null!=e._editEntity.polyline&&(e._editEntity.polyline.positions=new Cesium.CallbackProperty(e._callUpdateRectangleOutlineCoordinates(),!1))}},_entityCenterMouseMoveEvent:function(e){this._calculatePositionsByCenter(e.endPosition,!1)},_calculatePositionsByCenter:function(e,t){let i=this._cartesian3ToGeo(this._startPoint),n=this._transfromFromScreenPoint(e);var r=W([i.longitude,i.latitude]),o=W([n.gLocation.lng,n.gLocation.lat]),s=Ke(r,o),a={units:"kilometers",calculateHeight:t},l=Ze(r,o,a);let u=this._editEntity.getEntityType();if(u===rn.DrawType.Circle||u===rn.DrawType.DynamicCircle){for(let e=0;e<this._startMovePoints.length;e++){let t=this._calculateTransformPosition(this._startMovePoints[e],l,s,a);this._ellipseOutlineCoordinates[e]=t.clone()}this._movePoint=n.sLocation}else for(let c=0;c<this._startMovePoints.length;c++){let e=this._calculateTransformPosition(this._startMovePoints[c],l,s,a);this._sketchEditPoints[c]=e.clone()}},_entityCenterMouseUpEvent:function(e){this._calculatePositionsByCenter(e.position,!0);let t=this,i=this._editEntity.getEntityType();i===rn.DrawType.Circle||i===rn.DrawType.DynamicCircle?(this._editEntity.position=this._movePoint,void 0!==this._editEntity.polyline&&(this._editEntity.polyline.positions=this._ellipseOutlineCoordinates)):i===rn.DrawType.Polyline||i===rn.DrawType.SpatialLine?this._editEntity.polyline.positions=this._sketchEditPoints:i===rn.DrawType.Polygon||i===rn.DrawType.House?(this._editEntity.polygon.hierarchy={positions:t._sketchEditPoints},null!=this._editEntity.polyline&&(this._editEntity.polyline.positions=this._sketchEditPoints)):i===rn.DrawType.Rectangle&&(this._editEntity.rectangle.coordinates=Cesium.Rectangle.fromDegrees(t._rectangleCoordinates[0],t._rectangleCoordinates[1],t._rectangleCoordinates[2],t._rectangleCoordinates[3]),null!=this._editEntity.polyline&&(this._editEntity.polyline.positions=t._rectangleOutlineCoordinates))},_entityCallbackPropertyByMouseUp:function(){let e=this,t=e._editEntity.getEntityType();if(t===rn.DrawType.Polyline)e._editEntity.polyline.positions=e._sketchEditPoints;else if(t===rn.DrawType.Polygon||t===rn.DrawType.House){if(e._editEntity.polygon.hierarchy={positions:e._sketchEditPoints},null!=e._editEntity.polyline){let t=e._editEntity.polygon.hierarchy._value.positions,i=[];for(let e=0;e<t.length;e++)i.push(t[e].clone());i[0].x!==i[i.length-1].x&&i.push(i[0].clone()),e._editEntity.polyline.positions=i}}else t===rn.DrawType.Rectangle?(e._editEntity.rectangle.coordinates=Cesium.Rectangle.fromDegrees(e._rectangleCoordinates[0],e._rectangleCoordinates[1],e._rectangleCoordinates[2],e._rectangleCoordinates[3]),null!=e._editEntity.polyline&&(e._editEntity.polyline.positions=e._rectangleOutlineCoordinates)):t===rn.DrawType.Circle?(e._editEntity.ellipse.semiMajorAxis=e._sketchEllipseRadius,e._editEntity.ellipse.semiMinorAxis=e._sketchEllipseRadius,null!=e._editEntity.polyline&&(e._editEntity.polyline.positions=e._ellipseOutlineCoordinates)):t!==rn.DrawType.NormalWall&&t!==rn.DrawType.DynamicWall&&t!==rn.DrawType.TextWall||(e._editEntity.wall.positions=e._sketchEditPoints,e._editEntity.wall.minimumHeights=e._sketchWallHeights,e._editEntity.wall.maximumHeights=e._sketchWallMaxHeights)},_entityCallbackPropertyByMouseDown:function(){let e=this,t=e._editEntity.getEntityType();t===rn.DrawType.Polyline||t===rn.DrawType.SpatialLine?e._editEntity.polyline.positions=new Cesium.CallbackProperty((function(){return e._sketchEditPoints}),!1):t===rn.DrawType.Polygon||t===rn.DrawType.House?(e._editEntity.polygon.hierarchy=new Cesium.CallbackProperty((function(){return{positions:e._sketchEditPoints}}),!1),null!=e._editEntity.polyline&&(e._editEntity.polyline.positions=new Cesium.CallbackProperty((function(){let t=e._sketchEditPoints,i=[];for(let e=0;e<t.length;e++)i.push(t[e].clone());return i[0].x!==i[i.length-1].x&&i.push(i[0].clone()),i}),!1))):t===rn.DrawType.Rectangle?(e._editEntity.rectangle.coordinates=new Cesium.CallbackProperty(e._callUpdateRectangleCoordinates(e._sketchEditPoints),!1),null!=e._editEntity.polyline&&(e._editEntity.polyline.positions=new Cesium.CallbackProperty(e._callUpdateRectangleOutlineCoordinates(),!1))):t===rn.DrawType.Circle||t===rn.DrawType.DynamicCircle?(1===e._editPointEntity.getEditType().index&&(e._editEntity.ellipse.semiMajorAxis=new Cesium.CallbackProperty(e._callUpdateEllipseMinorAxis(e._sketchEditPoints),!1),e._editEntity.ellipse.semiMinorAxis=new Cesium.CallbackProperty(e._callUpdateEllipseMinorAxis(e._sketchEditPoints),!1)),null!=e._editEntity.polyline&&(e._editEntity.polyline.positions=new Cesium.CallbackProperty(e._callEllipseOutlineCoordinate(e._sketchEditPoints),!1))):t!==rn.DrawType.NormalWall&&t!==rn.DrawType.DynamicWall&&t!==rn.DrawType.TextWall||(e._editEntity.wall.positions=new Cesium.CallbackProperty((function(){return e._sketchEditPoints}),!1),e._editEntity.wall.minimumHeights=new Cesium.CallbackProperty((function(){return e._sketchWallHeights}),!1),e._editEntity.wall.maximumHeights=new Cesium.CallbackProperty((function(){return e._sketchWallMaxHeights}),!1))},_createEditPointEntity(e){let t=this;if(void 0===e||void 0===e.position)return;if(void 0===e||void 0===e.editType)return;let i=null!=e.color?e.color:[255,0,0,1],n=null!=e.size&&"number"==typeof e.size?e.size:9,r=null!=e.outlineWidth&&"number"==typeof e.outlineWidth?e.outlineWidth:1,o=null!=e.outlineColor?e.outlineColor:[255,255,255,1],s=new Cesium.Entity({name:null!=e.name?e.name:t._sketchEntityName,position:e.position,point:{show:!0,pixelSize:n,heightReference:Cesium.HeightReference.NONE,color:t._toColorFromArray(i),outlineWidth:r,outlineColor:t._toColorFromArray(o),disableDepthTestDistance:15e11}});s.setEditType(e.editType),t._entities.add(s)},_createEditNodePoint(e,t){this._sketchEditEntityNodeName="SketchEditEntityNode";let i=this;this._sketchEditPoints=[];let n=void 0===t?0:t;for(let r=0;r<e.length;r++){let t=e[r];if(this._sketchEditPoints.push(t.clone()),r<n)continue;if(0!==r&&t.x===e[0].x&&t.y===e[0].y&&t.z===e[0].z)continue;let o=this._cartesian3ToGeo(t),s=this._queryHeightFromGeo(o.longitude,o.latitude),a=Cesium.Cartesian3.fromDegrees(o.longitude,o.latitude,s);i._createEditPointEntity({name:i._sketchEditEntityNodeName,position:a,size:12,color:[0,0,255,1],editType:{type:rn.EditPointType.Node,index:r}})}},_createEditSpatialPoint(e,t,i){},_createEditMiddlePoint(e,t=!1){this._sketchEditEntityMiddleName="SketchEditEntityMiddle";let i=this;if(t)for(let n=1;n<e.length;n++){let t=e[n-1],r=e[n],o={x:(t.x+r.x)/2,y:(t.y+r.y)/2,z:(t.z+r.z)/2};this._createEditPointEntity({name:i._sketchEditEntityMiddleName,position:o,size:9,color:[255,255,0,1],editType:{type:rn.EditPointType.Middle,index:n}})}else for(let n=1;n<e.length;n++){let t=e[n-1],r=e[n],o=this._calculateMiddlePoint(t,r);this._createEditPointEntity({name:i._sketchEditEntityMiddleName,position:o,size:9,color:[255,255,0,1],editType:{type:rn.EditPointType.Middle,index:n}})}},_createEditCenterPoint(e){this._sketchEditEntityCenterName="SketchEditEntityCenter",this._createEditPointEntity({name:this._sketchEditEntityCenterName,position:e,size:12,color:[0,255,0,.1],outlineWidth:2,outlineColor:[255,255,255,1],editType:{type:rn.EditPointType.Center}}),null!=this._editEntity&&(this._editEntity.position=e.clone())},_calculateMiddlePoint(e,t){let i=Cesium.Ellipsoid.WGS84.cartesianToCartographic(e),n=Cesium.Ellipsoid.WGS84.cartesianToCartographic(t),r=[Cesium.Math.toDegrees(i.longitude),Cesium.Math.toDegrees(i.latitude)],o=[Cesium.Math.toDegrees(n.longitude),Cesium.Math.toDegrees(n.latitude)],s=Je(W(r),W(o)).geometry.coordinates,a=this._queryHeightFromGeo(s[0],s[1]);return Cesium.Cartesian3.fromDegrees(s[0],s[1],a)},_cartesian3ToGeo:function(e){let t=Cesium.Ellipsoid.WGS84.cartesianToCartographic(e);return{longitude:Cesium.Math.toDegrees(t.longitude),latitude:Cesium.Math.toDegrees(t.latitude),height:t.height}},_queryHeightFromGeo:function(e,t){if(void 0===e||void 0===t||"number"!=typeof e||"number"!=typeof t)return 0;let i=Cesium.Math.toRadians(e),n=Cesium.Math.toRadians(t),r=new Cesium.Cartographic(i,n),o=[];for(let a=0;a<this._entities.values.length;a++)this._entities.values[a].name===this._sketchEntityName&&o.push(this._entities.values[a]);let s=this._viewer.scene.sampleHeight(r,o);return void 0===s?0:s},_queryHeightFromGeoAsync:function(e,t,i){if(void 0===e||void 0===t||"number"!=typeof e||"number"!=typeof t)return 0;let n=Cesium.Math.toRadians(e),r=Cesium.Math.toRadians(t),o=new Cesium.Cartographic(n,r);this._viewer.scene.sampleHeightMostDetailed([o]).then((function(e){i&&i(e[0].height)}))},_clearEditPoint:function(){null!=this._sketchEditHandler&&(this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN),this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP),this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)),this._sketchEditPoints=[],this._sketchEditIndex=void 0,this._editEntity=void 0,this._removeEntityByName(this._sketchEditEntityNodeName),this._removeEntityByName(this._sketchEditEntityMiddleName),this._removeEntityByName(this._sketchEditEntityCenterName),this._removeEntityByName(this._sketchEditEntitySpatialName)}}),Object.assign(rn.prototype,{_checkColor:function(e){if(null==e)return!1;if("number"!=typeof e)return!1;let t=parseInt(e);return!(t<0||t>255)},_checkAlpha:function(e){if(null==e)return!1;if("number"!=typeof e)return!1;let t=parseFloat(e);return!(t<0||t>1)},_checkColorAndAlpha:function(e){let t;if(e&&void 0!==e.length&&0!==e.length)return 1===e.length&&this._checkColor(e[0])?t=[e[0],0,0,1]:2===e.length&&this._checkColor(e[0])&&this._checkColor(e[1])?t=[e[0],e[1],0,1]:3===e.length&&this._checkColor(e[0])&&this._checkColor(e[1])&&this._checkColor(e[2])?t=[e[0],e[1],e[2],1]:4===e.length&&this._checkColor(e[0])&&this._checkColor(e[1])&&this._checkColor(e[2])&&this._checkAlpha(e[3])&&(t=[e[0],e[1],e[2],e[3]]),t}}),rn.DrawType=Object.freeze({Point:"point",Polyline:"polyline",ArrowPolyline:"arrowPolyline",DynamicPolyline:"dynamicPolyline",GrowPolyline:"发光线",OultliePolyline:"outlinePolyline",Polygon:"polygon",SpatialLine:"spatialLine",Circle:"circle",DynamicCircle:"dynamicCircle",Rectangle:"rectangle",NormalWall:"normalWall",DynamicWall:"dynamicWall",House:"house",TextWall:"text",VideoWall:"videoWall"}),rn.IconType=Object.freeze({Normal:"normal",Blue:"blue",Green:"green",Violet:"violter"}),rn.EditPointType=Object.freeze({Node:"node",Middle:"middle",Center:"center",CoordinateAxis:"coordinateAxis"}),rn.WallType=Object.freeze({ColorWall:"colorWall",DynamicWall:"dynamicWall",TextWall:"textWall"}),rn.CircleType=Object.freeze({ColorCircle:"colorCircle",DynamicCircle:"dynamicCircle"}),rn.PolylineType=Object.freeze({NormalPolyline:"normalPolyline",ArrowsPolyline:"arrowsPolyline",DynamicPolyline:"dynamicPolyline",DottedPolyline:"dottedPolyline",GrowPolyline:"growPolyline",OutlinePolyline:"outlinePolyline"}),rn.PolygonType=Object.freeze({NormalPolygon:"normalPolygon",HousePolygon:"housePolygon"});var on={version:"1.0.0",PlotUtils:{}};on.PlotUtils.distance=function(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2))},on.PlotUtils.wholeDistance=function(e){for(var t=0,i=0;i<e.length-1;i++)t+=on.PlotUtils.distance(e[i],e[i+1]);return t},on.PlotUtils.getBaseLength=function(e){return Math.pow(on.PlotUtils.wholeDistance(e),.99)},on.PlotUtils.mid=function(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]},on.PlotUtils.getCircleCenterOfThreePoints=function(e,t,i){var n=[(e[0]+t[0])/2,(e[1]+t[1])/2],r=[n[0]-e[1]+t[1],n[1]+e[0]-t[0]],o=[(e[0]+i[0])/2,(e[1]+i[1])/2],s=[o[0]-e[1]+i[1],o[1]+e[0]-i[0]];return on.PlotUtils.getIntersectPoint(n,r,o,s)},on.PlotUtils.getIntersectPoint=function(e,t,i,n){if(e[1]==t[1]){var r=(n[0]-i[0])/(n[1]-i[1]),o=r*(e[1]-i[1])+i[0],s=e[1];return[o,s]}if(i[1]==n[1]){var a=(t[0]-e[0])/(t[1]-e[1]);return[o=a*(i[1]-e[1])+e[0],s=i[1]]}return a=(t[0]-e[0])/(t[1]-e[1]),r=(n[0]-i[0])/(n[1]-i[1]),[o=a*(s=(a*e[1]-e[0]-r*i[1]+i[0])/(a-r))-a*e[1]+e[0],s]},on.PlotUtils.getAzimuth=function(e,t){var i,n=Math.asin(Math.abs(t[1]-e[1])/on.PlotUtils.distance(e,t));return t[1]>=e[1]&&t[0]>=e[0]?i=n+Math.PI:t[1]>=e[1]&&t[0]<e[0]?i=on.Constants.TWO_PI-n:t[1]<e[1]&&t[0]<e[0]?i=n:t[1]<e[1]&&t[0]>=e[0]&&(i=Math.PI-n),i},on.PlotUtils.getAngleOfThreePoints=function(e,t,i){var n=on.PlotUtils.getAzimuth(t,e)-on.PlotUtils.getAzimuth(t,i);return 0>n?n+on.Constants.TWO_PI:n},on.PlotUtils.isClockWise=function(e,t,i){return(i[1]-e[1])*(t[0]-e[0])>(t[1]-e[1])*(i[0]-e[0])},on.PlotUtils.getPointOnLine=function(e,t,i){return[t[0]+e*(i[0]-t[0]),t[1]+e*(i[1]-t[1])]},on.PlotUtils.getCubicValue=function(e,t,i,n,r){var o=1-(e=Math.max(Math.min(e,1),0)),s=e*e,a=s*e,l=o*o,u=l*o;return[u*t[0]+3*l*e*i[0]+3*o*s*n[0]+a*r[0],u*t[1]+3*l*e*i[1]+3*o*s*n[1]+a*r[1]]},on.PlotUtils.getThirdPoint=function(e,t,i,n,r){var o=on.PlotUtils.getAzimuth(e,t),s=r?o+i:o-i,a=n*Math.cos(s),l=n*Math.sin(s);return[t[0]+a,t[1]+l]},on.PlotUtils.getArcPoints=function(e,t,i,n){var r,o,s=[],a=n-i;a=0>a?a+on.Constants.TWO_PI:a;for(var l=0;l<=on.Constants.FITTING_COUNT;l++){var u=i+a*l/on.Constants.FITTING_COUNT;r=e[0]+t*Math.cos(u),o=e[1]+t*Math.sin(u),s.push([r,o])}return s},on.PlotUtils.getBisectorNormals=function(e,t,i,n){var r=on.PlotUtils.getNormal(t,i,n),o=Math.sqrt(r[0]*r[0]+r[1]*r[1]),s=r[0]/o,a=r[1]/o,l=on.PlotUtils.distance(t,i),u=on.PlotUtils.distance(i,n);if(o>on.Constants.ZERO_TOLERANCE)if(on.PlotUtils.isClockWise(t,i,n)){var c=e*l,h=i[0]-c*a,d=i[1]+c*s,p=[h,d];c=e*u;var f=[h=i[0]+c*a,d=i[1]-c*s]}else c=e*l,p=[h=i[0]+c*a,d=i[1]-c*s],c=e*u,f=[h=i[0]-c*a,d=i[1]+c*s];else p=[h=i[0]+e*(t[0]-i[0]),d=i[1]+e*(t[1]-i[1])],f=[h=i[0]+e*(n[0]-i[0]),d=i[1]+e*(n[1]-i[1])];return[p,f]},on.PlotUtils.getNormal=function(e,t,i){var n=e[0]-t[0],r=e[1]-t[1],o=Math.sqrt(n*n+r*r);n/=o,r/=o;var s=i[0]-t[0],a=i[1]-t[1],l=Math.sqrt(s*s+a*a);return[n+(s/=l),r+(a/=l)]},on.PlotUtils.getCurvePoints=function(e,t){for(var i=[on.PlotUtils.getLeftMostControlPoint(t)],n=0;n<t.length-2;n++){var r=t[n],o=t[n+1],s=t[n+2],a=on.PlotUtils.getBisectorNormals(e,r,o,s);i=i.concat(a)}var l=on.PlotUtils.getRightMostControlPoint(t);i.push(l);var u=[];for(n=0;n<t.length-1;n++){r=t[n],o=t[n+1],u.push(r);for(e=0;e<on.Constants.FITTING_COUNT;e++){var c=on.PlotUtils.getCubicValue(e/on.Constants.FITTING_COUNT,r,i[2*n],i[2*n+1],o);u.push(c)}u.push(o)}return u},on.PlotUtils.getLeftMostControlPoint=function(e){var i=e[0],n=e[1],r=e[2],o=on.PlotUtils.getBisectorNormals(0,i,n,r)[0],s=on.PlotUtils.getNormal(i,n,r);if(Math.sqrt(s[0]*s[0]+s[1]*s[1])>on.Constants.ZERO_TOLERANCE)var a=on.PlotUtils.mid(i,n),l=i[0]-a[0],u=i[1]-a[1],c=2/on.PlotUtils.distance(i,n),h=-c*u,d=c*l,p=h*h-d*d,f=2*h*d,m=d*d-h*h,g=o[0]-a[0],v=o[1]-a[1],y=a[0]+p*g+f*v,_=a[1]+f*g+m*v;else y=i[0]+t*(n[0]-i[0]),_=i[1]+t*(n[1]-i[1]);return[y,_]},on.PlotUtils.getRightMostControlPoint=function(e){var i=e.length,n=e[i-3],r=e[i-2],o=e[i-1],s=on.PlotUtils.getBisectorNormals(0,n,r,o)[1],a=on.PlotUtils.getNormal(n,r,o);if(Math.sqrt(a[0]*a[0]+a[1]*a[1])>on.Constants.ZERO_TOLERANCE)var l=on.PlotUtils.mid(r,o),u=o[0]-l[0],c=o[1]-l[1],h=2/on.PlotUtils.distance(r,o),d=-h*c,p=h*u,f=d*d-p*p,m=2*d*p,g=p*p-d*d,v=s[0]-l[0],y=s[1]-l[1],_=l[0]+f*v+m*y,b=l[1]+m*v+g*y;else _=o[0]+t*(r[0]-o[0]),b=o[1]+t*(r[1]-o[1]);return[_,b]},on.PlotUtils.getBezierPoints=function(e){if(e.length<=2)return e;for(var t=[],i=e.length-1,n=0;1>=n;n+=.01){for(var r=0,o=r=0,s=0;i>=s;s++){var a=on.PlotUtils.getBinomialFactor(i,s),l=Math.pow(n,s),u=Math.pow(1-n,i-s);o+=a*l*u*e[s][0],r+=a*l*u*e[s][1]}t.push([o,r])}return t.push(e[i]),t},on.PlotUtils.getBinomialFactor=function(e,t){return on.PlotUtils.getFactorial(e)/(on.PlotUtils.getFactorial(t)*on.PlotUtils.getFactorial(e-t))},on.PlotUtils.getFactorial=function(e){if(1>=e)return 1;if(2==e)return 2;if(3==e)return 6;if(4==e)return 24;if(5==e)return 120;for(var t=1,i=1;e>=i;i++)t*=i;return t},on.PlotUtils.getQBSplinePoints=function(e){if(e.length<=2)return e;var t=[],i=e.length-2-1;t.push(e[0]);for(var n=0;i>=n;n++)for(var r=0;1>=r;r+=.05){for(var o=0,s=o=0,a=0;2>=a;a++){var l=on.PlotUtils.getQuadricBSplineFactor(a,r);s+=l*e[n+a][0],o+=l*e[n+a][1]}t.push([s,o])}return t.push(e[e.length-1]),t},on.PlotUtils.getQuadricBSplineFactor=function(e,t){return 0==e?Math.pow(t-1,2)/2:1==e?(-2*Math.pow(t,2)+2*t+1)/2:2==e?Math.pow(t,2)/2:0},on.Constants={TWO_PI:2*Math.PI,HALF_PI:Math.PI/2,FITTING_COUNT:100,ZERO_TOLERANCE:1e-4};var sn={version:"1.0.0",createTime:"2018.6.19",author:"xupinhui"},an="doublearrow",ln=.25,un=.3,cn=.85,hn=.15,dn={headHeightFactor:.18,headWidthFactor:.3,neckHeightFactor:.85,neckWidthFactor:.15,tailWidthFactor:.1,headTailFactor:.8,swallowTailFactor:1},pn={tailWidthFactor:.15,neckWidthFactor:.2,headWidthFactor:.25,headAngle:Math.PI/8.5,neckAngle:Math.PI/13};sn.algorithm={},sn.algorithm.doubleArrow=function(e){this.connPoint=null,this.tempPoint4=null,this.points=e;var t={controlPoint:null,polygonalPoint:null};if(!(2>(a=e.length))){if(2==a)return e;var i,n,r=this.points[0],o=this.points[1],s=this.points[2],a=e.length;this.tempPoint4=3==a?sn.algorithm.getTempPoint4(r,o,s):this.points[3],this.connPoint=3==a||4==a?on.PlotUtils.mid(r,o):this.points[4],on.PlotUtils.isClockWise(r,o,s)?(i=sn.algorithm.getArrowPoints(r,this.connPoint,this.tempPoint4,!1),n=sn.algorithm.getArrowPoints(this.connPoint,o,s,!0)):(i=sn.algorithm.getArrowPoints(o,this.connPoint,s,!1),n=sn.algorithm.getArrowPoints(this.connPoint,r,this.tempPoint4,!0));var l=i.length,u=(l-5)/2,c=i.slice(0,u),h=i.slice(u,u+5),d=i.slice(u+5,l),p=n.slice(0,u),f=n.slice(u,u+5),m=n.slice(u+5,l);p=on.PlotUtils.getBezierPoints(p);var g=on.PlotUtils.getBezierPoints(m.concat(c.slice(1)));d=on.PlotUtils.getBezierPoints(d);var v=p.concat(f,g,h,d),y=sn.algorithm.array2Dto1D(v);t.controlPoint=[r,o,s,this.tempPoint4,this.connPoint],t.polygonalPoint=Cesium.Cartesian3.fromDegreesArray(y)}return t},sn.algorithm.threeArrow=function(e){this.connPoint=null,this.tempPoint4=null,this.tempPoint5=null,this.points=e;var t={controlPoint:null,polygonalPoint:null};if((i=e.length)>=2){if(2==i)return e;var i,n,r,o=this.points[0],s=this.points[1],a=this.points[2];3==(i=e.length)?(this.tempPoint4=sn.algorithm.getTempPoint4(o,s,a),this.tempPoint5=on.PlotUtils.mid(a,this.tempPoint4)):(this.tempPoint4=this.points[3],this.tempPoint5=this.points[4]),this.connPoint=i<6?on.PlotUtils.mid(o,s):this.points[5],on.PlotUtils.isClockWise(o,s,a)?(n=sn.algorithm.getArrowPoints(o,this.connPoint,this.tempPoint4,!1),r=sn.algorithm.getArrowPoints(this.connPoint,s,a,!0)):(n=sn.algorithm.getArrowPoints(s,this.connPoint,a,!1),r=sn.algorithm.getArrowPoints(this.connPoint,o,this.tempPoint4,!0));var l=n.length,u=(l-5)/2,c=n.slice(0,u),h=n.slice(u,u+5),d=n.slice(u+5,l),p=r.slice(0,u),f=r.slice(u,u+5),m=r.slice(u+5,l);p=on.PlotUtils.getBezierPoints(p);var g=on.PlotUtils.getBezierPoints(m.concat(c.slice(1)));d=on.PlotUtils.getBezierPoints(d);var v=p.concat(f,g,h,d),y=sn.algorithm.array2Dto1D(v);t.controlPoint=[o,s,a,this.tempPoint4,this.tempPoint5,this.connPoint],t.polygonalPoint=Cesium.Cartesian3.fromDegreesArray(y)}return t},sn.algorithm.array2Dto1D=function(e){var t=[];return e.forEach((function(e){t.push(e[0]),t.push(e[1])})),t},sn.algorithm.getArrowPoints=function(e,t,i,n){this.type=an,this.headHeightFactor=ln,this.headWidthFactor=un,this.neckHeightFactor=cn,this.neckWidthFactor=hn;var r=on.PlotUtils.mid(e,t),o=on.PlotUtils.distance(r,i),s=on.PlotUtils.getThirdPoint(i,r,0,.3*o,!0),a=on.PlotUtils.getThirdPoint(i,r,0,.5*o,!0),l=[r,s=on.PlotUtils.getThirdPoint(r,s,on.Constants.HALF_PI,o/5,n),a=on.PlotUtils.getThirdPoint(r,a,on.Constants.HALF_PI,o/4,n),i],u=sn.algorithm.getArrowHeadPoints(l,this.headHeightFactor,this.headWidthFactor,this.neckHeightFactor,this.neckWidthFactor),c=u[0],h=u[4],d=on.PlotUtils.distance(e,t)/on.PlotUtils.getBaseLength(l)/2,p=sn.algorithm.getArrowBodyPoints(l,c,h,d),f=p.length,m=p.slice(0,f/2),g=p.slice(f/2,f);return m.push(c),g.push(h),(m=m.reverse()).push(t),(g=g.reverse()).push(e),m.reverse().concat(u,g)},sn.algorithm.getArrowHeadPoints=function(e,t,i){this.type=an,this.headHeightFactor=ln,this.headWidthFactor=un,this.neckHeightFactor=cn,this.neckWidthFactor=hn;var n=on.PlotUtils.getBaseLength(e)*this.headHeightFactor,r=e[e.length-1],o=(on.PlotUtils.distance(t,i),n*this.headWidthFactor),s=n*this.neckWidthFactor,a=n*this.neckHeightFactor,l=on.PlotUtils.getThirdPoint(e[e.length-2],r,0,n,!0),u=on.PlotUtils.getThirdPoint(e[e.length-2],r,0,a,!0),c=on.PlotUtils.getThirdPoint(r,l,on.Constants.HALF_PI,o,!1),h=on.PlotUtils.getThirdPoint(r,l,on.Constants.HALF_PI,o,!0);return[on.PlotUtils.getThirdPoint(r,u,on.Constants.HALF_PI,s,!1),c,r,h,on.PlotUtils.getThirdPoint(r,u,on.Constants.HALF_PI,s,!0)]},sn.algorithm.getArrowBodyPoints=function(e,t,i,n){for(var r=on.PlotUtils.wholeDistance(e),o=on.PlotUtils.getBaseLength(e)*n,s=(o-on.PlotUtils.distance(t,i))/2,a=0,l=[],u=[],c=1;c<e.length-1;c++){var h=on.PlotUtils.getAngleOfThreePoints(e[c-1],e[c],e[c+1])/2,d=(o/2-(a+=on.PlotUtils.distance(e[c-1],e[c]))/r*s)/Math.sin(h),p=on.PlotUtils.getThirdPoint(e[c-1],e[c],Math.PI-h,d,!0),f=on.PlotUtils.getThirdPoint(e[c-1],e[c],h,d,!1);l.push(p),u.push(f)}return l.concat(u)},sn.algorithm.getTempPoint4=function(e,t,i){var n,r,o,s,a=on.PlotUtils.mid(e,t),l=on.PlotUtils.distance(a,i),u=on.PlotUtils.getAngleOfThreePoints(e,a,i);return u<on.Constants.HALF_PI?(r=l*Math.sin(u),o=l*Math.cos(u),s=on.PlotUtils.getThirdPoint(e,a,on.Constants.HALF_PI,r,!1),n=on.PlotUtils.getThirdPoint(a,s,on.Constants.HALF_PI,o,!0)):u>=on.Constants.HALF_PI&&u<Math.PI?(r=l*Math.sin(Math.PI-u),o=l*Math.cos(Math.PI-u),s=on.PlotUtils.getThirdPoint(e,a,on.Constants.HALF_PI,r,!1),n=on.PlotUtils.getThirdPoint(a,s,on.Constants.HALF_PI,o,!1)):u>=Math.PI&&u<1.5*Math.PI?(r=l*Math.sin(u-Math.PI),o=l*Math.cos(u-Math.PI),s=on.PlotUtils.getThirdPoint(e,a,on.Constants.HALF_PI,r,!0),n=on.PlotUtils.getThirdPoint(a,s,on.Constants.HALF_PI,o,!0)):(r=l*Math.sin(2*Math.PI-u),o=l*Math.cos(2*Math.PI-u),s=on.PlotUtils.getThirdPoint(e,a,on.Constants.HALF_PI,r,!0),n=on.PlotUtils.getThirdPoint(a,s,on.Constants.HALF_PI,o,!1)),n},sn.algorithm.tailedAttackArrow=function(e){e=sn.algorithm.dereplication(e),this.tailWidthFactor=dn.tailWidthFactor,this.swallowTailFactor=dn.swallowTailFactor,this.swallowTailPnt=dn.swallowTailPnt;var t={controlPoint:null,polygonalPoint:null};if(t.controlPoint=e,!(2>(f=e.length))){if(2==e.length)return t.polygonalPoint=e,t;var i=e,n=i[0],r=i[1];on.PlotUtils.isClockWise(i[0],i[1],i[2])&&(n=i[1],r=i[0]);var o=[on.PlotUtils.mid(n,r)].concat(i.slice(2)),s=sn.algorithm.getAttackArrowHeadPoints(o,n,r,dn),a=s[0],l=s[4],u=on.PlotUtils.distance(n,r),c=on.PlotUtils.getBaseLength(o),h=c*this.tailWidthFactor*this.swallowTailFactor;this.swallowTailPnt=on.PlotUtils.getThirdPoint(o[1],o[0],0,h,!0);var d=u/c,p=sn.algorithm.getAttackArrowBodyPoints(o,a,l,d),f=p.length,m=[n].concat(p.slice(0,f/2));m.push(a);var g,v=[r].concat(p.slice(f/2,f));v.push(l),m=on.PlotUtils.getQBSplinePoints(m),v=on.PlotUtils.getQBSplinePoints(v),g=sn.algorithm.array2Dto1D(m.concat(s,v.reverse(),[this.swallowTailPnt,m[0]])),t.polygonalPoint=Cesium.Cartesian3.fromDegreesArray(g)}return t},sn.algorithm.getAttackArrowHeadPoints=function(e,t,i,n){this.headHeightFactor=n.headHeightFactor,this.headTailFactor=n.headTailFactor,this.headWidthFactor=n.headWidthFactor,this.neckWidthFactor=n.neckWidthFactor,this.neckHeightFactor=n.neckHeightFactor;var r=on.PlotUtils.getBaseLength(e),o=r*this.headHeightFactor,s=e[e.length-1];r=on.PlotUtils.distance(s,e[e.length-2]);var a=on.PlotUtils.distance(t,i);o>a*this.headTailFactor&&(o=a*this.headTailFactor);var l=o*this.headWidthFactor,u=o*this.neckWidthFactor,c=(o=o>r?r:o)*this.neckHeightFactor,h=on.PlotUtils.getThirdPoint(e[e.length-2],s,0,o,!0),d=on.PlotUtils.getThirdPoint(e[e.length-2],s,0,c,!0),p=on.PlotUtils.getThirdPoint(s,h,on.Constants.HALF_PI,l,!1),f=on.PlotUtils.getThirdPoint(s,h,on.Constants.HALF_PI,l,!0);return[on.PlotUtils.getThirdPoint(s,d,on.Constants.HALF_PI,u,!1),p,s,f,on.PlotUtils.getThirdPoint(s,d,on.Constants.HALF_PI,u,!0)]},sn.algorithm.getAttackArrowBodyPoints=function(e,t,i,n){for(var r=on.PlotUtils.wholeDistance(e),o=on.PlotUtils.getBaseLength(e)*n,s=(o-on.PlotUtils.distance(t,i))/2,a=0,l=[],u=[],c=1;c<e.length-1;c++){var h=on.PlotUtils.getAngleOfThreePoints(e[c-1],e[c],e[c+1])/2,d=(o/2-(a+=on.PlotUtils.distance(e[c-1],e[c]))/r*s)/Math.sin(h),p=on.PlotUtils.getThirdPoint(e[c-1],e[c],Math.PI-h,d,!0),f=on.PlotUtils.getThirdPoint(e[c-1],e[c],h,d,!1);l.push(p),u.push(f)}return l.concat(u)},sn.algorithm.dereplication=function(e){var t=e[e.length-1],i=!1,n=[];return n=e.filter((function(e){if(e[0]!=t[0]&&e[1]!=t[1])return e;i=!0})),i&&n.push(t),n},sn.algorithm.fineArrow=function(e,t){if(e.length<2||t.length<2)return;let i=pn.tailWidthFactor,n=pn.neckWidthFactor,r=pn.headWidthFactor,o=pn.headAngle,s=pn.neckAngle;var a=[];a[0]=e,a[1]=t;var l=a[0],u=a[1],c=on.PlotUtils.getBaseLength(a),h=c*i,d=c*n,p=c*r,f=on.PlotUtils.getThirdPoint(u,l,on.Constants.HALF_PI,h,!0),m=on.PlotUtils.getThirdPoint(u,l,on.Constants.HALF_PI,h,!1),g=on.PlotUtils.getThirdPoint(l,u,o,p,!1),v=on.PlotUtils.getThirdPoint(l,u,o,p,!0),y=on.PlotUtils.getThirdPoint(l,u,s,d,!1),_=on.PlotUtils.getThirdPoint(l,u,s,d,!0),b=[];return b.push(f[0],f[1],y[0],y[1],g[0],g[1],u[0],u[1],v[0],v[1],_[0],_[1],m[0],m[1],l[0],l[1]),Cesium.Cartesian3.fromDegreesArray(b)};var fn=function(e,t){this.type="StraightArrow",this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0)),this.viewer=e,this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.pointImageUrl="jt3dSDK/imgs/point/point.png",this.fillMaterial=Cesium.Color.fromCssColorString("#0000FF").withAlpha(.8),this.outlineMaterial=new Cesium.PolylineDashMaterialProperty({dashLength:16,color:Cesium.Color.fromCssColorString("#f00").withAlpha(.7)}),this.positions=[],this.firstPoint=null,this.floatPoint=null,this.arrowEntity=null,this.state=-1,this.selectPoint=null,this.clickStep=0,this.modifyHandler=null};fn.prototype={disable:function(){this.positions=[],this.firstPoint&&(this.viewer.entities.remove(this.firstPoint),this.firstPoint=null),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},disableHandler:function(){this.handler&&(this.handler.destroy(),this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null)},startDraw:function(){var e=this;this.state=1,this.handler.setInputAction((function(t){var i;(i=m.getCatesian3FromPX(e.viewer,t.position))&&(0==e.positions.length&&(e.firstPoint=e.creatPoint(i),e.firstPoint.type="firstPoint",e.floatPoint=e.creatPoint(i),e.floatPoint.type="floatPoint",e.positions.push(i)),3==e.positions.length&&(e.firstPoint.show=!1,e.floatPoint.show=!1,e.handler.destroy(),e.arrowEntity.objId=e.objId,e.state=-1),e.positions.push(i.clone()))}),Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction((function(t){var i;e.positions.length<1||(i=m.getCatesian3FromPX(e.viewer,t.endPosition))&&(e.floatPoint.position.setValue(i),e.positions.length>=2&&(Cesium.defined(e.arrowEntity)?(e.positions.pop(),e.positions.push(i)):(e.positions.push(i),e.arrowEntity=e.showArrowOnMap(e.positions))))}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)},startModify:function(){this.state=2,this.firstPoint.show=!0,this.floatPoint.show=!0;var e=this;this.clickStep=0,this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction((function(t){var i=e.viewer.scene.pick(t.position);if(Cesium.defined(i)&&i.id?(e.clickStep++,i.id.objId||(e.selectPoint=i.id)):(e.modifyHandler.destroy(),e.modifyHandler=null,e.firstPoint.show=!1,e.floatPoint.show=!1,e.state=-1),2==e.clickStep){var n;if(e.clickStep=0,!(n=m.getCatesian3FromPX(e.viewer,t.position)))return;e.selectPoint&&(e.selectPoint.position.setValue(n),e.selectPoint=null)}}),Cesium.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction((function(t){var i;e.selectPoint&&((i=m.getCatesian3FromPX(e.viewer,t.endPosition))&&(e.selectPoint.position.setValue(i),"firstPoint"==e.selectPoint.type&&(e.positions[1]=i),"floatPoint"==e.selectPoint.type&&(e.positions[2]=i)))}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)},createByData:function(e){this.state=-1,this.positions=[];for(var t=[],i=0;i<e.length;i++){var n=Cesium.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}this.positions=t,this.firstPoint=this.creatPoint(this.positions[1]),this.firstPoint.type="firstPoint",this.floatPoint=this.creatPoint(this.positions[2]),this.floatPoint.type="floatPoint",this.arrowEntity=this.showArrowOnMap(this.positions),this.firstPoint.show=!1,this.floatPoint.show=!1,this.arrowEntity.objId=this.objId},clear:function(){this.state=0,this.firstPoint&&this.viewer.entities.remove(this.firstPoint),this.floatPoint&&this.viewer.entities.remove(this.floatPoint),this.arrowEntity&&this.viewer.entities.remove(this.arrowEntity),this.state=-1},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){var t=this.viewer.entities.add({position:e,billboard:{image:this.pointImageUrl,verticalOrigin:Cesium.VerticalOrigin.BOTTOM,disableDepthTestDistance:Number.POSITIVE_INFINITY}});return t.attr="editPoint",t},showArrowOnMap:function(e){var t=this;return this.viewer.entities.add({polygon:new Cesium.PolygonGraphics({hierarchy:new Cesium.CallbackProperty((function(){if(e.length<2)return null;var i=e[1],n=e[2],r=t.cartesianToLatlng(i),o=t.cartesianToLatlng(n),s=[],a=sn.algorithm.fineArrow([r[0],r[1]],[o[0],o[1]]);if(-1!=JSON.stringify(a).indexOf("null"))return[];for(var l=0;l<a.length;l++){var u=new Cesium.Cartesian3(a[l].x,a[l].y,a[l].z);s.push(u)}return new Cesium.PolygonHierarchy(s)}),!1),show:!0,fill:!0,material:t.fillMaterial})})},cartesianToLatlng:function(e){var t=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),i=Cesium.Math.toDegrees(t.latitude);return[Cesium.Math.toDegrees(t.longitude),i]}};var mn=function(e,t){this.type="AttackArrow",this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0)),this.viewer=e,this.pointImageUrl="jt3dSDK/imgs/point/point.png",this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.fillMaterial=Cesium.Color.RED.withAlpha(.8),this.outlineMaterial=new Cesium.PolylineDashMaterialProperty({dashLength:16,color:Cesium.Color.fromCssColorString("#f00").withAlpha(.7)}),this.positions=[],this.state=-1,this.floatPoint=null,this.arrowEntity=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null};mn.prototype={disable:function(){this.positions=[],this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null);for(var e=0;e<this.pointArr.length;e++)this.pointArr[e]&&this.viewer.entities.remove(this.pointArr[e]);this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},disableHandler:function(){this.handler&&(this.handler.destroy(),this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null)},startDraw:function(){var e=this;this.state=1,this.handler.setInputAction((function(t){var i;if(i=m.getCatesian3FromPX(e.viewer,t.position)){0==e.positions.length&&(e.floatPoint=e.creatPoint(i),e.floatPoint.wz=-1),e.positions.push(i);var n=e.creatPoint(i);e.positions.length>2?n.wz=e.positions.length-1:n.wz=e.positions.length,e.pointArr.push(n)}}),Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction((function(t){var i;e.positions.length<2||(i=m.getCatesian3FromPX(e.viewer,t.endPosition))&&(e.floatPoint.position.setValue(i),e.positions.length>=2&&(Cesium.defined(e.arrowEntity)?(e.positions.pop(),e.positions.push(i)):(e.positions.push(i),e.arrowEntity=e.showArrowOnMap(e.positions),e.arrowEntity.objId=e.objId)))}),Cesium.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction((function(t){var i;if(i=m.getCatesian3FromPX(e.viewer,t.position)){for(var n=0;n<e.pointArr.length;n++)e.pointArr[n].show=!1;e.floatPoint.show=!1,e.viewer.entities.remove(e.floatPoint),e.floatPoint=null;var r=e.creatPoint(i);r.show=!1,r.wz=e.positions.length,e.pointArr.push(r),e.handler.destroy()}}),Cesium.ScreenSpaceEventType.RIGHT_CLICK)},createByData:function(e){this.positions=[],this.state=-1,this.floatPoint=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null;for(var t=[],i=0;i<e.length;i++){var n=Cesium.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}this.positions=t;for(i=0;i<this.positions.length;i++){var r=this.creatPoint(this.positions[i]);r.show=!1,r.wz=i+1,this.pointArr.push(r)}this.arrowEntity=this.showArrowOnMap(this.positions),this.arrowEntity.objId=this.objId},startModify:function(){this.state=2;for(var e=this,t=0;t<e.pointArr.length;t++)e.pointArr[t].show=!0;this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction((function(t){var i=e.viewer.scene.pick(t.position);if(Cesium.defined(i)&&i.id)e.clickStep++,i.id.objId||(e.selectPoint=i.id);else{for(var n=0;n<e.pointArr.length;n++)e.pointArr[n].show=!1;e.floatPoint&&(e.floatPoint.show=!1),e.state=-1,e.modifyHandler.destroy(),e.modifyHandler=null}if(2==e.clickStep){var r;if(e.clickStep=0,!(r=m.getCatesian3FromPX(e.viewer,t.position)))return;e.selectPoint&&(e.selectPoint.position.setValue(r),e.selectPoint=null)}}),Cesium.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction((function(t){var i;(i=m.getCatesian3FromPX(e.viewer,t.endPosition))&&e.selectPoint&&(e.selectPoint.position.setValue(i),e.positions[e.selectPoint.wz-1]=i)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)},clear:function(){this.state=0;for(var e=0;e<this.pointArr.length;e++)this.pointArr[e]&&this.viewer.entities.remove(this.pointArr[e]);this.floatPoint&&this.viewer.entities.remove(this.floatPoint),this.arrowEntity&&this.viewer.entities.remove(this.arrowEntity),this.state=-1},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){var t=this.viewer.entities.add({position:e,billboard:{image:this.pointImageUrl,verticalOrigin:Cesium.VerticalOrigin.BOTTOM}});return t.attr="editPoint",t},showArrowOnMap:function(e){var t=this;return this.viewer.entities.add({polygon:new Cesium.PolygonGraphics({hierarchy:new Cesium.CallbackProperty((function(){if(e.length<3)return null;for(var i=[],n=0;n<e.length;n++){var r=t.cartesianToLatlng(e[n]);i.push(r)}var o=sn.algorithm.tailedAttackArrow(i),s=[];return-1==JSON.stringify(o.polygonalPoint).indexOf("null")&&(s=o.polygonalPoint),new Cesium.PolygonHierarchy(s)}),!1),show:!0,fill:!0,material:t.fillMaterial})})},cartesianToLatlng:function(e){var t=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),i=Cesium.Math.toDegrees(t.latitude);return[Cesium.Math.toDegrees(t.longitude),i]}};var gn=function(e,t){this.type="PincerArrow",this.objId=Number((new Date).getTime()+""+Number(1e3*Math.random()).toFixed(0)),this.viewer=e,this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.pointImageUrl="jt3dSDK/imgs/point/point.png",this.fillMaterial=Cesium.Color.YELLOW.withAlpha(.8),this.outlineMaterial=new Cesium.PolylineDashMaterialProperty({dashLength:16,color:Cesium.Color.fromCssColorString("#f00").withAlpha(.7)}),this.positions=[],this.state=-1,this.floatPoint=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null};gn.prototype={disable:function(){this.positions=[],this.arrowEntity&&(this.viewer.entities.remove(this.arrowEntity),this.arrowEntity=null),this.state=-1,this.handler&&(this.handler.destroy(),this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.floatPoint&&(this.viewer.entities.remove(this.floatPoint),this.floatPoint=null),this.selectPoint&&(this.viewer.entities.remove(this.selectPoint),this.selectPoint=null);for(var e=0;e<this.pointArr.length;e++)this.pointArr[e]&&this.viewer.entities.remove(this.pointArr[e]);this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null),this.clickStep=0},disableHandler:function(){this.handler&&(this.handler.destroy(),this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler&&(this.modifyHandler.destroy(),this.modifyHandler=null)},startDraw:function(){var e=this;this.state=1,this.handler.setInputAction((function(t){var i;if(i=m.getCatesian3FromPX(e.viewer,t.position)){if(0==e.positions.length&&(e.floatPoint=e.creatPoint(i)),e.positions.length>4){(r=e.creatPoint(i)).wz=e.positions.length,e.pointArr.push(r);for(var n=0;n<e.pointArr.length;n++)e.pointArr[n].show=!1;return e.floatPoint&&(e.floatPoint.show=!1,e.viewer.entities.remove(e.floatPoint),e.floatPoint=null),void e.handler.destroy()}e.positions.push(i);var r=e.creatPoint(i);e.positions.length>2?r.wz=e.positions.length-1:r.wz=e.positions.length,e.pointArr.push(r)}}),Cesium.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction((function(t){var i;e.positions.length<2||(i=m.getCatesian3FromPX(e.viewer,t.endPosition))&&(e.floatPoint.position.setValue(i),e.positions.length>=2&&(Cesium.defined(e.arrowEntity)?(e.positions.pop(),e.positions.push(i)):(e.positions.push(i),e.arrowEntity=e.showArrowOnMap(e.positions),e.arrowEntity.objId=e.objId)))}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)},createByData:function(e){this.positions=[],this.state=-1,this.floatPoint=null,this.pointArr=[],this.selectPoint=null,this.clickStep=0,this.modifyHandler=null;for(var t=[],i=0;i<e.length;i++){var n=Cesium.Cartesian3.fromDegrees(e[i][0],e[i][1]);t.push(n)}this.positions=t;for(i=0;i<this.positions.length;i++){var r=this.creatPoint(this.positions[i]);r.show=!1,r.wz=i+1,this.pointArr.push(r)}this.arrowEntity=this.showArrowOnMap(this.positions),this.arrowEntity.objId=this.objId},startModify:function(){this.state=2;for(var e=this,t=0;t<e.pointArr.length;t++)e.pointArr[t].show=!0;this.modifyHandler||(this.modifyHandler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas)),this.modifyHandler.setInputAction((function(t){var i=e.viewer.scene.pick(t.position);if(Cesium.defined(i)&&i.id)e.clickStep++,i.id.objId||(e.selectPoint=i.id);else{for(var n=0;n<e.pointArr.length;n++)e.pointArr[n].show=!1;e.state=-1,e.modifyHandler.destroy(),e.modifyHandler=null}if(2==e.clickStep){var r;if(e.clickStep=0,!(r=m.getCatesian3FromPX(e.viewer,t.position)))return;e.selectPoint&&(e.selectPoint.position.setValue(r),e.selectPoint=null)}}),Cesium.ScreenSpaceEventType.LEFT_CLICK),this.modifyHandler.setInputAction((function(t){var i;(i=m.getCatesian3FromPX(e.viewer,t.endPosition))&&e.selectPoint&&(e.selectPoint.position.setValue(i),e.positions[e.selectPoint.wz-1]=i)}),Cesium.ScreenSpaceEventType.MOUSE_MOVE)},clear:function(){this.state=0;for(var e=0;e<this.pointArr.length;e++)this.pointArr[e]&&this.viewer.entities.remove(this.pointArr[e]);this.floatPoint&&this.viewer.entities.remove(this.floatPoint),this.arrowEntity&&this.viewer.entities.remove(this.arrowEntity),this.state=-1},getLnglats:function(){for(var e=[],t=0;t<this.positions.length;t++){var i=this.cartesianToLatlng(this.positions[t]);e.push(i)}return e},getPositions:function(){return this.positions},creatPoint:function(e){return this.viewer.entities.add({position:e,billboard:{image:this.pointImageUrl,verticalOrigin:Cesium.VerticalOrigin.BOTTOM}})},showArrowOnMap:function(e){var t=this;return this.viewer.entities.add({polygon:new Cesium.PolygonGraphics({hierarchy:new Cesium.CallbackProperty((function(){if(e.length<3)return null;for(var i=[],n=0;n<e.length;n++){var r=t.cartesianToLatlng(e[n]);i.push(r)}var o=sn.algorithm.doubleArrow(i),s=[];return-1==JSON.stringify(o.polygonalPoint).indexOf("null")&&(s=o.polygonalPoint),new Cesium.PolygonHierarchy(s)}),!1),show:!0,fill:!0,material:t.fillMaterial})})},cartesianToLatlng:function(e){var t=this.viewer.scene.globe.ellipsoid.cartesianToCartographic(e),i=Cesium.Math.toDegrees(t.latitude);return[Cesium.Math.toDegrees(t.longitude),i]}};class vn{constructor(e){if(!e)throw new DeveloperError("no viewer object!");this.viewer=e,this.isActivate=!1,this.drawArr=[],this.handler=null,this.nowArrowObj=null,this.init()}init(){this.isActivate||(this.isActivate=!0,this.bindEdit())}bindEdit(){var e=this;this.handler=new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas),this.handler.setInputAction((function(t){var i=e.viewer.scene.pick(t.position);if(Cesium.defined(i)&&i.id){if(e.nowArrowObj&&-1!=e.nowArrowObj.state)return void console.log("上一步操作未结束,请继续完成上一步!");for(var n=0;n<e.drawArr.length;n++)if(i.id.objId==e.drawArr[n].objId){e.nowArrowObj=e.drawArr[n],e.drawArr[n].startModify();break}}}),Cesium.ScreenSpaceEventType.LEFT_CLICK)}}Object.assign(vn.prototype,{draw:function(e){for(var t=0;t<this.drawArr.length;t++)this.drawArr[t].disableHandler();switch(e.type){case vn.DrawType.StraightArrow:var i=new fn(this.viewer,e);i.startDraw(),this.drawArr.push(i);break;case vn.DrawType.AttackArrow:var n=new mn(this.viewer,e);n.startDraw(),this.drawArr.push(n);break;case vn.DrawType.PincerArrow:var r=new gn(this.viewer,e);r.startDraw(),this.drawArr.push(r)}},saveData:function(){return new Promise(((e,t)=>{for(var i={straightArrowData:[],attackArrowData:[],pincerArrowData:[]},n=0;n<this.drawArr.length;n++){var r=this.drawArr[n],o=r.getLnglats();"StraightArrow"==r.type?i.straightArrowData.push(o):"AttackArrow"==r.type?i.attackArrowData.push(o):i.pincerArrowData.push(o)}e(i)}))},showData:function(e){if(e){for(var t=e.straightArrowData,i=e.attackArrowData,n=e.pincerArrowData,r=0;r<t.length;r++){var o=t[r],s=new fn(viewer);s.createByData(o),this.drawArr.push(s)}for(var a=0;a<i.length;a++){o=i[a];var l=new mn(viewer);l.createByData(o),this.drawArr.push(l)}for(var u=0;u<n.length;u++){o=n[u];var c=new gn(viewer);c.createByData(o),this.drawArr.push(c)}}},clearOne:function(){var e=this;this.handler.setInputAction((function(t){var i=viewer.scene.pick(t.position);if(Cesium.defined(i)&&i.id){for(var n=0;n<e.drawArr.length;n++)if(i.id.objId==e.drawArr[n].objId){e.drawArr[n].clear(),e.drawArr.splice(n,1);break}e.handler.destroy(),e.bindEdit()}}),Cesium.ScreenSpaceEventType.LEFT_CLICK)},clearAll:function(){for(var e=0;e<this.drawArr.length;e++)this.drawArr[e].clear()}}),vn.DrawType=Object.freeze({StraightArrow:"straightArrow",AttackArrow:"attackArrow",PincerArrow:"pincerArrow"});class yn{constructor(e,t,i,n){document.getElementsByClassName("MultiField-popup").length>0&&document.getElementsByClassName("MultiField-popup")[0].remove(),this.viewer=e,this.position=t,this.id="popup_"+fi(),this.popupDiv=document.createElement("div"),this.popupDiv.classList.add("MultiField-popup"),this.popupDiv.id=this.id,this.viewer.container.append(this.popupDiv),this.popupDiv.innerHTML=this._createHtml(i,n),this._render(this.position),this.eventListener=this.viewer.clock.onTick.addEventListener((e=>{this._render(this.position)})),document.getElementsByClassName("leaflet-popup-close-button")[0].onclick=()=>{this.close()}}_render(e){var t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e);null!=t&&(this.popupDiv.style.left=t.x-this.popupDiv.offsetWidth/2+"px",this.popupDiv.style.top=t.y-this.popupDiv.offsetHeight+40+"px"),this.viewer.camera.positionCartographic.height>2e5?this.popupDiv.style.display="none":this.popupDiv.style.display="block"}_createHtml(e,t){return'\n\t\t\t<div class="MultiField-popup-header">\n\t\t\t\t'+e+'\n\t\t\t\t<span class="leaflet-popup-close-button">×</span>\n\t\t\t</div>\n\t\t\t<div class="MultiField-popup-content">\n\t\t\t\t\t'+this._createTable(t)+'\n\t\t\t</div>\n\t\t\t<div class="MultiField-popup-tip">\n\t\t\t</div>\n\t\t'}_createTable(e){let t='<table class="table-popup">';for(let i in e)t+=`<tr><td class="title-popup">${i}</td>\n <td class="value-popup">${e[i]}</td></tr>`;return t+="</table>",t}}Object.assign(yn.prototype,{close(){this.popupDiv.remove(),this.viewer.clock.onTick.removeEventListener(this.eventListener)}});var _n,bn="undefined"!=typeof window?window:void 0!==te?te:"undefined"!=typeof self?self:{},Cn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:{}}),Tn=void 0!==te?te:"undefined"!=typeof window?window:{},wn=ne(Cn);"undefined"!=typeof document?_n=document:(_n=Tn["__GLOBAL_DOCUMENT_CACHE@4"])||(_n=Tn["__GLOBAL_DOCUMENT_CACHE@4"]=wn);var En=_n;function Sn(){return(Sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}var kn={exports:{}};!function(e,t){function i(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return s[e];var i,o=String(e);return(i=n[o.toLowerCase()])?i:(i=r[o.toLowerCase()])||(1===o.length?o.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){var o;if(o=n[t.toLowerCase()])return o===i;if(o=r[t.toLowerCase()])return o===i}else if("number"==typeof t)return t===i;return!1}};var n=(t=e.exports=i).code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};
- /*!
- * Programatically add the following
- */
- for(o=97;o<123;o++)n[String.fromCharCode(o)]=o-32;for(var o=48;o<58;o++)n[o-48]=o;for(o=1;o<13;o++)n["f"+o]=o+111;for(o=0;o<10;o++)n["numpad "+o]=o+96;var s=t.names=t.title={};for(o in n)s[n[o]]=o;for(var a in r)n[a]=r[a]}(kn,kn.exports);var Pn=kn.exports;function An(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xn(e,t){return(xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function In(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,xn(e,t)}var Mn=function(e,t){var i,n=null;try{i=JSON.parse(e,t)}catch(r){n=r}return[n,i]};var Ln={exports:{}},Dn={exports:{}};!function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(this,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Dn);var On=function(e){if(!e)return!1;var t=jn.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)},jn=Object.prototype.toString;var Rn=bn;var Nn=function(e,t){return void 0===t&&(t=!1),function(i,n,r){if(i)e(i);else if(n.statusCode>=400&&n.statusCode<=599){var o=r;if(t)if(Rn.TextDecoder){var s=function(e){void 0===e&&(e="");return e.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),n=i[0],r=i[1];return"charset"===n.trim()?r.trim():e}),"utf-8")}(n.headers&&n.headers["content-type"]);try{o=new TextDecoder(s).decode(r)}catch(a){}}else o=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:o})}else e(null,r)}},Un=bn,Bn=Dn.exports,Fn=On;Hn.httpHandler=Nn;function Wn(e,t,i){var n=e;return Fn(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=Bn({},t,{uri:e}),n.callback=i,n}function Hn(e,t,i){return Vn(t=Wn(e,t,i))}function Vn(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=l.response?l.response:l.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(i){}return null}(l),m)try{e=JSON.parse(e)}catch(t){}return e}function r(e){return clearTimeout(u),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,g)}function o(){if(!a){var t;clearTimeout(u),t=e.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var r=g,o=null;return 0!==t?(r={body:n(),statusCode:t,method:h,headers:{},url:c,rawRequest:l},l.getAllResponseHeaders&&(r.headers=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();void 0===t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t):t}(l.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),i(o,r,r.body)}}var s,a,l=e.xhr||null;l||(l=e.cors||e.useXDR?new Hn.XDomainRequest:new Hn.XMLHttpRequest);var u,c=l.url=e.uri||e.url,h=l.method=e.method||"GET",d=e.body||e.data,p=l.headers=e.headers||{},f=!!e.sync,m=!1,g={body:void 0,headers:{},statusCode:0,method:h,url:c,rawRequest:l};if("json"in e&&!1!==e.json&&(m=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==h&&"HEAD"!==h&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),d=JSON.stringify(!0===e.json?d:e.json))),l.onreadystatechange=function(){4===l.readyState&&setTimeout(o,0)},l.onload=o,l.onerror=r,l.onprogress=function(){},l.onabort=function(){a=!0},l.ontimeout=r,l.open(h,c,!f,e.username,e.password),f||(l.withCredentials=!!e.withCredentials),!f&&e.timeout>0&&(u=setTimeout((function(){if(!a){a=!0,l.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),l.setRequestHeader)for(s in p)p.hasOwnProperty(s)&&l.setRequestHeader(s,p[s]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(l.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(l),l.send(d||null),l}Ln.exports=Hn,Ln.exports.default=Hn,Hn.XMLHttpRequest=Un.XMLHttpRequest||function(){},Hn.XDomainRequest="withCredentials"in new Hn.XMLHttpRequest?Hn.XMLHttpRequest:Un.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],(function(e){Hn["delete"===e?"del":e]=function(t,i,n){return(i=Wn(t,i,n)).method=e.toUpperCase(),Vn(i)}}));var Gn=Ln.exports,zn={exports:{}},Yn=En,qn=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function Xn(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function Zn(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/1e3}var i=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return i?i[3]?t(i[1],i[2],i[3].replace(":",""),i[4]):i[1]>59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function Qn(){this.values=qn(null)}function Kn(e,t,i,n){var r=n?e.split(n):[e];for(var o in r)if("string"==typeof r[o]){var s=r[o].split(i);if(2===s.length)t(s[0].trim(),s[1].trim())}}function Jn(e,t,i){var n=e;function r(){var t=Zn(e);if(null===t)throw new Xn(Xn.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function o(){e=e.replace(/^\s+/,"")}if(o(),t.startTime=r(),o(),"--\x3e"!==e.substr(0,3))throw new Xn(Xn.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),o(),t.endTime=r(),o(),function(e,t){var n=new Qn;Kn(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var o=t.split(","),s=o[0];n.integer(e,s),n.percent(e,s)&&n.set("snapToLines",!1),n.alt(e,s,["auto"]),2===o.length&&n.alt("lineAlign",o[1],["start","center","end"]);break;case"position":o=t.split(","),n.percent(e,o[0]),2===o.length&&n.alt("positionAlign",o[1],["start","center","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(r){}t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100);try{t.align=n.get("align","center")}catch(r){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(r){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}Xn.prototype=qn(Error.prototype),Xn.prototype.constructor=Xn,Xn.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},Qn.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var $n=Yn.createElement&&Yn.createElement("textarea"),er={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},tr={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},ir={v:"title",lang:"lang"},nr={rt:"ruby"};function rr(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(t,i){var n=er[t];if(!n)return null;var r=e.document.createElement(n),o=ir[t];return o&&i&&(r[o]=i.trim()),r}for(var r,o,s,a,l=e.document.createElement("div"),u=l,c=[];null!==(r=i());)if("<"!==r[0])u.appendChild(e.document.createTextNode((o=r,$n.innerHTML=o,o=$n.textContent,$n.textContent="",o)));else{if("/"===r[1]){c.length&&c[c.length-1]===r.substr(2).replace(">","")&&(c.pop(),u=u.parentNode);continue}var h,d=Zn(r.substr(1,r.length-2));if(d){h=e.document.createProcessingInstruction("timestamp",d),u.appendChild(h);continue}var p=r.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!p)continue;if(!(h=n(p[1],p[3])))continue;if(s=u,nr[(a=h).localName]&&nr[a.localName]!==s.localName)continue;if(p[2]){var f=p[2].split(".");f.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(tr.hasOwnProperty(i)){var n=t?"background-color":"color",r=tr[i];h.style[n]=r}})),h.className=f.join(" ")}c.push(p[1]),u.appendChild(h),u=h}return l}var or=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function sr(e){for(var t=0;t<or.length;t++){var i=or[t];if(e>=i[0]&&e<=i[1])return!0}return!1}function ar(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var o=i.match(/^.*(\n|\r)/);return o?(e.length=0,o[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var o=0;o<i.length;o++)if(sr(i.charCodeAt(o)))return"rtl";return"ltr"}function lr(){}function ur(e,t,i){lr.call(this),this.cue=t,this.cueDiv=rr(e,t.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:ar(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function cr(e){var t,i,n,r;if(e.div){i=e.div.offsetHeight,n=e.div.offsetWidth,r=e.div.offsetTop;var o=(o=e.div.childNodes)&&(o=o[0])&&o.getClientRects&&o.getClientRects();e=e.div.getBoundingClientRect(),t=o?Math.max(o[0]&&o[0].height||0,e.height/o.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||i,this.bottom=e.bottom||r+(e.height||i),this.width=e.width||n,this.lineHeight=void 0!==t?t:e.lineHeight}function hr(e,t,i,n){var r=new cr(t),o=t.cue,s=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(o),a=[];if(o.snapToLines){var l;switch(o.vertical){case"":a=["+y","-y"],l="height";break;case"rl":a=["+x","-x"],l="width";break;case"lr":a=["-x","+x"],l="width"}var u=r.lineHeight,c=u*Math.round(s),h=i[l]+u,d=a[0];Math.abs(c)>h&&(c=c<0?-1:1,c*=Math.ceil(h/u)*u),s<0&&(c+=""===o.vertical?i.height:i.width,a=a.reverse()),r.move(d,c)}else{var p=r.lineHeight/i.height*100;switch(o.lineAlign){case"center":s-=p/2;break;case"end":s-=p}switch(o.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}a=["+y","-x","+x","-y"],r=new cr(t)}var f=function(e,t){for(var r,o=new cr(e),s=1,a=0;a<t.length;a++){for(;e.overlapsOppositeAxis(i,t[a])||e.within(i)&&e.overlapsAny(n);)e.move(t[a]);if(e.within(i))return e;var l=e.intersectPercentage(i);s>l&&(r=new cr(e),s=l),e=new cr(o)}return r||o}(r,a);t.move(f.toCSSCompatValues(i))}function dr(){}lr.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},lr.prototype.formatStyle=function(e,t){return 0===e?0:e+t},ur.prototype=qn(lr.prototype),ur.prototype.constructor=ur,cr.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},cr.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},cr.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},cr.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},cr.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},cr.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},cr.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},cr.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},dr.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},dr.convertCueToDOMTree=function(e,t){return e&&t?rr(e,t):null};dr.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],o=cr.getSimpleBoxPosition(n),s={font:Math.round(.05*o.height*100)/100+"px sans-serif"};!function(){for(var i,a,l=0;l<t.length;l++)a=t[l],i=new ur(e,a,s),n.appendChild(i.div),hr(0,i,o,r),a.displayState=i.div,r.push(cr.getSimpleBoxPosition(i))}()}else for(var a=0;a<t.length;a++)n.appendChild(t[a].displayState)},dr.Parser=function(e,t,i){i||(i=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=i||new TextDecoder("utf8"),this.regionList=[]},dr.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof Xn))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function i(){for(var e=t.buffer,i=0;i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;var n=e.substr(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.substr(i),n}function n(e){e.match(/X-TIMESTAMP-MAP/)?Kn(e,(function(e,i){switch(e){case"X-TIMESTAMP-MAP":!function(e){var i=new Qn;Kn(e,(function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",Zn(t))}}),/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}(i)}}),/=/):Kn(e,(function(e,i){switch(e){case"Region":!function(e){var i=new Qn;if(Kn(e,(function(e,t){switch(e){case"id":i.set(e,t);break;case"width":i.percent(e,t);break;case"lines":i.integer(e,t);break;case"regionanchor":case"viewportanchor":var n=t.split(",");if(2!==n.length)break;var r=new Qn;if(r.percent("x",n[0]),r.percent("y",n[1]),!r.has("x")||!r.has("y"))break;i.set(e+"X",r.get("x")),i.set(e+"Y",r.get("y"));break;case"scroll":i.alt(e,t,["up"])}}),/=/,/\s/),i.has("id")){var n=new(t.vttjs.VTTRegion||t.window.VTTRegion);n.width=i.get("width",100),n.lines=i.get("lines",3),n.regionAnchorX=i.get("regionanchorX",0),n.regionAnchorY=i.get("regionanchorY",100),n.viewportAnchorX=i.get("viewportanchorX",0),n.viewportAnchorY=i.get("viewportanchorY",100),n.scroll=i.get("scroll",""),t.onregion&&t.onregion(n),t.regionList.push({id:i.get("id"),region:n})}}(i)}}),/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var o=(r=i()).match(/^WEBVTT([ \t].*)?$/);if(!o||!o[0])throw new Xn(Xn.Errors.BadSignature);t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(l){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{Jn(r,t.cue,t.regionList)}catch(l){t.reportOrThrowError(l),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var a=-1!==r.indexOf("--\x3e");if(!r||a&&(s=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(l){t.reportOrThrowError(l),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new Xn(Xn.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var pr=dr,fr={"":1,lr:1,rl:1},mr={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function gr(e){return"string"==typeof e&&(!!mr[e.toLowerCase()]&&e.toLowerCase())}function vr(e,t,i){this.hasBeenReset=!1;var n="",r=!1,o=e,s=t,a=i,l=null,u="",c=!0,h="auto",d="start",p="auto",f="auto",m=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(e){n=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");o=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");s=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return a},set:function(e){a=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(e){l=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return u},set:function(e){var t=function(e){return"string"==typeof e&&!!fr[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");u=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return h},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");h=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return d},set:function(e){var t=gr(e);t?(d=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=gr(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=gr(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}vr.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var yr=vr,_r={"":!0,up:!0};function br(e){return"number"==typeof e&&e>=0&&e<=100}var Cr=function(){var e=100,t=3,i=0,n=100,r=0,o=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!br(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!br(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!br(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return o},set:function(e){if(!br(e))throw new Error("ViewportAnchorY must be between 0 and 100.");o=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!br(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"==typeof e&&!!_r[e.toLowerCase()]&&e.toLowerCase()}(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):s=t}}})},Tr=bn,wr=zn.exports={WebVTT:pr,VTTCue:yr,VTTRegion:Cr};Tr.vttjs=wr,Tr.WebVTT=wr.WebVTT;var Er=wr.VTTCue,Sr=wr.VTTRegion,kr=Tr.VTTCue,Pr=Tr.VTTRegion;wr.shim=function(){Tr.VTTCue=Er,Tr.VTTRegion=Sr},wr.restore=function(){Tr.VTTCue=kr,Tr.VTTRegion=Pr},Tr.VTTCue||wr.shim();var Ar=zn.exports;function xr(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Ir(e,t,i){return(Ir=xr()?Reflect.construct.bind():function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&xn(r,i.prototype),r}).apply(null,arguments)}var Mr,Lr,Dr,Or,jr,Rr={exports:{}};Mr=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,Lr=/^(?=([^\/?#]*))\1([^]*)$/,Dr=/(?:\/|^)\.(?=\/)/g,Or=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,Rr.exports=jr={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var n=jr.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=jr.normalizePath(n.path),jr.buildURLFromParts(n)}var r=jr.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=jr.normalizePath(r.path),jr.buildURLFromParts(r)):t;var o=jr.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var s=Lr.exec(o.path);o.netLoc=s[1],o.path=s[2]}o.netLoc&&!o.path&&(o.path="/");var a={scheme:o.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(a.netLoc=o.netLoc,"/"!==r.path[0]))if(r.path){var l=o.path,u=l.substring(0,l.lastIndexOf("/")+1)+r.path;a.path=jr.normalizePath(u)}else a.path=o.path,r.params||(a.params=o.params,r.query||(a.query=o.query));return null===a.path&&(a.path=i.alwaysNormalize?jr.normalizePath(r.path):r.path),jr.buildURLFromParts(a)},parseURL:function(e){var t=Mr.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(Dr,"");e.length!==(e=e.replace(Or,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};var Nr=Rr.exports,Ur="http://example.com",Br=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=bn.location&&bn.location.href||"");var i="function"==typeof bn.URL,n=/^\/\//.test(e),r=!bn.location&&!/\/\//i.test(e);if(i?e=new bn.URL(e,bn.location||Ur):/\/\//i.test(e)||(e=Nr.buildAbsoluteURL(bn.location&&bn.location.href||"",e)),i){var o=new URL(t,e);return r?o.href.slice(Ur.length):n?o.href.slice(o.protocol.length):o.href}return Nr.buildAbsoluteURL(e,t)},Fr=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),o=t.length,s=0;s<o;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();function Wr(e){for(var t,i=(t=e,bn.atob?bn.atob(t):Buffer.from(t,"base64").toString("binary")),n=new Uint8Array(i.length),r=0;r<i.length;r++)n[r]=i.charCodeAt(r);return n}
- /*! @name m3u8-parser @version 4.7.1 @license Apache-2.0 */var Hr,Vr,Gr=function(e){function t(){var t;return(t=e.call(this)||this).buffer="",t}return In(t,e),t.prototype.push=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(Fr),zr=String.fromCharCode(9),Yr=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},qr=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n},Xr=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}In(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r<n.customParsers.length;r++)if(n.customParsers[r].call(n,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))n.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),void n.trigger("data",i);if(t=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),void n.trigger("data",i);if(t=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),void n.trigger("data",i);if(t=/^#EXT-X-BYTERANGE:?(.*)?$/.exec(e))return i=Sn(Yr(t[1]),{type:"tag",tagType:"byterange"}),void n.trigger("data",i);if(t=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-MAP:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"map"},t[1]){var o=qr(t[1]);o.URI&&(i.uri=o.URI),o.BYTERANGE&&(i.byterange=Yr(o.BYTERANGE))}n.trigger("data",i)}else if(t=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e)){if(i={type:"tag",tagType:"stream-inf"},t[1]){if(i.attributes=qr(t[1]),i.attributes.RESOLUTION){var s=i.attributes.RESOLUTION.split("x"),a={};s[0]&&(a.width=parseInt(s[0],10)),s[1]&&(a.height=parseInt(s[1],10)),i.attributes.RESOLUTION=a}i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))}n.trigger("data",i)}else{if(t=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return i={type:"tag",tagType:"media"},t[1]&&(i.attributes=qr(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-ENDLIST/.exec(e))n.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))n.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))return i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),void n.trigger("data",i);if(t=/^#EXT-X-KEY:?(.*)$/.exec(e))return i={type:"tag",tagType:"key"},t[1]&&(i.attributes=qr(t[1]),i.attributes.IV&&("0x"===i.attributes.IV.substring(0,2).toLowerCase()&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),void n.trigger("data",i);if(t=/^#EXT-X-START:?(.*)$/.exec(e))return i={type:"tag",tagType:"start"},t[1]&&(i.attributes=qr(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",void n.trigger("data",i);if((t=/^#EXT-X-SKIP:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"skip"}).attributes=qr(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(zr)),void n.trigger("data",i);if((t=/^#EXT-X-PART:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"part"}).attributes=qr(t[1]),["DURATION"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["INDEPENDENT","GAP"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Yr(i.attributes.BYTERANGE)),void n.trigger("data",i);if((t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"server-control"}).attributes=qr(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=/YES/.test(i.attributes[e]))})),void n.trigger("data",i);if((t=/^#EXT-X-PART-INF:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"part-inf"}).attributes=qr(t[1]),["PART-TARGET"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseFloat(i.attributes[e]))})),void n.trigger("data",i);if((t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"preload-hint"}).attributes=qr(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach((function(e){if(i.attributes.hasOwnProperty(e)){i.attributes[e]=parseInt(i.attributes[e],10);var t="BYTERANGE-LENGTH"===e?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[t]=i.attributes[e],delete i.attributes[e]}})),void n.trigger("data",i);if((t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e))&&t[1])return(i={type:"tag",tagType:"rendition-report"}).attributes=qr(t[1]),["LAST-MSN","LAST-PART"].forEach((function(e){i.attributes.hasOwnProperty(e)&&(i.attributes[e]=parseInt(i.attributes[e],10))})),void n.trigger("data",i);n.trigger("data",{type:"tag",data:e.slice(4)})}}}else n.trigger("data",{type:"comment",text:e.slice(1)})})):this.trigger("data",{type:"uri",uri:e}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,o=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push((function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:n,segment:o}),!0}))},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push((function(e){return t.test(e)?i(e):e}))},t}(Fr),Zr=function(e){var t={};return Object.keys(e).forEach((function(i){var n;t[(n=i,n.toLowerCase().replace(/-(\w)/g,(function(e){return e[1].toUpperCase()})))]=e[i]})),t},Qr=function(e){var t=e.serverControl,i=e.targetDuration,n=e.partTargetDuration;if(t){var r="#EXT-X-SERVER-CONTROL",o="holdBack",s="partHoldBack",a=i&&3*i,l=n&&2*n;i&&!t.hasOwnProperty(o)&&(t[o]=a,this.trigger("info",{message:r+" defaulting HOLD-BACK to targetDuration * 3 ("+a+")."})),a&&t[o]<a&&(this.trigger("warn",{message:r+" clamping HOLD-BACK ("+t[o]+") to targetDuration * 3 ("+a+")"}),t[o]=a),n&&!t.hasOwnProperty(s)&&(t[s]=3*n,this.trigger("info",{message:r+" defaulting PART-HOLD-BACK to partTargetDuration * 3 ("+t[s]+")."})),n&&t[s]<l&&(this.trigger("warn",{message:r+" clamping PART-HOLD-BACK ("+t[s]+") to partTargetDuration * 2 ("+l+")."}),t[s]=l)}},Kr=function(e){function t(){var t;(t=e.call(this)||this).lineStream=new Gr,t.parseStream=new Xr,t.lineStream.pipe(t.parseStream);var i,n,r=An(t),o=[],s={},a=!1,l=function(){},u={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},c=0;t.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};var h=0,d=0;return t.on("end",(function(){s.uri||!s.parts&&!s.preloadHints||(!s.map&&i&&(s.map=i),!s.key&&n&&(s.key=n),s.timeline||"number"!=typeof c||(s.timeline=c),t.manifest.preloadSegment=s)})),t.parseStream.on("data",(function(e){var t,p;({tag:function(){({version:function(){e.version&&(this.manifest.version=e.version)},"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(s.byterange=t,t.length=e.length,"offset"in e||(e.offset=h)),"offset"in e&&(s.byterange=t,t.offset=e.offset),h=t.offset+t.length},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),e.duration>0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=o},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("com.microsoft.playready"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:e.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:Wr(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,c=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),n&&(i.key=n)},"stream-inf":function(){this.manifest.playlists=o,this.manifest.mediaGroups=this.manifest.mediaGroups||u,e.attributes?(s.attributes||(s.attributes={}),Sn(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||u,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(p={default:/yes/i.test(e.attributes.DEFAULT)}).default?p.autoselect=!0:p.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(p.language=e.attributes.LANGUAGE),e.attributes.URI&&(p.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(p.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(p.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(p.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=p}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){c+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(o.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,Qr.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data},skip:function(){this.manifest.skip=Zr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;a=!0;var i=this.manifest.segments.length,n=Zr(e.attributes);s.parts=s.parts||[],s.parts.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=d),d=n.byterange.offset+n.byterange.length);var r=s.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+r+" for segment #"+i,e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(e,i){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var t=this.manifest.serverControl=Zr(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Qr.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,i=Zr(e.attributes),n=i.type&&"PART"===i.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=n?d:0,n&&(d=i.byterange.offset+i.byterange.length)));var r=s.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t,e.attributes,["TYPE","URI"]),i.type)for(var o=0;o<s.preloadHints.length-1;o++){var a=s.preloadHints[o];a.type&&(a.type===i.type&&this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t+" has the same TYPE "+i.type+" as preload hint #"+o}))}},"rendition-report":function(){var t=Zr(e.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(t);var i=this.manifest.renditionReports.length-1,n=["LAST-MSN","URI"];a&&n.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+i,e.attributes,n)},"part-inf":function(){this.manifest.partInf=Zr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",e.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Qr.call(this,this.manifest)}}[e.tagType]||l).call(r)},uri:function(){s.uri=e.uri,o.push(s),this.manifest.targetDuration&&!("duration"in s)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),n&&(s.key=n),s.timeline=c,i&&(s.map=i),d=0,s={}},comment:function(){},custom:function(){e.segment?(s.custom=s.custom||{},s.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(r)})),t}In(t,e);var i=t.prototype;return i.warnOnMissingAttributes_=function(e,t,i){var n=[];i.forEach((function(e){t.hasOwnProperty(e)||n.push(e)})),n.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+n.join(", ")})},i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n"),this.trigger("end")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},t}(Fr),Jr={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},$r=["video","audio","text"],eo=["Video","Audio","Text"],to=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,i){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(i).toString(16)).slice(-2)})):e},io=function(e){void 0===e&&(e="");var t=e.split(","),i=[];return t.forEach((function(e){var t;e=e.trim(),$r.forEach((function(n){var r=Jr[n].exec(e.toLowerCase());if(r&&!(r.length<=1)){t=n;var o=e.substring(0,r[1].length),s=e.replace(o,"");i.push({type:o,details:s,mediaType:n})}})),t||i.push({type:e,details:"",mediaType:"unknown"})})),i},no=function(e){return void 0===e&&(e=""),Jr.audio.test(e.trim().toLowerCase())},ro=function(e){if(e&&"string"==typeof e){var t,i=e.toLowerCase().split(",").map((function(e){return to(e.trim())})),n="video";1===i.length&&no(i[0])?n="audio":1===i.length&&(void 0===(t=i[0])&&(t=""),Jr.text.test(t.trim().toLowerCase()))&&(n="application");var r="mp4";return i.every((function(e){return Jr.mp4.test(e)}))?r="mp4":i.every((function(e){return Jr.webm.test(e)}))?r="webm":i.every((function(e){return Jr.ogg.test(e)}))&&(r="ogg"),n+"/"+r+';codecs="'+e+'"'}},oo=function(e){return void 0===e&&(e=""),bn.MediaSource&&bn.MediaSource.isTypeSupported&&bn.MediaSource.isTypeSupported(ro(e))||!1},so=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every((function(e){e=e.trim();for(var t=0;t<eo.length;t++){if(Jr["muxer"+eo[t]].test(e))return!0}return!1}))},ao="mp4a.40.2",lo=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,uo=/^application\/dash\+xml/i,co=function(e){return lo.test(e)?"hls":uo.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},ho=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},po=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||ho(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},fo=bn.BigInt||Number,mo=[fo("0x1"),fo("0x100"),fo("0x10000"),fo("0x1000000"),fo("0x100000000"),fo("0x10000000000"),fo("0x1000000000000"),fo("0x100000000000000"),fo("0x10000000000000000")];Hr=new Uint16Array([65484]),255===(Vr=new Uint8Array(Hr.buffer,Hr.byteOffset,Hr.byteLength))[0]||Vr[0];var go=function(e,t){var i=void 0===t?{}:t,n=i.signed,r=void 0!==n&&n,o=i.le,s=void 0!==o&&o;e=po(e);var a=s?"reduce":"reduceRight",l=(e[a]?e[a]:Array.prototype[a]).call(e,(function(t,i,n){var r=s?n:Math.abs(n+1-e.length);return t+fo(i)*mo[r]}),fo(0));if(r){var u=mo[e.length]/fo(2)-fo(1);(l=fo(l))>u&&(l-=u,l-=u,l-=fo(2))}return Number(l)},vo=function(e,t){var i=(void 0===t?{}:t).le,n=void 0!==i&&i;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0),e=fo(e);for(var r,o=(r=e,Math.ceil(function(e){return e.toString(2).length}(r)/8)),s=new Uint8Array(new ArrayBuffer(o)),a=0;a<o;a++){var l=n?a:Math.abs(a+1-s.length);s[l]=Number(e/mo[a]&fo(255)),e<0&&(s[l]=Math.abs(~s[l]),s[l]-=0===a?1:2)}return s},yo=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i},_o=function(e,t,i){var n=void 0===i?{}:i,r=n.offset,o=void 0===r?0:r,s=n.mask,a=void 0===s?[]:s;e=po(e);var l=(t=po(t)).every?t.every:Array.prototype.every;return t.length&&e.length-o>=t.length&&l.call(t,(function(t,i){return t===(a[i]?a[i]&e[o+i]:e[o+i])}))},bo={},Co={};function To(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var wo=To({HTML:"text/html",isHTML:function(e){return e===wo.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Eo=To({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Eo.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Co.find=function(e,t,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,t);for(var n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(t.call(void 0,r,n,e))return r}},Co.freeze=To,Co.MIME_TYPE=wo,Co.NAMESPACE=Eo;var So=Co,ko=So.find,Po=So.NAMESPACE;function Ao(e){return""!==e}function xo(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function Io(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(Ao):[]}(e);return Object.keys(t.reduce(xo,{}))}function Mo(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function Lo(e,t){var i=e.prototype;if(!(i instanceof t)){let n=function(){};n.prototype=t.prototype,n=new n,Mo(i,n),e.prototype=i=n}i.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),i.constructor=e)}var Do={},Oo=Do.ELEMENT_NODE=1,jo=Do.ATTRIBUTE_NODE=2,Ro=Do.TEXT_NODE=3,No=Do.CDATA_SECTION_NODE=4,Uo=Do.ENTITY_REFERENCE_NODE=5,Bo=Do.ENTITY_NODE=6,Fo=Do.PROCESSING_INSTRUCTION_NODE=7,Wo=Do.COMMENT_NODE=8,Ho=Do.DOCUMENT_NODE=9,Vo=Do.DOCUMENT_TYPE_NODE=10,Go=Do.DOCUMENT_FRAGMENT_NODE=11,zo=Do.NOTATION_NODE=12,Yo={},qo={};Yo.INDEX_SIZE_ERR=(qo[1]="Index size error",1),Yo.DOMSTRING_SIZE_ERR=(qo[2]="DOMString size error",2);var Xo=Yo.HIERARCHY_REQUEST_ERR=(qo[3]="Hierarchy request error",3);Yo.WRONG_DOCUMENT_ERR=(qo[4]="Wrong document",4),Yo.INVALID_CHARACTER_ERR=(qo[5]="Invalid character",5),Yo.NO_DATA_ALLOWED_ERR=(qo[6]="No data allowed",6),Yo.NO_MODIFICATION_ALLOWED_ERR=(qo[7]="No modification allowed",7);var Zo=Yo.NOT_FOUND_ERR=(qo[8]="Not found",8);Yo.NOT_SUPPORTED_ERR=(qo[9]="Not supported",9);var Qo=Yo.INUSE_ATTRIBUTE_ERR=(qo[10]="Attribute in use",10);function Ko(e,t){if(t instanceof Error)var i=t;else i=this,Error.call(this,qo[e]),this.message=qo[e],Error.captureStackTrace&&Error.captureStackTrace(this,Ko);return i.code=e,t&&(this.message=this.message+": "+t),i}function Jo(){}function $o(e,t){this._node=e,this._refresh=t,es(this)}function es(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var i=e._refresh(e._node);Ws(e,"length",i.length),Mo(i,e),e._inc=t}}function ts(){}function is(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function ns(e,t,i,n){if(n?t[is(t,n)]=i:t[t.length++]=i,e){i.ownerElement=e;var r=e.ownerDocument;r&&(n&&cs(r,e,n),function(e,t,i){e&&e._inc++,i.namespaceURI===Po.XMLNS&&(t._nsMap[i.prefix?i.localName:""]=i.value)}(r,e,i))}}function rs(e,t,i){var n=is(t,i);if(!(n>=0))throw new Ko(Zo,new Error(e.tagName+"@"+i));for(var r=t.length-1;n<r;)t[n]=t[++n];if(t.length=r,e){var o=e.ownerDocument;o&&(cs(o,e,i),i.ownerElement=null)}}function os(){}function ss(){}function as(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function ls(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(ls(e,t))return!0}while(e=e.nextSibling)}function us(){this.ownerDocument=this}function cs(e,t,i,n){e&&e._inc++,i.namespaceURI===Po.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function hs(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,o=0;r;)n[o++]=r,r=r.nextSibling;n.length=o,delete n[n.length]}}}function ds(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,hs(e.ownerDocument,e),t}function ps(e){return e&&e.nodeType===ss.DOCUMENT_TYPE_NODE}function fs(e){return e&&e.nodeType===ss.ELEMENT_NODE}function ms(e){return e&&e.nodeType===ss.TEXT_NODE}function gs(e,t){var i=e.childNodes||[];if(ko(i,fs)||ps(t))return!1;var n=ko(i,ps);return!(t&&n&&i.indexOf(n)>i.indexOf(t))}function vs(e,t){var i=e.childNodes||[];if(ko(i,(function(e){return fs(e)&&e!==t})))return!1;var n=ko(i,ps);return!(t&&n&&i.indexOf(n)>i.indexOf(t))}function ys(e,t,i){if(!function(e){return e&&(e.nodeType===ss.DOCUMENT_NODE||e.nodeType===ss.DOCUMENT_FRAGMENT_NODE||e.nodeType===ss.ELEMENT_NODE)}(e))throw new Ko(Xo,"Unexpected parent node type "+e.nodeType);if(i&&i.parentNode!==e)throw new Ko(Zo,"child not in parent");if(!function(e){return e&&(fs(e)||ms(e)||ps(e)||e.nodeType===ss.DOCUMENT_FRAGMENT_NODE||e.nodeType===ss.COMMENT_NODE||e.nodeType===ss.PROCESSING_INSTRUCTION_NODE)}(t)||ps(t)&&e.nodeType!==ss.DOCUMENT_NODE)throw new Ko(Xo,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function _s(e,t,i){var n=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===ss.DOCUMENT_FRAGMENT_NODE){var o=r.filter(fs);if(o.length>1||ko(r,ms))throw new Ko(Xo,"More than one element or text in fragment");if(1===o.length&&!gs(e,i))throw new Ko(Xo,"Element in fragment can not be inserted before doctype")}if(fs(t)&&!gs(e,i))throw new Ko(Xo,"Only one element can be added and only after doctype");if(ps(t)){if(ko(n,ps))throw new Ko(Xo,"Only one doctype is allowed");var s=ko(n,fs);if(i&&n.indexOf(s)<n.indexOf(i))throw new Ko(Xo,"Doctype can only be inserted before an element");if(!i&&s)throw new Ko(Xo,"Doctype can not be appended since element is present")}}function bs(e,t,i){var n=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===ss.DOCUMENT_FRAGMENT_NODE){var o=r.filter(fs);if(o.length>1||ko(r,ms))throw new Ko(Xo,"More than one element or text in fragment");if(1===o.length&&!vs(e,i))throw new Ko(Xo,"Element in fragment can not be inserted before doctype")}if(fs(t)&&!vs(e,i))throw new Ko(Xo,"Only one element can be added and only after doctype");if(ps(t)){if(ko(n,(function(e){return ps(e)&&e!==i})))throw new Ko(Xo,"Only one doctype is allowed");var s=ko(n,fs);if(i&&n.indexOf(s)<n.indexOf(i))throw new Ko(Xo,"Doctype can only be inserted before an element")}}function Cs(e,t,i,n){ys(e,t,i),e.nodeType===ss.DOCUMENT_NODE&&(n||_s)(e,t,i);var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===Go){var o=t.firstChild;if(null==o)return t;var s=t.lastChild}else o=s=t;var a=i?i.previousSibling:e.lastChild;o.previousSibling=a,s.nextSibling=i,a?a.nextSibling=o:e.firstChild=o,null==i?e.lastChild=s:i.previousSibling=s;do{o.parentNode=e}while(o!==s&&(o=o.nextSibling));return hs(e.ownerDocument||e,e),t.nodeType==Go&&(t.firstChild=t.lastChild=null),t}function Ts(){this._nsMap={}}function ws(){}function Es(){}function Ss(){}function ks(){}function Ps(){}function As(){}function xs(){}function Is(){}function Ms(){}function Ls(){}function Ds(){}function Os(){}function js(e,t){var i=[],n=9==this.nodeType&&this.documentElement||this,r=n.prefix,o=n.namespaceURI;if(o&&null==r&&null==(r=n.lookupPrefix(o)))var s=[{namespace:o,prefix:null}];return Us(this,i,e,t,s),i.join("")}function Rs(e,t,i){var n=e.prefix||"",r=e.namespaceURI;if(!r)return!1;if("xml"===n&&r===Po.XML||r===Po.XMLNS)return!1;for(var o=i.length;o--;){var s=i[o];if(s.prefix===n)return s.namespace!==r}return!0}function Ns(e,t,i){e.push(" ",t,'="',i.replace(/[<&"]/g,as),'"')}function Us(e,t,i,n,r){if(r||(r=[]),n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case Oo:var o=e.attributes,s=o.length,a=e.firstChild,l=e.tagName,u=l;if(!(i=Po.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var c,h=0;h<o.length;h++)if("xmlns"===o.item(h).name){c=o.item(h).value;break}if(!c)for(var d=r.length-1;d>=0;d--){if(""===(p=r[d]).prefix&&p.namespace===e.namespaceURI){c=p.namespace;break}}if(c!==e.namespaceURI)for(d=r.length-1;d>=0;d--){var p;if((p=r[d]).namespace===e.namespaceURI){p.prefix&&(u=p.prefix+":"+l);break}}}t.push("<",u);for(var f=0;f<s;f++){"xmlns"==(m=o.item(f)).prefix?r.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&r.push({prefix:"",namespace:m.value})}for(f=0;f<s;f++){var m,g,v;if(Rs(m=o.item(f),0,r))Ns(t,(g=m.prefix||"")?"xmlns:"+g:"xmlns",v=m.namespaceURI),r.push({prefix:g,namespace:v});Us(m,t,i,n,r)}if(l===u&&Rs(e,0,r))Ns(t,(g=e.prefix||"")?"xmlns:"+g:"xmlns",v=e.namespaceURI),r.push({prefix:g,namespace:v});if(a||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(t.push(">"),i&&/^script$/i.test(l))for(;a;)a.data?t.push(a.data):Us(a,t,i,n,r.slice()),a=a.nextSibling;else for(;a;)Us(a,t,i,n,r.slice()),a=a.nextSibling;t.push("</",u,">")}else t.push("/>");return;case Ho:case Go:for(a=e.firstChild;a;)Us(a,t,i,n,r.slice()),a=a.nextSibling;return;case jo:return Ns(t,e.name,e.value);case Ro:return t.push(e.data.replace(/[<&]/g,as).replace(/]]>/g,"]]>"));case No:return t.push("<![CDATA[",e.data,"]]>");case Wo:return t.push("\x3c!--",e.data,"--\x3e");case Vo:var y=e.publicId,_=e.systemId;if(t.push("<!DOCTYPE ",e.name),y)t.push(" PUBLIC ",y),_&&"."!=_&&t.push(" ",_),t.push(">");else if(_&&"."!=_)t.push(" SYSTEM ",_,">");else{var b=e.internalSubset;b&&t.push(" [",b,"]"),t.push(">")}return;case Fo:return t.push("<?",e.target," ",e.data,"?>");case Uo:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Bs(e,t,i){var n;switch(t.nodeType){case Oo:(n=t.cloneNode(!1)).ownerDocument=e;case Go:break;case jo:i=!0}if(n||(n=t.cloneNode(!1)),n.ownerDocument=e,n.parentNode=null,i)for(var r=t.firstChild;r;)n.appendChild(Bs(e,r,i)),r=r.nextSibling;return n}function Fs(e,t,i){var n=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var o=t[r];"object"!=typeof o&&o!=n[r]&&(n[r]=o)}switch(t.childNodes&&(n.childNodes=new Jo),n.ownerDocument=e,n.nodeType){case Oo:var s=t.attributes,a=n.attributes=new ts,l=s.length;a._ownerElement=n;for(var u=0;u<l;u++)n.setAttributeNode(Fs(e,s.item(u),!0));break;case jo:i=!0}if(i)for(var c=t.firstChild;c;)n.appendChild(Fs(e,c,i)),c=c.nextSibling;return n}function Ws(e,t,i){e[t]=i}Yo.INVALID_STATE_ERR=(qo[11]="Invalid state",11),Yo.SYNTAX_ERR=(qo[12]="Syntax error",12),Yo.INVALID_MODIFICATION_ERR=(qo[13]="Invalid modification",13),Yo.NAMESPACE_ERR=(qo[14]="Invalid namespace",14),Yo.INVALID_ACCESS_ERR=(qo[15]="Invalid access",15),Ko.prototype=Error.prototype,Mo(Yo,Ko),Jo.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],n=0;n<this.length;n++)Us(this[n],i,e,t);return i.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},$o.prototype.item=function(e){return es(this),this[e]},Lo($o,Jo),ts.prototype={length:0,item:Jo.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var i=this[t];if(i.nodeName==e)return i}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new Ko(Qo);var i=this.getNamedItem(e.nodeName);return ns(this._ownerElement,this,e,i),i},setNamedItemNS:function(e){var t,i=e.ownerElement;if(i&&i!=this._ownerElement)throw new Ko(Qo);return t=this.getNamedItemNS(e.namespaceURI,e.localName),ns(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return rs(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var i=this.getNamedItemNS(e,t);return rs(this._ownerElement,this,i),i},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var n=this[i];if(n.localName==t&&n.namespaceURI==e)return n}return null}},os.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var n=new us;if(n.implementation=this,n.childNodes=new Jo,n.doctype=i||null,i&&n.appendChild(i),t){var r=n.createElementNS(e,t);n.appendChild(r)}return n},createDocumentType:function(e,t,i){var n=new As;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=i||"",n}},ss.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return Cs(this,e,t)},replaceChild:function(e,t){Cs(this,e,t,bs),t&&this.removeChild(t)},removeChild:function(e){return ds(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return Fs(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==Ro&&e.nodeType==Ro?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===e)return n;t=t.nodeType==jo?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&e in i&&Object.prototype.hasOwnProperty.call(i,e))return i[e];t=t.nodeType==jo?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},Mo(Do,ss),Mo(Do,ss.prototype),us.prototype={nodeName:"#document",nodeType:Ho,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==Go){for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}return e}return Cs(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===Oo&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),ds(this,e)},replaceChild:function(e,t){Cs(this,e,t,bs),e.ownerDocument=this,t&&this.removeChild(t),fs(e)&&(this.documentElement=e)},importNode:function(e,t){return Bs(this,e,t)},getElementById:function(e){var t=null;return ls(this.documentElement,(function(i){if(i.nodeType==Oo&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=Io(e);return new $o(this,(function(i){var n=[];return t.length>0&&ls(i.documentElement,(function(r){if(r!==i&&r.nodeType===Oo){var o=r.getAttribute("class");if(o){var s=e===o;if(!s){var a=Io(o);s=t.every((l=a,function(e){return l&&-1!==l.indexOf(e)}))}s&&n.push(r)}}var l})),n}))},createElement:function(e){var t=new Ts;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new Jo,(t.attributes=new ts)._ownerElement=t,t},createDocumentFragment:function(){var e=new Ls;return e.ownerDocument=this,e.childNodes=new Jo,e},createTextNode:function(e){var t=new Ss;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ks;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Ps;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new Ds;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new ws;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Ms;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new Ts,n=t.split(":"),r=i.attributes=new ts;return i.childNodes=new Jo,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new ws,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},Lo(us,ss),Ts.prototype={nodeType:Oo,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===Go?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,hs(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new $o(this,(function(t){var i=[];return ls(t,(function(n){n===t||n.nodeType!=Oo||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new $o(this,(function(i){var n=[];return ls(i,(function(r){r===i||r.nodeType!==Oo||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}},us.prototype.getElementsByTagName=Ts.prototype.getElementsByTagName,us.prototype.getElementsByTagNameNS=Ts.prototype.getElementsByTagNameNS,Lo(Ts,ss),ws.prototype.nodeType=jo,Lo(ws,ss),Es.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(qo[Xo])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},Lo(Es,ss),Ss.prototype={nodeName:"#text",nodeType:Ro,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},Lo(Ss,Es),ks.prototype={nodeName:"#comment",nodeType:Wo},Lo(ks,Es),Ps.prototype={nodeName:"#cdata-section",nodeType:No},Lo(Ps,Es),As.prototype.nodeType=Vo,Lo(As,ss),xs.prototype.nodeType=zo,Lo(xs,ss),Is.prototype.nodeType=Bo,Lo(Is,ss),Ms.prototype.nodeType=Uo,Lo(Ms,ss),Ls.prototype.nodeName="#document-fragment",Ls.prototype.nodeType=Go,Lo(Ls,ss),Ds.prototype.nodeType=Fo,Lo(Ds,ss),Os.prototype.serializeToString=function(e,t,i){return js.call(e,t,i)},ss.prototype.toString=js;try{if(Object.defineProperty){let e=function(t){switch(t.nodeType){case Oo:case Go:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}};Object.defineProperty($o.prototype,"length",{get:function(){return es(this),this.$$length}}),Object.defineProperty(ss.prototype,"textContent",{get:function(){return e(this)},set:function(e){switch(this.nodeType){case Oo:case Go:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Ws=function(e,t,i){e["$$"+t]=i}}}catch($v){}bo.DocumentType=As,bo.DOMException=Ko,bo.DOMImplementation=os,bo.Element=Ts,bo.Node=ss,bo.NodeList=Jo,bo.XMLSerializer=Os;var Hs={},Vs={};!function(e){var t=Co.freeze;e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),e.entityMap=e.HTML_ENTITIES}(Vs);var Gs={},zs=Co.NAMESPACE,Ys=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,qs=new RegExp("[\\-\\.0-9"+Ys.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Xs=new RegExp("^"+Ys.source+qs.source+"*(?::"+Ys.source+qs.source+"*)?$");function Zs(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Zs)}function Qs(){}function Ks(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function Js(e,t,i,n,r,o){function s(e,t,n){i.attributeNames.hasOwnProperty(e)&&o.fatalError("Attribute "+e+" redefined"),i.addValue(e,t,n)}for(var a,l=++t,u=0;;){var c=e.charAt(l);switch(c){case"=":if(1===u)a=e.slice(t,l),u=3;else{if(2!==u)throw new Error("attribute equal must after attrName");u=3}break;case"'":case'"':if(3===u||1===u){if(1===u&&(o.warning('attribute value must after "="'),a=e.slice(t,l)),t=l+1,!((l=e.indexOf(c,t))>0))throw new Error("attribute value no end '"+c+"' match");s(a,h=e.slice(t,l).replace(/&#?\w+;/g,r),t-1),u=5}else{if(4!=u)throw new Error('attribute value must after "="');s(a,h=e.slice(t,l).replace(/&#?\w+;/g,r),t),o.warning('attribute "'+a+'" missed start quot('+c+")!!"),t=l+1,u=5}break;case"/":switch(u){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:u=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),0==u&&i.setTagName(e.slice(t,l)),l;case">":switch(u){case 0:i.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(h=e.slice(t,l)).slice(-1)&&(i.closed=!0,h=h.slice(0,-1));case 2:2===u&&(h=a),4==u?(o.warning('attribute "'+h+'" missed quot(")!'),s(a,h.replace(/&#?\w+;/g,r),t)):(zs.isHTML(n[""])&&h.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+h+'" missed value!! "'+h+'" instead!!'),s(h,h,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"":c=" ";default:if(c<=" ")switch(u){case 0:i.setTagName(e.slice(t,l)),u=6;break;case 1:a=e.slice(t,l),u=2;break;case 4:var h=e.slice(t,l).replace(/&#?\w+;/g,r);o.warning('attribute "'+h+'" missed quot(")!!'),s(a,h,t);case 5:u=6}else switch(u){case 2:i.tagName,zs.isHTML(n[""])&&a.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),s(a,a,t),t=l,u=1;break;case 5:o.warning('attribute space is required"'+a+'"!!');case 6:u=1,t=l;break;case 3:u=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function $s(e,t,i){for(var n=e.tagName,r=null,o=e.length;o--;){var s=e[o],a=s.qName,l=s.value;if((d=a.indexOf(":"))>0)var u=s.prefix=a.slice(0,d),c=a.slice(d+1),h="xmlns"===u&&c;else c=a,u=null,h="xmlns"===a&&"";s.localName=c,!1!==h&&(null==r&&(r={},ia(i,i={})),i[h]=r[h]=l,s.uri=zs.XMLNS,t.startPrefixMapping(h,l))}for(o=e.length;o--;){(u=(s=e[o]).prefix)&&("xml"===u&&(s.uri=zs.XML),"xmlns"!==u&&(s.uri=i[u||""]))}var d;(d=n.indexOf(":"))>0?(u=e.prefix=n.slice(0,d),c=e.localName=n.slice(d+1)):(u=null,c=e.localName=n);var p=e.uri=i[u||""];if(t.startElement(p,c,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,!0;if(t.endElement(p,c,n),r)for(u in r)Object.prototype.hasOwnProperty.call(r,u)&&t.endPrefixMapping(u)}function ea(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var o=e.indexOf("</"+i+">",t),s=e.substring(t+1,o);if(/[&<]/.test(s))return/^script$/i.test(i)?(r.characters(s,0,s.length),o):(s=s.replace(/&#?\w+;/g,n),r.characters(s,0,s.length),o)}return t+1}function ta(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),n[i]=r),r<t}function ia(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function na(e,t,i,n){switch(e.charAt(t+2)){case"-":return"-"===e.charAt(t+3)?(r=e.indexOf("--\x3e",t+4))>t?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var o=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(n.push(i),i[1])return n}(e,t),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var a=o[1][0],l=!1,u=!1;s>3&&(/^public$/i.test(o[2][0])?(l=o[3][0],u=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(u=o[3][0]));var c=o[s-1];return i.startDTD(a,l,u),i.endDTD(),c.index+c[0].length}}return-1}function ra(e,t,i){var n=e.indexOf("?>",t);if(n){var r=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,i.processingInstruction(r[1],r[2]),n+2):-1}return-1}function oa(){this.attributeNames={}}Zs.prototype=new Error,Zs.prototype.name=Zs.name,Qs.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),ia(t,t={}),function(e,t,i,n,r){function o(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}function s(e){var t=e.slice(1,-1);return t in i?i[t]:"#"===t.charAt(0)?o(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function a(t){if(t>m){var i=e.substring(m,t).replace(/&#?\w+;/g,s);d&&l(m),n.characters(i,0,t-m),m=t}}function l(t,i){for(;t>=c&&(i=h.exec(e));)u=i.index,c=u+i[0].length,d.lineNumber++;d.columnNumber=t-u+1}var u=0,c=0,h=/.*(?:\r\n?|\n)|.*$/g,d=n.locator,p=[{currentNSMap:t}],f={},m=0;for(;;){try{var g=e.indexOf("<",m);if(g<0){if(!e.substr(m).match(/^\s*$/)){var v=n.doc,y=v.createTextNode(e.substr(m));v.appendChild(y),n.currentElement=y}return}switch(g>m&&a(g),e.charAt(g+1)){case"/":var _=e.indexOf(">",g+3),b=e.substring(g+2,_).replace(/[ \t\n\r]+$/g,""),C=p.pop();_<0?(b=e.substring(g+2).replace(/[\s<].*/,""),r.error("end tag name: "+b+" is not complete:"+C.tagName),_=g+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),r.error("end tag name: "+b+" maybe not complete"),_=g+1+b.length);var T=C.localNSMap,w=C.tagName==b;if(w||C.tagName&&C.tagName.toLowerCase()==b.toLowerCase()){if(n.endElement(C.uri,C.localName,b),T)for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&n.endPrefixMapping(E);w||r.fatalError("end tag name: "+b+" is not match the current start tagName:"+C.tagName)}else p.push(C);_++;break;case"?":d&&l(g),_=ra(e,g,n);break;case"!":d&&l(g),_=na(e,g,n,r);break;default:d&&l(g);var S=new oa,k=p[p.length-1].currentNSMap,P=(_=Js(e,g,S,k,s,r),S.length);if(!S.closed&&ta(e,_,S.tagName,f)&&(S.closed=!0,i.nbsp||r.warning("unclosed xml attribute")),d&&P){for(var A=Ks(d,{}),x=0;x<P;x++){var I=S[x];l(I.offset),I.locator=Ks(d,{})}n.locator=A,$s(S,n,k)&&p.push(S),n.locator=d}else $s(S,n,k)&&p.push(S);zs.isHTML(S.uri)&&!S.closed?_=ea(e,_,S.tagName,s,n):_++}}catch($v){if($v instanceof Zs)throw $v;r.error("element parse error: "+$v),_=-1}_>m?m=_:a(Math.max(g,m)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},oa.prototype={setTagName:function(e){if(!Xs.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!Xs.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},Gs.XMLReader=Qs,Gs.ParseError=Zs;var sa=Co,aa=bo,la=Vs,ua=Gs,ca=aa.DOMImplementation,ha=sa.NAMESPACE,da=ua.ParseError,pa=ua.XMLReader;function fa(e){this.options=e||{locator:{}}}function ma(){this.cdata=!1}function ga(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function va(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function ya(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function _a(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}fa.prototype.parseFromString=function(e,t){var i=this.options,n=new pa,r=i.domBuilder||new ma,o=i.errorHandler,s=i.locator,a=i.xmlns||{},l=/\/x?html?$/.test(t),u=l?la.HTML_ENTITIES:la.XML_ENTITIES;return s&&r.setDocumentLocator(s),n.errorHandler=function(e,t,i){if(!e){if(t instanceof ma)return t;e=t}var n={},r=e instanceof Function;function o(t){var o=e[t];!o&&r&&(o=2==e.length?function(i){e(t,i)}:e),n[t]=o&&function(e){o("[xmldom "+t+"]\t"+e+va(i))}||function(){}}return i=i||{},o("warning"),o("error"),o("fatalError"),n}(o,r,s),n.domBuilder=i.domBuilder||r,l&&(a[""]=ha.HTML),a.xml=a.xml||ha.XML,e&&"string"==typeof e?n.parse(e,a,u):n.errorHandler.error("invalid doc source"),r.doc},ma.prototype={startDocument:function(){this.doc=(new ca).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var r=this.doc,o=r.createElementNS(e,i||t),s=n.length;_a(this,o),this.currentElement=o,this.locator&&ga(this.locator,o);for(var a=0;a<s;a++){e=n.getURI(a);var l=n.getValue(a),u=(i=n.getQName(a),r.createAttributeNS(e,i));this.locator&&ga(n.getLocator(a),u),u.value=u.nodeValue=l,o.setAttributeNode(u)}},endElement:function(e,t,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var i=this.doc.createProcessingInstruction(e,t);this.locator&&ga(this.locator,i),_a(this,i)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){if(e=ya.apply(this,arguments)){if(this.cdata)var n=this.doc.createCDATASection(e);else n=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&ga(this.locator,n)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=ya.apply(this,arguments);var n=this.doc.createComment(e);this.locator&&ga(this.locator,n),_a(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var r=n.createDocumentType(e,t,i);this.locator&&ga(this.locator,r),_a(this,r),this.doc.doctype=r}},warning:function(e){console.warn("[xmldom warning]\t"+e,va(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,va(this.locator))},fatalError:function(e){throw new da(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){ma.prototype[e]=function(){return null}})),Hs.__DOMHandler=ma,Hs.DOMParser=fa,Hs.DOMImplementation=aa.DOMImplementation,Hs.XMLSerializer=aa.XMLSerializer;var ba=Hs.DOMParser,Ca=function(e){return!!e&&"object"==typeof e},Ta=function e(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.reduce((function(t,i){return"object"!=typeof i||Object.keys(i).forEach((function(n){Array.isArray(t[n])&&Array.isArray(i[n])?t[n]=t[n].concat(i[n]):Ca(t[n])&&Ca(i[n])?t[n]=e(t[n],i[n]):t[n]=i[n]})),t}),{})},wa=function(e){return Object.keys(e).map((function(t){return e[t]}))},Ea=function(e){return e.reduce((function(e,t){return e.concat(t)}),[])},Sa=function(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},ka=function(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1},Pa="INVALID_NUMBER_OF_PERIOD",Aa="DASH_EMPTY_MANIFEST",xa="DASH_INVALID_XML",Ia="NO_BASE_URL",Ma="SEGMENT_TIME_UNSPECIFIED",La="UNSUPPORTED_UTC_TIMING_SCHEME",Da=function(e){var t=e.baseUrl,i=void 0===t?"":t,n=e.source,r=void 0===n?"":n,o=e.range,s=void 0===o?"":o,a=e.indexRange,l=void 0===a?"":a,u={uri:r,resolvedUri:Br(i||"",r)};if(s||l){var c,h=(s||l).split("-"),d=bn.BigInt?bn.BigInt(h[0]):parseInt(h[0],10),p=bn.BigInt?bn.BigInt(h[1]):parseInt(h[1],10);d<Number.MAX_SAFE_INTEGER&&"bigint"==typeof d&&(d=Number(d)),p<Number.MAX_SAFE_INTEGER&&"bigint"==typeof p&&(p=Number(p)),"bigint"==typeof(c="bigint"==typeof p||"bigint"==typeof d?bn.BigInt(p)-bn.BigInt(d)+bn.BigInt(1):p-d+1)&&c<Number.MAX_SAFE_INTEGER&&(c=Number(c)),u.byterange={length:c,offset:d}}return u},Oa=function(e){return e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e},ja={static:function(e){var t=e.duration,i=e.timescale,n=void 0===i?1:i,r=e.sourceDuration,o=e.periodDuration,s=Oa(e.endNumber),a=t/n;return"number"==typeof s?{start:0,end:s}:"number"==typeof o?{start:0,end:o/a}:{start:0,end:r/a}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,o=void 0===r?1:r,s=e.duration,a=e.periodStart,l=void 0===a?0:a,u=e.minimumUpdatePeriod,c=void 0===u?0:u,h=e.timeShiftBufferDepth,d=void 0===h?1/0:h,p=Oa(e.endNumber),f=(t+i)/1e3,m=n+l,g=f+c-m,v=Math.ceil(g*o/s),y=Math.floor((f-m-d)*o/s),_=Math.floor((f-m)*o/s);return{start:Math.max(0,y),end:"number"==typeof p?p:Math.min(v,_)}}},Ra=function(e){var t=e.type,i=e.duration,n=e.timescale,r=void 0===n?1:n,o=e.periodDuration,s=e.sourceDuration,a=ja[t](e),l=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}(a.start,a.end).map(function(e){return function(t){var i=e.duration,n=e.timescale,r=void 0===n?1:n,o=e.periodStart,s=e.startNumber;return{number:(void 0===s?1:s)+t,duration:i/r,timeline:o,time:t*i}}}(e));if("static"===t){var u=l.length-1,c="number"==typeof o?o:s;l[u].duration=c-i/r*u}return l},Na=function(e){var t=e.baseUrl,i=e.initialization,n=void 0===i?{}:i,r=e.sourceDuration,o=e.indexRange,s=void 0===o?"":o,a=e.periodStart,l=e.presentationTime,u=e.number,c=void 0===u?0:u,h=e.duration;if(!t)throw new Error(Ia);var d=Da({baseUrl:t,source:n.sourceURL,range:n.range}),p=Da({baseUrl:t,source:t,indexRange:s});if(p.map=d,h){var f=Ra(e);f.length&&(p.duration=f[0].duration,p.timeline=f[0].timeline)}else r&&(p.duration=r,p.timeline=a);return p.presentationTime=l||a,p.number=c,[p]},Ua=function(e,t,i){var n,r=e.sidx.map?e.sidx.map:null,o=e.sidx.duration,s=e.timeline||0,a=e.sidx.byterange,l=a.offset+a.length,u=t.timescale,c=t.references.filter((function(e){return 1!==e.referenceType})),h=[],d=e.endList?"static":"dynamic",p=e.sidx.timeline,f=p,m=e.mediaSequence||0;n="bigint"==typeof t.firstOffset?bn.BigInt(l)+t.firstOffset:l+t.firstOffset;for(var g=0;g<c.length;g++){var v=t.references[g],y=v.referencedSize,_=v.subsegmentDuration,b=void 0;b="bigint"==typeof n?n+bn.BigInt(y)-bn.BigInt(1):n+y-1;var C=Na({baseUrl:i,timescale:u,timeline:s,periodStart:p,presentationTime:f,number:m,duration:_,sourceDuration:o,indexRange:n+"-"+b,type:d})[0];r&&(C.map=r),h.push(C),n+="bigint"==typeof n?bn.BigInt(y):y,f+=_/u,m++}return e.segments=h,e},Ba=["AUDIO","SUBTITLES"],Fa=function(e){return(t=e,i=function(e){return e.timeline},wa(t.reduce((function(e,t){return t.forEach((function(t){e[i(t)]=t})),e}),{}))).sort((function(e,t){return e.timeline>t.timeline?1:-1}));var t,i},Wa=function(e){var t,i,n=[];return t=e,i=function(e,t,i,r){n=n.concat(e.playlists||[])},Ba.forEach((function(e){for(var n in t.mediaGroups[e])for(var r in t.mediaGroups[e][n]){var o=t.mediaGroups[e][n][r];i(o,e,n,r)}})),n},Ha=function(e){var t=e.playlist,i=e.mediaSequence;t.mediaSequence=i,t.segments.forEach((function(e,i){e.number=t.mediaSequence+i}))},Va=function(e){var t=e.oldManifest,i=e.newManifest,n=t.playlists.concat(Wa(t)),r=i.playlists.concat(Wa(i));return i.timelineStarts=Fa([t.timelineStarts,i.timelineStarts]),function(e){var t=e.oldPlaylists,i=e.newPlaylists,n=e.timelineStarts;i.forEach((function(e){e.discontinuitySequence=ka(n,(function(t){return t.timeline===e.timeline}));var i=function(e,t){for(var i=0;i<e.length;i++)if(e[i].attributes.NAME===t)return e[i];return null}(t,e.attributes.NAME);if(i&&!e.sidx){var r=e.segments[0],o=ka(i.segments,(function(e){return Math.abs(e.presentationTime-r.presentationTime)<.016666666666666666}));if(-1===o)return Ha({playlist:e,mediaSequence:i.mediaSequence+i.segments.length}),e.segments[0].discontinuity=!0,e.discontinuityStarts.unshift(0),void((!i.segments.length&&e.timeline>i.timeline||i.segments.length&&e.timeline>i.segments[i.segments.length-1].timeline)&&e.discontinuitySequence--);i.segments[o].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,e.discontinuityStarts.unshift(0),e.discontinuitySequence--),Ha({playlist:e,mediaSequence:i.segments[o].number})}}))}({oldPlaylists:n,newPlaylists:r,timelineStarts:i.timelineStarts}),i},Ga=function(e){return e&&e.uri+"-"+(t=e.byterange,i="bigint"==typeof t.offset||"bigint"==typeof t.length?bn.BigInt(t.offset)+bn.BigInt(t.length)-bn.BigInt(1):t.offset+t.length-1,t.offset+"-"+i);var t,i},za=function(e){return wa(e.reduce((function(e,t){var i=t.attributes.id+(t.attributes.lang||"");if(e[i]){var n;if(t.segments)t.segments[0]&&(t.segments[0].discontinuity=!0),(n=e[i].segments).push.apply(n,t.segments);t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)}else e[i]=t,e[i].attributes.timelineStarts=[];return e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{})).map((function(e){var t,i;return e.discontinuityStarts=(t=e.segments||[],i="discontinuity",t.reduce((function(e,t,n){return t[i]&&e.push(n),e}),[])),e}))},Ya=function(e,t){var i=Ga(e.sidx),n=i&&t[i]&&t[i].sidx;return n&&Ua(e,n,e.sidx.resolvedUri),e},qa=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e)e[i]=Ya(e[i],t);return e},Xa=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,o=e.discontinuityStarts,s={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===i.type,timeline:i.periodStart,resolvedUri:"",targetDuration:i.duration,discontinuityStarts:o,timelineStarts:i.timelineStarts,segments:n};return i.contentProtection&&(s.contentProtection=i.contentProtection),r&&(s.sidx=r),s},Za=function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video/webm"===t.mimeType||"video"===t.contentType},Qa=function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio/webm"===t.mimeType||"audio"===t.contentType},Ka=function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType},Ja=function(e){return e?Object.keys(e).reduce((function(t,i){var n=e[i];return t.concat(n.playlists)}),[]):[]},$a=function(e){var t,i=e.dashPlaylists,n=e.locations,r=e.sidxMapping,o=void 0===r?{}:r,s=e.previousManifest;if(!i.length)return{};var a=i[0].attributes,l=a.sourceDuration,u=a.type,c=a.suggestedPresentationDelay,h=a.minimumUpdatePeriod,d=za(i.filter(Za)).map(Xa),p=za(i.filter(Qa)),f=za(i.filter(Ka)),m=i.map((function(e){return e.attributes.captionServices})).filter(Boolean),g={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(t={AUDIO:{},VIDEO:{}},t["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:l,playlists:qa(d,o)};h>=0&&(g.minimumUpdatePeriod=1e3*h),n&&(g.locations=n),"dynamic"===u&&(g.suggestedPresentationDelay=c);var v,y,_=0===g.playlists.length,b=p.length?function(e,t,i){var n;void 0===t&&(t={}),void 0===i&&(i=!1);var r=e.reduce((function(e,r){var o=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",a=r.attributes.label||"main";if(s&&!r.attributes.label){var l=o?" ("+o+")":"";a=""+r.attributes.lang+l}e[a]||(e[a]={language:s,autoselect:!0,default:"main"===o,playlists:[],uri:""});var u=Ya(function(e,t){var i,n=e.attributes,r=e.segments,o=e.sidx,s=e.mediaSequence,a=e.discontinuitySequence,l=e.discontinuityStarts,u={attributes:(i={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},i["PROGRAM-ID"]=1,i),uri:"",endList:"static"===n.type,timeline:n.periodStart,resolvedUri:"",targetDuration:n.duration,discontinuitySequence:a,discontinuityStarts:l,timelineStarts:n.timelineStarts,mediaSequence:s,segments:r};return n.contentProtection&&(u.contentProtection=n.contentProtection),o&&(u.sidx=o),t&&(u.attributes.AUDIO="audio",u.attributes.SUBTITLES="subs"),u}(r,i),t);return e[a].playlists.push(u),void 0===n&&"main"===o&&((n=r).default=!0),e}),{});return n||(r[Object.keys(r)[0]].default=!0),r}(p,o,_):null,C=f.length?function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n=i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(Ya(function(e){var t,i=e.attributes,n=e.segments,r=e.mediaSequence,o=e.discontinuityStarts,s=e.discontinuitySequence;void 0===n&&(n=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);var a=((t={NAME:i.id,BANDWIDTH:i.bandwidth})["PROGRAM-ID"]=1,t);return i.codecs&&(a.CODECS=i.codecs),{attributes:a,uri:"",endList:"static"===i.type,timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:o,discontinuitySequence:s,mediaSequence:r,segments:n}}(i),t)),e}),{})}(f,o):null,T=d.concat(Ja(b),Ja(C)),w=T.map((function(e){return e.timelineStarts}));return g.timelineStarts=Fa(w),v=T,y=g.timelineStarts,v.forEach((function(e){e.mediaSequence=0,e.discontinuitySequence=ka(y,(function(t){return t.timeline===e.timeline})),e.segments&&e.segments.forEach((function(e,t){e.number=t}))})),b&&(g.mediaGroups.AUDIO.audio=b),C&&(g.mediaGroups.SUBTITLES.subs=C),m.length&&(g.mediaGroups["CLOSED-CAPTIONS"].cc=m.reduce((function(e,t){return t?(t.forEach((function(t){var i=t.channel,n=t.language;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e}),{})),s?Va({oldManifest:s,newManifest:g}):g},el=function(e,t,i){var n=e.NOW,r=e.clientOffset,o=e.availabilityStartTime,s=e.timescale,a=void 0===s?1:s,l=e.periodStart,u=void 0===l?0:l,c=e.minimumUpdatePeriod,h=(n+r)/1e3+(void 0===c?0:c)-(o+u);return Math.ceil((h*a-t)/i)},tl=function(e,t){for(var i=e.type,n=e.minimumUpdatePeriod,r=void 0===n?0:n,o=e.media,s=void 0===o?"":o,a=e.sourceDuration,l=e.timescale,u=void 0===l?1:l,c=e.startNumber,h=void 0===c?1:c,d=e.periodStart,p=[],f=-1,m=0;m<t.length;m++){var g=t[m],v=g.d,y=g.r||0,_=g.t||0;f<0&&(f=_),_&&_>f&&(f=_);var b=void 0;if(y<0){var C=m+1;b=C===t.length?"dynamic"===i&&r>0&&s.indexOf("$Number$")>0?el(e,f,v):(a*u-f)/v:(t[C].t-f)/v}else b=y+1;for(var T=h+p.length+b,w=h+p.length;w<T;)p.push({number:w,duration:v/u,time:f,timeline:d}),f+=v,w++}return p},il=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,nl=function(e,t){return e.replace(il,function(e){return function(t,i,n,r){if("$$"===t)return"$";if(void 0===e[i])return t;var o=""+e[i];return"RepresentationID"===i?o:(r=n?parseInt(r,10):1,o.length>=r?o:""+new Array(r-o.length+1).join("0")+o)}}(t))},rl=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,o=Da({baseUrl:e.baseUrl,source:nl(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?Ra(e):tl(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]}(e,t).map((function(t){i.Number=t.number,i.Time=t.time;var n=nl(e.media||"",i),r=e.timescale||1,s=e.presentationTimeOffset||0,a=e.periodStart+(t.time-s)/r;return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:Br(e.baseUrl||"",n),map:o,number:t.number,presentationTime:a}}))},ol=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n,o=e.periodStart;if(!i&&!t||i&&t)throw new Error(Ma);var s,a=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,o=Da({baseUrl:i,source:r.sourceURL,range:r.range}),s=Da({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=o,s}(e,t)}));return i&&(s=Ra(e)),t&&(s=tl(e,t)),s.map((function(t,i){if(a[i]){var n=a[i],r=e.timescale||1,s=e.presentationTimeOffset||0;return n.timeline=t.timeline,n.duration=t.duration,n.number=t.number,n.presentationTime=o+(t.time-s)/r,n}})).filter((function(e){return e}))},sl=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=rl,t=Ta(n,r.template)):r.base?(i=Na,t=Ta(n,r.base)):r.list&&(i=ol,t=Ta(n,r.list));var o={attributes:n};if(!i)return o;var s=i(t,r.segmentTimeline);if(t.duration){var a=t,l=a.duration,u=a.timescale,c=void 0===u?1:u;t.duration=l/c}else s.length?t.duration=s.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return o.attributes=t,o.segments=s,r.base&&t.indexRange&&(o.sidx=s[0],o.segments=[]),o},al=function(e,t){return Sa(e.childNodes).filter((function(e){return e.tagName===t}))},ll=function(e){return e.textContent.trim()},ul=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],l=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(o||0)+3600*parseFloat(s||0)+60*parseFloat(a||0)+parseFloat(l||0)},cl={mediaPresentationDuration:function(e){return ul(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return ul(e)},suggestedPresentationDelay:function(e){return ul(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return ul(e)},start:function(e){return ul(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?ul(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},hl=function(e){return e&&e.attributes?Sa(e.attributes).reduce((function(e,t){var i=cl[t.name]||cl.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}},dl={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},pl=function(e,t){return t.length?Ea(e.map((function(e){return t.map((function(t){return Br(e,ll(t))}))}))):e},fl=function(e){var t=al(e,"SegmentTemplate")[0],i=al(e,"SegmentList")[0],n=i&&al(i,"SegmentURL").map((function(e){return Ta({tag:"SegmentURL"},hl(e))})),r=al(e,"SegmentBase")[0],o=i||t,s=o&&al(o,"SegmentTimeline")[0],a=i||r||t,l=a&&al(a,"Initialization")[0],u=t&&hl(t);u&&l?u.initialization=l&&hl(l):u&&u.initialization&&(u.initialization={sourceURL:u.initialization});var c={template:u,segmentTimeline:s&&al(s,"S").map((function(e){return hl(e)})),list:i&&Ta(hl(i),{segmentUrls:n,initialization:hl(l)}),base:r&&Ta(hl(r),{initialization:hl(l)})};return Object.keys(c).forEach((function(e){c[e]||delete c[e]})),c},ml=function(e,t,i){return function(n){var r,o=hl(n),s=pl(t,al(n,"BaseURL")),a=al(n,"Role")[0],l={role:hl(a)},u=Ta(e,o,l),c=al(n,"Accessibility")[0],h="urn:scte:dash:cc:cea-608:2015"===(r=hl(c)).schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map((function(e){var t,i;if(i=e,/^CC\d=/.test(e)){var n=e.split("=");t=n[0],i=n[1]}else/^CC\d$/.test(e)&&(t=e);return{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===r.schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map((function(e){var t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var i=e.split("="),n=i[0],r=i[1],o=void 0===r?"":r;t.channel=n,t.language=e,o.split(",").forEach((function(e){var i=e.split(":"),n=i[0],r=i[1];"lang"===n?t.language=r:"er"===n?t.easyReader=Number(r):"war"===n?t.aspectRatio=Number(r):"3D"===n&&(t["3D"]=Number(r))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;h&&(u=Ta(u,{captionServices:h}));var d=al(n,"Label")[0];if(d&&d.childNodes.length){var p=d.childNodes[0].nodeValue.trim();u=Ta(u,{label:p})}var f=al(n,"ContentProtection").reduce((function(e,t){var i=hl(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());var n=dl[i.schemeIdUri];if(n){e[n]={attributes:i};var r=al(t,"cenc:pssh")[0];if(r){var o=ll(r);e[n].pssh=o&&Wr(o)}}return e}),{});Object.keys(f).length&&(u=Ta(u,{contentProtection:f}));var m=fl(n),g=al(n,"Representation"),v=Ta(i,m);return Ea(g.map(function(e,t,i){return function(n){var r=al(n,"BaseURL"),o=pl(t,r),s=Ta(e,hl(n)),a=fl(n);return o.map((function(e){return{segmentInfo:Ta(i,a),attributes:Ta(s,{baseUrl:e})}}))}}(u,s,v)))}},gl=function(e,t){return function(i,n){var r=pl(t,al(i.node,"BaseURL")),o=Ta(e,{periodStart:i.attributes.start});"number"==typeof i.attributes.duration&&(o.periodDuration=i.attributes.duration);var s=al(i.node,"AdaptationSet"),a=fl(i.node);return Ea(s.map(ml(o,r,a)))}},vl=function(e){if(""===e)throw new Error(Aa);var t,i,n=new ba;try{i=(t=n.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch($v){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(xa);return i},yl=function(e,t){void 0===t&&(t={});var i=function(e,t){void 0===t&&(t={});var i=t,n=i.manifestUri,r=void 0===n?"":n,o=i.NOW,s=void 0===o?Date.now():o,a=i.clientOffset,l=void 0===a?0:a,u=al(e,"Period");if(!u.length)throw new Error(Pa);var c=al(e,"Location"),h=hl(e),d=pl([r],al(e,"BaseURL"));h.type=h.type||"static",h.sourceDuration=h.mediaPresentationDuration||0,h.NOW=s,h.clientOffset=l,c.length&&(h.locations=c.map(ll));var p=[];return u.forEach((function(e,t){var i=hl(e),n=p[t-1];i.start=function(e){var t=e.attributes,i=e.priorPeriodAttributes,n=e.mpdType;return"number"==typeof t.start?t.start:i&&"number"==typeof i.start&&"number"==typeof i.duration?i.start+i.duration:i||"static"!==n?null:0}({attributes:i,priorPeriodAttributes:n?n.attributes:null,mpdType:h.type}),p.push({node:e,attributes:i})})),{locations:h.locations,representationInfo:Ea(p.map(gl(h,d)))}}(vl(e),t),n=i.representationInfo.map(sl);return $a({dashPlaylists:n,locations:i.locations,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest})},_l=function(e){return function(e){var t=al(e,"UTCTiming")[0];if(!t)return null;var i=hl(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(La)}return i}(vl(e))},bl=Math.pow(2,32),Cl=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*bl+i.getUint32(4)},Tl=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},n=12;0===i.version?(i.earliestPresentationTime=t.getUint32(n),i.firstOffset=t.getUint32(n+4),n+=8):(i.earliestPresentationTime=Cl(e.subarray(n)),i.firstOffset=Cl(e.subarray(n+8)),n+=16),n+=2;var r=t.getUint16(n);for(n+=2;r>0;n+=12,r--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i},wl=po([73,68,51]),El=function e(t,i){return void 0===i&&(i=0),(t=po(t)).length-i<10||!_o(t,wl,{offset:i})?i:(i+=function(e,t){void 0===t&&(t=0);var i=(e=po(e))[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?n+20:n+10}(t,i),e(t,i))},Sl=function(e){return"string"==typeof e?yo(e):e},kl=function e(t,i,n){void 0===n&&(n=!1),i=function(e){return Array.isArray(e)?e.map((function(e){return Sl(e)})):[Sl(e)]}(i),t=po(t);var r=[];if(!i.length)return r;for(var o=0;o<t.length;){var s=(t[o]<<24|t[o+1]<<16|t[o+2]<<8|t[o+3])>>>0,a=t.subarray(o+4,o+8);if(0===s)break;var l=o+s;if(l>t.length){if(n)break;l=t.length}var u=t.subarray(o+8,l);_o(a,i[0])&&(1===i.length?r.push(u):r.push.apply(r,e(u,i.slice(1),n))),o=l}return r},Pl={EBML:po([26,69,223,163]),DocType:po([66,130]),Segment:po([24,83,128,103]),SegmentInfo:po([21,73,169,102]),Tracks:po([22,84,174,107]),Track:po([174]),TrackNumber:po([215]),DefaultDuration:po([35,227,131]),TrackEntry:po([174]),TrackType:po([131]),FlagDefault:po([136]),CodecID:po([134]),CodecPrivate:po([99,162]),VideoTrack:po([224]),AudioTrack:po([225]),Cluster:po([31,67,182,117]),Timestamp:po([231]),TimestampScale:po([42,215,177]),BlockGroup:po([160]),BlockDuration:po([155]),Block:po([161]),SimpleBlock:po([163])},Al=[128,64,32,16,8,4,2,1],xl=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=function(e){for(var t=1,i=0;i<Al.length&&!(e&Al[i]);i++)t++;return t}(e[t]),o=e.subarray(t,t+r);return i&&((o=Array.prototype.slice.call(e,t,t+r))[0]^=Al[r-1]),{length:r,value:go(o,{signed:n}),bytes:o}},Il=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map((function(t){return e(t)})):"number"==typeof t?vo(t):t},Ml=function e(t,i,n){if(n>=i.length)return i.length;var r=xl(i,n,!1);if(_o(t.bytes,r.bytes))return n;var o=xl(i,n+r.length);return e(t,i,n+o.length+o.value+r.length)},Ll=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return Il(e)})):[Il(e)]}(i),t=po(t);var n=[];if(!i.length)return n;for(var r=0;r<t.length;){var o=xl(t,r,!1),s=xl(t,r+o.length),a=r+o.length+s.length;127===s.value&&(s.value=Ml(o,t,a),s.value!==t.length&&(s.value-=a));var l=a+s.value>t.length?t.length:a+s.value,u=t.subarray(a,l);_o(i[0],o.bytes)&&(1===i.length?n.push(u):n=n.concat(e(u,i.slice(1)))),r+=o.length+s.length+u.length}return n},Dl=po([0,0,0,1]),Ol=po([0,0,1]),jl=po([0,0,3]),Rl=function(e){for(var t=[],i=1;i<e.length-2;)_o(e.subarray(i,i+3),jl)&&(t.push(i+2),i++),i++;if(0===t.length)return e;var n=e.length-t.length,r=new Uint8Array(n),o=0;for(i=0;i<n;o++,i++)o===t[0]&&(o++,t.shift()),r[i]=e[o];return r},Nl=function(e,t,i,n){void 0===n&&(n=1/0),e=po(e),i=[].concat(i);for(var r,o=0,s=0;o<e.length&&(s<n||r);){var a=void 0;if(_o(e.subarray(o),Dl)?a=4:_o(e.subarray(o),Ol)&&(a=3),a){if(s++,r)return Rl(e.subarray(r,o));var l=void 0;"h264"===t?l=31&e[o+a]:"h265"===t&&(l=e[o+a]>>1&63),-1!==i.indexOf(l)&&(r=o+a),o+=a+("h264"===t?1:2)}else o++}return e.subarray(0,0)},Ul={webm:po([119,101,98,109]),matroska:po([109,97,116,114,111,115,107,97]),flac:po([102,76,97,67]),ogg:po([79,103,103,83]),ac3:po([11,119]),riff:po([82,73,70,70]),avi:po([65,86,73]),wav:po([87,65,86,69]),"3gp":po([102,116,121,112,51,103]),mp4:po([102,116,121,112]),fmp4:po([115,116,121,112]),mov:po([102,116,121,112,113,116]),moov:po([109,111,111,118]),moof:po([109,111,111,102])},Bl={aac:function(e){var t=El(e);return _o(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=El(e);return _o(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Ll(e,[Pl.EBML,Pl.DocType])[0];return _o(t,Ul.webm)},mkv:function(e){var t=Ll(e,[Pl.EBML,Pl.DocType])[0];return _o(t,Ul.matroska)},mp4:function(e){return!Bl["3gp"](e)&&!Bl.mov(e)&&(!(!_o(e,Ul.mp4,{offset:4})&&!_o(e,Ul.fmp4,{offset:4}))||(!(!_o(e,Ul.moof,{offset:4})&&!_o(e,Ul.moov,{offset:4}))||void 0))},mov:function(e){return _o(e,Ul.mov,{offset:4})},"3gp":function(e){return _o(e,Ul["3gp"],{offset:4})},ac3:function(e){var t=El(e);return _o(e,Ul.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=El(e);return _o(e,Ul.flac,{offset:t})},ogg:function(e){return _o(e,Ul.ogg)},avi:function(e){return _o(e,Ul.riff)&&_o(e,Ul.avi,{offset:8})},wav:function(e){return _o(e,Ul.riff)&&_o(e,Ul.wav,{offset:8})},h264:function(e){return function(e,t,i){return Nl(e,"h264",t,i)}(e,7,3).length},h265:function(e){return function(e,t,i){return Nl(e,"h265",t,i)}(e,[32,33],3).length}},Fl=Object.keys(Bl).filter((function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e})).concat(["ts","h264","h265"]);
- /*! @name mpd-parser @version 0.21.1 @license Apache-2.0 */Fl.forEach((function(e){var t=Bl[e];Bl[e]=function(e){return t(po(e))}}));var Wl,Hl,Vl,Gl,zl=Bl,Yl=function(e){e=po(e);for(var t=0;t<Fl.length;t++){var i=Fl[t];if(zl[i](e))return i}return""},ql=9e4;for(var Xl,Zl=ql,Ql=(Wl=function(e){return e*ql},Hl=function(e,t){return e*t},Vl=function(e){return e/ql},Gl=function(e,t){return e/t},"7.20.3"),Kl={},Jl=function(e,t){return Kl[e]=Kl[e]||[],t&&(Kl[e]=Kl[e].concat(t)),Kl[e]},$l=function(e,t){var i=Jl(e).indexOf(t);return!(i<=-1)&&(Kl[e]=Kl[e].slice(),Kl[e].splice(i,1),!0)},eu={prefixed:!0},tu=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],iu=tu[0],nu=0
- /**
- * @license
- * Video.js 7.20.3 <http://videojs.com/>
- * Copyright Brightcove, Inc. <https://www.brightcove.com/>
- * Available under Apache License Version 2.0
- * <https://github.com/videojs/video.js/blob/main/LICENSE>
- *
- * Includes vtt.js <https://github.com/mozilla/vtt.js>
- * Available under Apache License Version 2.0
- * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
- */;nu<tu.length;nu++)if(tu[nu][1]in En){Xl=tu[nu];break}if(Xl){for(var ru=0;ru<Xl.length;ru++)eu[iu[ru]]=Xl[ru];eu.prefixed=Xl[0]!==iu[0]}var ou=[];var su=function e(t){var i,n="info",r=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i("log",n,t)};return i=function(e,t){return function(i,n,r){var o=t.levels[n],s=new RegExp("^("+o+")$");if("log"!==i&&r.unshift(i.toUpperCase()+":"),r.unshift(e+":"),ou){ou.push([].concat(r));var a=ou.length-1e3;ou.splice(0,a>0?a:0)}if(bn.console){var l=bn.console[i];l||"debug"!==i||(l=bn.console.info||bn.console.log),l&&o&&s.test(i)&&l[Array.isArray(r)?"apply":"call"](bn.console,r)}}}(t,r),r.createLogger=function(i){return e(t+": "+i)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},r.level=function(e){if("string"==typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');n=e}return n},(r.history=function(){return ou?[].concat(ou):[]}).filter=function(e){return(ou||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},r.history.clear=function(){ou&&(ou.length=0)},r.history.disable=function(){null!==ou&&(ou.length=0,ou=null)},r.history.enable=function(){null===ou&&(ou=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("error",n,t)},r.warn=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("warn",n,t)},r.debug=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i("debug",n,t)},r}("VIDEOJS"),au=su.createLogger,lu=Object.prototype.toString,uu=function(e){return du(e)?Object.keys(e):[]};function cu(e,t){uu(e).forEach((function(i){return t(e[i],i)}))}function hu(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Object.assign?Sn.apply(void 0,[e].concat(i)):(i.forEach((function(t){t&&cu(t,(function(t,i){e[i]=t}))})),e)}function du(e){return!!e&&"object"==typeof e}function pu(e){return du(e)&&"[object Object]"===lu.call(e)&&e.constructor===Object}function fu(e,t){if(!e||!t)return"";if("function"==typeof bn.getComputedStyle){var i;try{i=bn.getComputedStyle(e)}catch($v){return""}return i?i.getPropertyValue(t)||i[t]:""}return""}var mu,gu,vu,yu=bn.navigator&&bn.navigator.userAgent||"",_u=/AppleWebKit\/([\d.]+)/i.exec(yu),bu=_u?parseFloat(_u.pop()):null,Cu=/iPod/i.test(yu),Tu=(mu=yu.match(/OS (\d+)_/i))&&mu[1]?mu[1]:null,wu=/Android/i.test(yu),Eu=function(){var e=yu.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),Su=wu&&Eu<5&&bu<537,ku=/Firefox/i.test(yu),Pu=/Edg/i.test(yu),Au=!Pu&&(/Chrome/i.test(yu)||/CriOS/i.test(yu)),xu=function(){var e=yu.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Iu=(gu=/MSIE\s(\d+)\.\d/.exec(yu),!(vu=gu&&parseFloat(gu[1]))&&/Trident\/7.0/i.test(yu)&&/rv:11.0/.test(yu)&&(vu=11),vu),Mu=/Safari/i.test(yu)&&!Au&&!wu&&!Pu,Lu=/Windows/i.test(yu),Du=Boolean(Wu()&&("ontouchstart"in bn||bn.navigator.maxTouchPoints||bn.DocumentTouch&&bn.document instanceof bn.DocumentTouch)),Ou=/iPad/i.test(yu)||Mu&&Du&&!/iPhone/i.test(yu),ju=/iPhone/i.test(yu)&&!Ou,Ru=ju||Ou||Cu,Nu=(Mu||Ru)&&!Au,Uu=Object.freeze({__proto__:null,IS_IPOD:Cu,IOS_VERSION:Tu,IS_ANDROID:wu,ANDROID_VERSION:Eu,IS_NATIVE_ANDROID:Su,IS_FIREFOX:ku,IS_EDGE:Pu,IS_CHROME:Au,CHROME_VERSION:xu,IE_VERSION:Iu,IS_SAFARI:Mu,IS_WINDOWS:Lu,TOUCH_ENABLED:Du,IS_IPAD:Ou,IS_IPHONE:ju,IS_IOS:Ru,IS_ANY_SAFARI:Nu});function Bu(e){return"string"==typeof e&&Boolean(e.trim())}function Fu(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Wu(){return En===bn.document}function Hu(e){return du(e)&&1===e.nodeType}function Vu(){try{return bn.parent!==bn.self}catch(e){return!0}}function Gu(e){return function(t,i){if(!Bu(t))return En[e](null);Bu(i)&&(i=En.querySelector(i));var n=Hu(i)?i:En;return n[e]&&n[e](t)}}function zu(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=En.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(su.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?Yu(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&hc(r,n),r}function Yu(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function qu(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function Xu(e,t){return Fu(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function Zu(e,t){return e.classList?e.classList.add(t):Xu(e,t)||(e.className=(e.className+" "+t).trim()),e}function Qu(e,t){return e?(e.classList?e.classList.remove(t):(Fu(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e):(su.warn("removeClass was called with an element that doesn't exist"),null)}function Ku(e,t,i){var n=Xu(e,t);if("function"==typeof i&&(i=i(e,t)),"boolean"!=typeof i&&(i=!n),i!==n)return i?Zu(e,t):Qu(e,t),e}function Ju(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null==n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function $u(e){var t={};if(e&&e.attributes&&e.attributes.length>0)for(var i=e.attributes,n=i.length-1;n>=0;n--){var r=i[n].name,o=i[n].value;"boolean"!=typeof e[r]&&-1===",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+r+",")||(o=null!==o),t[r]=o}return t}function ec(e,t){return e.getAttribute(t)}function tc(e,t,i){e.setAttribute(t,i)}function ic(e,t){e.removeAttribute(t)}function nc(){En.body.focus(),En.onselectstart=function(){return!1}}function rc(){En.onselectstart=function(){return!0}}function oc(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(fu(e,"height"))),i.width||(i.width=parseFloat(fu(e,"width"))),i}}function sc(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==En[eu.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function ac(e,t){var i={x:0,y:0};if(Ru)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r=fu(n,"transform");if(/^matrix/.test(r)){var o=r.slice(7,-1).split(/,\s/).map(Number);i.x+=o[4],i.y+=o[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);i.x+=s[12],i.y+=s[13]}n=n.parentNode}var a={},l=sc(t.target),u=sc(e),c=u.width,h=u.height,d=t.offsetY-(u.top-l.top),p=t.offsetX-(u.left-l.left);return t.changedTouches&&(p=t.changedTouches[0].pageX-u.left,d=t.changedTouches[0].pageY+u.top,Ru&&(p-=i.x,d-=i.y)),a.y=1-Math.max(0,Math.min(1,d/h)),a.x=Math.max(0,Math.min(1,p/c)),a}function lc(e){return du(e)&&3===e.nodeType}function uc(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function cc(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"==typeof e&&(e=e()),Hu(e)||lc(e)?e:"string"==typeof e&&/\S/.test(e)?En.createTextNode(e):void 0})).filter((function(e){return e}))}function hc(e,t){return cc(t).forEach((function(t){return e.appendChild(t)})),e}function dc(e,t){return hc(uc(e),t)}function pc(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var fc,mc=Gu("querySelector"),gc=Gu("querySelectorAll"),vc=Object.freeze({__proto__:null,isReal:Wu,isEl:Hu,isInFrame:Vu,createEl:zu,textContent:Yu,prependTo:qu,hasClass:Xu,addClass:Zu,removeClass:Qu,toggleClass:Ku,setAttributes:Ju,getAttributes:$u,getAttribute:ec,setAttribute:tc,removeAttribute:ic,blockTextSelection:nc,unblockTextSelection:rc,getBoundingClientRect:oc,findPosition:sc,getPointerPosition:ac,isTextNode:lc,emptyEl:uc,normalizeContent:cc,appendContent:hc,insertContent:dc,isSingleLeftClick:pc,$:mc,$$:gc}),yc=!1,_c=function(){if(!1!==fc.options.autoSetup){var e=Array.prototype.slice.call(En.getElementsByTagName("video")),t=Array.prototype.slice.call(En.getElementsByTagName("audio")),i=Array.prototype.slice.call(En.getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&n.length>0)for(var r=0,o=n.length;r<o;r++){var s=n[r];if(!s||!s.getAttribute){bc(1);break}void 0===s.player&&null!==s.getAttribute("data-setup")&&fc(s)}else yc||bc(1)}};function bc(e,t){Wu()&&(t&&(fc=t),bn.setTimeout(_c,e))}function Cc(){yc=!0,bn.removeEventListener("load",Cc)}Wu()&&("complete"===En.readyState?Cc():bn.addEventListener("load",Cc));var Tc,wc=function(e){var t=En.createElement("style");return t.className=e,t},Ec=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},Sc=3;function kc(){return Sc++}bn.WeakMap||(Tc=function(){function e(){this.vdata="vdata"+Math.floor(bn.performance&&bn.performance.now()||Date.now()),this.data={}}var t=e.prototype;return t.set=function(e,t){var i=e[this.vdata]||kc();return e[this.vdata]||(e[this.vdata]=i),this.data[i]=t,this},t.get=function(e){var t=e[this.vdata];if(t)return this.data[t];su("We have no data for this element",e)},t.has=function(e){return e[this.vdata]in this.data},t.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},e}());var Pc,Ac=bn.WeakMap?new WeakMap:new Tc;function xc(e,t){if(Ac.has(e)){var i=Ac.get(e);0===i.handlers[t].length&&(delete i.handlers[t],e.removeEventListener?e.removeEventListener(t,i.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,i.dispatcher)),Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled),0===Object.getOwnPropertyNames(i).length&&Ac.delete(e)}}function Ic(e,t,i,n){i.forEach((function(i){e(t,i,n)}))}function Mc(e){if(e.fixed_)return e;function t(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){var n=e||bn.event;for(var r in e={},n)"layerX"!==r&&"layerY"!==r&&"keyLocation"!==r&&"webkitMovementX"!==r&&"webkitMovementY"!==r&&"path"!==r&&("returnValue"===r&&n.preventDefault||(e[r]=n[r]));if(e.target||(e.target=e.srcElement||En),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){n.preventDefault&&n.preventDefault(),e.returnValue=!1,n.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),e.cancelBubble=!0,n.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=i,null!==e.clientX&&void 0!==e.clientX){var o=En.documentElement,s=En.body;e.pageX=e.clientX+(o&&o.scrollLeft||s&&s.scrollLeft||0)-(o&&o.clientLeft||s&&s.clientLeft||0),e.pageY=e.clientY+(o&&o.scrollTop||s&&s.scrollTop||0)-(o&&o.clientTop||s&&s.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var Lc=["touchstart","touchmove"];function Dc(e,t,i){if(Array.isArray(t))return Ic(Dc,e,t,i);Ac.has(e)||Ac.set(e,{});var n=Ac.get(e);if(n.handlers||(n.handlers={}),n.handlers[t]||(n.handlers[t]=[]),i.guid||(i.guid=kc()),n.handlers[t].push(i),n.dispatcher||(n.disabled=!1,n.dispatcher=function(t,i){if(!n.disabled){t=Mc(t);var r=n.handlers[t.type];if(r)for(var o=r.slice(0),s=0,a=o.length;s<a&&!t.isImmediatePropagationStopped();s++)try{o[s].call(e,t,i)}catch($v){su.error($v)}}}),1===n.handlers[t].length)if(e.addEventListener){var r=!1;(function(){if("boolean"!=typeof Pc){Pc=!1;try{var e=Object.defineProperty({},"passive",{get:function(){Pc=!0}});bn.addEventListener("test",null,e),bn.removeEventListener("test",null,e)}catch($v){}}return Pc})()&&Lc.indexOf(t)>-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function Oc(e,t,i){if(Ac.has(e)){var n=Ac.get(e);if(n.handlers){if(Array.isArray(t))return Ic(Oc,e,t,i);var r=function(e,t){n.handlers[t]=[],xc(e,t)};if(void 0!==t){var o=n.handlers[t];if(o)if(i){if(i.guid)for(var s=0;s<o.length;s++)o[s].guid===i.guid&&o.splice(s--,1);xc(e,t)}else r(e,t)}else for(var a in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},a)&&r(e,a)}}}function jc(e,t,i){var n=Ac.has(e)?Ac.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=Mc(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles)jc.call(null,r,t,i);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){Ac.has(t.target)||Ac.set(t.target,{});var o=Ac.get(t.target);t.target[t.type]&&(o.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),o.disabled=!1)}return!t.defaultPrevented}function Rc(e,t,i){if(Array.isArray(t))return Ic(Rc,e,t,i);var n=function n(){Oc(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||kc(),Dc(e,t,n)}function Nc(e,t,i){var n=function n(){Oc(e,t,n),i.apply(this,arguments)};n.guid=i.guid=i.guid||kc(),Dc(e,t,n)}var Uc,Bc=Object.freeze({__proto__:null,fixEvent:Mc,on:Dc,off:Oc,trigger:jc,one:Rc,any:Nc}),Fc=30,Wc=function(e,t,i){t.guid||(t.guid=kc());var n=t.bind(e);return n.guid=i?i+"_"+t.guid:t.guid,n},Hc=function(e,t){var i=bn.performance.now();return function(){var n=bn.performance.now();n-i>=t&&(e.apply(void 0,arguments),i=n)}},Vc=function(){};Vc.prototype.allowedEvents_={},Vc.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Dc(this,e,t),this.addEventListener=i},Vc.prototype.addEventListener=Vc.prototype.on,Vc.prototype.off=function(e,t){Oc(this,e,t)},Vc.prototype.removeEventListener=Vc.prototype.off,Vc.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Rc(this,e,t),this.addEventListener=i},Vc.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Nc(this,e,t),this.addEventListener=i},Vc.prototype.trigger=function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=Mc(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),jc(this,e)},Vc.prototype.dispatchEvent=Vc.prototype.trigger,Vc.prototype.queueTrigger=function(e){var t=this;Uc||(Uc=new Map);var i=e.type||e,n=Uc.get(this);n||(n=new Map,Uc.set(this,n));var r=n.get(i);n.delete(i),bn.clearTimeout(r);var o=bn.setTimeout((function(){0===n.size&&(n=null,Uc.delete(t)),t.trigger(e)}),0);n.set(i,o)};var Gc=function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e},zc=function(e){return e instanceof Vc||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"==typeof e[t]}))},Yc=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},qc=function(e,t,i){if(!e||!e.nodeName&&!zc(e))throw new Error("Invalid target for "+Gc(t)+"#"+i+"; must be a DOM node or evented object.")},Xc=function(e,t,i){if(!Yc(e))throw new Error("Invalid event type for "+Gc(t)+"#"+i+"; must be a non-empty string or array.")},Zc=function(e,t,i){if("function"!=typeof e)throw new Error("Invalid listener for "+Gc(t)+"#"+i+"; must be a function.")},Qc=function(e,t,i){var n,r,o,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(n=e.eventBusEl_,t.length>=3&&t.shift(),r=t[0],o=t[1]):(n=t[0],r=t[1],o=t[2]),qc(n,e,i),Xc(r,e,i),Zc(o,e,i),{isTargetingSelf:s,target:n,type:r,listener:o=Wc(e,o)}},Kc=function(e,t,i,n){qc(e,e,t),e.nodeName?Bc[t](e,i,n):e[t](i,n)},Jc={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Qc(this,i,"on"),o=r.isTargetingSelf,s=r.target,a=r.type,l=r.listener;if(Kc(s,"on",a,l),!o){var u=function(){return e.off(s,a,l)};u.guid=l.guid;var c=function(){return e.off("dispose",u)};c.guid=l.guid,Kc(this,"on","dispose",u),Kc(s,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Qc(this,i,"one"),o=r.isTargetingSelf,s=r.target,a=r.type,l=r.listener;if(o)Kc(s,"one",a,l);else{var u=function t(){e.off(s,a,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];l.apply(null,n)};u.guid=l.guid,Kc(s,"one",a,u)}},any:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=Qc(this,i,"any"),o=r.isTargetingSelf,s=r.target,a=r.type,l=r.listener;if(o)Kc(s,"any",a,l);else{var u=function t(){e.off(s,a,t);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];l.apply(null,n)};u.guid=l.guid,Kc(s,"any",a,u)}},off:function(e,t,i){if(!e||Yc(e))Oc(this.eventBusEl_,e,t);else{var n=e,r=t;qc(n,this,"off"),Xc(r,this,"off"),Zc(i,this,"off"),i=Wc(this,i),this.off("dispose",i),n.nodeName?(Oc(n,r,i),Oc(n,"dispose",i)):zc(n)&&(n.off(r,i),n.off("dispose",i))}},trigger:function(e,t){qc(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(!Yc(i)){var n="Invalid event type for "+Gc(this)+"#trigger; must be a non-empty string or object with a type key that has a non-empty value.";if(!e)throw new Error(n);(this.log||su).error(n)}return jc(this.eventBusEl_,e,t)}};function $c(e,t){void 0===t&&(t={});var i=t.eventBusKey;if(i){if(!e[i].nodeName)throw new Error('The eventBusKey "'+i+'" does not refer to an element.');e.eventBusEl_=e[i]}else e.eventBusEl_=zu("span",{className:"vjs-event-bus"});return hu(e,Jc),e.eventedCallbacks&&e.eventedCallbacks.forEach((function(e){e()})),e.on("dispose",(function(){e.off(),[e,e.el_,e.eventBusEl_].forEach((function(e){e&&Ac.has(e)&&Ac.delete(e)})),bn.setTimeout((function(){e.eventBusEl_=null}),0)})),e}var eh={state:{},setState:function(e){var t,i=this;return"function"==typeof e&&(e=e()),cu(e,(function(e,n){i.state[n]!==e&&((t=t||{})[n]={from:i.state[n],to:e}),i.state[n]=e})),t&&zc(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function th(e,t){return hu(e,eh),e.state=hu({},e.state,t),"function"==typeof e.handleStateChanged&&zc(e)&&e.on("statechanged",e.handleStateChanged),e}var ih=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toLowerCase()}))},nh=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))};function rh(){for(var e={},t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.forEach((function(t){t&&cu(t,(function(t,i){pu(t)?(pu(e[i])||(e[i]={}),e[i]=rh(e[i],t)):e[i]=t}))})),e}var oh=function(){function e(){this.map_={}}var t=e.prototype;return t.has=function(e){return e in this.map_},t.delete=function(e){var t=this.has(e);return delete this.map_[e],t},t.set=function(e,t){return this.map_[e]=t,this},t.forEach=function(e,t){for(var i in this.map_)e.call(t,this.map_[i],i,this)},e}(),sh=bn.Map?bn.Map:oh,ah=function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var i in this.set_)e.call(t,i,i,this)},e}(),lh=bn.Set?bn.Set:ah,uh=function(){function e(e,t,i){var n=this;if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=rh({},this.options_),t=this.options_=rh(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){var r=e&&e.id&&e.id()||"no_player";this.id_=r+"_component_"+kc()}this.name_=t.name||null,t.el?this.el_=t.el:!1!==t.createEl&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach((function(e){return n.addClass(e)})),!1!==t.evented&&($c(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),th(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new lh,this.setIntervalIds_=new lh,this.rafIds_=new lh,this.namedRafs_=new sh,this.clearingTimersOnDispose_=!1,!1!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var t=e.prototype;return t.dispose=function(e){if(void 0===e&&(e={}),!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=rh(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return zu(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),o=r&&r[n],s=n&&n.split("-")[0],a=r&&r[s],l=i;return o&&o[e]?l=o[e]:a&&a[e]&&(l=a[e]),t&&(l=l.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return void 0===n&&(r=e),r}))),l},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];t=t.reduce((function(e,t){return e.concat(t)}),[]);for(var n=this,r=0;r<t.length;r++)if(!(n=n.getChild(t[r]))||!n.getChild)return;return n},t.addChild=function(t,i,n){var r,o;if(void 0===i&&(i={}),void 0===n&&(n=this.children_.length),"string"==typeof t){o=nh(t);var s=i.componentClass||o;i.name=o;var a=e.getComponent(s);if(!a)throw new Error("Component "+s+" does not exist");if("function"!=typeof a)return null;r=new a(this.player_||this,i)}else r=t;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,"function"==typeof r.id&&(this.childIndex_[r.id()]=r),(o=o||r.name&&nh(r.name()))&&(this.childNameIndex_[o]=r,this.childNameIndex_[ih(o)]=r),"function"==typeof r.el&&r.el()){var l=null;this.children_[n+1]&&(this.children_[n+1].el_?l=this.children_[n+1].el_:Hu(this.children_[n+1])&&(l=this.children_[n+1])),this.contentEl().insertBefore(r.el(),l)}return r},t.removeChild=function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,i=this.children_.length-1;i>=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[nh(e.name())]=null,this.childNameIndex_[ih(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},t.initChildren=function(){var t=this,i=this.options_.children;if(i){var n,r=this.options_,o=e.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"==typeof t?e===t:e===t.name}))}))).map((function(e){var n,r;return"string"==typeof e?r=i[n=e]||t.options_[n]||{}:(n=e.name,r=e),{name:n,opts:r}})).filter((function(t){var i=e.getComponent(t.opts.componentClass||nh(t.name));return i&&!o.isTech(i)})).forEach((function(e){var i=e.name,n=e.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=t.options_.playerOptions;var o=t.addChild(i,n);o&&(t[i]=o)}}))}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return mc(e,t||this.contentEl())},t.$$=function(e,t){return gc(e,t||this.contentEl())},t.hasClass=function(e){return Xu(this.el_,e)},t.addClass=function(e){Zu(this.el_,e)},t.removeClass=function(e){Qu(this.el_,e)},t.toggleClass=function(e,t){Ku(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return ec(this.el_,e)},t.setAttribute=function(e,t){tc(this.el_,e,t)},t.removeAttribute=function(e){ic(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+nh(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=fu(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+nh(e);t=this.el_[i]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(Pn.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=bn.performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){var n=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(e=!1)}}));var n=function(){e=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){(i=null,!0===e)&&(bn.performance.now()-t<200&&(n.preventDefault(),this.trigger("tap")))}))},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=Wc(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},t.setTimeout=function(e,t){var i,n=this;return e=Wc(this,e),this.clearTimersOnDispose_(),i=bn.setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),bn.clearTimeout(e)),e},t.setInterval=function(e,t){e=Wc(this,e),this.clearTimersOnDispose_();var i=bn.setInterval(e,t);return this.setIntervalIds_.add(i),i},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),bn.clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=Wc(this,e),t=bn.requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=Wc(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),bn.cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach((function(t,i){return e[n](i)}))})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n,r=e.getComponent("Tech"),o=r&&r.isTech(i),s=e===i||e.prototype.isPrototypeOf(i.prototype);if(o||!s)throw n=o?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+n+".");t=nh(t),e.components_||(e.components_={});var a=e.getComponent("Player");if("Player"===t&&a&&a.players){var l=a.players,u=Object.keys(l);if(l&&u.length>0&&u.map((function(e){return l[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[ih(t)]=i,i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();function ch(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function hh(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:ch.bind(null,"start",0,e),end:ch.bind(null,"end",1,e)},bn.Symbol&&bn.Symbol.iterator&&(t[bn.Symbol.iterator]=function(){return(e||[]).values()}),t}function dh(e,t){return Array.isArray(e)?hh(e):void 0===e||void 0===t?hh():hh([[e,t]])}function ph(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=dh(0,0));for(var o=0;o<e.length;o++)i=e.start(o),(n=e.end(o))>t&&(n=t),r+=n-i;return r/t}function fh(e){if(e instanceof fh)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:du(e)&&("number"==typeof e.code&&(this.code=e.code),hu(this,e)),this.message||(this.message=fh.defaultMessages[this.code]||"")}uh.prototype.supportsRaf_="function"==typeof bn.requestAnimationFrame&&"function"==typeof bn.cancelAnimationFrame,uh.registerComponent("Component",uh),fh.prototype.code=0,fh.prototype.message="",fh.prototype.status=null,fh.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],fh.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var mh=0;mh<fh.errorTypes.length;mh++)fh[fh.errorTypes[mh]]=mh,fh.prototype[fh.errorTypes[mh]]=mh;function gh(e){return null!=e&&"function"==typeof e.then}function vh(e){gh(e)&&e.then(null,(function(e){}))}var yh=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((function(t,i,n){return e[i]&&(t[i]=e[i]),t}),{cues:e.cues&&Array.prototype.map.call(e.cues,(function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}}))})},_h=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,(function(e){return e.track}));return Array.prototype.map.call(t,(function(e){var t=yh(e.track);return e.src&&(t.src=e.src),t})).concat(Array.prototype.filter.call(e.textTracks(),(function(e){return-1===i.indexOf(e)})).map(yh))},bh=function(e,t){return e.forEach((function(e){var i=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach((function(e){return i.addCue(e)}))})),t.textTracks()},Ch=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleKeyDown_=function(e){return n.handleKeyDown(e)},n.close_=function(e){return n.close(e)},n.opened_=n.hasBeenOpened_=n.hasBeenFilled_=!1,n.closeable(!n.options_.uncloseable),n.content(n.options_.content),n.contentEl_=zu("div",{className:"vjs-modal-dialog-content"},{role:"document"}),n.descEl_=zu("p",{className:"vjs-modal-dialog-description vjs-control-text",id:n.el().getAttribute("aria-describedby")}),Yu(n.descEl_,n.description()),n.el_.appendChild(n.descEl_),n.el_.appendChild(n.contentEl_),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},i.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-modal-dialog vjs-hidden "+e.prototype.buildCSSClass.call(this)},i.label=function(){return this.localize(this.options_.label||"Modal Window")},i.description=function(){var e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e},i.open=function(){if(!this.opened_){var e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}},i.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},i.close=function(){if(this.opened_){var e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}},i.closeable=function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,i=this.getChild("closeButton");if(t&&!i){var n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_},i.fill=function(){this.fillWith(this.content())},i.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),dc(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);var r=this.getChild("closeButton");r&&i.appendChild(r.el_)},i.empty=function(){this.trigger("beforemodalempty"),uc(this.contentEl()),this.trigger("modalempty")},i.content=function(e){return void 0!==e&&(this.content_=e),this.content_},i.conditionalFocus_=function(){var e=En.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())},i.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},i.handleKeyDown=function(e){if(e.stopPropagation(),Pn.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(Pn.isEventKey(e,"Tab")){for(var t,i=this.focusableEls_(),n=this.el_.querySelector(":focus"),r=0;r<i.length;r++)if(n===i[r]){t=r;break}En.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(i[i.length-1].focus(),e.preventDefault()):e.shiftKey||t!==i.length-1||(i[0].focus(),e.preventDefault())}},i.focusableEls_=function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,(function(e){return(e instanceof bn.HTMLAnchorElement||e instanceof bn.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof bn.HTMLInputElement||e instanceof bn.HTMLSelectElement||e instanceof bn.HTMLTextAreaElement||e instanceof bn.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof bn.HTMLIFrameElement||e instanceof bn.HTMLObjectElement||e instanceof bn.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")}))},t}(uh);Ch.prototype.options_={pauseOnOpen:!0,temporary:!0},uh.registerComponent("ModalDialog",Ch);var Th=function(e){function t(t){var i;void 0===t&&(t=[]),(i=e.call(this)||this).tracks_=[],Object.defineProperty(An(i),"length",{get:function(){return this.tracks_.length}});for(var n=0;n<t.length;n++)i.addTrack(t[n]);return i}In(t,e);var i=t.prototype;return i.addTrack=function(e){var t=this,i=this.tracks_.length;""+i in this||Object.defineProperty(this,i,{get:function(){return this.tracks_[i]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=function(){t.trigger({track:e,type:"labelchange",target:t})},zc(e)&&e.addEventListener("labelchange",e.labelchange_)},i.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(Vc);for(var wh in Th.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"},Th.prototype.allowedEvents_)Th.prototype["on"+wh]=null;var Eh=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)},Sh=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].enabled){Eh(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}In(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&Eh(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,Eh(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(Th),kh=function(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)},Ph=function(e){function t(t){var i;void 0===t&&(t=[]);for(var n=t.length-1;n>=0;n--)if(t[n].selected){kh(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(An(i),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),i}In(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.selected&&kh(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,kh(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(Th),Ah=function(e){function t(){return e.apply(this,arguments)||this}In(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;e.prototype.addTrack.call(this,t),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(Th),xh=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),Ih=function(){function e(t){e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=e.prototype;return t.setCues_=function(e){var t=this.length||0,i=0,n=e.length;this.cues_=e,this.length_=e.length;var r=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)},t.getCueById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},e}(),Mh={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Lh={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Dh={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Oh={disabled:"disabled",hidden:"hidden",showing:"showing"},jh=function(e){function t(t){var i;void 0===t&&(t={}),i=e.call(this)||this;var n={id:t.id||"vjs_track_"+kc(),kind:t.kind||"",language:t.language||""},r=t.label||"",o=function(e){Object.defineProperty(An(i),e,{get:function(){return n[e]},set:function(){}})};for(var s in n)o(s);return Object.defineProperty(An(i),"label",{get:function(){return r},set:function(e){e!==r&&(r=e,this.trigger("labelchange"))}}),i}return In(t,e),t}(Vc),Rh=function(e){var t=["protocol","hostname","port","pathname","search","hash","host"],i=En.createElement("a");i.href=e;for(var n={},r=0;r<t.length;r++)n[t[r]]=i[t[r]];return"http:"===n.protocol&&(n.host=n.host.replace(/:80$/,"")),"https:"===n.protocol&&(n.host=n.host.replace(/:443$/,"")),n.protocol||(n.protocol=bn.location.protocol),n.host||(n.host=bn.location.host),n},Nh=function(e){if(!e.match(/^https?:\/\//)){var t=En.createElement("a");t.href=e,e=t.href}return e},Uh=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},Bh=function(e,t){void 0===t&&(t=bn.location);var i=Rh(e);return(":"===i.protocol?t.protocol:i.protocol)+i.host!==t.protocol+t.host},Fh=Object.freeze({__proto__:null,parseUrl:Rh,getAbsoluteURL:Nh,getFileExtension:Uh,isCrossOrigin:Bh}),Wh=function(e,t){var i=new bn.WebVTT.Parser(bn,bn.vttjs,bn.WebVTT.StringDecoder()),n=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){n.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),n.length>0&&(bn.console&&bn.console.groupCollapsed&&bn.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return su.error(e)})),bn.console&&bn.console.groupEnd&&bn.console.groupEnd()),i.flush()},Hh=function(e,t){var i={uri:e},n=Bh(e);n&&(i.cors=n);var r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),Gn(i,Wc(this,(function(e,i,n){if(e)return su.error(e,i);t.loaded_=!0,"function"!=typeof bn.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return Wh(n,t);su.error("vttjs failed to load, stopping trying to process "+t.src)})):Wh(n,t)})))},Vh=function(e){function t(t){var i;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var n=rh(t,{kind:Dh[t.kind]||"subtitles",language:t.language||t.srclang||""}),r=Oh[n.mode]||"disabled",o=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=e.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var s=new Ih(i.cues_),a=new Ih(i.activeCues_),l=!1;i.timeupdateHandler=Wc(An(i),(function(e){void 0===e&&(e={}),this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))}));return i.tech_.one("dispose",(function(){i.stopTracking()})),"disabled"!==r&&i.startTracking(),Object.defineProperties(An(i),{default:{get:function(){return o},set:function(){}},mode:{get:function(){return r},set:function(e){Oh[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||Hh(this.src,this),this.stopTracking(),"disabled"!==r&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return a;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];(r.startTime<=e&&r.endTime>=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(l=!1,t.length!==this.activeCues_.length)l=!0;else for(var o=0;o<t.length;o++)-1===this.activeCues_.indexOf(t[o])&&(l=!0);return this.activeCues_=t,a.setCues_(this.activeCues_),a},set:function(){}}}),n.src?(i.src=n.src,i.preload_||(i.loaded_=!0),(i.preload_||"subtitles"!==n.kind&&"captions"!==n.kind)&&Hh(i.src,An(i))):i.loaded_=!0,i}In(t,e);var i=t.prototype;return i.startTracking=function(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)},i.stopTracking=function(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)},i.addCue=function(e){var t=e;if(bn.vttjs&&!(e instanceof bn.vttjs.VTTCue)){for(var i in t=new bn.vttjs.VTTCue(e.startTime,e.endTime,e.text),e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}for(var n=this.tech_.textTracks(),r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)},i.removeCue=function(e){for(var t=this.cues_.length;t--;){var i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}},t}(jh);Vh.prototype.allowedEvents_={cuechange:"cuechange"};var Gh=function(e){function t(t){var i;void 0===t&&(t={});var n=rh(t,{kind:Lh[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(An(i),"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),n.enabled&&(i.enabled=n.enabled),i.loaded_=!0,i}return In(t,e),t}(jh),zh=function(e){function t(t){var i;void 0===t&&(t={});var n=rh(t,{kind:Mh[t.kind]||""});i=e.call(this,n)||this;var r=!1;return Object.defineProperty(An(i),"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),n.selected&&(i.selected=n.selected),i}return In(t,e),t}(jh),Yh=function(e){function t(t){var i,n;void 0===t&&(t={}),i=e.call(this)||this;var r=new Vh(t);return i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i.default=r.default,Object.defineProperties(An(i),{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=0,r.addEventListener("loadeddata",(function(){n=2,i.trigger({type:"load",target:An(i)})})),i}return In(t,e),t}(Vc);Yh.prototype.allowedEvents_={load:"load"},Yh.NONE=0,Yh.LOADING=1,Yh.LOADED=2,Yh.ERROR=3;var qh={audio:{ListClass:Sh,TrackClass:Gh,capitalName:"Audio"},video:{ListClass:Ph,TrackClass:zh,capitalName:"Video"},text:{ListClass:Ah,TrackClass:Vh,capitalName:"Text"}};Object.keys(qh).forEach((function(e){qh[e].getterName=e+"Tracks",qh[e].privateName=e+"Tracks_"}));var Xh={remoteText:{ListClass:Ah,TrackClass:Vh,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:xh,TrackClass:Yh,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Zh=Sn({},qh,Xh);Xh.names=Object.keys(Xh),qh.names=Object.keys(qh),Zh.names=[].concat(Xh.names).concat(qh.names);var Qh=function(e){function t(t,i){var n;return void 0===t&&(t={}),void 0===i&&(i=function(){}),t.reportTouchActivity=!1,(n=e.call(this,null,t,i)||this).onDurationChange_=function(e){return n.onDurationChange(e)},n.trackProgress_=function(e){return n.trackProgress(e)},n.trackCurrentTime_=function(e){return n.trackCurrentTime(e)},n.stopTrackingCurrentTime_=function(e){return n.stopTrackingCurrentTime(e)},n.disposeSourceHandler_=function(e){return n.disposeSourceHandler(e)},n.queuedHanders_=new Set,n.hasStarted_=!1,n.on("playing",(function(){this.hasStarted_=!0})),n.on("loadstart",(function(){this.hasStarted_=!1})),Zh.names.forEach((function(e){var i=Zh[e];t&&t[i.getterName]&&(n[i.privateName]=t[i.getterName])})),n.featuresProgressEvents||n.manualProgressOn(),n.featuresTimeupdateEvents||n.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach((function(e){!1===t["native"+e+"Tracks"]&&(n["featuresNative"+e+"Tracks"]=!1)})),!1===t.nativeCaptions||!1===t.nativeTextTracks?n.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(n.featuresNativeTextTracks=!0),n.featuresNativeTextTracks||n.emulateTextTracks(),n.preloadTextTracks=!1!==t.preloadTextTracks,n.autoRemoteTextTracks_=new Zh.text.ListClass,n.initTrackListeners(),t.nativeControlsForTouch||n.emitTapEvents(),n.constructor&&(n.name_=n.constructor.name||"Unknown Tech"),n}In(t,e);var i=t.prototype;return i.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",(function(){return t.setTimeout((function(){return t.triggerSourceset(e)}),1)})),this.trigger({src:e,type:"sourceset"})},i.manualProgressOn=function(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)},i.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)},i.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Wc(this,(function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()})),500)},i.onDurationChange=function(e){this.duration_=this.duration()},i.buffered=function(){return dh(0,0)},i.bufferedPercent=function(){return ph(this.buffered(),this.duration_)},i.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},i.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)},i.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)},i.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval((function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}),250)},i.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.dispose=function(){this.clearTracks(qh.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),e.prototype.dispose.call(this)},i.clearTracks=function(e){var t=this;(e=[].concat(e)).forEach((function(e){for(var i=t[e+"Tracks"]()||[],n=i.length;n--;){var r=i[n];"text"===e&&t.removeRemoteTextTrack(r),i.removeTrack(r)}}))},i.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},i.reset=function(){},i.crossOrigin=function(){},i.setCrossOrigin=function(){},i.error=function(e){return void 0!==e&&(this.error_=new fh(e),this.trigger("error")),this.error_},i.played=function(){return this.hasStarted_?dh(0,0):dh()},i.play=function(){},i.setScrubbing=function(){},i.scrubbing=function(){},i.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},i.initTrackListeners=function(){var e=this;qh.names.forEach((function(t){var i=qh[t],n=function(){e.trigger(t+"trackchange")},r=e[i.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),e.on("dispose",(function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)}))}))},i.addWebVttScript_=function(){var e=this;if(!bn.WebVTT)if(En.body.contains(this.el())){if(!this.options_["vtt.js"]&&pu(Ar)&&Object.keys(Ar).length>0)return void this.trigger("vttjsloaded");var t=En.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",(function(){t.onload=null,t.onerror=null})),bn.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var o=function(){return e.trigger("texttrackchange")},s=function(){o();for(var e=0;e<t.length;e++){var i=t[e];i.removeEventListener("cuechange",o),"showing"===i.mode&&i.addEventListener("cuechange",o)}};s(),t.addEventListener("change",s),t.addEventListener("addtrack",s),t.addEventListener("removetrack",s),this.on("dispose",(function(){i.off("addtrack",n),i.off("removetrack",r),t.removeEventListener("change",s),t.removeEventListener("addtrack",s),t.removeEventListener("removetrack",s);for(var e=0;e<t.length;e++){t[e].removeEventListener("cuechange",o)}}))},i.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,n,r){void 0===r&&(r={});var o=e.textTracks();r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e;var s=new Zh.text.TrackClass(r);return o.addTrack(s),s}(this,e,t,i)},i.createRemoteTextTrack=function(e){var t=rh(e,{tech:this});return new Xh.remoteTextEl.TrackClass(t)},i.addRemoteTextTrack=function(e,t){var i=this;void 0===e&&(e={});var n=this.createRemoteTextTrack(e);return!0!==t&&!1!==t&&(su.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==t&&this.ready((function(){return i.autoRemoteTextTracks_.addTrack(n.track)})),n},i.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},i.getVideoPlaybackQuality=function(){return{}},i.requestPictureInPicture=function(){var e=this.options_.Promise||bn.Promise;if(e)return e.reject()},i.disablePictureInPicture=function(){return!0},i.setDisablePictureInPicture=function(){},i.requestVideoFrameCallback=function(e){var t=this,i=kc();return!this.isReady_||this.paused()?(this.queuedHanders_.add(i),this.one("playing",(function(){t.queuedHanders_.has(i)&&(t.queuedHanders_.delete(i),e())}))):this.requestNamedAnimationFrame(i,e),i},i.cancelVideoFrameCallback=function(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)},i.setPoster=function(){},i.playsinline=function(){},i.setPlaysinline=function(){},i.overrideNativeAudioTracks=function(){},i.overrideNativeVideoTracks=function(){},i.canPlayType=function(){return""},t.canPlayType=function(){return""},t.canPlaySource=function(e,i){return t.canPlayType(e.type)},t.isTech=function(e){return e.prototype instanceof t||e instanceof t||e===t},t.registerTech=function(e,i){if(t.techs_||(t.techs_={}),!t.isTech(i))throw new Error("Tech "+e+" must be a Tech");if(!t.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!t.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=nh(e),t.techs_[e]=i,t.techs_[ih(e)]=i,"Tech"!==e&&t.defaultTechOrder_.push(e),i},t.getTech=function(e){if(e)return t.techs_&&t.techs_[e]?t.techs_[e]:(e=nh(e),bn&&bn.videojs&&bn.videojs[e]?(su.warn("The "+e+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),bn.videojs[e]):void 0)},t}(uh);Zh.names.forEach((function(e){var t=Zh[e];Qh.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}})),Qh.prototype.featuresVolumeControl=!0,Qh.prototype.featuresMuteControl=!0,Qh.prototype.featuresFullscreenResize=!1,Qh.prototype.featuresPlaybackRate=!1,Qh.prototype.featuresProgressEvents=!1,Qh.prototype.featuresSourceset=!1,Qh.prototype.featuresTimeupdateEvents=!1,Qh.prototype.featuresNativeTextTracks=!1,Qh.prototype.featuresVideoFrameCallback=!1,Qh.withSourceHandlers=function(e){e.registerSourceHandler=function(t,i){var n=e.sourceHandlers;n||(n=e.sourceHandlers=[]),void 0===i&&(i=n.length),n.splice(i,0,t)},e.canPlayType=function(t){for(var i,n=e.sourceHandlers||[],r=0;r<n.length;r++)if(i=n[r].canPlayType(t))return i;return""},e.selectSourceHandler=function(t,i){for(var n=e.sourceHandlers||[],r=0;r<n.length;r++)if(n[r].canHandleSource(t,i))return n[r];return null},e.canPlaySource=function(t,i){var n=e.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach((function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})}),e.prototype),e.prototype.setSource=function(t){var i=e.selectSourceHandler(t,this.options_);i||(e.nativeSourceHandler?i=e.nativeSourceHandler:su.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}},uh.registerComponent("Tech",Qh),Qh.registerTech("Tech",Qh),Qh.defaultTechOrder_=[];var Kh={},Jh={},$h={};function ed(e,t,i){e.setTimeout((function(){return sd(t,Kh[t.type],i,e)}),1)}function td(e,t,i,n){void 0===n&&(n=null);var r="call"+nh(i),o=e.reduce(od(r),n),s=o===$h,a=s?null:t[i](o);return function(e,t,i,n){for(var r=e.length-1;r>=0;r--){var o=e[r];o[t]&&o[t](n,i)}}(e,i,a,s),a}var id={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},nd={setCurrentTime:1,setMuted:1,setVolume:1},rd={play:1,pause:1};function od(e){return function(t,i){return t===$h?$h:i[e]?i[e](t):t}}function sd(e,t,i,n,r,o){void 0===e&&(e={}),void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===o&&(o=!1);var s=t,a=s[0],l=s.slice(1);if("string"==typeof a)sd(e,Kh[a],i,n,r,o);else if(a){var u=function(e,t){var i=Jh[e.id()],n=null;if(null==i)return n=t(e),Jh[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var o=i[r],s=o[0],a=o[1];s===t&&(n=a)}return null===n&&(n=t(e),i.push([t,n])),n}(n,a);if(!u.setSource)return r.push(u),sd(e,l,i,n,r,o);u.setSource(hu({},e),(function(t,s){if(t)return sd(e,l,i,n,r,o);r.push(u),sd(s,e.type===s.type?l:Kh[s.type],i,n,r,o)}))}else l.length?sd(e,l,i,n,r,o):o?i(e,r):sd(e,Kh["*"],i,n,r,!0)}var ad={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},ld=function(e){void 0===e&&(e="");var t=Uh(e);return ad[t.toLowerCase()]||""},ud=function e(t){if(Array.isArray(t)){var i=[];t.forEach((function(t){t=e(t),Array.isArray(t)?i=i.concat(t):du(t)&&i.push(t)})),t=i}else t="string"==typeof t&&t.trim()?[cd({src:t})]:du(t)&&"string"==typeof t.src&&t.src&&t.src.trim()?[cd(t)]:[];return t};function cd(e){if(!e.type){var t=ld(e.src);t&&(e.type=t)}return e}var hd=function(e){function t(t,i,n){var r,o=rh({createEl:!1},i);if(r=e.call(this,t,o,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var s=0,a=i.playerOptions.techOrder;s<a.length;s++){var l=nh(a[s]),u=Qh.getTech(l);if(l||(u=uh.getComponent(l)),u&&u.isSupported()){t.loadTech_(l);break}}return r}return In(t,e),t}(uh);uh.registerComponent("MediaLoader",hd);var dd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).options_.controlText&&n.controlText(n.options_.controlText),n.handleMouseOver_=function(e){return n.handleMouseOver(e)},n.handleMouseOut_=function(e){return n.handleMouseOut(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.emitTapEvents(),n.enable(),n}In(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={}),t=hu({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&su.error("Creating a ClickableComponent with an HTML element of "+e+" is not supported; use a Button instead."),i=hu({role:"button"},i),this.tabIndex_=t.tabIndex;var n=zu(e,t,i);return n.appendChild(zu("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n},i.dispose=function(){this.controlTextEl_=null,e.prototype.dispose.call(this)},i.createControlTextEl=function(e){return this.controlTextEl_=zu("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},i.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,Yu(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)},i.buildCSSClass=function(){return"vjs-control vjs-button "+e.prototype.buildCSSClass.call(this)},i.enable=function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))},i.disable=function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)},i.handleLanguagechange=function(){this.controlText(this.controlText_)},i.handleClick=function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},i.handleKeyDown=function(t){Pn.isEventKey(t,"Space")||Pn.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(uh);uh.registerComponent("ClickableComponent",dd);var pd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update(),n.update_=function(e){return n.update(e)},t.on("posterchange",n.update_),n}In(t,e);var i=t.prototype;return i.dispose=function(){this.player().off("posterchange",this.update_),e.prototype.dispose.call(this)},i.createEl=function(){return zu("div",{className:"vjs-poster",tabIndex:-1})},i.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},i.setSrc=function(e){var t="";e&&(t='url("'+e+'")'),this.el_.style.backgroundImage=t},i.handleClick=function(e){if(this.player_.controls()){var t=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;!this.player_.tech(!0)||(Iu||Pu)&&t||this.player_.tech(!0).focus(),this.player_.paused()?vh(this.player_.play()):this.player_.pause()}},t}(dd);uh.registerComponent("PosterImage",pd);var fd={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function md(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function gd(e,t,i){try{e.style[t]=i}catch($v){return}}var vd=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var o=function(e){return r.updateDisplay(e)};return t.on("loadstart",(function(e){return r.toggleDisplay(e)})),t.on("texttrackchange",o),t.on("loadedmetadata",(function(e){return r.preselectTrack(e)})),t.ready(Wc(An(r),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",o),t.on("playerresize",o),bn.addEventListener("orientationchange",o),t.on("dispose",(function(){return bn.removeEventListener("orientationchange",o)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i<e.length;i++)this.player_.addRemoteTextTrack(e[i],!0);this.preselectTrack()}}))),r}In(t,e);var i=t.prototype;return i.preselectTrack=function(){for(var e,t,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),o=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var a=r[s];o&&o.enabled&&o.language&&o.language===a.language&&a.kind in n?a.kind===o.kind?i=a:i||(i=a):o&&!o.enabled?(i=null,e=null,t=null):a.default&&("descriptions"!==a.kind||e?a.kind in n&&!t&&(t=a):e=a)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},i.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})},i.clearDisplay=function(){"function"==typeof bn.WebVTT&&bn.WebVTT.processCues(bn,[],this.el_)},i.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],n=0;n<e.length;++n){var r=e[n];"showing"===r.mode&&i.push(r)}this.updateForTrack(i)}else{for(var o=null,s=null,a=e.length;a--;){var l=e[a];"showing"===l.mode&&("descriptions"===l.kind?o=l:s=l)}s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):o&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(o))}},i.updateDisplayState=function(e){for(var t=this.player_.textTrackSettings.getValues(),i=e.activeCues,n=i.length;n--;){var r=i[n];if(r){var o=r.displayState;if(t.color&&(o.firstChild.style.color=t.color),t.textOpacity&&gd(o.firstChild,"color",md(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(o.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&gd(o.firstChild,"backgroundColor",md(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?gd(o,"backgroundColor",md(t.windowColor,t.windowOpacity)):o.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?o.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222":"raised"===t.edgeStyle?o.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px #222":"depressed"===t.edgeStyle?o.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222":"uniform"===t.edgeStyle&&(o.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")),t.fontPercent&&1!==t.fontPercent){var s=bn.parseFloat(o.style.fontSize);o.style.fontSize=s*t.fontPercent+"px",o.style.height="auto",o.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?o.firstChild.style.fontVariant="small-caps":o.firstChild.style.fontFamily=fd[t.fontFamily])}}},i.updateForTrack=function(e){if(Array.isArray(e)||(e=[e]),"function"==typeof bn.WebVTT&&!e.every((function(e){return!e.activeCues}))){for(var t=[],i=0;i<e.length;++i)for(var n=e[i],r=0;r<n.activeCues.length;++r)t.push(n.activeCues[r]);bn.WebVTT.processCues(bn,t,this.el_);for(var o=0;o<e.length;++o){for(var s=e[o],a=0;a<s.activeCues.length;++a){var l=s.activeCues[a].displayState;Zu(l,"vjs-text-track-cue"),Zu(l,"vjs-text-track-cue-"+(s.language?s.language:o)),s.language&&tc(l,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}},t}(uh);uh.registerComponent("TextTrackDisplay",vd);var yd=function(e){function t(){return e.apply(this,arguments)||this}return In(t,e),t.prototype.createEl=function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),n=zu("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[i])}),r=e.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r},t}(uh);uh.registerComponent("LoadingSpinner",yd);var _d=function(e){function t(){return e.apply(this,arguments)||this}In(t,e);var i=t.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={});var n=zu("button",t=hu({className:this.buildCSSClass()},t),i=hu({type:"button"},i));return n.appendChild(zu("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return su.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),uh.prototype.addChild.call(this,e,t)},i.enable=function(){e.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){e.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(t){Pn.isEventKey(t,"Space")||Pn.isEventKey(t,"Enter")?t.stopPropagation():e.prototype.handleKeyDown.call(this,t)},t}(dd);uh.registerComponent("Button",_d);var bd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).mouseused_=!1,n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-big-play-button"},i.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){var i=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;return vh(t),void(!this.player_.tech(!0)||(Iu||Pu)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var o=function(){return r.focus()};gh(t)?t.then(o,(function(){})):this.setTimeout(o,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(_d);bd.prototype.controlText_="Play Video",uh.registerComponent("BigPlayButton",bd);var Cd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){Pn.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(_d);uh.registerComponent("CloseButton",Cd);var Td=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",(function(e){return n.handlePlay(e)})),n.on(t,"pause",(function(e){return n.handlePause(e)})),i.replay&&n.on(t,"ended",(function(e){return n.handleEnded(e)})),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?vh(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(function(e){return t.handleSeeked(e)}))},t}(_d);Td.prototype.controlText_="Play",uh.registerComponent("PlayToggle",Td);var wd=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),o=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||s>0?r+":":"")+(n=((r||o>=10)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)},Ed=wd;function Sd(e,t){return void 0===t&&(t=e),Ed(e,t)}var kd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],(function(e){return n.updateContent(e)})),n.updateTextNode_(),n}In(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),n=zu("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return i.appendChild(n),this.contentEl_=zu("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;void 0===e&&(e=0),e=Sd(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){if(t.contentEl_){var e=t.textNode_;e&&t.contentEl_.firstChild!==e&&(e=null,su.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=En.createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_))}})))},i.updateContent=function(e){},t}(uh);kd.prototype.labelText_="Time",kd.prototype.controlText_="Time",uh.registerComponent("TimeDisplay",kd);var Pd=function(e){function t(){return e.apply(this,arguments)||this}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(kd);Pd.prototype.labelText_="Current Time",Pd.prototype.controlText_="Current Time",uh.registerComponent("CurrentTimeDisplay",Pd);var Ad=function(e){function t(t,i){var n,r=function(e){return n.updateContent(e)};return(n=e.call(this,t,i)||this).on(t,"durationchange",r),n.on(t,"loadstart",r),n.on(t,"loadedmetadata",r),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(kd);Ad.prototype.labelText_="Duration",Ad.prototype.controlText_="Duration",uh.registerComponent("DurationDisplay",Ad);var xd=function(e){function t(){return e.apply(this,arguments)||this}return In(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=e.prototype.createEl.call(this,"div"),n=e.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(n),t.appendChild(i),t},t}(uh);uh.registerComponent("TimeDivider",xd);var Id=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",(function(e){return n.updateContent(e)})),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return!1!==this.options_.displayNegative&&t.insertBefore(zu("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(kd);Id.prototype.labelText_="Remaining Time",Id.prototype.controlText_="Remaining Time",uh.registerComponent("RemainingTimeDisplay",Id);var Md=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",(function(e){return n.updateShowing(e)})),n}In(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=zu("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(zu("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(En.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(uh);uh.registerComponent("LiveDisplay",Md);var Ld=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&(n.updateLiveEdgeStatusHandler_=function(e){return n.updateLiveEdgeStatus(e)},n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatusHandler_)),n}In(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=zu("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}(_d);Ld.prototype.controlText_="Seek to live, currently playing live",uh.registerComponent("SeekToLive",Ld);var Dd=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},Od=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseDown_=function(e){return n.handleMouseDown(e)},n.handleMouseUp_=function(e){return n.handleMouseUp(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleMouseMove_=function(e){return n.handleMouseMove(e)},n.update_=function(e){return n.update(e)},n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}In(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=hu({tabIndex:0},i),n=hu({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Au||e.preventDefault(),nc(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;rc(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",(function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number(Dd(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=ac(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){Pn.isEventKey(t,"Left")||Pn.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):Pn.isEventKey(t,"Right")||Pn.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(uh);uh.registerComponent("Slider",Od);var jd=function(e,t){return Dd(e/t*100,0,100).toFixed(2)+"%"},Rd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",(function(e){return n.update(e)})),n}In(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=zu("span",{className:"vjs-control-text"}),n=zu("span",{textContent:this.localize("Loaded")}),r=En.createTextNode(": ");return this.percentageEl_=zu("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),o=t.partEls_,s=jd(r,n);t.percent_!==s&&(t.el_.style.width=s,Yu(t.percentageEl_,s),t.percent_=s);for(var a=0;a<i.length;a++){var l=i.start(a),u=i.end(a),c=o[a];c||(c=t.el_.appendChild(zu()),o[a]=c),c.dataset.start===l&&c.dataset.end===u||(c.dataset.start=l,c.dataset.end=u,c.style.left=jd(l,r),c.style.width=jd(u-l,r))}for(var h=o.length;h>i.length;h--)t.el_.removeChild(o[h-1]);o.length=i.length}))},t}(uh);uh.registerComponent("LoadProgressBar",Rd);var Nd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=Hc(Wc(An(n),n.update),Fc),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=sc(this.el_),r=oc(this.player_.el()),o=e.width*t;if(r&&n){var s=e.left-r.left+o,a=e.width-o+(r.right-e.right),l=n.width/2;s<l?l+=l-s:a<l&&(l=a),l<0?l=0:l>n.width&&(l=n.width),l=Math.round(l),this.el_.style.right="-"+l+"px",this.write(i)}},i.write=function(e){Yu(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var o,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var a=r.player_.liveTracker.liveWindow(),l=a-t*a;o=(l<1?"":"-")+Sd(l,a)}else o=Sd(i,s);r.update(e,t,o),n&&n()}))},t}(uh);uh.registerComponent("TimeTooltip",Nd);var Ud=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=Hc(Wc(An(n),n.update),Fc),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(uh);Ud.prototype.options_={children:[]},Ru||wu||Ud.prototype.options_.children.push("timeTooltip"),uh.registerComponent("PlayProgressBar",Ud);var Bd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=Hc(Wc(An(n),n.update),Fc),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(uh);Bd.prototype.options_={children:["timeTooltip"]},uh.registerComponent("MouseTimeDisplay",Bd);var Fd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}In(t,e);var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=Wc(this,this.update),this.update=Hc(this.update_,Fc),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in En&&"visibilityState"in En&&this.on(En,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){"hidden"===En.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Fc))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this;if("hidden"!==En.visibilityState){var n=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",(function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[Sd(e,r),Sd(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(oc(i.el()),i.getProgress())})),n}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){pc(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e,t){if(void 0===t&&(t=!1),pc(e)){var i;t||this.player_.scrubbing()||this.player_.scrubbing(!0);var n=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(n>=.99)return void r.seekToLiveEdge();var o=r.seekableStart(),s=r.liveCurrentTime();if((i=o+n*r.liveWindow())>=s&&(i=s),i<=o&&(i=o+.1),i===1/0)return}else(i=n*this.player_.duration())===this.player_.duration()&&(i-=.1);this.userSeek_(i)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?vh(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){var i=this.player_.liveTracker;if(Pn.isEventKey(t,"Space")||Pn.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(Pn.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(Pn.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(Pn(t))){t.preventDefault(),t.stopPropagation();var n=10*(Pn.codes[Pn(t)]-Pn.codes[0])/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else Pn.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):Pn.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in En&&"visibilityState"in En&&this.off(En,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(Od);Fd.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Ru||wu||Fd.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),uh.registerComponent("SeekBar",Fd);var Wd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=Hc(Wc(An(n),n.handleMouseMove),Fc),n.throttledHandleMouseSeek=Hc(Wc(An(n),n.handleMouseSeek),Fc),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.handleMouseDownHandler_=function(e){return n.handleMouseDown(e)},n.enable(),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),o=sc(r),s=ac(r,e).x;s=Dd(s,0,1),n&&n.update(o,s),i&&i.update(o,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){if(this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&vh(this.player_.play())}},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(uh);Wd.prototype.options_={children:["seekBar"]},uh.registerComponent("ProgressControl",Wd);var Hd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],(function(e){return n.handlePictureInPictureChange(e)})),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],(function(e){return n.handlePictureInPictureEnabledChange(e)})),n.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(function(){"audio"===t.currentType().substring(0,5)||t.audioPosterMode()||t.audioOnlyMode()?(t.isInPictureInPicture()&&t.exitPictureInPicture(),n.hide()):n.show()})),n.disable(),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){En.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(_d);Hd.prototype.controlText_="Picture-in-Picture",uh.registerComponent("PictureInPictureToggle",Hd);var Vd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"fullscreenchange",(function(e){return n.handleFullscreenChange(e)})),!1===En[t.fsApi_.fullscreenEnabled]&&n.disable(),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(_d);Vd.prototype.controlText_="Fullscreen",uh.registerComponent("FullscreenToggle",Vd);var Gd=function(e){function t(){return e.apply(this,arguments)||this}return In(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(uh);uh.registerComponent("VolumeLevel",Gd);var zd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=Hc(Wc(An(n),n.update),Fc),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i,n){if(!i){var r=oc(this.el_),o=oc(this.player_.el()),s=e.width*t;if(!o||!r)return;var a=e.left-o.left+s,l=e.width-s+(o.right-e.right),u=r.width/2;a<u?u+=u-a:l<u&&(u=l),u<0?u=0:u>r.width&&(u=r.width),this.el_.style.right="-"+u+"px"}this.write(n+"%")},i.write=function(e){Yu(this.el_,e)},i.updateVolume=function(e,t,i,n,r){var o=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(function(){o.update(e,t,i,n.toFixed(0)),r&&r()}))},t}(uh);uh.registerComponent("VolumeLevelTooltip",zd);var Yd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=Hc(Wc(An(n),n.update),Fc),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,(function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"}))},t}(uh);Yd.prototype.options_={children:["volumeLevelTooltip"]},uh.registerComponent("MouseVolumeLevelDisplay",Yd);var qd=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",(function(e){return n.updateLastVolume_(e)})),n.on(t,"volumechange",(function(e){return n.updateARIAAttributes(e)})),t.ready((function(){return n.updateARIAAttributes()})),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){pc(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var i=this.el(),n=oc(i),r=this.vertical(),o=ac(i,e);o=r?o.y:o.x,o=Dd(o,0,1),t.update(n,o,r)}pc(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(Od);qd.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},Ru||wu||qd.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),qd.prototype.playerEvent="volumechange",uh.registerComponent("VolumeBar",qd);var Xd=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,(void 0===i.volumeBar||pu(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(An(n=e.call(this,t,i)||this),t),n.throttledHandleMouseMove=Hc(Wc(An(n),n.handleMouseMove),Fc),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n.on("touchstart",(function(e){return n.handleMouseDown(e)})),n.on("mousemove",(function(e){return n.handleMouseMove(e)})),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}In(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(uh);Xd.prototype.options_={children:["volumeBar"]},uh.registerComponent("VolumeControl",Xd);var Zd=function(e){function t(t,i){var n;return function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(An(n=e.call(this,t,i)||this),t),n.on(t,["loadstart","volumechange"],(function(e){return n.update(e)})),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;Ru&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)Qu(this.el_,"vjs-vol-"+i);Zu(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(_d);Zd.prototype.controlText_="Mute",uh.registerComponent("MuteToggle",Zd);var Qd=function(e){function t(t,i){var n;return void 0===i&&(i={}),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||pu(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],(function(e){return n.volumePanelState_(e)})),n.on(n.muteToggle,"keyup",(function(e){return n.handleKeyPress(e)})),n.on(n.volumeControl,"keyup",(function(e){return n.handleVolumeControlKeyUp(e)})),n.on("keydown",(function(e){return n.handleKeyPress(e)})),n.on("mouseover",(function(e){return n.handleMouseOver(e)})),n.on("mouseout",(function(e){return n.handleMouseOut(e)})),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}In(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){Pn.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),Dc(En,"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),Oc(En,"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){Pn.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(uh);Qd.prototype.options_={children:["muteToggle","volumeControl"]},uh.registerComponent("VolumePanel",Qd);var Kd=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",(function(e){return n.handleKeyDown(e)})),n.boundHandleBlur_=function(e){return n.handleBlur(e)},n.boundHandleTapClick_=function(e){return n.handleTapClick(e)},n}In(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof uh&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof uh&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=zu(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),Dc(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||En.activeElement;if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},i.handleKeyDown=function(e){Pn.isEventKey(e,"Left")||Pn.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(Pn.isEventKey(e,"Right")||Pn.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},t}(uh);uh.registerComponent("Menu",Kd);var Jd=function(e){function t(t,i){var n;void 0===i&&(i={}),(n=e.call(this,t,i)||this).menuButton_=new _d(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=_d.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var o=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",o),n.on(n.menuButton_,"click",o),n.on(n.menuButton_,"keydown",(function(e){return n.handleKeyDown(e)})),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),Dc(En,"keyup",n.handleMenuKeyUp_)})),n.on("mouseleave",(function(e){return n.handleMouseLeave(e)})),n.on("keydown",(function(e){return n.handleSubmenuKeyDown(e)})),n}In(t,e);var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))},i.createMenu=function(){var e=new Kd(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=zu("li",{className:"vjs-menu-title",textContent:nh(this.options_.title),tabIndex:-1}),i=new uh(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n<this.items.length;n++)e.addItem(this.items[n]);return e},i.createItems=function(){},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},i.buildWrapperCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+_d.prototype.buildCSSClass()+" "+e.prototype.buildCSSClass.call(this)},i.buildCSSClass=function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button "+t+" "+e.prototype.buildCSSClass.call(this)},i.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},i.dispose=function(){this.handleMouseLeave(),e.prototype.dispose.call(this)},i.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},i.handleMouseLeave=function(e){this.removeClass("vjs-hover"),Oc(En,"keyup",this.handleMenuKeyUp_)},i.focus=function(){this.menuButton_.focus()},i.blur=function(){this.menuButton_.blur()},i.handleKeyDown=function(e){Pn.isEventKey(e,"Esc")||Pn.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),Pn.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(Pn.isEventKey(e,"Up")||Pn.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},i.handleMenuKeyUp=function(e){(Pn.isEventKey(e,"Esc")||Pn.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},i.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},i.handleSubmenuKeyDown=function(e){(Pn.isEventKey(e,"Esc")||Pn.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),Pn.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},i.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Ru&&Vu())return;this.menu.focus()}},i.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},i.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},i.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},t}(uh);uh.registerComponent("MenuButton",Jd);var $d=function(e){function t(t,i){var n,r=i.tracks;if((n=e.call(this,t,i)||this).items.length<=1&&n.hide(),!r)return An(n);var o=Wc(An(n),n.update);return r.addEventListener("removetrack",o),r.addEventListener("addtrack",o),r.addEventListener("labelchange",o),n.player_.on("ready",o),n.player_.on("dispose",(function(){r.removeEventListener("removetrack",o),r.removeEventListener("addtrack",o),r.removeEventListener("labelchange",o)})),n}return In(t,e),t}(Jd);uh.registerComponent("TrackButton",$d);var ep=["Tab","Esc","Up","Down","Right","Left"],tp=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).selectable=i.selectable,n.isSelected_=i.selected||!1,n.multiSelectable=i.multiSelectable,n.selected(n.isSelected_),n.selectable?n.multiSelectable?n.el_.setAttribute("role","menuitemcheckbox"):n.el_.setAttribute("role","menuitemradio"):n.el_.setAttribute("role","menuitem"),n}In(t,e);var i=t.prototype;return i.createEl=function(t,i,n){this.nonIconControl=!0;var r=e.prototype.createEl.call(this,"li",hu({className:"vjs-menu-item",tabIndex:-1},i),n);return r.replaceChild(zu("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),r.querySelector(".vjs-icon-placeholder")),r},i.handleKeyDown=function(t){ep.some((function(e){return Pn.isEventKey(t,e)}))||e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){this.selected(!0)},i.selected=function(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},t}(dd);uh.registerComponent("MenuItem",tp);var ip=function(e){function t(t,i){var n,r=i.track,o=t.textTracks();i.label=r.label||r.language||"Unknown",i.selected="showing"===r.mode,(n=e.call(this,t,i)||this).track=r,n.kinds=(i.kinds||[i.kind||n.track.kind]).filter(Boolean);var s,a=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(An(n),t)},l=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleSelectedLanguageChange.apply(An(n),t)};(t.on(["loadstart","texttrackchange"],a),o.addEventListener("change",a),o.addEventListener("selectedlanguagechange",l),n.on("dispose",(function(){t.off(["loadstart","texttrackchange"],a),o.removeEventListener("change",a),o.removeEventListener("selectedlanguagechange",l)})),void 0===o.onchange)&&n.on(["tap","click"],(function(){if("object"!=typeof bn.Event)try{s=new bn.Event("change")}catch(e){}s||(s=En.createEvent("Event")).initEvent("change",!0,!0),o.dispatchEvent(s)}));return n.handleTracksChange(),n}In(t,e);var i=t.prototype;return i.handleClick=function(t){var i=this.track,n=this.player_.textTracks();if(e.prototype.handleClick.call(this,t),n)for(var r=0;r<n.length;r++){var o=n[r];-1!==this.kinds.indexOf(o.kind)&&(o===i?"showing"!==o.mode&&(o.mode="showing"):"disabled"!==o.mode&&(o.mode="disabled"))}},i.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},i.handleSelectedLanguageChange=function(e){if("showing"===this.track.mode){var t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},i.dispose=function(){this.track=null,e.prototype.dispose.call(this)},t}(tp);uh.registerComponent("TextTrackMenuItem",ip);var np=function(e){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,default:!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.label?i.track.label=i.label:i.track.label=i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,e.call(this,t,i)||this}In(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var o=t[n];if(this.options_.kinds.indexOf(o.kind)>-1&&"showing"===o.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var o=t[n];if(["captions","descriptions","subtitles"].indexOf(o.kind)>-1&&"showing"===o.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(ip);uh.registerComponent("OffTextTrackMenuItem",np);var rp=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return In(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=ip),this.label_&&(i=this.label_+" off"),e.push(new np(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var o=n[r];if(this.kinds_.indexOf(o.kind)>-1){var s=new t(this.player_,{track:o,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+o.kind+"-menu-item"),e.push(s)}}return e},t}($d);uh.registerComponent("TextTrackButton",rp);var op=function(e){function t(t,i){var n,r=i.track,o=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=o.text,i.selected=o.startTime<=s&&s<o.endTime,(n=e.call(this,t,i)||this).track=r,n.cue=o,n}return In(t,e),t.prototype.handleClick=function(t){e.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime)},t}(tp);uh.registerComponent("ChaptersTrackMenuItem",op);var sp=function(e){function t(t,i,n){var r;return(r=e.call(this,t,i,n)||this).selectCurrentItem_=function(){r.items.forEach((function(e){e.selected(r.track_.activeCues[0]===e.cue)}))},r}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-chapters-button "+e.prototype.buildWrapperCSSClass.call(this)},i.update=function(t){if(!t||!t.track||"chapters"===t.track.kind){var i=this.findChaptersTrack();i!==this.track_?(this.setTrack(i),e.prototype.update.call(this)):(!this.items||i&&i.cues&&i.cues.length!==this.items.length)&&e.prototype.update.call(this)}},i.setTrack=function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";var i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);i&&i.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}},i.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(nh(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i<n;i++){var r=t[i],o=new op(this.player_,{track:this.track_,cue:r});e.push(o)}return e},t}(rp);sp.prototype.kind_="chapters",sp.prototype.controlText_="Chapters",uh.registerComponent("ChaptersButton",sp);var ap=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var o=t.textTracks(),s=Wc(An(r),r.handleTracksChange);return o.addEventListener("change",s),r.on("dispose",(function(){o.removeEventListener("change",s)})),r}In(t,e);var i=t.prototype;return i.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,n=0,r=t.length;n<r;n++){var o=t[n];if(o.kind!==this.kind_&&"showing"===o.mode){i=!0;break}}i?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(rp);ap.prototype.kind_="descriptions",ap.prototype.controlText_="Descriptions",uh.registerComponent("DescriptionsButton",ap);var lp=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+e.prototype.buildWrapperCSSClass.call(this)},t}(rp);lp.prototype.kind_="subtitles",lp.prototype.controlText_="Subtitles",uh.registerComponent("SubtitlesButton",lp);var up=function(e){function t(t,i){var n;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,default:!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",(n=e.call(this,t,i)||this).addClass("vjs-texttrack-settings"),n.controlText(", opens "+i.kind+" settings dialog"),n}return In(t,e),t.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},t}(ip);uh.registerComponent("CaptionSettingsMenuItem",up);var cp=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new up(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),e.prototype.createItems.call(this,t)},t}(rp);cp.prototype.kind_="captions",cp.prototype.controlText_="Captions",uh.registerComponent("CaptionsButton",cp);var hp=function(e){function t(){return e.apply(this,arguments)||this}return In(t,e),t.prototype.createEl=function(t,i,n){var r=e.prototype.createEl.call(this,t,i,n),o=r.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(o.appendChild(zu("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),o.appendChild(zu("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}))),r},t}(ip);uh.registerComponent("SubsCapsMenuItem",hp);var dp=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions"),n.menuButton_.controlText(nh(n.label_)),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new up(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,hp)},t}(rp);dp.prototype.kinds_=["captions","subtitles"],dp.prototype.controlText_="Subtitles",uh.registerComponent("SubsCapsButton",dp);var pp=function(e){function t(t,i){var n,r=i.track,o=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(An(n),t)};return o.addEventListener("change",s),n.on("dispose",(function(){o.removeEventListener("change",s)})),n}In(t,e);var i=t.prototype;return i.createEl=function(t,i,n){var r=e.prototype.createEl.call(this,t,i,n),o=r.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(o.appendChild(zu("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),o.appendChild(zu("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r},i.handleClick=function(t){if(e.prototype.handleClick.call(this,t),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks)for(var i=this.player_.audioTracks(),n=0;n<i.length;n++){var r=i[n];r!==this.track&&(r.enabled=r===this.track)}},i.handleTracksChange=function(e){this.selected(this.track.enabled)},t}(tp);uh.registerComponent("AudioTrackMenuItem",pp);var fp=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.audioTracks(),e.call(this,t,i)||this}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];e.push(new pp(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},t}($d);fp.prototype.controlText_="Audio Track",uh.registerComponent("AudioTrackButton",fp);var mp=function(e){function t(t,i){var n,r=i.rate,o=parseFloat(r,10);return i.label=r,i.selected=o===t.playbackRate(),i.selectable=!0,i.multiSelectable=!1,(n=e.call(this,t,i)||this).label=r,n.rate=o,n.on(t,"ratechange",(function(e){return n.update(e)})),n}In(t,e);var i=t.prototype;return i.handleClick=function(t){e.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},i.update=function(e){this.selected(this.player().playbackRate()===this.rate)},t}(tp);mp.prototype.contentElType="button",uh.registerComponent("PlaybackRateMenuItem",mp);var gp=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).menuButton_.el_.setAttribute("aria-describedby",n.labelElId_),n.updateVisibility(),n.updateLabel(),n.on(t,"loadstart",(function(e){return n.updateVisibility(e)})),n.on(t,"ratechange",(function(e){return n.updateLabel(e)})),n.on(t,"playbackrateschange",(function(e){return n.handlePlaybackRateschange(e)})),n}In(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this);return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=zu("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),t.appendChild(this.labelEl_),t},i.dispose=function(){this.labelEl_=null,e.prototype.dispose.call(this)},i.buildCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-playback-rate "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){for(var e=this.playbackRates(),t=[],i=e.length-1;i>=0;i--)t.push(new mp(this.player(),{rate:e[i]+"x"}));return t},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){var t=this.player().playbackRate(),i=this.playbackRates(),n=(i.indexOf(t)+1)%i.length;this.player().playbackRate(i[n])},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(Jd);gp.prototype.controlText_="Playback Rate",uh.registerComponent("PlaybackRateMenuButton",gp);var vp=function(e){function t(){return e.apply(this,arguments)||this}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(t,i,n){return void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i.className||(i.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,i,n)},t}(uh);uh.registerComponent("Spacer",vp);var yp=function(e){function t(){return e.apply(this,arguments)||this}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(vp);uh.registerComponent("CustomControlSpacer",yp);var _p=function(e){function t(){return e.apply(this,arguments)||this}return In(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(uh);_p.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in En&&_p.prototype.options_.children.splice(_p.prototype.options_.children.length-1,0,"pictureInPictureToggle"),uh.registerComponent("ControlBar",_p);var bp=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",(function(e){return n.open(e)})),n}In(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(Ch);bp.prototype.options_=Sn({},Ch.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),uh.registerComponent("ErrorDisplay",bp);var Cp="vjs-text-track-settings",Tp=["#000","Black"],wp=["#00F","Blue"],Ep=["#0FF","Cyan"],Sp=["#0F0","Green"],kp=["#F0F","Magenta"],Pp=["#F00","Red"],Ap=["#FFF","White"],xp=["#FF0","Yellow"],Ip=["1","Opaque"],Mp=["0.5","Semi-Transparent"],Lp=["0","Transparent"],Dp={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Tp,Ap,Pp,Sp,wp,xp,kp,Ep]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Ip,Mp,Lp]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Ap,Tp,Pp,Sp,wp,xp,kp,Ep]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Ip,Mp]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[Lp,Mp,Ip]}};function Op(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Dp.windowColor.options=Dp.backgroundColor.options;var jp=function(e){function t(t,i){var n;return i.temporary=!1,(n=e.call(this,t,i)||this).updateDisplay=n.updateDisplay.bind(An(n)),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=zu("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),cu(Dp,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}In(t,e);var i=t.prototype;return i.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},i.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=Dp[e],o=r.id.replace("%s",this.id_),s=[t,o].join(" ").trim();return["<"+i+' id="'+o+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"</"+i+">",'<select aria-labelledby="'+s+'">'].concat(r.options.map((function(e){var t=o+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+s+" "+t+'">',n.localize(e[1]),"</option>"].join("")}))).concat("</select>").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")},i.createElColors_=function(){return zu("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return zu("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})},i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return zu("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+e+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+e+"</span>","</button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"</button>"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r,o,s=(r=n.$(t.selector),o=t.parser,Op(r.options[r.options.selectedIndex].value,o));return void 0!==s&&(e[i]=s),e},void 0===(i={})&&(i=0),uu(e=Dp).reduce((function(i,n){return t(i,e[n],n)}),i)},i.setValues=function(e){var t=this;cu(Dp,(function(i,n){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(Op(e.options[n].value,i)===t){e.selectedIndex=n;break}}(t.$(i.selector),e[n],i.parser)}))},i.setDefaults=function(){var e=this;cu(Dp,(function(t){var i=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=i}))},i.restoreSettings=function(){var e;try{e=JSON.parse(bn.localStorage.getItem(Cp))}catch(t){su.warn(t)}e&&this.setValues(e)},i.saveSettings=function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?bn.localStorage.setItem(Cp,JSON.stringify(e)):bn.localStorage.removeItem(Cp)}catch(t){su.warn(t)}}},i.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,i=e&&e.captionsButton;t?t.focus():i&&i.focus()},t}(Ch);uh.registerComponent("TextTrackSettings",jp);var Rp=function(e){function t(t,i){var n,r=i.ResizeObserver||bn.ResizeObserver;null===i.ResizeObserver&&(r=!1);var o=rh({createEl:!r,reportTouchActivity:!1},i);return(n=e.call(this,t,o)||this).ResizeObserver=i.ResizeObserver||bn.ResizeObserver,n.loadListener_=null,n.resizeObserver_=null,n.debouncedHandler_=function(e,t,i,n){var r;void 0===n&&(n=bn);var o=function(){var o=this,s=arguments,a=function(){r=null,a=null,i||e.apply(o,s)};!r&&i&&e.apply(o,s),n.clearTimeout(r),r=n.setTimeout(a,t)};return o.cancel=function(){n.clearTimeout(r),r=null},o}((function(){n.resizeHandler()}),100,!1,An(n)),r?(n.resizeObserver_=new n.ResizeObserver(n.debouncedHandler_),n.resizeObserver_.observe(t.el())):(n.loadListener_=function(){if(n.el_&&n.el_.contentWindow){var e=n.debouncedHandler_,t=n.unloadListener_=function(){Oc(this,"resize",e),Oc(this,"unload",t),t=null};Dc(n.el_.contentWindow,"unload",t),Dc(n.el_.contentWindow,"resize",e)}},n.one("load",n.loadListener_)),n}In(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})},i.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},i.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,e.prototype.dispose.call(this)},t}(uh);uh.registerComponent("ResizeManager",Rp);var Np={trackingThreshold:20,liveTolerance:15},Up=function(e){function t(t,i){var n,r=rh(Np,i,{createEl:!1});return(n=e.call(this,t,r)||this).handleVisibilityChange_=function(e){return n.handleVisibilityChange(e)},n.trackLiveHandler_=function(){return n.trackLive_()},n.handlePlay_=function(e){return n.handlePlay(e)},n.handleFirstTimeupdate_=function(e){return n.handleFirstTimeupdate(e)},n.handleSeeked_=function(e){return n.handleSeeked(e)},n.seekToLiveEdge_=function(e){return n.seekToLiveEdge(e)},n.reset_(),n.on(n.player_,"durationchange",(function(e){return n.handleDurationchange(e)})),n.on(n.player_,"canplay",(function(){return n.toggleTracking()})),Iu&&"hidden"in En&&"visibilityState"in En&&n.on(En,"visibilitychange",n.handleVisibilityChange_),n}In(t,e);var i=t.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===1/0&&(En.hidden?this.stopTracking():this.startTracking())},i.trackLive_=function(){var e=this.player_.seekable();if(e&&e.length){var t=Number(bn.performance.now().toFixed(4)),i=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;var n=this.liveCurrentTime(),r=this.player_.currentTime(),o=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;this.timeupdateSeen_&&n!==1/0||(o=!1),o!==this.behindLiveEdge_&&(this.behindLiveEdge_=o,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Fc),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"==typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(En,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(uh);uh.registerComponent("LiveTracker",Up);var Bp,Fp=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var o=0;o<i.length;o++){var s=i[o].src;s&&-1===n.indexOf(s)&&n.push(s)}return!!n.length&&(1===n.length&&(r=n[0]),e.triggerSourceset(r),!0)},Wp=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(e){var t=En.createElement(this.nodeName.toLowerCase());t.innerHTML=e;for(var i=En.createDocumentFragment();t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",bn.Element.prototype.appendChild.call(this,i),this.innerHTML}}),Hp=function(e,t){for(var i={},n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i},Vp=function(e){var t=e.el();if(!t.resetSourceWatch_){var i={},n=function(e){return Hp([e.el(),bn.HTMLMediaElement.prototype,bn.Element.prototype,Wp],"innerHTML")}(e),r=function(i){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];var s=i.apply(t,r);return Fp(e),s}};["append","appendChild","insertAdjacentHTML"].forEach((function(e){t[e]&&(i[e]=t[e],t[e]=r(i[e]))})),Object.defineProperty(t,"innerHTML",rh(n,{set:r(n.set)})),t.resetSourceWatch_=function(){t.resetSourceWatch_=null,Object.keys(i).forEach((function(e){t[e]=i[e]})),Object.defineProperty(t,"innerHTML",n)},e.one("sourceset",t.resetSourceWatch_)}},Gp=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?Nh(bn.Element.prototype.getAttribute.call(this,"src")):""},set:function(e){return bn.Element.prototype.setAttribute.call(this,"src",e),e}}),zp=function(e){if(e.featuresSourceset){var t=e.el();if(!t.resetSourceset_){var i=function(e){return Hp([e.el(),bn.HTMLMediaElement.prototype,Gp],"src")}(e),n=t.setAttribute,r=t.load;Object.defineProperty(t,"src",rh(i,{set:function(n){var r=i.set.call(t,n);return e.triggerSourceset(t.src),r}})),t.setAttribute=function(i,r){var o=n.call(t,i,r);return/src/i.test(i)&&e.triggerSourceset(t.src),o},t.load=function(){var i=r.call(t);return Fp(e)||(e.triggerSourceset(""),Vp(e)),i},t.currentSrc?e.triggerSourceset(t.currentSrc):Fp(e)||Vp(e),t.resetSourceset_=function(){t.resetSourceset_=null,t.load=r,t.setAttribute=n,Object.defineProperty(t,"src",i),t.resetSourceWatch_&&t.resetSourceWatch_()}}}},Yp=function(e,t,i,n){void 0===n&&(n=!0);var r=function(i){return Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0})},o={configurable:!0,enumerable:!0,get:function(){var e=i();return r(e),e}};return n&&(o.set=r),Object.defineProperty(e,t,o)},qp=function(e){function t(t,i){var n;n=e.call(this,t,i)||this;var r=t.source,o=!1;if(n.featuresVideoFrameCallback=n.featuresVideoFrameCallback&&"VIDEO"===n.el_.tagName,r&&(n.el_.currentSrc!==r.src||t.tag&&3===t.tag.initNetworkState_)?n.setSource(r):n.handleLateInit_(n.el_),t.enableSourceset&&n.setupSourcesetHandling_(),n.isScrubbing_=!1,n.el_.hasChildNodes()){for(var s=n.el_.childNodes,a=s.length,l=[];a--;){var u=s[a];"track"===u.nodeName.toLowerCase()&&(n.featuresNativeTextTracks?(n.remoteTextTrackEls().addTrackElement_(u),n.remoteTextTracks().addTrack(u.track),n.textTracks().addTrack(u.track),o||n.el_.hasAttribute("crossorigin")||!Bh(u.src)||(o=!0)):l.push(u))}for(var c=0;c<l.length;c++)n.el_.removeChild(l[c])}return n.proxyNativeTracks_(),n.featuresNativeTextTracks&&o&&su.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),n.restoreMetadataTracksInIOSNativePlayer_(),(Du||ju||Su)&&!0===t.nativeControlsForTouch&&n.setControls(!0),n.proxyWebkitFullscreen_(),n.triggerReady(),n}In(t,e);var i=t.prototype;return i.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),t.disposeMediaElement(this.el_),this.options_=null,e.prototype.dispose.call(this)},i.setupSourcesetHandling_=function(){zp(this)},i.restoreMetadataTracksInIOSNativePlayer_=function(){var e,t=this.textTracks(),i=function(){e=[];for(var i=0;i<t.length;i++){var n=t[i];"metadata"===n.kind&&e.push({track:n,storedMode:n.mode})}};i(),t.addEventListener("change",i),this.on("dispose",(function(){return t.removeEventListener("change",i)}));var n=function i(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",(function(){t.removeEventListener("change",i),t.removeEventListener("change",n),t.addEventListener("change",n)})),this.on("webkitendfullscreen",(function(){t.removeEventListener("change",i),t.addEventListener("change",i),t.removeEventListener("change",n)}))},i.overrideNative_=function(e,t){var i=this;if(t===this["featuresNative"+e+"Tracks"]){var n=e.toLowerCase();this[n+"TracksListeners_"]&&Object.keys(this[n+"TracksListeners_"]).forEach((function(e){i.el()[n+"Tracks"].removeEventListener(e,i[n+"TracksListeners_"][e])})),this["featuresNative"+e+"Tracks"]=!t,this[n+"TracksListeners_"]=null,this.proxyNativeTracksForType_(n)}},i.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},i.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},i.proxyNativeTracksForType_=function(e){var t=this,i=qh[e],n=this.el()[i.getterName],r=this[i.getterName]();if(this["featuresNative"+i.capitalName+"Tracks"]&&n&&n.addEventListener){var o={change:function(i){var n={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(n),"text"===e&&t[Xh.remoteText.getterName]().trigger(n)},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},s=function(){for(var e=[],t=0;t<r.length;t++){for(var i=!1,o=0;o<n.length;o++)if(n[o]===r[t]){i=!0;break}i||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[i.getterName+"Listeners_"]=o,Object.keys(o).forEach((function(e){var i=o[e];n.addEventListener(e,i),t.on("dispose",(function(t){return n.removeEventListener(e,i)}))})),this.on("loadstart",s),this.on("dispose",(function(e){return t.off("loadstart",s)}))}},i.proxyNativeTracks_=function(){var e=this;qh.names.forEach((function(t){e.proxyNativeTracksForType_(t)}))},i.createEl=function(){var e=this.options_.tag;if(!e||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(e){var i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),t.disposeMediaElement(e),e=i}else{e=En.createElement("video");var n=rh({},this.options_.tag&&$u(this.options_.tag));Du&&!0===this.options_.nativeControlsForTouch||delete n.controls,Ju(e,hu(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}void 0!==this.options_.preload&&tc(e,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);for(var r=["loop","muted","playsinline","autoplay"],o=0;o<r.length;o++){var s=r[o],a=this.options_[s];void 0!==a&&(a?tc(e,s,s):ic(e,s),e[s]=a)}return e},i.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var n=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready((function(){this.off("loadstart",i),this.off("loadedmetadata",n),t||this.trigger("loadstart")}))}var r=["loadstart"];r.push("loadedmetadata"),e.readyState>=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&Nu?this.el_.fastSeek(e):this.el_.currentTime=e}catch($v){su($v,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;if(this.el_.duration===1/0&&wu&&Au&&0===this.el_.currentTime){return this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN}return this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},i.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=bn.navigator&&bn.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)vh(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch($v){this.trigger("fullscreenerror",$v)}}),0);else try{e.webkitEnterFullScreen()}catch($v){this.trigger("fullscreenerror",$v)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.requestVideoFrameCallback=function(t){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(t):e.prototype.requestVideoFrameCallback.call(this,t)},i.cancelVideoFrameCallback=function(t){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(t):e.prototype.cancelVideoFrameCallback.call(this,t)},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=En.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.addRemoteTextTrack=function(t,i){var n=e.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),bn.performance&&"function"==typeof bn.performance.now?e.creationTime=bn.performance.now():bn.performance&&bn.performance.timing&&"number"==typeof bn.performance.timing.navigationStart&&(e.creationTime=bn.Date.now()-bn.performance.timing.navigationStart),e},t}(Qh);Yp(qp,"TEST_VID",(function(){if(Wu()){var e=En.createElement("video"),t=En.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),qp.isSupported=function(){try{qp.TEST_VID.volume=.5}catch($v){return!1}return!(!qp.TEST_VID||!qp.TEST_VID.canPlayType)},qp.canPlayType=function(e){return qp.TEST_VID.canPlayType(e)},qp.canPlaySource=function(e,t){return qp.canPlayType(e.type)},qp.canControlVolume=function(){try{var e=qp.TEST_VID.volume;qp.TEST_VID.volume=e/2+.1;var t=e!==qp.TEST_VID.volume;return t&&Ru?(bn.setTimeout((function(){qp&&qp.prototype&&(qp.prototype.featuresVolumeControl=e!==qp.TEST_VID.volume)})),!1):t}catch($v){return!1}},qp.canMuteVolume=function(){try{var e=qp.TEST_VID.muted;return qp.TEST_VID.muted=!e,qp.TEST_VID.muted?tc(qp.TEST_VID,"muted","muted"):ic(qp.TEST_VID,"muted"),e!==qp.TEST_VID.muted}catch($v){return!1}},qp.canControlPlaybackRate=function(){if(wu&&Au&&xu<58)return!1;try{var e=qp.TEST_VID.playbackRate;return qp.TEST_VID.playbackRate=e/2+.1,e!==qp.TEST_VID.playbackRate}catch($v){return!1}},qp.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(En.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(En.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(En.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(En.createElement("audio"),"innerHTML",{get:e,set:e})}catch($v){return!1}return!0},qp.supportsNativeTextTracks=function(){return Nu||Ru&&Au},qp.supportsNativeVideoTracks=function(){return!(!qp.TEST_VID||!qp.TEST_VID.videoTracks)},qp.supportsNativeAudioTracks=function(){return!(!qp.TEST_VID||!qp.TEST_VID.audioTracks)},qp.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];Yp(qp.prototype,t,(function(){return qp[i]()}),!0)})),qp.prototype.featuresVolumeControl=qp.canControlVolume(),qp.prototype.movingMediaElementInDOM=!Ru,qp.prototype.featuresFullscreenResize=!0,qp.prototype.featuresProgressEvents=!0,qp.prototype.featuresTimeupdateEvents=!0,qp.prototype.featuresVideoFrameCallback=!(!qp.TEST_VID||!qp.TEST_VID.requestVideoFrameCallback),qp.patchCanPlayType=function(){Eu>=4&&!ku&&!Au&&(Bp=qp.TEST_VID&&qp.TEST_VID.constructor.prototype.canPlayType,qp.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":Bp.call(this,e)})},qp.unpatchCanPlayType=function(){var e=qp.TEST_VID.constructor.prototype.canPlayType;return Bp&&(qp.TEST_VID.constructor.prototype.canPlayType=Bp),e},qp.patchCanPlayType(),qp.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch($v){}}()}},qp.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch($v){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){qp.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){qp.prototype["set"+nh(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){qp.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){qp.prototype["set"+nh(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){qp.prototype[e]=function(){return this.el_[e]()}})),Qh.withSourceHandlers(qp),qp.nativeSourceHandler={},qp.nativeSourceHandler.canPlayType=function(e){try{return qp.TEST_VID.canPlayType(e)}catch($v){return""}},qp.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return qp.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=Uh(e.src);return qp.nativeSourceHandler.canPlayType("video/"+i)}return""},qp.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},qp.nativeSourceHandler.dispose=function(){},qp.registerSourceHandler(qp.nativeSourceHandler),Qh.registerTech("Html5",qp);var Xp=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Zp={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Qp=["tiny","xsmall","small","medium","large","xlarge","huge"],Kp={};Qp.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Kp[e]="vjs-layout-"+t}));var Jp={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},$p=function(e){function t(i,n,r){var o;if(i.id=i.id||n.id||"vjs_video_"+kc(),(n=hu(t.getTagSettings(i),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"==typeof i.closest){var s=i.closest("[lang]");s&&s.getAttribute&&(n.language=s.getAttribute("lang"))}else for(var a=i;a&&1===a.nodeType;){if($u(a).hasOwnProperty("lang")){n.language=a.getAttribute("lang");break}a=a.parentNode}if((o=e.call(this,null,n,r)||this).boundDocumentFullscreenChange_=function(e){return o.documentFullscreenChange_(e)},o.boundFullWindowOnEscKey_=function(e){return o.fullWindowOnEscKey(e)},o.boundUpdateStyleEl_=function(e){return o.updateStyleEl_(e)},o.boundApplyInitTime_=function(e){return o.applyInitTime_(e)},o.boundUpdateCurrentBreakpoint_=function(e){return o.updateCurrentBreakpoint_(e)},o.boundHandleTechClick_=function(e){return o.handleTechClick_(e)},o.boundHandleTechDoubleClick_=function(e){return o.handleTechDoubleClick_(e)},o.boundHandleTechTouchStart_=function(e){return o.handleTechTouchStart_(e)},o.boundHandleTechTouchMove_=function(e){return o.handleTechTouchMove_(e)},o.boundHandleTechTouchEnd_=function(e){return o.handleTechTouchEnd_(e)},o.boundHandleTechTap_=function(e){return o.handleTechTap_(e)},o.isFullscreen_=!1,o.log=au(o.id_),o.fsApi_=eu,o.isPosterFromTech_=!1,o.queuedCallbacks_=[],o.isReady_=!1,o.hasStarted_=!1,o.userActive_=!1,o.debugEnabled_=!1,o.audioOnlyMode_=!1,o.audioPosterMode_=!1,o.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!o.options_||!o.options_.techOrder||!o.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(o.tag=i,o.tagAttributes=i&&$u(i),o.language(o.options_.language),n.languages){var l={};Object.getOwnPropertyNames(n.languages).forEach((function(e){l[e.toLowerCase()]=n.languages[e]})),o.languages_=l}else o.languages_=t.prototype.options_.languages;o.resetCache_(),o.poster_=n.poster||"",o.controls_=!!n.controls,i.controls=!1,i.removeAttribute("controls"),o.changingSrc_=!1,o.playCallbacks_=[],o.playTerminatedQueue_=[],i.hasAttribute("autoplay")?o.autoplay(!0):o.autoplay(o.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach((function(e){if("function"!=typeof o[e])throw new Error('plugin "'+e+'" does not exist')})),o.scrubbing_=!1,o.el_=o.createEl(),$c(An(o),{eventBusKey:"el_"}),o.fsApi_.requestFullscreen&&(Dc(En,o.fsApi_.fullscreenchange,o.boundDocumentFullscreenChange_),o.on(o.fsApi_.fullscreenchange,o.boundDocumentFullscreenChange_)),o.fluid_&&o.on(["playerreset","resize"],o.boundUpdateStyleEl_);var u=rh(o.options_);n.plugins&&Object.keys(n.plugins).forEach((function(e){o[e](n.plugins[e])})),n.debug&&o.debug(!0),o.options_.playerOptions=u,o.middleware_=[],o.playbackRates(n.playbackRates),o.initChildren(),o.isAudio("audio"===i.nodeName.toLowerCase()),o.controls()?o.addClass("vjs-controls-enabled"):o.addClass("vjs-controls-disabled"),o.el_.setAttribute("role","region"),o.isAudio()?o.el_.setAttribute("aria-label",o.localize("Audio Player")):o.el_.setAttribute("aria-label",o.localize("Video Player")),o.isAudio()&&o.addClass("vjs-audio"),o.flexNotSupported_()&&o.addClass("vjs-no-flex"),Du&&o.addClass("vjs-touch-enabled"),Ru||o.addClass("vjs-workinghover"),t.players[o.id_]=An(o);var c=Ql.split(".")[0];return o.addClass("vjs-v"+c),o.userActive(!0),o.reportUserActivity(),o.one("play",(function(e){return o.listenForUserActivity_(e)})),o.on("stageclick",(function(e){return o.handleStageClick_(e)})),o.on("keydown",(function(e){return o.handleKeyDown(e)})),o.on("languagechange",(function(e){return o.handleLanguagechange(e)})),o.breakpoints(o.options_.breakpoints),o.responsive(o.options_.responsive),o.on("ready",(function(){o.audioPosterMode(o.options_.audioPosterMode),o.audioOnlyMode(o.options_.audioOnlyMode)})),o}In(t,e);var i=t.prototype;return i.dispose=function(){var i=this;this.trigger("dispose"),this.off("dispose"),Oc(En,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Oc(En,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Jh[this.id()]=null,Zh.names.forEach((function(e){var t=Zh[e],n=i[t.getterName]();n&&n.off&&n.off()})),e.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl})},i.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:r||(t=this.el_=e.prototype.createEl.call(this,"div"));var o=$u(i);if(r){for(t=this.el_=i,i=this.tag=En.createElement("video");t.children.length;)i.appendChild(t.firstChild);Xu(t,"video-js")||Zu(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch($v){}}))}if(i.setAttribute("tabindex","-1"),o.tabindex="-1",(Iu||Au&&Lu)&&(i.setAttribute("role","application"),o.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in o&&delete o.width,"height"in o&&delete o.height,Object.getOwnPropertyNames(o).forEach((function(e){r&&"class"===e||t.setAttribute(e,o[e]),r&&i.setAttribute(e,o[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused"),!0!==bn.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=wc("vjs-styles-dimensions");var s=mc(".vjs-styles-defaults"),a=mc("head");a.insertBefore(this.styleEl_,s?s.nextSibling:a.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var l=i.getElementsByTagName("a"),u=0;u<l.length;u++){var c=l.item(u);Zu(c,"vjs-hidden"),c.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!n&&i.parentNode.insertBefore(t,i),qu(i,t),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t},i.crossOrigin=function(e){if(!e)return this.techGet_("crossOrigin");"anonymous"===e||"use-credentials"===e?this.techCall_("setCrossOrigin",e):su.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+e+'"')},i.width=function(e){return this.dimension("width",e)},i.height=function(e){return this.dimension("height",e)},i.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(t);isNaN(n)?su.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},i.fluid=function(e){var t,i,n=this;if(void 0===e)return!!this.fluid_;this.fluid_=!!e,zc(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),i=function(){n.on(["playerreset","resize"],n.boundUpdateStyleEl_)},zc(t=this)?i():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(i))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},i.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},i.aspectRatio=function(e){if(void 0===e)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()},i.updateStyleEl_=function(){if(!0!==bn.VIDEOJS_NO_DYNAMIC_STYLE){var e,t,i,n=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=n[1]/n[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),Ec(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: "+100*r+"%;\n }\n ")}else{var o="number"==typeof this.width_?this.width_:this.options_.width,s="number"==typeof this.height_?this.height_:this.options_.height,a=this.tech_&&this.tech_.el();a&&(o>=0&&(a.width=o),s>=0&&(a.height=s))}},i.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=nh(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(Qh.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var o=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(o=!1);var s={source:t,autoplay:o,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};Zh.names.forEach((function(e){var t=Zh[e];s[t.getterName]=i[t.privateName]})),hu(s,this.options_[n]),hu(s,this.options_[r]),hu(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var a=Qh.getTech(e);if(!a)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new a(s),this.tech_.ready(Wc(this,this.handleTechReady_),!0),bh(this.textTracksJson_||[],this.tech_),Xp.forEach((function(e){i.on(i.tech_,e,(function(t){return i["handleTech"+nh(e)+"_"](t)}))})),Object.keys(Zp).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Zp[e]+"_"].bind(i),event:t}):i["handleTech"+Zp[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",(function(e){return i.handleTechLoadStart_(e)})),this.on(this.tech_,"sourceset",(function(e){return i.handleTechSourceset_(e)})),this.on(this.tech_,"waiting",(function(e){return i.handleTechWaiting_(e)})),this.on(this.tech_,"ended",(function(e){return i.handleTechEnded_(e)})),this.on(this.tech_,"seeking",(function(e){return i.handleTechSeeking_(e)})),this.on(this.tech_,"play",(function(e){return i.handleTechPlay_(e)})),this.on(this.tech_,"firstplay",(function(e){return i.handleTechFirstPlay_(e)})),this.on(this.tech_,"pause",(function(e){return i.handleTechPause_(e)})),this.on(this.tech_,"durationchange",(function(e){return i.handleTechDurationChange_(e)})),this.on(this.tech_,"fullscreenchange",(function(e,t){return i.handleTechFullscreenChange_(e,t)})),this.on(this.tech_,"fullscreenerror",(function(e,t){return i.handleTechFullscreenError_(e,t)})),this.on(this.tech_,"enterpictureinpicture",(function(e){return i.handleTechEnterPictureInPicture_(e)})),this.on(this.tech_,"leavepictureinpicture",(function(e){return i.handleTechLeavePictureInPicture_(e)})),this.on(this.tech_,"error",(function(e){return i.handleTechError_(e)})),this.on(this.tech_,"posterchange",(function(e){return i.handleTechPosterChange_(e)})),this.on(this.tech_,"textdata",(function(e){return i.handleTechTextData_(e)})),this.on(this.tech_,"ratechange",(function(e){return i.handleTechRateChange_(e)})),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||qu(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e=this;Zh.names.forEach((function(t){var i=Zh[t];e[i.privateName]=e[i.getterName]()})),this.textTracksJson_=_h(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return void 0===e&&su.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},i.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)},i.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},i.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"==typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(gh(n))return n.catch((function(e){throw i(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():n():gh(i=this.play())&&(i=i.catch(n)),gh(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(){t.trigger({type:"autoplay-failure",autoplay:e})}))}},i.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!=typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var o=n[r];if(o.type&&o.src&&o.src===t)return o.type}return ld(t)}(this,t)),this.cache_.source=rh({},e,{src:t,type:i});for(var n=this.cache_.sources.filter((function(e){return e.src&&e.src===t})),r=[],o=this.$$("source"),s=[],a=0;a<o.length;a++){var l=$u(o[a]);r.push(l),l.src&&l.src===t&&s.push(l.src)}s.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},i.handleTechSourceset_=function(e){var t=this;if(!this.changingSrc_){var i=function(e){return t.updateSourceCaches_(e)},n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(i=function(){}),i(r),e.src||this.tech_.any(["sourceset","loadstart"],(function(e){if("sourceset"!==e.type){var i=t.techGet("currentSrc");t.lastSource_.tech=i,t.updateSourceCaches_(i)}}))}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},i.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},i.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},i.handleTechRateChange_=function(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(su.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?vh(this.play()):this.pause()))},i.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var i=this.el(),n=En[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}},i.handleTechFullscreenChange_=function(e,t){var i=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(function(){i.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))},i.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},i.techCall_=function(e,t){this.ready((function(){if(e in nd)return function(e,t,i,n){return t[i](e.reduce(od(i),n))}(this.middleware_,this.tech_,e,t);if(e in rd)return td(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch($v){throw su($v),$v}}),!0)},i.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in id)return function(e,t,i){return e.reduceRight(od(i),t[i]())}(this.middleware_,this.tech_,e);if(e in rd)return td(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch($v){if(void 0===this.tech_[e])throw su("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",$v),$v;if("TypeError"===$v.name)throw su("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",$v),this.tech_.isReady_=!1,$v;throw su($v),$v}}},i.play=function(){var e=this,t=this.options_.Promise||bn.Promise;return t?new t((function(t){e.play_(t)})):this.play_()},i.play_=function(e){var t=this;void 0===e&&(e=vh),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!Nu&&!Ru||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},i.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},i.pause=function(){this.techCall_("pause")},i.paused=function(){return!1!==this.techGet_("paused")},i.played=function(){return this.techGet_("played")||dh(0,0)},i.scrubbing=function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){return void 0!==e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=dh(0,0)),e},i.bufferedPercent=function(){return ph(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},i.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},i.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},i.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},i.requestFullscreen=function(e){var t=this.options_.Promise||bn.Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off("fullscreenerror",s),i.off("fullscreenchange",o)}function o(){r(),t()}function s(e,t){r(),n(t)}i.one("fullscreenchange",o),i.one("fullscreenerror",s);var a=i.requestFullscreenHelper_(e);a&&(a.then(r,r),a.then(t,n))}))}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||bn.Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off("fullscreenerror",o),t.off("fullscreenchange",r)}function r(){n(),e()}function o(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",o);var s=t.exitFullscreenHelper_();s&&(s.then(n,n),s.then(e,i))}))}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=En[this.fsApi_.exitFullscreen]();return t&&vh(t.then((function(){return e.isFullscreen(!1)}))),t}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=En.documentElement.style.overflow,Dc(En,"keydown",this.boundFullWindowOnEscKey_),En.documentElement.style.overflow="hidden",Zu(En.body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){Pn.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,Oc(En,"keydown",this.boundFullWindowOnEscKey_),En.documentElement.style.overflow=this.docOrigOverflow,Qu(En.body,"vjs-full-window"),this.trigger("exitFullWindow")},i.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},i.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in En&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in En)return En.exitPictureInPicture()},i.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},i.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=void 0===i?function(e){return Pn.isEventKey(e,"f")}:i,r=t.muteKey,o=void 0===r?function(e){return Pn.isEventKey(e,"m")}:r,s=t.playPauseKey,a=void 0===s?function(e){return Pn.isEventKey(e,"k")||Pn.isEventKey(e,"Space")}:s;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var l=uh.getComponent("FullscreenToggle");!1!==En[this.fsApi_.fullscreenEnabled]&&l.prototype.handleClick.call(this,e)}else if(o.call(this,e)){e.preventDefault(),e.stopPropagation(),uh.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(a.call(this,e)){e.preventDefault(),e.stopPropagation(),uh.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},i.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var r=n[i],o=Qh.getTech(r);if(o||(o=uh.getComponent(r)),o){if(o.isSupported()&&(t=o.canPlayType(e)))return t}else su.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.')}return""},i.selectSource=function(e){var t,i=this,n=this.options_.techOrder.map((function(e){return[e,Qh.getTech(e)]})).filter((function(e){var t=e[0],i=e[1];return i?i.isSupported():(su.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)})),r=function(e,t,i){var n;return e.some((function(e){return t.some((function(t){if(n=i(e,t))return!0}))})),n},o=function(e,t){var n=e[0];if(e[1].canPlaySource(t,i.options_[n.toLowerCase()]))return{source:t,tech:n}};return(this.options_.sourceOrder?r(e,n,(t=o,function(e,i){return t(i,e)})):r(n,e,o))||!1},i.handleSrc_=function(e,t){var i=this;if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();var n=ud(e);if(n.length){if(this.changingSrc_=!0,t||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),ed(this,n[0],(function(e,r){var o,s;if(i.middleware_=r,t||(i.cache_.sources=n),i.updateSourceCaches_(e),i.src_(e))return n.length>1?i.handleSrc_(n.slice(1)):(i.changingSrc_=!1,i.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0),void i.triggerReady());o=r,s=i.tech_,o.forEach((function(e){return e.setTech&&e.setTech(s)}))})),this.options_.retryOnError&&n.length>1){var r=function(){i.error(null),i.handleSrc_(n.slice(1),!0)},o=function(){i.off("error",r)};this.one("error",r),this.one("playing",o),this.resetRetryOnError_=function(){i.off("error",r),i.off("playing",o)}}}else this.setTimeout((function(){this.error({code:4,message:this.options_.notSupportedMessage})}),0)},i.src=function(e){return this.handleSrc_(e,!1)},i.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,nh(t)!==nh(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready((function(){n.changingSrc_=!1})),!1):(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1))},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,t=this.options_.Promise||bn.Promise;this.paused()||!t?this.doReset_():vh(this.play().then((function(){return e.doReset_()})))},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),zc(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar||{},t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},i.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},i.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},i.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},i.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},i.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(Jl("beforeerror").forEach((function(i){var n=i(t,e);du(n)&&!Array.isArray(n)||"string"==typeof n||"number"==typeof n||null===n?e=n:t.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){var i=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),void this.one("loadstart",(function(){this.off(["click","touchstart"],i)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new fh(e),this.addClass("vjs-error"),su.error("(CODE:"+this.error_.code+" "+fh.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),Jl("error").forEach((function(e){return e(t,t.error_)}))},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,t,i,n=Wc(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var o,s=this.getChild("controlBar");!s||Ru||wu||(s.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(o);var e=this.options_.inactivityTimeout;e<=0||(o=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},i.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},i.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},i.enableAudioOnlyUI_=function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();t.forEach((function(t){t!==i&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")},i.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((function(e){return e.show()})),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},i.audioOnlyMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var i=this.options_.Promise||bn.Promise;if(i){if(e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),i.all(n).then((function(){return t.enableAudioOnlyUI_()}))}return i.resolve().then((function(){return t.disableAudioOnlyUI_()}))}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},i.enablePosterModeUI_=function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.disablePosterModeUI_=function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.audioPosterMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var i=this.options_.Promise||bn.Promise;return i?e?this.audioOnlyMode()?this.audioOnlyMode(!1).then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.disablePosterModeUI_()})):e?(this.audioOnlyMode()&&this.audioOnlyMode(!1),void this.enablePosterModeUI_()):void this.disablePosterModeUI_()},i.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},i.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},i.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),zc(this)&&this.trigger("languagechange"))},i.languages=function(){return rh(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=rh(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=rh(n)).player=void 0,e.tracks[i]=n}return e},i.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new Ch(this,t);return this.addChild(n),n.on("dispose",(function(){i.removeChild(n)})),n.open(),n},i.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<Qp.length;i++){var n=Qp[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Kp[e]),this.addClass(Kp[n]),this.breakpoint_=n;break}}},i.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},i.breakpoints=function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=hu({},Jp,e),this.updateCurrentBreakpoint_()),hu(this.breakpoints_)},i.responsive=function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0},i.currentBreakpoint=function(){return this.breakpoint_},i.currentBreakpointClass=function(){return Kp[this.breakpoint_]||""},i.loadMedia=function(e,t){var i=this;if(e&&"object"==typeof e){this.reset(),this.cache_.media=rh(e);var n=this.cache_.media,r=n.artwork,o=n.poster,s=n.src,a=n.textTracks;!r&&o&&(this.cache_.media.artwork=[{src:o,type:ld(o)}]),s&&this.src(s),o&&this.poster(o),Array.isArray(a)&&a.forEach((function(e){return i.addRemoteTextTrack(e,!1)})),this.ready(t)}},i.getMedia=function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),(function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}}))};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:ld(t.poster)}]),t}return rh(this.cache_.media)},t.getTagSettings=function(e){var t={sources:[],tracks:[]},i=$u(e),n=i["data-setup"];if(Xu(e,"vjs-fill")&&(i.fill=!0),Xu(e,"vjs-fluid")&&(i.fluid=!0),null!==n){var r=Mn(n||"{}"),o=r[0],s=r[1];o&&su.error(o),hu(i,s)}if(hu(t,i),e.hasChildNodes())for(var a=e.childNodes,l=0,u=a.length;l<u;l++){var c=a[l],h=c.nodeName.toLowerCase();"source"===h?t.sources.push($u(c)):"track"===h&&t.tracks.push($u(c))}return t},i.flexNotSupported_=function(){var e=En.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},i.debug=function(e){if(void 0===e)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)},i.playbackRates=function(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every((function(e){return"number"==typeof e}))&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))},t}(uh);Zh.names.forEach((function(e){var t=Zh[e];$p.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}})),$p.prototype.crossorigin=$p.prototype.crossOrigin,$p.players={};var ef=bn.navigator;$p.prototype.options_={techOrder:Qh.defaultTechOrder_,html5:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:ef&&(ef.languages&&ef.languages[0]||ef.userLanguage||ef.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1},["ended","seeking","seekable","networkState","readyState"].forEach((function(e){$p.prototype[e]=function(){return this.techGet_(e)}})),Xp.forEach((function(e){$p.prototype["handleTech"+nh(e)+"_"]=function(){return this.trigger(e)}})),uh.registerComponent("Player",$p);var tf="plugin",nf={},rf=function(e){return nf.hasOwnProperty(e)},of=function(e){return rf(e)?nf[e]:void 0},sf=function(e,t){e.activePlugins_=e.activePlugins_||{},e.activePlugins_[t]=!0},af=function(e,t,i){var n=(i?"before":"")+"pluginsetup";e.trigger(n,t),e.trigger(n+":"+t.name,t)},lf=function(e,t){return t.prototype.name=e,function(){af(this,{name:e,plugin:t,instance:null},!0);for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];var o=Ir(t,[this].concat(n));return this[e]=function(){return o},af(this,o.getEventHash()),o}},uf=function(){function e(t){if(this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,this.log||(this.log=this.player.log.createLogger(this.name)),$c(this),delete this.trigger,th(this,this.constructor.defaultState),sf(t,this.name),this.dispose=this.dispose.bind(this),t.on("dispose",this.dispose)}var t=e.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(e){return void 0===e&&(e={}),e.name=this.name,e.plugin=this.constructor,e.instance=this,e},t.trigger=function(e,t){return void 0===t&&(t={}),jc(this.eventBusEl_,e,this.getEventHash(t))},t.handleStateChanged=function(e){},t.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t.activePlugins_[e]=!1,this.player=this.state=null,t[e]=lf(e,nf[e])},e.isBasic=function(t){var i="string"==typeof t?of(t):t;return"function"==typeof i&&!e.prototype.isPrototypeOf(i.prototype)},e.registerPlugin=function(t,i){if("string"!=typeof t)throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(rf(t))su.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if($p.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if("function"!=typeof i)throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof i+".");return nf[t]=i,t!==tf&&(e.isBasic(i)?$p.prototype[t]=function(e,t){var i=function(){af(this,{name:e,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return sf(this,e),af(this,{name:e,plugin:t,instance:i}),i};return Object.keys(t).forEach((function(e){i[e]=t[e]})),i}(t,i):$p.prototype[t]=lf(t,i)),i},e.deregisterPlugin=function(e){if(e===tf)throw new Error("Cannot de-register base plugin.");rf(e)&&(delete nf[e],delete $p.prototype[e])},e.getPlugins=function(e){var t;return void 0===e&&(e=Object.keys(nf)),e.forEach((function(e){var i=of(e);i&&((t=t||{})[e]=i)})),t},e.getPluginVersion=function(e){var t=of(e);return t&&t.VERSION||""},e}();uf.getPlugin=of,uf.BASE_PLUGIN_NAME=tf,uf.registerPlugin(tf,uf),$p.prototype.usingPlugin=function(e){return!!this.activePlugins_&&!0===this.activePlugins_[e]},$p.prototype.hasPlugin=function(e){return!!rf(e)};var cf=function(e){return 0===e.indexOf("#")?e.slice(1):e};function hf(e,t,i){var n=hf.getPlayer(e);if(n)return t&&su.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&n.ready(i),n;var r="string"==typeof e?mc("#"+cf(e)):e;if(!Hu(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");r.ownerDocument.defaultView&&r.ownerDocument.body.contains(r)||su.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),Jl("beforesetup").forEach((function(e){var i=e(r,rh(t));du(i)&&!Array.isArray(i)?t=rh(t,i):su.error("please return an object in beforesetup hooks")}));var o=uh.getComponent("Player");return n=new o(r,t,i),Jl("setup").forEach((function(e){return e(n)})),n}if(hf.hooks_=Kl,hf.hooks=Jl,hf.hook=function(e,t){Jl(e,t)},hf.hookOnce=function(e,t){Jl(e,[].concat(t).map((function(t){return function i(){return $l(e,i),t.apply(void 0,arguments)}})))},hf.removeHook=$l,!0!==bn.VIDEOJS_NO_DYNAMIC_STYLE&&Wu()){var df=mc(".vjs-styles-defaults");if(!df){df=wc("vjs-styles-defaults");var pf=mc("head");pf&&pf.insertBefore(df,pf.firstChild),Ec(df,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ")}}bc(1,hf),hf.VERSION=Ql,hf.options=$p.prototype.options_,hf.getPlayers=function(){return $p.players},hf.getPlayer=function(e){var t,i=$p.players;if("string"==typeof e){var n=cf(e),r=i[n];if(r)return r;t=mc("#"+n)}else t=e;if(Hu(t)){var o=t,s=o.player,a=o.playerId;if(s||i[a])return s||i[a]}},hf.getAllPlayers=function(){return Object.keys($p.players).map((function(e){return $p.players[e]})).filter(Boolean)},hf.players=$p.players,hf.getComponent=uh.getComponent,hf.registerComponent=function(e,t){Qh.isTech(t)&&su.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),uh.registerComponent.call(uh,e,t)},hf.getTech=Qh.getTech,hf.registerTech=Qh.registerTech,hf.use=function(e,t){Kh[e]=Kh[e]||[],Kh[e].push(t)},Object.defineProperty(hf,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(hf.middleware,"TERMINATOR",{value:$h,writeable:!1,enumerable:!0}),hf.browser=Uu,hf.TOUCH_ENABLED=Du,hf.extend=function(e,t){void 0===t&&(t={});var i=function(){e.apply(this,arguments)},n={};for(var r in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),n=t):"function"==typeof t&&(i=t),function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xn(e,t)}(i,e),e&&(i.super_=e),n)n.hasOwnProperty(r)&&(i.prototype[r]=n[r]);return i},hf.mergeOptions=rh,hf.bind=Wc,hf.registerPlugin=uf.registerPlugin,hf.deregisterPlugin=uf.deregisterPlugin,hf.plugin=function(e,t){return su.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),uf.registerPlugin(e,t)},hf.getPlugins=uf.getPlugins,hf.getPlugin=uf.getPlugin,hf.getPluginVersion=uf.getPluginVersion,hf.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),hf.options.languages=rh(hf.options.languages,((i={})[e]=t,i)),hf.options.languages[e]},hf.log=su,hf.createLogger=au,hf.createTimeRange=hf.createTimeRanges=dh,hf.formatTime=Sd,hf.setFormatTime=function(e){Ed=e},hf.resetFormatTime=function(){Ed=wd},hf.parseUrl=Rh,hf.isCrossOrigin=Bh,hf.EventTarget=Vc,hf.on=Dc,hf.one=Rc,hf.off=Oc,hf.trigger=jc,hf.xhr=Gn,hf.TextTrack=Vh,hf.AudioTrack=Gh,hf.VideoTrack=zh,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach((function(e){hf[e]=function(){return su.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),vc[e].apply(null,arguments)}})),hf.computedStyle=fu,hf.dom=vc,hf.url=Fh,hf.defineLazyProperty=Yp,hf.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"});
- /*! @name @videojs/http-streaming @version 2.14.3 @license Apache-2.0 */
- var ff=Br,mf=function(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t},gf=function(e){return hf.log.debug?hf.log.debug.bind(hf,"VHS:",e+" >"):function(){}},vf=1/30,yf=.1,_f=function(e,t){var i,n=[];if(e&&e.length)for(i=0;i<e.length;i++)t(e.start(i),e.end(i))&&n.push([e.start(i),e.end(i)]);return hf.createTimeRanges(n)},bf=function(e,t){return _f(e,(function(e,i){return e-yf<=t&&i+yf>=t}))},Cf=function(e,t){return _f(e,(function(e){return e-vf>=t}))},Tf=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")},wf=function(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t},Ef=function(e){if(e&&e.length&&e.end)return e.end(e.length-1)},Sf=function(e,t){var i=0;if(!e||!e.length)return i;for(var n=0;n<e.length;n++){var r=e.start(n),o=e.end(n);t>o||(i+=t>r&&t<=o?o-t:o-r)}return i},kf=hf.createTimeRange,Pf=function(e,t){if(!t.preload)return t.duration;var i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},Af=function(e){return(e.segments||[]).reduce((function(e,t,i){return t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e}),[])},xf=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},If=function(e){var t=e.preloadSegment;if(t){var i=t.parts,n=(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0);return n+=i&&i.length?i.length:0}},Mf=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var i=xf(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Lf=function(e,t,i){if(void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence)return 0;var n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;n--;){if(void 0!==(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=Pf(e,r),void 0!==r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t);if(n.precise)return n.result;var r=function(e,t){for(var i,n=0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(i=e.segments[r]).start)return{result:i.start-n,precise:!0};if(n+=Pf(e,i),void 0!==i.end)return{result:i.end-n,precise:!0}}return{result:-1,precise:!1}}(e,t);return r.precise?r.result:n.result+i},Df=function(e,t,i){if(!e)return 0;if("number"!=typeof i&&(i=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return bn.Infinity}return Lf(e,t,i)},Of=function(e){var t=e.defaultDuration,i=e.durationList,n=e.startIndex,r=e.endIndex,o=0;if(n>r){var s=[r,n];n=s[0],r=s[1]}if(n<0){for(var a=n;a<Math.min(0,r);a++)o+=t;n=0}for(var l=n;l<r;l++)o+=i[l].duration;return o},jf=function(e,t,i,n){if(!e||!e.segments)return null;if(e.endList)return Df(e);if(null===t)return null;t=t||0;var r=Lf(e,e.mediaSequence+e.segments.length,t);return i&&(r-=n="number"==typeof n?n:Mf(null,e)),Math.max(0,r)},Rf=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Nf=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Uf=function(e){var t=Rf(e);return!e.disabled&&!t},Bf=function(e,t){return t.attributes&&t.attributes[e]},Ff=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!Uf(e)&&(e.attributes.BANDWIDTH||0)<i})).length},Wf=function(e,t){return!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri))))},Hf=function(e,t){var i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},n=!1;for(var r in i){for(var o in i[r])if(n=t(i[r][o]))break;if(n)break}return!!n},Vf=function(e){if(!e||!e.playlists||!e.playlists.length)return Hf(e,(function(e){return e.playlists&&e.playlists.length||e.uri}));for(var t=function(t){var i=e.playlists[t],n=i.attributes&&i.attributes.CODECS;return n&&n.split(",").every((function(e){return no(e)}))||Hf(e,(function(e){return Wf(i,e)}))?"continue":{v:!1}},i=0;i<e.playlists.length;i++){var n=t(i);if("continue"!==n&&"object"==typeof n)return n.v}return!0},Gf={liveEdgeDelay:Mf,duration:Df,seekable:function(e,t,i){var n=t||0,r=jf(e,t,!0,i);return null===r?kf():kf(n,r)},getMediaInfoForTime:function(e){for(var t=e.playlist,i=e.currentTime,n=e.startingSegmentIndex,r=e.startingPartIndex,o=e.startTime,s=e.experimentalExactManifestTimings,a=i-o,l=Af(t),u=0,c=0;c<l.length;c++){var h=l[c];if(n===h.segmentIndex&&("number"!=typeof r||"number"!=typeof h.partIndex||r===h.partIndex)){u=c;break}}if(a<0){if(u>0)for(var d=u-1;d>=0;d--){var p=l[d];if(a+=p.duration,s){if(a<0)continue}else if(a+vf<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:o-Of({defaultDuration:t.targetDuration,durationList:l,startIndex:u,endIndex:d})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:i}}if(u<0){for(var f=u;f<0;f++)if((a-=t.targetDuration)<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:i};u=0}for(var m=u;m<l.length;m++){var g=l[m];if(a-=g.duration,s){if(a>0)continue}else if(a-vf>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:o+Of({defaultDuration:t.targetDuration,durationList:l,startIndex:u,endIndex:m})}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:i}},isEnabled:Uf,isDisabled:function(e){return e.disabled},isBlacklisted:Rf,isIncompatible:Nf,playlistEnd:jf,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:Bf,estimateSegmentRequestTime:function(e,t,i,n){return void 0===n&&(n=0),Bf("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*n)/t:NaN},isLowestEnabledRendition:Ff,isAudioOnly:Vf,playlistMatch:Wf,segmentDurationWithParts:Pf},zf=hf.log,Yf=function(e,t){return e+"-"+t},qf=function(e,t){e.mediaGroups&&["AUDIO","SUBTITLES"].forEach((function(i){if(e.mediaGroups[i])for(var n in e.mediaGroups[i])for(var r in e.mediaGroups[i][n]){var o=e.mediaGroups[i][n][r];t(o,i,n,r)}}))},Xf=function(e){var t=e.playlist,i=e.uri,n=e.id;t.id=n,t.playlistErrors_=0,i&&(t.uri=i),t.attributes=t.attributes||{}},Zf=function(e,t){e.uri=t;for(var i=0;i<e.playlists.length;i++)if(!e.playlists[i].uri){var n="placeholder-uri-"+i;e.playlists[i].uri=n}var r=Vf(e);qf(e,(function(t,i,n,o){var s="placeholder-uri-"+i+"-"+n+"-"+o;if(!t.playlists||!t.playlists.length){if(r&&"AUDIO"===i&&!t.uri)for(var a=0;a<e.playlists.length;a++){var l=e.playlists[a];if(l.attributes&&l.attributes.AUDIO&&l.attributes.AUDIO===n)return}t.playlists=[Sn({},t)]}t.playlists.forEach((function(t,i){var n=Yf(i,s);t.uri?t.resolvedUri=t.resolvedUri||ff(e.uri,t.uri):(t.uri=0===i?s:n,t.resolvedUri=t.uri),t.id=t.id||n,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t}))})),function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];Xf({playlist:i,id:Yf(t,i.uri)}),i.resolvedUri=ff(e.uri,i.uri),e.playlists[i.id]=i,e.playlists[i.uri]=i,i.attributes.BANDWIDTH||zf.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(e),function(e){qf(e,(function(t){t.uri&&(t.resolvedUri=ff(e.uri,t.uri))}))}(e)},Qf=hf.mergeOptions,Kf=hf.EventTarget,Jf=function(e,t){if(!e)return t;var i=Qf(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(var n=0;n<t.parts.length;n++)e.parts&&e.parts[n]&&(i.parts[n]=Qf(e.parts[n],t.parts[n]));return!e.skipped&&t.skipped&&(i.skipped=!1),e.preload&&!t.preload&&(i.preload=!1),i},$f=function(e,t){!e.resolvedUri&&e.uri&&(e.resolvedUri=ff(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=ff(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=ff(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=ff(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach((function(e){e.resolvedUri||(e.resolvedUri=ff(t,e.uri))})),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach((function(e){e.resolvedUri||(e.resolvedUri=ff(t,e.uri))}))},em=function(e){var t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(var n=0;n<i.preloadHints.length;n++)if("MAP"===i.preloadHints[n].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t},tm=function(e,t){return e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment},im=function(e,t,i){void 0===i&&(i=tm);var n=Qf(e,{}),r=n.playlists[t.id];if(!r)return null;if(i(r,t))return null;t.segments=em(t);var o=Qf(r,t);if(o.preloadSegment&&!t.preloadSegment&&delete o.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(var s=0;s<t.skip.skippedSegments;s++)t.segments.unshift({skipped:!0})}o.segments=function(e,t,i){var n=e.slice(),r=t.slice();i=i||0;for(var o,s=[],a=0;a<r.length;a++){var l=n[a+i],u=r[a];l?(o=l.map||o,s.push(Jf(l,u))):(o&&!u.map&&(u.map=o),s.push(u))}return s}(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}o.segments.forEach((function(e){$f(e,o.resolvedUri)}));for(var a=0;a<n.playlists.length;a++)n.playlists[a].id===t.id&&(n.playlists[a]=o);return n.playlists[t.id]=o,n.playlists[t.uri]=o,qf(e,(function(e,i,n,r){if(e.playlists)for(var s=0;s<e.playlists.length;s++)t.id===e.playlists[s].id&&(e.playlists[s]=o)})),n},nm=function(e,t){var i=e.segments||[],n=i[i.length-1],r=n&&n.parts&&n.parts[n.parts.length-1],o=r&&r.duration||n&&n.duration;return t&&o?1e3*o:500*(e.partTargetDuration||e.targetDuration||10)},rm=function(e){function t(t,i,n){var r;if(void 0===n&&(n={}),r=e.call(this)||this,!t)throw new Error("A non-empty playlist URL or object is required");r.logger_=gf("PlaylistLoader");var o=n,s=o.withCredentials,a=void 0!==s&&s,l=o.handleManifestRedirects,u=void 0!==l&&l;r.src=t,r.vhs_=i,r.withCredentials=a,r.handleManifestRedirects=u;var c=i.options_;return r.customTagParsers=c&&c.customTagParsers||[],r.customTagMappers=c&&c.customTagMappers||[],r.experimentalLLHLS=c&&c.experimentalLLHLS||!1,hf.browser.IE_VERSION&&(r.experimentalLLHLS=!1),r.state="HAVE_NOTHING",r.handleMediaupdatetimeout_=r.handleMediaupdatetimeout_.bind(An(r)),r.on("mediaupdatetimeout",r.handleMediaupdatetimeout_),r}In(t,e);var i=t.prototype;return i.handleMediaupdatetimeout_=function(){var e=this;if("HAVE_METADATA"===this.state){var t=this.media(),i=ff(this.master.uri,t.uri);this.experimentalLLHLS&&(i=function(e,t){if(t.endList||!t.serverControl)return e;var i={};if(t.serverControl.canBlockReload){var n=t.preloadSegment,r=t.mediaSequence+t.segments.length;if(n){var o=n.parts||[],s=If(t)-1;s>-1&&s!==o.length-1&&(i._HLS_part=s),(s>-1||o.length)&&r--}i._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){var a=new bn.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&a.searchParams.set(e,i[e])})),e=a.toString()}return e}(i,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}))}},i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,o=void 0===r?[]:r,s=e.customTagMappers,a=void 0===s?[]:s,l=e.experimentalLLHLS,u=new Kr;t&&u.on("warn",t),i&&u.on("info",i),o.forEach((function(e){return u.addParser(e)})),a.forEach((function(e){return u.addTagMapper(e)})),u.push(n),u.end();var c=u.manifest;if(l||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){c.hasOwnProperty(e)&&delete c[e]})),c.segments&&c.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!c.targetDuration){var h=10;c.segments&&c.segments.length&&(h=c.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)),t&&t("manifest has no targetDuration defaulting to "+h),c.targetDuration=h}var d=xf(c);if(d.length&&!c.partTargetDuration){var p=d.reduce((function(e,t){return Math.max(e,t.duration)}),0);t&&(t("manifest has no partTargetDuration defaulting to "+p),zf.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),c.partTargetDuration=p}return c}({onwarn:function(e){var n=e.message;return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message;return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var o=i||this.parseManifest_({url:n,manifestString:t});o.lastRequest=Date.now(),Xf({playlist:o,uri:n,id:r});var s=im(this.master,o);this.targetDuration=o.partTargetDuration||o.targetDuration,this.pendingMedia_=null,s?(this.master=s,this.media_=this.master.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(nm(this.media(),!!s)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),bn.clearTimeout(this.mediaUpdateTimeout),bn.clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(bn.clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=bn.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,o=!this.media_||e.id!==this.media_.id,s=this.master.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(o&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(nm(e,!0)),o){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=mf(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.mediaUpdateTimeout&&(bn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;this.mediaUpdateTimeout&&(bn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=bn.setTimeout((function(){t.mediaUpdateTimeout=null,t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(bn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=bn.setTimeout((function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)}),e))},i.start=function(){var e=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=bn.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=mf(e.handleManifestRedirects,e.src,i);var n=e.parseManifest_({manifestString:i.responseText,url:e.src});e.setupInitialPlaylist(n)}}))},i.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,Zf(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=em(e),e.segments.forEach((function(t){$f(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||bn.location.href;this.master=function(e,t){var i=Yf(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:bn.location.href,resolvedUri:bn.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(Kf),om=hf.xhr,sm=hf.mergeOptions,am=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),n(t,e)},lm=function(){var e=function e(t,i){t=sm({timeout:45e3},t);var n=e.beforeRequest||hf.Vhs.xhr.beforeRequest;if(n&&"function"==typeof n){var r=n(t);r&&(t=r)}var o=(!0===hf.Vhs.xhr.original?om:hf.Vhs.xhr)(t,(function(e,t){return am(o,e,t,i)})),s=o.abort;return o.abort=function(){return o.aborted=!0,s.apply(o,arguments)},o.uri=t.uri,o.requestTime=Date.now(),o};return e.original=!0,e},um=function(e){var t,i={};return e.byterange&&(i.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?bn.BigInt(t.offset)+bn.BigInt(t.length)-bn.BigInt(1):t.offset+t.length-1)),i},cm=function(e,t){return e.start(t)+"-"+e.end(t)},hm=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},dm=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},pm=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ho(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},fm=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},mm=function(e){return e.resolvedUri},gm=function(e){for(var t=Array.prototype.slice.call(e),i=16,n="",r=0;r<t.length/i;r++)n+=t.slice(r*i,r*i+i).map(hm).join("")+" "+t.slice(r*i,r*i+i).map(dm).join("")+"\n";return n},vm=Object.freeze({__proto__:null,createTransferableMessage:pm,initSegmentId:fm,segmentKeyId:mm,hexDump:gm,tagDump:function(e){var t=e.bytes;return gm(t)},textRanges:function(e){var t,i="";for(t=0;t<e.length;t++)i+=cm(e,t)+" ";return i}}),ym=function(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===n)return r({message:"getProgramTime: playlist and time must be provided"});var o=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i,n=0,r=0;r<t.segments.length&&!(e<=(n=(i=t.segments[r]).videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:n+i.duration));r++);var o=t.segments[t.segments.length-1];if(o.videoTimingInfo&&o.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>n){if(e>n+.25*o.duration)return null;i=o}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!o)return r({message:"valid programTime was not found"});if("estimate"===o.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:o.estimatedStart});var s={mediaSeconds:n},a=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,o.segment);return a&&(s.programDateTime=a.toISOString()),r(null,s)},_m=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,o=void 0===r?2:r,s=t.seekTo,a=t.pauseAfterSeek,l=void 0===a||a,u=t.tech,c=t.callback;if(!c)throw new Error("seekToProgramTime: callback must be provided");if(void 0===i||!n||!s)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!u.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(n))return c({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});var h=function(e,t){var i;try{i=new Date(e)}catch($v){return null}if(!t||!t.segments||0===t.segments.length)return null;var n=t.segments[0];if(i<n.dateTimeObject)return null;for(var r=0;r<t.segments.length-1&&(n=t.segments[r],!(i<t.segments[r+1].dateTimeObject));r++);var o,s=t.segments[t.segments.length-1],a=s.dateTimeObject,l=s.videoTimingInfo?(o=s.videoTimingInfo).transmuxedPresentationEnd-o.transmuxedPresentationStart-o.transmuxerPrependedSeconds:s.duration+.25*s.duration;return i>new Date(a.getTime()+1e3*l)?null:(i>a&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Gf.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!h)return c({message:i+" was not found in the stream"});var d=h.segment,p=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch($v){}var r=i.getTime();return(n.getTime()-r)/1e3}(d.dateTimeObject,i);if("estimate"===h.type)return 0===o?c({message:i+" is not buffered yet. Try again"}):(s(h.estimatedStart+p),void u.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:o-1,seekTo:s,pauseAfterSeek:l,tech:u,callback:c})})));var f=d.start+p;u.one("seeked",(function(){return c(null,u.currentTime())})),l&&u.pause(),s(f)},bm=function(e,t){if(4===e.readyState)return t()},Cm=function(e,t,i){var n,r=[],o=!1,s=function(e,t,n,r){return t.abort(),o=!0,i(e,t,n,r)},a=function(e,t){if(!o){if(e)return s(e,t,"",r);var i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length);if(r=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if((t=t.filter((function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e}))).length<=1)return po(t[0]);var n=t.reduce((function(e,t,i){return e+(t.byteLength||t.length)}),0),r=new Uint8Array(n),o=0;return t.forEach((function(e){e=po(e),r.set(e,o),o+=e.byteLength})),r}(r,yo(i,!0)),n=n||El(r),r.length<10||n&&r.length<n+2)return bm(t,(function(){return s(e,t,"",r)}));var a=Yl(r);return"ts"===a&&r.length<188||!a&&r.length<376?bm(t,(function(){return s(e,t,"",r)})):s(null,t,a,r)}},l=t({uri:e,beforeSend:function(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",(function(t){return t.total,t.loaded,am(e,null,{statusCode:e.status},a)}))}},(function(e,t){return am(l,e,t,a)}));return l},Tm=hf.EventTarget,wm=hf.mergeOptions,Em=function(e,t){if(!tm(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var i=0;i<e.segments.length;i++){var n=e.segments[i],r=t.segments[i];if(n.uri!==r.uri)return!1;if(n.byterange||r.byterange){var o=n.byterange,s=r.byterange;if(o&&!s||!o&&s)return!1;if(o.offset!==s.offset||o.length!==s.length)return!1}}return!0},Sm=function(e,t){return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},km=function(e,t){var i={};for(var n in e){var r=e[n].sidx;if(r){var o=Ga(r);if(!t[o])break;var s=t[o].sidxInfo;Sm(s,r)&&(i[o]=t[o])}}return i},Pm=function(e){function t(t,i,n,r){var o;void 0===n&&(n={}),(o=e.call(this)||this).masterPlaylistLoader_=r||An(o),r||(o.isMaster_=!0);var s=n,a=s.withCredentials,l=void 0!==a&&a,u=s.handleManifestRedirects,c=void 0!==u&&u;if(o.vhs_=i,o.withCredentials=l,o.handleManifestRedirects=c,!t)throw new Error("A non-empty playlist URL or object is required");return o.on("minimumUpdatePeriod",(function(){o.refreshXml_()})),o.on("mediaupdatetimeout",(function(){o.refreshMedia_(o.media().id)})),o.state="HAVE_NOTHING",o.loadedPlaylists_={},o.logger_=gf("DashPlaylistLoader"),o.isMaster_?(o.masterPlaylistLoader_.srcUrl=t,o.masterPlaylistLoader_.sidxMapping_={}):o.childPlaylist_=t,o}In(t,e);var i=t.prototype;return i.requestErrored_=function(e,t,i){return!this.request||(this.request=null,e?(this.error="object"!=typeof e||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2}:e,i&&(this.state=i),this.trigger("error"),!0):void 0)},i.addSidxSegments_=function(e,t,i){var n=this,r=e.sidx&&Ga(e.sidx);if(e.sidx&&r&&!this.masterPlaylistLoader_.sidxMapping_[r]){var o=mf(this.handleManifestRedirects,e.sidx.resolvedUri),s=function(o,s){if(!n.requestErrored_(o,s,t)){var a,l=n.masterPlaylistLoader_.sidxMapping_;try{a=Tl(po(s.response).subarray(8))}catch($v){return void n.requestErrored_($v,s,t)}return l[r]={sidxInfo:e.sidx,sidx:a},Ua(e,a,e.sidx.resolvedUri),i(!0)}};this.request=Cm(o,this.vhs_.xhr,(function(t,i,r,a){if(t)return s(t,i);if(!r||"mp4"!==r)return s({status:i.status,message:"Unsupported "+(r||"unknown")+" container type for sidx segment at URL: "+o,response:"",playlist:e,internal:!0,blacklistDuration:1/0,code:2},i);var l=e.sidx.byterange,u=l.offset,c=l.length;if(a.length>=c+u)return s(t,{response:a.subarray(u,u+c),status:i.status,uri:i.uri});n.request=n.vhs_.xhr({uri:o,responseType:"arraybuffer",headers:um({byterange:e.sidx.byterange})},s)}))}else this.mediaRequest_=bn.setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},bn.clearTimeout(this.minimumUpdatePeriodTimeout_),bn.clearTimeout(this.mediaRequest_),bn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"==typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),bn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(bn.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;bn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=bn.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=bn.setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=mf(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t=this,i=_l(this.masterPlaylistLoader_.masterXml_);return null===i?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.masterPlaylistLoader_.clientOffset_=i.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:ff(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now(),e();var o;o="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.masterPlaylistLoader_.clientOffset_=o-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e,t,i,n,r,o,s,a=this.masterPlaylistLoader_.master,l=(e={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:a},t=e.masterXml,i=e.srcUrl,n=e.clientOffset,r=e.sidxMapping,o=e.previousManifest,s=yl(t,{manifestUri:i,clientOffset:n,sidxMapping:r,previousManifest:o}),Zf(s,i),s);a&&(l=function(e,t,i){for(var n=!0,r=wm(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),o=0;o<t.playlists.length;o++){var s=t.playlists[o];if(s.sidx){var a=Ga(s.sidx);i&&i[a]&&i[a].sidx&&Ua(s,i[a].sidx,s.sidx.resolvedUri)}var l=im(r,s,Em);l&&(r=l,n=!1)}return qf(t,(function(e,t,i,o){if(e.playlists&&e.playlists.length){var s=e.playlists[0].id,a=im(r,e.playlists[0],Em);a&&((r=a).mediaGroups[t][i][o].playlists[0]=r.playlists[s],n=!1)}})),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(n=!1),n?null:r}(a,l,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=l||a;var u=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];return u&&u!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=u),(!a||l&&l.minimumUpdatePeriod!==a.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(l)},i.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(bn.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.master&&e.master.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of "+t+", not setting a timeout"):this.createMUPTimeout_(t)},i.createMUPTimeout_=function(e){var t=this.masterPlaylistLoader_;t.minimumUpdatePeriodTimeout_=bn.setTimeout((function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)}),e)},i.refreshXml_=function(){var e=this;this.requestMaster_((function(t,i){var n,r,o;i&&(e.media_&&(e.media_=e.masterPlaylistLoader_.master.playlists[e.media_.id]),e.masterPlaylistLoader_.sidxMapping_=(n=e.masterPlaylistLoader_.master,r=e.masterPlaylistLoader_.sidxMapping_,o=km(n.playlists,r),qf(n,(function(e,t,i,n){if(e.playlists&&e.playlists.length){var s=e.playlists;o=wm(o,km(s,r))}})),o),e.addSidxSegments_(e.media(),e.state,(function(t){e.refreshMedia_(e.media().id)})))}))},i.refreshMedia_=function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();var i=this.masterPlaylistLoader_.master.playlists,n=!this.media_||this.media_!==i[e];if(n?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){!function e(){t.media().endList||(t.mediaUpdateTimeout=bn.setTimeout((function(){t.trigger("mediaupdatetimeout"),e()}),nm(t.media(),Boolean(n))))}()}this.trigger("loadedplaylist")},t}(Tm),Am={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30},xm=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},Im=function(e){return function(){var t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch($v){var t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}}(e),i=xm(new Worker(t));i.objURL=t;var n=i.terminate;return i.on=i.addEventListener,i.off=i.removeEventListener,i.terminate=function(){return URL.revokeObjectURL(t),n.call(this)},i}},Mm=function(e){return"var browserWorkerPolyFill = "+xm.toString()+";\nbrowserWorkerPolyFill(self);\n"+e},Lm=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},Dm=Im(Mm(Lm((function(){var e=function(){this.init=function(){var e={};this.on=function(t,i){e[t]||(e[t]=[]),e[t]=e[t].concat(i)},this.off=function(t,i){var n;return!!e[t]&&(n=e[t].indexOf(i),e[t]=e[t].slice(),e[t].splice(n,1),n>-1)},this.trigger=function(t){var i,n,r,o;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n<r;++n)i[n].call(this,arguments[1]);else{for(o=[],n=arguments.length,n=1;n<arguments.length;++n)o.push(arguments[n]);for(r=i.length,n=0;n<r;++n)i[n].apply(this,o)}},this.dispose=function(){e={}}}};e.prototype.pipe=function(e){return this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),this.on("partialdone",(function(t){e.partialFlush(t)})),this.on("endedtimeline",(function(t){e.endTimeline(t)})),this.on("reset",(function(t){e.reset(t)})),e},e.prototype.push=function(e){this.trigger("data",e)},e.prototype.flush=function(e){this.trigger("done",e)},e.prototype.partialFlush=function(e){this.trigger("partialdone",e)},e.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},e.prototype.reset=function(e){this.trigger("reset",e)};var t,i,n,r,o,s,a,l,u,c,h,d,p,f,m,g,v,y,_,b,C,T,w,E,S,k,P,A,x,I,M,L,D,O,j,R,N,U,B,F,W=e,H=Math.pow(2,32),V={getUint64:function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:i.getUint32(0)*H+i.getUint32(4)},MAX_UINT32:H},G=V.MAX_UINT32;!function(){var e;if(T={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},"undefined"!=typeof Uint8Array){for(e in T)T.hasOwnProperty(e)&&(T[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);w=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),S=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),E=new Uint8Array([0,0,0,1]),k=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]),P=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]),A={video:k,audio:P},M=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),I=new Uint8Array([0,0,0,0,0,0,0,0]),L=new Uint8Array([0,0,0,0,0,0,0,0]),D=L,O=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),j=L,x=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),t=function(e){var t,i,n=[],r=0;for(t=1;t<arguments.length;t++)n.push(arguments[t]);for(t=n.length;t--;)r+=n[t].byteLength;for(i=new Uint8Array(r+8),new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,i.byteLength),i.set(e,4),t=0,r=8;t<n.length;t++)i.set(n[t],r),r+=n[t].byteLength;return i},i=function(){return t(T.dinf,t(T.dref,M))},n=function(e){return t(T.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},m=function(e){return t(T.hdlr,A[e])},f=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(T.mdhd,i)},p=function(e){return t(T.mdia,f(e),m(e.type),s(e))},o=function(e){return t(T.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},s=function(e){return t(T.minf,"video"===e.type?t(T.vmhd,x):t(T.smhd,I),i(),v(e))},a=function(e,i){for(var n=[],r=i.length;r--;)n[r]=_(i[r]);return t.apply(null,[T.moof,o(e)].concat(n))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=h(e[i]);return t.apply(null,[T.moov,c(4294967295)].concat(n).concat(u(e)))},u=function(e){for(var i=e.length,n=[];i--;)n[i]=b(e[i]);return t.apply(null,[T.mvex].concat(n))},c=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(T.mvhd,i)},g=function(e){var i,n,r=e.samples||[],o=new Uint8Array(4+r.length);for(n=0;n<r.length;n++)i=r[n].flags,o[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t(T.sdtp,o)},v=function(e){return t(T.stbl,y(e),t(T.stts,j),t(T.stsc,D),t(T.stsz,O),t(T.stco,L))},y=function(e){return t(T.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?R(e):N(e))},R=function(e){var i,n,r=e.sps||[],o=e.pps||[],s=[],a=[];for(i=0;i<r.length;i++)s.push((65280&r[i].byteLength)>>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i<o.length;i++)a.push((65280&o[i].byteLength)>>>8),a.push(255&o[i].byteLength),a=a.concat(Array.prototype.slice.call(o[i]));if(n=[T.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(T.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[o.length],a))),t(T.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var l=e.sarRatio[0],u=e.sarRatio[1];n.push(t(T.pasp,new Uint8Array([(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l,(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u])))}return t.apply(null,n)},N=function(e){return t(T.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))},d=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(T.tkhd,i)},_=function(e){var i,n,r,o,s,a;return i=t(T.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/G),a=Math.floor(e.baseMediaDecodeTime%G),n=t(T.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,a>>>24&255,a>>>16&255,a>>>8&255,255&a])),92,"audio"===e.type?(r=C(e,92),t(T.traf,i,n,r)):(o=g(e),r=C(e,o.length+92),t(T.traf,i,n,r,o))},h=function(e){return e.duration=e.duration||4294967295,t(T.trak,d(e),p(e))},b=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(T.trex,i)},F=function(e,t){var i=0,n=0,r=0,o=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(o=8)),[0,0,i|n|r|o,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},B=function(e,i){var n,r,o,s,a,l;for(i+=20+16*(s=e.samples||[]).length,o=F(s,i),(r=new Uint8Array(o.length+16*s.length)).set(o),n=o.length,l=0;l<s.length;l++)a=s[l],r[n++]=(4278190080&a.duration)>>>24,r[n++]=(16711680&a.duration)>>>16,r[n++]=(65280&a.duration)>>>8,r[n++]=255&a.duration,r[n++]=(4278190080&a.size)>>>24,r[n++]=(16711680&a.size)>>>16,r[n++]=(65280&a.size)>>>8,r[n++]=255&a.size,r[n++]=a.flags.isLeading<<2|a.flags.dependsOn,r[n++]=a.flags.isDependedOn<<6|a.flags.hasRedundancy<<4|a.flags.paddingValue<<1|a.flags.isNonSyncSample,r[n++]=61440&a.flags.degradationPriority,r[n++]=15&a.flags.degradationPriority,r[n++]=(4278190080&a.compositionTimeOffset)>>>24,r[n++]=(16711680&a.compositionTimeOffset)>>>16,r[n++]=(65280&a.compositionTimeOffset)>>>8,r[n++]=255&a.compositionTimeOffset;return t(T.trun,r)},U=function(e,i){var n,r,o,s,a,l;for(i+=20+8*(s=e.samples||[]).length,o=F(s,i),(n=new Uint8Array(o.length+8*s.length)).set(o),r=o.length,l=0;l<s.length;l++)a=s[l],n[r++]=(4278190080&a.duration)>>>24,n[r++]=(16711680&a.duration)>>>16,n[r++]=(65280&a.duration)>>>8,n[r++]=255&a.duration,n[r++]=(4278190080&a.size)>>>24,n[r++]=(16711680&a.size)>>>16,n[r++]=(65280&a.size)>>>8,n[r++]=255&a.size;return t(T.trun,n)},C=function(e,t){return"audio"===e.type?U(e,t):B(e,t)};r=function(){return t(T.ftyp,w,E,w,S)};var z,Y,q,X,Z,Q,K,J,$=function(e){return t(T.mdat,e)},ee=a,te=function(e){var t,i=r(),n=l(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t},ie=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ne=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r},re=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(i=e[t]).keyFrame?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},oe=function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},se=function(e,t){var i,n,r,o,s,a=t||0,l=[];for(i=0;i<e.length;i++)for(o=e[i],n=0;n<o.length;n++)s=o[n],a+=(r=ie(s,a)).size,l.push(r);return l},ae=function(e){var t,i,n,r,o,s,a=0,l=e.byteLength,u=e.nalCount,c=new Uint8Array(l+4*u),h=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],i=0;i<r.length;i++)for(o=r[i],n=0;n<o.length;n++)s=o[n],h.setUint32(a,s.data.byteLength),a+=4,c.set(s.data,a),a+=s.data.byteLength;return c},le=[33,16,5,32,164,27],ue=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ce=function(e){for(var t=[];e--;)t.push(0);return t},he=function(){if(!z){var e={96e3:[le,[227,64],ce(154),[56]],88200:[le,[231],ce(170),[56]],64e3:[le,[248,192],ce(240),[56]],48e3:[le,[255,192],ce(268),[55,148,128],ce(54),[112]],44100:[le,[255,192],ce(268),[55,163,128],ce(84),[112]],32e3:[le,[255,192],ce(268),[55,234],ce(226),[112]],24e3:[le,[255,192],ce(268),[55,255,128],ce(268),[111,112],ce(126),[224]],16e3:[le,[255,192],ce(268),[55,255,128],ce(268),[111,255],ce(269),[223,108],ce(195),[1,192]],12e3:[ue,ce(268),[3,127,248],ce(268),[6,255,240],ce(268),[13,255,224],ce(268),[27,253,128],ce(259),[56]],11025:[ue,ce(268),[3,127,248],ce(268),[6,255,240],ce(268),[13,255,224],ce(268),[27,255,192],ce(268),[55,175,128],ce(108),[112]],8e3:[ue,ce(268),[3,121,16],ce(47),[7]]};t=e,z=Object.keys(t).reduce((function(e,i){return e[i]=new Uint8Array(t[i].reduce((function(e,t){return e.concat(t)}),[])),e}),{})}var t;return z},de=9e4;Q=function(e,t){return Y(Z(e,t))},K=function(e,t){return q(X(e),t)},J=function(e,t,i){return X(i?e:e-t)};var pe=de,fe=Y=function(e){return e*de},me=(q=function(e,t){return e*t},X=function(e){return e/de}),ge=(Z=function(e,t){return e/t},Q),ve=K,ye=J,_e=function(e,t,i,n){var r,o,s,a,l,u=0,c=0,h=0;if(t.length&&(r=ge(e.baseMediaDecodeTime,e.samplerate),o=Math.ceil(pe/(e.samplerate/1024)),i&&n&&(u=r-Math.max(i,n),h=(c=Math.floor(u/o))*o),!(c<1||h>pe/2))){for((s=he()[e.samplerate])||(s=t[0].data),a=0;a<c;a++)l=t[0],t.splice(0,0,{data:s,dts:l.dts-o,pts:l.pts-o});return e.baseMediaDecodeTime-=Math.floor(ve(h,e.samplerate)),h}},be=function(e,t,i){return t.minSegmentDts>=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},Ce=function(e){var t,i,n=[];for(t=0;t<e.length;t++)i=e[t],n.push({size:i.data.byteLength,duration:1024});return n},Te=function(e){var t,i,n=0,r=new Uint8Array(function(e){var t,i=0;for(t=0;t<e.length;t++)i+=e[t].data.byteLength;return i}(e));for(t=0;t<e.length;t++)i=e[t],r.set(i.data,n),n+=i.data.byteLength;return r},we=pe,Ee=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},Se=function(e,t){var i,n=e.minSegmentDts;return t||(n-=e.timelineStartInfo.dts),i=e.timelineStartInfo.baseMediaDecodeTime,i+=n,i=Math.max(0,i),"audio"===e.type&&(i*=e.samplerate/we,i=Math.floor(i)),i},ke=function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))},Pe=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,n=0,r=0}return i},Ae=function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},xe=function(e,t){var i,n,r,o,s=[];if(!(64&t[0]))return s;for(n=31&t[0],i=0;i<n;i++)o={type:3&t[(r=3*i)+2],pts:e},4&t[r+2]&&(o.ccData=t[r+3]<<8|t[r+4],s.push(o));return s},Ie=function(e){for(var t,i,n=e.byteLength,r=[],o=1;o<n-2;)0===e[o]&&0===e[o+1]&&3===e[o+2]?(r.push(o+2),o+=2):o++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(o=0;o<t;s++,o++)s===r[0]&&(s++,r.shift()),i[o]=e[s];return i},Me=4,Le=function e(t){t=t||{},e.prototype.init.call(this),this.parse708captions_="boolean"!=typeof t.parse708captions||t.parse708captions,this.captionPackets_=[],this.ccStreams_=[new He(0,0),new He(0,1),new He(1,0),new He(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ne({captionServices:t.captionServices})),this.reset(),this.ccStreams_.forEach((function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.on("done",this.trigger.bind(this,"done"))}),this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};(Le.prototype=new W).push=function(e){var t,i,n;if("sei_rbsp"===e.nalUnitType&&(t=Pe(e.escapedRBSP)).payload&&t.payloadType===Me&&(i=Ae(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));n=xe(e.pts,i),this.captionPackets_=this.captionPackets_.concat(n),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Le.prototype.flushCCStreams=function(e){this.ccStreams_.forEach((function(t){return"flush"===e?t.flush():t.partialFlush()}),this)},Le.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach((function(e,t){e.presortIndex=t})),this.captionPackets_.sort((function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts})),this.captionPackets_.forEach((function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)}),this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},Le.prototype.flush=function(){return this.flushStream("flush")},Le.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Le.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach((function(e){e.reset()}))},Le.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},Le.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Le.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Le.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},Le.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var De={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},Oe=function(e){return 32<=e&&e<=127||160<=e&&e<=255},je=function(e){this.windowNum=e,this.reset()};je.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},je.prototype.getText=function(){return this.rows.join("\n")},je.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},je.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},je.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},je.prototype.addText=function(e){this.rows[this.rowIdx]+=e},je.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var Re=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new je(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)};Re.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new je(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Re.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Re.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Ne=function e(t){t=t||{},e.prototype.init.call(this);var i,n=this,r=t.captionServices||{},o={};Object.keys(r).forEach((function(e){i=r[e],/^SERVICE/.test(e)&&(o[e]=i.encoding)})),this.serviceEncodings=o,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};Ne.prototype=new W,Ne.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ne.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Ne.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,o=t[r++];for(e.seq=o>>6,e.sizeCode=63&o;r<t.length;r++)n=31&(o=t[r++]),7===(i=o>>5)&&n>0&&(i=o=t[r++]),this.pushServiceBlock(i,r,n),n>0&&(r+=n-1)},Ne.prototype.pushServiceBlock=function(e,t,i){var n,r=t,o=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r<t+i&&r<o.length;r++)n=o[r],Oe(n)?r=this.handleText(r,s):24===n?r=this.multiByteCharacter(r,s):16===n?r=this.extendedCommands(r,s):128<=n&&n<=135?r=this.setCurrentWindow(r,s):152<=n&&n<=159?r=this.defineWindow(r,s):136===n?r=this.clearWindows(r,s):140===n?r=this.deleteWindows(r,s):137===n?r=this.displayWindows(r,s):138===n?r=this.hideWindows(r,s):139===n?r=this.toggleWindows(r,s):151===n?r=this.setWindowAttributes(r,s):144===n?r=this.setPenAttributes(r,s):145===n?r=this.setPenColor(r,s):146===n?r=this.setPenLocation(r,s):143===n?s=this.reset(r,s):8===n?s.currentWindow.backspace():12===n?s.currentWindow.clearText():13===n?s.currentWindow.pendingNewLine=!0:14===n?s.currentWindow.clearText():141===n&&r++},Ne.prototype.extendedCommands=function(e,t){var i=this.current708Packet.data[++e];return Oe(i)&&(e=this.handleText(e,t,{isExtended:!0})),e},Ne.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Ne.prototype.initService=function(e,t){var i,n,r=this;return(i="SERVICE"+e)in this.serviceEncodings&&(n=this.serviceEncodings[i]),this.services[e]=new Re(e,n,r),this.services[e].init(this.getPts(t),(function(t){r.flushDisplayed(t,r.services[e])})),this.services[e]},Ne.prototype.handleText=function(e,t,i){var n,r,o,s,a=i&&i.isExtended,l=i&&i.isMultiByte,u=this.current708Packet.data,c=a?4096:0,h=u[e],d=u[e+1],p=t.currentWindow;return t.textDecoder_&&!a?(l?(r=[h,d],e++):r=[h],n=t.textDecoder_.decode(new Uint8Array(r))):(s=De[o=c|h]||o,n=4096&o&&o===s?"":String.fromCharCode(s)),p.pendingNewLine&&!p.isEmpty()&&p.newLine(this.getPts(e)),p.pendingNewLine=!1,p.addText(n),e},Ne.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,n=i[e+1],r=i[e+2];return Oe(n)&&Oe(r)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},Ne.prototype.setCurrentWindow=function(e,t){var i=7&this.current708Packet.data[e];return t.setCurrentWindow(i),e},Ne.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,n=i[e],r=7&n;t.setCurrentWindow(r);var o=t.currentWindow;return n=i[++e],o.visible=(32&n)>>5,o.rowLock=(16&n)>>4,o.columnLock=(8&n)>>3,o.priority=7&n,n=i[++e],o.relativePositioning=(128&n)>>7,o.anchorVertical=127&n,n=i[++e],o.anchorHorizontal=n,n=i[++e],o.anchorPoint=(240&n)>>4,o.rowCount=15&n,n=i[++e],o.columnCount=63&n,n=i[++e],o.windowStyle=(56&n)>>3,o.penStyle=7&n,o.virtualRowCount=o.rowCount+1,e},Ne.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.winAttr;return n=i[++e],r.fillOpacity=(192&n)>>6,r.fillRed=(48&n)>>4,r.fillGreen=(12&n)>>2,r.fillBlue=3&n,n=i[++e],r.borderType=(192&n)>>6,r.borderRed=(48&n)>>4,r.borderGreen=(12&n)>>2,r.borderBlue=3&n,n=i[++e],r.borderType+=(128&n)>>5,r.wordWrap=(64&n)>>6,r.printDirection=(48&n)>>4,r.scrollDirection=(12&n)>>2,r.justify=3&n,n=i[++e],r.effectSpeed=(240&n)>>4,r.effectDirection=(12&n)>>2,r.displayEffect=3&n,e},Ne.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},Ne.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Ne.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},Ne.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},Ne.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},Ne.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},Ne.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},Ne.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penAttr;return n=i[++e],r.textTag=(240&n)>>4,r.offset=(12&n)>>2,r.penSize=3&n,n=i[++e],r.italics=(128&n)>>7,r.underline=(64&n)>>6,r.edgeType=(56&n)>>3,r.fontStyle=7&n,e},Ne.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penColor;return n=i[++e],r.fgOpacity=(192&n)>>6,r.fgRed=(48&n)>>4,r.fgGreen=(12&n)>>2,r.fgBlue=3&n,n=i[++e],r.bgOpacity=(192&n)>>6,r.bgRed=(48&n)>>4,r.bgGreen=(12&n)>>2,r.bgBlue=3&n,n=i[++e],r.edgeRed=(48&n)>>4,r.edgeGreen=(12&n)>>2,r.edgeBlue=3&n,e},Ne.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},Ne.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Ue={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Be=function(e){return null===e?"":(e=Ue[e]||e,String.fromCharCode(e))},Fe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],We=function(){for(var e=[],t=15;t--;)e.push("");return e},He=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,o;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=We();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=We();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=We()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))o=Be((n=(3&n)<<8)|r),this[this.mode_](e.pts,o),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),o=Be((n=(3&n)<<8)|r),this[this.mode_](e.pts,o),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14==(14&r)&&this.addFormatting(e.pts,["i"]),1==(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Fe.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16==(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14==(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),o=Be(n),o+=Be(r),this[this.mode_](e.pts,o),this.column_+=o.length)}else this.lastControlCode_=null}};He.prototype=new W,He.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch($v){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},He.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=We(),this.nonDisplayed_=We(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},He.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},He.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},He.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},He.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},He.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},He.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},He.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},He.prototype.isNormalChar=function(e){return e>=32&&e<=127},He.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=We(),this.displayed_=We()),void 0!==t&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},He.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce((function(e,t){return e+"<"+t+">"}),"");this[this.mode_](e,i)},He.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+"</"+t+">"}),"");this.formatting_=[],this[this.mode_](e,t)}},He.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},He.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},He.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},He.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i};var Ve={CaptionStream:Le,Cea608Stream:He,Cea708Stream:Ne},Ge={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},ze="shared",Ye=function(e,t){var i=1;for(e>t&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},qe=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||ze,this.push=function(e){this.type_!==ze&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Ye(e.dts,n),e.pts=Ye(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};qe.prototype=new W;var Xe,Ze=qe,Qe=Ye,Ke=function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r},Je=function(e,t,i){return decodeURIComponent(Ke(e,t,i))},$e=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},et={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Je(e.data,1,t),e.value=Je(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Je(e.data,1,t),e.url=Je(e.data,t+1,e.data.length);break}},PRIV:function(e){var t,i;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=(i=e.data,unescape(Ke(i,0,t)));break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}};(Xe=function(e){var t,i={descriptor:e&&e.descriptor},n=0,r=[],o=0;if(Xe.prototype.init.call(this),this.dispatchType=Ge.METADATA_STREAM_TYPE.toString(16),i.descriptor)for(t=0;t<i.descriptor.length;t++)this.dispatchType+=("00"+i.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,i,s,a,l;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(o=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),o+=e.data.byteLength,1===r.length&&(n=$e(e.data.subarray(6,10)),n+=10),!(o<n)){for(t={data:new Uint8Array(n),frames:[],pts:r[0].pts,dts:r[0].dts},l=0;l<n;)t.data.set(r[0].data.subarray(0,n-l),l),l+=r[0].data.byteLength,o-=r[0].data.byteLength,r.shift();i=10,64&t.data[5]&&(i+=4,i+=$e(t.data.subarray(10,14)),n-=$e(t.data.subarray(16,20)));do{if((s=$e(t.data.subarray(i+4,i+8)))<1)return void this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping metadata parsing."});if((a={id:String.fromCharCode(t.data[i],t.data[i+1],t.data[i+2],t.data[i+3]),data:t.data.subarray(i+10,i+s+10)}).key=a.id,et[a.id]&&(et[a.id](a),"com.apple.streaming.transportStreamTimestamp"===a.owner)){var u=a.data,c=(1&u[3])<<30|u[4]<<22|u[5]<<14|u[6]<<6|u[7]>>>2;c*=4,c+=3&u[7],a.timeStamp=c,void 0===t.pts&&void 0===t.dts&&(t.pts=a.timeStamp,t.dts=a.timeStamp),this.trigger("timestamp",a)}t.frames.push(a),i+=10,i+=s}while(i<n);this.trigger("data",t)}}}).prototype=new W;var tt,it,nt,rt=Xe,ot=Ze,st=188;(tt=function(){var e=new Uint8Array(st),t=0;tt.prototype.init.call(this),this.push=function(i){var n,r=0,o=st;for(t?((n=new Uint8Array(i.byteLength+t)).set(e.subarray(0,t)),n.set(i,t),t=0):n=i;o<n.byteLength;)71!==n[r]||71!==n[o]?(r++,o++):(this.trigger("data",n.subarray(r,o)),r+=st,o+=st);r<n.byteLength&&(e.set(n.subarray(r),0),t=n.byteLength-r)},this.flush=function(){t===st&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new W,(it=function(){var e,t,i,n;it.prototype.init.call(this),n=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,n){var r=0;n.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===n.type?t(e.subarray(r),n):i(e.subarray(r),n)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],n.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=n.pmtPid},i=function(e,t){var i,r;if(1&e[5]){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<i;){var o=e[r],s=(31&e[r+1])<<8|e[r+2];o===Ge.H264_STREAM_TYPE&&null===n.programMapTable.video?n.programMapTable.video=s:o===Ge.ADTS_STREAM_TYPE&&null===n.programMapTable.audio?n.programMapTable.audio=s:o===Ge.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][s]=o),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=n.programMapTable}},this.push=function(t){var i={},n=4;if(i.payloadUnitStartIndicator=!!(64&t[1]),i.pid=31&t[1],i.pid<<=8,i.pid|=t[2],(48&t[3])>>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=Ge.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=Ge.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new W,it.STREAM_TYPES={h264:27,adts:15},(nt=function(){var e,t=this,i=!1,n={data:[],size:0},r={data:[],size:0},o={data:[],size:0},s=function(e,i,n){var r,o,s=new Uint8Array(e.size),a={type:i},l=0,u=0;if(e.data.length&&!(e.size<9)){for(a.trackId=e.data[0].pid,l=0;l<e.data.length;l++)o=e.data[l],s.set(o.data,u),u+=o.data.byteLength;var c,h,d,p;h=a,p=(c=s)[0]<<16|c[1]<<8|c[2],h.data=new Uint8Array,1===p&&(h.packetLength=6+(c[4]<<8|c[5]),h.dataAlignmentIndicator=0!=(4&c[6]),192&(d=c[7])&&(h.pts=(14&c[9])<<27|(255&c[10])<<20|(254&c[11])<<12|(255&c[12])<<5|(254&c[13])>>>3,h.pts*=4,h.pts+=(6&c[13])>>>1,h.dts=h.pts,64&d&&(h.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,h.dts*=4,h.dts+=(6&c[18])>>>1)),h.data=c.subarray(9+c[8])),r="video"===i||a.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",a)}};nt.prototype.init.call(this),this.push=function(a){({pat:function(){},pes:function(){var e,t;switch(a.streamType){case Ge.H264_STREAM_TYPE:e=n,t="video";break;case Ge.ADTS_STREAM_TYPE:e=r,t="audio";break;case Ge.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}a.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(a),e.size+=a.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=a.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[a.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(r,"audio"),s(o,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new W;var at={PAT_PID:0,MP2T_PACKET_LENGTH:st,TransportPacketStream:tt,TransportParseStream:it,ElementaryStream:nt,TimestampRolloverStream:ot,CaptionStream:Ve.CaptionStream,Cea608Stream:Ve.Cea608Stream,Cea708Stream:Ve.Cea708Stream,MetadataStream:rt};for(var lt in Ge)Ge.hasOwnProperty(lt)&&(at[lt]=Ge[lt]);var ut,ct=at,ht=pe,dt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(ut=function(e){var t,i=0;ut.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+i+" outside syncword"})},this.push=function(n){var r,o,s,a,l,u=0;if(e||(i=0),"audio"===n.type){var c;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),t.set(n.data,s.byteLength)):t=n.data;u+7<t.length;)if(255===t[u]&&240==(246&t[u+1])){if("number"==typeof c&&(this.skipWarn_(c,u),c=null),o=2*(1&~t[u+1]),r=(3&t[u+3])<<11|t[u+4]<<3|(224&t[u+5])>>5,l=(a=1024*(1+(3&t[u+6])))*ht/dt[(60&t[u+2])>>>2],t.byteLength-u<r)break;this.trigger("data",{pts:n.pts+i*l,dts:n.dts+i*l,sampleCount:a,audioobjecttype:1+(t[u+2]>>>6&3),channelcount:(1&t[u+2])<<2|(192&t[u+3])>>>6,samplerate:dt[(60&t[u+2])>>>2],samplingfrequencyindex:(60&t[u+2])>>>2,samplesize:16,data:t.subarray(u+7+o,u+r)}),i++,u+=r}else"number"!=typeof c&&(c=u),u++;"number"==typeof c&&(this.skipWarn_(c,u),c=null),t=t.subarray(u)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new W;var pt,ft,mt,gt=ut,vt=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,o=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");o.set(e.subarray(r,r+s)),i=new DataView(o.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),o=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?o<<r|this.readBits(r):o},this.skipLeadingZeros=function(){var e;for(e=0;e<n;++e)if(0!=(i&2147483648>>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(ft=function(){var e,t,i=0;ft.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var o=t.byteLength;i<o-3;i++)if(1===t[i+2]){e=i+5;break}for(;e<o;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}i+3!==e-2&&this.trigger("data",t.subarray(i+3,e-2));do{e++}while(1!==t[e]&&e<o);i=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(i+3,e-2)),i=e-2,e+=3;break;default:e+=3}t=t.subarray(i),e-=i,i=0},this.reset=function(){t=null,i=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new W,mt={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(pt=function(){var e,t,i,n,r,o,s,a=new ft;pt.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,a.push(e))},a.on("data",(function(s){var a={trackId:t,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(a.nalUnitTypeCode){case 5:a.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:a.nalUnitType="sei_rbsp",a.escapedRBSP=r(s.subarray(1));break;case 7:a.nalUnitType="seq_parameter_set_rbsp",a.escapedRBSP=r(s.subarray(1)),a.config=o(a.escapedRBSP);break;case 8:a.nalUnitType="pic_parameter_set_rbsp";break;case 9:a.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",a)})),a.on("done",(function(){e.trigger("done")})),a.on("partialdone",(function(){e.trigger("partialdone")})),a.on("reset",(function(){e.trigger("reset")})),a.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){a.flush()},this.partialFlush=function(){a.partialFlush()},this.reset=function(){a.reset()},this.endTimeline=function(){a.endTimeline()},s=function(e,t){var i,n=8,r=8;for(i=0;i<e;i++)0!==r&&(r=(n+t.readExpGolomb()+256)%256),n=0===r?n:r},r=function(e){for(var t,i,n=e.byteLength,r=[],o=1;o<n-2;)0===e[o]&&0===e[o+1]&&3===e[o+2]?(r.push(o+2),o+=2):o++;if(0===r.length)return e;t=n-r.length,i=new Uint8Array(t);var s=0;for(o=0;o<t;s++,o++)s===r[0]&&(s++,r.shift()),i[o]=e[s];return i},o=function(e){var t,i,n,r,o,a,l,u,c,h,d,p,f=0,m=0,g=0,v=0,y=[1,1];if(i=(t=new vt(e)).readUnsignedByte(),r=t.readUnsignedByte(),n=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),mt[i]&&(3===(o=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(d=3!==o?8:12,p=0;p<d;p++)t.readBoolean()&&s(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(a=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===a)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),l=t.readUnsignedExpGolomb(),p=0;p<l;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),u=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(h=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(f=t.readUnsignedExpGolomb(),m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}y&&(y[0],y[1])}return{profileIdc:i,levelIdc:n,profileCompatibility:r,width:16*(u+1)-2*f-2*m,height:(2-h)*(c+1)*16-2*g-2*v,sarRatio:y}}}).prototype=new W;var yt,_t={H264Stream:pt,NalByteStream:ft},bt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ct=function(e,t){var i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return i=i>=0?i:0,(16&e[t+5])>>4?i+20:i+10},Tt=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=Ct(t,i))},wt=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},Et={isLikelyAacData:function(e){var t=Tt(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:Ct,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240==(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return bt[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=wt(e.subarray(10,14)));do{if((i=wt(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"===unescape(function(e,t,i){var n,r="";for(n=t;n<i;n++)r+="%"+("00"+e[n].toString(16)).slice(-2);return r}(n,0,r))){var o=n.subarray(r+1),s=(1&o[3])<<30|o[4]<<22|o[5]<<14|o[6]<<6|o[7]>>>2;return s*=4,s+=3&o[7]}break}}t+=10,t+=i}while(t<e.byteLength);return null}};(yt=function(){var e=new Uint8Array,t=0;yt.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(i){var n,r,o,s,a=0,l=0;for(e.length?(s=e.length,(e=new Uint8Array(i.byteLength+s)).set(e.subarray(0,s)),e.set(i,s)):e=i;e.length-l>=3;)if(e[l]!=="I".charCodeAt(0)||e[l+1]!=="D".charCodeAt(0)||e[l+2]!=="3".charCodeAt(0))if(255!=(255&e[l])||240!=(240&e[l+1]))l++;else{if(e.length-l<7)break;if(l+(a=Et.parseAdtsSize(e,l))>e.length)break;o={type:"audio",data:e.subarray(l,l+a),pts:t,dts:t},this.trigger("data",o),l+=a}else{if(e.length-l<10)break;if(l+(a=Et.parseId3TagSize(e,l))>e.length)break;r={type:"timed-metadata",data:e.subarray(l,l+a)},this.trigger("data",r),l+=a}n=e.length-l,e=n>0?e.subarray(l):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new W;var St,kt,Pt,At,xt=yt,It=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Mt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Lt=_t.H264Stream,Dt=Et.isLikelyAacData,Ot=pe,jt=function(e,t){t.stream=e,this.trigger("log",t)},Rt=function(e,t){for(var i=Object.keys(t),n=0;n<i.length;n++){var r=i[n];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",jt.bind(e,r))}},Nt=function(e,t){var i;if(e.length!==t.length)return!1;for(i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},Ut=function(e,t,i,n,r,o){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:o,baseMediaDecodeTime:e}};(kt=function(e,t){var i,n=[],r=0,o=0,s=1/0;i=(t=t||{}).firstSequenceNumber||0,kt.prototype.init.call(this),this.push=function(t){ke(e,t),e&&It.forEach((function(i){e[i]=t[i]})),n.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){o=e},this.flush=function(){var a,l,u,c,h,d,p;0!==n.length?(a=be(n,e,r),e.baseMediaDecodeTime=Se(e,t.keepOriginalTimestamps),p=_e(e,a,o,s),e.samples=Ce(a),u=$(Te(a)),n=[],l=ee(i,[e]),c=new Uint8Array(l.byteLength+u.byteLength),i++,c.set(l),c.set(u,l.byteLength),Ee(e),h=Math.ceil(1024*Ot/e.samplerate),a.length&&(d=a.length*h,this.trigger("segmentTimingInfo",Ut(ge(e.baseMediaDecodeTime,e.samplerate),a[0].dts,a[0].pts,a[0].dts+d,a[0].pts+d,p||0)),this.trigger("timingInfo",{start:a[0].pts,end:a[0].pts+d})),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){Ee(e),n=[],this.trigger("reset")}}).prototype=new W,(St=function(e,t){var i,n,r,o=[],s=[];i=(t=t||{}).firstSequenceNumber||0,St.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){ke(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||n||(n=t.config,e.sps=[t.data],Mt.forEach((function(t){e[t]=n[t]}),this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),o.push(t)},this.flush=function(){for(var n,r,a,l,u,c,h,d,p=0;o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0===o.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(n=ne(o),(a=re(n))[0][0].keyFrame||((r=this.getGopForFusion_(o[0],e))?(p=r.duration,a.unshift(r),a.byteLength+=r.byteLength,a.nalCount+=r.nalCount,a.pts=r.pts,a.dts=r.dts,a.duration+=r.duration):a=oe(a)),s.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(a):this.alignGopsAtStart_(a)))return this.gopCache_.unshift({gop:a.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Ee(e),a=f}ke(e,a),e.samples=se(a),u=$(ae(a)),e.baseMediaDecodeTime=Se(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",a.map((function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}}))),h=a[0],d=a[a.length-1],this.trigger("segmentTimingInfo",Ut(e.baseMediaDecodeTime,h.dts,h.pts,d.dts+d.duration,d.pts+d.duration,p)),this.trigger("timingInfo",{start:a[0].pts,end:a[a.length-1].pts+a[a.length-1].duration}),this.gopCache_.unshift({gop:a.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),l=ee(i,[e]),c=new Uint8Array(l.byteLength+u.byteLength),i++,c.set(l),c.set(u,l.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),o=[],this.gopCache_.length=0,s.length=0,this.trigger("reset")},this.resetStream_=function(){Ee(e),n=void 0,r=void 0},this.getGopForFusion_=function(t){var i,n,r,o,s,a=1/0;for(s=0;s<this.gopCache_.length;s++)r=(o=this.gopCache_[s]).gop,e.pps&&Nt(e.pps[0],o.pps[0])&&e.sps&&Nt(e.sps[0],o.sps[0])&&(r.dts<e.timelineStartInfo.dts||(i=t.dts-r.dts-r.duration)>=-1e4&&i<=45e3&&(!n||a>i)&&(n=o,a=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,o,a,l,u;for(o=e.byteLength,a=e.nalCount,l=e.duration,t=i=0;t<s.length&&i<e.length&&(n=s[t],r=e[i],n.pts!==r.pts);)r.pts>n.pts?t++:(i++,o-=r.byteLength,a-=r.nalCount,l-=r.duration);return 0===i?e:i===e.length?null:((u=e.slice(i)).byteLength=o,u.duration=l,u.nalCount=a,u.pts=u[0].pts,u.dts=u[0].dts,u)},this.alignGopsAtEnd_=function(e){var t,i,n,r,o,a,l;for(t=s.length-1,i=e.length-1,o=null,a=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){a=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(o=i),i--)}if(!a&&null===o)return null;if(0===(l=a?i:o))return e;var u=e.slice(l),c=u.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return u.byteLength=c.byteLength,u.duration=c.duration,u.nalCount=c.nalCount,u.pts=u[0].pts,u.dts=u[0].dts,u},this.alignGopsWith=function(e){s=e}}).prototype=new W,(At=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,At.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new W,At.prototype.flush=function(e){var t,i,n,r,o=0,s={captions:[],captionStreams:{},metadata:[],info:{}},a=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(a=this.videoTrack.timelineStartInfo.pts,Mt.forEach((function(e){s.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(a=this.audioTrack.timelineStartInfo.pts,It.forEach((function(e){s.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=te(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],o),o+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=ye(t.startPts,a,this.keepOriginalTimestamps),t.endTime=ye(t.endPts,a,this.keepOriginalTimestamps),s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(i=this.pendingMetadata[r]).cueTime=ye(i.pts,a,this.keepOriginalTimestamps),s.metadata.push(i);for(s.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",s),r=0;r<s.captions.length;r++)t=s.captions[r],this.trigger("caption",t);for(r=0;r<s.metadata.length;r++)i=s.metadata[r],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},At.prototype.setRemux=function(e){this.remuxTracks=e},(Pt=function(e){var t,i,n=this,r=!0;Pt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new ct.MetadataStream,r.aacStream=new xt,r.audioTimestampRolloverStream=new ct.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new ct.TimestampRolloverStream("timed-metadata"),r.adtsStream=new gt,r.coalesceStream=new At(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(o){"timed-metadata"!==o.type&&"audio"!==o.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new kt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Rt(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new ct.MetadataStream,r.packetStream=new ct.TransportPacketStream,r.parseStream=new ct.TransportParseStream,r.elementaryStream=new ct.ElementaryStream,r.timestampRolloverStream=new ct.TimestampRolloverStream,r.adtsStream=new gt,r.h264Stream=new Lt,r.captionStream=new ct.CaptionStream(e),r.coalesceStream=new At(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(o){var s;if("metadata"===o.type){for(s=o.tracks.length;s--;)t||"video"!==o.tracks[s].type?i||"audio"!==o.tracks[s].type||((i=o.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=o.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new St(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new kt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Rt(this,r)},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,Ee(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Ee(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=Dt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new W;var Bt,Ft,Wt,Ht={Transmuxer:Pt,VideoSegmentStream:St,AudioSegmentStream:kt,AUDIO_PROPERTIES:It,VIDEO_PROPERTIES:Mt,generateSegmentTimingInfo:Ut},Vt=function(e){return e>>>0},Gt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},zt=Vt,Yt=function e(t,i){var n,r,o,s,a,l=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=zt(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),o=Gt(t.subarray(n+4,n+8)),s=r>1?n+r:t.byteLength,o===i[0]&&(1===i.length?l.push(t.subarray(n+8,s)):(a=e(t.subarray(n+8,s),i.slice(1))).length&&(l=l.concat(a))),n=s;return l},qt=Vt,Xt=V.getUint64,Zt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Xt(e.subarray(4)):t.baseMediaDecodeTime=qt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},Qt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Kt=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],o=4&i.flags[2],s=1&i.flags[1],a=2&i.flags[1],l=4&i.flags[1],u=8&i.flags[1],c=n.getUint32(4),h=8;for(r&&(i.dataOffset=n.getInt32(h),h+=4),o&&c&&(t={flags:Qt(e.subarray(h,h+4))},h+=4,s&&(t.duration=n.getUint32(h),h+=4),a&&(t.size=n.getUint32(h),h+=4),u&&(1===i.version?t.compositionTimeOffset=n.getInt32(h):t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=n.getUint32(h),h+=4),a&&(t.size=n.getUint32(h),h+=4),l&&(t.flags=Qt(e.subarray(h,h+4)),h+=4),u&&(1===i.version?t.compositionTimeOffset=n.getInt32(h):t.compositionTimeOffset=n.getUint32(h),h+=4),i.samples.push(t);return i},Jt=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],o=2&n.flags[2],s=8&n.flags[2],a=16&n.flags[2],l=32&n.flags[2],u=65536&n.flags[0],c=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),o&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(n.defaultSampleDuration=i.getUint32(t),t+=4),a&&(n.defaultSampleSize=i.getUint32(t),t+=4),l&&(n.defaultSampleFlags=i.getUint32(t)),u&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},$t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ei="undefined"!=typeof window?window:void 0!==$t?$t:"undefined"!=typeof self?self:{},ti=Ie,ii=Ve.CaptionStream,ni=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null},ri=function(e,t){var i=Yt(e,["moof","traf"]),n=Yt(e,["mdat"]),r={},o=[];return n.forEach((function(e,t){var n=i[t];o.push({mdat:e,traf:n})})),o.forEach((function(e){var i,n=e.mdat,o=e.traf,s=Yt(o,["tfhd"]),a=Jt(s[0]),l=a.trackId,u=Yt(o,["tfdt"]),c=u.length>0?Zt(u[0]).baseMediaDecodeTime:0,h=Yt(o,["trun"]);t===l&&h.length>0&&(i=function(e,t,i){var n,r,o,s,a=new DataView(e.buffer,e.byteOffset,e.byteLength),l={logs:[],seiNals:[]};for(r=0;r+4<e.length;r+=o)if(o=a.getUint32(r),r+=4,!(o<=0))switch(31&e[r]){case 6:var u=e.subarray(r+1,r+1+o),c=ni(r,t);if(n={nalUnitType:"sei_rbsp",size:o,data:u,escapedRBSP:ti(u),trackId:i},c)n.pts=c.pts,n.dts=c.dts,s=c;else{if(!s){l.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+r+" for trackId "+i+". See mux.js#223."});break}n.pts=s.pts,n.dts=s.dts}l.seiNals.push(n)}return l}(n,function(e,t,i){var n=t,r=i.defaultSampleDuration||0,o=i.defaultSampleSize||0,s=i.trackId,a=[];return e.forEach((function(e){var t=Kt(e).samples;t.forEach((function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=o),e.trackId=s,e.dts=n,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof n?(e.pts=n+ei.BigInt(e.compositionTimeOffset),n+=ei.BigInt(e.duration)):(e.pts=n+e.compositionTimeOffset,n+=e.duration)})),a=a.concat(t)})),a}(h,c,a),l),r[l]||(r[l]={seiNals:[],logs:[]}),r[l].seiNals=r[l].seiNals.concat(i.seiNals),r[l].logs=r[l].logs.concat(i.logs))})),r},oi=function(){var e,t,i,n,r,o,s=!1;this.isInitialized=function(){return s},this.init=function(t){e=new ii,s=!0,o=!!t&&t.isPartial,e.on("data",(function(e){e.startTime=e.startPts/n,e.endTime=e.endPts/n,r.captions.push(e),r.captionStreams[e.stream]=!0})),e.on("log",(function(e){r.logs.push(e)}))},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length)&&(i!==e[0]||n!==t[i])},this.parse=function(e,o,s){var a;if(!this.isInitialized())return null;if(!o||!s)return null;if(this.isNewInit(o,s))i=o[0],n=s[i];else if(null===i||!n)return t.push(e),null;for(;t.length>0;){var l=t.shift();this.parse(l,o,s)}return(a=function(e,t,i){if(null===t)return null;var n=ri(e,t)[t]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(e,i,n))&&a.logs&&(r.logs=r.logs.concat(a.logs)),null!==a&&a.seiNals?(this.pushNals(a.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;o?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},si=Vt,ai=function(e){return("00"+e.toString(16)).slice(-2)},li=V.getUint64;Bt=function(e,t){var i=Yt(t,["moof","traf"]).reduce((function(t,i){var n,r,o=Yt(i,["tfhd"])[0],s=si(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),a=e[s]||9e4,l=Yt(i,["tfdt"])[0],u=new DataView(l.buffer,l.byteOffset,l.byteLength);return"bigint"==typeof(n=1===l[0]?li(l.subarray(4,12)):u.getUint32(4))?r=n/ei.BigInt(a):"number"!=typeof n||isNaN(n)||(r=n/a),r<Number.MAX_SAFE_INTEGER&&(r=Number(r)),r<t&&(t=r),t}),1/0);return"bigint"==typeof i||isFinite(i)?i:0},Ft=function(e){var t=Yt(e,["moov","trak"]),i=[];return t.forEach((function(e){var t,n,r={},o=Yt(e,["tkhd"])[0];o&&(n=(t=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0),r.id=0===n?t.getUint32(12):t.getUint32(20));var s=Yt(e,["mdia","hdlr"])[0];if(s){var a=Gt(s.subarray(8,12));r.type="vide"===a?"video":"soun"===a?"audio":a}var l=Yt(e,["mdia","minf","stbl","stsd"])[0];if(l){var u=l.subarray(8);r.codec=Gt(u.subarray(4,8));var c,h=Yt(u,[r.codec])[0];h&&(/^[asm]vc[1-9]$/i.test(r.codec)?(c=h.subarray(78),"avcC"===Gt(c.subarray(4,8))&&c.length>11?(r.codec+=".",r.codec+=ai(c[9]),r.codec+=ai(c[10]),r.codec+=ai(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(c=h.subarray(28),"esds"===Gt(c.subarray(4,8))&&c.length>20&&0!==c[19]?(r.codec+="."+ai(c[19]),r.codec+="."+ai(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var d=Yt(e,["mdia","mdhd"])[0];d&&(r.timescale=Wt(d)),i.push(r)})),i};var ui=Bt,ci=Ft,hi=(Wt=function(e){var t=0===e[0]?12:20;return si(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},function(e){var t=31&e[1];return t<<=8,t|=e[2]}),di=function(e){return!!(64&e[1])},pi=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},fi=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},mi={parseType:function(e,t){var i=hi(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=di(e),i=4+pi(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=di(e),n=4+pi(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var o=12+((15&e[n+10])<<8|e[n+11]);o<r;){var s=n+o;t[(31&e[s+1])<<8|e[s+2]]=e[s],o+=5+((15&e[s+3])<<8|e[s+4])}return t}},parsePayloadUnitStartIndicator:di,parsePesType:function(e,t){switch(t[hi(e)]){case Ge.H264_STREAM_TYPE:return"video";case Ge.ADTS_STREAM_TYPE:return"audio";case Ge.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!di(e))return null;var t=4+pi(e);if(t>=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+pi(e),i=e.subarray(t),n=0,r=0,o=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===fi(31&i[r+3])&&(o=!0);do{n++}while(1!==i[n]&&n<i.length);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===fi(31&i[r+3])&&(o=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,i&&i.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===fi(31&i[r+3])&&(o=!0),o}},gi=Qe,vi={};vi.ts=mi,vi.aac=Et;var yi=pe,_i=188,bi=71,Ci=function(e,t,i){for(var n,r,o,s,a=0,l=_i,u=!1;l<=e.byteLength;)if(e[a]!==bi||e[l]!==bi&&l!==e.byteLength)a++,l++;else{switch(n=e.subarray(a,l),vi.ts.parseType(n,t.pid)){case"pes":r=vi.ts.parsePesType(n,t.table),o=vi.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&o&&(s=vi.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),u=!0)}if(u)break;a+=_i,l+=_i}for(a=(l=e.byteLength)-_i,u=!1;a>=0;)if(e[a]!==bi||e[l]!==bi&&l!==e.byteLength)a--,l--;else{switch(n=e.subarray(a,l),vi.ts.parseType(n,t.pid)){case"pes":r=vi.ts.parsePesType(n,t.table),o=vi.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&o&&(s=vi.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),u=!0)}if(u)break;a-=_i,l-=_i}},Ti=function(e,t,i){for(var n,r,o,s,a,l,u,c=0,h=_i,d=!1,p={data:[],size:0};h<e.byteLength;)if(e[c]!==bi||e[h]!==bi)c++,h++;else{switch(n=e.subarray(c,h),vi.ts.parseType(n,t.pid)){case"pes":if(r=vi.ts.parsePesType(n,t.table),o=vi.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(o&&!d&&(s=vi.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),d=!0),!i.firstKeyFrame)){if(o&&0!==p.size){for(a=new Uint8Array(p.size),l=0;p.data.length;)u=p.data.shift(),a.set(u,l),l+=u.byteLength;if(vi.ts.videoPacketContainsKeyFrame(a)){var f=vi.ts.parsePesTime(a);f?(i.firstKeyFrame=f,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}p.size=0}p.data.push(n),p.size+=n.byteLength}}if(d&&i.firstKeyFrame)break;c+=_i,h+=_i}for(c=(h=e.byteLength)-_i,d=!1;c>=0;)if(e[c]!==bi||e[h]!==bi)c--,h--;else{switch(n=e.subarray(c,h),vi.ts.parseType(n,t.pid)){case"pes":r=vi.ts.parsePesType(n,t.table),o=vi.ts.parsePayloadUnitStartIndicator(n),"video"===r&&o&&(s=vi.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),d=!0)}if(d)break;c-=_i,h-=_i}},wi=function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=_i;r<e.byteLength;)if(e[n]!==bi||e[r]!==bi)n++,r++;else{switch(i=e.subarray(n,r),vi.ts.parseType(i,t.pid)){case"pat":t.pid=vi.ts.parsePat(i);break;case"pmt":var o=vi.ts.parsePmt(i);t.table=t.table||{},Object.keys(o).forEach((function(e){t.table[e]=o[e]}))}n+=_i,r+=_i}}(e,t),t.table){if(t.table.hasOwnProperty(n))switch(t.table[n]){case Ge.H264_STREAM_TYPE:i.video=[],Ti(e,t,i),0===i.video.length&&delete i.video;break;case Ge.ADTS_STREAM_TYPE:i.audio=[],Ci(e,t,i),0===i.audio.length&&delete i.audio}}return i},Ei=function(e,t){var i;return(i=vi.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,o=null,s=0,a=0;e.length-a>=3;){switch(vi.aac.parseType(e,a)){case"timed-metadata":if(e.length-a<10){i=!0;break}if((s=vi.aac.parseId3TagSize(e,a))>e.length){i=!0;break}null===o&&(t=e.subarray(a,a+s),o=vi.aac.parseAacTimestamp(t)),a+=s;break;case"audio":if(e.length-a<7){i=!0;break}if((s=vi.aac.parseAdtsSize(e,a))>e.length){i=!0;break}null===r&&(t=e.subarray(a,a+s),r=vi.aac.parseSampleRate(t)),n++,a+=s;break;default:a++}if(i)return null}if(null===r||null===o)return null;var l=yi/r;return{audio:[{type:"audio",dts:o,pts:o},{type:"audio",dts:o+1024*n*l,pts:o+1024*n*l}]}}(e):wi(e))&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;(void 0===i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=gi(e.dts,i),e.pts=gi(e.pts,i),e.dtsTime=e.dts/yi,e.ptsTime=e.pts/yi}))}if(e.video&&e.video.length){var n=t;if((void 0===n||isNaN(n))&&(n=e.video[0].dts),e.video.forEach((function(e){e.dts=gi(e.dts,n),e.pts=gi(e.pts,n),e.dtsTime=e.dts/yi,e.ptsTime=e.pts/yi})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=gi(r.dts,n),r.pts=gi(r.pts,n),r.dtsTime=r.dts/yi,r.ptsTime=r.pts/yi}}}(i,t),i):null},Si=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){var e,t;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Ht.Transmuxer(this.options),e=this.self,(t=this.transmuxer).on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){var i={start:{decode:me(t.start.dts),presentation:me(t.start.pts)},end:{decode:me(t.end.dts),presentation:me(t.end.pts)},baseMediaDecodeTime:me(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=me(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){var i={start:{decode:me(t.start.dts),presentation:me(t.start.pts)},end:{decode:me(t.end.dts),presentation:me(t.end.pts)},baseMediaDecodeTime:me(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=me(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:me(t.start),end:me(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:me(t.start),end:me(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))},t.pushMp4Captions=function(e){this.captionParser||(this.captionParser=new oi,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])},t.probeMp4StartTime=function(e){var t=e.timescales,i=e.data,n=ui(t,i);this.self.postMessage({action:"probeMp4StartTime",startTime:n,data:i},[i.buffer])},t.probeMp4Tracks=function(e){var t=e.data,i=ci(t);this.self.postMessage({action:"probeMp4Tracks",tracks:i,data:t},[t.buffer])},t.probeTs=function(e){var t=e.data,i=e.baseStartTime,n="number"!=typeof i||isNaN(i)?void 0:i*pe,r=Ei(t,n),o=null;r&&((o={hasVideo:r.video&&2===r.video.length||!1,hasAudio:r.audio&&2===r.audio.length||!1}).hasVideo&&(o.videoStart=r.video[0].ptsTime),o.hasAudio&&(o.audioStart=r.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:o,data:t},[t.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(fe(t)))},t.setAudioAppendStart=function(e){this.transmuxer.setAudioAppendStart(Math.ceil(fe(e.appendStart)))},t.setRemux=function(e){this.transmuxer.setRemux(e.remux)},t.flush=function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())},e}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Si(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Si(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})))),Om=function(e){var t=e.transmuxer,i=e.bytes,n=e.audioAppendStart,r=e.gopsToAlignWith,o=e.remux,s=e.onData,a=e.onTrackInfo,l=e.onAudioTimingInfo,u=e.onVideoTimingInfo,c=e.onVideoSegmentTimingInfo,h=e.onAudioSegmentTimingInfo,d=e.onId3,p=e.onCaptions,f=e.onDone,m=e.onEndedTimeline,g=e.onTransmuxerLog,v=e.isEndOfTimeline,y={buffer:[]},_=v;if(t.onmessage=function(i){t.currentTransmux===e&&("data"===i.data.action&&function(e,t,i){var n=e.data.segment,r=n.type,o=n.initSegment,s=n.captions,a=n.captionStreams,l=n.metadata,u=n.videoFrameDtsTime,c=n.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:a,metadata:l});var h=e.data.segment.boxes||{data:e.data.segment.data},d={type:r,data:new Uint8Array(h.data,h.data.byteOffset,h.data.byteLength),initSegment:new Uint8Array(o.data,o.byteOffset,o.byteLength)};void 0!==u&&(d.videoFrameDtsTime=u),void 0!==c&&(d.videoFramePtsTime=c),i(d)}(i,y,s),"trackinfo"===i.data.action&&a(i.data.trackInfo),"gopInfo"===i.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(i,y),"audioTimingInfo"===i.data.action&&l(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&u(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&c(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&h(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&d([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(_=!1,m()),"log"===i.data.action&&g(i.data.log),"transmuxed"===i.data.type&&(_||(t.onmessage=null,function(e){var t=e.transmuxedData,i=e.callback;t.buffer=[],i(t)}({transmuxedData:y,callback:f}),jm(t))))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==o&&t.postMessage({action:"setRemux",remux:o}),i.byteLength){var b=i instanceof ArrayBuffer?i:i.buffer,C=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:b,byteOffset:C,byteLength:i.byteLength},[b])}v&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},jm=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Om(e.currentTransmux))},Rm=function(e,t){e.postMessage({action:t}),jm(e)},Nm=function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,void Rm(t,e);t.transmuxQueue.push(Rm.bind(null,t,e))},Um=function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void Om(e);e.transmuxer.transmuxQueue.push(e)},Bm=function(e){Nm("reset",e)},Fm=function(e){var t=new Dm;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t},Wm=function(e){var t=e.transmuxer,i=e.endAction||e.action,n=e.callback,r=Sn({},e,{endAction:null,transmuxer:null,callback:null});if(t.addEventListener("message",(function r(o){o.data.action===i&&(t.removeEventListener("message",r),o.data.data&&(o.data.data=new Uint8Array(o.data.data,e.byteOffset||0,e.byteLength||o.data.data.byteLength),e.data&&(e.data=o.data.data)),n(o.data))})),e.data){var o=e.data instanceof ArrayBuffer;r.byteOffset=o?0:e.data.byteOffset,r.byteLength=e.data.byteLength;var s=[o?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},Hm=2,Vm=-101,Gm=-102,zm=function(e){e.forEach((function(e){e.abort()}))},Ym=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Vm,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Gm,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Hm,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:Hm,xhr:t}:null},qm=function(e,t,i){return function(n,r){var o=r.response,s=Ym(n,r);if(s)return i(s,e);if(16!==o.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Hm,xhr:r},e);for(var a=new DataView(o),l=new Uint32Array([a.getUint32(0),a.getUint32(4),a.getUint32(8),a.getUint32(12)]),u=0;u<t.length;u++)t[u].bytes=l;return i(null,e)}},Xm=function(e,t){var i=Yl(e.map.bytes);if("mp4"!==i){var n=e.map.resolvedUri||e.map.uri;return t({internal:!0,message:"Found unsupported "+(i||"unknown")+" container for initialization segment at URL: "+n,code:Hm})}Wm({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:function(i){var n=i.tracks,r=i.data;return e.map.bytes=r,n.forEach((function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale))})),t(null)}})},Zm=function(e){var t=e.segment,i=e.finishProcessingFn,n=e.responseType;return function(e,r){var o=Ym(e,r);if(o)return i(o,t);var s="arraybuffer"!==n&&r.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer}(r.responseText.substring(t.lastReachedChar||0)):r.response;return t.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(r),t.key?t.encryptedBytes=new Uint8Array(s):t.bytes=new Uint8Array(s),i(null,t)}},Qm=function(e){var t=e.segment,i=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,o=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,a=e.id3Fn,l=e.captionsFn,u=e.isEndOfTimeline,c=e.endedTimelineFn,h=e.dataFn,d=e.doneFn,p=e.onTransmuxerLog,f=t.map&&t.map.tracks||{},m=Boolean(f.audio&&f.video),g=r.bind(null,t,"audio","start"),v=r.bind(null,t,"audio","end"),y=r.bind(null,t,"video","start"),_=r.bind(null,t,"video","end");Wm({action:"probeTs",transmuxer:t.transmuxer,data:i,baseStartTime:t.baseStartTime,callback:function(e){t.bytes=i=e.data;var r=e.result;r&&(n(t,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:m}),n=null,r.hasAudio&&!m&&g(r.audioStart),r.hasVideo&&y(r.videoStart),g=null,y=null),Um({bytes:i,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:m,onData:function(e){e.type="combined"===e.type?"video":e.type,h(t,e)},onTrackInfo:function(e){n&&(m&&(e.isMuxed=!0),n(t,e))},onAudioTimingInfo:function(e){g&&void 0!==e.start&&(g(e.start),g=null),v&&void 0!==e.end&&v(e.end)},onVideoTimingInfo:function(e){y&&void 0!==e.start&&(y(e.start),y=null),_&&void 0!==e.end&&_(e.end)},onVideoSegmentTimingInfo:function(e){o(e)},onAudioSegmentTimingInfo:function(e){s(e)},onId3:function(e,i){a(t,e,i)},onCaptions:function(e){l(t,[e])},isEndOfTimeline:u,onEndedTimeline:function(){c()},onTransmuxerLog:p,onDone:function(e){d&&(e.type="combined"===e.type?"video":e.type,d(null,t,e))}})}})},Km=function(e){var t=e.segment,i=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,o=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,a=e.id3Fn,l=e.captionsFn,u=e.isEndOfTimeline,c=e.endedTimelineFn,h=e.dataFn,d=e.doneFn,p=e.onTransmuxerLog,f=new Uint8Array(i);if(function(e){return kl(e,["moof"]).length>0}(f)){t.isFmp4=!0;var m=t.map.tracks,g={isFmp4:!0,hasVideo:!!m.video,hasAudio:!!m.audio};m.audio&&m.audio.codec&&"enca"!==m.audio.codec&&(g.audioCodec=m.audio.codec),m.video&&m.video.codec&&"encv"!==m.video.codec&&(g.videoCodec=m.video.codec),m.video&&m.audio&&(g.isMuxed=!0),n(t,g);var v=function(e){h(t,{data:f,type:g.hasAudio&&!g.isMuxed?"audio":"video"}),e&&e.length&&l(t,e),d(null,t,{})};Wm({action:"probeMp4StartTime",timescales:t.map.timescales,data:f,transmuxer:t.transmuxer,callback:function(e){var n=e.data,o=e.startTime;i=n.buffer,t.bytes=f=n,g.hasAudio&&!g.isMuxed&&r(t,"audio","start",o),g.hasVideo&&r(t,"video","start",o),m.video&&n.byteLength&&t.transmuxer?Wm({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:f,timescales:t.map.timescales,trackIds:[m.video.id],callback:function(e){i=e.data.buffer,t.bytes=f=e.data,e.logs.forEach((function(e){p(hf.mergeOptions(e,{stream:"mp4CaptionParser"}))})),v(e.captions)}}):v()}})}else if(t.transmuxer){if(void 0===t.container&&(t.container=Yl(f)),"ts"!==t.container&&"aac"!==t.container)return n(t,{hasAudio:!1,hasVideo:!1}),void d(null,t,{});Qm({segment:t,bytes:i,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:c,dataFn:h,doneFn:d,onTransmuxerLog:p})}else d(null,t,{})},Jm=function(e,t){var i,n=e.id,r=e.key,o=e.encryptedBytes,s=e.decryptionWorker;s.addEventListener("message",(function e(i){if(i.data.source===n){s.removeEventListener("message",e);var r=i.data.decrypted;t(new Uint8Array(r.bytes,r.byteOffset,r.byteLength))}})),i=r.bytes.slice?r.bytes.slice():new Uint32Array(Array.prototype.slice.call(r.bytes)),s.postMessage(pm({source:n,encrypted:o,key:i,iv:r.iv}),[o.buffer,i.buffer])},$m=function(e){var t=e.activeXhrs,i=e.decryptionWorker,n=e.trackInfoFn,r=e.timingInfoFn,o=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,a=e.id3Fn,l=e.captionsFn,u=e.isEndOfTimeline,c=e.endedTimelineFn,h=e.dataFn,d=e.doneFn,p=e.onTransmuxerLog,f=0,m=!1;return function(e,g){if(!m){if(e)return m=!0,zm(t),d(e,g);if((f+=1)===t.length){var v=function(){if(g.encryptedBytes)return function(e){var t=e.decryptionWorker,i=e.segment,n=e.trackInfoFn,r=e.timingInfoFn,o=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,a=e.id3Fn,l=e.captionsFn,u=e.isEndOfTimeline,c=e.endedTimelineFn,h=e.dataFn,d=e.doneFn,p=e.onTransmuxerLog;Jm({id:i.requestId,key:i.key,encryptedBytes:i.encryptedBytes,decryptionWorker:t},(function(e){i.bytes=e,Km({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:c,dataFn:h,doneFn:d,onTransmuxerLog:p})}))}({decryptionWorker:i,segment:g,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:c,dataFn:h,doneFn:d,onTransmuxerLog:p});Km({segment:g,bytes:g.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:c,dataFn:h,doneFn:d,onTransmuxerLog:p})};if(g.endOfAllRequests=Date.now(),g.map&&g.map.encryptedBytes&&!g.map.bytes)return Jm({decryptionWorker:i,id:g.requestId+"-init",encryptedBytes:g.map.encryptedBytes,key:g.map.key},(function(e){g.map.bytes=e,Xm(g,(function(e){if(e)return zm(t),d(e,g);v()}))}));v()}}}},eg=function(e){var t=e.segment,i=e.progressFn;return e.trackInfoFn,e.timingInfoFn,e.videoSegmentTimingInfoFn,e.audioSegmentTimingInfoFn,e.id3Fn,e.captionsFn,e.isEndOfTimeline,e.endedTimelineFn,e.dataFn,function(e){if(!e.target.aborted)return t.stats=hf.mergeOptions(t.stats,function(e){var t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),i(e,t)}},tg=function(e){var t=e.xhr,i=e.xhrOptions,n=e.decryptionWorker,r=e.segment,o=e.abortFn,s=e.progressFn,a=e.trackInfoFn,l=e.timingInfoFn,u=e.videoSegmentTimingInfoFn,c=e.audioSegmentTimingInfoFn,h=e.id3Fn,d=e.captionsFn,p=e.isEndOfTimeline,f=e.endedTimelineFn,m=e.dataFn,g=e.doneFn,v=e.onTransmuxerLog,y=[],_=$m({activeXhrs:y,decryptionWorker:n,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:c,id3Fn:h,captionsFn:d,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m,doneFn:g,onTransmuxerLog:v});if(r.key&&!r.key.bytes){var b=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&b.push(r.map.key);var C=t(hf.mergeOptions(i,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),qm(r,b,_));y.push(C)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){var T=t(hf.mergeOptions(i,{uri:r.map.key.resolvedUri,responseType:"arraybuffer"}),qm(r,[r.map.key],_));y.push(T)}var w=t(hf.mergeOptions(i,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:um(r.map)}),function(e){var t=e.segment,i=e.finishProcessingFn;return function(e,n){var r=Ym(e,n);if(r)return i(r,t);var o=new Uint8Array(n.response);if(t.map.key)return t.map.encryptedBytes=o,i(null,t);t.map.bytes=o,Xm(t,(function(e){if(e)return e.xhr=n,e.status=n.status,i(e,t);i(null,t)}))}}({segment:r,finishProcessingFn:_}));y.push(w)}var E=hf.mergeOptions(i,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:um(r)}),S=t(E,Zm({segment:r,finishProcessingFn:_,responseType:E.responseType}));S.addEventListener("progress",eg({segment:r,progressFn:s,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:c,id3Fn:h,captionsFn:d,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m})),y.push(S);var k={};return y.forEach((function(e){e.addEventListener("loadend",function(e){var t=e.loadendState,i=e.abortFn;return function(e){e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}}({loadendState:k,abortFn:o}))})),function(){return zm(y)}},ig=gf("CodecUtils"),ng=function(e,t){var i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},rg=function(e){var t={};return e.forEach((function(e){var i=e.mediaType,n=e.type,r=e.details;t[i]=t[i]||[],t[i].push(to(""+n+r))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return ig("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]})),t},og=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},sg=function(e,t){var i=t.attributes||{},n=rg(function(e){var t=e.attributes||{};if(t.CODECS)return io(t.CODECS)}(t)||[]);if(ng(e,t)&&!n.audio&&!function(e,t){if(!ng(e,t))return!0;var i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(var r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1}(e,t)){var r=rg(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return io(r.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},ag=gf("PlaylistSelector"),lg=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},ug=function(e,t){if(!e)return"";var i=bn.getComputedStyle(e);return i?i[t]:""},cg=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},hg=function(e,t){var i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||bn.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n=n||bn.Number.MAX_VALUE)},dg=function(e,t,i,n,r,o){if(e){var s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},a=e.playlists;Gf.isAudioOnly(e)&&(a=o.getAudioTrackPlaylists_(),s.audioOnly=!0);var l=a.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||bn.Number.MAX_VALUE,width:t,height:i,playlist:e}}));cg(l,(function(e,t){return e.bandwidth-t.bandwidth}));var u=(l=l.filter((function(e){return!Gf.isIncompatible(e.playlist)}))).filter((function(e){return Gf.isEnabled(e.playlist)}));u.length||(u=l.filter((function(e){return!Gf.isDisabled(e.playlist)})));var c=u.filter((function(e){return e.bandwidth*Am.BANDWIDTH_VARIANCE<t})),h=c[c.length-1],d=c.filter((function(e){return e.bandwidth===h.bandwidth}))[0];if(!1===r){var p=d||u[0]||l[0];if(p&&p.playlist){var f="sortedPlaylistReps";return d&&(f="bandwidthBestRep"),u[0]&&(f="enabledPlaylistReps"),ag("choosing "+lg(p)+" using "+f+" with options",s),p.playlist}return ag("could not choose a playlist with options",s),null}var m=c.filter((function(e){return e.width&&e.height}));cg(m,(function(e,t){return e.width-t.width}));var g=m.filter((function(e){return e.width===i&&e.height===n}));h=g[g.length-1];var v,y,_,b,C=g.filter((function(e){return e.bandwidth===h.bandwidth}))[0];if(C||(y=(v=m.filter((function(e){return e.width>i||e.height>n}))).filter((function(e){return e.width===v[0].width&&e.height===v[0].height})),h=y[y.length-1],_=y.filter((function(e){return e.bandwidth===h.bandwidth}))[0]),o.experimentalLeastPixelDiffSelector){var T=m.map((function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e}));cg(T,(function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff})),b=T[0]}var w=b||_||C||d||u[0]||l[0];if(w&&w.playlist){var E="sortedPlaylistReps";return b?E="leastPixelDiffRep":_?E="resolutionPlusOneRep":C?E="resolutionBestRep":d?E="bandwidthBestRep":u[0]&&(E="enabledPlaylistReps"),ag("choosing "+lg(w)+" using "+E+" with options",s),w.playlist}return ag("could not choose a playlist with options",s),null}},pg=function(){var e=this.useDevicePixelRatio&&bn.devicePixelRatio||1;return dg(this.playlists.master,this.systemBandwidth,parseInt(ug(this.tech_.el(),"width"),10)*e,parseInt(ug(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},fg=function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,r=e.videoDuration;if(i){var o=bn.WebKitDataCue||bn.VTTCue,s=t.metadataTrack_;if(s&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!=typeof t||bn.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new o(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return hf.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return hf.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return hf.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(i),s.addCue(i)}))})),s.cues&&s.cues.length)){for(var a=s.cues,l=[],u=0;u<a.length;u++)a[u]&&l.push(a[u]);var c=l.reduce((function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e}),{}),h=Object.keys(c).sort((function(e,t){return Number(e)-Number(t)}));h.forEach((function(e,t){var i=c[e],n=Number(h[t+1])||r;i.forEach((function(e){e.endTime=n}))}))}}},mg=function(e,t,i){var n,r;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime>=e&&r.endTime<=t&&i.removeCue(r)},gg=function(e){return"number"==typeof e&&isFinite(e)},vg=1/60,yg=function(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,o=e.playlist,s=o.mediaSequence,a=o.id,l=o.segments,u=void 0===l?[]:l,c=e.mediaIndex,h=e.partIndex,d=e.timeline,p=u.length-1,f="mediaIndex/partIndex increment";e.getMediaInfoForTime?f="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(f="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(f+=" with independent "+e.independent);var m="number"==typeof h,g=e.segment.uri?"segment":"pre-segment",v=m?If({preloadSegment:n})-1:0;return g+" ["+(s+c)+"/"+(s+p)+"]"+(m?" part ["+h+"/"+v+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(m?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+d+"] selected by ["+f+"] playlist ["+a+"]"},_g=function(e){return e+"TimingInfo"},bg=function(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,o=e.audioDisabled;if(i===n)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==n}if("main"===r&&o){var a=t.pendingTimelineChange({type:"audio"});return!a||a.to!==n}return!1},Cg=function(e){var t=e.segmentDuration,i=e.maxDuration;return!!t&&Math.round(t)>i+vf},Tg=function(e,t){if("hls"!==t)return null;var i,n,r=(i={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},n=0,["video","audio"].forEach((function(e){var t=i[e+"TimingInfo"];if(t){var r,o=t.start,s=t.end;"bigint"==typeof o||"bigint"==typeof s?r=bn.BigInt(s)-bn.BigInt(o):"number"==typeof o&&"number"==typeof s&&(r=s-o),void 0!==r&&r>n&&(n=r)}})),"bigint"==typeof n&&n<Number.MAX_SAFE_INTEGER&&(n=Number(n)),n);if(!r)return null;var o=e.playlist.targetDuration,s=Cg({segmentDuration:r,maxDuration:2*o}),a=Cg({segmentDuration:r,maxDuration:o}),l="Segment with index "+e.mediaIndex+" from playlist "+e.playlist.id+" has a duration of "+r+" when the reported duration is "+e.duration+" and the target duration is "+o+". For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";return s||a?{severity:s?"warn":"info",message:l}:null},wg=function(e){function t(t,i){var n;if(n=e.call(this)||this,!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.useDtsForTimestampOffset_=t.useDtsForTimestampOffset,n.captionServices_=t.captionServices,n.experimentalExactManifestTimings=t.experimentalExactManifestTimings,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=hf.browser.IE_VERSION>=11,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=gf("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(An(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}In(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return Fm({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&bn.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,bn.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&Bm(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return hf.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=fm(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=mm(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var o=e.mediaSequence-i.mediaSequence;if(this.logger_("live window shift ["+o+"]"),null!==this.mediaIndex)if(this.mediaIndex-=o,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var a=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=a}}n&&(n.mediaIndex-=o,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},i.pause=function(){this.checkBufferTimeout_&&(bn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&Bm(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,o=function(){0===--r&&i()};for(var s in!n&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,o)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*Zl),o=Math.ceil((i-n)*Zl),s=e.slice(),a=e.length;a--&&!(e[a].pts<=o););if(-1===a)return s;for(var l=a+1;l--&&!(e[l].pts<=r););return l=Math.max(l,0),s.splice(l,a-l+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,o)),this.inbandTextTracks_)mg(e,t,this.inbandTextTracks_[s]);mg(e,t,this.segmentMetadataTrack_),o()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&bn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=bn.setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&bn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=bn.setTimeout(this.monitorBufferTick_.bind(this),500)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,o=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&o},i.chooseNextRequest_=function(){var e=this.buffered_(),t=Ef(e)||0,i=Sf(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),o=this.playlist_.segments;if(!o.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var s={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(s.isSyncRequest)s.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,o=0;o<t.length;o++){var s=t[o];if(e===s.timeline&&(n.push(o),(r+=s.duration)>i))return o}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,o,t);else if(null!==this.mediaIndex){var a=o[this.mediaIndex],l="number"==typeof this.partIndex?this.partIndex:-1;s.startOfSegment=a.end?a.end:t,a.parts&&a.parts[l+1]?(s.mediaIndex=this.mediaIndex,s.partIndex=l+1):s.mediaIndex=this.mediaIndex+1}else{var u=Gf.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),c=u.segmentIndex,h=u.startTime,d=u.partIndex;s.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),s.mediaIndex=c,s.startOfSegment=h,s.partIndex=d}var p=o[s.mediaIndex],f=p&&"number"==typeof s.partIndex&&p.parts&&p.parts[s.partIndex];if(!p||"number"==typeof s.partIndex&&!f)return null;if("number"!=typeof s.partIndex&&p.parts&&(s.partIndex=0,f=p.parts[0]),!i&&f&&!f.independent)if(0===s.partIndex){var m=o[s.mediaIndex-1],g=m.parts&&m.parts.length&&m.parts[m.parts.length-1];g&&g.independent&&(s.mediaIndex-=1,s.partIndex=m.parts.length-1,s.independent="previous segment")}else p.parts[s.partIndex-1].independent&&(s.partIndex-=1,s.independent="previous part");var v=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return s.mediaIndex>=o.length-1&&v&&!this.seeking_()?null:this.generateSegmentInfo_(s)},i.generateSegmentInfo_=function(e){var t=e.independent,i=e.playlist,n=e.mediaIndex,r=e.startOfSegment,o=e.isSyncRequest,s=e.partIndex,a=e.forceTimestampOffset,l=e.getMediaInfoForTime,u=i.segments[n],c="number"==typeof s&&u.parts[s],h={requestId:"segment-loader-"+Math.random(),uri:c&&c.resolvedUri||u.resolvedUri,mediaIndex:n,partIndex:c?s:null,isSyncRequest:o,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:c&&c.duration||u.duration,segment:u,part:c,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:l,independent:t},d=void 0!==a?a:this.isPendingTimestampOffset_;h.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:u.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:d});var p=Ef(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(h.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(h.gopsToAlignWith=function(e,t,i){if(null==t||!e.length)return[];var n,r=Math.ceil((t-i+3)*Zl);for(n=0;n<e.length&&!(e[n].pts>r);n++);return e.slice(n)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),h},i.timestampOffsetForSegment_=function(e){return i=(t=e).segmentTimeline,n=t.currentTimeline,r=t.startOfSegment,o=t.buffered,t.overrideCheck||i!==n?i<n?r:o.length?o.end(o.length-1):r:null;var t,i,n,r,o},i.earlyAbortWhenNeeded_=function(e){if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)){var t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=Gf.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),o=function(e,t,i){return void 0===i&&(i=1),((e.length?e.end(e.length-1):0)-t)/i}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(!(r<=o)){var s=function(e){var t=e.master,i=e.currentTime,n=e.bandwidth,r=e.duration,o=e.segmentDuration,s=e.timeUntilRebuffer,a=e.currentTimeline,l=e.syncController,u=t.playlists.filter((function(e){return!Gf.isIncompatible(e)})),c=u.filter(Gf.isEnabled);c.length||(c=u.filter((function(e){return!Gf.isDisabled(e)})));var h=c.filter(Gf.hasAttribute.bind(null,"BANDWIDTH")).map((function(e){var t=l.getSyncPoint(e,r,a,i)?1:2;return{playlist:e,rebufferingImpact:Gf.estimateSegmentRequestTime(o,n,e)*t-s}})),d=h.filter((function(e){return e.rebufferingImpact<=0}));return cg(d,(function(e,t){return hg(t.playlist,e.playlist)})),d.length?d[0]:(cg(h,(function(e,t){return e.rebufferingImpact-t.rebufferingImpact})),h[0]||null)}({master:this.vhs_.playlists.master,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:o,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var a=r-o-s.rebufferingImpact,l=.5;o<=vf&&(l=1),!s.playlist||s.playlist.uri===this.playlist_.uri||a<l||(this.bandwidth=s.playlist.attributes.BANDWIDTH*Am.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}}}},i.handleAbort_=function(e){this.logger_("Aborting "+yg(e)),this.mediaRequestsAborted+=1},i.handleProgress_=function(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")},i.handleTrackInfo_=function(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(t=t||{},function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;var i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(var r=0;r<i.length;r++){var o=i[r];if(o!==n[r])return!1;if(e[o]!==t[o])return!1}return!0}(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),this.checkForAbort_(e.requestId)||(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()&&this.processCallQueue_()))},i.handleTimingInfo_=function(e,t,i,n){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){var r=this.pendingSegment_,o=_g(t);r[o]=r[o]||{},r[o][i]=n,this.logger_("timinginfo: "+t+" - "+i+" - "+n),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}},i.handleCaptions_=function(e,t){var i=this;if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(0!==t.length)if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach((function(e){r[e.stream]=r[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=r[e.stream];t.startTime=Math.min(t.startTime,e.startTime+n),t.endTime=Math.max(t.endTime,e.endTime+n),t.captions.push(e)})),Object.keys(r).forEach((function(e){var t=r[e],o=t.startTime,s=t.endTime,a=t.captions,l=i.inbandTextTracks_;i.logger_("adding cues from "+o+" -> "+s+" for "+e),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);var r=t.textTracks().getTrackById(n);if(r)e[i]=r;else{var o=i,s=i,a=!1,l=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];l&&(o=l.label,s=l.language,a=l.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:a,label:o,language:s},!1).track}}}(l,i.vhs_.tech_,e),mg(o,s,l[e]),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=bn.WebKitDataCue||bn.VTTCue;i.forEach((function(e){var i=e.stream;t[i].addCue(new r(e.startTime+n,e.endTime+n,e.text))}))}}({captionArray:a,inbandTextTracks:l,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},i.handleId3_=function(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,i){e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,i,this.vhs_.tech_),fg({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})}else this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i))},i.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach((function(e){return e()})),this.metadataQueue_.caption.forEach((function(e){return e()})),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},i.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach((function(e){return e()}))},i.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((function(e){return e()}))},i.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!bg({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.getCurrentMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),e&&e.trackInfo||this.currentMediaInfo_},i.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},i.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed;return!(n&&!e.videoTimingInfo)&&(!(i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!bg({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[_g(t.type)].start;else{var n,r=this.getCurrentMediaInfo_(),o="main"===this.loaderType_&&r&&r.hasVideo;o&&(n=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:o,firstVideoFrameTimeForData:n,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});var s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},i.updateAppendInitSegmentStatus=function(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)},i.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){var o=fm(n);if(this.activeInitSegmentId_===o)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=o}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},i.handleQuotaExceededError_=function(e,t){var i=this,n=e.segmentInfo,r=e.type,o=e.bytes,s=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+wf(s).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+wf(a).join(", "));var l=s.length?s.start(0):0,u=s.length?s.end(s.length-1):0,c=a.length?a.start(0):0,h=a.length?a.end(a.length-1):0;if(u-l<=1&&h-c<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+o.byteLength+", audio buffer: "+wf(s).join(", ")+", video buffer: "+wf(a).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:o}));var d=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+d),this.remove(0,d,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=bn.setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+r.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:r}))},i.appendToSourceBuffer_=function(e){var t,i,n,r=e.segmentInfo,o=e.type,s=e.initSegment,a=e.data,l=e.bytes;if(!l){var u=[a],c=a.byteLength;s&&(u.unshift(s),c+=s.byteLength),n=0,(t={bytes:c,segments:u}).bytes&&(i=new Uint8Array(t.bytes),t.segments.forEach((function(e){i.set(e,n),n+=e.byteLength}))),l=i}this.sourceUpdater_.appendBuffer({segmentInfo:r,type:o,bytes:l},this.handleAppendError_.bind(this,{segmentInfo:r,type:o,bytes:l}))},i.handleSegmentTimingInfo_=function(e,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var n=this.pendingSegment_.segment,r=e+"TimingInfo";n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}},i.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=Sn({},e,{forceTimestampOffset:!0});Sn(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,o=e.timeline!==this.currentTimeline_&&e.timeline>0,s=n||r&&o;this.logger_("Requesting "+yg(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=tg({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(i){var n=i.message,r=i.level,o=i.stream;t.logger_(yg(e)+" logged from transmuxer stream "+o+" as a "+r+": "+n)}})},i.trimBackBuffer_=function(e){var t=function(e,t,i){var n=t-Am.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},i.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?n.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(n.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){var o=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=o}return t.map&&(n.map=this.initSegmentForMap(t.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<vg?this.logger_("Ignoring segment's bandwidth because its duration of "+e+" is less than the min to record 0.016666666666666666"):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)},i.handleTimeout_=function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate")},i.segmentRequestFinished_=function(e,t,i){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Gm)return;return this.pause(),e.code===Vm?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}var n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}},i.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},i.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},i.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},i.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,o=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,a=e.videoTimingInfo,l=e.audioTimingInfo;if(void 0!==t)return t;if(!s)return l.start;var u=i.segments[n-1];return 0!==n&&u&&void 0!==u.start&&u.end===r+o?a.start:r},i.waitForAppendsToComplete_=function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed,o="main"===this.loaderType_&&n,s=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);o&&e.waitingOnAppends++,s&&e.waitingOnAppends++,o&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},i.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},i.checkForIllegalMediaSwitch=function(e){var t=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},i.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}},i.getSegmentStartTimeForTimestampOffsetCalculation_=function(e){var t=e.videoTimingInfo,i=e.audioTimingInfo,n=e.timingInfo;return this.useDtsForTimestampOffset_?t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i&&"number"==typeof i.transmuxedDecodeStart?i.transmuxedDecodeStart:n.start:n.start},i.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"==typeof i.end?i.end:i.start+e.duration)},i.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=Tg(e,this.sourceType_);if(t&&("warn"===t.severity?hf.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",!e.isSyncRequest||(this.trigger("syncinfoupdate"),e.hasAppendedData_)){this.logger_("Appended "+yg(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,o=n&&n.end&&this.currentTime_()-n.end>3*e.playlist.partTargetDuration;if(r||o)return this.logger_("bad "+(r?"segment":"part")+" "+yg(e)),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request "+yg(e))},i.recordThroughput_=function(e){if(e.duration<vg)this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record 0.016666666666666666");else{var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}},i.addSegmentMetadataCue_=function(e){if(this.segmentMetadataTrack_){var t=e.segment,i=t.start,n=t.end;if(gg(i)&&gg(n)){mg(i,n,this.segmentMetadataTrack_);var r=bn.WebKitDataCue||bn.VTTCue,o={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:n},s=new r(i,n,JSON.stringify(o));s.value=o,this.segmentMetadataTrack_.addCue(s)}}},t}(hf.EventTarget);function Eg(){}var Sg,kg=function(e){return"string"!=typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))},Pg=["video","audio"],Ag=function(e,t){var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},xg=function e(t,i){if(0!==i.queue.length){var n=0,r=i.queue[n];if("mediaSource"!==r.type){if("mediaSource"!==t&&i.ready()&&"closed"!==i.mediaSource.readyState&&!Ag(t,i)){if(r.type!==t){if(null===(n=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];if("mediaSource"===n.type)return null;if(n.type===e)return i}return null}(t,i.queue)))return;r=i.queue[n]}return i.queue.splice(n,1),i.queuePending[t]=r,r.action(t,i),r.doneFn?void 0:(i.queuePending[t]=null,void e(t,i))}}else i.updating()||"closed"===i.mediaSource.readyState||(i.queue.shift(),r.action(i),r.doneFn&&r.doneFn(),e("audio",i),e("video",i))}},Ig=function(e,t){var i=t[e+"Buffer"],n=kg(e);i&&(i.removeEventListener("updateend",t["on"+n+"UpdateEnd_"]),i.removeEventListener("error",t["on"+n+"Error_"]),t.codecs[e]=null,t[e+"Buffer"]=null)},Mg=function(e,t){return e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t)},Lg=function(e,t,i){return function(n,r){var o=r[n+"Buffer"];if(Mg(r.mediaSource,o)){r.logger_("Appending segment "+t.mediaIndex+"'s "+e.length+" bytes to "+n+"Buffer");try{o.appendBuffer(e)}catch($v){r.logger_("Error with code "+$v.code+" "+(22===$v.code?"(QUOTA_EXCEEDED_ERR) ":"")+"when appending segment "+t.mediaIndex+" to "+n+"Buffer"),r.queuePending[n]=null,i($v)}}}},Dg=function(e,t){return function(i,n){var r=n[i+"Buffer"];if(Mg(n.mediaSource,r)){n.logger_("Removing "+e+" to "+t+" from "+i+"Buffer");try{r.remove(e,t)}catch($v){n.logger_("Remove "+e+" to "+t+" from "+i+"Buffer failed")}}}},Og=function(e){return function(t,i){var n=i[t+"Buffer"];Mg(i.mediaSource,n)&&(i.logger_("Setting "+t+"timestampOffset to "+e),n.timestampOffset=e)}},jg=function(e){return function(t,i){e()}},Rg=function(e){return function(t){if("open"===t.mediaSource.readyState){t.logger_("Calling mediaSource endOfStream("+(e||"")+")");try{t.mediaSource.endOfStream(e)}catch($v){hf.log.warn("Failed to call media source endOfStream",$v)}}}},Ng=function(e){return function(t){t.logger_("Setting mediaSource duration to "+e);try{t.mediaSource.duration=e}catch($v){hf.log.warn("Failed to set media source duration",$v)}}},Ug=function(){return function(e,t){if("open"===t.mediaSource.readyState){var i=t[e+"Buffer"];if(Mg(t.mediaSource,i)){t.logger_("calling abort on "+e+"Buffer");try{i.abort()}catch($v){hf.log.warn("Failed to abort on "+e+"Buffer",$v)}}}}},Bg=function(e,t){return function(i){var n=kg(e),r=ro(t);i.logger_("Adding "+e+"Buffer with codec "+t+" to mediaSource");var o=i.mediaSource.addSourceBuffer(r);o.addEventListener("updateend",i["on"+n+"UpdateEnd_"]),o.addEventListener("error",i["on"+n+"Error_"]),i.codecs[e]=t,i[e+"Buffer"]=o}},Fg=function(e){return function(t){var i=t[e+"Buffer"];if(Ig(e,t),Mg(t.mediaSource,i)){t.logger_("Removing "+e+"Buffer with codec "+t.codecs[e]+" from mediaSource");try{t.mediaSource.removeSourceBuffer(i)}catch($v){hf.log.warn("Failed to removeSourceBuffer "+e+"Buffer",$v)}}}},Wg=function(e){return function(t,i){var n=i[t+"Buffer"],r=ro(e);Mg(i.mediaSource,n)&&i.codecs[t]!==e&&(i.logger_("changing "+t+"Buffer codec from "+i.codecs[t]+" to "+e),n.changeType(r),i.codecs[t]=e)}},Hg=function(e){var t=e.type,i=e.sourceUpdater,n=e.action,r=e.doneFn,o=e.name;i.queue.push({type:t,action:n,doneFn:r,name:o}),xg(t,i)},Vg=function(e,t){return function(i){if(t.queuePending[e]){var n=t.queuePending[e].doneFn;t.queuePending[e]=null,n&&n(t[e+"Error_"])}xg(e,t)}},Gg=function(e){function t(t){var i;return(i=e.call(this)||this).mediaSource=t,i.sourceopenListener_=function(){return xg("mediaSource",An(i))},i.mediaSource.addEventListener("sourceopen",i.sourceopenListener_),i.logger_=gf("SourceUpdater"),i.audioTimestampOffset_=0,i.videoTimestampOffset_=0,i.queue=[],i.queuePending={audio:null,video:null},i.delayedAudioAppendQueue_=[],i.videoAppendQueued_=!1,i.codecs={},i.onVideoUpdateEnd_=Vg("video",An(i)),i.onAudioUpdateEnd_=Vg("audio",An(i)),i.onVideoError_=function(e){i.videoError_=e},i.onAudioError_=function(e){i.audioError_=e},i.createdSourceBuffers_=!1,i.initializedEme_=!1,i.triggeredReady_=!1,i}In(t,e);var i=t.prototype;return i.initializedEme=function(){this.initializedEme_=!0,this.triggerReady()},i.hasCreatedSourceBuffers=function(){return this.createdSourceBuffers_},i.hasInitializedAnyEme=function(){return this.initializedEme_},i.ready=function(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()},i.createSourceBuffers=function(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())},i.triggerReady=function(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))},i.addSourceBuffer=function(e,t){Hg({type:"mediaSource",sourceUpdater:this,action:Bg(e,t),name:"addSourceBuffer"})},i.abort=function(e){Hg({type:e,sourceUpdater:this,action:Ug(e),name:"abort"})},i.removeSourceBuffer=function(e){this.canRemoveSourceBuffer()?Hg({type:"mediaSource",sourceUpdater:this,action:Fg(e),name:"removeSourceBuffer"}):hf.log.error("removeSourceBuffer is not supported!")},i.canRemoveSourceBuffer=function(){return!hf.browser.IE_VERSION&&!hf.browser.IS_FIREFOX&&bn.MediaSource&&bn.MediaSource.prototype&&"function"==typeof bn.MediaSource.prototype.removeSourceBuffer},t.canChangeType=function(){return bn.SourceBuffer&&bn.SourceBuffer.prototype&&"function"==typeof bn.SourceBuffer.prototype.changeType},i.canChangeType=function(){return this.constructor.canChangeType()},i.changeType=function(e,t){this.canChangeType()?Hg({type:e,sourceUpdater:this,action:Wg(t),name:"changeType"}):hf.log.error("changeType is not supported!")},i.addOrChangeSourceBuffers=function(e){var t=this;if(!e||"object"!=typeof e||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach((function(i){var n=e[i];if(!t.hasCreatedSourceBuffers())return t.addSourceBuffer(i,n);t.canChangeType()&&t.changeType(i,n)}))},i.appendBuffer=function(e,t){var i=this,n=e.segmentInfo,r=e.type,o=e.bytes;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_("delayed audio append of "+o.length+" until video append");if(Hg({type:r,sourceUpdater:this,action:Lg(o,n||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;var s=this.delayedAudioAppendQueue_.slice();this.logger_("queuing delayed audio "+s.length+" appendBuffers"),this.delayedAudioAppendQueue_.length=0,s.forEach((function(e){i.appendBuffer.apply(i,e)}))}},i.audioBuffered=function(){return Mg(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:hf.createTimeRange()},i.videoBuffered=function(){return Mg(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:hf.createTimeRange()},i.buffered=function(){var e=Mg(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Mg(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){var i=null,n=null,r=0,o=[],s=[];if(!(e&&e.length&&t&&t.length))return hf.createTimeRange();for(var a=e.length;a--;)o.push({time:e.start(a),type:"start"}),o.push({time:e.end(a),type:"end"});for(a=t.length;a--;)o.push({time:t.start(a),type:"start"}),o.push({time:t.end(a),type:"end"});for(o.sort((function(e,t){return e.time-t.time})),a=0;a<o.length;a++)"start"===o[a].type?2==++r&&(i=o[a].time):"end"===o[a].type&&1==--r&&(n=o[a].time),null!==i&&null!==n&&(s.push([i,n]),i=null,n=null);return hf.createTimeRanges(s)}(this.audioBuffered(),this.videoBuffered())},i.setDuration=function(e,t){void 0===t&&(t=Eg),Hg({type:"mediaSource",sourceUpdater:this,action:Ng(e),name:"duration",doneFn:t})},i.endOfStream=function(e,t){void 0===e&&(e=null),void 0===t&&(t=Eg),"string"!=typeof e&&(e=void 0),Hg({type:"mediaSource",sourceUpdater:this,action:Rg(e),name:"endOfStream",doneFn:t})},i.removeAudio=function(e,t,i){void 0===i&&(i=Eg),this.audioBuffered().length&&0!==this.audioBuffered().end(0)?Hg({type:"audio",sourceUpdater:this,action:Dg(e,t),doneFn:i,name:"remove"}):i()},i.removeVideo=function(e,t,i){void 0===i&&(i=Eg),this.videoBuffered().length&&0!==this.videoBuffered().end(0)?Hg({type:"video",sourceUpdater:this,action:Dg(e,t),doneFn:i,name:"remove"}):i()},i.updating=function(){return!(!Ag("audio",this)&&!Ag("video",this))},i.audioTimestampOffset=function(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Hg({type:"audio",sourceUpdater:this,action:Og(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_},i.videoTimestampOffset=function(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(Hg({type:"video",sourceUpdater:this,action:Og(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_},i.audioQueueCallback=function(e){this.audioBuffer&&Hg({type:"audio",sourceUpdater:this,action:jg(e),name:"callback"})},i.videoQueueCallback=function(e){this.videoBuffer&&Hg({type:"video",sourceUpdater:this,action:jg(e),name:"callback"})},i.dispose=function(){var e=this;this.trigger("dispose"),Pg.forEach((function(t){e.abort(t),e.canRemoveSourceBuffer()?e.removeSourceBuffer(t):e[t+"QueueCallback"]((function(){return Ig(t,e)}))})),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()},t}(hf.EventTarget),zg=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},Yg=new Uint8Array("\n\n".split("").map((function(e){return e.charCodeAt(0)}))),qg=function(e){function t(t,i){var n;return void 0===i&&(i={}),(n=e.call(this,t,i)||this).mediaSource_=null,n.subtitlesTrack_=null,n.loaderType_="subtitle",n.featuresNativeTextTracks_=t.featuresNativeTextTracks,n.shouldSaveSegmentTimingInfo_=!1,n}In(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return null},i.buffered_=function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return hf.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return hf.createTimeRanges([[t,i]])},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=fm(e),n=this.initSegments_[i];if(t&&!n&&e.bytes){var r=Yg.byteLength+e.bytes.byteLength,o=new Uint8Array(r);o.set(e.bytes),o.set(Yg,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:o}}return n||e},i.couldBeginLoading_=function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.track=function(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_},i.remove=function(e,t){mg(e,t,this.subtitlesTrack_)},i.fillBuffer_=function(){var e=this,t=this.chooseNextRequest_();if(t){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){return this.syncController_.one("timestampoffset",(function(){e.state="READY",e.paused()||e.monitorBuffer_()})),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}},i.timestampOffsetForSegment_=function(){return null},i.chooseNextRequest_=function(){return this.skipEmptySegments_(e.prototype.chooseNextRequest_.call(this))},i.skipEmptySegments_=function(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Vm&&this.handleTimeout_(),e.code===Gm?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");var o=r.segment;if(o.map&&(o.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof bn.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var s,a=function(){n.subtitlesTrack_.tech_.off("vttjsloaded",s),n.stopForError({message:"Error loading vtt.js"})};return s=function(){n.subtitlesTrack_.tech_.off("vttjserror",a),n.segmentRequestFinished_(e,t,i)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",s),void this.subtitlesTrack_.tech_.one("vttjserror",a)}o.requested=!0;try{this.parseVTTCues_(r)}catch($v){return void this.stopForError({message:$v.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=o.duration,r.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new bn.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t)for(var i=0;i<t.length;i++){for(var n=[],r=0,o=0;o<t.length;o++)t[i].startTime===t[o].startTime&&t[i].endTime===t[o].endTime&&t[i].text===t[o].text&&++r>1&&n.push(t[o]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t,i=!1;"function"==typeof bn.TextDecoder?t=new bn.TextDecoder("utf8"):(t=bn.WebVTT.StringDecoder(),i=!0);var n=new bn.WebVTT.Parser(bn,bn.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){e.timestampmap=t},n.onparsingerror=function(e){hf.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=zg(r)),n.parse(r)}var o=e.bytes;i&&(o=zg(o)),n.parse(o),n.flush()},i.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,o=r.MPEGTS/Zl-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=o,e.endTime+=o})),!i.syncInfo){var s=e.cues[0].startTime,a=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,a-n.duration)}}}else n.empty=!0},t}(wg),Xg=function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},Zg=[{name:"VOD",run:function(e,t,i,n,r){if(i!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var o=null,s=null,a=Af(t);r=r||0;for(var l=0;l<a.length;l++){var u=a[t.endList||0===r?l:a.length-(l+1)],c=u.segment,h=e.timelineToDatetimeMappings[c.timeline];if(h&&c.dateTimeObject){var d=c.dateTimeObject.getTime()/1e3+h;if(c.parts&&"number"==typeof u.partIndex)for(var p=0;p<u.partIndex;p++)d+=c.parts[p].duration;var f=Math.abs(r-d);if(null!==s&&(0===f||s<f))break;s=f,o={time:d,segmentIndex:u.segmentIndex,partIndex:u.partIndex}}}return o}},{name:"Segment",run:function(e,t,i,n,r){var o=null,s=null;r=r||0;for(var a=Af(t),l=0;l<a.length;l++){var u=a[t.endList||0===r?l:a.length-(l+1)],c=u.segment,h=u.part&&u.part.start||c&&c.start;if(c.timeline===n&&void 0!==h){var d=Math.abs(r-h);if(null!==s&&s<d)break;(!o||null===s||s>=d)&&(s=d,o={time:h,segmentIndex:u.segmentIndex,partIndex:u.partIndex})}}return o}},{name:"Discontinuity",run:function(e,t,i,n,r){var o=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,a=0;a<t.discontinuityStarts.length;a++){var l=t.discontinuityStarts[a],u=t.discontinuitySequence+a+1,c=e.discontinuities[u];if(c){var h=Math.abs(r-c.time);if(null!==s&&s<h)break;(!o||null===s||s>=h)&&(s=h,o={time:c.time,segmentIndex:l,partIndex:null})}}return o}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],Qg=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=gf("SyncController"),i}In(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+Of({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,t,i,n){for(var r=[],o=0;o<Zg.length;o++){var s=Zg[o],a=s.run(this,e,t,i,n);a&&(a.strategy=s.name,r.push({strategy:s.name,syncPoint:a}))}return r},i.selectSyncPoint_=function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,o=1;o<e.length;o++){var s=Math.abs(e[o].syncPoint[t.key]-t.value);s<n&&(n=s,i=e[o].syncPoint,r=e[o].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+("number"==typeof i.partIndex?",partIndex:"+i.partIndex:"")+"]"),i},i.saveExpiredSegmentInfo=function(e,t){var i=t.mediaSequence-e.mediaSequence;if(i>86400)hf.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.");else for(var n=i-1;n>=0;n--){var r=e.segments[n];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var o=r.dateTimeObject;r.discontinuity&&i&&o&&(this.timelineToDatetimeMappings[r.timeline]=-o.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,o=e.segment,s=e.part,a=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+a.time+"] [mapping: "+a.mapping+"]")),n=e.startOfSegment,r=t.end+a.mapping;else{if(!a)return!1;n=t.start+a.mapping,r=t.end+a.mapping}return s&&(s.start=n,s.end=r),(!o.start||n<o.start)&&(o.start=n),o.end=r,!0},i.saveDiscontinuitySyncInfo_=function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r=t.discontinuityStarts[n],o=t.discontinuitySequence+n+1,s=r-e.mediaIndex,a=Math.abs(s);if(!this.discontinuities[o]||this.discontinuities[o].accuracy>a){var l=void 0;l=s<0?i.start-Of({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+Of({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[o]={time:l,accuracy:a}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(hf.EventTarget),Kg=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}In(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"==typeof i&&"number"==typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(hf.EventTarget),Jg=Im(Mm(Lm((function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var i=t((function(e){function t(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e},e.exports.default=e.exports,e.exports.__esModule=!0})),n=t((function(e){function t(i,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(i,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})),r=t((function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0})),o=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),o=t.length,s=0;s<o;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",(function(t){e.push(t)}))},e}();
- /*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
- var s,a=null,l=function(){function e(e){var t,i,n;a||(a=function(){var e,t,i,n,r,o,s,a,l=[[[],[],[],[],[]],[[],[],[],[],[]]],u=l[0],c=l[1],h=u[4],d=c[4],p=[],f=[];for(e=0;e<256;e++)f[(p[e]=e<<1^283*(e>>7))^e]=e;for(t=i=0;!h[t];t^=n||1,i=f[i]||1)for(o=(o=i^i<<1^i<<2^i<<3^i<<4)>>8^255&o^99,h[t]=o,d[o]=t,a=16843009*p[r=p[n=p[t]]]^65537*r^257*n^16843008*t,s=257*p[o]^16843008*o,e=0;e<4;e++)u[e][t]=s=s<<24^s>>>8,c[e][o]=a=a<<24^a>>>8;for(e=0;e<5;e++)u[e]=u[e].slice(0),c[e]=c[e].slice(0);return l}()),this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]];var r=this._tables[0][4],o=this._tables[1],s=e.length,l=1;if(4!==s&&6!==s&&8!==s)throw new Error("Invalid aes key size");var u=e.slice(0),c=[];for(this._key=[u,c],t=s;t<4*s+28;t++)n=u[t-1],(t%s==0||8===s&&t%s==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%s==0&&(n=n<<8^n>>>24^l<<24,l=l<<1^283*(l>>7))),u[t]=u[t-s]^n;for(i=0;t;i++,t--)n=u[3&i?t:t-4],c[i]=t<=4||i<4?n:o[0][r[n>>>24]]^o[1][r[n>>16&255]]^o[2][r[n>>8&255]]^o[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,o){var s,a,l,u,c=this._key[1],h=e^c[0],d=n^c[1],p=i^c[2],f=t^c[3],m=c.length/4-2,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],C=v[3],T=v[4];for(u=0;u<m;u++)s=y[h>>>24]^_[d>>16&255]^b[p>>8&255]^C[255&f]^c[g],a=y[d>>>24]^_[p>>16&255]^b[f>>8&255]^C[255&h]^c[g+1],l=y[p>>>24]^_[f>>16&255]^b[h>>8&255]^C[255&d]^c[g+2],f=y[f>>>24]^_[h>>16&255]^b[d>>8&255]^C[255&p]^c[g+3],g+=4,h=s,d=a,p=l;for(u=0;u<4;u++)r[(3&-u)+o]=T[h>>>24]<<24^T[d>>16&255]<<16^T[p>>8&255]<<8^T[255&f]^c[g++],s=h,h=d,d=p,p=f,f=s},e}(),u=function(e){function t(){var t;return(t=e.call(this,o)||this).jobs=[],t.delay=1,t.timeout_=null,t}r(t,e);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(o),c=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},h=function(){function e(t,i,n,r){var o=e.STEP,s=new Int32Array(t.buffer),a=new Uint8Array(t.byteLength),l=0;for(this.asyncStream_=new u,this.asyncStream_.push(this.decryptChunk_(s.subarray(l,l+o),i,n,a)),l=o;l<s.length;l+=o)n=new Uint32Array([c(s[l-4]),c(s[l-3]),c(s[l-2]),c(s[l-1])]),this.asyncStream_.push(this.decryptChunk_(s.subarray(l,l+o),i,n,a));this.asyncStream_.push((function(){
- /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
- var e;r(null,(e=a).subarray(0,e.byteLength-e[e.byteLength-1]))}))}return e.prototype.decryptChunk_=function(e,t,i,n){return function(){var r=function(e,t,i){var n,r,o,s,a,u,h,d,p,f=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),m=new l(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),v=new Int32Array(g.buffer);for(n=i[0],r=i[1],o=i[2],s=i[3],p=0;p<f.length;p+=4)a=c(f[p]),u=c(f[p+1]),h=c(f[p+2]),d=c(f[p+3]),m.decrypt(a,u,h,d,v,p),v[p]=c(v[p]^n),v[p+1]=c(v[p+1]^r),v[p+2]=c(v[p+2]^o),v[p+3]=c(v[p+3]^s),n=a,r=u,o=h,s=d;return g}(e,t,i);n.set(r,e.byteOffset)}},i(e,null,[{key:"STEP",get:function(){return 32e3}}]),e}();s="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};var d=s.BigInt||Number;d("0x1"),d("0x100"),d("0x10000"),d("0x1000000"),d("0x100000000"),d("0x10000000000"),d("0x1000000000000"),d("0x100000000000000"),d("0x10000000000000000");var p=function(e){var t={};return Object.keys(e).forEach((function(i){var n,r=e[i];n=r,("function"===ArrayBuffer.isView?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer)?t[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[i]=r})),t};self.onmessage=function(e){var t=e.data,i=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),n=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new h(i,n,r,(function(e,i){self.postMessage(p({source:t.source,decrypted:i}),[i.buffer])}))}})))),$g=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},ev=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},tv=function(e,t){t.activePlaylistLoader=e,e.load()},iv={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;ev(i,n);var o=n.activeTrack(),s=n.activeGroup(),a=(s.filter((function(e){return e.default}))[0]||s[0]).id,l=n.tracks[a];if(o!==l){for(var u in hf.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[u].enabled=n.tracks[u]===l;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];hf.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),ev(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},nv={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,o=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();o.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&o.load()})),t.on("loadedplaylist",(function(){o.playlist(t.media(),r),n.paused()||o.load()})),t.on("error",iv[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,o=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();o.playlist(e,r),o.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&o.load()})),t.on("loadedplaylist",(function(){o.playlist(t.media(),r),n.paused()||o.load()})),t.on("error",iv[e](e,i))}},rv={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],o=t.requestOptions,s=t.master.mediaGroups,a=t.mediaTypes[e],l=a.groups,u=a.tracks,c=a.logger_,h=t.masterPlaylistLoader,d=Vf(h.master);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},d&&(s[e].main.default.playlists=h.master.playlists)),s[e])for(var f in l[p]||(l[p]=[]),s[e][p]){var m=s[e][p][f],g=void 0;if(d?(c("AUDIO group '"+p+"' label '"+f+"' is a master playlist"),m.isMasterPlaylist=!0,g=null):g="vhs-json"===n&&m.playlists?new rm(m.playlists[0],i,o):m.resolvedUri?new rm(m.resolvedUri,i,o):m.playlists&&"dash"===n?new Pm(m.playlists[0],i,o,h):null,m=hf.mergeOptions({id:f,playlistLoader:g},m),nv[e](e,m.playlistLoader,t),l[p].push(m),void 0===u[f]){var v=new hf.AudioTrack({id:f,kind:$g(m),enabled:!1,language:m.language,default:m.default,label:f});u[f]=v}}r.on("error",iv[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,o=t.segmentLoaders[e],s=t.requestOptions,a=t.master.mediaGroups,l=t.mediaTypes[e],u=l.groups,c=l.tracks,h=t.masterPlaylistLoader;for(var d in a[e])for(var p in u[d]||(u[d]=[]),a[e][d])if(!a[e][d][p].forced){var f=a[e][d][p],m=void 0;if("hls"===r)m=new rm(f.resolvedUri,n,s);else if("dash"===r){if(!f.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;m=new Pm(f.playlists[0],n,s,h)}else"vhs-json"===r&&(m=new rm(f.playlists?f.playlists[0]:f.resolvedUri,n,s));if(f=hf.mergeOptions({id:p,playlistLoader:m},f),nv[e](e,f.playlistLoader,t),u[d].push(f),void 0===c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}o.on("error",iv[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],o=r.groups,s=r.tracks;for(var a in n[e])for(var l in o[a]||(o[a]=[]),n[e][a]){var u=n[e][a][l];if(/^(?:CC|SERVICE)/.test(u.instreamId)){var c=i.options_.vhs&&i.options_.vhs.captionServices||{},h={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(c[h.instreamId]&&(h=hf.mergeOptions(h,c[h.instreamId])),void 0===h.default&&delete h.default,o[a].push(hf.mergeOptions({id:l},u)),void 0===s[l]){var d=i.addRemoteTextTrack({id:h.instreamId,kind:"captions",default:h.default,language:h.language,label:h.label},!1).track;s[l]=d}}}}},ov=function e(t,i){for(var n=0;n<t.length;n++){if(Wf(i,t[n]))return!0;if(t[n].playlists&&e(t[n].playlists,i))return!0}return!1},sv={AUDIO:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if(i[n].enabled)return i[n];return null}},SUBTITLES:function(e,t){return function(){var i=t.mediaTypes[e].tracks;for(var n in i)if("showing"===i[n].mode||"hidden"===i[n].mode)return i[n];return null}}},av=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(t){rv[t](t,e)}));var t=e.mediaTypes,i=e.masterPlaylistLoader,n=e.tech,r=e.vhs,o=e.segmentLoaders,s=o.AUDIO,a=o.main;["AUDIO","SUBTITLES"].forEach((function(i){t[i].activeGroup=function(e,t){return function(i){var n=t.masterPlaylistLoader,r=t.mediaTypes[e].groups,o=n.media();if(!o)return null;var s=null;o.attributes[e]&&(s=r[o.attributes[e]]);var a=Object.keys(r);if(!s)if("AUDIO"===e&&a.length>1&&Vf(t.master))for(var l=0;l<a.length;l++){var u=r[a[l]];if(ov(u,o)){s=u;break}}else r.main?s=r.main:1===a.length&&(s=r[a[0]]);return void 0===i?s:null!==i&&s&&s.filter((function(e){return e.id===i.id}))[0]||null}}(i,e),t[i].activeTrack=sv[i](i,e),t[i].onGroupChanged=function(e,t){return function(){var i=t.segmentLoaders,n=i[e],r=i.main,o=t.mediaTypes[e],s=o.activeTrack(),a=o.getActiveGroup(),l=o.activePlaylistLoader,u=o.lastGroup_;a&&u&&a.id===u.id||(o.lastGroup_=a,o.lastTrack_=s,ev(n,o),a&&!a.isMasterPlaylist&&(a.playlistLoader?(n.resyncLoader(),tv(a.playlistLoader,o)):l&&r.resetEverything()))}}(i,e),t[i].onGroupChanging=function(e,t){return function(){var i=t.segmentLoaders[e];t.mediaTypes[e].lastGroup_=null,i.abort(),i.pause()}}(i,e),t[i].onTrackChanged=function(e,t){return function(){var i=t.masterPlaylistLoader,n=t.segmentLoaders,r=n[e],o=n.main,s=t.mediaTypes[e],a=s.activeTrack(),l=s.getActiveGroup(),u=s.activePlaylistLoader,c=s.lastTrack_;if((!c||!a||c.id!==a.id)&&(s.lastGroup_=l,s.lastTrack_=a,ev(r,s),l)){if(l.isMasterPlaylist){if(!a||!c||a.id===c.id)return;var h=t.vhs.masterPlaylistController_,d=h.selectPlaylist();if(h.media()===d)return;return s.logger_("track change. Switching master audio from "+c.id+" to "+a.id),i.pause(),o.resetEverything(),void h.fastQualityChange_(d)}if("AUDIO"===e){if(!l.playlistLoader)return o.setAudio(!0),void o.resetEverything();r.setAudio(!0),o.setAudio(!1)}u!==l.playlistLoader?(r.track&&r.track(a),r.resetEverything(),tv(l.playlistLoader,s)):tv(l.playlistLoader,s)}}}(i,e),t[i].getActiveGroup=function(e,t){var i=t.mediaTypes;return function(){var t=i[e].activeTrack();return t?i[e].activeGroup(t):null}}(i,e)}));var l=t.AUDIO.activeGroup();if(l){var u=(l.filter((function(e){return e.default}))[0]||l[0]).id;t.AUDIO.tracks[u].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s.setAudio(!0)):a.setAudio(!0)}i.on("mediachange",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanged()}))})),i.on("mediachanging",(function(){["AUDIO","SUBTITLES"].forEach((function(e){return t[e].onGroupChanging()}))}));var c=function(){t.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"}),n.trigger({type:"usage",name:"hls-audio-change"})};for(var h in n.audioTracks().addEventListener("change",c),n.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",(function(){n.audioTracks().removeEventListener("change",c),n.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)})),n.clearTracks("audio"),t.AUDIO.tracks)n.audioTracks().addTrack(t.AUDIO.tracks[h])},lv=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],uv=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},cv=function(e){function t(t){var i;i=e.call(this)||this;var n=t.src,r=t.handleManifestRedirects,o=t.withCredentials,s=t.tech,a=t.bandwidth,l=t.externVhs,u=t.useCueTags,c=t.blacklistDuration,h=t.enableLowInitialPlaylist,d=t.sourceType,p=t.cacheEncryptionKeys,f=t.experimentalBufferBasedABR,m=t.experimentalLeastPixelDiffSelector,g=t.captionServices;if(!n)throw new Error("A non-empty playlist URL or JSON manifest string is required");var v,y=t.maxPlaylistRetries;null==y&&(y=1/0),Sg=l,i.experimentalBufferBasedABR=Boolean(f),i.experimentalLeastPixelDiffSelector=Boolean(m),i.withCredentials=o,i.tech_=s,i.vhs_=s.vhs,i.sourceType_=d,i.useCueTags_=u,i.blacklistDuration=c,i.maxPlaylistRetries=y,i.enableLowInitialPlaylist=h,i.useCueTags_&&(i.cueTagsTrack_=i.tech_.addTextTrack("metadata","ad-cues"),i.cueTagsTrack_.inBandMetadataTrackDispatchType=""),i.requestOptions_={withCredentials:o,handleManifestRedirects:r,maxPlaylistRetries:y,timeout:null},i.on("error",i.pauseLoading),i.mediaTypes_=(v={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach((function(e){v[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Eg,activeTrack:Eg,getActiveGroup:Eg,onGroupChanged:Eg,onTrackChanged:Eg,lastTrack_:null,logger_:gf("MediaGroups["+e+"]")}})),v),i.mediaSource=new bn.MediaSource,i.handleDurationChange_=i.handleDurationChange_.bind(An(i)),i.handleSourceOpen_=i.handleSourceOpen_.bind(An(i)),i.handleSourceEnded_=i.handleSourceEnded_.bind(An(i)),i.mediaSource.addEventListener("durationchange",i.handleDurationChange_),i.mediaSource.addEventListener("sourceopen",i.handleSourceOpen_),i.mediaSource.addEventListener("sourceended",i.handleSourceEnded_),i.seekable_=hf.createTimeRanges(),i.hasPlayed_=!1,i.syncController_=new Qg(t),i.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,i.decrypter_=new Jg,i.sourceUpdater_=new Gg(i.mediaSource),i.inbandTextTracks_={},i.timelineChangeController_=new Kg;var _={vhs:i.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:g,mediaSource:i.mediaSource,currentTime:i.tech_.currentTime.bind(i.tech_),seekable:function(){return i.seekable()},seeking:function(){return i.tech_.seeking()},duration:function(){return i.duration()},hasPlayed:function(){return i.hasPlayed_},goalBufferLength:function(){return i.goalBufferLength()},bandwidth:a,syncController:i.syncController_,decrypter:i.decrypter_,sourceType:i.sourceType_,inbandTextTracks:i.inbandTextTracks_,cacheEncryptionKeys:p,sourceUpdater:i.sourceUpdater_,timelineChangeController:i.timelineChangeController_,experimentalExactManifestTimings:t.experimentalExactManifestTimings};i.masterPlaylistLoader_="dash"===i.sourceType_?new Pm(n,i.vhs_,i.requestOptions_):new rm(n,i.vhs_,i.requestOptions_),i.setupMasterPlaylistLoaderListeners_(),i.mainSegmentLoader_=new wg(hf.mergeOptions(_,{segmentMetadataTrack:i.segmentMetadataTrack_,loaderType:"main"}),t),i.audioSegmentLoader_=new wg(hf.mergeOptions(_,{loaderType:"audio"}),t),i.subtitleSegmentLoader_=new qg(hf.mergeOptions(_,{loaderType:"vtt",featuresNativeTextTracks:i.tech_.featuresNativeTextTracks}),t),i.setupSegmentLoaderListeners_(),i.experimentalBufferBasedABR&&(i.masterPlaylistLoader_.one("loadedplaylist",(function(){return i.startABRTimer_()})),i.tech_.on("pause",(function(){return i.stopABRTimer_()})),i.tech_.on("play",(function(){return i.startABRTimer_()}))),lv.forEach((function(e){i[e+"_"]=uv.bind(An(i),e)})),i.logger_=gf("MPC"),i.triggeredFmp4Usage=!1,"none"===i.tech_.preload()?(i.loadOnPlay_=function(){i.loadOnPlay_=null,i.masterPlaylistLoader_.load()},i.tech_.one("play",i.loadOnPlay_)):i.masterPlaylistLoader_.load(),i.timeToLoadedData__=-1,i.mainAppendsToLoadedData__=-1,i.audioAppendsToLoadedData__=-1;var b="none"===i.tech_.preload()?"play":"loadstart";return i.tech_.one(b,(function(){var e=Date.now();i.tech_.one("loadeddata",(function(){i.timeToLoadedData__=Date.now()-e,i.mainAppendsToLoadedData__=i.mainSegmentLoader_.mediaAppends,i.audioAppendsToLoadedData__=i.audioSegmentLoader_.mediaAppends}))})),i}In(t,e);var i=t.prototype;return i.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__},i.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__},i.appendsToLoadedData_=function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t},i.timeToLoadedData_=function(){return this.timeToLoadedData__},i.checkABR_=function(){var e=this.selectPlaylist();e&&this.shouldSwitchToMedia_(e)&&this.switchMedia_(e,"abr")},i.switchMedia_=function(e,t,i){var n=this.media(),r=n&&(n.id||n.uri),o=e.id||e.uri;r&&r!==o&&(this.logger_("switch media "+r+" -> "+o+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=bn.setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(bn.clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var o=n.main||r.length&&n[r[0]];for(var s in o)if(o[s].default){i={label:s};break}}if(!i)return t;var a=[];for(var l in n)if(n[l][i.label]){var u=n[l][i.label];if(u.playlists&&u.playlists.length)a.push.apply(a,u.playlists);else if(u.uri)a.push(u);else if(e.playlists.length)for(var c=0;c<e.playlists.length;c++){var h=e.playlists[c];h.attributes&&h.attributes.AUDIO&&h.attributes.AUDIO===l&&a.push(h)}}return a.length?a:t},i.setupMasterPlaylistLoaderListeners_=function(){var e=this;this.masterPlaylistLoader_.on("loadedmetadata",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Ff(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),av({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,masterPlaylistLoader:e.masterPlaylistLoader_,vhs:e.vhs_,master:e.master(),mediaTypes:e.mediaTypes_,blacklistCurrentPlaylist:e.blacklistCurrentPlaylist.bind(e)}),e.triggerPresenceUsage_(e.master(),t),e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",(function(){e.trigger("selectedinitialmedia")}))})),this.masterPlaylistLoader_.on("loadedplaylist",(function(){e.loadOnPlay_&&e.tech_.off("play",e.loadOnPlay_);var t=e.masterPlaylistLoader_.media();if(!t){var i;if(e.excludeUnsupportedVariants_(),e.enableLowInitialPlaylist&&(i=e.selectInitialPlaylist()),i||(i=e.selectPlaylist()),!i||!e.shouldSwitchToMedia_(i))return;if(e.initialMedia_=i,e.switchMedia_(e.initialMedia_,"initial"),!("vhs-json"===e.sourceType_&&e.initialMedia_.segments))return;t=e.initialMedia_}e.handleUpdatedMediaPlaylist(t)})),this.masterPlaylistLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)})),this.masterPlaylistLoader_.on("mediachanging",(function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()})),this.masterPlaylistLoader_.on("mediachange",(function(){var t=e.masterPlaylistLoader_.media(),i=1.5*t.targetDuration*1e3;Ff(e.masterPlaylistLoader_.master,e.masterPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=i,e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})})),this.masterPlaylistLoader_.on("playlistunchanged",(function(){var t=e.masterPlaylistLoader_.media();"playlist-unchanged"!==t.lastExcludeReason_&&(e.stuckAtPlaylistEnd_(t)&&(e.blacklistCurrentPlaylist({message:"Playlist no longer updating.",reason:"playlist-unchanged"}),e.tech_.trigger("playliststuck")))})),this.masterPlaylistLoader_.on("renditiondisabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"}),e.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})})),this.masterPlaylistLoader_.on("renditionenabled",(function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"}),e.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})}))},i.handleUpdatedMediaPlaylist=function(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())},i.triggerPresenceUsage_=function(e,t){var i=e.mediaGroups||{},n=!0,r=Object.keys(i.AUDIO);for(var o in i.AUDIO)for(var s in i.AUDIO[o]){i.AUDIO[o][s].uri||(n=!1)}n&&(this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),this.tech_.trigger({type:"usage",name:"hls-demuxed"})),Object.keys(i.SUBTITLES).length&&(this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),this.tech_.trigger({type:"usage",name:"hls-webvtt"})),Sg.Playlist.isAes(t)&&(this.tech_.trigger({type:"usage",name:"vhs-aes"}),this.tech_.trigger({type:"usage",name:"hls-aes"})),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,i=e.buffered,n=e.currentTime,r=e.nextPlaylist,o=e.bufferLowWaterLine,s=e.bufferHighWaterLine,a=e.duration,l=e.experimentalBufferBasedABR,u=e.log;if(!r)return hf.log.warn("We received no playlist to switch to. Please check your stream."),!1;var c="allowing switch "+(t&&t.id||"null")+" -> "+r.id;if(!t)return u(c+" as current playlist is not set"),!0;if(r.id===t.id)return!1;var h=Boolean(bf(i,n).length);if(!t.endList)return h||"number"!=typeof t.partTargetDuration?(u(c+" as current playlist is live"),!0):(u("not "+c+" as current playlist is live llhls, but currentTime isn't in buffered."),!1);var d=Sf(i,n),p=l?Am.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Am.MAX_BUFFER_LOW_WATER_LINE;if(a<p)return u(c+" as duration < max low water line ("+a+" < "+p+")"),!0;var f=r.attributes.BANDWIDTH,m=t.attributes.BANDWIDTH;if(f<m&&(!l||d<s)){var g=c+" as next bandwidth < current bandwidth ("+f+" < "+m+")";return l&&(g+=" and forwardBuffer < bufferHighWaterLine ("+d+" < "+s+")"),u(g),!0}if((!l||f>m)&&d>=o){var v=c+" as forwardBuffer >= bufferLowWaterLine ("+d+" >= "+o+")";return l&&(v+=" and next bandwidth > current bandwidth ("+f+" > "+m+")"),u(v),!0}return u("not "+c+" as no switching criteria met"),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist();e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))}));var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){hf.browser.IE_VERSION||hf.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}},i.setupFirstPlay=function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if(hf.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",(function(){e.trigger("firstplay"),e.tech_.setCurrentTime(i.end(0)),e.hasPlayed_=!0})),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(i.end(0))}return this.hasPlayed_=!0,this.load(),!0},i.handleSourceOpen_=function(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,(function(e){}))}this.trigger("sourceopen")},i.handleSourceEnded_=function(){if(this.inbandTextTracks_.metadataTrack_){var e=this.inbandTextTracks_.metadataTrack_.cues;if(e&&e.length){var t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}}},i.handleDurationChange_=function(){this.tech_.trigger("durationchange")},i.onEndOfStream=function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){var t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())},i.stuckAtPlaylistEnd_=function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;var i=Sg.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return i-n<=yf;var o=r.end(r.length-1);return o-n<=yf&&i-o<=yf},i.blacklistCurrentPlaylist=function(e,t){void 0===e&&(e={});var i=e.playlist||this.masterPlaylistLoader_.media();if(t=t||e.blacklistDuration||this.blacklistDuration,!i)return this.error=e,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));i.playlistErrors_++;var n,r=this.masterPlaylistLoader_.master.playlists,o=r.filter(Uf),s=1===o.length&&o[0]===i;if(1===r.length&&t!==1/0)return hf.log.warn("Problem encountered with playlist "+i.id+". Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(s);if(s){var a=!1;r.forEach((function(e){if(e!==i){var t=e.excludeUntil;void 0!==t&&t!==1/0&&(a=!0,delete e.excludeUntil)}})),a&&(hf.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}n=i.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=n,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var l=this.selectPlaylist();if(!l)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var u=e.internal?this.logger_:hf.log.warn,c=e.message?" "+e.message:"";u((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+c+" Switching to playlist "+l.id+"."),l.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var h=l.targetDuration/2*1e3||5e3,d="number"==typeof l.lastRequest&&Date.now()-l.lastRequest<=h;return this.switchMedia_(l,"exclude",s||d)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_);var o=[];(r||"audio"===e)&&o.push("AUDIO"),(r||"subtitle"===e)&&(o.push("CLOSED-CAPTIONS"),o.push("SUBTITLES")),o.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"==typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=bf(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Sg.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.masterPlaylistLoader_.master,r=Sg.Playlist.seekable(t,i,Sg.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=Sg.Playlist.seekable(t,i,Sg.Playlist.liveEdgeDelay(n,t))).length)return}var o,s;this.seekable_&&this.seekable_.length&&(o=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=hf.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)<r.end(0)?e.end(0):r.end(0)]]):this.seekable_=r,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===o&&this.seekable_.start(0)===s||(this.logger_("seekable updated ["+Tf(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},i.updateDuration=function(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){var t=this.seekable();if(!t.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))}else{var i=this.tech_.buffered(),n=Sg.Playlist.duration(this.masterPlaylistLoader_.media());i.length>0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};t.video=t.main;var i=sg(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||ao)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||ao,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var o,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&(r=t[e].isFmp4,a=n[e],!(r?oo(a):so(a)))){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(o=i)}var r,a})),r&&o&&this.media().attributes.AUDIO){var a=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===a&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+a+" as "+o+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var l=[];if(["video","audio"].forEach((function(t){var i=(io(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(io(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&l.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),l.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+l.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}var u=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+=t+' does not support codec(s): "'+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:u,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r=t[n];if(-1===i.indexOf(r.id)){i.push(r.id);var o=sg(e.master,r),s=[];!o.audio||so(o.audio)||oo(o.audio)||s.push("audio codec "+o.audio),!o.video||so(o.video)||oo(o.video)||s.push("video codec "+o.video),o.text&&"stpp.ttml.im1t"===o.text&&s.push("text codec "+o.text),s.length&&(r.excludeUntil=1/0,e.logger_("excluding "+r.id+" for unsupported: "+s.join(", ")))}}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=rg(io(e)),o=og(r),s=r.video&&io(r.video)[0]||null,a=r.audio&&io(r.audio)[0]||null;Object.keys(n).forEach((function(e){var r=n[e];if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id);var l=[],u=sg(t.masterPlaylistLoader_.master,r),c=og(u);if(u.audio||u.video){if(c!==o&&l.push('codec count "'+c+'" !== "'+o+'"'),!t.sourceUpdater_.canChangeType()){var h=u.video&&io(u.video)[0]||null,d=u.audio&&io(u.audio)[0]||null;h&&s&&h.type.toLowerCase()!==s.type.toLowerCase()&&l.push('video codec "'+h.type+'" !== "'+s.type+'"'),d&&a&&d.type.toLowerCase()!==a.type.toLowerCase()&&l.push('audio codec "'+d.type+'" !== "'+a.type+'"')}l.length&&(r.excludeUntil=1/0,t.logger_("blacklisting "+r.id+": "+l.join(" && ")))}}}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n,r=i,o=0;o<e.segments.length;o++){var s=e.segments[o];if(n||(n=Xg(t,r+s.duration/2)),n){if("cueIn"in s){n.endTime=r,n.adEndTime=r,r+=s.duration,n=null;continue}if(r<n.endTime){r+=s.duration;continue}n.endTime+=s.duration}else if("cueOut"in s&&((n=new bn.VTTCue(r,r+s.duration,s.cueOut)).adStartTime=r,n.adEndTime=r+parseFloat(s.cueOut),t.addCue(n)),"cueOutCont"in s){var a=s.cueOutCont.split("/").map(parseFloat),l=a[0],u=a[1];(n=new bn.VTTCue(r,r+s.duration,"")).adStartTime=r-l,n.adEndTime=n.adStartTime+u,t.addCue(n)}r+=s.duration}}(e,this.cueTagsTrack_,t)},i.goalBufferLength=function(){var e=this.tech_.currentTime(),t=Am.GOAL_BUFFER_LENGTH,i=Am.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Am.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)},i.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),t=Am.BUFFER_LOW_WATER_LINE,i=Am.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Am.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,Am.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.experimentalBufferBasedABR?r:n)},i.bufferHighWaterLine=function(){return Am.BUFFER_HIGH_WATER_LINE},t}(hf.EventTarget),hv=function(e,t,i){var n,r,o,s=e.masterPlaylistController_,a=s[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(s);if(t.attributes){var l=t.attributes.RESOLUTION;this.width=l&&l.width,this.height=l&&l.height,this.bandwidth=t.attributes.BANDWIDTH}this.codecs=sg(s.master(),t),this.playlist=t,this.id=i,this.enabled=(n=e.playlists,r=t.id,o=a,function(e){var t=n.master.playlists[r],i=Nf(t),s=Uf(t);return void 0===e?s:(e?delete t.disabled:t.disabled=!0,e===s||i||(o(),e?n.trigger("renditionenabled"):n.trigger("renditiondisabled")),e)})},dv=["seeking","seeked","pause","playing","error"],pv=function(){function e(e){var t=this;this.masterPlaylistController_=e.masterPlaylistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=gf("PlaybackWatcher"),this.logger_("initialize");var i=function(){return t.monitorCurrentTime_()},n=function(){return t.monitorCurrentTime_()},r=function(){return t.techWaiting_()},o=function(){return t.cancelTimer_()},s=this.masterPlaylistController_,a=["main","subtitle","audio"],l={};a.forEach((function(e){l[e]={reset:function(){return t.resetSegmentDownloads_(e)},updateend:function(){return t.checkSegmentDownloads_(e)}},s[e+"SegmentLoader_"].on("appendsdone",l[e].updateend),s[e+"SegmentLoader_"].on("playlistupdate",l[e].reset),t.tech_.on(["seeked","seeking"],l[e].reset)}));var u=function(e){["main","audio"].forEach((function(i){s[i+"SegmentLoader_"][e]("appended",t.seekingAppendCheck_)}))};this.seekingAppendCheck_=function(){t.fixesBadSeeks_()&&(t.consecutiveUpdates=0,t.lastRecordedTime=t.tech_.currentTime(),u("off"))},this.clearSeekingAppendCheck_=function(){return u("off")},this.watchForBadSeeking_=function(){t.clearSeekingAppendCheck_(),u("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(dv,o),this.tech_.on("canplay",n),this.tech_.one("play",i),this.dispose=function(){t.clearSeekingAppendCheck_(),t.logger_("dispose"),t.tech_.off("waiting",r),t.tech_.off(dv,o),t.tech_.off("canplay",n),t.tech_.off("play",i),t.tech_.off("seeking",t.watchForBadSeeking_),t.tech_.off("seeked",t.clearSeekingAppendCheck_),a.forEach((function(e){s[e+"SegmentLoader_"].off("appendsdone",l[e].updateend),s[e+"SegmentLoader_"].off("playlistupdate",l[e].reset),t.tech_.off(["seeked","seeking"],l[e].reset)})),t.checkCurrentTimeTimeout_&&bn.clearTimeout(t.checkCurrentTimeTimeout_),t.cancelTimer_()}}var t=e.prototype;return t.monitorCurrentTime_=function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&bn.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=bn.setTimeout(this.monitorCurrentTime_.bind(this),250)},t.resetSegmentDownloads_=function(e){var t=this.masterPlaylistController_[e+"SegmentLoader_"];this[e+"StalledDownloads_"]>0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1}(this[e+"Buffered_"],n);this[e+"Buffered_"]=n,r?this.resetSegmentDownloads_(e):(this[e+"StalledDownloads_"]++,this.logger_("found #"+this[e+"StalledDownloads_"]+" "+e+" appends that did not increase buffer (possible stalled download)",{playlistId:i.playlist_&&i.playlist_.id,buffered:wf(n)}),this[e+"StalledDownloads_"]<10||(this.logger_(e+" loader stalled download exclusion"),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:"vhs-"+e+"-download-exclusion"}),"subtitle"!==e&&t.blacklistCurrentPlaylist({message:"Excessive "+e+" segment downloading detected."},1/0)))},t.checkCurrentTime_=function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+yf>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1));if(this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:yf)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+Tf(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var r=this.masterPlaylistController_.sourceUpdater_,o=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,a=r.videoBuffer?r.videoBuffered():null,l=this.media(),u=l.partTargetDuration?l.partTargetDuration:2*(l.targetDuration-vf),c=[s,a],h=0;h<c.length;h++){if(c[h])if(Sf(c[h],i)<u)return!1}var d=Cf(o,i);return 0!==d.length&&(e=d.start(0)+yf,this.logger_("Buffered region starts ("+d.start(0)+") just beyond seek point ("+i+"). Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0)},t.waiting_=function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),i=bf(t,e);return i.length&&e+3<=i.end(0)?(this.cancelTimer_(),this.tech_.setCurrentTime(e),this.logger_("Stopped at "+e+" while inside a buffered region ["+i.start(0)+" -> "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var o=Cf(r,t);if(o.length>0){var s=o.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+o.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+yf;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)},t.videoUnderflow_=function(e){var t=e.videoBuffered,i=e.audioBuffered,n=e.currentTime;if(t){var r;if(t.length&&i.length){var o=bf(t,n-3),s=bf(t,n),a=bf(i,n);a.length&&!s.length&&o.length&&(r={start:o.end(0),end:a.end(0)})}else{Cf(t,n).length||(r=this.gapFromVideoUnderflow_(t,n))}return!!r&&(this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". Seeking to current time "+n),!0)}},t.skipTheGap_=function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),n=Cf(t,i);this.cancelTimer_(),0!==n.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+vf),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))},t.gapFromVideoUnderflow_=function(e,t){for(var i=function(e){if(e.length<2)return hf.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return hf.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),o=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:o}}return null},e}(),fv={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},mv=function e(t,i){var n=0,r=0,o=hf.mergeOptions(fv,i);t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var s=function(){r&&t.currentTime(r)},a=function(e){null!=e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},l=function(){return Date.now()-n<1e3*o.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):o.getSource&&"function"==typeof o.getSource?(n=Date.now(),o.getSource.call(t,a)):void hf.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},u=function e(){t.off("loadedmetadata",s),t.off("error",l),t.off("dispose",e)};t.on("error",l),t.on("dispose",u),t.reloadSourceOnError=function(i){u(),e(t,i)}},gv="2.14.3",vv={PlaylistLoader:rm,Playlist:Gf,utils:vm,STANDARD_PLAYLIST_SELECTOR:pg,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(Gf.isEnabled);return cg(t,(function(e,t){return hg(e,t)})),t.filter((function(t){return!!sg(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:pg,movingAverageBandwidthSelector:function(e){var t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&bn.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),dg(this.playlists.master,t,parseInt(ug(this.tech_.el(),"width"),10)*n,parseInt(ug(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:hg,comparePlaylistResolution:function(e,t){var i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||bn.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||bn.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:lm()};Object.keys(Am).forEach((function(e){Object.defineProperty(vv,e,{get:function(){return hf.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),Am[e]},set:function(t){hf.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!=typeof t||t<0?hf.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):Am[e]=t}})}));var yv="videojs-vhs",_v=function(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.id){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})};vv.canPlaySource=function(){return hf.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var bv=function(e){var t=e.player,i=e.sourceKeySystems,n=e.audioMedia,r=e.mainPlaylists;if(!t.eme.initializeMediaKeys)return Promise.resolve();var o=function(e,t){return e.reduce((function(e,i){if(!i.contentProtection)return e;var n=t.reduce((function(e,t){var n=i.contentProtection[t];return n&&n.pssh&&(e[t]={pssh:n.pssh}),e}),{});return Object.keys(n).length&&e.push(n),e}),[])}(n?r.concat([n]):r,Object.keys(i)),s=[],a=[];return o.forEach((function(e){a.push(new Promise((function(e,i){t.tech_.one("keysessioncreated",e)}))),s.push(new Promise((function(i,n){t.eme.initializeMediaKeys({keySystems:e},(function(e){e?n(e):i()}))})))})),Promise.race([Promise.all(s),Promise.race(a)])},Cv=function(e){var t=e.player,i=function(e,t,i){if(!e)return e;var n={};t&&t.attributes&&t.attributes.CODECS&&(n=rg(io(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);var r=ro(n.video),o=ro(n.audio),s={};for(var a in e)s[a]={},o&&(s[a].audioContentType=o),r&&(s[a].videoContentType=r),t.contentProtection&&t.contentProtection[a]&&t.contentProtection[a].pssh&&(s[a].pssh=t.contentProtection[a].pssh),"string"==typeof e[a]&&(s[a].url=e[a]);return hf.mergeOptions(e,s)}(e.sourceKeySystems,e.media,e.audioMedia);return!!i&&(t.currentSource().keySystems=i,!(i&&!t.eme)||(hf.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},Tv=function(){if(!bn.localStorage)return null;var e=bn.localStorage.getItem(yv);if(!e)return null;try{return JSON.parse(e)}catch($v){return null}};vv.supportsNativeHls=function(){if(!En||!En.createElement)return!1;var e=En.createElement("video");if(!hf.getTech("Html5").isSupported())return!1;return["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some((function(t){return/maybe|probably/i.test(e.canPlayType(t))}))}(),vv.supportsNativeDash=!!(En&&En.createElement&&hf.getTech("Html5").isSupported())&&/maybe|probably/i.test(En.createElement("video").canPlayType("application/dash+xml")),vv.supportsTypeNatively=function(e){return"hls"===e?vv.supportsNativeHls:"dash"===e&&vv.supportsNativeDash},vv.isSupported=function(){return hf.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var wv=function(e){function t(t,i,n){var r;if(r=e.call(this,i,hf.mergeOptions(n.hls,n.vhs))||this,n.hls&&Object.keys(n.hls).length&&hf.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object."),"number"==typeof n.initialBandwidth&&(r.options_.bandwidth=n.initialBandwidth),r.logger_=gf("VhsHandler"),i.options_&&i.options_.playerId){var o=hf(i.options_.playerId);o.hasOwnProperty("hls")||Object.defineProperty(o,"hls",{get:function(){return hf.log.warn("player.hls is deprecated. Use player.tech().vhs instead."),i.trigger({type:"usage",name:"hls-player-access"}),An(r)},configurable:!0}),o.hasOwnProperty("vhs")||Object.defineProperty(o,"vhs",{get:function(){return hf.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."),i.trigger({type:"usage",name:"vhs-player-access"}),An(r)},configurable:!0}),o.hasOwnProperty("dash")||Object.defineProperty(o,"dash",{get:function(){return hf.log.warn("player.dash is deprecated. Use player.tech().vhs instead."),An(r)},configurable:!0}),r.player_=o}if(r.tech_=i,r.source_=t,r.stats={},r.ignoreNextSeekingEvent_=!1,r.setOptions_(),r.options_.overrideNative&&i.overrideNativeAudioTracks&&i.overrideNativeVideoTracks)i.overrideNativeAudioTracks(!0),i.overrideNativeVideoTracks(!0);else if(r.options_.overrideNative&&(i.featuresNativeVideoTracks||i.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return r.on(En,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],(function(e){var t=En.fullscreenElement||En.webkitFullscreenElement||En.mozFullScreenElement||En.msFullscreenElement;t&&t.contains(r.tech_.el())?r.masterPlaylistController_.fastQualityChange_():r.masterPlaylistController_.checkABR_()})),r.on(r.tech_,"seeking",(function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())})),r.on(r.tech_,"error",(function(){this.tech_.error()&&this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()})),r.on(r.tech_,"play",r.play),r}In(t,e);var i=t.prototype;return i.setOptions_=function(){var e=this;if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=!1!==this.options_.handleManifestRedirects,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var t=Tv();t&&t.bandwidth&&(this.options_.bandwidth=t.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),t&&t.throughput&&(this.options_.throughput=t.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Am.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Am.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","experimentalBufferBasedABR","liveRangeSafeTimeDelta","experimentalLLHLS","useNetworkInformationApi","useDtsForTimestampOffset","experimentalExactManifestTimings","experimentalLeastPixelDiffSelector"].forEach((function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])})),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio},i.src=function(e,t){var i=this;if(e){var n;this.setOptions_(),this.options_.src=0===(n=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(n.substring(n.indexOf(",")+1)):n,this.options_.tech=this.tech_,this.options_.externVhs=vv,this.options_.sourceType=co(t),this.options_.seekTo=function(e){i.tech_.setCurrentTime(e)},this.options_.smoothQualityChange&&hf.log.warn("smoothQualityChange is deprecated and will be removed in the next major version"),this.masterPlaylistController_=new cv(this.options_);var r=hf.mergeOptions({liveRangeSafeTimeDelta:yf},this.options_,{seekable:function(){return i.seekable()},media:function(){return i.masterPlaylistController_.media()},masterPlaylistController:this.masterPlaylistController_});this.playbackWatcher_=new pv(r),this.masterPlaylistController_.on("error",(function(){var e=hf.players[i.tech_.options_.playerId],t=i.masterPlaylistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}));var o=this.options_.experimentalBufferBasedABR?vv.movingAverageBandwidthSelector(.55):vv.STANDARD_PLAYLIST_SELECTOR;this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):o.bind(this),this.masterPlaylistController_.selectInitialPlaylist=vv.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){var e=this.masterPlaylistController_.mainSegmentLoader_.bandwidth,t=bn.navigator.connection||bn.navigator.mozConnection||bn.navigator.webkitConnection,i=1e7;if(this.options_.useNetworkInformationApi&&t){var n=1e3*t.downlink*1e3;e=n>=i&&e>=i?Math.max(e,n):n}return e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){hf.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return wf(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return wf(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!bn.localStorage)return!1;var t=Tv();t=t?hf.mergeOptions(t,e):e;try{bn.localStorage.setItem(yv,JSON.stringify(t))}catch($v){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e;(e=i).representations=function(){var t=e.masterPlaylistController_.master(),i=Vf(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((function(e){return!Nf(e)})).map((function(t,i){return new hv(e,t,t.id)})):[]}})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=bn.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.createKeySessions_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),bv({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})}))},i.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},i.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=Cv({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",(function(t){if("output-restricted"===t.status){var i=e.masterPlaylistController_.master();if(i&&i.playlists){var n,r=[];if(i.playlists.forEach((function(e){e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height>=720&&(!e.excludeUntil||e.excludeUntil<1/0)&&(e.excludeUntil=1/0,r.push(e))})),r.length)(n=hf.log).warn.apply(n,['DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.'].concat(r)),e.masterPlaylistController_.fastQualityChange_()}}})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==hf.browser.IE_VERSION&&i?this.createKeySessions_():this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=hf.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var t,i;t=e.qualityLevels_,(i=e).representations().forEach((function(e){t.addQualityLevel(e)})),_v(t,i.playlists)})),this.playlists.on("mediachange",(function(){_v(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":gv,"mux.js":"6.0.1","mpd-parser":"0.21.1","m3u8-parser":"4.7.1","aes-decrypter":"3.1.3"}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return Gg.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&bn.URL.revokeObjectURL&&(bn.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return ym({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),_m({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(hf.getComponent("Component")),Ev={name:"videojs-http-streaming",VERSION:gv,canHandleSource:function(e,t){void 0===t&&(t={});var i=hf.mergeOptions(hf.options,t);return Ev.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=hf.mergeOptions(hf.options,i);return t.vhs=new wv(e,t,n),hf.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return hf.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=lm(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){void 0===t&&(t={});var i=hf.mergeOptions(hf.options,t),n=i.vhs,r=(n=void 0===n?{}:n).overrideNative,o=void 0===r?!hf.browser.IS_ANY_SAFARI:r,s=i.hls,a=(s=void 0===s?{}:s).overrideNative,l=void 0!==a&&a,u=co(e);return u&&(!vv.supportsTypeNatively(u)||l||o)?"maybe":""}};(oo("avc1.4d400d,mp4a.40.2")&&hf.getTech("Html5").registerSourceHandler(Ev,0),hf.VhsHandler=wv,Object.defineProperty(hf,"HlsHandler",{get:function(){return hf.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),wv},configurable:!0}),hf.VhsSourceHandler=Ev,Object.defineProperty(hf,"HlsSourceHandler",{get:function(){return hf.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),Ev},configurable:!0}),hf.Vhs=vv,Object.defineProperty(hf,"Hls",{get:function(){return hf.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),vv},configurable:!0}),hf.use||(hf.registerComponent("Hls",vv),hf.registerComponent("Vhs",vv)),hf.options.vhs=hf.options.vhs||{},hf.options.hls=hf.options.hls||{},hf.getPlugin&&hf.getPlugin("reloadSourceOnError"))||(hf.registerPlugin||hf.plugin)("reloadSourceOnError",(function(e){mv(this,e)}));var Sv,kv=hf.getComponent("Tech"),Pv=hf.dom,Av=hf.url,xv=hf.createTimeRange,Iv=hf.mergeOptions,Mv=bn&&bn.navigator||{},Lv=function(e){function t(i,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,i,n));return i.source&&r.ready((function(){this.setSource(i.source)}),!0),i.startTime&&r.ready((function(){this.load(),this.play(),this.currentTime(i.startTime)}),!0),bn.videojs=bn.videojs||{},bn.videojs.Flash=bn.videojs.Flash||{},bn.videojs.Flash.onReady=t.onReady,bn.videojs.Flash.onEvent=t.onEvent,bn.videojs.Flash.onError=t.onError,r.on("seeked",(function(){this.lastSeekTarget_=void 0})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.createEl=function(){var e=this.options_;e.swf||(e.swf="https://vjs.zencdn.net/swf/5.4.2/video-js.swf");var i=e.techId,n=Iv({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:e.autoplay,preload:e.preload,loop:e.loop,muted:e.muted},e.flashVars),r=Iv({wmode:"opaque",bgcolor:"#000000"},e.params),o=Iv({id:i,name:i,class:"vjs-tech"},e.attributes);return this.el_=t.embed(e.swf,n,r,o),this.el_.tech=this,this.el_},t.prototype.play=function(){this.ended()&&this.setCurrentTime(0),this.el_.vjs_play()},t.prototype.pause=function(){this.el_.vjs_pause()},t.prototype.src=function(e){return void 0===e?this.currentSrc():this.setSrc(e)},t.prototype.setSrc=function(e){var t=this;e=Av.getAbsoluteURL(e),this.el_.vjs_src(e),this.autoplay()&&this.setTimeout((function(){return t.play()}),0)},t.prototype.seeking=function(){return void 0!==this.lastSeekTarget_},t.prototype.setCurrentTime=function(t){var i=this.seekable();i.length&&(t=(t=t>i.start(0)?t:i.start(0))<i.end(i.length-1)?t:i.end(i.length-1),this.lastSeekTarget_=t,this.trigger("seeking"),this.el_.vjs_setProperty("currentTime",t),e.prototype.setCurrentTime.call(this))},t.prototype.currentTime=function(){return this.seeking()?this.lastSeekTarget_||0:this.el_.vjs_getProperty("currentTime")},t.prototype.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.vjs_getProperty("currentSrc")},t.prototype.duration=function(){if(0===this.readyState())return NaN;var e=this.el_.vjs_getProperty("duration");return e>=0?e:1/0},t.prototype.load=function(){this.el_.vjs_load()},t.prototype.poster=function(){this.el_.vjs_getProperty("poster")},t.prototype.setPoster=function(){},t.prototype.seekable=function(){var e=this.duration();return 0===e?xv():xv(0,e)},t.prototype.buffered=function(){var e=this.el_.vjs_getProperty("buffered");return 0===e.length?xv():xv(e[0][0],e[0][1])},t.prototype.supportsFullScreen=function(){return!1},t.prototype.enterFullScreen=function(){return!1},t.prototype.getVideoPlaybackQuality=function(){var e=this.el_.vjs_getProperty("getVideoPlaybackQuality");return bn.performance&&"function"==typeof bn.performance.now?e.creationTime=bn.performance.now():bn.performance&&bn.performance.timing&&"number"==typeof bn.performance.timing.navigationStart&&(e.creationTime=bn.Date.now()-bn.performance.timing.navigationStart),e},t}(kv),Dv=["rtmpConnection","rtmpStream","preload","defaultPlaybackRate","playbackRate","autoplay","loop","controls","volume","muted","defaultMuted"],Ov=["networkState","readyState","initialTime","startOffsetTime","paused","ended","videoWidth","videoHeight"],jv=Lv.prototype;function Rv(e){var t=e.charAt(0).toUpperCase()+e.slice(1);jv["set"+t]=function(t){return this.el_.vjs_setProperty(e,t)}}function Nv(e){jv[e]=function(){return this.el_.vjs_getProperty(e)}}for(var Uv=0;Uv<Dv.length;Uv++)Nv(Dv[Uv]),Rv(Dv[Uv]);for(var Bv=0;Bv<Ov.length;Bv++)Nv(Ov[Bv]);Lv.isSupported=function(){return!((!hf.browser.IS_CHROME||hf.browser.IS_ANDROID&&hf.browser.IS_IOS)&&(!hf.browser.IS_SAFARI||hf.browser.IS_IOS)&&!hf.browser.IS_EDGE)||Lv.version()[0]>=10},kv.withSourceHandlers(Lv),Lv.nativeSourceHandler={},Lv.nativeSourceHandler.canPlayType=function(e){return e in Lv.formats?"maybe":""},Lv.nativeSourceHandler.canHandleSource=function(e,t){var i,n,r=void 0;return e.type?r=e.type.replace(/;.*/,"").toLowerCase():(i=e.src,r=(n=Av.getFileExtension(i))?"video/"+n:""),Lv.nativeSourceHandler.canPlayType(r)},Lv.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Lv.nativeSourceHandler.dispose=function(){},Lv.registerSourceHandler(Lv.nativeSourceHandler),Lv.formats={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"},Lv.onReady=function(e){var t=Pv.$("#"+e),i=t&&t.tech;i&&i.el()&&Lv.checkReady(i)},Lv.checkReady=function(e){e.el()&&(e.el().vjs_getProperty?e.triggerReady():this.setTimeout((function(){Lv.checkReady(e)}),50))},Lv.onEvent=function(e,t){var i=Pv.$("#"+e).tech,n=Array.prototype.slice.call(arguments,2);i.setTimeout((function(){i.trigger(t,n)}),1)},Lv.onError=function(e,t){var i=Pv.$("#"+e).tech;if("srcnotfound"===t)return i.error(4);"string"==typeof t?i.error("FLASH: "+t):(t.origin="flash",i.error(t))},Lv.version=function(){var e="0,0,0";try{e=new bn.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch($v){try{Mv.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(e=(Mv.plugins["Shockwave Flash 2.0"]||Mv.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(t){}}return e.split(",")},Lv.embed=function(e,t,i,n){var r=Lv.getEmbedCode(e,t,i,n);return Pv.createEl("div",{innerHTML:r}).childNodes[0]},Lv.getEmbedCode=function(e,t,i,n){var r="",o="",s="";return t&&Object.getOwnPropertyNames(t).forEach((function(e){r+=e+"="+t[e]+"&"})),i=Iv({movie:e,flashvars:r,allowScriptAccess:"always",allowNetworking:"all"},i),Object.getOwnPropertyNames(i).forEach((function(e){o+='<param name="'+e+'" value="'+i[e]+'" />'})),n=Iv({data:e,width:"100%",height:"100%"},n),Object.getOwnPropertyNames(n).forEach((function(e){s+=e+'="'+n[e]+'" '})),'<object type="application/x-shockwave-flash" '+s+">"+o+"</object>"},(Sv=Lv).streamingFormats={"rtmp/mp4":"MP4","rtmp/flv":"FLV"},Sv.streamFromParts=function(e,t){return e+"&"+t},Sv.streamToParts=function(e){var t={connection:"",stream:""};if(!e)return t;var i=e.search(/&(?![\w-]+=)/),n=void 0;return-1!==i?n=i+1:0===(i=n=e.lastIndexOf("/")+1)&&(i=n=e.length),t.connection=e.substring(0,i),t.stream=e.substring(n,e.length),t},Sv.isStreamingType=function(e){return e in Sv.streamingFormats},Sv.RTMP_RE=/^rtmp[set]?:\/\//i,Sv.isStreamingSrc=function(e){return Sv.RTMP_RE.test(e)},Sv.rtmpSourceHandler={},Sv.rtmpSourceHandler.canPlayType=function(e){return Sv.isStreamingType(e)?"maybe":""},Sv.rtmpSourceHandler.canHandleSource=function(e,t){var i=Sv.rtmpSourceHandler.canPlayType(e.type);return i||(Sv.isStreamingSrc(e.src)?"maybe":"")},Sv.rtmpSourceHandler.handleSource=function(e,t,i){var n=Sv.streamToParts(e.src);t.setRtmpConnection(n.connection),t.setRtmpStream(n.stream)},Sv.registerSourceHandler(Sv.rtmpSourceHandler),kv.getTech("Flash")?(hf.log.warn("Not using videojs-flash as it appears to already be registered"),hf.log.warn("videojs-flash should only be used with video.js@6 and above")):hf.registerTech("Flash",Lv),Lv.VERSION="2.2.1";var Fv={exports:{}};!function(e,t){var i;self,i=function(){return function(){var e={"./node_modules/es6-promise/dist/es6-promise.js":function(e,t,i){
- /*!
- * @overview es6-promise - a tiny implementation of Promises/A+.
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
- * @license Licensed under MIT license
- * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
- * @version v4.2.8+1e68dce6
- */
- e.exports=function(){function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,o=void 0,s=void 0,a=function(e,t){b[r]=e,b[r+1]=t,2===(r+=2)&&(s?s(C):w())};function l(e){s=e}function u(e){a=e}var c="undefined"!=typeof window?window:void 0,h=c||{},d=h.MutationObserver||h.WebKitMutationObserver,p="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function m(){return function(){return process.nextTick(C)}}function g(){return void 0!==o?function(){o(C)}:_()}function v(){var e=0,t=new d(C),i=document.createTextNode("");return t.observe(i,{characterData:!0}),function(){i.data=e=++e%2}}function y(){var e=new MessageChannel;return e.port1.onmessage=C,function(){return e.port2.postMessage(0)}}function _(){var e=setTimeout;return function(){return e(C,1)}}var b=new Array(1e3);function C(){for(var e=0;e<r;e+=2)(0,b[e])(b[e+1]),b[e]=void 0,b[e+1]=void 0;r=0}function T(){try{var e=Function("return this")().require("vertx");return o=e.runOnLoop||e.runOnContext,g()}catch($v){return _()}}var w=void 0;function E(e,t){var i=this,n=new this.constructor(P);void 0===n[k]&&q(n);var r=i._state;if(r){var o=arguments[r-1];a((function(){return V(r,n,o,i._result)}))}else W(i,n,e,t);return n}function S(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var i=new t(P);return N(i,e),i}w=p?m():d?v():f?y():void 0===c?T():_();var k=Math.random().toString(36).substring(2);function P(){}var A=void 0,x=1,I=2;function M(){return new TypeError("You cannot resolve a promise with itself")}function L(){return new TypeError("A promises callback cannot return that same promise.")}function D(e,t,i,n){try{e.call(t,i,n)}catch($v){return $v}}function O(e,t,i){a((function(e){var n=!1,r=D(i,t,(function(i){n||(n=!0,t!==i?N(e,i):B(e,i))}),(function(t){n||(n=!0,F(e,t))}),"Settle: "+(e._label||" unknown promise"));!n&&r&&(n=!0,F(e,r))}),e)}function j(e,t){t._state===x?B(e,t._result):t._state===I?F(e,t._result):W(t,void 0,(function(t){return N(e,t)}),(function(t){return F(e,t)}))}function R(e,i,n){i.constructor===e.constructor&&n===E&&i.constructor.resolve===S?j(e,i):void 0===n?B(e,i):t(n)?O(e,i,n):B(e,i)}function N(t,i){if(t===i)F(t,M());else if(e(i)){var n=void 0;try{n=i.then}catch(r){return void F(t,r)}R(t,i,n)}else B(t,i)}function U(e){e._onerror&&e._onerror(e._result),H(e)}function B(e,t){e._state===A&&(e._result=t,e._state=x,0!==e._subscribers.length&&a(H,e))}function F(e,t){e._state===A&&(e._state=I,e._result=t,a(U,e))}function W(e,t,i,n){var r=e._subscribers,o=r.length;e._onerror=null,r[o]=t,r[o+x]=i,r[o+I]=n,0===o&&e._state&&a(H,e)}function H(e){var t=e._subscribers,i=e._state;if(0!==t.length){for(var n=void 0,r=void 0,o=e._result,s=0;s<t.length;s+=3)n=t[s],r=t[s+i],n?V(i,n,r,o):r(o);e._subscribers.length=0}}function V(e,i,n,r){var o=t(n),s=void 0,a=void 0,l=!0;if(o){try{s=n(r)}catch($v){l=!1,a=$v}if(i===s)return void F(i,L())}else s=r;i._state!==A||(o&&l?N(i,s):!1===l?F(i,a):e===x?B(i,s):e===I&&F(i,s))}function G(e,t){try{t((function(t){N(e,t)}),(function(t){F(e,t)}))}catch($v){F(e,$v)}}var z=0;function Y(){return z++}function q(e){e[k]=z++,e._state=void 0,e._result=void 0,e._subscribers=[]}function X(){return new Error("Array Methods must be provided an Array")}var Z=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(P),this.promise[k]||q(this.promise),n(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?B(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&B(this.promise,this._result))):F(this.promise,X())}return e.prototype._enumerate=function(e){for(var t=0;this._state===A&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,n=i.resolve;if(n===S){var r=void 0,o=void 0,s=!1;try{r=e.then}catch($v){s=!0,o=$v}if(r===E&&e._state!==A)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(i===te){var a=new i(P);s?F(a,o):R(a,e,r),this._willSettleAt(a,t)}else this._willSettleAt(new i((function(t){return t(e)})),t)}else this._willSettleAt(n(e),t)},e.prototype._settledAt=function(e,t,i){var n=this.promise;n._state===A&&(this._remaining--,e===I?F(n,i):this._result[t]=i),0===this._remaining&&B(n,this._result)},e.prototype._willSettleAt=function(e,t){var i=this;W(e,void 0,(function(e){return i._settledAt(x,t,e)}),(function(e){return i._settledAt(I,t,e)}))},e}();function Q(e){return new Z(this,e).promise}function K(e){var t=this;return n(e)?new t((function(i,n){for(var r=e.length,o=0;o<r;o++)t.resolve(e[o]).then(i,n)})):new t((function(e,t){return t(new TypeError("You must pass an array to race."))}))}function J(e){var t=new this(P);return F(t,e),t}function $(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function ee(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var te=function(){function e(t){this[k]=Y(),this._result=this._state=void 0,this._subscribers=[],P!==t&&("function"!=typeof t&&$(),this instanceof e?G(this,t):ee())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var i=this,n=i.constructor;return t(e)?i.then((function(t){return n.resolve(e()).then((function(){return t}))}),(function(t){return n.resolve(e()).then((function(){throw t}))})):i.then(e,e)},e}();function ie(){var e=void 0;if(void 0!==i.g)e=i.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch($v){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch($v){}if("[object Promise]"===n&&!t.cast)return}e.Promise=te}return te.prototype.then=E,te.all=Q,te.race=K,te.resolve=S,te.reject=J,te._setScheduler=l,te._setAsap=u,te._asap=a,te.polyfill=ie,te.Promise=te,te}()},"./node_modules/events/events.js":function(e){var t,i="object"==typeof Reflect?Reflect:null,n=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(i,n){function r(i){e.removeListener(t,o),n(i)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",r),i([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&m(e,"error",t,i)}(e,r,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,i,n){var r,o,s,u;if(a(i),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),o=e._events),s=o[t]),void 0===s)s=o[t]=i,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[i,s]:[s,i]:n?s.unshift(i):s.push(i),(r=l(e))>0&&s.length>r&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,u=c,console&&console.warn&&console.warn(u)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,i){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},r=c.bind(n);return r.listener=i,n.wrapFn=r,r}function d(e,t,i){var n=e._events;if(void 0===n)return[];var r=n[t];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(r):f(r,r.length)}function p(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function f(e,t){for(var i=new Array(t),n=0;n<t;++n)i[n]=e[n];return i}function m(e,t,i,n){if("function"==typeof e.on)n.once?e.once(t,i):e.on(t,i);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function r(o){n.once&&e.removeEventListener(t,r),i(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return l(this)},o.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else{var u=l.length,c=f(l,u);for(i=0;i<u;++i)n(c[i],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},o.prototype.removeListener=function(e,t){var i,n,r,o,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(i=n[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(r=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,r=o;break}if(r<0)return this;0===r?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,r),1===i.length&&(n[e]=i[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,i,n;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var r,o=Object.keys(i);for(n=0;n<o.length;++n)"removeListener"!==(r=o[n])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return d(this,e,!0)},o.prototype.rawListeners=function(e){return d(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},"./node_modules/webworkify-webpack/index.js":function(e,t,i){function n(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=t,i.i=function(e){return e},i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var n=i(i.s=ENTRY_MODULE);return n.default||n}var r="[\\.|\\-|\\+|\\w|/|@]+",o="\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)";function s(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function a(e,t,n){var a={};a[n]=[];var l=t.toString(),u=l.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return a;for(var c,h=u[1],d=new RegExp("(\\\\n|\\W)"+s(h)+o,"g");c=d.exec(l);)"dll-reference"!==c[3]&&a[n].push(c[3]);for(d=new RegExp("\\("+s(h)+'\\("(dll-reference\\s('+r+'))"\\)\\)'+o,"g");c=d.exec(l);)e[c[2]]||(a[n].push(c[1]),e[c[2]]=i(c[1]).m),a[c[2]]=a[c[2]]||[],a[c[2]].push(c[4]);for(var p,f=Object.keys(a),m=0;m<f.length;m++)for(var g=0;g<a[f[m]].length;g++)p=a[f[m]][g],isNaN(1*p)||(a[f[m]][g]=1*a[f[m]][g]);return a}function l(e){return Object.keys(e).reduce((function(t,i){return t||e[i].length>0}),!1)}e.exports=function(e,t){t=t||{};var r={main:i.m},o=t.all?{main:Object.keys(r.main)}:function(e,t){for(var i={main:[t]},n={main:[]},r={main:{}};l(i);)for(var o=Object.keys(i),s=0;s<o.length;s++){var u=o[s],c=i[u].pop();if(r[u]=r[u]||{},!r[u][c]&&e[u][c]){r[u][c]=!0,n[u]=n[u]||[],n[u].push(c);for(var h=a(e,e[u][c],u),d=Object.keys(h),p=0;p<d.length;p++)i[d[p]]=i[d[p]]||[],i[d[p]]=i[d[p]].concat(h[d[p]])}}return n}(r,e),s="";Object.keys(o).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;o[e][t];)t++;o[e].push(t),r[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",s=s+"var "+e+" = ("+n.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+o[e].map((function(t){return JSON.stringify(t)+": "+r[e][t].toString()})).join(",")+"});\n"})),s=s+"new (("+n.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+o.main.map((function(e){return JSON.stringify(e)+": "+r.main[e].toString()})).join(",")+"}))(self);";var u=new window.Blob([s],{type:"text/javascript"});if(t.bare)return u;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),h=new window.Worker(c);return h.objectURL=c,h}},"./src/config.js":function(e,t,i){i.r(t),i.d(t,{defaultConfig:function(){return n},createDefaultConfig:function(){return r}});var n={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 r(){return Object.assign({},n)}},"./src/core/features.js":function(e,t,i){i.r(t);var n=i("./src/io/io-controller.js"),r=i("./src/config.js"),o=function(){function e(){}return e.supportMSEH264Playback=function(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')},e.supportNetworkStreamIO=function(){var e=new n.default({},(0,r.createDefaultConfig)()),t=e.loaderType;return e.destroy(),"fetch-stream-loader"==t||"xhr-moz-chunked-loader"==t},e.getNetworkLoaderTypeName=function(){var e=new n.default({},(0,r.createDefaultConfig)()),t=e.loaderType;return e.destroy(),t},e.supportNativeMediaPlayback=function(t){null==e.videoElement&&(e.videoElement=window.document.createElement("video"));var i=e.videoElement.canPlayType(t);return"probably"===i||"maybe"==i},e.getFeatureList=function(){var t={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return t.mseFlvPlayback=e.supportMSEH264Playback(),t.networkStreamIO=e.supportNetworkStreamIO(),t.networkLoaderName=e.getNetworkLoaderTypeName(),t.mseLiveFlvPlayback=t.mseFlvPlayback&&t.networkStreamIO,t.nativeMP4H264Playback=e.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),t.nativeWebmVP8Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),t.nativeWebmVP9Playback=e.supportNativeMediaPlayback('video/webm; codecs="vp9"'),t},e}();t.default=o},"./src/core/media-info.js":function(e,t,i){i.r(t);var n=function(){function e(){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 e.prototype.isComplete=function(){var e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=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;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&e&&t},e.prototype.isSeekable=function(){return!0===this.hasKeyframesIndex},e.prototype.getNearestKeyframe=function(e){if(null==this.keyframesIndex)return null;var t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}},e.prototype._search=function(e,t){var i=0,n=e.length-1,r=0,o=0,s=n;for(t<e[0]&&(i=0,o=s+1);o<=s;){if((r=o+Math.floor((s-o)/2))===n||t>=e[r]&&t<e[r+1]){i=r;break}e[r]<t?o=r+1:s=r-1}return i},e}();t.default=n},"./src/core/media-segment-info.js":function(e,t,i){i.r(t),i.d(t,{SampleInfo:function(){return n},MediaSegmentInfo:function(){return r},IDRSampleList:function(){return o},MediaSegmentInfoList:function(){return s}});var n=function(e,t,i,n,r){this.dts=e,this.pts=t,this.duration=i,this.originalDts=n,this.isSyncPoint=r,this.fileposition=null},r=function(){function e(){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 e.prototype.appendSyncPoint=function(e){e.isSyncPoint=!0,this.syncPoints.push(e)},e}(),o=function(){function e(){this._list=[]}return e.prototype.clear=function(){this._list=[]},e.prototype.appendArray=function(e){var t=this._list;0!==e.length&&(t.length>0&&e[0].originalDts<t[t.length-1].originalDts&&this.clear(),Array.prototype.push.apply(t,e))},e.prototype.getLastSyncPointBeforeDts=function(e){if(0==this._list.length)return null;var t=this._list,i=0,n=t.length-1,r=0,o=0,s=n;for(e<t[0].dts&&(i=0,o=s+1);o<=s;){if((r=o+Math.floor((s-o)/2))===n||e>=t[r].dts&&e<t[r+1].dts){i=r;break}t[r].dts<e?o=r+1:s=r-1}return this._list[i]},e}(),s=function(){function e(e){this._type=e,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this._list.length},e.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},e.prototype._searchNearestSegmentBefore=function(e){var t=this._list;if(0===t.length)return-2;var i=t.length-1,n=0,r=0,o=i,s=0;if(e<t[0].originalBeginDts)return s=-1;for(;r<=o;){if((n=r+Math.floor((o-r)/2))===i||e>t[n].lastSample.originalDts&&e<t[n+1].originalBeginDts){s=n;break}t[n].originalBeginDts<e?r=n+1:o=n-1}return s},e.prototype._searchNearestSegmentAfter=function(e){return this._searchNearestSegmentBefore(e)+1},e.prototype.append=function(e){var t=this._list,i=e,n=this._lastAppendLocation,r=0;-1!==n&&n<t.length&&i.originalBeginDts>=t[n].lastSample.originalDts&&(n===t.length-1||n<t.length-1&&i.originalBeginDts<t[n+1].originalBeginDts)?r=n+1:t.length>0&&(r=this._searchNearestSegmentBefore(i.originalBeginDts)+1),this._lastAppendLocation=r,this._list.splice(r,0,i)},e.prototype.getLastSegmentBefore=function(e){var t=this._searchNearestSegmentBefore(e);return t>=0?this._list[t]:null},e.prototype.getLastSampleBefore=function(e){var t=this.getLastSegmentBefore(e);return null!=t?t.lastSample:null},e.prototype.getLastSyncPointBefore=function(e){for(var t=this._searchNearestSegmentBefore(e),i=this._list[t].syncPoints;0===i.length&&t>0;)t--,i=this._list[t].syncPoints;return i.length>0?i[i.length-1]:null},e}()},"./src/core/mse-controller.js":function(e,t,i){i.r(t);var n=i("./node_modules/events/events.js"),r=i.n(n),o=i("./src/utils/logger.js"),s=i("./src/utils/browser.js"),a=i("./src/core/mse-events.js"),l=i("./src/core/media-segment-info.js"),u=i("./src/utils/exception.js"),c=function(){function e(e){this.TAG="MSEController",this._config=e,this._emitter=new(r()),this._config.isLive&&null==this._config.autoCleanupSourceBuffer&&(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 l.IDRSampleList}return e.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaSource)throw new u.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var t=this._mediaSource=new window.MediaSource;t.addEventListener("sourceopen",this.e.onSourceOpen),t.addEventListener("sourceended",this.e.onSourceEnded),t.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=e,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),e.src=this._mediaSourceObjectURL},e.prototype.detachMediaElement=function(){if(this._mediaSource){var e=this._mediaSource;for(var t in this._sourceBuffers){var i=this._pendingSegments[t];i.splice(0,i.length),this._pendingSegments[t]=null,this._pendingRemoveRanges[t]=null,this._lastInitSegments[t]=null;var n=this._sourceBuffers[t];if(n){if("closed"!==e.readyState){try{e.removeSourceBuffer(n)}catch(r){o.default.e(this.TAG,r.message)}n.removeEventListener("error",this.e.onSourceBufferError),n.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[t]=null,this._sourceBuffers[t]=null}}if("open"===e.readyState)try{e.endOfStream()}catch(r){o.default.e(this.TAG,r.message)}e.removeEventListener("sourceopen",this.e.onSourceOpen),e.removeEventListener("sourceended",this.e.onSourceEnded),e.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)},e.prototype.appendInitSegment=function(e,t){if(!this._mediaSource||"open"!==this._mediaSource.readyState)return this._pendingSourceBufferInit.push(e),void this._pendingSegments[e.type].push(e);var i=e,n=""+i.container;i.codec&&i.codec.length>0&&(n+=";codecs="+i.codec);var r=!1;if(o.default.v(this.TAG,"Received Initialization Segment, mimeType: "+n),this._lastInitSegments[i.type]=i,n!==this._mimeTypes[i.type]){if(this._mimeTypes[i.type])o.default.v(this.TAG,"Notice: "+i.type+" mimeType changed, origin: "+this._mimeTypes[i.type]+", target: "+n);else{r=!0;try{var l=this._sourceBuffers[i.type]=this._mediaSource.addSourceBuffer(n);l.addEventListener("error",this.e.onSourceBufferError),l.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(u){return o.default.e(this.TAG,u.message),void this._emitter.emit(a.default.ERROR,{code:u.code,msg:u.message})}}this._mimeTypes[i.type]=n}t||this._pendingSegments[i.type].push(i),r||this._sourceBuffers[i.type]&&!this._sourceBuffers[i.type].updating&&this._doAppendSegments(),s.default.safari&&"audio/mpeg"===i.container&&i.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=i.mediaDuration/1e3,this._updateMediaSourceDuration())},e.prototype.appendMediaSegment=function(e){var t=e;this._pendingSegments[t.type].push(t),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var i=this._sourceBuffers[t.type];!i||i.updating||this._hasPendingRemoveRanges()||this._doAppendSegments()},e.prototype.seek=function(e){for(var t in this._sourceBuffers)if(this._sourceBuffers[t]){var i=this._sourceBuffers[t];if("open"===this._mediaSource.readyState)try{i.abort()}catch(c){o.default.e(this.TAG,c.message)}this._idrList.clear();var n=this._pendingSegments[t];if(n.splice(0,n.length),"closed"!==this._mediaSource.readyState){for(var r=0;r<i.buffered.length;r++){var a=i.buffered.start(r),l=i.buffered.end(r);this._pendingRemoveRanges[t].push({start:a,end:l})}if(i.updating||this._doRemoveRanges(),s.default.safari){var u=this._lastInitSegments[t];u&&(this._pendingSegments[t].push(u),i.updating||this._doAppendSegments())}}}},e.prototype.endOfStream=function(){var e=this._mediaSource,t=this._sourceBuffers;e&&"open"===e.readyState?t.video&&t.video.updating||t.audio&&t.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,e.endOfStream()):e&&"closed"===e.readyState&&this._hasPendingSegments()&&(this._hasPendingEos=!0)},e.prototype.getNearestKeyframe=function(e){return this._idrList.getLastSyncPointBeforeDts(e)},e.prototype._needCleanupSourceBuffer=function(){if(!this._config.autoCleanupSourceBuffer)return!1;var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){var n=i.buffered;if(n.length>=1&&e-n.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},e.prototype._doCleanupSourceBuffer=function(){var e=this._mediaElement.currentTime;for(var t in this._sourceBuffers){var i=this._sourceBuffers[t];if(i){for(var n=i.buffered,r=!1,o=0;o<n.length;o++){var s=n.start(o),a=n.end(o);if(s<=e&&e<a+3){if(e-s>=this._config.autoCleanupMaxBackwardDuration){r=!0;var l=e-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[t].push({start:s,end:l})}}else a<e&&(r=!0,this._pendingRemoveRanges[t].push({start:s,end:a}))}r&&!i.updating&&this._doRemoveRanges()}}},e.prototype._updateMediaSourceDuration=function(){var e=this._sourceBuffers;if(0!==this._mediaElement.readyState&&"open"===this._mediaSource.readyState&&!(e.video&&e.video.updating||e.audio&&e.audio.updating)){var t=this._mediaSource.duration,i=this._pendingMediaDuration;i>0&&(isNaN(t)||i>t)&&(o.default.v(this.TAG,"Update MediaSource duration from "+t+" to "+i),this._mediaSource.duration=i),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},e.prototype._doRemoveRanges=function(){for(var e in this._pendingRemoveRanges)if(this._sourceBuffers[e]&&!this._sourceBuffers[e].updating)for(var t=this._sourceBuffers[e],i=this._pendingRemoveRanges[e];i.length&&!t.updating;){var n=i.shift();t.remove(n.start,n.end)}},e.prototype._doAppendSegments=function(){var e=this._pendingSegments;for(var t in e)if(this._sourceBuffers[t]&&!this._sourceBuffers[t].updating&&e[t].length>0){var i=e[t].shift();if(i.timestampOffset){var n=this._sourceBuffers[t].timestampOffset,r=i.timestampOffset/1e3;Math.abs(n-r)>.1&&(o.default.v(this.TAG,"Update MPEG audio timestampOffset from "+n+" to "+r),this._sourceBuffers[t].timestampOffset=r),delete i.timestampOffset}if(!i.data||0===i.data.byteLength)continue;try{this._sourceBuffers[t].appendBuffer(i.data),this._isBufferFull=!1,"video"===t&&i.hasOwnProperty("info")&&this._idrList.appendArray(i.info.syncPoints)}catch(s){this._pendingSegments[t].unshift(i),22===s.code?(this._isBufferFull||this._emitter.emit(a.default.BUFFER_FULL),this._isBufferFull=!0):(o.default.e(this.TAG,s.message),this._emitter.emit(a.default.ERROR,{code:s.code,msg:s.message}))}}},e.prototype._onSourceOpen=function(){if(o.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var e=this._pendingSourceBufferInit;e.length;){var t=e.shift();this.appendInitSegment(t,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(a.default.SOURCE_OPEN)},e.prototype._onSourceEnded=function(){o.default.v(this.TAG,"MediaSource onSourceEnded")},e.prototype._onSourceClose=function(){o.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&null!=this.e&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},e.prototype._hasPendingSegments=function(){var e=this._pendingSegments;return e.video.length>0||e.audio.length>0},e.prototype._hasPendingRemoveRanges=function(){var e=this._pendingRemoveRanges;return e.video.length>0||e.audio.length>0},e.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(a.default.UPDATE_END)},e.prototype._onSourceBufferError=function(e){o.default.e(this.TAG,"SourceBuffer Error: "+e)},e}();t.default=c},"./src/core/mse-events.js":function(e,t,i){i.r(t),t.default={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"}},"./src/core/transmuxer.js":function(e,t,i){i.r(t);var n=i("./node_modules/events/events.js"),r=i.n(n),o=i("./node_modules/webworkify-webpack/index.js"),s=i.n(o),a=i("./src/utils/logger.js"),l=i("./src/utils/logging-control.js"),u=i("./src/core/transmuxing-controller.js"),c=i("./src/core/transmuxing-events.js"),h=i("./src/core/media-info.js"),d=function(){function e(e,t){if(this.TAG="Transmuxer",this._emitter=new(r()),t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=s()("./src/core/transmuxing-worker.js"),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},l.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:l.default.getConfig()})}catch(n){a.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new u.default(e,t)}else this._controller=new u.default(e,t);if(this._controller){var i=this._controller;i.on(c.default.IO_ERROR,this._onIOError.bind(this)),i.on(c.default.DEMUX_ERROR,this._onDemuxError.bind(this)),i.on(c.default.INIT_SEGMENT,this._onInitSegment.bind(this)),i.on(c.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),i.on(c.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),i.on(c.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),i.on(c.default.MEDIA_INFO,this._onMediaInfo.bind(this)),i.on(c.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),i.on(c.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),i.on(c.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),i.on(c.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return e.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),l.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.hasWorker=function(){return null!=this._worker},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(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},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(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(c.default.INIT_SEGMENT,e,t)}))},e.prototype._onMediaSegment=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(c.default.MEDIA_SEGMENT,e,t)}))},e.prototype._onLoadingComplete=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(c.default.LOADING_COMPLETE)}))},e.prototype._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then((function(){e._emitter.emit(c.default.RECOVERED_EARLY_EOF)}))},e.prototype._onMediaInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(c.default.MEDIA_INFO,e)}))},e.prototype._onMetaDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(c.default.METADATA_ARRIVED,e)}))},e.prototype._onScriptDataArrived=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(c.default.SCRIPTDATA_ARRIVED,e)}))},e.prototype._onStatisticsInfo=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(c.default.STATISTICS_INFO,e)}))},e.prototype._onIOError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(c.default.IO_ERROR,e,t)}))},e.prototype._onDemuxError=function(e,t){var i=this;Promise.resolve().then((function(){i._emitter.emit(c.default.DEMUX_ERROR,e,t)}))},e.prototype._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then((function(){t._emitter.emit(c.default.RECOMMEND_SEEKPOINT,e)}))},e.prototype._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},e.prototype._onWorkerMessage=function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case c.default.INIT_SEGMENT:case c.default.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case c.default.LOADING_COMPLETE:case c.default.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case c.default.MEDIA_INFO:Object.setPrototypeOf(i,h.default.prototype),this._emitter.emit(t.msg,i);break;case c.default.METADATA_ARRIVED:case c.default.SCRIPTDATA_ARRIVED:case c.default.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case c.default.IO_ERROR:case c.default.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case c.default.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":a.default.emitter.emit("log",i.type,i.logcat)}},e}();t.default=d},"./src/core/transmuxing-controller.js":function(e,t,i){i.r(t);var n=i("./node_modules/events/events.js"),r=i.n(n),o=i("./src/utils/logger.js"),s=i("./src/utils/browser.js"),a=i("./src/core/media-info.js"),l=i("./src/demux/flv-demuxer.js"),u=i("./src/remux/mp4-remuxer.js"),c=i("./src/demux/demux-errors.js"),h=i("./src/io/io-controller.js"),d=i("./src/core/transmuxing-events.js"),p=function(){function e(e,t){this.TAG="TransmuxingController",this._emitter=new(r()),this._config=t,e.segments||(e.segments=[{duration:e.duration,filesize:e.filesize,url:e.url}]),"boolean"!=typeof e.cors&&(e.cors=!0),"boolean"!=typeof e.withCredentials&&(e.withCredentials=!1),this._mediaDataSource=e,this._currentSegmentIndex=0;var i=0;this._mediaDataSource.segments.forEach((function(n){n.timestampBase=i,i+=n.duration,n.cors=e.cors,n.withCredentials=e.withCredentials,t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy)})),isNaN(i)||this._mediaDataSource.duration===i||(this._mediaDataSource.duration=i),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return e.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},e.prototype.on=function(e,t){this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},e.prototype._loadSegment=function(e,t){this._currentSegmentIndex=e;var i=this._mediaDataSource.segments[e],n=this._ioctl=new h.default(i,this._config,e);n.onError=this._onIOException.bind(this),n.onSeeked=this._onIOSeeked.bind(this),n.onComplete=this._onIOComplete.bind(this),n.onRedirect=this._onIORedirect.bind(this),n.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),t?this._demuxer.bindDataSource(this._ioctl):n.onDataArrival=this._onInitChunkArrival.bind(this),n.open(t)},e.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},e.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},e.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},e.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},e.prototype.seek=function(e){if(null!=this._mediaInfo&&this._mediaInfo.isSeekable()){var t=this._searchSegmentIndexContains(e);if(t===this._currentSegmentIndex){var i=this._mediaInfo.segments[t];if(null==i)this._pendingSeekTime=e;else{var n=i.getNearestKeyframe(e);this._remuxer.seek(n.milliseconds),this._ioctl.seek(n.fileposition),this._pendingResolveSeekPoint=n.milliseconds}}else{var r=this._mediaInfo.segments[t];null==r?(this._pendingSeekTime=e,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(t)):(n=r.getNearestKeyframe(e),this._internalAbort(),this._remuxer.seek(e),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[t].timestampBase,this._loadSegment(t,n.fileposition),this._pendingResolveSeekPoint=n.milliseconds,this._reportSegmentMediaInfo(t))}this._enableStatisticsReporter()}},e.prototype._searchSegmentIndexContains=function(e){for(var t=this._mediaDataSource.segments,i=t.length-1,n=0;n<t.length;n++)if(e<t[n].timestampBase){i=n-1;break}return i},e.prototype._onInitChunkArrival=function(e,t){var i=this,n=null,r=0;if(t>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,r=this._demuxer.parseChunks(e,t);else if((n=l.default.probe(e)).match){this._demuxer=new l.default(n,this._config),this._remuxer||(this._remuxer=new u.default(this._config));var s=this._mediaDataSource;null==s.duration||isNaN(s.duration)||(this._demuxer.overridedDuration=s.duration),"boolean"==typeof s.hasAudio&&(this._demuxer.overridedHasAudio=s.hasAudio),"boolean"==typeof s.hasVideo&&(this._demuxer.overridedHasVideo=s.hasVideo),this._demuxer.timestampBase=s.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(e,t)}else n=null,o.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then((function(){i._internalAbort()})),this._emitter.emit(d.default.DEMUX_ERROR,c.default.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),r=0;return r},e.prototype._onMediaInfo=function(e){var t=this;null==this._mediaInfo&&(this._mediaInfo=Object.assign({},e),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,a.default.prototype));var i=Object.assign({},e);Object.setPrototypeOf(i,a.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=i,this._reportSegmentMediaInfo(this._currentSegmentIndex),null!=this._pendingSeekTime&&Promise.resolve().then((function(){var e=t._pendingSeekTime;t._pendingSeekTime=null,t.seek(e)}))},e.prototype._onMetaDataArrived=function(e){this._emitter.emit(d.default.METADATA_ARRIVED,e)},e.prototype._onScriptDataArrived=function(e){this._emitter.emit(d.default.SCRIPTDATA_ARRIVED,e)},e.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},e.prototype._onIOComplete=function(e){var t=e+1;t<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(t)):(this._remuxer.flushStashedSamples(),this._emitter.emit(d.default.LOADING_COMPLETE),this._disableStatisticsReporter())},e.prototype._onIORedirect=function(e){var t=this._ioctl.extraData;this._mediaDataSource.segments[t].redirectedURL=e},e.prototype._onIORecoveredEarlyEof=function(){this._emitter.emit(d.default.RECOVERED_EARLY_EOF)},e.prototype._onIOException=function(e,t){o.default.e(this.TAG,"IOException: type = "+e+", code = "+t.code+", msg = "+t.msg),this._emitter.emit(d.default.IO_ERROR,e,t),this._disableStatisticsReporter()},e.prototype._onDemuxException=function(e,t){o.default.e(this.TAG,"DemuxException: type = "+e+", info = "+t),this._emitter.emit(d.default.DEMUX_ERROR,e,t)},e.prototype._onRemuxerInitSegmentArrival=function(e,t){this._emitter.emit(d.default.INIT_SEGMENT,e,t)},e.prototype._onRemuxerMediaSegmentArrival=function(e,t){if(null==this._pendingSeekTime&&(this._emitter.emit(d.default.MEDIA_SEGMENT,e,t),null!=this._pendingResolveSeekPoint&&"video"===e)){var i=t.info.syncPoints,n=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,s.default.safari&&i.length>0&&i[0].originalDts===n&&(n=i[0].pts),this._emitter.emit(d.default.RECOMMEND_SEEKPOINT,n)}},e.prototype._enableStatisticsReporter=function(){null==this._statisticsReporter&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},e.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype._reportSegmentMediaInfo=function(e){var t=this._mediaInfo.segments[e],i=Object.assign({},t);i.duration=this._mediaInfo.duration,i.segmentCount=this._mediaInfo.segmentCount,delete i.segments,delete i.keyframesIndex,this._emitter.emit(d.default.MEDIA_INFO,i)},e.prototype._reportStatisticsInfo=function(){var e={};e.url=this._ioctl.currentURL,e.hasRedirect=this._ioctl.hasRedirect,e.hasRedirect&&(e.redirectedURL=this._ioctl.currentRedirectedURL),e.speed=this._ioctl.currentSpeed,e.loaderType=this._ioctl.loaderType,e.currentSegmentIndex=this._currentSegmentIndex,e.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(d.default.STATISTICS_INFO,e)},e}();t.default=p},"./src/core/transmuxing-events.js":function(e,t,i){i.r(t),t.default={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"}},"./src/core/transmuxing-worker.js":function(e,t,i){i.r(t);var n=i("./src/utils/logging-control.js"),r=i("./src/utils/polyfill.js"),o=i("./src/core/transmuxing-controller.js"),s=i("./src/core/transmuxing-events.js");t.default=function(e){var t=null,i=function(t,i){e.postMessage({msg:"logcat_callback",data:{type:t,logcat:i}})}.bind(this);function a(t,i){var n={msg:s.default.INIT_SEGMENT,data:{type:t,data:i}};e.postMessage(n,[i.data])}function l(t,i){var n={msg:s.default.MEDIA_SEGMENT,data:{type:t,data:i}};e.postMessage(n,[i.data])}function u(){var t={msg:s.default.LOADING_COMPLETE};e.postMessage(t)}function c(){var t={msg:s.default.RECOVERED_EARLY_EOF};e.postMessage(t)}function h(t){var i={msg:s.default.MEDIA_INFO,data:t};e.postMessage(i)}function d(t){var i={msg:s.default.METADATA_ARRIVED,data:t};e.postMessage(i)}function p(t){var i={msg:s.default.SCRIPTDATA_ARRIVED,data:t};e.postMessage(i)}function f(t){var i={msg:s.default.STATISTICS_INFO,data:t};e.postMessage(i)}function m(t,i){e.postMessage({msg:s.default.IO_ERROR,data:{type:t,info:i}})}function g(t,i){e.postMessage({msg:s.default.DEMUX_ERROR,data:{type:t,info:i}})}function v(t){e.postMessage({msg:s.default.RECOMMEND_SEEKPOINT,data:t})}r.default.install(),e.addEventListener("message",(function(r){switch(r.data.cmd){case"init":(t=new o.default(r.data.param[0],r.data.param[1])).on(s.default.IO_ERROR,m.bind(this)),t.on(s.default.DEMUX_ERROR,g.bind(this)),t.on(s.default.INIT_SEGMENT,a.bind(this)),t.on(s.default.MEDIA_SEGMENT,l.bind(this)),t.on(s.default.LOADING_COMPLETE,u.bind(this)),t.on(s.default.RECOVERED_EARLY_EOF,c.bind(this)),t.on(s.default.MEDIA_INFO,h.bind(this)),t.on(s.default.METADATA_ARRIVED,d.bind(this)),t.on(s.default.SCRIPTDATA_ARRIVED,p.bind(this)),t.on(s.default.STATISTICS_INFO,f.bind(this)),t.on(s.default.RECOMMEND_SEEKPOINT,v.bind(this));break;case"destroy":t&&(t.destroy(),t=null),e.postMessage({msg:"destroyed"});break;case"start":t.start();break;case"stop":t.stop();break;case"seek":t.seek(r.data.param);break;case"pause":t.pause();break;case"resume":t.resume();break;case"logging_config":var y=r.data.param;n.default.applyConfig(y),!0===y.enableCallback?n.default.addLogListener(i):n.default.removeLogListener(i)}}))}},"./src/demux/amf-parser.js":function(e,t,i){i.r(t);var n,r=i("./src/utils/logger.js"),o=i("./src/utils/utf8-conv.js"),s=i("./src/utils/exception.js"),a=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0]),l=function(){function e(){}return e.parseScriptData=function(t,i,n){var o={};try{var s=e.parseValue(t,i,n),a=e.parseValue(t,i+s.size,n-s.size);o[s.data]=a.data}catch($v){r.default.e("AMF",$v.toString())}return o},e.parseObject=function(t,i,n){if(n<3)throw new s.IllegalStateException("Data not enough when parse ScriptDataObject");var r=e.parseString(t,i,n),o=e.parseValue(t,i+r.size,n-r.size),a=o.objectEnd;return{data:{name:r.data,value:o.data},size:r.size+o.size,objectEnd:a}},e.parseVariable=function(t,i,n){return e.parseObject(t,i,n)},e.parseString=function(e,t,i){if(i<2)throw new s.IllegalStateException("Data not enough when parse String");var n=new DataView(e,t,i).getUint16(0,!a);return{data:n>0?(0,o.default)(new Uint8Array(e,t+2,n)):"",size:2+n}},e.parseLongString=function(e,t,i){if(i<4)throw new s.IllegalStateException("Data not enough when parse LongString");var n=new DataView(e,t,i).getUint32(0,!a);return{data:n>0?(0,o.default)(new Uint8Array(e,t+4,n)):"",size:4+n}},e.parseDate=function(e,t,i){if(i<10)throw new s.IllegalStateException("Data size invalid when parse Date");var n=new DataView(e,t,i),r=n.getFloat64(0,!a),o=n.getInt16(8,!a);return{data:new Date(r+=60*o*1e3),size:10}},e.parseValue=function(t,i,n){if(n<1)throw new s.IllegalStateException("Data not enough when parse Value");var o,l=new DataView(t,i,n),u=1,c=l.getUint8(0),h=!1;try{switch(c){case 0:o=l.getFloat64(1,!a),u+=8;break;case 1:o=!!l.getUint8(1),u+=1;break;case 2:var d=e.parseString(t,i+1,n-1);o=d.data,u+=d.size;break;case 3:o={};var p=0;for(9==(16777215&l.getUint32(n-4,!a))&&(p=3);u<n-4;){var f=e.parseObject(t,i+u,n-u-p);if(f.objectEnd)break;o[f.data.name]=f.data.value,u+=f.size}u<=n-3&&9==(16777215&l.getUint32(u-1,!a))&&(u+=3);break;case 8:for(o={},u+=4,p=0,9==(16777215&l.getUint32(n-4,!a))&&(p=3);u<n-8;){var m=e.parseVariable(t,i+u,n-u-p);if(m.objectEnd)break;o[m.data.name]=m.data.value,u+=m.size}u<=n-3&&9==(16777215&l.getUint32(u-1,!a))&&(u+=3);break;case 9:o=void 0,u=1,h=!0;break;case 10:o=[];var g=l.getUint32(1,!a);u+=4;for(var v=0;v<g;v++){var y=e.parseValue(t,i+u,n-u);o.push(y.data),u+=y.size}break;case 11:var _=e.parseDate(t,i+1,n-1);o=_.data,u+=_.size;break;case 12:var b=e.parseString(t,i+1,n-1);o=b.data,u+=b.size;break;default:u=n,r.default.w("AMF","Unsupported AMF value type "+c)}}catch($v){r.default.e("AMF",$v.toString())}return{data:o,size:u,objectEnd:h}},e}();t.default=l},"./src/demux/demux-errors.js":function(e,t,i){i.r(t),t.default={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"}},"./src/demux/exp-golomb.js":function(e,t,i){i.r(t);var n=i("./src/utils/exception.js"),r=function(){function e(e){this.TAG="ExpGolomb",this._buffer=e,this._buffer_index=0,this._total_bytes=e.byteLength,this._total_bits=8*e.byteLength,this._current_word=0,this._current_word_bits_left=0}return e.prototype.destroy=function(){this._buffer=null},e.prototype._fillCurrentWord=function(){var e=this._total_bytes-this._buffer_index;if(e<=0)throw new n.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");var t=Math.min(4,e),i=new Uint8Array(4);i.set(this._buffer.subarray(this._buffer_index,this._buffer_index+t)),this._current_word=new DataView(i.buffer).getUint32(0,!1),this._buffer_index+=t,this._current_word_bits_left=8*t},e.prototype.readBits=function(e){if(e>32)throw new n.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(e<=this._current_word_bits_left){var t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}var i=this._current_word_bits_left?this._current_word:0;i>>>=32-this._current_word_bits_left;var r=e-this._current_word_bits_left;this._fillCurrentWord();var o=Math.min(r,this._current_word_bits_left),s=this._current_word>>>32-o;return this._current_word<<=o,this._current_word_bits_left-=o,i=i<<o|s},e.prototype.readBool=function(){return 1===this.readBits(1)},e.prototype.readByte=function(){return this.readBits(8)},e.prototype._skipLeadingZero=function(){var e;for(e=0;e<this._current_word_bits_left;e++)if(0!=(this._current_word&2147483648>>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()},e.prototype.readUEG=function(){var e=this._skipLeadingZero();return this.readBits(e+1)-1},e.prototype.readSEG=function(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)},e}();t.default=r},"./src/demux/flv-demuxer.js":function(e,t,i){i.r(t);var n=i("./src/utils/logger.js"),r=i("./src/demux/amf-parser.js"),o=i("./src/demux/sps-parser.js"),s=i("./src/demux/demux-errors.js"),a=i("./src/core/media-info.js"),l=i("./src/utils/exception.js"),u=function(){function e(e,t){var i;this.TAG="FLVDemuxer",this._config=t,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=e.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=e.hasAudioTrack,this._hasVideo=e.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new a.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=(i=new ArrayBuffer(2),new DataView(i).setInt16(0,256,!0),256===new Int16Array(i)[0])}return e.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},e.probe=function(e){var t=new Uint8Array(e),i={match:!1};if(70!==t[0]||76!==t[1]||86!==t[2]||1!==t[3])return i;var n,r,o=(4&t[4])>>>2!=0,s=0!=(1&t[4]),a=(n=t)[r=5]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3];return a<9?i:{match:!0,consumed:a,dataOffset:a,hasAudioTrack:o,hasVideoTrack:s}},e.prototype.bindDataSource=function(e){return e.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(e.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(e){this._onTrackMetadata=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(e){this._onMediaInfo=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(e){this._onMetaDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(e){this._onScriptDataArrived=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(e){this._onDataAvailable=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(e){this._timestampBase=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedDuration",{get:function(){return this._duration},set:function(e){this._durationOverrided=!0,this._duration=e,this._mediaInfo.duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasAudio",{set:function(e){this._hasAudioFlagOverrided=!0,this._hasAudio=e,this._mediaInfo.hasAudio=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overridedHasVideo",{set:function(e){this._hasVideoFlagOverrided=!0,this._hasVideo=e,this._mediaInfo.hasVideo=e},enumerable:!1,configurable:!0}),e.prototype.resetMediaInfo=function(){this._mediaInfo=new a.default},e.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!(this._hasAudio||!this._hasVideo)&&this._videoInitialMetadataDispatched},e.prototype.parseChunks=function(t,i){if(!(this._onError&&this._onMediaInfo&&this._onTrackMetadata&&this._onDataAvailable))throw new l.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var r=0,o=this._littleEndian;if(0===i){if(!(t.byteLength>13))return 0;r=e.probe(t).dataOffset}for(this._firstParse&&(this._firstParse=!1,i+r!==this._dataOffset&&n.default.w(this.TAG,"First time parsing but chunk byteStart invalid!"),0!==(s=new DataView(t,r)).getUint32(0,!o)&&n.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),r+=4);r<t.byteLength;){this._dispatch=!0;var s=new DataView(t,r);if(r+11+4>t.byteLength)break;var a=s.getUint8(0),u=16777215&s.getUint32(0,!o);if(r+11+u+4>t.byteLength)break;if(8===a||9===a||18===a){var c=s.getUint8(4),h=s.getUint8(5),d=s.getUint8(6)|h<<8|c<<16|s.getUint8(7)<<24;0!=(16777215&s.getUint32(7,!o))&&n.default.w(this.TAG,"Meet tag which has StreamID != 0!");var p=r+11;switch(a){case 8:this._parseAudioData(t,p,u,d);break;case 9:this._parseVideoData(t,p,u,d,i+r);break;case 18:this._parseScriptData(t,p,u)}var f=s.getUint32(11+u,!o);f!==11+u&&n.default.w(this.TAG,"Invalid PrevTagSize "+f),r+=11+u+4}else n.default.w(this.TAG,"Unsupported tag type "+a+", skipped"),r+=11+u+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),r},e.prototype._parseScriptData=function(e,t,i){var o=r.default.parseScriptData(e,t,i);if(o.hasOwnProperty("onMetaData")){if(null==o.onMetaData||"object"!=typeof o.onMetaData)return void n.default.w(this.TAG,"Invalid onMetaData structure!");this._metadata&&n.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=o;var s=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},s)),"boolean"==typeof s.hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=s.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),"boolean"==typeof s.hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=s.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),"number"==typeof s.audiodatarate&&(this._mediaInfo.audioDataRate=s.audiodatarate),"number"==typeof s.videodatarate&&(this._mediaInfo.videoDataRate=s.videodatarate),"number"==typeof s.width&&(this._mediaInfo.width=s.width),"number"==typeof s.height&&(this._mediaInfo.height=s.height),"number"==typeof s.duration){if(!this._durationOverrided){var a=Math.floor(s.duration*this._timescale);this._duration=a,this._mediaInfo.duration=a}}else this._mediaInfo.duration=0;if("number"==typeof s.framerate){var l=Math.floor(1e3*s.framerate);if(l>0){var u=l/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=u,this._referenceFrameRate.fps_num=l,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=u}}if("object"==typeof s.keyframes){this._mediaInfo.hasKeyframesIndex=!0;var c=s.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(c),s.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=s,n.default.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(o).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},o))},e.prototype._parseKeyframesIndex=function(e){for(var t=[],i=[],n=1;n<e.times.length;n++){var r=this._timestampBase+Math.floor(1e3*e.times[n]);t.push(r),i.push(e.filepositions[n])}return{times:t,filepositions:i}},e.prototype._parseAudioData=function(e,t,i,r){if(i<=1)n.default.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");else if(!0!==this._hasAudioFlagOverrided||!1!==this._hasAudio){this._littleEndian;var o=new DataView(e,t,i).getUint8(0),a=o>>>4;if(2===a||10===a){var l=0,u=(12&o)>>>2;if(u>=0&&u<=4){l=this._flvSoundRateTable[u];var c=1&o,h=this._audioMetadata,d=this._audioTrack;if(h||(!1===this._hasAudio&&!1===this._hasAudioFlagOverrided&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),(h=this._audioMetadata={}).type="audio",h.id=d.id,h.timescale=this._timescale,h.duration=this._duration,h.audioSampleRate=l,h.channelCount=0===c?1:2),10===a){var p=this._parseAACAudioData(e,t+1,i-1);if(null==p)return;if(0===p.packetType){h.config&&n.default.w(this.TAG,"Found another AudioSpecificConfig!");var f=p.data;h.audioSampleRate=f.samplingRate,h.channelCount=f.channelCount,h.codec=f.codec,h.originalCodec=f.originalCodec,h.config=f.config,h.refSampleDuration=1024/h.audioSampleRate*h.timescale,n.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",h),(v=this._mediaInfo).audioCodec=h.originalCodec,v.audioSampleRate=h.audioSampleRate,v.audioChannelCount=h.channelCount,v.hasVideo?null!=v.videoCodec&&(v.mimeType='video/x-flv; codecs="'+v.videoCodec+","+v.audioCodec+'"'):v.mimeType='video/x-flv; codecs="'+v.audioCodec+'"',v.isComplete()&&this._onMediaInfo(v)}else if(1===p.packetType){var m=this._timestampBase+r,g={unit:p.data,length:p.data.byteLength,dts:m,pts:m};d.samples.push(g),d.length+=p.data.length}else n.default.e(this.TAG,"Flv: Unsupported AAC data type "+p.packetType)}else if(2===a){if(!h.codec){var v;if(null==(f=this._parseMP3AudioData(e,t+1,i-1,!0)))return;h.audioSampleRate=f.samplingRate,h.channelCount=f.channelCount,h.codec=f.codec,h.originalCodec=f.originalCodec,h.refSampleDuration=1152/h.audioSampleRate*h.timescale,n.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",h),(v=this._mediaInfo).audioCodec=h.codec,v.audioSampleRate=h.audioSampleRate,v.audioChannelCount=h.channelCount,v.audioDataRate=f.bitRate,v.hasVideo?null!=v.videoCodec&&(v.mimeType='video/x-flv; codecs="'+v.videoCodec+","+v.audioCodec+'"'):v.mimeType='video/x-flv; codecs="'+v.audioCodec+'"',v.isComplete()&&this._onMediaInfo(v)}var y=this._parseMP3AudioData(e,t+1,i-1,!1);if(null==y)return;m=this._timestampBase+r;var _={unit:y,length:y.byteLength,dts:m,pts:m};d.samples.push(_),d.length+=y.length}}else this._onError(s.default.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+u)}else this._onError(s.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+a)}},e.prototype._parseAACAudioData=function(e,t,i){if(!(i<=1)){var r={},o=new Uint8Array(e,t,i);return r.packetType=o[0],0===o[0]?r.data=this._parseAACAudioSpecificConfig(e,t+1,i-1):r.data=o.subarray(1),r}n.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!")},e.prototype._parseAACAudioSpecificConfig=function(e,t,i){var n,r,o=new Uint8Array(e,t,i),a=null,l=0,u=null;if(l=n=o[0]>>>3,(r=(7&o[0])<<1|o[1]>>>7)<0||r>=this._mpegSamplingRates.length)this._onError(s.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");else{var c=this._mpegSamplingRates[r],h=(120&o[1])>>>3;if(!(h<0||h>=8)){5===l&&(u=(7&o[1])<<1|o[2]>>>7,o[2]);var d=self.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?r>=6?(l=5,a=new Array(4),u=r-3):(l=2,a=new Array(2),u=r):-1!==d.indexOf("android")?(l=2,a=new Array(2),u=r):(l=5,u=r,a=new Array(4),r>=6?u=r-3:1===h&&(l=2,a=new Array(2),u=r)),a[0]=l<<3,a[0]|=(15&r)>>>1,a[1]=(15&r)<<7,a[1]|=(15&h)<<3,5===l&&(a[1]|=(15&u)>>>1,a[2]=(1&u)<<7,a[2]|=8,a[3]=0),{config:a,samplingRate:c,channelCount:h,codec:"mp4a.40."+l,originalCodec:"mp4a.40."+n}}this._onError(s.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration")}},e.prototype._parseMP3AudioData=function(e,t,i,r){if(!(i<4)){this._littleEndian;var o=new Uint8Array(e,t,i),s=null;if(r){if(255!==o[0])return;var a=o[1]>>>3&3,l=(6&o[1])>>1,u=(240&o[2])>>>4,c=(12&o[2])>>>2,h=3!=(o[3]>>>6&3)?2:1,d=0,p=0;switch(a){case 0:d=this._mpegAudioV25SampleRateTable[c];break;case 2:d=this._mpegAudioV20SampleRateTable[c];break;case 3:d=this._mpegAudioV10SampleRateTable[c]}switch(l){case 1:u<this._mpegAudioL3BitRateTable.length&&(p=this._mpegAudioL3BitRateTable[u]);break;case 2:u<this._mpegAudioL2BitRateTable.length&&(p=this._mpegAudioL2BitRateTable[u]);break;case 3:u<this._mpegAudioL1BitRateTable.length&&(p=this._mpegAudioL1BitRateTable[u])}s={bitRate:p,samplingRate:d,channelCount:h,codec:"mp3",originalCodec:"mp3"}}else s=o;return s}n.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!")},e.prototype._parseVideoData=function(e,t,i,r,o){if(i<=1)n.default.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");else if(!0!==this._hasVideoFlagOverrided||!1!==this._hasVideo){var a=new Uint8Array(e,t,i)[0],l=(240&a)>>>4,u=15&a;7===u?this._parseAVCVideoPacket(e,t+1,i-1,r,o,l):this._onError(s.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+u)}},e.prototype._parseAVCVideoPacket=function(e,t,i,r,o,a){if(i<4)n.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");else{var l=this._littleEndian,u=new DataView(e,t,i),c=u.getUint8(0),h=(16777215&u.getUint32(0,!l))<<8>>8;if(0===c)this._parseAVCDecoderConfigurationRecord(e,t+4,i-4);else if(1===c)this._parseAVCVideoData(e,t+4,i-4,r,o,a,h);else if(2!==c)return void this._onError(s.default.FORMAT_ERROR,"Flv: Invalid video packet type "+c)}},e.prototype._parseAVCDecoderConfigurationRecord=function(e,t,i){if(i<7)n.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");else{var r=this._videoMetadata,a=this._videoTrack,l=this._littleEndian,u=new DataView(e,t,i);r?void 0!==r.avcc&&n.default.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(!1===this._hasVideo&&!1===this._hasVideoFlagOverrided&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),(r=this._videoMetadata={}).type="video",r.id=a.id,r.timescale=this._timescale,r.duration=this._duration);var c=u.getUint8(0),h=u.getUint8(1);if(u.getUint8(2),u.getUint8(3),1===c&&0!==h)if(this._naluLengthSize=1+(3&u.getUint8(4)),3===this._naluLengthSize||4===this._naluLengthSize){var d=31&u.getUint8(5);if(0!==d){d>1&&n.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+d);for(var p=6,f=0;f<d;f++){var m=u.getUint16(p,!l);if(p+=2,0!==m){var g=new Uint8Array(e,t+p,m);p+=m;var v=o.default.parseSPS(g);if(0===f){r.codecWidth=v.codec_size.width,r.codecHeight=v.codec_size.height,r.presentWidth=v.present_size.width,r.presentHeight=v.present_size.height,r.profile=v.profile_string,r.level=v.level_string,r.bitDepth=v.bit_depth,r.chromaFormat=v.chroma_format,r.sarRatio=v.sar_ratio,r.frameRate=v.frame_rate,!1!==v.frame_rate.fixed&&0!==v.frame_rate.fps_num&&0!==v.frame_rate.fps_den||(r.frameRate=this._referenceFrameRate);var y=r.frameRate.fps_den,_=r.frameRate.fps_num;r.refSampleDuration=r.timescale*(y/_);for(var b=g.subarray(1,4),C="avc1.",T=0;T<3;T++){var w=b[T].toString(16);w.length<2&&(w="0"+w),C+=w}r.codec=C;var E=this._mediaInfo;E.width=r.codecWidth,E.height=r.codecHeight,E.fps=r.frameRate.fps,E.profile=r.profile,E.level=r.level,E.refFrames=v.ref_frames,E.chromaFormat=v.chroma_format_string,E.sarNum=r.sarRatio.width,E.sarDen=r.sarRatio.height,E.videoCodec=C,E.hasAudio?null!=E.audioCodec&&(E.mimeType='video/x-flv; codecs="'+E.videoCodec+","+E.audioCodec+'"'):E.mimeType='video/x-flv; codecs="'+E.videoCodec+'"',E.isComplete()&&this._onMediaInfo(E)}}}var S=u.getUint8(p);if(0!==S){for(S>1&&n.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+S),p++,f=0;f<S;f++)m=u.getUint16(p,!l),p+=2,0!==m&&(p+=m);r.avcc=new Uint8Array(i),r.avcc.set(new Uint8Array(e,t,i),0),n.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",r)}else this._onError(s.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS")}else this._onError(s.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS")}else this._onError(s.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));else this._onError(s.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord")}},e.prototype._parseAVCVideoData=function(e,t,i,r,o,s,a){for(var l=this._littleEndian,u=new DataView(e,t,i),c=[],h=0,d=0,p=this._naluLengthSize,f=this._timestampBase+r,m=1===s;d<i;){if(d+4>=i){n.default.w(this.TAG,"Malformed Nalu near timestamp "+f+", offset = "+d+", dataSize = "+i);break}var g=u.getUint32(d,!l);if(3===p&&(g>>>=8),g>i-p)return void n.default.w(this.TAG,"Malformed Nalus near timestamp "+f+", NaluSize > DataSize!");var v=31&u.getUint8(d+p);5===v&&(m=!0);var y=new Uint8Array(e,t+d,p+g),_={type:v,data:y};c.push(_),h+=y.byteLength,d+=p+g}if(c.length){var b=this._videoTrack,C={units:c,length:h,isKeyframe:m,dts:f,cts:a,pts:f+a};m&&(C.fileposition=o),b.samples.push(C),b.length+=h}},e}();t.default=u},"./src/demux/sps-parser.js":function(e,t,i){i.r(t);var n=i("./src/demux/exp-golomb.js"),r=function(){function e(){}return e._ebsp2rbsp=function(e){for(var t=e,i=t.byteLength,n=new Uint8Array(i),r=0,o=0;o<i;o++)o>=2&&3===t[o]&&0===t[o-1]&&0===t[o-2]||(n[r]=t[o],r++);return new Uint8Array(n.buffer,0,r)},e.parseSPS=function(t){var i=e._ebsp2rbsp(t),r=new n.default(i);r.readByte();var o=r.readByte();r.readByte();var s=r.readByte();r.readUEG();var a=e.getProfileString(o),l=e.getLevelString(s),u=1,c=420,h=8;if((100===o||110===o||122===o||244===o||44===o||83===o||86===o||118===o||128===o||138===o||144===o)&&(3===(u=r.readUEG())&&r.readBits(1),u<=3&&(c=[0,420,422,444][u]),h=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool()))for(var d=3!==u?8:12,p=0;p<d;p++)r.readBool()&&(p<6?e._skipScalingList(r,16):e._skipScalingList(r,64));r.readUEG();var f=r.readUEG();if(0===f)r.readUEG();else if(1===f){r.readBits(1),r.readSEG(),r.readSEG();var m=r.readUEG();for(p=0;p<m;p++)r.readSEG()}var g=r.readUEG();r.readBits(1);var v=r.readUEG(),y=r.readUEG(),_=r.readBits(1);0===_&&r.readBits(1),r.readBits(1);var b=0,C=0,T=0,w=0;r.readBool()&&(b=r.readUEG(),C=r.readUEG(),T=r.readUEG(),w=r.readUEG());var E=1,S=1,k=0,P=!0,A=0,x=0;if(r.readBool()){if(r.readBool()){var I=r.readByte();I>0&&I<16?(E=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][I-1],S=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][I-1]):255===I&&(E=r.readByte()<<8|r.readByte(),S=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){var M=r.readBits(32),L=r.readBits(32);P=r.readBool(),k=(A=L)/(x=2*M)}}var D=1;1===E&&1===S||(D=E/S);var O=0,j=0;0===u?(O=1,j=2-_):(O=3===u?1:2,j=(1===u?2:1)*(2-_));var R=16*(v+1),N=16*(y+1)*(2-_);R-=(b+C)*O,N-=(T+w)*j;var U=Math.ceil(R*D);return r.destroy(),r=null,{profile_string:a,level_string:l,bit_depth:h,ref_frames:g,chroma_format:c,chroma_format_string:e.getChromaFormatString(c),frame_rate:{fixed:P,fps:k,fps_den:x,fps_num:A},sar_ratio:{width:E,height:S},codec_size:{width:R,height:N},present_size:{width:U,height:N}}},e._skipScalingList=function(e,t){for(var i=8,n=8,r=0;r<t;r++)0!==n&&(n=(i+e.readSEG()+256)%256),i=0===n?i:n},e.getProfileString=function(e){switch(e){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"}},e.getLevelString=function(e){return(e/10).toFixed(1)},e.getChromaFormatString=function(e){switch(e){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}},e}();t.default=r},"./src/flv.js":function(e,t,i){i.r(t);var n=i("./src/utils/polyfill.js"),r=i("./src/core/features.js"),o=i("./src/io/loader.js"),s=i("./src/player/flv-player.js"),a=i("./src/player/native-player.js"),l=i("./src/player/player-events.js"),u=i("./src/player/player-errors.js"),c=i("./src/utils/logging-control.js"),h=i("./src/utils/exception.js");n.default.install();var d={createPlayer:function(e,t){var i=e;if(null==i||"object"!=typeof i)throw new h.InvalidArgumentException("MediaDataSource must be an javascript object!");if(!i.hasOwnProperty("type"))throw new h.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");switch(i.type){case"flv":return new s.default(i,t);default:return new a.default(i,t)}},isSupported:function(){return r.default.supportMSEH264Playback()},getFeatureList:function(){return r.default.getFeatureList()}};d.BaseLoader=o.BaseLoader,d.LoaderStatus=o.LoaderStatus,d.LoaderErrors=o.LoaderErrors,d.Events=l.default,d.ErrorTypes=u.ErrorTypes,d.ErrorDetails=u.ErrorDetails,d.FlvPlayer=s.default,d.NativePlayer=a.default,d.LoggingControl=c.default,Object.defineProperty(d,"version",{enumerable:!0,get:function(){return"1.6.2"}}),t.default=d},"./src/index.js":function(e,t,i){e.exports=i("./src/flv.js").default},"./src/io/fetch-stream-loader.js":function(e,t,i){i.r(t);var n,r=i("./src/utils/browser.js"),o=i("./src/io/loader.js"),s=i("./src/utils/exception.js"),a=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),l=function(e){function t(t,i){var n=e.call(this,"fetch-stream-loader")||this;return n.TAG="FetchStreamLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return a(t,e),t.isSupported=function(){try{var e=r.default.msedge&&r.default.version.minor>=15048,t=!r.default.msedge||e;return self.fetch&&self.ReadableStream&&t}catch($v){return!1}},t.prototype.destroy=function(){this.isWorking()&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){var i=this;this._dataSource=e,this._range=t;var n=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(n=e.redirectedURL);var r=this._seekHandler.getConfig(n,t),a=new self.Headers;if("object"==typeof r.headers){var l=r.headers;for(var u in l)l.hasOwnProperty(u)&&a.append(u,l[u])}var c={method:"GET",headers:a,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(var u in this._config.headers)a.append(u,this._config.headers[u]);!1===e.cors&&(c.mode="same-origin"),e.withCredentials&&(c.credentials="include"),e.referrerPolicy&&(c.referrerPolicy=e.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,c.signal=this._abortController.signal),this._status=o.LoaderStatus.kConnecting,self.fetch(r.url,c).then((function(e){if(i._requestAbort)return i._status=o.LoaderStatus.kIdle,void e.body.cancel();if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==r.url&&i._onURLRedirect){var t=i._seekHandler.removeURLParameters(e.url);i._onURLRedirect(t)}var n=e.headers.get("Content-Length");return null!=n&&(i._contentLength=parseInt(n),0!==i._contentLength&&i._onContentLengthKnown&&i._onContentLengthKnown(i._contentLength)),i._pump.call(i,e.body.getReader())}if(i._status=o.LoaderStatus.kError,!i._onError)throw new s.RuntimeException("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);i._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})})).catch((function(e){if(!i._abortController||!i._abortController.signal.aborted){if(i._status=o.LoaderStatus.kError,!i._onError)throw e;i._onError(o.LoaderErrors.EXCEPTION,{code:-1,msg:e.message})}}))},t.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==o.LoaderStatus.kBuffering||!r.default.chrome)&&this._abortController)try{this._abortController.abort()}catch($v){}},t.prototype._pump=function(e){var t=this;return e.read().then((function(i){if(i.done)if(null!==t._contentLength&&t._receivedLength<t._contentLength){t._status=o.LoaderStatus.kError;var n=o.LoaderErrors.EARLY_EOF,r={code:-1,msg:"Fetch stream meet Early-EOF"};if(!t._onError)throw new s.RuntimeException(r.msg);t._onError(n,r)}else t._status=o.LoaderStatus.kComplete,t._onComplete&&t._onComplete(t._range.from,t._range.from+t._receivedLength-1);else{if(t._abortController&&t._abortController.signal.aborted)return void(t._status=o.LoaderStatus.kComplete);if(!0===t._requestAbort)return t._status=o.LoaderStatus.kComplete,e.cancel();t._status=o.LoaderStatus.kBuffering;var a=i.value.buffer,l=t._range.from+t._receivedLength;t._receivedLength+=a.byteLength,t._onDataArrival&&t._onDataArrival(a,l,t._receivedLength),t._pump(e)}})).catch((function(e){if(t._abortController&&t._abortController.signal.aborted)t._status=o.LoaderStatus.kComplete;else if(11!==e.code||!r.default.msedge){t._status=o.LoaderStatus.kError;var i=0,n=null;if(19!==e.code&&"network error"!==e.message||!(null===t._contentLength||null!==t._contentLength&&t._receivedLength<t._contentLength)?(i=o.LoaderErrors.EXCEPTION,n={code:e.code,msg:e.message}):(i=o.LoaderErrors.EARLY_EOF,n={code:e.code,msg:"Fetch stream meet Early-EOF"}),!t._onError)throw new s.RuntimeException(n.msg);t._onError(i,n)}}))},t}(o.BaseLoader);t.default=l},"./src/io/io-controller.js":function(e,t,i){i.r(t);var n=i("./src/utils/logger.js"),r=i("./src/io/speed-sampler.js"),o=i("./src/io/loader.js"),s=i("./src/io/fetch-stream-loader.js"),a=i("./src/io/xhr-moz-chunked-loader.js"),l=i("./src/io/xhr-range-loader.js"),u=i("./src/io/websocket-loader.js"),c=i("./src/io/range-seek-handler.js"),h=i("./src/io/param-seek-handler.js"),d=i("./src/utils/exception.js"),p=function(){function e(e,t,i){this.TAG="IOController",this._config=t,this._extraData=i,this._stashInitialSize=393216,null!=t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new r.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 e.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},e.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},e.prototype.isPaused=function(){return this._paused},Object.defineProperty(e.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extraData",{get:function(){return this._extraData},set:function(e){this._extraData=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(e){this._onSeeked=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(e){this._onRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(e){this._onRecoveredEarlyEof=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasRedirect",{get:function(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSpeed",{get:function(){return this._loaderClass===l.default?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),e.prototype._selectSeekHandler=function(){var e=this._config;if("range"===e.seekType)this._seekHandler=new c.default(this._config.rangeLoadZeroStart);else if("param"===e.seekType){var t=e.seekParamStart||"bstart",i=e.seekParamEnd||"bend";this._seekHandler=new h.default(t,i)}else{if("custom"!==e.seekType)throw new d.InvalidArgumentException("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new d.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}},e.prototype._selectLoader=function(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=u.default;else if(s.default.isSupported())this._loaderClass=s.default;else if(a.default.isSupported())this._loaderClass=a.default;else{if(!l.default.isSupported())throw new d.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=l.default}},e.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(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)},e.prototype.open=function(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},e.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},e.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(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)},e.prototype.resume=function(){if(this._paused){this._paused=!1;var e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}},e.prototype.seek=function(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)},e.prototype._internalSeek=function(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;var i={from:e,to:-1};this._currentRange={from:i.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,i),this._onSeeked&&this._onSeeked()},e.prototype.updateUrl=function(e){if(!e||"string"!=typeof e||0===e.length)throw new d.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=e},e.prototype._expandBuffer=function(e){for(var t=this._stashSize;t+1048576<e;)t*=2;if((t+=1048576)!==this._bufferSize){var i=new ArrayBuffer(t);if(this._stashUsed>0){var n=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(i,0,t).set(n,0)}this._stashBuffer=i,this._bufferSize=t}},e.prototype._normalizeSpeed=function(e){var t=this._speedNormalizeList,i=t.length-1,n=0,r=0,o=i;if(e<t[0])return t[0];for(;r<=o;){if((n=r+Math.floor((o-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:o=n-1}},e.prototype._adjustStashSize=function(e){var t=0;(t=this._config.isLive||e<512?e:e>=512&&e<=1024?Math.floor(1.5*e):2*e)>8192&&(t=8192);var i=1024*t+1048576;this._bufferSize<i&&this._expandBuffer(i),this._stashSize=1024*t},e.prototype._dispatchChunks=function(e,t){return this._currentRange.to=t+e.byteLength-1,this._onDataArrival(e,t)},e.prototype._onURLRedirect=function(e){this._redirectedURL=e,this._onRedirect&&this._onRedirect(e)},e.prototype._onContentLengthKnown=function(e){e&&this._fullRequestFlag&&(this._totalLength=e,this._fullRequestFlag=!1)},e.prototype._onLoaderChunkArrival=function(e,t,i){if(!this._onDataArrival)throw new d.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");if(!this._paused){this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(e.byteLength);var n=this._speedSampler.lastSecondKBps;if(0!==n){var r=this._normalizeSpeed(n);this._speedNormalized!==r&&(this._speedNormalized=r,this._adjustStashSize(r))}if(this._enableStash)if(0===this._stashUsed&&0===this._stashByteStart&&(this._stashByteStart=t),this._stashUsed+e.byteLength<=this._stashSize)(a=new Uint8Array(this._stashBuffer,0,this._stashSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;else if(a=new Uint8Array(this._stashBuffer,0,this._bufferSize),this._stashUsed>0){var o=this._stashBuffer.slice(0,this._stashUsed);(l=this._dispatchChunks(o,this._stashByteStart))<o.byteLength?l>0&&(u=new Uint8Array(o,l),a.set(u,0),this._stashUsed=u.byteLength,this._stashByteStart+=l):(this._stashUsed=0,this._stashByteStart+=l),this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else(l=this._dispatchChunks(e,t))<e.byteLength&&((s=e.byteLength-l)>this._bufferSize&&(this._expandBuffer(s),a=new Uint8Array(this._stashBuffer,0,this._bufferSize)),a.set(new Uint8Array(e,l),0),this._stashUsed+=s,this._stashByteStart=t+l);else if(0===this._stashUsed){var s;(l=this._dispatchChunks(e,t))<e.byteLength&&((s=e.byteLength-l)>this._bufferSize&&this._expandBuffer(s),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e,l),0),this._stashUsed+=s,this._stashByteStart=t+l)}else{var a,l;if(this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength),(a=new Uint8Array(this._stashBuffer,0,this._bufferSize)).set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength,(l=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart))<this._stashUsed&&l>0){var u=new Uint8Array(this._stashBuffer,l);a.set(u,0)}this._stashUsed-=l,this._stashByteStart+=l}}},e.prototype._flushStashBuffer=function(e){if(this._stashUsed>0){var t=this._stashBuffer.slice(0,this._stashUsed),i=this._dispatchChunks(t,this._stashByteStart),r=t.byteLength-i;if(i<t.byteLength){if(!e){if(i>0){var o=new Uint8Array(this._stashBuffer,0,this._bufferSize),s=new Uint8Array(t,i);o.set(s,0),this._stashUsed=s.byteLength,this._stashByteStart+=i}return 0}n.default.w(this.TAG,r+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,r}return 0},e.prototype._onLoaderComplete=function(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},e.prototype._onLoaderError=function(e,t){switch(n.default.e(this.TAG,"Loader error, code = "+t.code+", msg = "+t.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=o.LoaderErrors.UNRECOVERABLE_EARLY_EOF),e){case o.LoaderErrors.EARLY_EOF:if(!this._config.isLive&&this._totalLength){var i=this._currentRange.to+1;return void(i<this._totalLength&&(n.default.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(i,!1)))}e=o.LoaderErrors.UNRECOVERABLE_EARLY_EOF;break;case o.LoaderErrors.UNRECOVERABLE_EARLY_EOF:case o.LoaderErrors.CONNECTING_TIMEOUT:case o.LoaderErrors.HTTP_STATUS_CODE_INVALID:case o.LoaderErrors.EXCEPTION:}if(!this._onError)throw new d.RuntimeException("IOException: "+t.msg);this._onError(e,t)},e}();t.default=p},"./src/io/loader.js":function(e,t,i){i.r(t),i.d(t,{LoaderStatus:function(){return r},LoaderErrors:function(){return o},BaseLoader:function(){return s}});var n=i("./src/utils/exception.js"),r={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},o={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"},s=function(){function e(e){this._type=e||"undefined",this._status=r.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}return e.prototype.destroy=function(){this._status=r.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null},e.prototype.isWorking=function(){return this._status===r.kConnecting||this._status===r.kBuffering},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needStashBuffer",{get:function(){return this._needStash},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onContentLengthKnown",{get:function(){return this._onContentLengthKnown},set:function(e){this._onContentLengthKnown=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onURLRedirect",{get:function(){return this._onURLRedirect},set:function(e){this._onURLRedirect=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(e){this._onDataArrival=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onError",{get:function(){return this._onError},set:function(e){this._onError=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onComplete",{get:function(){return this._onComplete},set:function(e){this._onComplete=e},enumerable:!1,configurable:!0}),e.prototype.open=function(e,t){throw new n.NotImplementedException("Unimplemented abstract function!")},e.prototype.abort=function(){throw new n.NotImplementedException("Unimplemented abstract function!")},e}()},"./src/io/param-seek-handler.js":function(e,t,i){i.r(t);var n=function(){function e(e,t){this._startName=e,this._endName=t}return e.prototype.getConfig=function(e,t){var i=e;if(0!==t.from||-1!==t.to){var n=!0;-1===i.indexOf("?")&&(i+="?",n=!1),n&&(i+="&"),i+=this._startName+"="+t.from.toString(),-1!==t.to&&(i+="&"+this._endName+"="+t.to.toString())}return{url:i,headers:{}}},e.prototype.removeURLParameters=function(e){var t=e.split("?")[0],i=void 0,n=e.indexOf("?");-1!==n&&(i=e.substring(n+1));var r="";if(null!=i&&i.length>0)for(var o=i.split("&"),s=0;s<o.length;s++){var a=o[s].split("="),l=s>0;a[0]!==this._startName&&a[0]!==this._endName&&(l&&(r+="&"),r+=o[s])}return 0===r.length?t:t+"?"+r},e}();t.default=n},"./src/io/range-seek-handler.js":function(e,t,i){i.r(t);var n=function(){function e(e){this._zeroStart=e||!1}return e.prototype.getConfig=function(e,t){var i={};if(0!==t.from||-1!==t.to){var n=void 0;n=-1!==t.to?"bytes="+t.from.toString()+"-"+t.to.toString():"bytes="+t.from.toString()+"-",i.Range=n}else this._zeroStart&&(i.Range="bytes=0-");return{url:e,headers:i}},e.prototype.removeURLParameters=function(e){return e},e}();t.default=n},"./src/io/speed-sampler.js":function(e,t,i){i.r(t);var n=function(){function e(){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 e.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},e.prototype.addBytes=function(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())},Object.defineProperty(e.prototype,"currentKBps",{get:function(){this.addBytes(0);var e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"averageKBps",{get:function(){var e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024},enumerable:!1,configurable:!0}),e}();t.default=n},"./src/io/websocket-loader.js":function(e,t,i){i.r(t);var n,r=i("./src/io/loader.js"),o=i("./src/utils/exception.js"),s=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),a=function(e){function t(){var t=e.call(this,"websocket-loader")||this;return t.TAG="WebSocketLoader",t._needStash=!0,t._ws=null,t._requestAbort=!1,t._receivedLength=0,t}return s(t,e),t.isSupported=function(){try{return void 0!==self.WebSocket}catch($v){return!1}},t.prototype.destroy=function(){this._ws&&this.abort(),e.prototype.destroy.call(this)},t.prototype.open=function(e){try{var t=this._ws=new self.WebSocket(e.url);t.binaryType="arraybuffer",t.onopen=this._onWebSocketOpen.bind(this),t.onclose=this._onWebSocketClose.bind(this),t.onmessage=this._onWebSocketMessage.bind(this),t.onerror=this._onWebSocketError.bind(this),this._status=r.LoaderStatus.kConnecting}catch($v){this._status=r.LoaderStatus.kError;var i={code:$v.code,msg:$v.message};if(!this._onError)throw new o.RuntimeException(i.msg);this._onError(r.LoaderErrors.EXCEPTION,i)}},t.prototype.abort=function(){var e=this._ws;!e||0!==e.readyState&&1!==e.readyState||(this._requestAbort=!0,e.close()),this._ws=null,this._status=r.LoaderStatus.kComplete},t.prototype._onWebSocketOpen=function(e){this._status=r.LoaderStatus.kBuffering},t.prototype._onWebSocketClose=function(e){!0!==this._requestAbort?(this._status=r.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)):this._requestAbort=!1},t.prototype._onWebSocketMessage=function(e){var t=this;if(e.data instanceof ArrayBuffer)this._dispatchArrayBuffer(e.data);else if(e.data instanceof Blob){var i=new FileReader;i.onload=function(){t._dispatchArrayBuffer(i.result)},i.readAsArrayBuffer(e.data)}else{this._status=r.LoaderStatus.kError;var n={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new o.RuntimeException(n.msg);this._onError(r.LoaderErrors.EXCEPTION,n)}},t.prototype._dispatchArrayBuffer=function(e){var t=e,i=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)},t.prototype._onWebSocketError=function(e){this._status=r.LoaderStatus.kError;var t={code:e.code,msg:e.message};if(!this._onError)throw new o.RuntimeException(t.msg);this._onError(r.LoaderErrors.EXCEPTION,t)},t}(r.BaseLoader);t.default=a},"./src/io/xhr-moz-chunked-loader.js":function(e,t,i){i.r(t);var n,r=i("./src/utils/logger.js"),o=i("./src/io/loader.js"),s=i("./src/utils/exception.js"),a=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),l=function(e){function t(t,i){var n=e.call(this,"xhr-moz-chunked-loader")||this;return n.TAG="MozChunkedLoader",n._seekHandler=t,n._config=i,n._needStash=!0,n._xhr=null,n._requestAbort=!1,n._contentLength=null,n._receivedLength=0,n}return a(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===e.responseType}catch($v){return r.default.w("MozChunkedLoader",$v.message),!1}},t.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),e.prototype.destroy.call(this)},t.prototype.open=function(e,t){this._dataSource=e,this._range=t;var i=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(i=e.redirectedURL);var n=this._seekHandler.getConfig(i,t);this._requestURL=n.url;var r=this._xhr=new XMLHttpRequest;if(r.open("GET",n.url,!0),r.responseType="moz-chunked-arraybuffer",r.onreadystatechange=this._onReadyStateChange.bind(this),r.onprogress=this._onProgress.bind(this),r.onloadend=this._onLoadEnd.bind(this),r.onerror=this._onXhrError.bind(this),e.withCredentials&&(r.withCredentials=!0),"object"==typeof n.headers){var s=n.headers;for(var a in s)s.hasOwnProperty(a)&&r.setRequestHeader(a,s[a])}if("object"==typeof this._config.headers)for(var a in s=this._config.headers)s.hasOwnProperty(a)&&r.setRequestHeader(a,s[a]);this._status=o.LoaderStatus.kConnecting,r.send()},t.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=o.LoaderStatus.kComplete},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL&&t.responseURL!==this._requestURL&&this._onURLRedirect){var i=this._seekHandler.removeURLParameters(t.responseURL);this._onURLRedirect(i)}if(0!==t.status&&(t.status<200||t.status>299)){if(this._status=o.LoaderStatus.kError,!this._onError)throw new s.RuntimeException("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(o.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=o.LoaderStatus.kBuffering}},t.prototype._onProgress=function(e){if(this._status!==o.LoaderStatus.kError){null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var t=e.target.response,i=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,i,this._receivedLength)}},t.prototype._onLoadEnd=function(e){!0!==this._requestAbort?this._status!==o.LoaderStatus.kError&&(this._status=o.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1},t.prototype._onXhrError=function(e){this._status=o.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&e.loaded<this._contentLength?(t=o.LoaderErrors.EARLY_EOF,i={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(t=o.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new s.RuntimeException(i.msg);this._onError(t,i)},t}(o.BaseLoader);t.default=l},"./src/io/xhr-range-loader.js":function(e,t,i){i.r(t);var n,r=i("./src/utils/logger.js"),o=i("./src/io/speed-sampler.js"),s=i("./src/io/loader.js"),a=i("./src/utils/exception.js"),l=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),u=function(e){function t(t,i){var n=e.call(this,"xhr-range-loader")||this;return n.TAG="RangeLoader",n._seekHandler=t,n._config=i,n._needStash=!1,n._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],n._currentChunkSizeKB=384,n._currentSpeedNormalized=0,n._zeroSpeedChunkCount=0,n._xhr=null,n._speedSampler=new o.default,n._requestAbort=!1,n._waitForTotalLength=!1,n._totalLengthReceived=!1,n._currentRequestURL=null,n._currentRedirectedURL=null,n._currentRequestRange=null,n._totalLength=null,n._contentLength=null,n._receivedLength=0,n._lastTimeLoaded=0,n}return l(t,e),t.isSupported=function(){try{var e=new XMLHttpRequest;return e.open("GET","https://example.com",!0),e.responseType="arraybuffer","arraybuffer"===e.responseType}catch($v){return r.default.w("RangeLoader",$v.message),!1}},t.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),e.prototype.destroy.call(this)},Object.defineProperty(t.prototype,"currentSpeed",{get:function(){return this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),t.prototype.open=function(e,t){this._dataSource=e,this._range=t,this._status=s.LoaderStatus.kConnecting;var i=!1;null!=this._dataSource.filesize&&0!==this._dataSource.filesize&&(i=!0,this._totalLength=this._dataSource.filesize),this._totalLengthReceived||i?this._openSubRange():(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1}))},t.prototype._openSubRange=function(){var e=1024*this._currentChunkSizeKB,t=this._range.from+this._receivedLength,i=t+e;null!=this._contentLength&&i-this._range.from>=this._contentLength&&(i=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:i},this._internalOpen(this._dataSource,this._currentRequestRange)},t.prototype._internalOpen=function(e,t){this._lastTimeLoaded=0;var i=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?i=this._currentRedirectedURL:null!=e.redirectedURL&&(i=e.redirectedURL));var n=this._seekHandler.getConfig(i,t);this._currentRequestURL=n.url;var r=this._xhr=new XMLHttpRequest;if(r.open("GET",n.url,!0),r.responseType="arraybuffer",r.onreadystatechange=this._onReadyStateChange.bind(this),r.onprogress=this._onProgress.bind(this),r.onload=this._onLoad.bind(this),r.onerror=this._onXhrError.bind(this),e.withCredentials&&(r.withCredentials=!0),"object"==typeof n.headers){var o=n.headers;for(var s in o)o.hasOwnProperty(s)&&r.setRequestHeader(s,o[s])}if("object"==typeof this._config.headers)for(var s in o=this._config.headers)o.hasOwnProperty(s)&&r.setRequestHeader(s,o[s]);r.send()},t.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=s.LoaderStatus.kComplete},t.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)},t.prototype._onReadyStateChange=function(e){var t=e.target;if(2===t.readyState){if(null!=t.responseURL){var i=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&i!==this._currentRedirectedURL&&(this._currentRedirectedURL=i,this._onURLRedirect&&this._onURLRedirect(i))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=s.LoaderStatus.kBuffering}else{if(this._status=s.LoaderStatus.kError,!this._onError)throw new a.RuntimeException("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(s.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}},t.prototype._onProgress=function(e){if(this._status!==s.LoaderStatus.kError){if(null===this._contentLength){var t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;var i=e.total;this._internalAbort(),null!=i&0!==i&&(this._totalLength=i)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var n=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(n)}},t.prototype._normalizeSpeed=function(e){var t=this._chunkSizeKBList,i=t.length-1,n=0,r=0,o=i;if(e<t[0])return t[0];for(;r<=o;){if((n=r+Math.floor((o-r)/2))===i||e>=t[n]&&e<t[n+1])return t[n];t[n]<e?r=n+1:o=n-1}},t.prototype._onLoad=function(e){if(this._status!==s.LoaderStatus.kError)if(this._waitForTotalLength)this._waitForTotalLength=!1;else{this._lastTimeLoaded=0;var t=this._speedSampler.lastSecondKBps;if(0===t&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(t=this._speedSampler.currentKBps)),0!==t){var i=this._normalizeSpeed(t);this._currentSpeedNormalized!==i&&(this._currentSpeedNormalized=i,this._currentChunkSizeKB=i)}var n=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=n.byteLength;var o=!1;null!=this._contentLength&&this._receivedLength<this._contentLength?this._openSubRange():o=!0,this._onDataArrival&&this._onDataArrival(n,r,this._receivedLength),o&&(this._status=s.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}},t.prototype._onXhrError=function(e){this._status=s.LoaderStatus.kError;var t=0,i=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(t=s.LoaderErrors.EARLY_EOF,i={code:-1,msg:"RangeLoader meet Early-Eof"}):(t=s.LoaderErrors.EXCEPTION,i={code:-1,msg:e.constructor.name+" "+e.type}),!this._onError)throw new a.RuntimeException(i.msg);this._onError(t,i)},t}(s.BaseLoader);t.default=u},"./src/player/flv-player.js":function(e,t,i){i.r(t);var n=i("./node_modules/events/events.js"),r=i.n(n),o=i("./src/utils/logger.js"),s=i("./src/utils/browser.js"),a=i("./src/player/player-events.js"),l=i("./src/core/transmuxer.js"),u=i("./src/core/transmuxing-events.js"),c=i("./src/core/mse-controller.js"),h=i("./src/core/mse-events.js"),d=i("./src/player/player-errors.js"),p=i("./src/config.js"),f=i("./src/utils/exception.js"),m=function(){function e(e,t){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(r()),this._config=(0,p.createDefaultConfig)(),"object"==typeof t&&Object.assign(this._config,t),"flv"!==e.type.toLowerCase())throw new f.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");!0===e.isLive&&(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=e,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 i=s.default.chrome&&(s.default.version.major<50||50===s.default.version.major&&s.default.version.build<2661);this._alwaysSeekKeyframe=!!(i||s.default.msedge||s.default.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}return e.prototype.destroy=function(){null!=this._progressChecker&&(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},e.prototype.on=function(e,t){var i=this;e===a.default.MEDIA_INFO?null!=this._mediaInfo&&Promise.resolve().then((function(){i._emitter.emit(a.default.MEDIA_INFO,i.mediaInfo)})):e===a.default.STATISTICS_INFO&&null!=this._statisticsInfo&&Promise.resolve().then((function(){i._emitter.emit(a.default.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){var t=this;if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),e.addEventListener("seeking",this.e.onvSeeking),e.addEventListener("canplay",this.e.onvCanPlay),e.addEventListener("stalled",this.e.onvStalled),e.addEventListener("progress",this.e.onvProgress),this._msectl=new c.default(this._config),this._msectl.on(h.default.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(h.default.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(h.default.SOURCE_OPEN,(function(){t._mseSourceOpened=!0,t._hasPendingLoad&&(t._hasPendingLoad=!1,t.load())})),this._msectl.on(h.default.ERROR,(function(e){t._emitter.emit(a.default.ERROR,d.ErrorTypes.MEDIA_ERROR,d.ErrorDetails.MEDIA_MSE_ERROR,e)})),this._msectl.attachMediaElement(e),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch($v){}},e.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)},e.prototype.load=function(){var e=this;if(!this._mediaElement)throw new f.IllegalStateException("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new f.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");this._hasPendingLoad||(this._config.deferLoadAfterSourceOpen&&!1===this._mseSourceOpened?this._hasPendingLoad=!0:(this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new l.default(this._mediaDataSource,this._config),this._transmuxer.on(u.default.INIT_SEGMENT,(function(t,i){e._msectl.appendInitSegment(i)})),this._transmuxer.on(u.default.MEDIA_SEGMENT,(function(t,i){if(e._msectl.appendMediaSegment(i),e._config.lazyLoad&&!e._config.isLive){var n=e._mediaElement.currentTime;i.info.endDts>=1e3*(n+e._config.lazyLoadMaxDuration)&&null==e._progressChecker&&(o.default.v(e.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),e._suspendTransmuxer())}})),this._transmuxer.on(u.default.LOADING_COMPLETE,(function(){e._msectl.endOfStream(),e._emitter.emit(a.default.LOADING_COMPLETE)})),this._transmuxer.on(u.default.RECOVERED_EARLY_EOF,(function(){e._emitter.emit(a.default.RECOVERED_EARLY_EOF)})),this._transmuxer.on(u.default.IO_ERROR,(function(t,i){e._emitter.emit(a.default.ERROR,d.ErrorTypes.NETWORK_ERROR,t,i)})),this._transmuxer.on(u.default.DEMUX_ERROR,(function(t,i){e._emitter.emit(a.default.ERROR,d.ErrorTypes.MEDIA_ERROR,t,{code:-1,msg:i})})),this._transmuxer.on(u.default.MEDIA_INFO,(function(t){e._mediaInfo=t,e._emitter.emit(a.default.MEDIA_INFO,Object.assign({},t))})),this._transmuxer.on(u.default.METADATA_ARRIVED,(function(t){e._emitter.emit(a.default.METADATA_ARRIVED,t)})),this._transmuxer.on(u.default.SCRIPTDATA_ARRIVED,(function(t){e._emitter.emit(a.default.SCRIPTDATA_ARRIVED,t)})),this._transmuxer.on(u.default.STATISTICS_INFO,(function(t){e._statisticsInfo=e._fillStatisticsInfo(t),e._emitter.emit(a.default.STATISTICS_INFO,Object.assign({},e._statisticsInfo))})),this._transmuxer.on(u.default.RECOMMEND_SEEKPOINT,(function(t){e._mediaElement&&!e._config.accurateSeek&&(e._requestSetTime=!0,e._mediaElement.currentTime=t/1e3)})),this._transmuxer.open()))},e.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)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._internalSeek(e):this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){return null==this._statisticsInfo&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),e.prototype._fillStatisticsInfo=function(e){if(e.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e},e.prototype._onmseUpdateEnd=function(){if(this._config.lazyLoad&&!this._config.isLive){for(var e=this._mediaElement.buffered,t=this._mediaElement.currentTime,i=0,n=0;n<e.length;n++){var r=e.start(n),s=e.end(n);if(r<=t&&t<s){i=s;break}}i>=t+this._config.lazyLoadMaxDuration&&null==this._progressChecker&&(o.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},e.prototype._onmseBufferFull=function(){o.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),null==this._progressChecker&&this._suspendTransmuxer()},e.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),null==this._progressChecker&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},e.prototype._checkProgressAndResume=function(){for(var e=this._mediaElement.currentTime,t=this._mediaElement.buffered,i=!1,n=0;n<t.length;n++){var r=t.start(n),s=t.end(n);if(e>=r&&e<s){e>=s-this._config.lazyLoadRecoverDuration&&(i=!0);break}}i&&(window.clearInterval(this._progressChecker),this._progressChecker=null,i&&(o.default.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},e.prototype._isTimepointBuffered=function(e){for(var t=this._mediaElement.buffered,i=0;i<t.length;i++){var n=t.start(i),r=t.end(i);if(e>=n&&e<r)return!0}return!1},e.prototype._internalSeek=function(e){var t=this._isTimepointBuffered(e),i=!1,n=0;if(e<1&&this._mediaElement.buffered.length>0){var r=this._mediaElement.buffered.start(0);(r<1&&e<r||s.default.safari)&&(i=!0,n=s.default.safari?.1:r)}if(i)this._requestSetTime=!0,this._mediaElement.currentTime=n;else if(t){if(this._alwaysSeekKeyframe){var o=this._msectl.getNearestKeyframe(Math.floor(1e3*e));this._requestSetTime=!0,this._mediaElement.currentTime=null!=o?o.dts/1e3:e}else this._requestSetTime=!0,this._mediaElement.currentTime=e;null!=this._progressChecker&&this._checkProgressAndResume()}else null!=this._progressChecker&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e)},e.prototype._checkAndApplyUnbufferedSeekpoint=function(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){var e=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(e)||(null!=this._progressChecker&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(e),this._transmuxer.seek(Math.floor(1e3*e)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=e))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)},e.prototype._checkAndResumeStuckPlayback=function(e){var t=this._mediaElement;if(e||!this._receivedCanPlay||t.readyState<2){var i=t.buffered;i.length>0&&t.currentTime<i.start(0)&&(o.default.w(this.TAG,"Playback seems stuck at "+t.currentTime+", seek to "+i.start(0)),this._requestSetTime=!0,this._mediaElement.currentTime=i.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)},e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)},e.prototype._onvSeeking=function(e){var t=this._mediaElement.currentTime,i=this._mediaElement.buffered;if(this._requestSetTime)this._requestSetTime=!1;else{if(t<1&&i.length>0){var n=i.start(0);if(n<1&&t<n||s.default.safari)return this._requestSetTime=!0,void(this._mediaElement.currentTime=s.default.safari?.1:n)}if(this._isTimepointBuffered(t)){if(this._alwaysSeekKeyframe){var r=this._msectl.getNearestKeyframe(Math.floor(1e3*t));null!=r&&(this._requestSetTime=!0,this._mediaElement.currentTime=r.dts/1e3)}null!=this._progressChecker&&this._checkProgressAndResume()}else this._seekpointRecord={seekPoint:t,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}},e.prototype._onvCanPlay=function(e){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)},e.prototype._onvStalled=function(e){this._checkAndResumeStuckPlayback(!0)},e.prototype._onvProgress=function(e){this._checkAndResumeStuckPlayback()},e}();t.default=m},"./src/player/native-player.js":function(e,t,i){i.r(t);var n=i("./node_modules/events/events.js"),r=i.n(n),o=i("./src/player/player-events.js"),s=i("./src/config.js"),a=i("./src/utils/exception.js"),l=function(){function e(e,t){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(r()),this._config=(0,s.createDefaultConfig)(),"object"==typeof t&&Object.assign(this._config,t),"flv"===e.type.toLowerCase())throw new a.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");if(e.hasOwnProperty("segments"))throw new a.InvalidArgumentException("NativePlayer("+e.type+") doesn't support multipart playback!");this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=e,this._mediaElement=null}return e.prototype.destroy=function(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null},e.prototype.on=function(e,t){var i=this;e===o.default.MEDIA_INFO?null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(o.default.MEDIA_INFO,i.mediaInfo)})):e===o.default.STATISTICS_INFO&&null!=this._mediaElement&&0!==this._mediaElement.readyState&&Promise.resolve().then((function(){i._emitter.emit(o.default.STATISTICS_INFO,i.statisticsInfo)})),this._emitter.addListener(e,t)},e.prototype.off=function(e,t){this._emitter.removeListener(e,t)},e.prototype.attachMediaElement=function(e){if(this._mediaElement=e,e.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),null!=this._pendingSeekTime)try{e.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch($v){}},e.prototype.detachMediaElement=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.load=function(){if(!this._mediaElement)throw new a.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)},e.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),null!=this._statisticsReporter&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},e.prototype.play=function(){return this._mediaElement.play()},e.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(e){this._mediaElement.volume=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(e){this._mediaElement.muted=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(e){this._mediaElement?this._mediaElement.currentTime=e:this._pendingSeekTime=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaInfo",{get:function(){var e={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(e.duration=Math.floor(1e3*this._mediaElement.duration),this._mediaElement instanceof HTMLVideoElement&&(e.width=this._mediaElement.videoWidth,e.height=this._mediaElement.videoHeight)),e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statisticsInfo",{get:function(){var e={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return e;var t=!0,i=0,n=0;if(this._mediaElement.getVideoPlaybackQuality){var r=this._mediaElement.getVideoPlaybackQuality();i=r.totalVideoFrames,n=r.droppedVideoFrames}else null!=this._mediaElement.webkitDecodedFrameCount?(i=this._mediaElement.webkitDecodedFrameCount,n=this._mediaElement.webkitDroppedFrameCount):t=!1;return t&&(e.decodedFrames=i,e.droppedFrames=n),e},enumerable:!1,configurable:!0}),e.prototype._onvLoadedMetadata=function(e){null!=this._pendingSeekTime&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(o.default.MEDIA_INFO,this.mediaInfo)},e.prototype._reportStatisticsInfo=function(){this._emitter.emit(o.default.STATISTICS_INFO,this.statisticsInfo)},e}();t.default=l},"./src/player/player-errors.js":function(e,t,i){i.r(t),i.d(t,{ErrorTypes:function(){return o},ErrorDetails:function(){return s}});var n=i("./src/io/loader.js"),r=i("./src/demux/demux-errors.js"),o={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},s={NETWORK_EXCEPTION:n.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:n.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:n.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:n.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:r.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:r.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:r.default.CODEC_UNSUPPORTED}},"./src/player/player-events.js":function(e,t,i){i.r(t),t.default={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"}},"./src/remux/aac-silent.js":function(e,t,i){i.r(t);var n=function(){function e(){}return e.getSilentFrame=function(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)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(6===t)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(1===t)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(2===t)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(3===t)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},e}();t.default=n},"./src/remux/mp4-generator.js":function(e,t,i){i.r(t);var n=function(){function e(){}return e.init=function(){for(var t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var i=e.constants={};i.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),i.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),i.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),i.STSC=i.STCO=i.STTS,i.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),i.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]),i.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]),i.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),i.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},e.box=function(e){for(var t=8,i=null,n=Array.prototype.slice.call(arguments,1),r=n.length,o=0;o<r;o++)t+=n[o].byteLength;(i=new Uint8Array(t))[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);var s=8;for(o=0;o<r;o++)i.set(n[o],s),s+=n[o].byteLength;return i},e.generateInitSegment=function(t){var i=e.box(e.types.ftyp,e.constants.FTYP),n=e.moov(t),r=new Uint8Array(i.byteLength+n.byteLength);return r.set(i,0),r.set(n,i.byteLength),r},e.moov=function(t){var i=e.mvhd(t.timescale,t.duration),n=e.trak(t),r=e.mvex(t);return e.box(e.types.moov,i,n,r)},e.mvhd=function(t,i){return e.box(e.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))},e.trak=function(t){return e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.tkhd=function(t){var i=t.id,n=t.duration,r=t.presentWidth,o=t.presentHeight;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,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,r>>>8&255,255&r,0,0,o>>>8&255,255&o,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t),e.hdlr(t),e.minf(t))},e.mdhd=function(t){var i=t.timescale,n=t.duration;return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,85,196,0,0]))},e.hdlr=function(t){var i=null;return i="audio"===t.type?e.constants.HDLR_AUDIO:e.constants.HDLR_VIDEO,e.box(e.types.hdlr,i)},e.minf=function(t){var i=null;return i="audio"===t.type?e.box(e.types.smhd,e.constants.SMHD):e.box(e.types.vmhd,e.constants.VMHD),e.box(e.types.minf,i,e.dinf(),e.stbl(t))},e.dinf=function(){return e.box(e.types.dinf,e.box(e.types.dref,e.constants.DREF))},e.stbl=function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.constants.STTS),e.box(e.types.stsc,e.constants.STSC),e.box(e.types.stsz,e.constants.STSZ),e.box(e.types.stco,e.constants.STCO))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.codec?e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp3(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.mp4a(t)):e.box(e.types.stsd,e.constants.STSD_PREFIX,e.avc1(t))},e.mp3=function(t){var i=t.channelCount,n=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return e.box(e.types[".mp3"],r)},e.mp4a=function(t){var i=t.channelCount,n=t.audioSampleRate,r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,i,0,16,0,0,0,0,n>>>8&255,255&n,0,0]);return e.box(e.types.mp4a,r,e.esds(t))},e.esds=function(t){var i=t.config||[],n=i.length,r=new Uint8Array([0,0,0,0,3,23+n,0,1,0,4,15+n,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([n]).concat(i).concat([6,1,2]));return e.box(e.types.esds,r)},e.avc1=function(t){var i=t.avcc,n=t.codecWidth,r=t.codecHeight,o=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,n>>>8&255,255&n,r>>>8&255,255&r,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 e.box(e.types.avc1,o,e.box(e.types.avcC,i))},e.mvex=function(t){return e.box(e.types.mvex,e.trex(t))},e.trex=function(t){var i=t.id,n=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return e.box(e.types.trex,n)},e.moof=function(t,i){return e.box(e.types.moof,e.mfhd(t.sequenceNumber),e.traf(t,i))},e.mfhd=function(t){var i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]);return e.box(e.types.mfhd,i)},e.traf=function(t,i){var n=t.id,r=e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n])),o=e.box(e.types.tfdt,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),s=e.sdtp(t),a=e.trun(t,s.byteLength+16+16+8+16+8+8);return e.box(e.types.traf,r,o,a,s)},e.sdtp=function(t){for(var i=t.samples||[],n=i.length,r=new Uint8Array(4+n),o=0;o<n;o++){var s=i[o].flags;r[o+4]=s.isLeading<<6|s.dependsOn<<4|s.isDependedOn<<2|s.hasRedundancy}return e.box(e.types.sdtp,r)},e.trun=function(t,i){var n=t.samples||[],r=n.length,o=12+16*r,s=new Uint8Array(o);i+=8+o,s.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0);for(var a=0;a<r;a++){var l=n[a].duration,u=n[a].size,c=n[a].flags,h=n[a].cts;s.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,u>>>24&255,u>>>16&255,u>>>8&255,255&u,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.isNonSync,0,0,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*a)}return e.box(e.types.trun,s)},e.mdat=function(t){return e.box(e.types.mdat,t)},e}();n.init(),t.default=n},"./src/remux/mp4-remuxer.js":function(e,t,i){i.r(t);var n=i("./src/utils/logger.js"),r=i("./src/remux/mp4-generator.js"),o=i("./src/remux/aac-silent.js"),s=i("./src/utils/browser.js"),a=i("./src/core/media-segment-info.js"),l=i("./src/utils/exception.js"),u=function(){function e(e){this.TAG="MP4Remuxer",this._config=e,this._isLive=!0===e.isLive,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 a.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new a.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!(!s.default.chrome||!(s.default.version.major<50||50===s.default.version.major&&s.default.version.build<2661)),this._fillSilentAfterSeek=s.default.msedge||s.default.msie,this._mp3UseMpegAudio=!s.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return e.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},e.prototype.bindDataSource=function(e){return e.onDataAvailable=this.remux.bind(this),e.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(e.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(e){this._onInitSegment=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(e){this._onMediaSegment=e},enumerable:!1,configurable:!0}),e.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},e.prototype.seek=function(e){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},e.prototype.remux=function(e,t){if(!this._onMediaSegment)throw new l.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(e,t),this._remuxVideo(t),this._remuxAudio(e)},e.prototype._onTrackMetadataReceived=function(e,t){var i=null,n="mp4",o=t.codec;if("audio"===e)this._audioMeta=t,"mp3"===t.codec&&this._mp3UseMpegAudio?(n="mpeg",o="",i=new Uint8Array):i=r.default.generateInitSegment(t);else{if("video"!==e)return;this._videoMeta=t,i=r.default.generateInitSegment(t)}if(!this._onInitSegment)throw new l.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(e,{type:e,data:i.buffer,codec:o,container:e+"/"+n,mediaDuration:t.duration})},e.prototype._calculateDtsBase=function(e,t){this._dtsBaseInited||(e.samples&&e.samples.length&&(this._audioDtsBase=e.samples[0].dts),t.samples&&t.samples.length&&(this._videoDtsBase=t.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},e.prototype.flushStashedSamples=function(){var e=this._videoStashedLastSample,t=this._audioStashedLastSample,i={type:"video",id:1,sequenceNumber:0,samples:[],length:0};null!=e&&(i.samples.push(e),i.length=e.length);var n={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};null!=t&&(n.samples.push(t),n.length=t.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(i,!0),this._remuxAudio(n,!0)},e.prototype._remuxAudio=function(e,t){if(null!=this._audioMeta){var i,l=e,u=l.samples,c=void 0,h=-1,d=this._audioMeta.refSampleDuration,p="mp3"===this._audioMeta.codec&&this._mp3UseMpegAudio,f=this._dtsBaseInited&&void 0===this._audioNextDts,m=!1;if(u&&0!==u.length&&(1!==u.length||t)){var g=0,v=null,y=0;p?(g=0,y=l.length):(g=8,y=8+l.length);var _=null;if(u.length>1&&(y-=(_=u.pop()).length),null!=this._audioStashedLastSample){var b=this._audioStashedLastSample;this._audioStashedLastSample=null,u.unshift(b),y+=b.length}null!=_&&(this._audioStashedLastSample=_);var C=u[0].dts-this._dtsBase;if(this._audioNextDts)c=C-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())c=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&"mp3"!==this._audioMeta.originalCodec&&(m=!0);else{var T=this._audioSegmentInfoList.getLastSampleBefore(C);if(null!=T){var w=C-(T.originalDts+T.duration);w<=3&&(w=0),c=C-(T.dts+T.duration+w)}else c=0}if(m){var E=C-c,S=this._videoSegmentInfoList.getLastSegmentBefore(C);if(null!=S&&S.beginDts<E){if(R=o.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount)){var k=S.beginDts,P=E-S.beginDts;n.default.v(this.TAG,"InsertPrefixSilentAudio: dts: "+k+", duration: "+P),u.unshift({unit:R,dts:k,pts:k}),y+=R.byteLength}}else m=!1}for(var A=[],x=0;x<u.length;x++){var I=(b=u[x]).unit,M=b.dts-this._dtsBase,L=(k=M,!1),D=null,O=0;if(!(M<-.001)){if("mp3"!==this._audioMeta.codec){var j=M;if(this._audioNextDts&&(j=this._audioNextDts),(c=M-j)<=-3*d){n.default.w(this.TAG,"Dropping 1 audio frame (originalDts: "+M+" ms ,curRefDts: "+j+" ms) due to dtsCorrection: "+c+" ms overlap.");continue}if(c>=3*d&&this._fillAudioTimestampGap&&!s.default.safari){L=!0;var R,N=Math.floor(c/d);n.default.w(this.TAG,"Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: "+M+" ms, curRefDts: "+j+" ms, dtsCorrection: "+Math.round(c)+" ms, generate: "+N+" frames"),k=Math.floor(j),O=Math.floor(j+d)-k,null==(R=o.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))&&(n.default.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),R=I),D=[];for(var U=0;U<N;U++){j+=d;var B=Math.floor(j),F=Math.floor(j+d)-B,W={dts:B,pts:B,cts:0,unit:R,size:R.byteLength,duration:F,originalDts:M,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};D.push(W),y+=W.size}this._audioNextDts=j+d}else k=Math.floor(j),O=Math.floor(j+d)-k,this._audioNextDts=j+d}else k=M-c,O=x!==u.length-1?u[x+1].dts-this._dtsBase-c-k:null!=_?_.dts-this._dtsBase-c-k:A.length>=1?A[A.length-1].duration:Math.floor(d),this._audioNextDts=k+O;-1===h&&(h=k),A.push({dts:k,pts:k,cts:0,unit:b.unit,size:b.unit.byteLength,duration:O,originalDts:M,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),L&&A.push.apply(A,D)}}if(0===A.length)return l.samples=[],void(l.length=0);for(p?v=new Uint8Array(y):((v=new Uint8Array(y))[0]=y>>>24&255,v[1]=y>>>16&255,v[2]=y>>>8&255,v[3]=255&y,v.set(r.default.types.mdat,4)),x=0;x<A.length;x++)I=A[x].unit,v.set(I,g),g+=I.byteLength;var H=A[A.length-1];i=H.dts+H.duration;var V=new a.MediaSegmentInfo;V.beginDts=h,V.endDts=i,V.beginPts=h,V.endPts=i,V.originalBeginDts=A[0].originalDts,V.originalEndDts=H.originalDts+H.duration,V.firstSample=new a.SampleInfo(A[0].dts,A[0].pts,A[0].duration,A[0].originalDts,!1),V.lastSample=new a.SampleInfo(H.dts,H.pts,H.duration,H.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(V),l.samples=A,l.sequenceNumber++;var G=null;G=p?new Uint8Array:r.default.moof(l,h),l.samples=[],l.length=0;var z={type:"audio",data:this._mergeBoxes(G,v).buffer,sampleCount:A.length,info:V};p&&f&&(z.timestampOffset=h),this._onMediaSegment("audio",z)}}},e.prototype._remuxVideo=function(e,t){if(null!=this._videoMeta){var i,n,o=e,s=o.samples,l=void 0,u=-1,c=-1;if(s&&0!==s.length&&(1!==s.length||t)){var h=8,d=null,p=8+e.length,f=null;if(s.length>1&&(p-=(f=s.pop()).length),null!=this._videoStashedLastSample){var m=this._videoStashedLastSample;this._videoStashedLastSample=null,s.unshift(m),p+=m.length}null!=f&&(this._videoStashedLastSample=f);var g=s[0].dts-this._dtsBase;if(this._videoNextDts)l=g-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())l=0;else{var v=this._videoSegmentInfoList.getLastSampleBefore(g);if(null!=v){var y=g-(v.originalDts+v.duration);y<=3&&(y=0),l=g-(v.dts+v.duration+y)}else l=0}for(var _=new a.MediaSegmentInfo,b=[],C=0;C<s.length;C++){var T=(m=s[C]).dts-this._dtsBase,w=m.isKeyframe,E=T-l,S=m.cts,k=E+S;-1===u&&(u=E,c=k);var P=0;if(P=C!==s.length-1?s[C+1].dts-this._dtsBase-l-E:null!=f?f.dts-this._dtsBase-l-E:b.length>=1?b[b.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),w){var A=new a.SampleInfo(E,k,P,m.dts,!0);A.fileposition=m.fileposition,_.appendSyncPoint(A)}b.push({dts:E,pts:k,cts:S,units:m.units,size:m.length,isKeyframe:w,duration:P,originalDts:T,flags:{isLeading:0,dependsOn:w?2:1,isDependedOn:w?1:0,hasRedundancy:0,isNonSync:w?0:1}})}for((d=new Uint8Array(p))[0]=p>>>24&255,d[1]=p>>>16&255,d[2]=p>>>8&255,d[3]=255&p,d.set(r.default.types.mdat,4),C=0;C<b.length;C++)for(var x=b[C].units;x.length;){var I=x.shift().data;d.set(I,h),h+=I.byteLength}var M=b[b.length-1];if(i=M.dts+M.duration,n=M.pts+M.duration,this._videoNextDts=i,_.beginDts=u,_.endDts=i,_.beginPts=c,_.endPts=n,_.originalBeginDts=b[0].originalDts,_.originalEndDts=M.originalDts+M.duration,_.firstSample=new a.SampleInfo(b[0].dts,b[0].pts,b[0].duration,b[0].originalDts,b[0].isKeyframe),_.lastSample=new a.SampleInfo(M.dts,M.pts,M.duration,M.originalDts,M.isKeyframe),this._isLive||this._videoSegmentInfoList.append(_),o.samples=b,o.sequenceNumber++,this._forceFirstIDR){var L=b[0].flags;L.dependsOn=2,L.isNonSync=0}var D=r.default.moof(o,u);o.samples=[],o.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(D,d).buffer,sampleCount:b.length,info:_})}}},e.prototype._mergeBoxes=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i},e}();t.default=u},"./src/utils/browser.js":function(e,t,i){i.r(t);var n={};!function(){var e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],i=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],r={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:i[0]||""},o={};if(r.browser){o[r.browser]=!0;var s=r.majorVersion.split(".");o.version={major:parseInt(r.majorVersion,10),string:r.version},s.length>1&&(o.version.minor=parseInt(s[1],10)),s.length>2&&(o.version.build=parseInt(s[2],10))}if(r.platform&&(o[r.platform]=!0),(o.chrome||o.opr||o.safari)&&(o.webkit=!0),o.rv||o.iemobile){o.rv&&delete o.rv;var a="msie";r.browser=a,o.msie=!0}if(o.edge){delete o.edge;var l="msedge";r.browser=l,o.msedge=!0}if(o.opr){var u="opera";r.browser=u,o.opera=!0}if(o.safari&&o.android){var c="android";r.browser=c,o.android=!0}for(var h in o.name=r.browser,o.platform=r.platform,n)n.hasOwnProperty(h)&&delete n[h];Object.assign(n,o)}(),t.default=n},"./src/utils/exception.js":function(e,t,i){i.r(t),i.d(t,{RuntimeException:function(){return o},IllegalStateException:function(){return s},InvalidArgumentException:function(){return a},NotImplementedException:function(){return l}});var n,r=(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=function(){function e(e){this._message=e}return Object.defineProperty(e.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return this.name+": "+this.message},e}(),s=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),t}(o),a=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),t}(o),l=function(e){function t(t){return e.call(this,t)||this}return r(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),t}(o)},"./src/utils/logger.js":function(e,t,i){i.r(t);var n=i("./node_modules/events/events.js"),r=i.n(n),o=function(){function e(){}return e.e=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","error",n),e.ENABLE_ERROR&&(console.error?console.error(n):console.warn?console.warn(n):console.log(n))},e.i=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","info",n),e.ENABLE_INFO&&(console.info?console.info(n):console.log(n))},e.w=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","warn",n),e.ENABLE_WARN&&(console.warn?console.warn(n):console.log(n))},e.d=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","debug",n),e.ENABLE_DEBUG&&(console.debug?console.debug(n):console.log(n))},e.v=function(t,i){t&&!e.FORCE_GLOBAL_TAG||(t=e.GLOBAL_TAG);var n="["+t+"] > "+i;e.ENABLE_CALLBACK&&e.emitter.emit("log","verbose",n),e.ENABLE_VERBOSE&&console.log(n)},e}();o.GLOBAL_TAG="flv.js",o.FORCE_GLOBAL_TAG=!1,o.ENABLE_ERROR=!0,o.ENABLE_INFO=!0,o.ENABLE_WARN=!0,o.ENABLE_DEBUG=!0,o.ENABLE_VERBOSE=!0,o.ENABLE_CALLBACK=!1,o.emitter=new(r()),t.default=o},"./src/utils/logging-control.js":function(e,t,i){i.r(t);var n=i("./node_modules/events/events.js"),r=i.n(n),o=i("./src/utils/logger.js"),s=function(){function e(){}return Object.defineProperty(e,"forceGlobalTag",{get:function(){return o.default.FORCE_GLOBAL_TAG},set:function(t){o.default.FORCE_GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"globalTag",{get:function(){return o.default.GLOBAL_TAG},set:function(t){o.default.GLOBAL_TAG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableAll",{get:function(){return o.default.ENABLE_VERBOSE&&o.default.ENABLE_DEBUG&&o.default.ENABLE_INFO&&o.default.ENABLE_WARN&&o.default.ENABLE_ERROR},set:function(t){o.default.ENABLE_VERBOSE=t,o.default.ENABLE_DEBUG=t,o.default.ENABLE_INFO=t,o.default.ENABLE_WARN=t,o.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableDebug",{get:function(){return o.default.ENABLE_DEBUG},set:function(t){o.default.ENABLE_DEBUG=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableVerbose",{get:function(){return o.default.ENABLE_VERBOSE},set:function(t){o.default.ENABLE_VERBOSE=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableInfo",{get:function(){return o.default.ENABLE_INFO},set:function(t){o.default.ENABLE_INFO=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableWarn",{get:function(){return o.default.ENABLE_WARN},set:function(t){o.default.ENABLE_WARN=t,e._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"enableError",{get:function(){return o.default.ENABLE_ERROR},set:function(t){o.default.ENABLE_ERROR=t,e._notifyChange()},enumerable:!1,configurable:!0}),e.getConfig=function(){return{globalTag:o.default.GLOBAL_TAG,forceGlobalTag:o.default.FORCE_GLOBAL_TAG,enableVerbose:o.default.ENABLE_VERBOSE,enableDebug:o.default.ENABLE_DEBUG,enableInfo:o.default.ENABLE_INFO,enableWarn:o.default.ENABLE_WARN,enableError:o.default.ENABLE_ERROR,enableCallback:o.default.ENABLE_CALLBACK}},e.applyConfig=function(e){o.default.GLOBAL_TAG=e.globalTag,o.default.FORCE_GLOBAL_TAG=e.forceGlobalTag,o.default.ENABLE_VERBOSE=e.enableVerbose,o.default.ENABLE_DEBUG=e.enableDebug,o.default.ENABLE_INFO=e.enableInfo,o.default.ENABLE_WARN=e.enableWarn,o.default.ENABLE_ERROR=e.enableError,o.default.ENABLE_CALLBACK=e.enableCallback},e._notifyChange=function(){var t=e.emitter;if(t.listenerCount("change")>0){var i=e.getConfig();t.emit("change",i)}},e.registerListener=function(t){e.emitter.addListener("change",t)},e.removeListener=function(t){e.emitter.removeListener("change",t)},e.addLogListener=function(t){o.default.emitter.addListener("log",t),o.default.emitter.listenerCount("log")>0&&(o.default.ENABLE_CALLBACK=!0,e._notifyChange())},e.removeLogListener=function(t){o.default.emitter.removeListener("log",t),0===o.default.emitter.listenerCount("log")&&(o.default.ENABLE_CALLBACK=!1,e._notifyChange())},e}();s.emitter=new(r()),t.default=s},"./src/utils/polyfill.js":function(e,t,i){i.r(t);var n=function(){function e(){}return e.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Object.assign=Object.assign||function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t},"function"!=typeof self.Promise&&i("./node_modules/es6-promise/dist/es6-promise.js").polyfill()},e}();n.install(),t.default=n},"./src/utils/utf8-conv.js":function(e,t,i){function n(e,t,i){var n=e;if(t+i<n.length){for(;i--;)if(128!=(192&n[++t]))return!1;return!0}return!1}i.r(t),t.default=function(e){for(var t=[],i=e,r=0,o=e.length;r<o;)if(i[r]<128)t.push(String.fromCharCode(i[r])),++r;else{if(i[r]<192);else if(i[r]<224){if(n(i,r,1)&&(s=(31&i[r])<<6|63&i[r+1])>=128){t.push(String.fromCharCode(65535&s)),r+=2;continue}}else if(i[r]<240){if(n(i,r,2)&&(s=(15&i[r])<<12|(63&i[r+1])<<6|63&i[r+2])>=2048&&55296!=(63488&s)){t.push(String.fromCharCode(65535&s)),r+=3;continue}}else if(i[r]<248){var s;if(n(i,r,3)&&(s=(7&i[r])<<18|(63&i[r+1])<<12|(63&i[r+2])<<6|63&i[r+3])>65536&&s<1114112){s-=65536,t.push(String.fromCharCode(s>>>10|55296)),t.push(String.fromCharCode(1023&s|56320)),r+=4;continue}}t.push(String.fromCharCode(65533)),++r}return t.join("")}}},t={};function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}return i.m=e,i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch($v){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i("./src/index.js")}()},e.exports=i()}(Fv);var Wv=ie(Fv.exports);const Hv=hf.getTech("Html5"),Vv=hf.mergeOptions||hf.util.mergeOptions,Gv={mediaDataSource:{},config:{}};class zv extends Hv{constructor(e,t){super(e=Vv(Gv,e),t)}setSrc(e){this.flvPlayer&&(this.flvPlayer.detachMediaElement(),this.flvPlayer.destroy());const t=this.options_.mediaDataSource,i=this.options_.config;t.type=void 0===t.type?"flv":t.type,t.url=e,this.flvPlayer=Wv.createPlayer(t,i),this.flvPlayer.attachMediaElement(this.el_),this.flvPlayer.load()}dispose(){this.flvPlayer&&(this.flvPlayer.detachMediaElement(),this.flvPlayer.destroy()),super.dispose()}}zv.isSupported=function(){return Wv&&Wv.isSupported()},zv.formats={"video/flv":"FLV","video/x-flv":"FLV"},zv.canPlayType=function(e){return zv.isSupported()&&e in zv.formats?"maybe":""},zv.canPlaySource=function(e,t){return zv.canPlayType(e.type)},zv.VERSION="__VERSION__",hf.registerTech("Flvjs",zv);class Yv{constructor(e,t,i){switch(document.getElementsByClassName("popup-video").length>0&&document.getElementsByClassName("popup-video")[0].remove(),this.viewer=e,this.position=t,this.id="popup_video_"+fi(),this.popupDiv=document.createElement("div"),this.popupDiv.classList.add("popup-video"),this.popupDiv.id=this.id,this.viewer.container.append(this.popupDiv),this.popupDiv.innerHTML=this._createHtml(i),i.type){case"hls":this.videotype="application/x-mpegURL";break;case"rtmp":this.videotype="rtmp/flv";break;case"flv":this.videotype="video/x-flv";break;case"mp4":this.videotype="video/mp4"}this.videoPlayer=hf(document.querySelector("#myvideo"),{controls:!0,autoplay:"muted",loop:!0,muted:!1,fluid:!0,aspectRatio:"16:9",reload:"auto",fullscreen:{options:{navigationUI:"hide"}},sources:[{src:i.url,type:this.videotype}]},(function(){console.log("onPlayerReady",this)})),this._render(this.position),this.eventListener=this.viewer.clock.onTick.addEventListener((e=>{this._render(this.position)})),document.getElementsByClassName("popup-video-close-button")[0].onclick=()=>{this.close()}}_render(e){var t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e);null!=t&&(this.popupDiv.style.left=t.x-this.popupDiv.offsetWidth/2+"px",this.popupDiv.style.top=t.y-this.popupDiv.offsetHeight+40+"px"),this.viewer.camera.positionCartographic.height>2e5?this.popupDiv.style.display="none":this.popupDiv.style.display="block"}_createHtml(e){return`\n\t\t\t<div class="popup-video-header">\n\t\t\t\t${e.name}\n\t\t\t\t<span class="popup-video-close-button">×</span>\n\t\t\t</div>\n\t\t\t<div class="popup-video-content">\n\t\t\t\t<video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>\n\t\t\t</div>\n\t\t\t<div class="popup-video-tip">\n\t\t\t</div>\n\t\t`}}Object.assign(Yv.prototype,{close(){this.popupDiv.remove(),this.viewer.clock.onTick.removeEventListener(this.eventListener),hf("myvideo").dispose(),this.videoPlayer.dispose()}});class qv{constructor(e,t,i){switch(document.getElementsByClassName("popup-video2").length>0&&document.getElementsByClassName("popup-video2")[0].remove(),this.viewer=e,this.position=t,this.id="popup_video_"+fi(),this.popupDiv=document.createElement("div"),this.popupDiv.classList.add("popup-video2"),this.popupDiv.id=this.id,this.viewer.container.append(this.popupDiv),this.popupDiv.innerHTML=this._createHtml(i),i.type){case"hls":this.videotype="application/x-mpegURL";break;case"rtmp":this.videotype="rtmp/flv";break;case"flv":this.videotype="video/x-flv";break;case"mp4":this.videotype="video/mp4"}this.videoPlayer=hf(document.querySelector("#myvideo"),{controls:!0,autoplay:"muted",loop:!0,muted:!1,fluid:!0,aspectRatio:"16:9",reload:"auto",fullscreen:{options:{navigationUI:"hide"}},sources:[{src:i.url,type:this.videotype}]},(function(){console.log("onPlayerReady",this)})),this._render(this.position),this.eventListener=this.viewer.clock.onTick.addEventListener((e=>{this._render(this.position)})),document.getElementsByClassName("popup-close-button")[0].onclick=()=>{this.close()}}_render(e){var t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e);null!=t&&(this.popupDiv.style.left=t.x-this.popupDiv.offsetWidth-120+"px",this.popupDiv.style.top=t.y+"px"),this.viewer.camera.positionCartographic.height>2e5?this.popupDiv.style.display="none":this.popupDiv.style.display="block"}_createHtml(e){return`\n\t\t<div class="rightLine-1"></div>\n\t\t<div class="rightLine-2"></div>\n\t\t<div class="rightLine-3"></div>\n\t\t<div class="popup-header">\n\t\t\t<span class="popup-title" >${e.name}</span>\n\t\t\t<span class="popup-close-button" title="关闭" >×</span>\n\t\t</div>\n\t\t<div class="popup-content">\n\t\t\t<video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>\n\t\t</div>\n\t\t`}}Object.assign(qv.prototype,{close(){this.popupDiv.remove(),this.viewer.clock.onTick.removeEventListener(this.eventListener)}});class Xv{constructor(e,t,i,n){document.getElementsByClassName("popup1").length>0&&document.getElementsByClassName("popup1")[0].remove(),this.viewer=e,this.position=t,this.id="popup_"+fi(),this.popupDiv=document.createElement("div"),this.popupDiv.classList.add("popup1"),this.popupDiv.id=this.id,this.viewer.container.append(this.popupDiv),this.popupDiv.innerHTML=this._createHtml(i,n),this._render(this.position),this.eventListener=this.viewer.clock.onTick.addEventListener((e=>{this._render(this.position)})),document.getElementsByClassName("leaflet-popup-close-button")[0].onclick=()=>{this.close()}}_render(e){var t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e);null!=t&&(this.popupDiv.style.left=t.x-this.popupDiv.offsetWidth/2+"px",this.popupDiv.style.top=t.y-this.popupDiv.offsetHeight+40+"px"),this.viewer.camera.positionCartographic.height>2e5?this.popupDiv.style.display="none":this.popupDiv.style.display="block"}_createHtml(e,t){return`\n\t\t\t<div class="popup-header">\n\t\t\t\t\t${e}\n\t\t\t\t<span class="leaflet-popup-close-button">×</span>\n\t\t\t</div>\n\t\t\t<div class="popup-content">\n\t\t\t\t\t${t}\n\t\t\t</div>\n\t\t\t<div class="popup-tip">\n\t\t\t</div>\n\t\t`}}Object.assign(Xv.prototype,{close(){this.popupDiv.remove(),this.viewer.clock.onTick.removeEventListener(this.eventListener)}});class Zv{constructor(e,t,i,n){document.getElementsByClassName("popup2").length>0&&document.getElementsByClassName("popup2")[0].remove(),this.viewer=e,this.position=t,this.id="popup_"+fi(),this.popupDiv=document.createElement("div"),this.popupDiv.classList.add("popup2"),this.popupDiv.id=this.id,this.viewer.container.append(this.popupDiv),this.popupDiv.innerHTML=this._createHtml(i,n),this._render(this.position),this.eventListener=this.viewer.clock.onTick.addEventListener((e=>{this._render(this.position)})),document.getElementsByClassName("popup-close-button")[0].onclick=()=>{this.close()}}_render(e){var t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e);null!=t&&(this.popupDiv.style.left=t.x-this.popupDiv.offsetWidth-120+"px",this.popupDiv.style.top=t.y+"px"),this.viewer.camera.positionCartographic.height>2e5?this.popupDiv.style.display="none":this.popupDiv.style.display="block"}_createHtml(e,t){return`\n\t\t<div class="rightLine-1"></div>\n\t\t<div class="rightLine-2"></div>\n\t\t<div class="rightLine-3"></div>\n\t\t<div class="popup-header">\n\t\t\t<span class="popup-title" >${e}</span>\n\t\t\t<span class="popup-close-button" title="关闭" >×</span>\n\t\t</div>\n\t\t<div class="popup-content">\n\t\t\t\t${t}\n\t\t</div>\n\t\t`}}Object.assign(Zv.prototype,{close(){this.popupDiv.remove(),this.viewer.clock.onTick.removeEventListener(this.eventListener)}});class Qv{constructor(e,t,i,n){document.getElementsByClassName("popup3").length>0&&document.getElementsByClassName("popup3")[0].remove(),this.viewer=e,this.position=t,this.id="popup_"+fi(),this.popupDiv=document.createElement("div"),this.popupDiv.classList.add("popup3"),this.popupDiv.id=this.id,this.viewer.container.append(this.popupDiv),this.popupDiv.innerHTML=this._createHtml(i,n),this._render(this.position),this.eventListener=this.viewer.clock.onTick.addEventListener((e=>{this._render(this.position)})),document.getElementsByClassName("popup-close-button")[0].onclick=()=>{this.close()}}_render(e){var t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this.viewer.scene,e);null!=t&&(this.popupDiv.style.left=t.x+70+"px",this.popupDiv.style.top=t.y-this.popupDiv.offsetHeight-20+"px"),this.viewer.camera.positionCartographic.height>2e5?this.popupDiv.style.display="none":this.popupDiv.style.display="block"}_createHtml(e,t){return`\n\t\t<div class="leftLine-1"></div>\n\t\t<div class="leftLine-2"></div>\n\t\t<div class="popup-header">\n\t\t\t<span class="popup-title" >${e}</span>\n\t\t\t<span class="popup-close-button" title="关闭" >×</span>\n\t\t</div>\n\t\t<div class="popup-content">\n\t\t\t\t${t}\n\t\t</div>\n\t\t`}}Object.assign(Qv.prototype,{close(){this.popupDiv.remove(),this.viewer.clock.onTick.removeEventListener(this.eventListener)}});let Kv={MultiFieldAdaptWindow:yn,VideoWindow:Yv,VideoWindow2:qv,HtmlWindow:Xv,HtmlWindow2:Zv,HtmlWindow3:Qv};class Jv{constructor(e){if(!e)throw new n("no viewer object!");this._viewer=e}_createHtml(e){return'\n\t\t\t\t<video id="myVideoMapping" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>\n\t\t'}}Object.assign(Jv.prototype,{VideoRegionEntity(e,t){return new Promise(((r,o)=>{let s=this;if(!i(e))throw new n("points is required.");switch(e.length<3&&o("面对象,点数至少3个"),e.map((e=>Cesium.Cartesian3.fromDegrees(e[0],e[1],e[2]||0))),document.getElementsByClassName("VideoMapping").length>0&&document.getElementsByClassName("VideoMapping")[0].remove(),this.id="VideoMapping_"+fi(),this.popupDiv=document.createElement("div"),this.popupDiv.classList.add("VideoMapping"),this.popupDiv.id=this.id,this._viewer.container.append(this.popupDiv),this.popupDiv.innerHTML=this._createHtml(t),t.type){case"hls":this.videotype="application/x-mpegURL";break;case"rtmp":this.videotype="rtmp/flv";break;case"flv":this.videotype="video/x-flv";break;case"mp4":this.videotype="video/mp4"}this.videoPlayer=hf(document.querySelector("#myVideoMapping"),{controls:!0,autoplay:"muted",loop:!0,muted:!1,fluid:!0,aspectRatio:"16:9",reload:"auto",fullscreen:{options:{navigationUI:"hide"}},sources:[{src:t.url,type:this.videotype}]},(function(){console.log("onPlayerReady",this);let e=s._viewer.entities.add({polygon:{height:.1,hierarchy:new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights([121.600444,37.398272,37.95,121.600443,37.398272,33,121.600443,37.398341,33,121.600444,37.398341,37.95])),material:document.getElementById("myVideoMapping"),perPositionHeight:!0}});r(e)}))}))}});e.CommonTools=en,e.CoordTransform=m,e.DrawMilitaryPlot=vn,e.DrawTools=rn,e.FloatingLayer=v,e.LocateUtil=_,e.PointObject=Zi,e.PolygonObject=Ji,e.PolylineObject=Ki,e.PopupWindow=Kv,e.ReminderTip=b,e.SceneControl=qi,e.SceneEffects=Gi,e.SketchViewModel=$i,e.SpatialAnalysis=hi,e.TerrainAnalysis=yi,e.TrackRoam=Xi,e.VERSION="2.01",e.VideoPlugin=Jv,e.common=gi,e.jtMap3d=c,e.layer=g,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
|