| 1 | | (()=>{"use strict";var t,e={467(){const t=window.wp.blocks,e=window.wp.blockEditor,s=window.wp.components,i=window.wp.element,r=window.wp.primitives,n=window.ReactJSXRuntime;var a=(0,n.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,n.jsx)(r.Path,{d:"M16 10h4c.6 0 1-.4 1-1V5c0-.6-.4-1-1-1h-4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1zm-8 4H4c-.6 0-1 .4-1 1v4c0 .6.4 1 1 1h4c.6 0 1-.4 1-1v-4c0-.6-.4-1-1-1zm10-2.6L14.5 15l1.1 1.1 1.7-1.7c-.1 1.1-.3 2.3-.9 2.9-.3.3-.7.5-1.3.5h-4.5v1.5H15c.9 0 1.7-.3 2.3-.9 1-1 1.3-2.7 1.4-4l1.8 1.8 1.1-1.1-3.6-3.7zM6.8 9.7c.1-1.1.3-2.3.9-2.9.4-.4.8-.6 1.3-.6h4.5V4.8H9c-.9 0-1.7.3-2.3.9-1 1-1.3 2.7-1.4 4L3.5 8l-1 1L6 12.6 9.5 9l-1-1-1.7 1.7z"})});const o=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"muvi-dental/dental-education-video","title":"Dental Video","category":"embed","icon":"video-alt3","description":"Embed a dental education video from the Toothority library.","attributes":{"topic":{"type":"string","default":""}},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","viewScript":"file:./view.js"}'),l=(0,n.jsxs)(r.SVG,{viewBox:"0 0 470.4 392",xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)(r.Path,{fill:"#19bad1",d:"M376.5,31c-29.1-16.1-62.1-24.1-98.9-24.1s-69.9,8-99.3,24.1c-10.5,5.7-20.1,12.3-28.9,19.6l53.4,38.1c3.5-2.5,7-4.9,10.8-7,18.9-10.7,40.2-16.1,64-16.1s45.1,5.4,64,16.1c18.9,10.7,33.7,26,44.4,45.8,10.7,19.8,16.1,42.5,16.1,68.2s-5.4,48.4-16.1,68.2c-10.7,19.8-25.5,35.2-44.4,46.1-18.9,11-40.2,16.4-64,16.4s-45.1-5.5-64-16.4c-4-2.3-7.8-4.9-11.4-7.6l-53,38.3c8.9,7.5,18.6,14.1,29.1,20,29.4,16.3,62.4,24.5,99.3,24.5s69.8-8.1,98.9-24.5c29.1-16.3,52-38.8,68.5-67.5,16.5-28.7,24.8-61.2,24.8-97.5s-8.3-68.9-24.8-97.5c-16.6-28.7-39.4-51-68.5-67.1"}),(0,n.jsx)(r.Path,{fill:"#d721b4",d:"M174.9,273.7l98.5-71c.6-.5,1.2-1,1.7-1.6,1.4-1.7,2.1-3.9,2.1-6.1s0-1.5-.2-2.2c-.3-1.4-1-2.8-1.9-3.9-.5-.6-1-1.1-1.7-1.6L13.7,2c-.7-.5-1.5-.9-2.2-1.1-.3,0-.5,0-.8-.1-.5-.1-1-.2-1.5-.2-.7,0-1.3,0-1.9.2-.2,0-.3.1-.5.2-.5.2-.9.3-1.4.6-.2.1-.3.2-.5.3-.5.3-1,.7-1.4,1.1,0,0-.1.1-.2.2-.5.5-.9,1.1-1.3,1.7,0,.2-.2.3-.3.5-.2.5-.5,1-.6,1.5,0,.2-.1.4-.2.6-.2.7-.3,1.5-.3,2.3v372.6c0,.8.1,1.6.3,2.3,0,.2.1.4.2.6.2.5.4,1.1.6,1.5,0,.2.2.3.3.5.3.6.8,1.2,1.2,1.7,0,0,.1.1.2.2.4.4.9.8,1.4,1.1.2.1.3.2.5.3.4.2.9.4,1.4.6.2,0,.3.1.5.2.6.2,1.3.2,1.9.2.5,0,1-.1,1.5-.2.3,0,.5,0,.8-.1.8-.3,1.5-.6,2.2-1.2l108.1-78,53.1-38.3Z"})]}),h=[{name:"General & Preventive",slug:"general",videos:[{label:"Brushing",value:"brushing"},{label:"Flossing",value:"flossing"},{label:"Nutrition",value:"nutrition"},{label:"Oral Hygiene",value:"oral-hygiene"},{label:"Sealants",value:"sealants"},{label:"Tooth Decay",value:"caries"}]},{name:"Restorative",slug:"restorative",videos:[{label:"Crowns",value:"crowns"},{label:"Dental Bridge",value:"dental-bridge"},{label:"Fillings",value:"fillings"},{label:"Full Mouth Restoration",value:"full-mouth-restoration"},{label:"Teeth Whitening",value:"teeth-whitening"},{label:"Teeth Whitening (Home)",value:"teeth-whitening-home"},{label:"Teeth Whitening (Office)",value:"teeth-whitening-office"},{label:"Veneers",value:"veneers"}]},{name:"Implants",slug:"implants",videos:[{label:"Bone Graft",value:"bone-graft"},{label:"Dental Implants",value:"dental-implants"},{label:"Denture Stabilization",value:"denture-stabilization"},{label:"Implant Bridge",value:"implant-bridge"},{label:"Mini Dental Implants",value:"mini-implants"},{label:"Multiple Mini Implants",value:"multi-implant-minis"},{label:"Single Mini Implant",value:"single-implant-minis"}]},{name:"Periodontics",slug:"periodontics",videos:[{label:"Bone Graft",value:"bone-graft"},{label:"Crown Lengthening",value:"crown-lengthening"},{label:"Gingivectomy",value:"gingivectomy"},{label:"Gum Disease",value:"gum-disease"},{label:"Gum Recession",value:"gum-recession"},{label:"Scaling & Root Planing",value:"scaling-root-planing"}]},{name:"Endodontics",slug:"endodontics",videos:[{label:"Apicoectomy",value:"apicoectomy"},{label:"Root Canal Therapy",value:"root-canal"}]},{name:"Oral Surgery",slug:"oral-surgery",videos:[{label:"Frenectomy",value:"frenectomy"},{label:"Sinus Augmentation",value:"sinus-augmentation"},{label:"Wisdom Teeth",value:"wisdom-teeth"}]},{name:"Orthodontics",slug:"orthodontics",videos:[{label:"Invisible Aligners",value:"invisible-aligners"},{label:"Lower Lingual Holding Arch",value:"lower-lingual-holding-arch"},{label:"Oral Habits & Expanders",value:"oral-habits"},{label:"Orthodontics",value:"orthodontics"},{label:"Space Maintainer",value:"space-maintainer"}]},{name:"Prosthetics",slug:"prosthetics",videos:[{label:"Dental Flipper",value:"dental-flipper"},{label:"Dentures",value:"dentures"},{label:"Nesbit Partial",value:"nesbit-partial"},{label:"Partial Dentures",value:"partial-dentures"}]},{name:"Pediatric",slug:"pediatric",videos:[{label:"Brushing",value:"brushing"},{label:"Flossing",value:"flossing"},{label:"Frenectomy",value:"frenectomy"},{label:"Growth & Development",value:"growth-development"},{label:"Primary Tooth Eruption",value:"primary-tooth-eruption"},{label:"Sealants",value:"sealants"},{label:"Space Maintainer",value:"space-maintainer"}]},{name:"Other",slug:"other",videos:[{label:"Bruxism",value:"bruxism"},{label:"TMJ & TMD",value:"tmd"}]}],d=h.flatMap(t=>t.videos).filter((t,e,s)=>s.findIndex(e=>e.value===t.value)===e).sort((t,e)=>t.label.localeCompare(e.label));function c(t){return d.find(e=>e.value===t)}function u({onSelect:t}){return(0,n.jsx)(s.Placeholder,{icon:l,label:"Dental Education Video",instructions:"Select a video from the Toothority library to embed on your page.",children:(0,n.jsx)(s.Button,{variant:"primary",onClick:t,children:"Browse Video Library"})})}function f({onSelect:t,onClose:e,currentTopic:r}){const a=window.muviAuth?.authorized??!1,[o,l]=(0,i.useState)(""),[c,u]=(0,i.useState)("all"),f=(0,i.useMemo)(()=>{let t="all"===c?d:h.find(t=>t.slug===c)?.videos||[];if(o){const e=o.toLowerCase();t=t.filter(t=>t.label.toLowerCase().includes(e))}return t},[o,c]);return(0,n.jsx)(s.Modal,{title:"Select a Dental Education Video",onRequestClose:e,isFullScreen:!0,className:"muvi-picker-modal",children:(0,n.jsxs)("div",{className:"muvi-picker",children:[(0,n.jsxs)("div",{className:"muvi-picker__header",children:[(0,n.jsx)("img",{src:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAzMzUyLjUgNzI5LjQiPgogIDwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAzMC4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiAyLjEuMSBCdWlsZCAxMzYpICAtLT4KICA8ZGVmcz4KICAgIDxzdHlsZT4KICAgICAgLnN0MCB7CiAgICAgICAgZmlsbDogI2Q3MjFiNDsKICAgICAgfQoKICAgICAgLnN0MSB7CiAgICAgICAgZmlsbDogI2ZmZjsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2RlZnM+CiAgPGc+CiAgICA8cGF0aCBjbGFzcz0ic3QxIiBkPSJNODc4LjEsMTg2LjZjLTMxLjQtMTcuNC02Ny0yNi0xMDYuOC0yNnMtNzUuNSw4LjctMTA3LjEsMjZjLTEzLjEsNy4yLTI0LjksMTUuNS0zNS42LDI1LDYuNCw4LjMsMTIuMiwxNywxNy42LDI2LjMsNywxMi4xLDEyLjcsMjQuNywxNy40LDM3LjksMTAuNS0xNC4zLDIzLjQtMjUuNywzOC43LTM0LjQsMjAuNC0xMS42LDQzLjQtMTcuNCw2OS0xNy40czQ4LjcsNS44LDY5LDE3LjRjMjAuNCwxMS42LDM2LjMsMjgsNDcuOSw0OS40LDExLjYsMjEuNCwxNy40LDQ1LjksMTcuNCw3My42cy01LjgsNTIuMi0xNy40LDczLjZjLTExLjYsMjEuNC0yNy41LDM4LTQ3LjksNDkuOC0yMC40LDExLjgtNDMuNCwxNy43LTY5LDE3LjdzLTQ4LjctNS45LTY5LTE3LjdjLTE1LjMtOC45LTI4LjItMjAuNS0zOC43LTM0LjgtNC43LDEzLjEtMTAuNSwyNS44LTE3LjQsMzcuOC01LjMsOS4zLTExLjIsMTgtMTcuNiwyNi40LDEwLjcsOS41LDIyLjYsMTgsMzUuNywyNS4zLDMxLjcsMTcuNiw2Ny40LDI2LjQsMTA3LjEsMjYuNHM3NS4zLTguOCwxMDYuOC0yNi40YzMxLjQtMTcuNiw1Ni4xLTQxLjksNzMuOS03Mi44LDE3LjgtMzAuOSwyNi44LTY2LDI2LjgtMTA1LjNzLTguOS03NC4zLTI2LjgtMTA1LjNjLTE3LjktMzAuOS00Mi41LTU1LjEtNzMuOS03Mi40WiIvPgogICAgPHBhdGggY2xhc3M9InN0MSIgZD0iTTEzNy45LDUwNy43Yy0yMC4xLDAtMzUuNi01LjgtNDYuNC0xNy40LTEwLjgtMTEuNi0xNi4yLTI4LjItMTYuMi00OS44di0yMTYuNWgxMTQuN3YtNTkuNmgtMTE0Ljd2LTg3LjVIMi45djM2Ni43YzAsNDAuMiwxMS4xLDcxLjIsMzMuMiw5Mi44LDIyLjEsMjEuNiw1My4zLDMyLjQsOTMuNiwzMi40czMyLjctMi40LDQ4LjMtNy4yYzE1LjYtNC44LDI4LjctMTEuNywzOS4yLTIwLjdsLTIyLjYtNTIuMWMtMTUuNiwxMi42LTM0LjUsMTguOS01Ni42LDE4LjlaIi8+CiAgICA8cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTM1LjYsMTg2LjZjLTMxLjQtMTcuNC02Ny0yNi0xMDYuOC0yNnMtNzUuNSw4LjctMTA3LjEsMjZjLTMxLjcsMTcuNC01Ni41LDQxLjUtNzQuMyw3Mi40LTE3LjksMzAuOS0yNi44LDY2LTI2LjgsMTA1LjNzOC45LDc0LjMsMjYuOCwxMDUuM2MxNy44LDMwLjksNDIuNiw1NS4yLDc0LjMsNzIuOCwzMS43LDE3LjYsNjcuNCwyNi40LDEwNy4xLDI2LjRzNzUuMy04LjgsMTA2LjgtMjYuNGMzMS40LTE3LjYsNTYuMS00MS45LDczLjktNzIuOCwxNy44LTMwLjksMjYuOC02NiwyNi44LTEwNS4zcy04LjktNzQuMy0yNi44LTEwNS4zYy0xNy45LTMwLjktNDIuNS01NS4xLTczLjktNzIuNFpNNTQ1LjgsNDM3LjljLTExLjYsMjEuNC0yNy41LDM4LTQ3LjksNDkuOC0yMC40LDExLjgtNDMuNCwxNy43LTY5LDE3LjdzLTQ4LjctNS45LTY5LTE3LjdjLTIwLjQtMTEuOC0zNi41LTI4LjQtNDguMy00OS44LTExLjgtMjEuNC0xNy43LTQ1LjktMTcuNy03My42czUuOS01Mi4yLDE3LjctNzMuNmMxMS44LTIxLjQsMjcuOS0zNy44LDQ4LjMtNDkuNCwyMC40LTExLjYsNDMuNC0xNy40LDY5LTE3LjRzNDguNyw1LjgsNjksMTcuNGMyMC40LDExLjYsMzYuMywyOCw0Ny45LDQ5LjQsMTEuNiwyMS40LDE3LjQsNDUuOSwxNy40LDczLjZzLTUuOCw1Mi4yLTE3LjQsNzMuNloiLz4KICAgIDxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yMTMzLjMsMTg2LjZjLTMxLjQtMTcuNC02Ny0yNi0xMDYuOC0yNnMtNzUuNSw4LjctMTA3LjEsMjZjLTExLjMsNi4yLTIxLjcsMTMuMy0zMS4yLDIxLjJsNTcuNiw0MS4xYzMuNy0yLjcsNy42LTUuMywxMS43LTcuNiwyMC40LTExLjYsNDMuNC0xNy40LDY5LTE3LjRzNDguNyw1LjgsNjksMTcuNGMyMC40LDExLjYsMzYuMywyOCw0Ny45LDQ5LjQsMTEuNiwyMS40LDE3LjQsNDUuOSwxNy40LDczLjZzLTUuOCw1Mi4yLTE3LjQsNzMuNmMtMTEuNiwyMS40LTI3LjUsMzgtNDcuOSw0OS44LTIwLjQsMTEuOC00My40LDE3LjctNjksMTcuN3MtNDguNy01LjktNjktMTcuN2MtNC4zLTIuNS04LjQtNS4yLTEyLjMtOC4ybC01Ny4yLDQxLjNjOS42LDgsMjAsMTUuMywzMS40LDIxLjYsMzEuNywxNy42LDY3LjQsMjYuNCwxMDcuMSwyNi40czc1LjMtOC44LDEwNi44LTI2LjRjMzEuNC0xNy42LDU2LjEtNDEuOSw3My45LTcyLjgsMTcuOC0zMC45LDI2LjgtNjYsMjYuOC0xMDUuM3MtOC45LTc0LjMtMjYuOC0xMDUuM2MtMTcuOS0zMC45LTQyLjUtNTUuMS03My45LTcyLjRaIi8+CiAgICA8cGF0aCBjbGFzcz0ic3QxIiBkPSJNMTE2Ny43LDUwNy43Yy0yMC4xLDAtMzUuNi01LjgtNDYuNC0xNy40LTEwLjgtMTEuNi0xNi4yLTI4LjItMTYuMi00OS44di0yMTYuNWgxMTQuN3YtNTkuNmgtMTE0Ljd2LTg3LjVoLTcyLjR2MzY2LjdjMCw0MC4yLDExLjEsNzEuMiwzMy4yLDkyLjgsMjIuMSwyMS42LDUzLjMsMzIuNCw5My42LDMyLjRzMzIuNy0yLjQsNDguMy03LjJjMTUuNi00LjgsMjguNy0xMS43LDM5LjItMjAuN2wtMjIuNi01Mi4xYy0xNS42LDEyLjYtMzQuNSwxOC45LTU2LjYsMTguOVoiLz4KICAgIDxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yMzU2LjYsMjQyLjF2LTY3LjJoLTY5LjR2Mzk5LjloNzIuNHYtMTk5LjJjMC00My4zLDExLjItNzYuNiwzMy42LTEwMCwyMi40LTIzLjQsNTMuMi0zNS4xLDkyLjQtMzUuMXMxMi42LjMsMTYuNi44di03MC4yYy0zNS4yLDAtNjUuMSw2LTg5LjgsMTguMS0yNC43LDEyLjEtNDMuMywyOS43LTU1LjgsNTIuOFoiLz4KICAgIDxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yNjA1LjcsMy43Yy0xNC4xLDAtMjUuOCw0LjctMzUuMSwxNC05LjMsOS4zLTE0LDIwLjUtMTQsMzMuNnM0LjYsMjQuMSwxNCwzMy4yYzkuMyw5LjEsMjEsMTMuNiwzNS4xLDEzLjZzMjUuOC00LjYsMzUuMS0xNGM5LjMtOS4zLDE0LTIwLjcsMTQtMzQuM3MtNC43LTI0LTE0LTMyLjhjLTkuMy04LjgtMjEtMTMuMi0zNS4xLTEzLjJaIi8+CiAgICA8cmVjdCBjbGFzcz0ic3QxIiB4PSIyNTY5LjUiIHk9IjE3NC45IiB3aWR0aD0iNzIuNCIgaGVpZ2h0PSIzOTkuOSIvPgogICAgPHBhdGggY2xhc3M9InN0MSIgZD0iTTI4NTIuMyw1MTguMmMtMjAuMSwwLTM1LjYtNS44LTQ2LjQtMTcuNC0xMC44LTExLjYtMTYuMi0yOC4yLTE2LjItNDkuOHYtMjE2LjVoMTE0Ljd2LTU5LjZoLTExNC43di04Ny41aC03Mi40djM2Ni43YzAsNDAuMiwxMS4xLDcxLjIsMzMuMiw5Mi44LDIyLjEsMjEuNiw1My4zLDMyLjQsOTMuNiwzMi40czMyLjctMi40LDQ4LjMtNy4yYzE1LjYtNC44LDI4LjctMTEuNywzOS4yLTIwLjdsLTIyLjYtNTIuMWMtMTUuNiwxMi42LTM0LjUsMTguOS01Ni42LDE4LjlaIi8+CiAgICA8cGF0aCBjbGFzcz0ic3QxIiBkPSJNMzI3Ny4yLDE3NC45djE4NS42YzAsNDIuMi0xMS4xLDc1LTMzLjIsOTguMS0yMi4xLDIzLjEtNTIuMywzNC43LTkwLjUsMzQuN3MtNjEuNC05LjktODAtMjkuOGMtMTguNi0xOS45LTI3LjktNDguOS0yNy45LTg3LjF2LTIwMS41aC03Mi40djIwOS44YzAsNTcuMywxNS4zLDEwMC42LDQ2LDEyOS44LDMwLjcsMjkuMiw3Mi43LDQzLjgsMTI2LDQzLjhzNTIuMy01LjIsNzUuNS0xNS41YzIzLjEtMTAuMyw0Mi0yNSw1Ni42LTQ0LjF2MjkuNGMwLDQ1LjMtMTAuMyw3OC44LTMwLjksMTAwLjctMjAuNiwyMS45LTUyLjgsMzIuOC05Ni42LDMyLjhzLTUzLjktNC41LTc4LjgtMTMuNmMtMjQuOS05LjEtNDYuMi0yMS42LTYzLjgtMzcuN2wtMzUuNSw1NS44YzIwLjYsMTkuMSw0Ny4yLDMzLjgsNzkuNiw0NC4xLDMyLjQsMTAuMyw2Ni41LDE1LjUsMTAyLjIsMTUuNSw2NS40LDAsMTE0LjQtMTYuNywxNDcuMS01MC4yLDMyLjctMzMuNSw0OS04NS4xLDQ5LTE1NS4xVjE3NC45aC03Mi40WiIvPgogICAgPHBhdGggY2xhc3M9InN0MSIgZD0iTTE1MDEuNiwxNjAuNmMtMzAuMiwwLTU3LjUsNS4zLTgxLjksMTUuOC0yNC40LDEwLjYtNDQuMSwyNS40LTU5LjIsNDQuNVY0LjRoLTcyLjR2NTU5LjhoNzIuNHYtMjA2YzAtNDIuNywxMS4zLTc1LjYsMzQtOTguNSwyMi42LTIyLjksNTMuNi0zNC4zLDkyLjgtMzQuM3M2MS40LDkuOCw4MCwyOS40YzE4LjYsMTkuNiwyNy45LDQ4LjgsMjcuOSw4Ny41djIyMS44aDcyLjR2LTIzMC4xYzAtNTYuOC0xNS0xMDAtNDQuOS0xMjkuNC0yOS45LTI5LjQtNzAuMy00NC4xLTEyMS4xLTQ0LjFaIi8+CiAgPC9nPgogIDxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xOTE1LjgsNDQ4LjVsMTA2LjMtNzYuN2MuNy0uNSwxLjMtMS4xLDEuOC0xLjcsMS41LTEuOSwyLjMtNC4yLDIuMy02LjYsMC0uOCwwLTEuNi0uMy0yLjQtLjMtMS41LTEtMy0yLjEtNC4yLS41LS42LTEuMS0xLjItMS44LTEuN2wtMjgwLjItMTk5LjljLS44LS42LTEuNi0xLTIuNC0xLjItLjMsMC0uNiwwLS45LS4yLS41LS4xLTEuMS0uMi0xLjYtLjMtLjcsMC0xLjQsMC0yLjEuMi0uMiwwLS40LjEtLjUuMi0uNS4yLTEsLjQtMS41LjYtLjIuMS0uNC4yLS42LjMtLjUuMy0xLjEuNy0xLjUsMS4yLDAsMC0uMS4xLS4yLjItLjUuNS0xLDEuMS0xLjQsMS44LS4xLjItLjIuNC0uMy42LS4zLjUtLjUsMS4xLS43LDEuNiwwLC4yLS4xLjQtLjIuNy0uMi44LS4zLDEuNi0uMywyLjV2NDAyLjFjMCwuOS4xLDEuNy4zLDIuNSwwLC4yLjEuNS4yLjcuMi42LjQsMS4xLjcsMS43LDAsLjIuMi40LjMuNi40LjcuOCwxLjMsMS40LDEuOCwwLDAsLjEuMS4yLjIuNS40LDEsLjgsMS41LDEuMi4yLjEuNC4yLjYuMy41LjMsMSwuNSwxLjUuNi4yLDAsLjMuMS41LjIuNy4yLDEuNC4zLDIuMS4yLjUsMCwxLjEtLjEsMS42LS4zLjMsMCwuNiwwLC44LS4yLjgtLjMsMS42LS43LDIuNC0xLjJsMTE2LjYtODQuMSw1Ny4yLTQxLjNaIi8+Cjwvc3ZnPg==",alt:"Toothority",className:"muvi-picker__logo"}),(0,n.jsx)("div",{className:"muvi-picker__search-wrap",children:(0,n.jsx)(s.SearchControl,{value:o,onChange:l,placeholder:"Search videos..."})}),!a&&(0,n.jsx)("a",{className:"muvi-picker__subscribe-link",href:"https://toothority.com/toothority-web",target:"_blank",rel:"noopener noreferrer",children:"Sign Up for $99/mo"}),(0,n.jsx)("button",{className:"muvi-picker__close-btn",onClick:e,"aria-label":"Close",type:"button",children:(0,n.jsx)("svg",{viewBox:"0 0 24 24",width:"20",height:"20",children:(0,n.jsx)("path",{fill:"currentColor",d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})})]}),(0,n.jsxs)("div",{className:"muvi-picker__categories-bar",children:[(0,n.jsx)("button",{className:"muvi-picker__category-btn "+("all"===c?"is-active":""),onClick:()=>{u("all"),l("")},children:"All"}),h.map(t=>(0,n.jsx)("button",{className:"muvi-picker__category-btn "+(c===t.slug?"is-active":""),onClick:()=>{u(t.slug),l("")},children:t.name},t.slug))]}),(0,n.jsxs)("div",{className:"muvi-picker__grid",children:[f.map(e=>(0,n.jsxs)("button",{className:"muvi-picker__item "+(e.value===r?"is-selected":""),onClick:()=>t(e.value),children:[(0,n.jsx)("img",{src:"https://assets.toothority.com/img/posters-chairside/"+e.value+".jpg",alt:e.label,loading:"lazy"}),(0,n.jsx)("span",{className:"muvi-picker__item-label",children:e.label})]},e.value)),0===f.length&&(0,n.jsx)("p",{className:"muvi-picker__no-results",children:"No videos match your search."})]})]})})}window.React;const g=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},m=Number.isSafeInteger||function(t){return"number"==typeof t&&Math.abs(t)<=p},p=Number.MAX_SAFE_INTEGER||9007199254740991;let v=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),y=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",t.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",t.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.ASSET_LIST_LOAD_ERROR="assetListLoadError",t.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",t.ASSET_LIST_PARSING_ERROR="assetListParsingError",t.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.ATTACH_MEDIA_ERROR="attachMediaError",t.UNKNOWN="unknown",t}({}),E=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.MEDIA_ENDED="hlsMediaEnded",t.STALL_RESOLVED="hlsStallResolved",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFERED_TO_END="hlsBufferedToEnd",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t.ASSET_LIST_LOADING="hlsAssetListLoading",t.ASSET_LIST_LOADED="hlsAssetListLoaded",t.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",t.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",t.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",t.INTERSTITIAL_STARTED="hlsInterstitialStarted",t.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",t.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",t.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",t.INTERSTITIAL_ENDED="hlsInterstitialEnded",t.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",t.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",t.EVENT_CUE_ENTER="hlsEventCueEnter",t}({});var T="manifest",S="level",L="audioTrack",A="subtitleTrack",I="main",b="audio",R="subtitle";class k{constructor(t,e=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=s}sample(t,e){const s=Math.pow(this.alpha_,t);this.estimate_=e*(1-s)+s*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class D{constructor(t,e,s,i=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new k(t),this.fast_=new k(e),this.defaultTTFB_=i,this.ttfb_=new k(t)}update(t,e){const{slow_:s,fast_:i,ttfb_:r}=this;s.halfLife!==t&&(this.slow_=new k(t,s.getEstimate(),s.getTotalWeight())),i.halfLife!==e&&(this.fast_=new k(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.ttfb_=new k(t,r.getEstimate(),r.getTotalWeight()))}sample(t,e){const s=(t=Math.max(t,this.minDelayMs_))/1e3,i=8*e/s;this.fast_.sample(s,i),this.slow_.sample(s,i)}sampleTTFB(t){const e=t/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(s,Math.max(t,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function C(t,e,s){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,e);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function M(){return M=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var i in s)({}).hasOwnProperty.call(s,i)&&(t[i]=s[i])}return t},M.apply(null,arguments)}function _(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),s.push.apply(s,i)}return s}function w(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{};e%2?_(Object(s),!0).forEach(function(e){C(t,e,s[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):_(Object(s)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))})}return t}class P{constructor(t,e){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const s=`[${t}]:`;this.trace=x,this.debug=e.debug.bind(null,s),this.log=e.log.bind(null,s),this.warn=e.warn.bind(null,s),this.info=e.info.bind(null,s),this.error=e.error.bind(null,s)}}const x=function(){},O={trace:x,debug:x,log:x,warn:x,info:x,error:x};function N(){return M({},O)}function F(t,e,s){return e[t]?e[t].bind(e):function(t,e){const s=self.console[t];return s?s.bind(self.console,`${e?"["+e+"] ":""}[${t}] >`):x}(t,s)}const U=N(),B=U;function $(t=!0){if("undefined"!=typeof self)return(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function j(t,e){const s=Object.keys(t),i=Object.keys(e),r=s.length,n=i.length;return!r||!n||r===n&&!s.some(t=>-1===i.indexOf(t))}function G(t,e=!1){if("undefined"!=typeof TextDecoder){const s=new TextDecoder("utf-8").decode(t);if(e){const t=s.indexOf("\0");return-1!==t?s.substring(0,t):s}return s.replace(/\0/g,"")}const s=t.length;let i,r,n,a="",o=0;for(;o<s;){if(i=t[o++],0===i&&e)return a;if(0!==i&&3!==i)switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:a+=String.fromCharCode(i);break;case 12:case 13:r=t[o++],a+=String.fromCharCode((31&i)<<6|63&r);break;case 14:r=t[o++],n=t[o++],a+=String.fromCharCode((15&i)<<12|(63&r)<<6|63&n)}}return a}function K(t){let e="";for(let s=0;s<t.length;s++){let i=t[s].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function V(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function H(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Y,z,W,q,Q,X,Z={exports:{}},J=(Y||(Y=1,z=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,W=/^(?=([^\/?#]*))\1([^]*)$/,q=/(?:\/|^)\.(?=\/)/g,Q=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,Z.exports=X={buildAbsoluteURL:function(t,e,s){if(s=s||{},t=t.trim(),!(e=e.trim())){if(!s.alwaysNormalize)return t;var i=X.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=X.normalizePath(i.path),X.buildURLFromParts(i)}var r=X.parseURL(e);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return s.alwaysNormalize?(r.path=X.normalizePath(r.path),X.buildURLFromParts(r)):e;var n=X.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var a=W.exec(n.path);n.netLoc=a[1],n.path=a[2]}n.netLoc&&!n.path&&(n.path="/");var o={scheme:n.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(o.netLoc=n.netLoc,"/"!==r.path[0]))if(r.path){var l=n.path,h=l.substring(0,l.lastIndexOf("/")+1)+r.path;o.path=X.normalizePath(h)}else o.path=n.path,r.params||(o.params=n.params,r.query||(o.query=n.query));return null===o.path&&(o.path=s.alwaysNormalize?X.normalizePath(r.path):r.path),X.buildURLFromParts(o)},parseURL:function(t){var e=z.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(q,"");t.length!==(t=t.replace(Q,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}}),Z.exports);class tt{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var et="audio",st="video",it="audiovideo";class rt{constructor(t){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof t&&(t={url:t}),this.base=t,function(t,e){const s=lt(t,e);s&&(s.enumerable=!0,Object.defineProperty(t,e,s))}(this,"stats")}setByteRange(t,e){const s=t.split("@",2);let i;i=1===s.length?(null==e?void 0:e.byteRangeEndOffset)||0:parseInt(s[1]),this._byteRange=[i,parseInt(s[0])+i]}get baseurl(){return this.base.url}get byteRange(){return null===this._byteRange?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return null===this._streams&&(this._streams={[et]:null,[st]:null,[it]:null}),this._streams}set elementaryStreams(t){this._streams=t}get hasStats(){return null!==this._stats}get hasStreams(){return null!==this._streams}get stats(){return null===this._stats&&(this._stats=new tt),this._stats}set stats(t){this._stats=t}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=J.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[et]=null,t[st]=null,t[it]=null}}function nt(t){return"initSegment"!==t.sn}class at extends rt{constructor(t,e){super(e),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=t}get byteLength(){if(this.hasStats){const t=this.stats.total;if(t)return t}if(this.byteRange.length){const t=this.byteRange[0],e=this.byteRange[1];if(g(t)&&g(e))return e-t}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null}set bitrate(t){this._bitrate=t}get decryptdata(){var t;const{levelkeys:e}=this;if(!e||e.NONE)return null;if(e.identity)this._decryptdata||(this._decryptdata=e.identity.getDecryptData(this.sn));else if(null==(t=this._decryptdata)||!t.keyId){const t=Object.keys(e);if(1===t.length){const s=this._decryptdata=e[t[0]]||null;s&&(this._decryptdata=s.getDecryptData(this.sn,e))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;const t=g(this.duration)?this.duration:0;return this.programDateTime+1e3*t}get encrypted(){var t;if(null!=(t=this._decryptdata)&&t.encrypted)return!0;if(this.levelkeys){var e;const t=Object.keys(this.levelkeys),s=t.length;if(s>1||1===s&&null!=(e=this.levelkeys[t[0]])&&e.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(t){g(t)?this._programDateTime=t:this._programDateTime=this.rawProgramDateTime=null}get ref(){return nt(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(t){this.setStart(this.start+t)}setStart(t){this.start=t,this._ref&&(this._ref.start=t)}setDuration(t){this.duration=t,this._ref&&(this._ref.duration=t)}setKeyFormat(t){const e=this.levelkeys;if(e){var s;const i=e[t];!i||null!=(s=this._decryptdata)&&s.keyId||(this._decryptdata=i.getDecryptData(this.sn,e))}}abortRequests(){var t,e;null==(t=this.loader)||t.abort(),null==(e=this.keyLoader)||e.abort()}setElementaryStreamInfo(t,e,s,i,r,n=!1){const{elementaryStreams:a}=this,o=a[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,s),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,r)):a[t]={startPTS:e,endPTS:s,startDTS:i,endDTS:r,partial:n}}}class ot extends rt{constructor(t,e,s,i,r){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=e,this.index=i;const n=t.enumeratedString("BYTERANGE");n&&this.setByteRange(n,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}function lt(t,e){const s=Object.getPrototypeOf(t);if(s){return Object.getOwnPropertyDescriptor(s,e)||lt(s,e)}}const ht=Math.pow(2,32)-1,dt=[].push,ct={video:1,audio:2,id3:3,text:4};function ut(t){return String.fromCharCode.apply(null,t)}function ft(t,e){const s=t[e]<<8|t[e+1];return s<0?65536+s:s}function gt(t,e){const s=pt(t,e);return s<0?4294967296+s:s}function mt(t,e){let s=gt(t,e);return s*=Math.pow(2,32),s+=gt(t,e+4),s}function pt(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function vt(t,e){const s=[];if(!e.length)return s;const i=t.byteLength;for(let r=0;r<i;){const n=gt(t,r),a=n>1?r+n:i;if(ut(t.subarray(r+4,r+8))===e[0])if(1===e.length)s.push(t.subarray(r+8,a));else{const i=vt(t.subarray(r+8,a),e.slice(1));i.length&&dt.apply(s,i)}r=a}return s}function yt(t){const e=[],s=t[0];let i=8;const r=gt(t,i);i+=4;let n=0,a=0;0===s?(n=gt(t,i),a=gt(t,i+4),i+=8):(n=mt(t,i),a=mt(t,i+8),i+=16),i+=2;let o=t.length+a;const l=ft(t,i);i+=2;for(let s=0;s<l;s++){let s=i;const n=gt(t,s);s+=4;const a=2147483647&n;if(1==(2147483648&n)>>>31)return B.warn("SIDX has hierarchical references (not supported)"),null;const l=gt(t,s);s+=4,e.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/r,start:o,end:o+a-1}}),o+=a,s+=4,i=s}return{earliestPresentationTime:n,timescale:r,version:s,referencesCount:l,references:e}}function Et(t){const e=[],s=vt(t,["moov","trak"]);for(let t=0;t<s.length;t++){const i=s[t],r=vt(i,["tkhd"])[0];if(r){let t=r[0];const s=gt(r,0===t?12:20),n=vt(i,["mdia","mdhd"])[0];if(n){t=n[0];const r=gt(n,0===t?12:20),a=vt(i,["mdia","hdlr"])[0];if(a){const t=ut(a.subarray(8,12)),n={soun:et,vide:st}[t],o=Tt(vt(i,["mdia","minf","stbl","stsd"])[0]);n?(e[s]={timescale:r,type:n,stsd:o},e[n]=w({timescale:r,id:s},o)):e[s]={timescale:r,type:t,stsd:o}}}}}return vt(t,["moov","mvex","trex"]).forEach(t=>{const s=gt(t,4),i=e[s];i&&(i.default={duration:gt(t,12),flags:gt(t,20)})}),e}function Tt(t){const e=t.subarray(8),s=e.subarray(86),i=ut(e.subarray(4,8));let r,n=i;const a="enca"===i||"encv"===i;if(a){const t=vt(e,[i])[0];vt(t.subarray("enca"===i?28:78),["sinf"]).forEach(t=>{const e=vt(t,["schm"])[0];if(e){const s=ut(e.subarray(4,8));if("cbcs"===s||"cenc"===s){const e=vt(t,["frma"])[0];e&&(n=ut(e))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const t=vt(s,["avcC"])[0];t&&t.length>3&&(n+="."+At(t[1])+At(t[2])+At(t[3]),r=St("avc1"===o?"dva1":"dvav",s));break}case"mp4a":{const t=vt(e,[i])[0],s=vt(t.subarray(28),["esds"])[0];if(s&&s.length>7){let t=4;if(3!==s[t++])break;t=Lt(s,t),t+=2;const e=s[t++];if(128&e&&(t+=2),64&e&&(t+=s[t++]),4!==s[t++])break;t=Lt(s,t);const i=s[t++];if(64!==i)break;if(n+="."+At(i),t+=12,5!==s[t++])break;t=Lt(s,t);const r=s[t++];let a=(248&r)>>3;31===a&&(a+=1+((7&r)<<3)+((224&s[t])>>5)),n+="."+a}break}case"hvc1":case"hev1":{const t=vt(s,["hvcC"])[0];if(t&&t.length>12){const e=t[1],s=["","A","B","C"][e>>6],i=31&e,r=gt(t,2),a=(32&e)>>5?"H":"L",o=t[12],l=t.subarray(6,12);n+="."+s+i,n+="."+function(t){let e=0;for(let s=0;s<32;s++)e|=(t>>s&1)<<31-s;return e>>>0}(r).toString(16).toUpperCase(),n+="."+a+o;let h="";for(let t=l.length;t--;){const e=l[t];(e||h)&&(h="."+e.toString(16).toUpperCase()+h)}n+=h}r=St("hev1"==o?"dvhe":"dvh1",s);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":n=St(n,s)||n;break;case"vp09":{const t=vt(s,["vpcC"])[0];if(t&&t.length>6){const e=t[4],s=t[5],i=t[6]>>4&15;n+="."+It(e)+"."+It(s)+"."+It(i)}break}case"av01":{const t=vt(s,["av1C"])[0];if(t&&t.length>2){const e=t[1]>>>5,i=31&t[1],a=t[2]>>>7?"H":"M",o=(64&t[2])>>6,l=(32&t[2])>>5,h=2===e&&o?l?12:10:o?10:8,d=(16&t[2])>>4,c=(8&t[2])>>3,u=(4&t[2])>>2,f=3&t[2],g=1,m=1,p=1,v=0;n+="."+e+"."+It(i)+a+"."+It(h)+"."+d+"."+c+u+f+"."+It(g)+"."+It(m)+"."+It(p)+"."+v,r=St("dav1",s)}break}}return{codec:n,encrypted:a,supplemental:r}}function St(t,e){const s=vt(e,["dvvC"]),i=s.length?s[0]:vt(e,["dvcC"])[0];if(i){const e=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return t+"."+It(e)+"."+It(s)}}function Lt(t,e){const s=e+5;for(;128&t[e++]&&e<s;);return e}function At(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function It(t){return(t<10?"0":"")+t}function bt(t,e){vt(t,["moov","trak"]).forEach(t=>{const s=vt(t,["mdia","minf","stbl","stsd"])[0];if(!s)return;const i=s.subarray(8);let r=vt(i,["enca"]);const n=r.length>0;n||(r=vt(i,["encv"])),r.forEach(t=>{vt(n?t.subarray(28):t.subarray(78),["sinf"]).forEach(t=>{const s=Rt(t);s&&e(s,n)})})})}function Rt(t){const e=vt(t,["schm"])[0];if(e){const s=ut(e.subarray(4,8));if("cbcs"===s||"cenc"===s){const e=vt(t,["schi","tenc"])[0];if(e)return e}}}function kt(t,e){const s=new Uint8Array(t.length+e.length);return s.set(t),s.set(e,t.length),s}function Dt(t,e){const s=[],i=e.samples,r=e.timescale,n=e.id;let a=!1;return vt(i,["moof"]).map(o=>{const l=o.byteOffset-8;vt(o,["traf"]).map(o=>{const h=vt(o,["tfdt"]).map(t=>{const e=t[0];let s=gt(t,4);return 1===e&&(s*=Math.pow(2,32),s+=gt(t,8)),s/r})[0];return void 0!==h&&(t=h),vt(o,["tfhd"]).map(h=>{const d=gt(h,4),c=16777215>(h,0);let u=0;const f=!!(16&c);let g=0;const m=!!(32&c);let p=8;d===n&&(!!(1&c)&&(p+=8),!!(2&c)&&(p+=4),!!(8&c)&&(u=gt(h,p),p+=4),f&&(g=gt(h,p),p+=4),m&&(p+=4),"video"===e.type&&(a=Ct(e.codec)),vt(o,["trun"]).map(n=>{const o=n[0],h=16777215>(n,0),d=!!(1&h);let c=0;const f=!!(4&h),m=!!(256&h);let p=0;const v=!!(512&h);let y=0;const E=!!(1024&h),T=!!(2048&h);let S=0;const L=gt(n,4);let A=8;d&&(c=gt(n,A),A+=4),f&&(A+=4);let I=c+l;for(let l=0;l<L;l++){if(m?(p=gt(n,A),A+=4):p=u,v?(y=gt(n,A),A+=4):y=g,E&&(A+=4),T&&(S=0===o?gt(n,A):pt(n,A),A+=4),e.type===st){let e=0;for(;e<y;){const n=gt(i,I);I+=4,Mt(a,i[I])&&_t(i.subarray(I,I+n),a?2:1,t+S/r,s),I+=n,e+=n+4}}t+=p/r}}))})})}),s}function Ct(t){if(!t)return!1;const e=t.substring(0,4);return"hvc1"===e||"hev1"===e||"dvh1"===e||"dvhe"===e}function Mt(t,e){if(t){const t=e>>1&63;return 39===t||40===t}return 6==(31&e)}function _t(t,e,s,i){const r=wt(t);let n=0;n+=e;let a=0,o=0,l=0;for(;n<r.length;){a=0;do{if(n>=r.length)break;l=r[n++],a+=l}while(255===l);o=0;do{if(n>=r.length)break;l=r[n++],o+=l}while(255===l);const t=r.length-n;let e=n;if(o<t)n+=o;else if(o>t){B.error(`Malformed SEI payload. ${o} is too small, only ${t} bytes left to parse.`);break}if(4===a){if(181===r[e++]){const t=ft(r,e);if(e+=2,49===t){const t=gt(r,e);if(e+=4,1195456820===t){const t=r[e++];if(3===t){const n=r[e++],o=64&n,l=o?2+3*(31&n):0,h=new Uint8Array(l);if(o){h[0]=n;for(let t=1;t<l;t++)h[t]=r[e++]}i.push({type:t,payloadType:a,pts:s,bytes:h})}}}}}else if(5===a&&o>16){const t=[];for(let s=0;s<16;s++){const i=r[e++].toString(16);t.push(1==i.length?"0"+i:i),3!==s&&5!==s&&7!==s&&9!==s||t.push("-")}const n=o-16,l=new Uint8Array(n);for(let t=0;t<n;t++)l[t]=r[e++];i.push({payloadType:a,pts:s,uuid:t.join(""),userData:G(l),userDataBytes:l})}}}function wt(t){const e=t.byteLength,s=[];let i=1;for(;i<e-2;)0===t[i]&&0===t[i+1]&&3===t[i+2]?(s.push(i+2),i+=2):i++;if(0===s.length)return t;const r=e-s.length,n=new Uint8Array(r);let a=0;for(i=0;i<r;a++,i++)a===s[0]&&(a++,s.shift()),n[i]=t[a];return n}function Pt(t){const e=t.getUint32(0),s=t.byteOffset,i=t.byteLength;if(i<e)return{offset:s,size:i};if(1886614376!==t.getUint32(4))return{offset:s,size:e};const r=t.getUint32(8)>>>24;if(0!==r&&1!==r)return{offset:s,size:e};const n=t.buffer,a=K(new Uint8Array(n,s+12,16));let o=null,l=null,h=0;if(0===r)h=28;else{const r=t.getUint32(28);if(!r||i<32+16*r)return{offset:s,size:e};o=[];for(let t=0;t<r;t++)o.push(new Uint8Array(n,s+32+16*t,16));h=32+16*r}if(!h)return{offset:s,size:e};const d=t.getUint32(h);return e-32<d?{offset:s,size:e}:(l=new Uint8Array(n,s+h+4,d),{version:r,systemId:a,kids:o,data:l,offset:s,size:e})}const xt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ot={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Nt(t,e){const s=Ot[e];return!!s&&!!s[t.slice(0,4)]}function Ft(t,e,s=!0){return!t.split(",").some(t=>!Ut(t,e,s))}function Ut(t,e,s=!0){var i;const r=$(s);return null!=(i=null==r?void 0:r.isTypeSupported(Bt(t,e)))&&i}function Bt(t,e){return`${e}/mp4;codecs=${t}`}function $t(t){if(t){const e=t.substring(0,4);return Ot.video[e]}return 2}function jt(t){const e=xt();return t.split(",").reduce((t,s)=>{const i=e&&Ct(s)?9:Ot.video[s];return i?(2*i+t)/(t?3:2):(Ot.audio[s]+t)/(t?2:1)},0)}const Gt={},Kt=/flac|opus|mp4a\.40\.34/i;function Vt(t,e=!0){return t.replace(Kt,t=>function(t,e=!0){if(Gt[t])return Gt[t];const s={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[t];for(let r=0;r<s.length;r++){var i;if(Ut(s[r],"audio",e))return Gt[t]=s[r],s[r];if("mp3"===s[r]&&null!=(i=$(e))&&i.isTypeSupported("audio/mpeg"))return""}return t}(t.toLowerCase(),e))}function Ht(t,e){if(t&&(t.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(t))&&(Yt(t,"audio")||Yt(t,"video")))return t;if(e){const s=e.split(",");if(s.length>1){if(t)for(let e=s.length;e--;)if(s[e].substring(0,4)===t.substring(0,4))return s[e];return s[0]}}return e||t}function Yt(t,e){return Nt(t,e)&&Ut(t,e)}function zt(t){if(t.startsWith("av01.")){const e=t.split("."),s=["0","111","01","01","01","0"];for(let t=e.length;t>4&&t<10;t++)e[t]=s[t-4];return e.join(".")}return t}function Wt(t){const e=$(t)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function qt(t){return t.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const Qt={supported:!1,smooth:!1,powerEfficient:!1},Xt={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function Zt(t,e){return{supported:!1,configurations:e,decodingInfoResults:[Qt],error:t}}function Jt(t,e,s,i,r,n){const a=t.videoCodec,o=t.audioCodec?t.audioGroups:null,l=null==n?void 0:n.audioCodec,h=null==n?void 0:n.channels,d=h?parseInt(h):l?1/0:2;let c=null;if(null!=o&&o.length)try{c=1===o.length&&o[0]?e.groups[o[0]].channels:o.reduce((t,s)=>{if(s){const i=e.groups[s];if(!i)throw new Error(`Audio track group ${s} not found`);Object.keys(i.channels).forEach(e=>{t[e]=(t[e]||0)+i.channels[e]})}return t},{2:0})}catch(t){return!0}return void 0!==a&&(a.split(",").some(t=>Ct(t))||t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(i,30)||"SDR"!==t.videoRange&&t.videoRange!==s||t.bitrate>Math.max(r,8e6))||!!c&&g(d)&&Object.keys(c).some(t=>parseInt(t)>d)}function te(t,e,s,i={}){const r=t.videoCodec;if(!r&&!t.audioCodec||!s)return Promise.resolve(Xt);const n=[],a=function(t){var e;const s=null==(e=t.videoCodec)?void 0:e.split(","),i=se(t),r=t.width||640,n=t.height||480,a=t.frameRate||30,o=t.videoRange.toLowerCase();return s?s.map(t=>{const e={contentType:Bt(zt(t),"video"),width:r,height:n,bitrate:i,framerate:a};return"sdr"!==o&&(e.transferFunction=o),e}):[]}(t),o=a.length,l=function(t,e,s){var i;const r=null==(i=t.audioCodec)?void 0:i.split(","),n=se(t);return r&&t.audioGroups?t.audioGroups.reduce((t,i)=>{var a;const o=i?null==(a=e.groups[i])?void 0:a.tracks:null;return o?o.reduce((t,e)=>{if(e.groupId===i){const i=parseFloat(e.channels||"");r.forEach(e=>{const r={contentType:Bt(e,"audio"),bitrate:s?ee(e,n):n};i&&(r.channels=""+i),t.push(r)})}return t},t):t},[]):[]}(t,e,o>0),h=l.length;for(let t=o||1*h||1;t--;){const e={type:"media-source"};if(o&&(e.video=a[t%o]),h){e.audio=l[t%h];const s=e.audio.bitrate;e.video&&s&&(e.video.bitrate-=s)}n.push(e)}if(r){const t=navigator.userAgent;if(r.split(",").some(t=>Ct(t))&&xt())return Promise.resolve(Zt(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${t})`),n))}return Promise.all(n.map(t=>{const e=function(t){let e="";const{audio:s,video:i}=t;return i&&(e+=`${qt(i.contentType)}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`),s&&(e+=`${i?"_":""}${qt(s.contentType)}_c${s.channels}`),e}(t);return i[e]||(i[e]=s.decodingInfo(t))})).then(t=>({supported:!t.some(t=>!t.supported),configurations:n,decodingInfoResults:t})).catch(t=>({supported:!1,configurations:n,decodingInfoResults:[],error:t}))}function ee(t,e){if(e<=1)return 1;let s=128e3;return"ec-3"===t?s=768e3:"ac-3"===t&&(s=64e4),Math.min(e/2,s)}function se(t){return 1e3*Math.ceil(Math.max(.9*t.bitrate,t.averageBitrate)/1e3)||1}const ie=["NONE","TYPE-0","TYPE-1",null],re=["SDR","PQ","HLG"];function ne(t){const{canSkipUntil:e,canSkipDateRanges:s,age:i}=t;return e&&i<e/2?s?"v2":"YES":""}class ae{constructor(t,e,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=s}addDirectives(t){const e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.href}}class oe{constructor(t){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),"supplemental"in t){var e;this.supplemental=t.supplemental;const s=null==(e=t.supplemental)?void 0:e.videoCodec;s&&s!==t.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(t){return le(this._audioGroups,t)}hasSubtitleGroup(t){return le(this._subtitleGroups,t)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(t,e){if(e)if("audio"===t){let t=this._audioGroups;t||(t=this._audioGroups=[]),-1===t.indexOf(e)&&t.push(e)}else if("text"===t){let t=this._subtitleGroups;t||(t=this._subtitleGroups=[]),-1===t.indexOf(e)&&t.push(e)}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return null==(t=this.audioGroups)?void 0:t[0]}get textGroupId(){var t;return null==(t=this.subtitleGroups)?void 0:t[0]}addFallback(){}}function le(t,e){return!(!e||!t)&&-1!==t.indexOf(e)}const he=(t,e)=>JSON.stringify(t,(t=>{const e=new WeakSet;return(s,i)=>{if(t&&(i=t(s,i)),"object"==typeof i&&null!==i){if(e.has(i))return;e.add(i)}return i}})(e));function de(t,e){B.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function ce(t){return t.reduce((t,e)=>{let s=t.groups[e.groupId];s||(s=t.groups[e.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(e);const i=e.channels||"2";return s.channels[i]=(s.channels[i]||0)+1,s.hasDefault=s.hasDefault||e.default,s.hasAutoSelect=s.hasAutoSelect||e.autoselect,s.hasDefault&&(t.hasDefaultAudio=!0),s.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function ue(t){if(!t)return t;const{lang:e,assocLang:s,characteristics:i,channels:r,audioCodec:n}=t;return{lang:e,assocLang:s,characteristics:i,channels:r,audioCodec:n}}function fe(t,e,s){if("attrs"in t){const s=e.indexOf(t);if(-1!==s)return s}for(let i=0;i<e.length;i++)if(ge(t,e[i],s))return i;return-1}function ge(t,e,s){const{groupId:i,name:r,lang:n,assocLang:a,default:o}=t,l=t.forced;return(void 0===i||e.groupId===i)&&(void 0===r||e.name===r)&&(void 0===n||function(t,e="--"){return t.length===e.length?t===e:t.startsWith(e)||e.startsWith(t)}(n,e.lang))&&(void 0===n||e.assocLang===a)&&(void 0===o||e.default===o)&&(void 0===l||e.forced===l)&&(!("characteristics"in t)||function(t,e=""){const s=t.split(","),i=e.split(",");return s.length===i.length&&!s.some(t=>-1===i.indexOf(t))}(t.characteristics||"",e.characteristics))&&(void 0===s||s(t,e))}function me(t,e){const{audioCodec:s,channels:i}=t;return!(void 0!==s&&(e.audioCodec||"").substring(0,4)!==s.substring(0,4)||void 0!==i&&i!==(e.channels||"2"))}function pe(t,e,s){for(let i=e;i>-1;i--)if(s(t[i]))return i;for(let i=e+1;i<t.length;i++)if(s(t[i]))return i;return-1}function ve(t,e){var s;return!!t&&t!==(null==(s=e.loadLevelObj)?void 0:s.uri)}const ye=function(t,e){let s=0,i=t.length-1,r=null,n=null;for(;s<=i;){r=(s+i)/2|0,n=t[r];const a=e(n);if(a>0)s=r+1;else{if(!(a<0))return n;i=r-1}}return null};function Ee(t,e,s=0,i=0,r=.005){let n=null;if(t){n=e[1+t.sn-e[0].sn]||null;const i=t.endDTS-s;i>0&&i<15e-7&&(s+=15e-7),n&&t.level!==n.level&&n.end<=t.end&&(n=e[2+t.sn-e[0].sn]||null)}else 0===s&&0===e[0].start&&(n=e[0]);if(n&&((!t||t.level===n.level)&&0===Te(s,i,n)||function(t,e,s){if(e&&0===e.start&&e.level<t.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((t,e)=>("INF"===e[0]&&(t+=parseFloat(e[1])),t),s);return t.start<=i}return!1}(n,t,Math.min(r,i))))return n;const a=ye(e,Te.bind(null,s,i));return!a||a===t&&n?n:a}function Te(t=0,e=0,s){if(s.start<=t&&s.start+s.duration>t)return 0;const i=Math.min(e,s.duration+(s.deltaPTS?s.deltaPTS:0));return s.start+s.duration-i<=t?1:s.start-i>t&&s.start?-1:0}function Se(t,e,s){const i=1e3*Math.min(e,s.duration+(s.deltaPTS?s.deltaPTS:0));return(s.endProgramDateTime||0)-i>t}function Le(t,e,s){if(t&&t.startCC<=e&&t.endCC>=e){let i=t.fragments;const{fragmentHint:r}=t;let n;return r&&(i=i.concat(r)),ye(i,t=>t.cc<e?1:t.cc>e?-1:(n=t,t.end<=s?1:t.start>s?-1:0)),n||null}return null}function Ae(t){switch(t.details){case y.FRAG_LOAD_TIMEOUT:case y.KEY_LOAD_TIMEOUT:case y.LEVEL_LOAD_TIMEOUT:case y.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ie(t){return t.details.startsWith("key")}function be(t){return Ie(t)&&!!t.frag&&!t.frag.decryptdata}function Re(t,e){const s=Ae(e);return t.default[(s?"timeout":"error")+"Retry"]}function ke(t,e){const s="linear"===t.backoff?1:Math.pow(2,e);return Math.min(s*t.retryDelayMs,t.maxRetryDelayMs)}function De(t){return w(w({},t),{errorRetry:null,timeoutRetry:null})}function Ce(t,e,s,i){if(!t)return!1;const r=null==i?void 0:i.code,n=e<t.maxNumRetry&&(function(t){return Me(t)||!!t&&(t<400||t>499)}(r)||!!s);return t.shouldRetry?t.shouldRetry(t,e,s,i,n):n}function Me(t){return 0===t&&!1===navigator.onLine}function _e(t){const e={action:0,flags:0};return t&&(e.resolved=!0),e}var we="NOT_LOADED",Pe="APPENDING",xe="PARTIAL",Oe="OK";class Ne{constructor(t){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=t,this._registerListeners()}_registerListeners(){const{hls:t}=this;t&&(t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.BUFFER_APPENDED,this.onBufferAppended,this),t.on(E.FRAG_BUFFERED,this.onFragBuffered,this),t.on(E.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.BUFFER_APPENDED,this.onBufferAppended,this),t.off(E.FRAG_BUFFERED,this.onFragBuffered,this),t.off(E.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,e){const s=this.activePartLists[e];if(s)for(let e=s.length;e--;){const i=s[e];if(!i)break;if(i.start<=t&&t<=i.end&&i.loaded)return i}return this.getBufferedFrag(t,e)}getBufferedFrag(t,e){return this.getFragAtPos(t,e,!0)}getFragAtPos(t,e,s){const{fragments:i}=this,r=Object.keys(i);for(let n=r.length;n--;){const a=i[r[n]];if((null==a?void 0:a.body.type)===e&&(!s||a.buffered)){const e=a.body;if(e.start<=t&&t<=e.end)return e}}return null}detectEvictedFragments(t,e,s,i,r){this.timeRanges&&(this.timeRanges[t]=e);const n=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(i=>{const a=this.fragments[i];if(!a)return;if(n>=a.body.sn)return;if(!a.buffered&&(!a.loaded||r))return void(a.body.type===s&&this.removeFragment(a.body));const o=a.range[t];o&&(0!==o.time.length?o.time.some(t=>{const s=!this.isTimeBuffered(t.startPTS,t.endPTS,e);return s&&this.removeFragment(a.body),s}):this.removeFragment(a.body))})}detectPartialFragments(t){const e=this.timeRanges;if(!e||"initSegment"===t.frag.sn)return;const s=t.frag,i=Ue(s),r=this.fragments[i];if(!r||r.buffered&&s.gap)return;const n=!s.relurl;Object.keys(e).forEach(i=>{const a=s.elementaryStreams[i];if(!a)return;const o=e[i],l=n||!0===a.partial;r.range[i]=this.getBufferedTimes(s,t.part,l,o)}),r.loaded=null,Object.keys(r.range).length?(this.bufferedEnd(r,s),Fe(r)||this.removeParts(s.sn-1,s.type)):this.removeFragment(r.body)}bufferedEnd(t,e){t.buffered=!0,(t.body.endList=e.endList||t.body.endList)&&(this.endListFragments[t.body.type]=t)}removeParts(t,e){const s=this.activePartLists[e];s&&(this.activePartLists[e]=Be(s,e=>e.fragment.sn>=t))}fragBuffered(t,e){const s=Ue(t);let i=this.fragments[s];!i&&e&&(i=this.fragments[s]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,this.bufferedEnd(i,t))}getBufferedTimes(t,e,s,i){const r={time:[],partial:s},n=t.start,a=t.end,o=t.minEndPTS||a,l=t.maxStartPTS||n;for(let t=0;t<i.length;t++){const e=i.start(t)-this.bufferPadding,s=i.end(t)+this.bufferPadding;if(l>=e&&o<=s){r.time.push({startPTS:Math.max(n,i.start(t)),endPTS:Math.min(a,i.end(t))});break}if(n<s&&a>e){const e=Math.max(n,i.start(t)),s=Math.min(a,i.end(t));s>e&&(r.partial=!0,r.time.push({startPTS:e,endPTS:s}))}else if(a<=e)break}return r}getPartialFragment(t){let e,s,i,r=null,n=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach(l=>{const h=o[l];h&&Fe(h)&&(s=h.body.start-a,i=h.body.end+a,t>=s&&t<=i&&(e=Math.min(t-s,i-t),n<=e&&(r=h.body,n=e)))}),r}isEndListAppended(t){const e=this.endListFragments[t];return void 0!==e&&(e.buffered||Fe(e))}getState(t){const e=Ue(t),s=this.fragments[e];return s?s.buffered?Fe(s)?xe:Oe:Pe:we}isTimeBuffered(t,e,s){let i,r;for(let n=0;n<s.length;n++){if(i=s.start(n)-this.bufferPadding,r=s.end(n)+this.bufferPadding,t>=i&&e<=r)return!0;if(e<=i)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(t,e){if("initSegment"===e.frag.sn||e.frag.bitrateTest)return;const s=e.frag,i=e.part?null:e,r=Ue(s);this.fragments[r]={body:s,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(t,e){const{frag:s,part:i,timeRanges:r,type:n}=e;if("initSegment"===s.sn)return;const a=s.type;if(i){let t=this.activePartLists[a];t||(this.activePartLists[a]=t=[]),t.push(i)}this.timeRanges=r;const o=r[n];this.detectEvictedFragments(n,o,a,i)}onFragBuffered(t,e){this.detectPartialFragments(e)}hasFragment(t){const e=Ue(t);return!!this.fragments[e]}hasFragments(t){const{fragments:e}=this,s=Object.keys(e);if(!t)return s.length>0;for(let i=s.length;i--;){const r=e[s[i]];if((null==r?void 0:r.body.type)===t)return!0}return!1}hasParts(t){var e;return!(null==(e=this.activePartLists[t])||!e.length)}removeFragmentsInRange(t,e,s,i,r){i&&!this.hasGaps||Object.keys(this.fragments).forEach(n=>{const a=this.fragments[n];if(!a)return;const o=a.body;o.type!==s||i&&!o.gap||o.start<e&&o.end>t&&(a.buffered||r)&&this.removeFragment(o)})}removeFragment(t){const e=Ue(t);t.clearElementaryStreamInfo();const s=this.activePartLists[t.type];if(s){const e=t.sn;this.activePartLists[t.type]=Be(s,t=>t.fragment.sn!==e)}delete this.fragments[e],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){var t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const e=null==(t=this.hls)||null==(t=t.latestLevelDetails)?void 0:t.partList;e&&e.forEach(t=>t.clearElementaryStreamInfo())}}function Fe(t){var e,s,i;return t.buffered&&!!(t.body.gap||null!=(e=t.range.video)&&e.partial||null!=(s=t.range.audio)&&s.partial||null!=(i=t.range.audiovideo)&&i.partial)}function Ue(t){return`${t.type}_${t.level}_${t.sn}`}function Be(t,e){return t.filter(t=>{const s=e(t);return s||t.clearElementaryStreamInfo(),s})}class $e{constructor(t,e,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=e,this.aesMode=s}decrypt(t,e){switch(this.aesMode){case 0:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t);case 1:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},e,t);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class je{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(t){const e=new DataView(t),s=new Uint32Array(4);for(let t=0;t<4;t++)s[t]=e.getUint32(4*t);return s}initTable(){const t=this.sBox,e=this.invSBox,s=this.subMix,i=s[0],r=s[1],n=s[2],a=s[3],o=this.invSubMix,l=o[0],h=o[1],d=o[2],c=o[3],u=new Uint32Array(256);let f=0,g=0,m=0;for(m=0;m<256;m++)u[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let s=g^g<<1^g<<2^g<<3^g<<4;s=s>>>8^255&s^99,t[f]=s,e[s]=f;const o=u[f],m=u[o],p=u[m];let v=257*u[s]^16843008*s;i[f]=v<<24|v>>>8,r[f]=v<<16|v>>>16,n[f]=v<<8|v>>>24,a[f]=v,v=16843009*p^65537*m^257*o^16843008*f,l[s]=v<<24|v>>>8,h[s]=v<<16|v>>>16,d[s]=v<<8|v>>>24,c[s]=v,f?(f=o^u[u[u[p^o]]],g^=u[u[g]]):f=g=1}}expandKey(t){const e=this.uint8ArrayToUint32Array_(t);let s=!0,i=0;for(;i<e.length&&s;)s=e[i]===this.key[i],i++;if(s)return;this.key=e;const r=this.keySize=e.length;if(4!==r&&6!==r&&8!==r)throw new Error("Invalid aes key size="+r);const n=this.ksRows=4*(r+6+1);let a,o;const l=this.keySchedule=new Uint32Array(n),h=this.invKeySchedule=new Uint32Array(n),d=this.sBox,c=this.rcon,u=this.invSubMix,f=u[0],g=u[1],m=u[2],p=u[3];let v,y;for(a=0;a<n;a++)a<r?v=l[a]=e[a]:(y=v,a%r===0?(y=y<<8|y>>>24,y=d[y>>>24]<<24|d[y>>>16&255]<<16|d[y>>>8&255]<<8|d[255&y],y^=c[a/r|0]<<24):r>6&&a%r===4&&(y=d[y>>>24]<<24|d[y>>>16&255]<<16|d[y>>>8&255]<<8|d[255&y]),l[a]=v=(l[a-r]^y)>>>0);for(o=0;o<n;o++)a=n-o,y=3&o?l[a]:l[a-4],h[o]=o<4||a<=4?y:f[d[y>>>24]]^g[d[y>>>16&255]]^m[d[y>>>8&255]]^p[d[255&y]],h[o]=h[o]>>>0}networkToHostOrderSwap(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24}decrypt(t,e,s){const i=this.keySize+6,r=this.invKeySchedule,n=this.invSBox,a=this.invSubMix,o=a[0],l=a[1],h=a[2],d=a[3],c=this.uint8ArrayToUint32Array_(s);let u=c[0],f=c[1],g=c[2],m=c[3];const p=new Int32Array(t),v=new Int32Array(p.length);let y,E,T,S,L,A,I,b,R,k,D,C,M,_;const w=this.networkToHostOrderSwap;for(;e<p.length;){for(R=w(p[e]),k=w(p[e+1]),D=w(p[e+2]),C=w(p[e+3]),L=R^r[0],A=C^r[1],I=D^r[2],b=k^r[3],M=4,_=1;_<i;_++)y=o[L>>>24]^l[A>>16&255]^h[I>>8&255]^d[255&b]^r[M],E=o[A>>>24]^l[I>>16&255]^h[b>>8&255]^d[255&L]^r[M+1],T=o[I>>>24]^l[b>>16&255]^h[L>>8&255]^d[255&A]^r[M+2],S=o[b>>>24]^l[L>>16&255]^h[A>>8&255]^d[255&I]^r[M+3],L=y,A=E,I=T,b=S,M+=4;y=n[L>>>24]<<24^n[A>>16&255]<<16^n[I>>8&255]<<8^n[255&b]^r[M],E=n[A>>>24]<<24^n[I>>16&255]<<16^n[b>>8&255]<<8^n[255&L]^r[M+1],T=n[I>>>24]<<24^n[b>>16&255]<<16^n[L>>8&255]<<8^n[255&A]^r[M+2],S=n[b>>>24]<<24^n[L>>16&255]<<16^n[A>>8&255]<<8^n[255&I]^r[M+3],v[e]=w(y^u),v[e+1]=w(S^f),v[e+2]=w(T^g),v[e+3]=w(E^m),u=R,f=k,g=D,m=C,e+=4}return v.buffer}}class Ge{constructor(t,e,s){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=e,this.aesMode=s}expandKey(){const t=function(t){switch(t){case 0:return"AES-CBC";case 1:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${t}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}class Ke{constructor(t,{removePKCS7Padding:e=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=t.enableSoftwareAES,this.removePKCS7Padding=e,e)try{const t=self.crypto;t&&(this.subtle=t.subtle||t.webkitSubtle)}catch(t){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:t,remainderData:e}=this;if(!t||e)return this.reset(),null;const s=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?function(t){const e=t.byteLength,s=e&&new DataView(t.buffer).getUint8(e-1);return s?t.slice(0,e-s):t}(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(t,e,s,i){return this.useSoftware?new Promise((r,n)=>{const a=ArrayBuffer.isView(t)?t:new Uint8Array(t);this.softwareDecrypt(a,e,s,i);const o=this.flush();o?r(o.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(t),e,s,i)}softwareDecrypt(t,e,s,i){const{currentIV:r,currentResult:n,remainderData:a}=this;if(0!==i||16!==e.byteLength)return B.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),a&&(t=kt(a,t),this.remainderData=null);const o=this.getValidChunk(t);if(!o.length)return null;r&&(s=r);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new je),l.expandKey(e);const h=n;return this.currentResult=l.decrypt(o.buffer,0,s),this.currentIV=o.slice(-16).buffer,h||null}webCryptoDecrypt(t,e,s,i){if(this.key!==e||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,e,s,i));this.key=e,this.fastAesKey=new Ge(this.subtle,e,i)}return this.fastAesKey.expandKey().then(e=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new $e(this.subtle,new Uint8Array(s),i).decrypt(t.buffer,e)):Promise.reject(new Error("web crypto not initialized"))).catch(r=>(B.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${r.name}: ${r.message}`),this.onWebCryptoError(t,e,s,i)))}onWebCryptoError(t,e,s,i){const r=this.enableSoftwareAES;if(r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,s,i);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(r?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(t){let e=t;const s=t.length-t.length%16;return s!==t.length&&(e=t.slice(0,s),this.remainderData=t.slice(s)),e}logOnce(t){this.logEnabled&&(B.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const Ve=Math.pow(2,17);class He{constructor(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(t,e){const s=t.url;if(!s)return Promise.reject(new We({type:v.NETWORK_ERROR,details:y.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a "+(s?"part list":"url")),networkDetails:null}));this.abort();const i=this.config,r=i.fLoader,n=i.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),t.gap){if(t.tagList.some(t=>"GAP"===t[0]))return void o(ze(t));t.gap=!1}const l=this.loader=r?new r(i):new n(i),h=Ye(t);t.loader=l;const d=De(i.fragLoadPolicy.default),c={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===t.sn?1/0:Ve};t.stats=l.stats;const u={onSuccess:(e,s,i,r)=>{this.resetLoader(t,l);let n=e.data;i.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(n.slice(0,16)),n=n.slice(16)),a({frag:t,part:null,payload:n,networkDetails:r})},onError:(e,i,r,n)=>{this.resetLoader(t,l),o(new We({type:v.NETWORK_ERROR,details:y.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:w({url:s,data:void 0},e),error:new Error(`HTTP Error ${e.code} ${e.text}`),networkDetails:r,stats:n}))},onAbort:(e,s,i)=>{this.resetLoader(t,l),o(new We({type:v.NETWORK_ERROR,details:y.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:i,stats:e}))},onTimeout:(e,s,i)=>{this.resetLoader(t,l),o(new We({type:v.NETWORK_ERROR,details:y.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:i,stats:e}))}};e&&(u.onProgress=(s,i,r,n)=>e({frag:t,part:null,payload:r,networkDetails:n})),l.load(h,c,u)})}loadPart(t,e,s){this.abort();const i=this.config,r=i.fLoader,n=i.loader;return new Promise((a,o)=>{if(this.loader&&this.loader.destroy(),t.gap||e.gap)return void o(ze(t,e));const l=this.loader=r?new r(i):new n(i),h=Ye(t,e);t.loader=l;const d=De(i.fragLoadPolicy.default),c={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Ve};e.stats=l.stats,l.load(h,c,{onSuccess:(i,r,n,o)=>{this.resetLoader(t,l),this.updateStatsFromPart(t,e);const h={frag:t,part:e,payload:i.data,networkDetails:o};s(h),a(h)},onError:(s,i,r,n)=>{this.resetLoader(t,l),o(new We({type:v.NETWORK_ERROR,details:y.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:w({url:h.url,data:void 0},s),error:new Error(`HTTP Error ${s.code} ${s.text}`),networkDetails:r,stats:n}))},onAbort:(s,i,r)=>{t.stats.aborted=e.stats.aborted,this.resetLoader(t,l),o(new We({type:v.NETWORK_ERROR,details:y.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:r,stats:s}))},onTimeout:(s,i,r)=>{this.resetLoader(t,l),o(new We({type:v.NETWORK_ERROR,details:y.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:r,stats:s}))}})})}updateStatsFromPart(t,e){const s=t.stats,i=e.stats,r=i.total;if(s.loaded+=i.loaded,r){const i=Math.round(t.duration/e.duration),n=Math.min(Math.round(s.loaded/r),i),a=(i-n)*Math.round(s.loaded/n);s.total=s.loaded+a}else s.total=Math.max(s.loaded,s.total);const n=s.loading,a=i.loading;n.start?n.first+=a.first-a.start:(n.start=a.start,n.first=a.first),n.end=a.end}resetLoader(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()}}function Ye(t,e=null){const s=e||t,i={frag:t,part:e,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},r=s.byteRangeStartOffset,n=s.byteRangeEndOffset;if(g(r)&&g(n)){var a;let e=r,s=n;if("initSegment"===t.sn&&("AES-128"===(o=null==(a=t.decryptdata)?void 0:a.method)||"AES-256"===o)){const t=n-r;t%16&&(s=n+(16-t%16)),0!==r&&(i.resetIV=!0,e=r-16)}i.rangeStart=e,i.rangeEnd=s}var o;return i}function ze(t,e){const s=new Error(`GAP ${t.gap?"tag":"attribute"} found`),i={type:v.MEDIA_ERROR,details:y.FRAG_GAP,fatal:!1,frag:t,error:s,networkDetails:null};return e&&(i.part=e),(e||t).stats.aborted=!0,new We(i)}class We extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class qe extends P{constructor(t,e){super(t,e),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(t){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class Qe{constructor(t,e,s,i=0,r=-1,n=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=s,this.size=i,this.part=r,this.partial=n}}const Xe={length:0,start:()=>0,end:()=>0};class Ze{static isBuffered(t,e){if(t){const s=Ze.getBuffered(t);for(let t=s.length;t--;)if(e>=s.start(t)&&e<=s.end(t))return!0}return!1}static bufferedRanges(t){if(t){const e=Ze.getBuffered(t);return Ze.timeRangesToArray(e)}return[]}static timeRangesToArray(t){const e=[];for(let s=0;s<t.length;s++)e.push({start:t.start(s),end:t.end(s)});return e}static bufferInfo(t,e,s){if(t){const i=Ze.bufferedRanges(t);if(i.length)return Ze.bufferedInfo(i,e,s)}return{len:0,start:e,end:e,bufferedIndex:-1}}static bufferedInfo(t,e,s){e=Math.max(0,e),t.length>1&&t.sort((t,e)=>t.start-e.start||e.end-t.end);let i=-1,r=[];if(s)for(let n=0;n<t.length;n++){e>=t[n].start&&e<=t[n].end&&(i=n);const a=r.length;if(a){const e=r[a-1].end;t[n].start-e<s?t[n].end>e&&(r[a-1].end=t[n].end):r.push(t[n])}else r.push(t[n])}else r=t;let n,a=0,o=e,l=e;for(let t=0;t<r.length;t++){const h=r[t].start,d=r[t].end;if(-1===i&&e>=h&&e<=d&&(i=t),e+s>=h&&e<d)o=h,l=d,a=l-e;else if(e+s<h){n=h;break}}return{len:a,start:o||0,end:l||0,nextStart:n,buffered:t,bufferedIndex:i}}static getBuffered(t){try{return t.buffered||Xe}catch(t){return B.log("failed to get media.buffered",t),Xe}}}const Je=/\{\$([a-zA-Z0-9-_]+)\}/g;function ts(t){return Je.test(t)}function es(t,e){if(null!==t.variableList||t.hasVariableRefs){const s=t.variableList;return e.replace(Je,e=>{const i=e.substring(2,e.length-1),r=null==s?void 0:s[i];return void 0===r?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"`)),e):r})}return e}function ss(t,e,s){let i,r,n=t.variableList;if(n||(t.variableList=n={}),"QUERYPARAM"in e){i=e.QUERYPARAM;try{const t=new self.URL(s).searchParams;if(!t.has(i))throw new Error(`"${i}" does not match any query parameter in URI: "${s}"`);r=t.get(i)}catch(e){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${e.message}`))}}else i=e.NAME,r=e.VALUE;i in n?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)):n[i]=r||""}function is(t,e,s){const i=e.IMPORT;if(s&&i in s){let e=t.variableList;e||(t.variableList=e={}),e[i]=s[i]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}const rs=/^(\d+)x(\d+)$/,ns=/(.+?)=(".*?"|.*?)(?:,|$)/g;class as{constructor(t,e){"string"==typeof t&&(t=as.parseAttrList(t,e)),M(this,t)}get clientAttrs(){return Object.keys(this).filter(t=>"X-"===t.substring(0,2))}decimalInteger(t){const e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}hexadecimalInteger(t){if(this[t]){let e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;const s=new Uint8Array(e.length/2);for(let t=0;t<e.length/2;t++)s[t]=parseInt(e.slice(2*t,2*t+2),16);return s}return null}hexadecimalIntegerAsNumber(t){const e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,e){const s=this[t];return s?parseFloat(s):e}enumeratedString(t){return this[t]}enumeratedStringList(t,e){const s=this[t];return(s?s.split(/[ ,]+/):[]).reduce((t,e)=>(t[e.toLowerCase()]=!0,t),e)}bool(t){return"YES"===this[t]}decimalResolution(t){const e=rs.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}static parseAttrList(t,e){let s;const i={};for(ns.lastIndex=0;null!==(s=ns.exec(t));){const r=s[1].trim();let n=s[2];const a=0===n.indexOf('"')&&n.lastIndexOf('"')===n.length-1;let o=!1;if(a)n=n.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(e&&(a||o))n=es(e,n);else if(!o&&!a)switch(r){case"CLOSED-CAPTIONS":if("NONE"===n)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":B.warn(`${t}: attribute ${r} is missing quotes`)}i[r]=n}return i}}function os(t){return"ID"!==t&&"CLASS"!==t&&"CUE"!==t&&"START-DATE"!==t&&"DURATION"!==t&&"END-DATE"!==t&&"END-ON-NEXT"!==t}function ls(t){return"SCTE35-OUT"===t||"SCTE35-IN"===t||"SCTE35-CMD"===t}class hs{constructor(t,e,s=0){var i;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(null==e?void 0:e.tagAnchor)||null,this.tagOrder=null!=(i=null==e?void 0:e.tagOrder)?i:s,e){const s=e.attr;for(const e in s)if(Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==s[e]){B.warn(`DATERANGE tag attribute: "${e}" does not match for tags with ID: "${t.ID}"`),this._badValueForSameId=e;break}t=M(new as({}),s,t)}if(this.attr=t,e?(this._startDate=e._startDate,this._cue=e._cue,this._endDate=e._endDate,this._dateAtEnd=e._dateAtEnd):this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){const t=(null==e?void 0:e.endDate)||new Date(this.attr["END-DATE"]);g(t.getTime())&&(this._endDate=t)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const t=this._cue;return void 0===t?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):t}get startTime(){const{tagAnchor:t}=this;return null===t||null===t.programDateTime?(B.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${t}`),NaN):t.start+(this.startDate.getTime()-t.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const t=this._endDate||this._dateAtEnd;if(t)return t;const e=this.duration;return null!==e?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(g(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&g(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}class ds{constructor(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}reloaded(t){if(!t)return this.advanced=!0,void(this.updated=!0);const e=this.lastPartSn-t.lastPartSn,s=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!s||!!e||!this.live,this.advanced=this.endSN>t.endSN||e>0||0===e&&s>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1}hasKey(t){return this.encryptedFragments.some(e=>{let s=e.decryptdata;return s||(e.setKeyFormat(t.keyFormat),s=e.decryptdata),!!s&&t.matches(s)})}get hasProgramDateTime(){return!!this.fragments.length&&g(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const t=this.partList;if(t){const e=this.lastPartIndex;if(-1!==e){for(let s=t.length;s--;)if(t[s].index>e)return t[s].index;return e}}return 0}get lastPartSn(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const t=this.partEnd-this.fragmentStart;return this.age>Math.max(t,this.totalduration)+this.levelTargetDuration}return!1}}function cs(t,e){return t.length===e.length&&!t.some((t,s)=>t!==e[s])}function us(t,e){return!t&&!e||!(!t||!e)&&cs(t,e)}function fs(t){return"AES-128"===t||"AES-256"===t||"AES-256-CTR"===t}function gs(t){switch(t){case"AES-128":case"AES-256":return 0;case"AES-256-CTR":return 1;default:throw new Error(`invalid full segment method ${t}`)}}function ms(t){return Uint8Array.from(atob(t),t=>t.charCodeAt(0))}function ps(t){return Uint8Array.from(unescape(encodeURIComponent(t)),t=>t.charCodeAt(0))}function vs(t){const e=function(t,e,s){const i=t[e];t[e]=t[s],t[s]=i};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}function ys(t){const e=t.split(":");let s=null;if("data"===e[0]&&2===e.length){const t=e[1].split(";"),i=t[t.length-1].split(",");if(2===i.length){const e="base64"===i[0],r=i[1];e?(t.splice(-1,1),s=ms(r)):s=function(t){const e=ps(t).subarray(0,16),s=new Uint8Array(16);return s.set(e,16-e.length),s}(r)}}return s}const Es="undefined"!=typeof self?self:void 0;var Ts={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ss="org.w3.clearkey",Ls="com.apple.streamingkeydelivery",As="com.microsoft.playready",Is="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function bs(t){switch(t){case Ls:return Ts.FAIRPLAY;case As:return Ts.PLAYREADY;case Is:return Ts.WIDEVINE;case Ss:return Ts.CLEARKEY}}function Rs(t){switch(t){case Ts.FAIRPLAY:return Ls;case Ts.PLAYREADY:return As;case Ts.WIDEVINE:return Is;case Ts.CLEARKEY:return Ss}}function ks(t){const{drmSystems:e,widevineLicenseUrl:s}=t,i=e?[Ts.FAIRPLAY,Ts.WIDEVINE,Ts.PLAYREADY,Ts.CLEARKEY].filter(t=>!!e[t]):[];return!i[Ts.WIDEVINE]&&s&&i.push(Ts.WIDEVINE),i}const Ds=null!=Es&&null!=(Cs=Es.navigator)&&Cs.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Cs;function Ms(t){const e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(e)),i=s.substring(s.indexOf("<"),s.length),r=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const t=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(t){const e=ms(t).subarray(0,16);return vs(e),e}}return null}let _s={};class ws{static clearKeyUriToKeyIdMap(){_s={}}static setKeyIdForUri(t,e){_s[t]=e}static addKeyIdForUri(t){const e=Object.keys(_s).length%Number.MAX_SAFE_INTEGER,s=new Uint8Array(16);return new DataView(s.buffer,12,4).setUint32(0,e),_s[t]=s,s}constructor(t,e,s,i=[1],r=null,n){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=e,this.keyFormat=s,this.keyFormatVersions=i,this.iv=r,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&!fs(t),null!=n&&n.startsWith("0x")&&(this.keyId=new Uint8Array(V(n)))}matches(t){return t.uri===this.uri&&t.method===this.method&&t.encrypted===this.encrypted&&t.keyFormat===this.keyFormat&&cs(t.keyFormatVersions,this.keyFormatVersions)&&us(t.iv,this.iv)&&us(t.keyId,this.keyId)}isSupported(){if(this.method){if(fs(this.method)||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case Ls:case Is:case As:case Ss:return-1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(t,e){if(!this.encrypted||!this.uri)return null;if(fs(this.method)){let e=this.iv;return e||("number"!=typeof t&&(B.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0),e=function(t){const e=new Uint8Array(16);for(let s=12;s<16;s++)e[s]=t>>8*(15-s)&255;return e}(t)),new ws(this.method,this.uri,"identity",this.keyFormatVersions,e)}if(this.keyId){const t=_s[this.uri];if(t&&!cs(this.keyId,t)&&ws.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const s=ys(this.uri);if(s)switch(this.keyFormat){case Is:if(this.pssh=s,!this.keyId){const t=function(t){const e=[];if(t instanceof ArrayBuffer){const s=t.byteLength;let i=0;for(;i+32<s;){const s=Pt(new DataView(t,i));e.push(s),i+=s.size}}return e}(s.buffer);if(t.length){var i;const e=t[0];this.keyId=null!=(i=e.kids)&&i.length?e.kids[0]:null}}this.keyId||(this.keyId=Ps(e));break;case As:{const t=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=function(t,e,s){if(16!==t.byteLength)throw new RangeError("Invalid system id");let i,r,n;i=0,r=new Uint8Array,n=new Uint8Array;const a=new Uint8Array(4);return s.byteLength>0&&new DataView(a.buffer).setUint32(0,s.byteLength,!1),function(t,...e){const s=e.length;let i=8,r=s;for(;r--;)i+=e[r].byteLength;const n=new Uint8Array(i);for(n[0]=i>>24&255,n[1]=i>>16&255,n[2]=i>>8&255,n[3]=255&i,n.set(t,4),r=0,i=8;r<s;r++)n.set(e[r],i),i+=e[r].byteLength;return n}([112,115,115,104],new Uint8Array([0,0,0,0]),t,n,r,a,s)}(t,0,s),this.keyId=Ms(s);break}default:{let t=s.subarray(0,16);if(16!==t.length){const e=new Uint8Array(16);e.set(t,16-t.length),t=e}this.keyId=t;break}}if(!this.keyId||16!==this.keyId.byteLength){let t;t=function(t){const e=null==t?void 0:t[Is];return e?e.keyId:null}(e),t||(t=Ps(e),t||(t=_s[this.uri])),t&&(this.keyId=t,ws.setKeyIdForUri(this.uri,t))}return this}}function Ps(t){const e=null==t?void 0:t[As];if(e){const t=ys(e.uri);if(t)return Ms(t)}return null}const xs=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Os=/#EXT-X-MEDIA:(.*)/g,Ns=/^#EXT(?:INF|-X-TARGETDURATION):/m,Fs=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Us=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Bs{static findGroup(t,e){for(let s=0;s<t.length;s++){const i=t[s];if(i.id===e)return i}}static resolve(t,e){return J.buildAbsoluteURL(e,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return Ns.test(t)}static parseMasterPlaylist(t,e){const s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:ts(t)},i=[];if(xs.lastIndex=0,!t.startsWith("#EXTM3U"))return s.playlistParsingError=new Error("no EXTM3U delimiter"),s;let r;for(;null!=(r=xs.exec(t));)if(r[1]){var n;const t=new as(r[1],s),a=es(s,r[2]),o={attrs:t,bitrate:t.decimalInteger("BANDWIDTH")||t.decimalInteger("AVERAGE-BANDWIDTH"),name:t.NAME,url:Bs.resolve(a,e)},l=t.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),Vs(t.CODECS,o);const h=t["SUPPLEMENTAL-CODECS"];h&&(o.supplemental={},Vs(h,o.supplemental)),null!=(n=o.unknownCodecs)&&n.length||i.push(o),s.levels.push(o)}else if(r[3]){const t=r[3],i=r[4];switch(t){case"SESSION-DATA":{const t=new as(i,s),e=t["DATA-ID"];e&&(null===s.sessionData&&(s.sessionData={}),s.sessionData[e]=t);break}case"SESSION-KEY":{const t=Gs(i,e,s);t.encrypted&&t.isSupported()?(null===s.sessionKeys&&(s.sessionKeys=[]),s.sessionKeys.push(t)):B.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`);break}case"DEFINE":ss(s,new as(i,s),e);break;case"CONTENT-STEERING":{const t=new as(i,s);s.contentSteering={uri:Bs.resolve(t["SERVER-URI"],e),pathwayId:t["PATHWAY-ID"]||"."};break}case"START":s.startTimeOffset=Ks(i)}}const a=i.length>0&&i.length<s.levels.length;return s.levels=a?i:s.levels,0===s.levels.length&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(t,e,s){let i;const r={},n=s.levels,a={AUDIO:n.map(t=>({id:t.attrs.AUDIO,audioCodec:t.audioCodec})),SUBTITLES:n.map(t=>({id:t.attrs.SUBTITLES,textCodec:t.textCodec})),"CLOSED-CAPTIONS":[]};let o=0;for(Os.lastIndex=0;null!==(i=Os.exec(t));){const t=new as(i[1],s),n=t.TYPE;if(n){const s=a[n],i=r[n]||[];r[n]=i;const l=t.LANGUAGE,h=t["ASSOC-LANGUAGE"],d=t.CHANNELS,c=t.CHARACTERISTICS,u=t["INSTREAM-ID"],f={attrs:t,bitrate:0,id:o++,groupId:t["GROUP-ID"]||"",name:t.NAME||l||"",type:n,default:t.bool("DEFAULT"),autoselect:t.bool("AUTOSELECT"),forced:t.bool("FORCED"),lang:l,url:t.URI?Bs.resolve(t.URI,e):""};if(h&&(f.assocLang=h),d&&(f.channels=d),c&&(f.characteristics=c),u&&(f.instreamId=u),null!=s&&s.length){const t=Bs.findGroup(s,f.groupId)||s[0];Hs(f,t,"audioCodec"),Hs(f,t,"textCodec")}i.push(f)}}return r}static parseLevelPlaylist(t,e,s,i,r,n){var a;const o={url:e},l=new ds(e),h=l.fragments,d=[];let c,u,f,m,p=null,v=0,y=0,E=0,T=0,S=0,L=null,A=new at(i,o),I=-1,b=!1,R=null;if(Fs.lastIndex=0,l.m3u8=t,l.hasVariableRefs=ts(t),"#EXTM3U"!==(null==(a=Fs.exec(t))?void 0:a[0]))return l.playlistParsingError=new Error("Missing format identifier #EXTM3U"),l;for(;null!==(c=Fs.exec(t));){b&&(b=!1,A=new at(i,o),A.playlistOffset=E,A.setStart(E),A.sn=v,A.cc=T,S&&(A.bitrate=S),A.level=s,p&&(A.initSegment=p,p.rawProgramDateTime&&(A.rawProgramDateTime=p.rawProgramDateTime,p.rawProgramDateTime=null),R&&(A.setByteRange(R),R=null)));const t=c[1];if(t){A.duration=parseFloat(t);const e=(" "+c[2]).slice(1);A.title=e||null,A.tagList.push(e?["INF",t,e]:["INF",t])}else if(c[3]){if(g(A.duration)){A.playlistOffset=E,A.setStart(E),f&&Ws(A,f,l),A.sn=v,A.level=s,A.cc=T,h.push(A);const t=(" "+c[3]).slice(1);A.relurl=es(l,t),Ys(A,L,d),L=A,E+=A.duration,v++,y=0,b=!0}}else{if(c=c[0].match(Us),!c){B.warn("No matches on slow regex match for level playlist!");continue}for(u=1;u<c.length&&void 0===c[u];u++);const t=(" "+c[u]).slice(1),r=(" "+c[u+1]).slice(1),a=c[u+2]?(" "+c[u+2]).slice(1):null;switch(t){case"BYTERANGE":L?A.setByteRange(r,L):A.setByteRange(r);break;case"PROGRAM-DATE-TIME":A.rawProgramDateTime=r,A.tagList.push(["PROGRAM-DATE-TIME",r]),-1===I&&(I=h.length);break;case"PLAYLIST-TYPE":l.type&&qs(l,t,c),l.type=r.toUpperCase();break;case"MEDIA-SEQUENCE":0!==l.startSN?qs(l,t,c):h.length>0&&Qs(l,t,c),v=l.startSN=parseInt(r);break;case"SKIP":{l.skippedSegments&&qs(l,t,c);const e=new as(r,l),s=e.decimalInteger("SKIPPED-SEGMENTS");if(g(s)){l.skippedSegments+=s;for(let t=s;t--;)h.push(null);v+=s}const i=e.enumeratedString("RECENTLY-REMOVED-DATERANGES");i&&(l.recentlyRemovedDateranges=(l.recentlyRemovedDateranges||[]).concat(i.split("\t")));break}case"TARGETDURATION":0!==l.targetduration&&qs(l,t,c),l.targetduration=Math.max(parseInt(r),1);break;case"VERSION":null!==l.version&&qs(l,t,c),l.version=parseInt(r);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":l.live||qs(l,t,c),l.live=!1;break;case"#":(r||a)&&A.tagList.push(a?[r,a]:[r]);break;case"DISCONTINUITY":T++,A.tagList.push(["DIS"]);break;case"GAP":A.gap=!0,A.tagList.push([t]);break;case"BITRATE":A.tagList.push([t,r]),S=1e3*parseInt(r),g(S)?A.bitrate=S:S=0;break;case"DATERANGE":{const t=new as(r,l),e=new hs(t,l.dateRanges[t.ID],l.dateRangeTagCount);l.dateRangeTagCount++,e.isValid||l.skippedSegments?l.dateRanges[e.id]=e:B.warn(`Ignoring invalid DATERANGE tag: "${r}"`),A.tagList.push(["EXT-X-DATERANGE",r]);break}case"DEFINE":{const t=new as(r,l);"IMPORT"in t?is(l,t,n):ss(l,t,e)}break;case"DISCONTINUITY-SEQUENCE":0!==l.startCC?qs(l,t,c):h.length>0&&Qs(l,t,c),l.startCC=T=parseInt(r);break;case"KEY":{const t=Gs(r,e,l);if(t.isSupported()){if("NONE"===t.method){f=void 0;break}f||(f={});const e=f[t.keyFormat];null!=e&&e.matches(t)||(e&&(f=M({},f)),f[t.keyFormat]=t)}else B.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${r}"`);break}case"START":l.startTimeOffset=Ks(r);break;case"MAP":{const t=new as(r,l);if(A.duration){const e=new at(i,o);zs(e,t,s,f),p=e,A.initSegment=p,p.rawProgramDateTime&&!A.rawProgramDateTime&&(A.rawProgramDateTime=p.rawProgramDateTime)}else{const e=A.byteRangeEndOffset;if(e){const t=A.byteRangeStartOffset;R=`${e-t}@${t}`}else R=null;zs(A,t,s,f),p=A,b=!0}p.cc=T;break}case"SERVER-CONTROL":m&&qs(l,t,c),m=new as(r),l.canBlockReload=m.bool("CAN-BLOCK-RELOAD"),l.canSkipUntil=m.optionalFloat("CAN-SKIP-UNTIL",0),l.canSkipDateRanges=l.canSkipUntil>0&&m.bool("CAN-SKIP-DATERANGES"),l.partHoldBack=m.optionalFloat("PART-HOLD-BACK",0),l.holdBack=m.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{l.partTarget&&qs(l,t,c);const e=new as(r);l.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let t=l.partList;t||(t=l.partList=[]);const e=y>0?t[t.length-1]:void 0,s=y++,i=new as(r,l),n=new ot(i,A,o,s,e);t.push(n),A.duration+=n.duration;break}case"PRELOAD-HINT":{const t=new as(r,l);l.preloadHint=t;break}case"RENDITION-REPORT":{const t=new as(r,l);l.renditionReports=l.renditionReports||[],l.renditionReports.push(t);break}default:B.warn(`line parsed but not handled: ${c}`)}}}L&&!L.relurl?(h.pop(),E-=L.duration,l.partList&&(l.fragmentHint=L)):l.partList&&(Ys(A,L,d),A.cc=T,l.fragmentHint=A,f&&Ws(A,f,l)),l.targetduration||(l.playlistParsingError=new Error("Missing Target Duration"));const k=h.length,D=h[0],C=h[k-1];if(E+=l.skippedSegments*l.targetduration,E>0&&k&&C){l.averagetargetduration=E/k;const t=C.sn;l.endSN="initSegment"!==t?t:0,l.live||(C.endList=!0),I>0&&(function(t,e){let s=t[e];for(let i=e;i--;){const e=t[i];if(!e)return;e.programDateTime=s.programDateTime-1e3*e.duration,s=e}}(h,I),D&&d.unshift(D))}return l.fragmentHint&&(E+=l.fragmentHint.duration),l.totalduration=E,d.length&&l.dateRangeTagCount&&D&&$s(d,l),l.endCC=T,l}}function $s(t,e){let s=t.length;if(!s){if(!e.hasProgramDateTime)return;{const i=e.fragments[e.fragments.length-1];t.push(i),s++}}const i=t[s-1],r=e.live?1/0:e.totalduration,n=Object.keys(e.dateRanges);for(let o=n.length;o--;){const l=e.dateRanges[n[o]],h=l.startDate.getTime();l.tagAnchor=i.ref;for(let i=s;i--;){var a;if((null==(a=t[i])?void 0:a.sn)<e.startSN)break;const s=js(e,h,t,i,r);if(-1!==s){l.tagAnchor=e.fragments[s].ref;break}}}}function js(t,e,s,i,r){const n=s[i];if(n){const o=n.programDateTime;var a;if(e>=o||0===i)if(e<=o+1e3*(((null==(a=s[i+1])?void 0:a.start)||r)-n.start)){const r=s[i].sn-t.startSN;if(r<0)return-1;const n=t.fragments;if(n.length>s.length)for(let a=(s[i+1]||n[n.length-1]).sn-t.startSN;a>r;a--){const t=n[a].programDateTime;if(e>=t&&e<t+1e3*n[a].duration)return a}return r}}return-1}function Gs(t,e,s){var i,r;const n=new as(t,s),a=null!=(i=n.METHOD)?i:"",o=n.URI,l=n.hexadecimalInteger("IV"),h=n.KEYFORMATVERSIONS,d=null!=(r=n.KEYFORMAT)?r:"identity";o&&n.IV&&!l&&B.error(`Invalid IV: ${n.IV}`);const c=o?Bs.resolve(o,e):"",u=(h||"1").split("/").map(Number).filter(Number.isFinite);return new ws(a,c,d,u,l,n.KEYID)}function Ks(t){const e=new as(t).decimalFloatingPoint("TIME-OFFSET");return g(e)?e:null}function Vs(t,e){let s=(t||"").split(/[ ,]+/).filter(t=>t);["video","audio","text"].forEach(t=>{const i=s.filter(e=>Nt(e,t));i.length&&(e[`${t}Codec`]=i.map(t=>t.split("/")[0]).join(","),s=s.filter(t=>-1===i.indexOf(t)))}),e.unknownCodecs=s}function Hs(t,e,s){const i=e[s];i&&(t[s]=i)}function Ys(t,e,s){t.rawProgramDateTime?s.push(t):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime)}function zs(t,e,s,i){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=s,t.sn="initSegment",i&&(t.levelkeys=i),t.initSegment=null}function Ws(t,e,s){t.levelkeys=e;const{encryptedFragments:i}=s;i.length&&i[i.length-1].levelkeys===e||!Object.keys(e).some(t=>e[t].isCommonEncryption)||i.push(t)}function qs(t,e,s){t.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${s[0]})`)}function Qs(t,e,s){t.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${s[0]})`)}function Xs(t,e){const s=e.startPTS;if(g(s)){let i,r=0;e.sn>t.sn?(r=s-t.start,i=t):(r=t.start-s,i=e),i.duration!==r&&i.setDuration(r)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.setStart(t.start+(t.minEndPTS-t.start)):e.setStart(t.start+t.duration):e.setStart(Math.max(t.start-e.duration,0))}function Zs(t,e,s,i,r,n,a){i-s<=0&&(a.warn("Fragment should have a positive duration",e),i=s+e.duration,n=r+e.duration);let o=s,l=i;const h=e.startPTS,d=e.endPTS;if(g(h)){const c=Math.abs(h-s);t&&c>t.totalduration?a.warn(`media timestamps and playlist times differ by ${c}s for level ${e.level} ${t.url}`):g(e.deltaPTS)?e.deltaPTS=Math.max(c,e.deltaPTS):e.deltaPTS=c,o=Math.max(s,h),s=Math.min(s,h),r=void 0!==e.startDTS?Math.min(r,e.startDTS):r,l=Math.min(i,d),i=Math.max(i,d),n=void 0!==e.endDTS?Math.max(n,e.endDTS):n}const c=s-e.start;0!==e.start&&e.setStart(s),e.setDuration(i-e.start),e.startPTS=s,e.maxStartPTS=o,e.startDTS=r,e.endPTS=i,e.minEndPTS=l,e.endDTS=n;const u=e.sn;if(!t||u<t.startSN||u>t.endSN)return 0;let f;const m=u-t.startSN,p=t.fragments;for(p[m]=e,f=m;f>0;f--)Xs(p[f],p[f-1]);for(f=m;f<p.length-1;f++)Xs(p[f],p[f+1]);return t.fragmentHint&&Xs(p[p.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,c}function Js(t,e,s,i,r){return new Error(`${t} ${r.url}\nPlaylist starting @${e.startSN}\n${e.m3u8}\n\nPlaylist starting @${s.startSN}\n${s.m3u8}`)}function ti(t,e,s=!0){const i=e.startSN+e.skippedSegments-t.startSN,r=t.fragments,n=i>=0;let a=0;if(n&&i<r.length)a=r[i].start;else if(n&&e.startSN===t.endSN+1)a=t.fragmentEnd;else if(n&&s)a=t.fragmentStart+i*e.levelTargetDuration;else{if(e.skippedSegments||0!==e.fragmentStart)return;a=t.fragmentStart}ei(e,a)}function ei(t,e){if(e){const s=t.fragments;for(let i=t.skippedSegments;i<s.length;i++)s[i].addStart(e);t.fragmentHint&&t.fragmentHint.addStart(e)}}function si(t,e=1/0){let s=1e3*t.targetduration;if(t.updated){const i=t.fragments,r=4;if(i.length&&s*r>e){const t=1e3*i[i.length-1].duration;t<s&&(s=t)}}else s/=2;return Math.round(s)}function ii(t,e,s){if(!t)return null;let i=t.fragments[e-t.startSN];return i||(i=t.fragmentHint,i&&i.sn===e?i:e<t.startSN&&s&&s.sn===e?s:null)}function ri(t,e,s){return t?ni(t.partList,e,s):null}function ni(t,e,s){if(t)for(let i=t.length;i--;){const r=t[i];if(r.index===s&&r.fragment.sn===e)return r}return null}function ai(t){t.forEach((t,e)=>{var s;null==(s=t.details)||s.fragments.forEach(t=>{t.level=e,t.initSegment&&(t.initSegment.level=e)})})}function oi(t,e){return!(t===e||!e)&&li(t)!==li(e)}function li(t){return t.replace(/\?[^?]*$/,"")}function hi(t,e){for(let i=0,r=t.length;i<r;i++){var s;if((null==(s=t[i])?void 0:s.cc)===e)return t[i]}return null}function di(t,e){const s=t.start+e;t.startPTS=s,t.setStart(s),t.endPTS=s+t.duration}function ci(t,e){const s=e.fragments;for(let e=0,i=s.length;e<i;e++)di(s[e],t);e.fragmentHint&&di(e.fragmentHint,t),e.alignedSliding=!0}function ui(t,e){if(!function(t,e){return!!(t&&e.startCC<t.endCC&&e.endCC>t.startCC)}(e,t))return;const s=Math.min(e.endCC,t.endCC),i=hi(e.fragments,s),r=hi(t.fragments,s);i&&r&&(B.log(`Aligning playlist at start of dicontinuity sequence ${s}`),ci(i.start-r.start,t))}function fi(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const s=t.fragments,i=e.fragments;if(!s.length||!i.length)return;let r,n;const a=Math.min(e.endCC,t.endCC);e.startCC<a&&t.startCC<a&&(r=hi(i,a),n=hi(s,a)),r&&n||(r=i[Math.floor(i.length/2)],n=hi(s,r.cc)||s[Math.floor(s.length/2)]);const o=r.programDateTime,l=n.programDateTime;o&&l&&ci((l-o)/1e3-(n.start-r.start),t)}function gi(t,e,s){mi(t,e,s),t.addEventListener(e,s)}function mi(t,e,s){t.removeEventListener(e,s)}const pi="STOPPED",vi="IDLE",yi="KEY_LOADING",Ei="FRAG_LOADING",Ti="FRAG_LOADING_WAITING_RETRY",Si="WAITING_TRACK",Li="PARSING",Ai="PARSED",Ii="ENDED",bi="ERROR",Ri="WAITING_INIT_PTS",ki="WAITING_LEVEL";class Di extends qe{constructor(t,e,s,i,r){super(i,t.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=pi,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:t,fragCurrent:e,media:s,mediaBuffer:i,state:r}=this,n=s?s.currentTime:0,a=Ze.bufferInfo(i||s,n,t.maxBufferHole),o=!a.len;if(this.log(`Media seeking to ${g(n)?n.toFixed(3):n}, state: ${r}, ${o?"out of":"in"} buffer`),this.state===Ii)this.resetLoadingState();else if(e){const s=t.maxFragLookUpTolerance,i=e.start-s,r=e.start+e.duration+s;if(o||r<a.start||i>a.end){const t=n>r;(n<i||t)&&(t&&e.loader&&(this.log(`Cancelling fragment load for seek (sn: ${e.sn})`),e.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(s&&(this.fragmentTracker.removeFragmentsInRange(n,1/0,this.playlistType,!0),n>this.lastCurrentTime&&(this.lastCurrentTime=n),!this.loadingParts)){const t=Math.max(a.end,n),e=this.shouldLoadParts(this.getLevelDetails(),t);e&&(this.log(`LL-Part loading ON after seeking to ${n.toFixed(2)} with buffer @${t.toFixed(2)}`),this.loadingParts=e)}this.hls.hasEnoughToStart||(this.log(`Setting ${o?"startPosition":"nextLoadPosition"} to ${n} for seek without enough to start`),this.nextLoadPosition=n,o&&(this.startPosition=n)),o&&this.state===vi&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=r,this.hls=t,this.fragmentLoader=new He(t.config),this.keyLoader=s,this.fragmentTracker=e,this.config=t.config,this.decrypter=new Ke(t.config)}registerListeners(){const{hls:t}=this;t.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(E.MANIFEST_LOADING,this.onManifestLoading,this),t.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(E.MANIFEST_LOADING,this.onManifestLoading,this),t.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(E.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){if(this.state===pi)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const t=this.fragCurrent;null!=t&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=pi}get startPositionValue(){const{nextLoadPosition:t,startPosition:e}=this;return-1===e&&t?t:e}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(t,e){if(e.live||!this.media)return!1;const s=t.end||0,i=this.config.timelineOffset||0;if(s<=i)return!1;const r=t.buffered;this.config.maxBufferHole&&r&&r.length>1&&(t=Ze.bufferedInfo(r,t.start,0));const n=t.nextStart;if(n&&n>i&&n<e.edge)return!1;if(this.media.currentTime<t.start)return!1;const a=e.partList;if(null!=a&&a.length){const t=a[a.length-1];return Ze.isBuffered(this.media,t.start+t.duration/2)}const o=e.fragments[e.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(o)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){const t=this.config.timelineOffset;var e;return t?(null==(e=this.getLevelDetails())?void 0:e.appliedTimelineOffset)||t:0}onMediaAttached(t,e){const s=this.media=this.mediaBuffer=e.media;gi(s,"seeking",this.onMediaSeeking),gi(s,"ended",this.onMediaEnded);const i=this.config;this.levels&&i.autoStartLoad&&this.state===pi&&this.startLoad(i.startPosition)}onMediaDetaching(t,e){const s=!!e.transferMedia,i=this.media;if(null!==i){if(i.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),mi(i,"seeking",this.onMediaSeeking),mi(i,"ended",this.onMediaEnded),this.keyLoader&&!s&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,s)return this.resetLoadingState(),void this.resetTransmuxer();this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(t,e){}onManifestLoaded(t,e){this.startTimeOffset=e.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=pi,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(t,e,s){this.startFragRequested=!0,this._loadFragForPlayback(t,e,s)}_loadFragForPlayback(t,e,s){this._doFragLoad(t,e,s,t=>{const e=t.frag;if(this.fragContextChanged(e))return this.warn(`${e.type} sn: ${e.sn}${t.part?" part: "+t.part.index:""} of ${this.fragInfo(e,!1,t.part)}) was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)}).then(t=>{if(!t)return;const e=this.state,s=t.frag;this.fragContextChanged(s)?(e===Ei||!this.fragCurrent&&e===Li)&&(this.fragmentTracker.removeFragment(s),this.state=vi):("payload"in t&&(this.log(`Loaded ${s.type} sn: ${s.sn} of ${this.playlistLabel()} ${s.level}`),this.hls.trigger(E.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))}).catch(e=>{this.state!==pi&&this.state!==bi&&(this.warn(`Frag error: ${(null==e?void 0:e.message)||e}`),this.resetFragmentLoading(t))})}clearTrackerIfNeeded(t){var e;const{fragmentTracker:s}=this;if(s.getState(t)===Pe){const e=t.type,i=this.getFwdBufferInfo(this.mediaBuffer,e),r=Math.max(t.duration,i?i.len:this.config.maxBufferLength),n=this.backtrackFragment;(1===(n?t.sn-n.sn:0)||this.reduceMaxBufferLength(r,t.duration))&&s.removeFragment(t)}else 0===(null==(e=this.mediaBuffer)?void 0:e.buffered.length)?s.removeAllFragments():s.hasParts(t.type)&&(s.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),s.getState(t)===xe&&s.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const e=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}waitForLive(t){const e=t.details;return(null==e?void 0:e.live)&&"EVENT"!==e.type&&(this.levelLastLoaded!==t||e.expired)}flushMainBuffer(t,e,s=null){if(!(t-e))return;const i={startOffset:t,endOffset:e,type:s};this.hls.trigger(E.BUFFER_FLUSHING,i)}_loadInitSegment(t,e){this._doFragLoad(t,e).then(t=>{const e=null==t?void 0:t.frag;if(!e||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t}).then(t=>{const{hls:e}=this,{frag:s,payload:i}=t,r=s.decryptdata;if(i&&i.byteLength>0&&null!=r&&r.key&&r.iv&&fs(r.method)){const n=self.performance.now();return this.decrypter.decrypt(new Uint8Array(i),r.key.buffer,r.iv.buffer,gs(r.method)).catch(t=>{throw e.trigger(E.ERROR,{type:v.MEDIA_ERROR,details:y.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:s}),t}).then(i=>{const r=self.performance.now();return e.trigger(E.FRAG_DECRYPTED,{frag:s,payload:i,stats:{tstart:n,tdecrypt:r}}),t.payload=i,this.completeInitSegmentLoad(t)})}return this.completeInitSegmentLoad(t)}).catch(e=>{this.state!==pi&&this.state!==bi&&(this.warn(e),this.resetFragmentLoading(t))})}completeInitSegmentLoad(t){const{levels:e}=this;if(!e)throw new Error("init load aborted, missing levels");const s=t.frag.stats;this.state!==pi&&(this.state=vi),t.frag.data=new Uint8Array(t.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(t,e){var s,i;const r=t.tracks;if(r&&!e.encrypted&&(null!=(s=r.audio)&&s.encrypted||null!=(i=r.video)&&i.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const t=this.media,s=new Error(`Encrypted track with no key in ${this.fragInfo(e)} (media ${t?"attached mediaKeys: "+t.mediaKeys:"detached"})`);return this.warn(s.message),!(!t||t.mediaKeys)&&(this.hls.trigger(E.ERROR,{type:v.KEY_SYSTEM_ERROR,details:y.KEY_SYSTEM_NO_KEYS,fatal:!1,error:s,frag:e}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(t){const{fragCurrent:e}=this;return!t||!e||t.sn!==e.sn||t.level!==e.level}fragBufferedComplete(t,e){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.fragInfo(t,!1,e)} > buffer:${s?function(t){let e="";const s=t.length;for(let i=0;i<s;i++)e+=`[${t.start(i).toFixed(3)}-${t.end(i).toFixed(3)}]`;return e}(Ze.getBuffered(s)):"(detached)"})`),nt(t)){var i;if(t.type!==R){const e=t.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return void(this.state=vi)}const e=null==(i=this.levels)?void 0:i[t.level];null!=e&&e.fragmentError&&(this.log(`Resetting level fragment error count of ${e.fragmentError} on frag buffered`),e.fragmentError=0)}this.state=vi}_handleFragmentLoadComplete(t){const{transmuxer:e}=this;if(!e)return;const{frag:s,part:i,partsLoaded:r}=t,n=!r||0===r.length||r.some(t=>!t),a=new Qe(s.level,s.sn,s.stats.chunkCount+1,0,i?i.index:-1,!n);e.flush(a)}_handleFragmentLoadProgress(t){}_doFragLoad(t,e,s=null,i){var r;this.fragCurrent=t;const n=e.details;if(!this.levels||!n)throw new Error(`frag load aborted, missing level${n?"":" detail"}s`);let a=null;if(!t.encrypted||null!=(r=t.decryptdata)&&r.key)t.encrypted||(a=this.keyLoader.loadClear(t,n.encryptedFragments,this.startFragRequested),a&&this.log("[eme] blocking frag load until media-keys acquired"));else if(this.log(`Loading key for ${t.sn} of [${n.startSN}-${n.endSN}], ${this.playlistLabel()} ${t.level}`),this.state=yi,this.fragCurrent=t,a=this.keyLoader.load(t).then(t=>{if(!this.fragContextChanged(t.frag))return this.hls.trigger(E.KEY_LOADED,t),this.state===yi&&(this.state=vi),t}),this.hls.trigger(E.KEY_LOADING,{frag:t}),null===this.fragCurrent)return this.log("context changed in KEY_LOADING"),Promise.resolve(null);const o=this.fragPrevious;if(nt(t)&&(!o||t.sn!==o.sn)){const s=this.shouldLoadParts(e.details,t.end);s!==this.loadingParts&&(this.log(`LL-Part loading ${s?"ON":"OFF"} loading sn ${null==o?void 0:o.sn}->${t.sn}`),this.loadingParts=s)}if(s=Math.max(t.start,s||0),this.loadingParts&&nt(t)){const r=n.partList;if(r&&i){s>n.fragmentEnd&&n.fragmentHint&&(t=n.fragmentHint);const o=this.getNextPart(r,t,s);if(o>-1){const l=r[o];let h;return t=this.fragCurrent=l.fragment,this.log(`Loading ${t.type} sn: ${t.sn} part: ${l.index} (${o}/${r.length-1}) of ${this.fragInfo(t,!1,l)}) cc: ${t.cc} [${n.startSN}-${n.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=Ei,h=a?a.then(s=>!s||this.fragContextChanged(s.frag)?null:this.doFragPartsLoad(t,l,e,i)).catch(t=>this.handleFragLoadError(t)):this.doFragPartsLoad(t,l,e,i).catch(t=>this.handleFragLoadError(t)),this.hls.trigger(E.FRAG_LOADING,{frag:t,part:l,targetBufferTime:s}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):h}if(!t.url||this.loadedEndOfParts(r,s))return Promise.resolve(null)}}var l;if(nt(t)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${t.sn} loaded parts: ${null==(l=n.partList)?void 0:l.filter(t=>t.loaded).map(t=>`[${t.start}-${t.end}]`)}`),this.loadingParts=!1;else if(!t.url)return Promise.resolve(null);this.log(`Loading ${t.type} sn: ${t.sn} of ${this.fragInfo(t,!1)}) cc: ${t.cc} ${"["+n.startSN+"-"+n.endSN+"]"}, target: ${parseFloat(s.toFixed(3))}`),g(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=Ei;const h=this.config.progressive&&t.type!==R;let d;return d=h&&a?a.then(e=>!e||this.fragContextChanged(e.frag)?null:this.fragmentLoader.load(t,i)).catch(t=>this.handleFragLoadError(t)):Promise.all([this.fragmentLoader.load(t,h?i:void 0),a]).then(([t])=>(!h&&i&&i(t),t)).catch(t=>this.handleFragLoadError(t)),this.hls.trigger(E.FRAG_LOADING,{frag:t,targetBufferTime:s}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(t,e,s,i){return new Promise((r,n)=>{var a;const o=[],l=null==(a=s.details)?void 0:a.partList,h=e=>{this.fragmentLoader.loadPart(t,e,i).then(i=>{o[e.index]=i;const n=i.part;this.hls.trigger(E.FRAG_LOADED,i);const a=ri(s.details,t.sn,e.index+1)||ni(l,t.sn,e.index+1);if(!a)return r({frag:t,part:n,partsLoaded:o});h(a)}).catch(n)};h(e)})}handleFragLoadError(t){if("data"in t){const e=t.data;e.frag&&e.details===y.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):e.frag&&e.type===v.KEY_SYSTEM_ERROR?(e.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(e.frag)):this.hls.trigger(E.ERROR,e)}else this.hls.trigger(E.ERROR,{type:v.OTHER_ERROR,details:y.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const e=this.getCurrentContext(t);if(!e||this.state!==Li)return void(this.fragCurrent||this.state===pi||this.state===bi||(this.state=vi));const{frag:s,part:i,level:r}=e,n=self.performance.now();s.stats.parsing.end=n,i&&(i.stats.parsing.end=n);const a=this.getLevelDetails(),o=a&&s.sn>a.endSN||this.shouldLoadParts(a,s.end);o!==this.loadingParts&&(this.log(`LL-Part loading ${o?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=o),this.updateLevelTiming(s,i,r,t.partial)}shouldLoadParts(t,e){if(this.config.lowLatencyMode){if(!t)return this.loadingParts;if(t.partList){var s;const r=t.partList[0];if(r.fragment.type===R)return!1;var i;if(e>=r.end+((null==(s=t.fragmentHint)?void 0:s.duration)||0))if((this.hls.hasEnoughToStart?(null==(i=this.media)?void 0:i.currentTime)||this.lastCurrentTime:this.getLoadPosition())>r.start-r.fragment.duration)return!0}}return!1}getCurrentContext(t){const{levels:e,fragCurrent:s}=this,{level:i,sn:r,part:n}=t;if(null==e||!e[i])return this.warn(`Levels object was unset while buffering fragment ${r} of ${this.playlistLabel()} ${i}. The current chunk will not be buffered.`),null;const a=e[i],o=a.details,l=n>-1?ri(o,r,n):null,h=l?l.fragment:ii(o,r,s);return h?(s&&s!==h&&(h.stats=s.stats),{frag:h,part:l,level:a}):null}bufferFragmentData(t,e,s,i,r){if(this.state!==Li)return;const{data1:n,data2:a}=t;let o=n;if(a&&(o=kt(n,a)),!o.length)return;const l=this.initPTS[e.cc],h=l?-l.baseTime/l.timescale:void 0,d={type:t.type,frag:e,part:s,chunkMeta:i,offset:h,parent:e.type,data:o};if(this.hls.trigger(E.BUFFER_APPENDING,d),t.dropped&&t.independent&&!s){if(r)return;this.flushBufferGap(e)}}flushBufferGap(t){const e=this.media;if(!e)return;if(!Ze.isBuffered(e,e.currentTime))return void this.flushMainBuffer(0,t.start);const s=e.currentTime,i=Ze.bufferInfo(e,s,0),r=t.duration,n=Math.min(2*this.config.maxFragLookUpTolerance,.25*r),a=Math.max(Math.min(t.start-n,i.end-n),s+n);t.start-a>n&&this.flushMainBuffer(a,t.start)}getFwdBufferInfo(t,e){var s;const i=this.getLoadPosition();if(!g(i))return null;const r=this.lastCurrentTime>i||null!=(s=this.media)&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(t,i,e,r)}getFwdBufferInfoAtPos(t,e,s,i){const r=Ze.bufferInfo(t,e,i);if(0===r.len&&void 0!==r.nextStart){const n=this.fragmentTracker.getBufferedFrag(e,s);if(n&&(r.nextStart<=n.end||n.gap)){const s=Math.max(Math.min(r.nextStart,n.end)-e,i);return Ze.bufferInfo(t,e,s)}}return r}getMaxBufferLength(t){const{config:e}=this;let s;return s=t?Math.max(8*e.maxBufferSize/t,e.maxBufferLength):e.maxBufferLength,Math.min(s,e.maxMaxBufferLength)}reduceMaxBufferLength(t,e){const s=this.config,i=Math.max(Math.min(t-e,s.maxBufferLength),e),r=Math.max(t-3*e,s.maxMaxBufferLength/2,i);return r>=i&&(s.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0)}getAppendedFrag(t,e=I){const s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(t,e):null;return s&&"fragment"in s?s.fragment:s}getNextFragment(t,e){const s=e.fragments,i=s.length;if(!i)return null;const{config:r}=this,n=s[0].start,a=r.lowLatencyMode&&!!e.partList;let o=null;if(e.live){const s=r.initialLiveManifestSize;if(i<s)return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${s})`),null;if(!e.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||t<n){var l;a&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),o=this.getInitialLiveFragment(e);const s=this.hls.startPosition,i=this.hls.liveSyncPosition,r=o?(-1!==s&&s>=n?s:i)||o.start:t;this.log(`Setting startPosition to ${r} to match start frag at live edge. mainStart: ${s} liveSyncPosition: ${i} frag.start: ${null==(l=o)?void 0:l.start}`),this.startPosition=this.nextLoadPosition=r}}else t<=n&&(o=s[0]);if(!o){const s=this.loadingParts?e.partEnd:e.fragmentEnd;o=this.getFragmentAtPosition(t,s,e)}let h=this.filterReplacedPrimary(o,e);if(!h&&o){const t=o.sn-e.startSN;h=this.filterReplacedPrimary(s[t+1]||null,e)}return this.mapToInitFragWhenRequired(h)}isLoopLoading(t,e){const s=this.fragmentTracker.getState(t);return(s===Oe||s===xe&&!!t.gap)&&this.nextLoadPosition>e}getNextFragmentLoopLoading(t,e,s,i,r){let n=null;if(t.gap&&(n=this.getNextFragment(this.nextLoadPosition,e),n&&!n.gap&&s.nextStart)){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,i,0);if(null!==t&&s.len+t.len>=r){const t=n.sn;return this.loopSn!==t&&(this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${t}`),this.loopSn=t),null}}return this.loopSn=void 0,n}get primaryPrefetch(){var t;if(Ci(this.config)&&(null==(t=this.hls.interstitialsManager)||null==(t=t.playingItem)?void 0:t.event))return!0;return!1}filterReplacedPrimary(t,e){if(!t)return t;if(Ci(this.config)&&t.type!==R){const s=this.hls.interstitialsManager,i=null==s?void 0:s.bufferingItem;if(i){const s=i.event;if(s){if(s.appendInPlace||Math.abs(t.start-i.start)>1||0===i.start)return null}else{if(t.end<=i.start&&!1===(null==e?void 0:e.live))return null;if(t.start>i.end&&i.nextEvent&&(i.nextEvent.appendInPlace||t.start-i.end>1))return null}}const r=null==s?void 0:s.playerQueue;if(r)for(let e=r.length;e--;){const s=r[e].interstitial;if(s.appendInPlace&&t.start>=s.startTime&&t.end<=s.resumeTime)return null}}return t}mapToInitFragWhenRequired(t){return null==t||!t.initSegment||t.initSegment.data||this.bitrateTest?t:t.initSegment}getNextPart(t,e,s){let i=-1,r=!1,n=!0;for(let a=0,o=t.length;a<o;a++){const o=t[a];if(n=n&&!o.independent,i>-1&&s<o.start)break;const l=o.loaded;l?i=-1:(r||(o.independent||n)&&o.fragment===e)&&(o.fragment!==e&&this.warn(`Need buffer at ${s} but next unloaded part starts at ${o.start}`),i=a),r=l}return i}loadedEndOfParts(t,e){let s;for(let i=t.length;i--;){if(s=t[i],!s.loaded)return!1;if(e>s.start)return!0}return!1}getInitialLiveFragment(t){const e=t.fragments,s=this.fragPrevious;let i=null;if(s){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),i=function(t,e,s){if(null===e||!Array.isArray(t)||!t.length||!g(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;for(let i=0;i<t.length;++i){const r=t[i];if(Se(e,s,r))return r}return null}(e,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){const r=s.sn+1;if(r>=t.startSN&&r<=t.endSN){const n=e[r-t.startSN];s.cc===n.cc&&(i=n,this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`))}i||(i=Le(t,s.cc,s.end),i&&this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`))}}else{const e=this.hls.liveSyncPosition;null!==e&&(i=this.getFragmentAtPosition(e,this.bitrateTest?t.fragmentEnd:t.edge,t))}return i}getFragmentAtPosition(t,e,s){const{config:i}=this;let{fragPrevious:r}=this,{fragments:n,endSN:a}=s;const{fragmentHint:o}=s,{maxFragLookUpTolerance:l}=i,h=s.partList,d=!!(this.loadingParts&&null!=h&&h.length&&o);let c;var u;(d&&!this.bitrateTest&&h[h.length-1].fragment.sn===o.sn&&(n=n.concat(o),a=o.sn),t<e)?c=Ee(r,n,t,t<this.lastCurrentTime||t>e-l||null!=(u=this.media)&&u.paused||!this.startFragRequested?0:l):c=n[n.length-1];if(c){const t=c.sn-s.startSN,e=this.fragmentTracker.getState(c);if((e===Oe||e===xe&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!d||h[0].fragment.sn>c.sn||!s.live)&&c.level===r.level){const e=n[t+1];c=c.sn<a&&this.fragmentTracker.getState(e)!==Oe?e:null}}return c}alignPlaylists(t,e,s){const i=t.fragments.length;if(!i)return this.warn("No fragments in live playlist"),0;const r=t.fragmentStart,n=!e,a=t.alignedSliding&&g(r);if(n||!a&&!r){!function(t,e){t&&(ui(e,t),e.alignedSliding||fi(e,t),e.alignedSliding||e.skippedSegments||ti(t,e,!1))}(s,t);const r=t.fragmentStart;return this.log(`Live playlist sliding: ${r.toFixed(2)} start-sn: ${e?e.startSN:"na"}->${t.startSN} fragments: ${i}`),r}return r}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)}setStartPosition(t,e){let s=this.startPosition;s<e&&(s=-1);const i=this.timelineOffset;if(-1===s){const r=null!==this.startTimeOffset,n=r?this.startTimeOffset:t.startTimeOffset;null!==n&&g(n)?(s=e+n,n<0&&(s+=t.edge),s=Math.min(Math.max(e,s),e+t.totalduration),this.log(`Setting startPosition to ${s} for start time offset ${n} found in ${r?"multivariant":"media"} playlist`),this.startPosition=s):t.live?(s=this.hls.liveSyncPosition||e,this.log(`Setting startPosition to -1 to start at live edge ${s}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=s=0),this.lastCurrentTime=s+i}this.nextLoadPosition=s+i}getLoadPosition(){var t;const{media:e}=this;let s=0;return null!=(t=this.hls)&&t.hasEnoughToStart&&e?s=e.currentTime:this.nextLoadPosition>=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(t,e){this.transmuxer&&t.type===this.playlistType&&nt(t)&&t.stats.aborted&&(this.log(`Fragment ${t.sn}${e?" part "+e.index:""} of ${this.playlistLabel()} ${t.level} was aborted`),this.resetFragmentLoading(t))}resetFragmentLoading(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===Ti)||(this.state=vi)}onFragmentOrKeyLoadError(t,e){var s;if(e.chunkMeta&&!e.frag){const t=this.getCurrentContext(e.chunkMeta);t&&(e.frag=t.frag)}const i=e.frag;if(!i||i.type!==t||!this.levels)return;var r;if(this.fragContextChanged(i))return void this.warn(`Frag load error must match current frag to retry ${i.url} > ${null==(r=this.fragCurrent)?void 0:r.url}`);const n=e.details===y.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);const a=e.errorAction;if(!a)return void(this.state=bi);const{action:o,flags:l,retryCount:h=0,retryConfig:d}=a,c=!!d,u=c&&5===o,f=c&&!a.resolved&&1===l,g=null==(s=this.hls.latestLevelDetails)?void 0:s.live;if(!u&&f&&nt(i)&&!i.endList&&g&&!be(e))this.resetFragmentErrors(t),this.treatAsGap(i),a.resolved=!0;else if((u||f)&&h<d.maxNumRetry){var m;const s=Me(null==(m=e.response)?void 0:m.code),r=ke(d,h);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+r,this.state=Ti,a.resolved=!0,s)return this.log("Waiting for connection (offline)"),this.retryDate=1/0,void(e.reason="offline");this.warn(`Fragment ${i.sn} of ${t} ${i.level} errored with ${e.details}, retrying loading ${h+1}/${d.maxNumRetry} in ${r}ms`)}else if(d){if(this.resetFragmentErrors(t),!(h<d.maxNumRetry))return void this.warn(`${e.details} reached or exceeded max retry (${h})`);n||3===o||(a.resolved=!0)}else this.state=2===o?ki:bi;this.tickImmediate()}checkRetryDate(){const t=self.performance.now(),e=this.retryDate,s=e===1/0;(!e||t>=e||s&&!Me(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=vi)}reduceLengthAndFlushBuffer(t){if(this.state===Li||this.state===Ai){const e=t.frag,s=t.parent,i=this.getFwdBufferInfo(this.mediaBuffer,s),r=i&&i.len>.5;r&&this.reduceMaxBufferLength(i.len,(null==e?void 0:e.duration)||10);const n=!r;return n&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),e&&(this.fragmentTracker.removeFragment(e),this.nextLoadPosition=e.start),this.resetLoadingState(),n}return!1}resetFragmentErrors(t){t===b&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==pi&&(this.state=vi)}afterBufferFlushed(t,e,s){if(!t)return;const i=Ze.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,i,s),this.state===Ii&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==pi&&(this.state=vi)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=this.levelLastLoaded,e=t?t.details:null;null!=e&&e.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(e,e.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(t){this.log(`Loading context changed while buffering sn ${t.sn} of ${this.playlistLabel()} ${-1===t.level?"<removed>":t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,e,s,i){const r=s.details;if(r){if(!Object.keys(t.elementaryStreams).reduce((e,n)=>{const a=t.elementaryStreams[n];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${t.sn} ${n} duration reliably (${o})`),e||!1;const l=i?0:Zs(r,t,a.startPTS,a.endPTS,a.startDTS,a.endDTS,this);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:r,level:s,drift:l,type:n,frag:t,start:a.startPTS,end:a.endPTS}),!0}return e},!1)){var n;const e=null===(null==(n=this.transmuxer)?void 0:n.error);if((0===s.fragmentError||e&&(s.fragmentError<2||t.endList))&&this.treatAsGap(t,s),e){const e=new Error(`Found no media in fragment ${t.sn} of ${this.playlistLabel()} ${t.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(e.message),this.hls.trigger(E.ERROR,{type:v.MEDIA_ERROR,details:y.FRAG_PARSING_ERROR,fatal:!1,error:e,frag:t,reason:`Found no media in msn ${t.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Ai,this.log(`Parsed ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.fragInfo(t,!1,e)})`),this.hls.trigger(E.FRAG_PARSED,{frag:t,part:e})}else this.warn("level.details undefined")}playlistLabel(){return this.playlistType===I?"level":"track"}fragInfo(t,e=!0,s){var i,r;return`${this.playlistLabel()} ${t.level} (${s?"part":"frag"}:[${(null!=(i=e&&!s?t.startPTS:(s||t).start)?i:NaN).toFixed(3)}-${(null!=(r=e&&!s?t.endPTS:(s||t).end)?r:NaN).toFixed(3)}]${s&&"main"===t.type?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(t,e){e&&e.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)}resetTransmuxer(){var t;null==(t=this.transmuxer)||t.reset()}recoverWorkerError(t){"demuxerWorker"===t.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(t){const e=this._state;e!==t&&(this._state=t,this.log(`${e}->${t}`))}get state(){return this._state}}function Ci(t){return!!t.interstitialsController&&!1!==t.enableInterstitialPlayback}class Mi{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:e}=this;let s;return t.length?(s=1===t.length?t[0]:function(t,e){const s=new Uint8Array(e);let i=0;for(let e=0;e<t.length;e++){const r=t[e];s.set(r,i),i+=r.length}return s}(t,e),this.reset(),s):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var _i,wi={exports:{}},Pi=(_i||(_i=1,function(t){var e=Object.prototype.hasOwnProperty,s="~";function i(){}function r(t,e,s){this.fn=t,this.context=e,this.once=s||!1}function n(t,e,i,n,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new r(i,n||t,a),l=s?s+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0===--t._eventsCount?t._events=new i:delete t._events[e]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(s=!1)),o.prototype.eventNames=function(){var t,i,r=[];if(0===this._eventsCount)return r;for(i in t=this._events)e.call(t,i)&&r.push(s?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(t)):r},o.prototype.listeners=function(t){var e=s?s+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,a=new Array(n);r<n;r++)a[r]=i[r].fn;return a},o.prototype.listenerCount=function(t){var e=s?s+t:t,i=this._events[e];return i?i.fn?1:i.length:0},o.prototype.emit=function(t,e,i,r,n,a){var o=s?s+t:t;if(!this._events[o])return!1;var l,h,d=this._events[o],c=arguments.length;if(d.fn){switch(d.once&&this.removeListener(t,d.fn,void 0,!0),c){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,e),!0;case 3:return d.fn.call(d.context,e,i),!0;case 4:return d.fn.call(d.context,e,i,r),!0;case 5:return d.fn.call(d.context,e,i,r,n),!0;case 6:return d.fn.call(d.context,e,i,r,n,a),!0}for(h=1,l=new Array(c-1);h<c;h++)l[h-1]=arguments[h];d.fn.apply(d.context,l)}else{var u,f=d.length;for(h=0;h<f;h++)switch(d[h].once&&this.removeListener(t,d[h].fn,void 0,!0),c){case 1:d[h].fn.call(d[h].context);break;case 2:d[h].fn.call(d[h].context,e);break;case 3:d[h].fn.call(d[h].context,e,i);break;case 4:d[h].fn.call(d[h].context,e,i,r);break;default:if(!l)for(u=1,l=new Array(c-1);u<c;u++)l[u-1]=arguments[u];d[h].fn.apply(d[h].context,l)}}return!0},o.prototype.on=function(t,e,s){return n(this,t,e,s,!1)},o.prototype.once=function(t,e,s){return n(this,t,e,s,!0)},o.prototype.removeListener=function(t,e,i,r){var n=s?s+t:t;if(!this._events[n])return this;if(!e)return a(this,n),this;var o=this._events[n];if(o.fn)o.fn!==e||r&&!o.once||i&&o.context!==i||a(this,n);else{for(var l=0,h=[],d=o.length;l<d;l++)(o[l].fn!==e||r&&!o[l].once||i&&o[l].context!==i)&&h.push(o[l]);h.length?this._events[n]=1===h.length?h[0]:h:a(this,n)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=s?s+t:t,this._events[e]&&a(this,e)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=s,o.EventEmitter=o,t.exports=o}(wi)),wi.exports),xi=H(Pi);const Oi="1.6.15",Ni={};function Fi(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function Ui(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function Bi(t,e){let s=0;return s=(127&t[e])<<21,s|=(127&t[e+1])<<14,s|=(127&t[e+2])<<7,s|=127&t[e+3],s}function $i(t,e){const s=e;let i=0;for(;Ui(t,e);)i+=10,i+=Bi(t,e+6),Fi(t,e+10)&&(i+=10),e+=i;if(i>0)return t.subarray(s,s+i)}function ji(t,e){return 255===t[e]&&240==(246&t[e+1])}function Gi(t,e){return 1&t[e+1]?7:9}function Ki(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function Vi(t,e){return e+1<t.length&&ji(t,e)}function Hi(t,e){if(Vi(t,e)){const s=Gi(t,e);if(e+s>=t.length)return!1;const i=Ki(t,e);if(i<=s)return!1;const r=e+i;return r===t.length||Vi(t,r)}return!1}function Yi(t,e,s,i,r){if(!t.samplerate){const n=function(t,e,s,i){const r=e[s+2],n=r>>2&15;if(n>12){const e=new Error(`invalid ADTS sampling index:${n}`);return void t.emit(E.ERROR,E.ERROR,{type:v.MEDIA_ERROR,details:y.FRAG_PARSING_ERROR,fatal:!0,error:e,reason:e.message})}const a=1+(r>>6&3),o=e[s+3]>>6&3|(1&r)<<2,l="mp4a.40."+a,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][n];let d=n;5!==a&&29!==a||(d-=3);const c=[a<<3|(14&d)>>1,(1&d)<<7|o<<3];return B.log(`manifest codec:${i}, parsed codec:${l}, channels:${o}, rate:${h} (ADTS object type:${a} sampling index:${n})`),{config:c,samplerate:h,channelCount:o,codec:l,parsedCodec:l,manifestCodec:i}}(e,s,i,r);if(!n)return;M(t,n)}}function zi(t){return 9216e4/t}function Wi(t,e,s,i,r){const n=i+r*zi(t.samplerate),a=function(t,e){const s=Gi(t,e);if(e+s<=t.length){const i=Ki(t,e)-s;if(i>0)return{headerLength:s,frameLength:i}}}(e,s);let o;if(a){const{frameLength:i,headerLength:r}=a,l=r+i,h=Math.max(0,s+l-e.length);h?(o=new Uint8Array(l-r),o.set(e.subarray(s+r,e.length),0)):o=e.subarray(s+r,s+l);const d={unit:o,pts:n};return h||t.samples.push(d),{sample:d,length:l,missing:h}}const l=e.length-s;return o=new Uint8Array(l),o.set(e.subarray(s,e.length),0),{sample:{unit:o,pts:n},length:l,missing:-1}}function qi(t,e){return Ui(t,e)&&Bi(t,e+6)+10<=t.length-e}function Qi(t,e=0,s=1/0){return function(t,e,s,i){const r=(n=t)instanceof ArrayBuffer?n:n.buffer;var n;let a=1;"BYTES_PER_ELEMENT"in i&&(a=i.BYTES_PER_ELEMENT);const o=(c=t)&&c.buffer instanceof ArrayBuffer&&void 0!==c.byteLength&&void 0!==c.byteOffset?t.byteOffset:0,l=(o+t.byteLength)/a,h=(o+e)/a,d=Math.floor(Math.max(0,Math.min(h,l)));var c;return new i(r,d,Math.floor(Math.min(d+Math.max(s,0),l))-d)}(t,e,s,Uint8Array)}function Xi(t){return"PRIV"===t.type?function(t){if(t.size<2)return;const e=G(t.data,!0),s=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:s.buffer}}(t):"W"===t.type[0]?function(t){if("WXXX"===t.type){if(t.size<2)return;let e=1;const s=G(t.data.subarray(e),!0);e+=s.length+1;const i=G(t.data.subarray(e));return{key:t.type,info:s,data:i}}const e=G(t.data);return{key:t.type,info:"",data:e}}(t):"APIC"===t.type?function(t){const e={key:t.type,description:"",data:"",mimeType:null,pictureType:null};if(t.size<2)return;if(3!==t.data[0])return void console.log("Ignore frame with unrecognized character encoding");const s=t.data.subarray(1).indexOf(0);if(-1===s)return;const i=G(Qi(t.data,1,s)),r=t.data[2+s],n=t.data.subarray(3+s).indexOf(0);if(-1===n)return;const a=G(Qi(t.data,3+s,n));let o;return o="--\x3e"===i?G(Qi(t.data,4+s+n)):(l=t.data.subarray(4+s+n))instanceof ArrayBuffer?l:0==l.byteOffset&&l.byteLength==l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer,e.mimeType=i,e.pictureType=r,e.description=a,e.data=o,e;var l}(t):function(t){if(t.size<2)return;if("TXXX"===t.type){let e=1;const s=G(t.data.subarray(e),!0);e+=s.length+1;const i=G(t.data.subarray(e));return{key:t.type,info:s,data:i}}const e=G(t.data.subarray(1));return{key:t.type,info:"",data:e}}(t)}function Zi(t){const e=String.fromCharCode(t[0],t[1],t[2],t[3]),s=Bi(t,4);return{type:e,size:s,data:t.subarray(10,10+s)}}function Ji(t){let e=0;const s=[];for(;Ui(t,e);){const i=Bi(t,e+6);t[e+5]>>6&1&&(e+=10),e+=10;const r=e+i;for(;e+10<r;){const i=Zi(t.subarray(e)),r=Xi(i);r&&s.push(r),e+=i.size+10}Fi(t,e)&&(e+=10)}return s}function tr(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info}function er(t){if(8===t.data.byteLength){const e=new Uint8Array(t.data),s=1&e[3];let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,s&&(i+=47721858.84),Math.round(i)}}function sr(t){const e=Ji(t);for(let t=0;t<e.length;t++){const s=e[t];if(tr(s))return er(s)}}let ir=function(t){return t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3",t.misbklv="urn:misb:KLV:bin:1910.1",t}({});function rr(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class nr{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(t,e,s,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(t){this.initPTS=t,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(t,e){return!1}appendFrame(t,e,s){}demux(t,e){this.cachedData&&(t=kt(this.cachedData,t),this.cachedData=null);let s,i=$i(t,0),r=i?i.length:0;const n=this._audioTrack,a=this._id3Track,o=i?sr(i):void 0,l=t.length;for((null===this.basePTS||0===this.frameIndex&&g(o))&&(this.basePTS=ar(o,e,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),i&&i.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ir.audioId3,duration:Number.POSITIVE_INFINITY});r<l;){if(this.canParse(t,r)){const e=this.appendFrame(n,t,r);e?(this.frameIndex++,this.lastPTS=e.sample.pts,r+=e.length,s=r):r=l}else qi(t,r)?(i=$i(t,r),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:ir.audioId3,duration:Number.POSITIVE_INFINITY}),r+=i.length,s=r):r++;if(r===l&&s!==l){const e=t.slice(s);this.cachedData?this.cachedData=kt(this.cachedData,e):this.cachedData=e}}return{audioTrack:n,videoTrack:rr(),id3Track:a,textTrack:rr()}}demuxSampleAes(t,e,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(t){const e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),{audioTrack:this._audioTrack,videoTrack:rr(),id3Track:this._id3Track,textTrack:rr()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const ar=(t,e,s)=>g(t)?90*t:9e4*e+(s?9e4*s.baseTime/s.timescale:0);let or=null;const lr=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],hr=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],dr=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],cr=[0,1,1,4];function ur(t,e,s,i,r){if(s+24>e.length)return;const n=fr(e,s);if(n&&s+n.frameLength<=e.length){const a=i+r*(9e4*n.samplesPerFrame/n.sampleRate),o={unit:e.subarray(s,s+n.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=n.channelCount,t.samplerate=n.sampleRate,t.samples.push(o),{sample:o,length:n.frameLength,missing:0}}}function fr(t,e){const s=t[e+1]>>3&3,i=t[e+1]>>1&3,r=t[e+2]>>4&15,n=t[e+2]>>2&3;if(1!==s&&0!==r&&15!==r&&3!==n){const a=t[e+2]>>1&1,o=t[e+3]>>6,l=1e3*lr[14*(3===s?3-i:3===i?3:4)+r-1],h=hr[3*(3===s?0:2===s?1:2)+n],d=3===o?1:2,c=dr[s][i],u=cr[i],f=8*c*u,g=Math.floor(c*l/h+a)*u;if(null===or){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);or=t?parseInt(t[1]):0}return!!or&&or<=87&&2===i&&l>=224e3&&0===o&&(t[e+3]=128|t[e+3]),{sampleRate:h,channelCount:d,frameLength:g,samplesPerFrame:f}}}function gr(t,e){return!(255!==t[e]||224&~t[e+1]||!(6&t[e+1]))}function mr(t,e){return e+1<t.length&&gr(t,e)}function pr(t,e){if(e+1<t.length&&gr(t,e)){const s=4,i=fr(t,e);let r=s;null!=i&&i.frameLength&&(r=i.frameLength);const n=e+r;return n===t.length||mr(t,n)}return!1}const vr=(t,e)=>{let s=0,i=5;e+=i;const r=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;i>0;){a[0]=t[e];const o=Math.min(i,8),l=8-o;n[0]=4278190080>>>24+l<<l,r[0]=(a[0]&n[0])>>l,s=s?s<<o|r[0]:r[0],e+=1,i-=o}return s};function yr(t,e,s,i,r){if(s+8>e.length)return-1;if(11!==e[s]||119!==e[s+1])return-1;const n=e[s+4]>>6;if(n>=3)return-1;const a=[48e3,44100,32e3][n],o=63&e[s+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+n];if(s+l>e.length)return-1;const h=e[s+6]>>5;let d=0;2===h?d+=2:(1&h&&1!==h&&(d+=2),4&h&&(d+=2));const c=(e[s+6]<<8|e[s+7])>>12-d&1,u=[2,1,2,3,3,4,4,5][h]+c,f=e[s+5]>>3,g=7&e[s+5],m=new Uint8Array([n<<6|f<<1|g>>2,(3&g)<<6|h<<3|c<<2|o>>4,o<<4&224]),p=i+r*(1536/a*9e4),v=e.subarray(s,s+l);return t.config=m,t.channelCount=u,t.samplerate=a,t.samples.push({unit:v,pts:p}),l}const Er=/\/emsg[-/]ID3/i;function Tr(t,e){return g(t.presentationTime)?t.presentationTime/t.timeScale:e+t.presentationTimeDelta/t.timeScale}class Sr{constructor(t,e,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new Ke(e,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,0)}decryptAacSample(t,e,s){const i=t[e].unit;if(i.length<=16)return;const r=i.subarray(16,i.length-i.length%16),n=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(n).then(r=>{const n=new Uint8Array(r);i.set(n,16),this.decrypter.isSync()||this.decryptAacSamples(t,e+1,s)}).catch(s)}decryptAacSamples(t,e,s){for(;;e++){if(e>=t.length)return void s();if(!(t[e].unit.length<32||(this.decryptAacSample(t,e,s),this.decrypter.isSync())))return}}getAvcEncryptedData(t){const e=16*Math.floor((t.length-48)/160)+16,s=new Int8Array(e);let i=0;for(let e=32;e<t.length-16;e+=160,i+=16)s.set(t.subarray(e,e+16),i);return s}getAvcDecryptedUnit(t,e){const s=new Uint8Array(e);let i=0;for(let e=32;e<t.length-16;e+=160,i+=16)t.set(s.subarray(i,i+16),e);return t}decryptAvcSample(t,e,s,i,r){const n=wt(r.data),a=this.getAvcEncryptedData(n);this.decryptBuffer(a.buffer).then(a=>{r.data=this.getAvcDecryptedUnit(n,a),this.decrypter.isSync()||this.decryptAvcSamples(t,e,s+1,i)}).catch(i)}decryptAvcSamples(t,e,s,i){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,s=0){if(e>=t.length)return void i();const r=t[e].units;for(;!(s>=r.length);s++){const n=r[s];if(!(n.data.length<=48||1!==n.type&&5!==n.type||(this.decryptAvcSample(t,e,s,i,n),this.decrypter.isSync())))return}}}}class Lr{constructor(){this.VideoSample=null}createVideoSample(t,e,s){return{key:t,frame:!1,pts:e,dts:s,units:[],length:0}}getLastNalUnit(t){var e;let s,i=this.VideoSample;if(i&&0!==i.units.length||(i=t[t.length-1]),null!=(e=i)&&e.units){const t=i.units;s=t[t.length-1]}return s}pushAccessUnit(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){const s=e.samples,i=s.length;if(!i)return void e.dropped++;{const e=s[i-1];t.pts=e.pts,t.dts=e.dts}}e.samples.push(t)}}parseNALu(t,e,s){const i=e.byteLength;let r=t.naluState||0;const n=r,a=[];let o,l,h,d=0,c=-1,u=0;for(-1===r&&(c=0,u=this.getNALuType(e,0),r=0,d=1);d<i;)if(o=e[d++],r)if(1!==r)if(o)if(1===o){if(l=d-r-1,c>=0){const t={data:e.subarray(c,l),type:u};a.push(t)}else{const s=this.getLastNalUnit(t.samples);s&&(n&&d<=4-n&&s.state&&(s.data=s.data.subarray(0,s.data.byteLength-n)),l>0&&(s.data=kt(s.data,e.subarray(0,l)),s.state=0))}d<i?(h=this.getNALuType(e,d),c=d,u=h,r=0):r=-1}else r=0;else r=3;else r=o?0:2;else r=o?0:1;if(c>=0&&r>=0){const t={data:e.subarray(c,i),type:u,state:r};a.push(t)}if(0===a.length){const s=this.getLastNalUnit(t.samples);s&&(s.data=kt(s.data,e))}return t.naluState=r,a}}class Ar{constructor(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const t=this.data,e=this.bytesAvailable,s=t.byteLength-e,i=new Uint8Array(4),r=Math.min(4,e);if(0===r)throw new Error("no bytes available");i.set(t.subarray(s,s+r)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(t){let e;t=Math.min(t,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(e=(t-=this.bitsAvailable)>>3,t-=e<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let e=Math.min(this.bitsAvailable,t);const s=this.word>>>32-e;if(t>32&&B.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0)this.word<<=e;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return e=t-e,e>0&&this.bitsAvailable?s<<e|this.readBits(e):s}skipLZ(){let t;for(t=0;t<this.bitsAvailable;++t)if(this.word&2147483648>>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Ir extends Lr{parsePES(t,e,s,i){const r=this.parseNALu(t,s.data,i);let n,a=this.VideoSample,o=!1;s.data=null,a&&r.length&&!t.audFound&&(this.pushAccessUnit(a,t),a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),r.forEach(i=>{var r,l;switch(i.type){case 1:{let e=!1;n=!0;const r=i.data;if(o&&r.length>4){const t=this.readSliceType(r);2!==t&&4!==t&&7!==t&&9!==t||(e=!0)}var h;e&&null!=(h=a)&&h.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.frame=!0,a.key=e;break}case 5:n=!0,null!=(r=a)&&r.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 6:n=!0,_t(i.data,1,s.pts,e.samples);break;case 7:{var d,c;n=!0,o=!0;const e=i.data,s=this.readSPS(e);if(!t.sps||t.width!==s.width||t.height!==s.height||(null==(d=t.pixelRatio)?void 0:d[0])!==s.pixelRatio[0]||(null==(c=t.pixelRatio)?void 0:c[1])!==s.pixelRatio[1]){t.width=s.width,t.height=s.height,t.pixelRatio=s.pixelRatio,t.sps=[e];const i=e.subarray(1,4);let r="avc1.";for(let t=0;t<3;t++){let e=i[t].toString(16);e.length<2&&(e="0"+e),r+=e}t.codec=r}break}case 8:n=!0,t.pps=[i.data];break;case 9:n=!0,t.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,t),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:n=!0;break;default:n=!1}a&&n&&a.units.push(i)}),i&&a&&(this.pushAccessUnit(a,t),this.VideoSample=null)}getNALuType(t,e){return 31&t[e]}readSliceType(t){const e=new Ar(t);return e.readUByte(),e.readUEG(),e.readUEG()}skipScalingList(t,e){let s,i=8,r=8;for(let n=0;n<t;n++)0!==r&&(s=e.readEG(),r=(i+s+256)%256),i=0===r?i:r}readSPS(t){const e=new Ar(t);let s,i,r,n=0,a=0,o=0,l=0;const h=e.readUByte.bind(e),d=e.readBits.bind(e),c=e.readUEG.bind(e),u=e.readBoolean.bind(e),f=e.skipBits.bind(e),g=e.skipEG.bind(e),m=e.skipUEG.bind(e),p=this.skipScalingList.bind(this);h();const v=h();if(d(5),f(3),h(),m(),100===v||110===v||122===v||244===v||44===v||83===v||86===v||118===v||128===v){const t=c();if(3===t&&f(1),m(),m(),f(1),u())for(i=3!==t?8:12,r=0;r<i;r++)u()&&p(r<6?16:64,e)}m();const y=c();if(0===y)c();else if(1===y)for(f(1),g(),g(),s=c(),r=0;r<s;r++)g();m(),f(1);const E=c(),T=c(),S=d(1);0===S&&f(1),f(1),u()&&(n=c(),a=c(),o=c(),l=c());let L=[1,1];if(u()&&u())switch(h()){case 1:L=[1,1];break;case 2:L=[12,11];break;case 3:L=[10,11];break;case 4:L=[16,11];break;case 5:L=[40,33];break;case 6:L=[24,11];break;case 7:L=[20,11];break;case 8:L=[32,11];break;case 9:L=[80,33];break;case 10:L=[18,11];break;case 11:L=[15,11];break;case 12:L=[64,33];break;case 13:L=[160,99];break;case 14:L=[4,3];break;case 15:L=[3,2];break;case 16:L=[2,1];break;case 255:L=[h()<<8|h(),h()<<8|h()]}return{width:Math.ceil(16*(E+1)-2*n-2*a),height:(2-S)*(T+1)*16-(S?2:4)*(o+l),pixelRatio:L}}}class br extends Lr{constructor(...t){super(...t),this.initVPS=null}parsePES(t,e,s,i){const r=this.parseNALu(t,s.data,i);let n,a=this.VideoSample,o=!1;s.data=null,a&&r.length&&!t.audFound&&(this.pushAccessUnit(a,t),a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),r.forEach(i=>{var r,l;switch(i.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),a.frame=!0,n=!0;break;case 16:case 17:case 18:case 21:var h;n=!0,o&&null!=(h=a)&&h.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 19:case 20:n=!0,null!=(r=a)&&r.frame&&!a.key&&(this.pushAccessUnit(a,t),a=this.VideoSample=null),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0,a.frame=!0;break;case 39:n=!0,_t(i.data,2,s.pts,e.samples);break;case 32:n=!0,t.vps||("object"!=typeof t.params&&(t.params={}),t.params=M(t.params,this.readVPS(i.data)),this.initVPS=i.data),t.vps=[i.data];break;case 33:if(n=!0,o=!0,void 0===t.vps||t.vps[0]===this.initVPS||void 0===t.sps||this.matchSPS(t.sps[0],i.data)||(this.initVPS=t.vps[0],t.sps=t.pps=void 0),!t.sps){const e=this.readSPS(i.data);t.width=e.width,t.height=e.height,t.pixelRatio=e.pixelRatio,t.codec=e.codecString,t.sps=[],"object"!=typeof t.params&&(t.params={});for(const s in e.params)t.params[s]=e.params[s]}this.pushParameterSet(t.sps,i.data,t.vps),a||(a=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),a.key=!0;break;case 34:if(n=!0,"object"==typeof t.params){if(!t.pps){t.pps=[];const e=this.readPPS(i.data);for(const s in e)t.params[s]=e[s]}this.pushParameterSet(t.pps,i.data,t.vps)}break;case 35:n=!0,t.audFound=!0,null!=(l=a)&&l.frame&&(this.pushAccessUnit(a,t),a=null),a||(a=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:n=!1}a&&n&&a.units.push(i)}),i&&a&&(this.pushAccessUnit(a,t),this.VideoSample=null)}pushParameterSet(t,e,s){(s&&s[0]===this.initVPS||!s&&!t.length)&&t.push(e)}getNALuType(t,e){return(126&t[e])>>>1}ebsp2rbsp(t){const e=new Uint8Array(t.byteLength);let s=0;for(let i=0;i<t.byteLength;i++)i>=2&&3===t[i]&&0===t[i-1]&&0===t[i-2]||(e[s]=t[i],s++);return new Uint8Array(e.buffer,0,s)}pushAccessUnit(t,e){super.pushAccessUnit(t,e),this.initVPS&&(this.initVPS=null)}readVPS(t){const e=new Ar(t);return e.readUByte(),e.readUByte(),e.readBits(4),e.skipBits(2),e.readBits(6),{numTemporalLayers:e.readBits(3)+1,temporalIdNested:e.readBoolean()}}readSPS(t){const e=new Ar(this.ebsp2rbsp(t));e.readUByte(),e.readUByte(),e.readBits(4);const s=e.readBits(3);e.readBoolean();const i=e.readBits(2),r=e.readBoolean(),n=e.readBits(5),a=e.readUByte(),o=e.readUByte(),l=e.readUByte(),h=e.readUByte(),d=e.readUByte(),c=e.readUByte(),u=e.readUByte(),f=e.readUByte(),g=e.readUByte(),m=e.readUByte(),p=e.readUByte(),v=[],y=[];for(let t=0;t<s;t++)v.push(e.readBoolean()),y.push(e.readBoolean());if(s>0)for(let t=s;t<8;t++)e.readBits(2);for(let t=0;t<s;t++)v[t]&&(e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte(),e.readUByte()),y[t]&&e.readUByte();e.readUEG();const E=e.readUEG();3==E&&e.skipBits(1);const T=e.readUEG(),S=e.readUEG(),L=e.readBoolean();let A=0,I=0,b=0,R=0;L&&(A+=e.readUEG(),I+=e.readUEG(),b+=e.readUEG(),R+=e.readUEG());const k=e.readUEG(),D=e.readUEG(),C=e.readUEG();for(let t=e.readBoolean()?0:s;t<=s;t++)e.skipUEG(),e.skipUEG(),e.skipUEG();if(e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG(),e.readBoolean()&&e.readBoolean())for(let t=0;t<4;t++)for(let s=0;s<(3===t?2:6);s++)if(e.readBoolean()){const s=Math.min(64,1<<4+(t<<1));t>1&&e.readEG();for(let t=0;t<s;t++)e.readEG()}else e.readUEG();e.readBoolean(),e.readBoolean(),e.readBoolean()&&(e.readUByte(),e.skipUEG(),e.skipUEG(),e.readBoolean());const M=e.readUEG();let _=0;for(let t=0;t<M;t++){let s=!1;if(0!==t&&(s=e.readBoolean()),s){t===M&&e.readUEG(),e.readBoolean(),e.readUEG();let s=0;for(let t=0;t<=_;t++){const t=e.readBoolean();let i=!1;t||(i=e.readBoolean()),(t||i)&&s++}_=s}else{const t=e.readUEG(),s=e.readUEG();_=t+s;for(let s=0;s<t;s++)e.readUEG(),e.readBoolean();for(let t=0;t<s;t++)e.readUEG(),e.readBoolean()}}if(e.readBoolean()){const t=e.readUEG();for(let s=0;s<t;s++){for(let t=0;t<C+4;t++)e.readBits(1);e.readBits(1)}}let w=0,P=1,x=1,O=!0,N=1,F=0;e.readBoolean(),e.readBoolean();let U=!1;if(e.readBoolean()){if(e.readBoolean()){const t=e.readUByte();t>0&&t<16?(P=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][t-1],x=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][t-1]):255===t&&(P=e.readBits(16),x=e.readBits(16))}if(e.readBoolean()&&e.readBoolean(),e.readBoolean()&&(e.readBits(3),e.readBoolean(),e.readBoolean()&&(e.readUByte(),e.readUByte(),e.readUByte())),e.readBoolean()&&(e.readUEG(),e.readUEG()),e.readBoolean(),e.readBoolean(),e.readBoolean(),U=e.readBoolean(),U&&(e.skipUEG(),e.skipUEG(),e.skipUEG(),e.skipUEG()),e.readBoolean()&&(N=e.readBits(32),F=e.readBits(32),e.readBoolean()&&e.readUEG(),e.readBoolean())){const t=e.readBoolean(),i=e.readBoolean();let r=!1;(t||i)&&(r=e.readBoolean(),r&&(e.readUByte(),e.readBits(5),e.readBoolean(),e.readBits(5)),e.readBits(4),e.readBits(4),r&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5));for(let n=0;n<=s;n++){O=e.readBoolean();let s=!1;O||e.readBoolean()?e.readEG():s=e.readBoolean();const n=s?1:e.readUEG()+1;if(t)for(let t=0;t<n;t++)e.readUEG(),e.readUEG(),r&&(e.readUEG(),e.readUEG()),e.skipBits(1);if(i)for(let t=0;t<n;t++)e.readUEG(),e.readUEG(),r&&(e.readUEG(),e.readUEG()),e.skipBits(1)}}e.readBoolean()&&(e.readBoolean(),e.readBoolean(),e.readBoolean(),w=e.readUEG())}let B=T,$=S;if(L){let t=1,e=1;1===E?t=e=2:2==E&&(t=2),B=T-t*I-t*A,$=S-e*R-e*b}const j=i?["A","B","C"][i]:"",G=a<<24|o<<16|l<<8|h;let K=0;for(let t=0;t<32;t++)K=(K|(G>>t&1)<<31-t)>>>0;let V=K.toString(16);return 1===n&&"2"===V&&(V="6"),{codecString:`hvc1.${j}${n}.${V}.${r?"H":"L"}${p}.B0`,params:{general_tier_flag:r,general_profile_idc:n,general_profile_space:i,general_profile_compatibility_flags:[a,o,l,h],general_constraint_indicator_flags:[d,c,u,f,g,m],general_level_idc:p,bit_depth:k+8,bit_depth_luma_minus8:k,bit_depth_chroma_minus8:D,min_spatial_segmentation_idc:w,chroma_format_idc:E,frame_rate:{fixed:O,fps:F/N}},width:B,height:$,pixelRatio:[P,x]}}readPPS(t){const e=new Ar(this.ebsp2rbsp(t));e.readUByte(),e.readUByte(),e.skipUEG(),e.skipUEG(),e.skipBits(2),e.skipBits(3),e.skipBits(2),e.skipUEG(),e.skipUEG(),e.skipEG(),e.skipBits(2),e.readBoolean()&&e.skipUEG(),e.skipEG(),e.skipEG(),e.skipBits(4);const s=e.readBoolean(),i=e.readBoolean();let r=1;return i&&s?r=0:i?r=3:s&&(r=2),{parallelismType:r}}matchSPS(t,e){return String.fromCharCode.apply(null,t).substr(3)===String.fromCharCode.apply(null,e).substr(3)}}const Rr=188;class kr{constructor(t,e,s,i){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=e,this.typeSupported=s,this.logger=i,this.videoParser=null}static probe(t,e){const s=kr.syncOffset(t);return s>0&&e.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),-1!==s}static syncOffset(t){const e=t.length;let s=Math.min(940,e-Rr)+1,i=0;for(;i<s;){let r=!1,n=-1,a=0;for(let o=i;o<e;o+=Rr){if(71!==t[o]||e-o!==Rr&&71!==t[o+Rr]){if(a)return-1;break}if(a++,-1===n&&(n=o,0!==n&&(s=Math.min(n+18612,t.length-Rr)+1)),r||(r=0===Dr(t,o)),r&&a>1&&(0===n&&a>2||o+Rr>s))return n}i++}return-1}static createTrack(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:ct[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,sa |