You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
726 KiB
69 lines
726 KiB
!(function(){var Za=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[4928],{19362:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return de}});var C=A(5891),O=A(59301),le={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"ellipsis",theme:"outlined"},fe=le,V=A(88853),$=function(Q,ke){return O.createElement(V.Z,(0,C.Z)({},Q,{ref:ke,icon:fe}))},ye=O.forwardRef($),de=ye},16537:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return de}});var C=A(5891),O=A(59301),le={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"}}]},name:"left",theme:"outlined"},fe=le,V=A(88853),$=function(Q,ke){return O.createElement(V.Z,(0,C.Z)({},Q,{ref:ke,icon:fe}))},ye=O.forwardRef($),de=ye},53878:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return de}});var C=A(5891),O=A(59301),le={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},fe=le,V=A(88853),$=function(Q,ke){return O.createElement(V.Z,(0,C.Z)({},Q,{ref:ke,icon:fe}))},ye=O.forwardRef($),de=ye},35593:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return jt}});var C=A(57259),O=A(29043),le=A(19149),fe=A(43403),V=A(92310),$=A.n(V),ye=A(29301),de=A(85899),ae=A(70653),Q=A(8107),ke=A(49879),ve=A(28800),f=A(93144),N=A(59301),K=A(5891),_e=A(43469),Re=A(20475);function H(R){var P=R.prefixCls,x=R.align,L=R.arrow,F=R.arrowPos,ne=L||{},I=ne.className,G=ne.content,W=F.x,w=W===void 0?0:W,se=F.y,Te=se===void 0?0:se,We=N.useRef();if(!x||!x.points)return null;var Qe={position:"absolute"};if(x.autoArrow!==!1){var dt=x.points[0],Ze=x.points[1],ct=dt[0],tt=dt[1],bt=Ze[0],wt=Ze[1];ct===bt||!["t","b"].includes(ct)?Qe.top=Te:ct==="t"?Qe.top=0:Qe.bottom=0,tt===wt||!["l","r"].includes(tt)?Qe.left=w:tt==="l"?Qe.left=0:Qe.right=0}return N.createElement("div",{ref:We,className:$()("".concat(P,"-arrow"),I),style:Qe},G)}function D(R){var P=R.prefixCls,x=R.open,L=R.zIndex,F=R.mask,ne=R.motion;return F?N.createElement(_e.default,(0,K.Z)({},ne,{motionAppear:!0,visible:x,removeOnLeave:!0}),function(I){var G=I.className;return N.createElement("div",{style:{zIndex:L},className:$()("".concat(P,"-mask"),G)})}):null}var B=N.memo(function(R){var P=R.children;return P},function(R,P){return P.cache}),z=B,b=N.forwardRef(function(R,P){var x=R.popup,L=R.className,F=R.prefixCls,ne=R.style,I=R.target,G=R.onVisibleChanged,W=R.open,w=R.keepDom,se=R.fresh,Te=R.onClick,We=R.mask,Qe=R.arrow,dt=R.arrowPos,Ze=R.align,ct=R.motion,tt=R.maskMotion,bt=R.forceRender,wt=R.getPopupContainer,ce=R.autoDestroy,Yt=R.portal,Ct=R.zIndex,ai=R.onMouseEnter,je=R.onMouseLeave,vi=R.onPointerEnter,ci=R.ready,gi=R.offsetX,ui=R.offsetY,ft=R.offsetR,Qt=R.offsetB,st=R.onAlign,At=R.onPrepare,Xt=R.stretch,It=R.targetWidth,ii=R.targetHeight,si=typeof x=="function"?x():x,hi=W||w,Ei=(wt==null?void 0:wt.length)>0,ni=N.useState(!wt||!Ei),fi=(0,O.Z)(ni,2),tn=fi[0],Be=fi[1];if((0,ve.Z)(function(){!tn&&Ei&&I&&Be(!0)},[tn,Ei,I]),!tn)return null;var l="auto",d={left:"-1000vw",top:"-1000vh",right:l,bottom:l};if(ci||!W){var g,v=Ze.points,S=Ze.dynamicInset||((g=Ze._experimental)===null||g===void 0?void 0:g.dynamicInset),U=S&&v[0][1]==="r",q=S&&v[0][0]==="b";U?(d.right=ft,d.left=l):(d.left=gi,d.right=l),q?(d.bottom=Qt,d.top=l):(d.top=ui,d.bottom=l)}var Ye={};return Xt&&(Xt.includes("height")&&ii?Ye.height=ii:Xt.includes("minHeight")&&ii&&(Ye.minHeight=ii),Xt.includes("width")&&It?Ye.width=It:Xt.includes("minWidth")&&It&&(Ye.minWidth=It)),W||(Ye.pointerEvents="none"),N.createElement(Yt,{open:bt||hi,getContainer:wt&&function(){return wt(I)},autoDestroy:ce},N.createElement(D,{prefixCls:F,open:W,zIndex:Ct,mask:We,motion:tt}),N.createElement(ye.Z,{onResize:st,disabled:!W},function($e){return N.createElement(_e.default,(0,K.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:bt,leavedClassName:"".concat(F,"-hidden")},ct,{onAppearPrepare:At,onEnterPrepare:At,visible:W,onVisibleChanged:function(Pt){var Dt;ct==null||(Dt=ct.onVisibleChanged)===null||Dt===void 0||Dt.call(ct,Pt),G(Pt)}}),function(lt,Pt){var Dt=lt.className,Oe=lt.style,Ft=$()(F,Dt,L);return N.createElement("div",{ref:(0,Re.sQ)($e,P,Pt),className:Ft,style:(0,C.Z)((0,C.Z)((0,C.Z)((0,C.Z)({"--arrow-x":"".concat(dt.x||0,"px"),"--arrow-y":"".concat(dt.y||0,"px")},d),Ye),Oe),{},{boxSizing:"border-box",zIndex:Ct},ne),onMouseEnter:ai,onMouseLeave:je,onPointerEnter:vi,onClick:Te},Qe&&N.createElement(H,{prefixCls:F,arrow:Qe,arrowPos:dt,align:Ze}),N.createElement(z,{cache:!W&&!se},si))})}))}),oe=b,he=N.forwardRef(function(R,P){var x=R.children,L=R.getTriggerDOMNode,F=(0,Re.Yr)(x),ne=N.useCallback(function(G){(0,Re.mH)(P,L?L(G):G)},[L]),I=(0,Re.x1)(ne,x.ref);return F?N.cloneElement(x,{ref:I}):x}),Y=he,Ne=N.createContext(null),Ke=Ne;function Xe(R){return R?Array.isArray(R)?R:[R]:[]}function Se(R,P,x,L){return N.useMemo(function(){var F=Xe(x!=null?x:P),ne=Xe(L!=null?L:P),I=new Set(F),G=new Set(ne);return R&&(I.has("hover")&&(I.delete("hover"),I.add("click")),G.has("hover")&&(G.delete("hover"),G.add("click"))),[I,G]},[R,P,x,L])}var j=A(48886);function X(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],x=arguments.length>2?arguments[2]:void 0;return x?R[0]===P[0]:R[0]===P[0]&&R[1]===P[1]}function J(R,P,x,L){for(var F=x.points,ne=Object.keys(R),I=0;I<ne.length;I+=1){var G,W=ne[I];if(X((G=R[W])===null||G===void 0?void 0:G.points,F,L))return"".concat(P,"-placement-").concat(W)}return""}function M(R,P,x,L){return P||(x?{motionName:"".concat(R,"-").concat(x)}:L?{motionName:L}:null)}function Ae(R){return R.ownerDocument.defaultView}function ze(R){for(var P=[],x=R==null?void 0:R.parentElement,L=["hidden","scroll","clip","auto"];x;){var F=Ae(x).getComputedStyle(x),ne=F.overflowX,I=F.overflowY,G=F.overflow;[ne,I,G].some(function(W){return L.includes(W)})&&P.push(x),x=x.parentElement}return P}function ge(R){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(R)?P:R}function Ee(R){return ge(parseFloat(R),0)}function rt(R,P){var x=(0,C.Z)({},R);return(P||[]).forEach(function(L){if(!(L instanceof HTMLBodyElement||L instanceof HTMLHtmlElement)){var F=Ae(L).getComputedStyle(L),ne=F.overflow,I=F.overflowClipMargin,G=F.borderTopWidth,W=F.borderBottomWidth,w=F.borderLeftWidth,se=F.borderRightWidth,Te=L.getBoundingClientRect(),We=L.offsetHeight,Qe=L.clientHeight,dt=L.offsetWidth,Ze=L.clientWidth,ct=Ee(G),tt=Ee(W),bt=Ee(w),wt=Ee(se),ce=ge(Math.round(Te.width/dt*1e3)/1e3),Yt=ge(Math.round(Te.height/We*1e3)/1e3),Ct=(dt-Ze-bt-wt)*ce,ai=(We-Qe-ct-tt)*Yt,je=ct*Yt,vi=tt*Yt,ci=bt*ce,gi=wt*ce,ui=0,ft=0;if(ne==="clip"){var Qt=Ee(I);ui=Qt*ce,ft=Qt*Yt}var st=Te.x+ci-ui,At=Te.y+je-ft,Xt=st+Te.width+2*ui-ci-gi-Ct,It=At+Te.height+2*ft-je-vi-ai;x.left=Math.max(x.left,st),x.top=Math.max(x.top,At),x.right=Math.min(x.right,Xt),x.bottom=Math.min(x.bottom,It)}}),x}function qe(R){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x="".concat(P),L=x.match(/^(.*)\%$/);return L?R*(parseFloat(L[1])/100):parseFloat(x)}function Fe(R,P){var x=P||[],L=(0,O.Z)(x,2),F=L[0],ne=L[1];return[qe(R.width,F),qe(R.height,ne)]}function He(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[R[0],R[1]]}function we(R,P){var x=P[0],L=P[1],F,ne;return x==="t"?ne=R.y:x==="b"?ne=R.y+R.height:ne=R.y+R.height/2,L==="l"?F=R.x:L==="r"?F=R.x+R.width:F=R.x+R.width/2,{x:F,y:ne}}function it(R,P){var x={t:"b",b:"t",l:"r",r:"l"};return R.map(function(L,F){return F===P?x[L]||"c":L}).join("")}function pt(R,P,x,L,F,ne,I){var G=N.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:F[L]||{}}),W=(0,O.Z)(G,2),w=W[0],se=W[1],Te=N.useRef(0),We=N.useMemo(function(){return P?ze(P):[]},[P]),Qe=N.useRef({}),dt=function(){Qe.current={}};R||dt();var Ze=(0,Q.Z)(function(){if(P&&x&&R){let Ji=function(Gi,cn){var pn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ft,Xi=si.x+Gi,rn=si.y+cn,zn=Xi+g,sr=rn+d,Nn=Math.max(Xi,pn.left),dr=Math.max(rn,pn.top),Wn=Math.min(zn,pn.right),Zn=Math.min(sr,pn.bottom);return Math.max(0,(Wn-Nn)*(Zn-dr))},Sn=function(){Ui=si.y+xt,Di=Ui+d,Bi=si.x+Gt,Zi=Bi+g};var bt,wt,ce=P,Yt=ce.ownerDocument,Ct=Ae(ce),ai=Ct.getComputedStyle(ce),je=ai.width,vi=ai.height,ci=ai.position,gi=ce.style.left,ui=ce.style.top,ft=ce.style.right,Qt=ce.style.bottom,st=ce.style.overflow,At=(0,C.Z)((0,C.Z)({},F[L]),ne),Xt=Yt.createElement("div");(bt=ce.parentElement)===null||bt===void 0||bt.appendChild(Xt),Xt.style.left="".concat(ce.offsetLeft,"px"),Xt.style.top="".concat(ce.offsetTop,"px"),Xt.style.position=ci,Xt.style.height="".concat(ce.offsetHeight,"px"),Xt.style.width="".concat(ce.offsetWidth,"px"),ce.style.left="0",ce.style.top="0",ce.style.right="auto",ce.style.bottom="auto",ce.style.overflow="hidden";var It;if(Array.isArray(x))It={x:x[0],y:x[1],width:0,height:0};else{var ii=x.getBoundingClientRect();It={x:ii.x,y:ii.y,width:ii.width,height:ii.height}}var si=ce.getBoundingClientRect(),hi=Yt.documentElement,Ei=hi.clientWidth,ni=hi.clientHeight,fi=hi.scrollWidth,tn=hi.scrollHeight,Be=hi.scrollTop,l=hi.scrollLeft,d=si.height,g=si.width,v=It.height,S=It.width,U={left:0,top:0,right:Ei,bottom:ni},q={left:-l,top:-Be,right:fi-l,bottom:tn-Be},Ye=At.htmlRegion,$e="visible",lt="visibleFirst";Ye!=="scroll"&&Ye!==lt&&(Ye=$e);var Pt=Ye===lt,Dt=rt(q,We),Oe=rt(U,We),Ft=Ye===$e?Oe:Dt,nt=Pt?Oe:Ft;ce.style.left="auto",ce.style.top="auto",ce.style.right="0",ce.style.bottom="0";var Ue=ce.getBoundingClientRect();ce.style.left=gi,ce.style.top=ui,ce.style.right=ft,ce.style.bottom=Qt,ce.style.overflow=st,(wt=ce.parentElement)===null||wt===void 0||wt.removeChild(Xt);var Ge=ge(Math.round(g/parseFloat(je)*1e3)/1e3),mt=ge(Math.round(d/parseFloat(vi)*1e3)/1e3);if(Ge===0||mt===0||(0,de.Sh)(x)&&!(0,j.Z)(x))return;var Rt=At.offset,Nt=At.targetOffset,wi=Fe(si,Rt),Ai=(0,O.Z)(wi,2),ut=Ai[0],at=Ai[1],Z=Fe(It,Nt),ee=(0,O.Z)(Z,2),me=ee[0],Ce=ee[1];It.x-=me,It.y-=Ce;var pe=At.points||[],Pe=(0,O.Z)(pe,2),Le=Pe[0],Tt=Pe[1],Ot=He(Tt),gt=He(Le),Vt=we(It,Ot),Mt=we(si,gt),Jt=(0,C.Z)({},At),Gt=Vt.x-Mt.x+ut,xt=Vt.y-Mt.y+at,Si=Ji(Gt,xt),ei=Ji(Gt,xt,Oe),Ci=we(It,["t","l"]),pi=we(si,["t","l"]),di=we(It,["b","r"]),oi=we(si,["b","r"]),li=At.overflow||{},bi=li.adjustX,$i=li.adjustY,_i=li.shiftX,Kt=li.shiftY,ot=function(cn){return typeof cn=="boolean"?cn:cn>=0},Ui,Di,Bi,Zi;Sn();var qi=ot($i),Yi=gt[0]===Ot[0];if(qi&>[0]==="t"&&(Di>nt.bottom||Qe.current.bt)){var Ni=xt;Yi?Ni-=d-v:Ni=Ci.y-oi.y-at;var Qi=Ji(Gt,Ni),fn=Ji(Gt,Ni,Oe);Qi>Si||Qi===Si&&(!Pt||fn>=ei)?(Qe.current.bt=!0,xt=Ni,at=-at,Jt.points=[it(gt,0),it(Ot,0)]):Qe.current.bt=!1}if(qi&>[0]==="b"&&(Ui<nt.top||Qe.current.tb)){var Ti=xt;Yi?Ti+=d-v:Ti=di.y-pi.y-at;var Ki=Ji(Gt,Ti),In=Ji(Gt,Ti,Oe);Ki>Si||Ki===Si&&(!Pt||In>=ei)?(Qe.current.tb=!0,xt=Ti,at=-at,Jt.points=[it(gt,0),it(Ot,0)]):Qe.current.tb=!1}var mn=ot(bi),Tn=gt[1]===Ot[1];if(mn&>[1]==="l"&&(Zi>nt.right||Qe.current.rl)){var nn=Gt;Tn?nn-=g-S:nn=Ci.x-oi.x-ut;var ji=Ji(nn,xt),on=Ji(nn,xt,Oe);ji>Si||ji===Si&&(!Pt||on>=ei)?(Qe.current.rl=!0,Gt=nn,ut=-ut,Jt.points=[it(gt,1),it(Ot,1)]):Qe.current.rl=!1}if(mn&>[1]==="r"&&(Bi<nt.left||Qe.current.lr)){var En=Gt;Tn?En+=g-S:En=di.x-pi.x-ut;var Rn=Ji(En,xt),ln=Ji(En,xt,Oe);Rn>Si||Rn===Si&&(!Pt||ln>=ei)?(Qe.current.lr=!0,Gt=En,ut=-ut,Jt.points=[it(gt,1),it(Ot,1)]):Qe.current.lr=!1}Sn();var Fi=_i===!0?0:_i;typeof Fi=="number"&&(Bi<Oe.left&&(Gt-=Bi-Oe.left-ut,It.x+S<Oe.left+Fi&&(Gt+=It.x-Oe.left+S-Fi)),Zi>Oe.right&&(Gt-=Zi-Oe.right-ut,It.x>Oe.right-Fi&&(Gt+=It.x-Oe.right+Fi)));var zi=Kt===!0?0:Kt;typeof zi=="number"&&(Ui<Oe.top&&(xt-=Ui-Oe.top-at,It.y+v<Oe.top+zi&&(xt+=It.y-Oe.top+v-zi)),Di>Oe.bottom&&(xt-=Di-Oe.bottom-at,It.y>Oe.bottom-zi&&(xt+=It.y-Oe.bottom+zi)));var gn=si.x+Gt,_n=gn+g,an=si.y+xt,An=an+d,un=It.x,Ln=un+S,On=It.y,Pn=On+v,jn=Math.max(gn,un),Hn=Math.min(_n,Ln),xn=(jn+Hn)/2,qn=xn-gn,Fn=Math.max(an,On),wn=Math.min(An,Pn),Qn=(Fn+wn)/2,Mn=Qn-an;I==null||I(P,Jt);var Dn=Ue.right-si.x-(Gt+si.width),Bn=Ue.bottom-si.y-(xt+si.height);se({ready:!0,offsetX:Gt/Ge,offsetY:xt/mt,offsetR:Dn/Ge,offsetB:Bn/mt,arrowX:qn/Ge,arrowY:Mn/mt,scaleX:Ge,scaleY:mt,align:Jt})}}),ct=function(){Te.current+=1;var wt=Te.current;Promise.resolve().then(function(){Te.current===wt&&Ze()})},tt=function(){se(function(wt){return(0,C.Z)((0,C.Z)({},wt),{},{ready:!1})})};return(0,ve.Z)(tt,[L]),(0,ve.Z)(function(){R||tt()},[R]),[w.ready,w.offsetX,w.offsetY,w.offsetR,w.offsetB,w.arrowX,w.arrowY,w.scaleX,w.scaleY,w.align,ct]}var Lt=A(26390);function Ut(R,P,x,L,F){(0,ve.Z)(function(){if(R&&P&&x){let Te=function(){L(),F()};var ne=P,I=x,G=ze(ne),W=ze(I),w=Ae(I),se=new Set([w].concat((0,Lt.Z)(G),(0,Lt.Z)(W)));return se.forEach(function(We){We.addEventListener("scroll",Te,{passive:!0})}),w.addEventListener("resize",Te,{passive:!0}),L(),function(){se.forEach(function(We){We.removeEventListener("scroll",Te),w.removeEventListener("resize",Te)})}}},[R,P,x])}var $t=A(51395),vt=A(23073);function Bt(R,P,x,L,F,ne,I,G){var W=N.useRef(R),w=N.useRef(!1);W.current!==R&&(w.current=!0,W.current=R),N.useEffect(function(){var se=(0,vt.Z)(function(){w.current=!1});return function(){vt.Z.cancel(se)}},[R]),N.useEffect(function(){if(P&&L&&(!F||ne)){var se=function(){var ci=!1,gi=function(Qt){var st=Qt.target;ci=I(st)},ui=function(Qt){var st=Qt.target;!w.current&&W.current&&!ci&&!I(st)&&G(!1)};return[gi,ui]},Te=se(),We=(0,O.Z)(Te,2),Qe=We[0],dt=We[1],Ze=se(),ct=(0,O.Z)(Ze,2),tt=ct[0],bt=ct[1],wt=Ae(L);wt.addEventListener("mousedown",Qe,!0),wt.addEventListener("click",dt,!0),wt.addEventListener("contextmenu",dt,!0);var ce=(0,ae.A)(x);if(ce&&(ce.addEventListener("mousedown",tt,!0),ce.addEventListener("click",bt,!0),ce.addEventListener("contextmenu",bt,!0)),0)var Yt,Ct,ai,je;return function(){wt.removeEventListener("mousedown",Qe,!0),wt.removeEventListener("click",dt,!0),wt.removeEventListener("contextmenu",dt,!0),ce&&(ce.removeEventListener("mousedown",tt,!0),ce.removeEventListener("click",bt,!0),ce.removeEventListener("contextmenu",bt,!0))}}},[P,x,L,F,ne])}var Ht=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function Zt(){var R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:fe.Z,P=N.forwardRef(function(x,L){var F=x.prefixCls,ne=F===void 0?"rc-trigger-popup":F,I=x.children,G=x.action,W=G===void 0?"hover":G,w=x.showAction,se=x.hideAction,Te=x.popupVisible,We=x.defaultPopupVisible,Qe=x.onPopupVisibleChange,dt=x.afterPopupVisibleChange,Ze=x.mouseEnterDelay,ct=x.mouseLeaveDelay,tt=ct===void 0?.1:ct,bt=x.focusDelay,wt=x.blurDelay,ce=x.mask,Yt=x.maskClosable,Ct=Yt===void 0?!0:Yt,ai=x.getPopupContainer,je=x.forceRender,vi=x.autoDestroy,ci=x.destroyPopupOnHide,gi=x.popup,ui=x.popupClassName,ft=x.popupStyle,Qt=x.popupPlacement,st=x.builtinPlacements,At=st===void 0?{}:st,Xt=x.popupAlign,It=x.zIndex,ii=x.stretch,si=x.getPopupClassNameFromAlign,hi=x.fresh,Ei=x.alignPoint,ni=x.onPopupClick,fi=x.onPopupAlign,tn=x.arrow,Be=x.popupMotion,l=x.maskMotion,d=x.popupTransitionName,g=x.popupAnimation,v=x.maskTransitionName,S=x.maskAnimation,U=x.className,q=x.getTriggerDOMNode,Ye=(0,le.Z)(x,Ht),$e=vi||ci||!1,lt=N.useState(!1),Pt=(0,O.Z)(lt,2),Dt=Pt[0],Oe=Pt[1];(0,ve.Z)(function(){Oe((0,f.Z)())},[]);var Ft=N.useRef({}),nt=N.useContext(Ke),Ue=N.useMemo(function(){return{registerSubPopup:function(yt,yi){Ft.current[yt]=yi,nt==null||nt.registerSubPopup(yt,yi)}}},[nt]),Ge=(0,ke.Z)(),mt=N.useState(null),Rt=(0,O.Z)(mt,2),Nt=Rt[0],wi=Rt[1],Ai=(0,Q.Z)(function(St){(0,de.Sh)(St)&&Nt!==St&&wi(St),nt==null||nt.registerSubPopup(Ge,St)}),ut=N.useState(null),at=(0,O.Z)(ut,2),Z=at[0],ee=at[1],me=N.useRef(null),Ce=(0,Q.Z)(function(St){(0,de.Sh)(St)&&Z!==St&&(ee(St),me.current=St)}),pe=N.Children.only(I),Pe=(pe==null?void 0:pe.props)||{},Le={},Tt=(0,Q.Z)(function(St){var yt,yi,Hi=Z;return(Hi==null?void 0:Hi.contains(St))||((yt=(0,ae.A)(Hi))===null||yt===void 0?void 0:yt.host)===St||St===Hi||(Nt==null?void 0:Nt.contains(St))||((yi=(0,ae.A)(Nt))===null||yi===void 0?void 0:yi.host)===St||St===Nt||Object.values(Ft.current).some(function(xi){return(xi==null?void 0:xi.contains(St))||St===xi})}),Ot=M(ne,Be,g,d),gt=M(ne,l,S,v),Vt=N.useState(We||!1),Mt=(0,O.Z)(Vt,2),Jt=Mt[0],Gt=Mt[1],xt=Te!=null?Te:Jt,Si=(0,Q.Z)(function(St){Te===void 0&&Gt(St)});(0,ve.Z)(function(){Gt(Te||!1)},[Te]);var ei=N.useRef(xt);ei.current=xt;var Ci=N.useRef([]);Ci.current=[];var pi=(0,Q.Z)(function(St){var yt;Si(St),((yt=Ci.current[Ci.current.length-1])!==null&&yt!==void 0?yt:xt)!==St&&(Ci.current.push(St),Qe==null||Qe(St))}),di=N.useRef(),oi=function(){clearTimeout(di.current)},li=function(yt){var yi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;oi(),yi===0?pi(yt):di.current=setTimeout(function(){pi(yt)},yi*1e3)};N.useEffect(function(){return oi},[]);var bi=N.useState(!1),$i=(0,O.Z)(bi,2),_i=$i[0],Kt=$i[1];(0,ve.Z)(function(St){(!St||xt)&&Kt(!0)},[xt]);var ot=N.useState(null),Ui=(0,O.Z)(ot,2),Di=Ui[0],Bi=Ui[1],Zi=N.useState([0,0]),qi=(0,O.Z)(Zi,2),Yi=qi[0],Ni=qi[1],Qi=function(yt){Ni([yt.clientX,yt.clientY])},fn=pt(xt,Nt,Ei?Yi:Z,Qt,At,Xt,fi),Ti=(0,O.Z)(fn,11),Ki=Ti[0],In=Ti[1],mn=Ti[2],Tn=Ti[3],nn=Ti[4],ji=Ti[5],on=Ti[6],En=Ti[7],Rn=Ti[8],ln=Ti[9],Fi=Ti[10],zi=Se(Dt,W,w,se),gn=(0,O.Z)(zi,2),_n=gn[0],an=gn[1],An=_n.has("click"),un=an.has("click")||an.has("contextMenu"),Ln=(0,Q.Z)(function(){_i||Fi()}),On=function(){ei.current&&Ei&&un&&li(!1)};Ut(xt,Z,Nt,Ln,On),(0,ve.Z)(function(){Ln()},[Yi,Qt]),(0,ve.Z)(function(){xt&&!(At!=null&&At[Qt])&&Ln()},[JSON.stringify(Xt)]);var Pn=N.useMemo(function(){var St=J(At,ne,ln,Ei);return $()(St,si==null?void 0:si(ln))},[ln,si,At,ne,Ei]);N.useImperativeHandle(L,function(){return{nativeElement:me.current,forceAlign:Ln}});var jn=N.useState(0),Hn=(0,O.Z)(jn,2),xn=Hn[0],qn=Hn[1],Fn=N.useState(0),wn=(0,O.Z)(Fn,2),Qn=wn[0],Mn=wn[1],Dn=function(){if(ii&&Z){var yt=Z.getBoundingClientRect();qn(yt.width),Mn(yt.height)}},Bn=function(){Dn(),Ln()},Ji=function(yt){Kt(!1),Fi(),dt==null||dt(yt)},Sn=function(){return new Promise(function(yt){Dn(),Bi(function(){return yt})})};(0,ve.Z)(function(){Di&&(Fi(),Di(),Bi(null))},[Di]);function Gi(St,yt,yi,Hi){Le[St]=function(xi){var kn;Hi==null||Hi(xi),li(yt,yi);for(var hr=arguments.length,ar=new Array(hr>1?hr-1:0),Jn=1;Jn<hr;Jn++)ar[Jn-1]=arguments[Jn];(kn=Pe[St])===null||kn===void 0||kn.call.apply(kn,[Pe,xi].concat(ar))}}(An||un)&&(Le.onClick=function(St){var yt;ei.current&&un?li(!1):!ei.current&&An&&(Qi(St),li(!0));for(var yi=arguments.length,Hi=new Array(yi>1?yi-1:0),xi=1;xi<yi;xi++)Hi[xi-1]=arguments[xi];(yt=Pe.onClick)===null||yt===void 0||yt.call.apply(yt,[Pe,St].concat(Hi))}),Bt(xt,un,Z,Nt,ce,Ct,Tt,li);var cn=_n.has("hover"),pn=an.has("hover"),Xi,rn;cn&&(Gi("onMouseEnter",!0,Ze,function(St){Qi(St)}),Gi("onPointerEnter",!0,Ze,function(St){Qi(St)}),Xi=function(yt){(xt||_i)&&Nt!==null&&Nt!==void 0&&Nt.contains(yt.target)&&li(!0,Ze)},Ei&&(Le.onMouseMove=function(St){var yt;(yt=Pe.onMouseMove)===null||yt===void 0||yt.call(Pe,St)})),pn&&(Gi("onMouseLeave",!1,tt),Gi("onPointerLeave",!1,tt),rn=function(){li(!1,tt)}),_n.has("focus")&&Gi("onFocus",!0,bt),an.has("focus")&&Gi("onBlur",!1,wt),_n.has("contextMenu")&&(Le.onContextMenu=function(St){var yt;ei.current&&an.has("contextMenu")?li(!1):(Qi(St),li(!0)),St.preventDefault();for(var yi=arguments.length,Hi=new Array(yi>1?yi-1:0),xi=1;xi<yi;xi++)Hi[xi-1]=arguments[xi];(yt=Pe.onContextMenu)===null||yt===void 0||yt.call.apply(yt,[Pe,St].concat(Hi))}),U&&(Le.className=$()(Pe.className,U));var zn=(0,C.Z)((0,C.Z)({},Pe),Le),sr={},Nn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Nn.forEach(function(St){Ye[St]&&(sr[St]=function(){for(var yt,yi=arguments.length,Hi=new Array(yi),xi=0;xi<yi;xi++)Hi[xi]=arguments[xi];(yt=zn[St])===null||yt===void 0||yt.call.apply(yt,[zn].concat(Hi)),Ye[St].apply(Ye,Hi)})});var dr=N.cloneElement(pe,(0,C.Z)((0,C.Z)({},zn),sr)),Wn={x:ji,y:on},Zn=tn?(0,C.Z)({},tn!==!0?tn:{}):null;return N.createElement(N.Fragment,null,N.createElement(ye.Z,{disabled:!xt,ref:Ce,onResize:Bn},N.createElement(Y,{getTriggerDOMNode:q},dr)),N.createElement(Ke.Provider,{value:Ue},N.createElement(oe,{portal:R,ref:Ai,prefixCls:ne,popup:gi,className:$()(ui,Pn),style:ft,target:Z,onMouseEnter:Xi,onMouseLeave:rn,onPointerEnter:Xi,zIndex:It,open:xt,keepDom:_i,fresh:hi,onClick:ni,mask:ce,motion:Ot,maskMotion:gt,onVisibleChanged:Ji,onPrepare:Sn,forceRender:je,autoDestroy:$e,getPopupContainer:ai,align:ln,arrow:Zn,arrowPos:Wn,ready:Ki,offsetX:In,offsetY:mn,offsetR:Tn,offsetB:nn,onAlign:Ln,stretch:ii,targetWidth:xn/En,targetHeight:Qn/Rn})))});return P}var jt=Zt(fe.Z)},25039:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return K}});var C=A(59301),O=A(8591),le=A(38854),fe=A(93726),V=A(37312),$=A(2119),ye=A(56102),de=A(39171),ae={watermark:"watermark___hNYlv",videovideo:"videovideo___ovOkV",animate__loop:"animate__loop___mvL6s",upDown:"upDown___SlgHv",container:"container___g1WYG","video-container":"video-container___XPkWR","video-controls":"video-controls___to0Zq",hide:"hide___NA3DV","video-progress":"video-progress___gqHsd",seek:"seek___iZHBm","seek-tooltip":"seek-tooltip___uWyXx","bottom-controls":"bottom-controls___uoIBm","left-controls":"left-controls___mBEx4","right-controls":"right-controls___e9L6r",rateOverlay:"rateOverlay___HHBWe",controlText:"controlText___M_BWR","volume-controls":"volume-controls___fa3mE","fullscreen-button":"fullscreen-button___ur0es","fullscreen-button1":"fullscreen-button1___rfaXm","pip-button":"pip-button___GFO8W","playback-animation":"playback-animation___ndURq",volume:"volume___OTmpP",hidden:"hidden___o7GkT"},Q=(_e,Re,H)=>new Promise((D,B)=>{var z=he=>{try{oe(H.next(he))}catch(Y){B(Y)}},b=he=>{try{oe(H.throw(he))}catch(Y){B(Y)}},oe=he=>he.done?D(he.value):Promise.resolve(he.value).then(z,b);oe((H=H.apply(_e,Re)).next())});function ke(_e){if(isNaN(_e))return{minutes:"00",seconds:"00"};const Re=new Date(_e*1e3).toISOString().substr(11,8);return{hour:Re.substr(0,2),minutes:Re.substr(3,2),seconds:Re.substr(6,2)}}Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2}});function ve(_e,Re){return _e-Re}function f(_e){_e.sort(ve);let Re=0;for(let H=0;H<_e.length-1;H++){let D=Math.abs(_e[H+1]-_e[H]);D<21&&(Re+=D)}return Re}const N=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;var K=(0,C.forwardRef)(({allow_skip:_e,src:Re,toLog:H,videoId:D,logWatchHistory:B,courseId:z=null,startTime:b,handlePause:oe=()=>{},handlePlay:he=()=>{},handlePlayEnded:Y=()=>{},autoPlay:Ne=!1,onPlayEnded:Ke=()=>{},isShowWaterMark:Xe=!0},Se)=>{var j;Re=Re==null?void 0:Re.replace("http://","https://");const J=((j=Re==null?void 0:Re.split("."))==null?void 0:j.pop())==="flv",M=(0,C.useRef)(),Ae=(0,C.useRef)(),ze=(0,C.useRef)(),ge=(0,C.useRef)(),Ee=(0,C.useRef)(),rt=(0,C.useRef)(),qe=(0,C.useRef)(),Fe=(0,C.useRef)(),He=(0,C.useRef)(),we=(0,C.useRef)(),it=(0,C.useRef)(),pt=(0,C.useRef)(),Lt=(0,C.useRef)(),Ut=(0,C.useRef)(),$t=navigator.userAgent.toLowerCase().match(N),vt=$t?$t[0]:"pc",Bt=(0,C.useRef)(!1),Ht=(0,$.eY)();let Zt=0,jt=0,R=0,P=null,x=!1,L=20,F=1,ne=!1,I=!1,G=[];(0,C.useImperativeHandle)(Se,()=>({getLastUpdatedTime:()=>M.current.currentTime,getDuration:()=>M.current.duration})),O.ZP.config({maxCount:1,getContainer:()=>ze.current});const W=(0,C.useCallback)((Ze,ct=!1)=>{let tt={point:M.current.currentTime};P?(tt.log_id=P,tt.watch_duration=f(G),tt.total_duration=jt):(z?(tt.video_id=parseInt(D,10),tt.course_id=z):tt.video_id=D,tt.duration=Zt,tt.device=vt),ct&&(tt.ed="1");function bt(){return Q(this,null,function*(){ne=!0,P=yield B==null?void 0:B(tt),ne=!1,Ze&&Ze()})}bt()},[D,z]);(0,C.useEffect)(()=>{M.current&&(ge.current.style.display="none",Ee.current.style.display="block"),O.ZP.destroy();let Ze=null;return fe.Z.isSupported&&J&&Re&&(Re==null?void 0:Re.indexOf(".m3u8"))<0?(Ze=fe.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:Re,muted:!1}),M.current&&(Ze.attachMediaElement(M.current),Ze.load())):M.current.setAttribute("src",Re),se(),()=>{Ze&&(Ze.unload(),Ze.pause(),Ze.destroy(),Ze=null)}},[M,J,Re]);function w(){M.current.paused?(ge.current.style.display="none",Ee.current.style.display="block"):(ge.current.style.display="block",Ee.current.style.display="none")}function se(){it.current.style.display="none",Lt.current.style.display="none",pt.current.style.display="none",M.current.muted||M.current.volume===0?it.current.style.display="block":M.current.volume>0&&M.current.volume<=.5?Lt.current.style.display="block":pt.current.style.display="block"}(0,C.useEffect)(()=>{const Ze=document.getElementById("play"),ct=document.querySelectorAll(".playback-icons use");function tt(){he(),b&&!Bt.current&&(M.current.currentTime=b),Bt.current=!0,G.push(M.current.currentTime),x||(x=!0,H&&W())}function bt(){return Q(this,null,function*(){w(),G.push(M.current.currentTime),H&&W(()=>{P=null,R=0,x=!1,ne=!1,I=!1,G=[],jt=0,F=1},!0),Ke()})}function wt(){rt.current.value=Math.round(M.current.currentTime),qe.current.value=Math.round(M.current.currentTime)}function ce(){const st=ke(Math.round(M.current.currentTime));He.current.innerText=`${st.hour>0?st.hour+":":""}${st.minutes}:${st.seconds}`,He.current.setAttribute("datetime",`${st.hour>0?" "+st.hour+" ":""}${st.minutes}m ${st.seconds}s`)}function Yt(){var st,At,Xt,It,ii,si,hi;const Ei=Math.round((st=M.current)==null?void 0:st.duration);(Xt=(At=rt.current)==null?void 0:At.setAttribute)==null||Xt.call(At,"max",Ei),(ii=(It=qe.current)==null?void 0:It.setAttribute)==null||ii.call(It,"max",Ei);const ni=ke(Ei);Fe.current&&(Fe.current.innerText=`${ni.hour>0?ni.hour+":":""}${ni.minutes}:${ni.seconds}`,(hi=(si=Fe.current).setAttribute)==null||hi.call(si,"datetime",`${ni.hour>0?" "+ni.hour+" ":""}${ni.minutes}m ${ni.seconds}s`))}function Ct(){try{const st=Math.round(M.current.duration);rt.current.setAttribute("max",st),qe.current.setAttribute("max",st);const At=ke(st);Fe.current.innerText=`${At.hour>0?At.hour+":":""}${At.minutes}:${At.seconds}`,Fe.current.setAttribute("datetime",`${At.hour>0?" "+At.hour+" ":""}${At.minutes}m ${At.seconds}s`),wt(),ce();const{width:Xt,height:It,x:ii,y:si}=Ae.current.getBoundingClientRect();if(ii<0||si<0||!Xt)return;if(!I){let hi=M.current.currentTime,Ei=hi-R;Math.abs(Ei)<10?(jt+=Math.abs(Ei),R=hi,ne||jt-F*L>=0&&(F++,G.push(R),H&&W())):(R=hi,H&&W())}}catch(st){console.log(st)}}function ai(){I=!0}function je(){M.current.playing&&G.push(M.current.currentTime,R),R=M.current.currentTime,I=!1}function vi(){Zt=M.current.duration,Zt<=20&&(L=Zt/3),M.current.addEventListener("play",tt)}function ci(st){st.preventDefault(),(0,de.vp)()?(M.current.style.width="100%",M.current.style.height="100%"):M.current.style.cssText=""}function gi(){oe()}function ui(st){if(!_e){O.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");return}const At=st.target.dataset.seek?st.target.dataset.seek:st.target.value;M.current.currentTime=At,qe.current.value=At,rt.current.value=At}function ft(st){const At=Math.round(st.offsetX/st.target.clientWidth*parseInt(st.target.getAttribute("max"),10));rt.current.setAttribute("data-seek",At);const Xt=ke(At);we.current.textContent=`${Xt.hour>0?Xt.hour+":":""}${Xt.minutes}:${Xt.seconds}`;const It=M.current.getBoundingClientRect();we.current.style.left=`${st.pageX-It.left}px`}function Qt(st){switch(st.code){case"Space":st.preventDefault(),Qe();break;case"ArrowRight":if(st.preventDefault(),!_e){O.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(M.current.currentTime>=M.current.duration)break;M.current.currentTime=parseInt(M.current.currentTime)+5,wt();break;case"ArrowLeft":if(st.preventDefault(),!_e){O.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(M.current.currentTime===0)break;M.current.currentTime=parseInt(M.current.currentTime)-5,wt();break;case"ArrowUp":st.preventDefault(),M.current.volume<1&&(M.current.volume=(parseInt(M.current.volume*10)+1)/10);break;case"ArrowDown":st.preventDefault(),M.current.volume>0&&(M.current.volume=(parseInt(M.current.volume*10)-1)/10);break}}return ze.current.addEventListener((0,de.gH)(),ci),M.current.addEventListener("canplay",vi),M.current.addEventListener("ended",bt),M.current.addEventListener("seeking",ai),M.current.addEventListener("seeked",je),M.current.addEventListener("loadedmetadata",Yt),rt.current.addEventListener("mousemove",ft),rt.current.addEventListener("input",ui),M.current.addEventListener("timeupdate",Ct),M.current.addEventListener("pause",gi),M.current.addEventListener("volumechange",se),document.addEventListener("keydown",Qt),()=>{var st,At,Xt,It,ii,si,hi,Ei,ni,fi,tn,Be;(st=M.current)==null||st.removeEventListener("canplay",vi),(At=M.current)==null||At.removeEventListener("play",tt),(Xt=M.current)==null||Xt.removeEventListener("ended",bt),(It=M.current)==null||It.removeEventListener("seeking",ai),(ii=M.current)==null||ii.removeEventListener("seeked",je),(si=rt.current)==null||si.removeEventListener("mousemove",ft),(hi=rt.current)==null||hi.removeEventListener("input",ui),(Ei=M.current)==null||Ei.removeEventListener("timeupdate",Ct),(ni=M.current)==null||ni.removeEventListener("pause",gi),(fi=M.current)==null||fi.removeEventListener("loadedmetadata",Yt),(tn=M.current)==null||tn.removeEventListener("volumechange",se),document.removeEventListener("keydown",Qt),(Be=M.current)!=null&&Be.playing&&(G.push(R,M.current.currentTime),H&&W())}},[M,Re]),(0,C.useEffect)(()=>{if(M.current.onended=()=>{Y(M)},M.current.oncontextmenu=()=>!1,(Re==null?void 0:Re.indexOf(".m3u8"))>-1){if(M.current.canPlayType("application/vnd.apple.mpegurl"))M.current.src=Re;else if(V.ZP.isSupported()){var Ze=new V.ZP;Ze.loadSource(Re),Ze.attachMedia(M.current)}}},[Re]);const[Te,We]=(0,C.useState)(1),Qe=()=>{M.current.paused||M.current.ended?M.current.play():M.current.pause(),w()};function dt(){M.current.muted=!M.current.muted,M.current.muted?(Ut.current.setAttribute("data-volume",volume.value),Ut.current.value=0):Ut.current.value=Ut.current.dataset.volume}return C.createElement("div",{style:{position:"relative"},ref:ze},C.createElement("div",{ref:Ae,className:`${ae.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${ae.animate__loop}`},Xe&&Ht?Ht.login:" "),C.createElement("div",{className:ae.container},C.createElement("div",{className:ae["video-container"],id:"video-container"},C.createElement("div",{className:ae["playback-animation"],id:"playback-animation"},C.createElement("svg",{className:ae["playback-icons"]},C.createElement("use",{className:"hidden",href:"#play-icon"}),C.createElement("use",{href:"#pause"}))),C.createElement("video",{className:ae.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:M,autoPlay:Ne}),C.createElement("div",{className:`${ae["video-controls"]} `,id:"video-controls"},C.createElement("div",{className:ae["bottom-controls"]},C.createElement("div",{className:ae["left-controls"]},C.createElement("button",{"data-title":"\u64AD\u653E/\u6682\u505C",id:"play",onClick:Qe},C.createElement("svg",{className:ae["playback-icons"]},C.createElement("use",{ref:Ee,href:"#play-icon"}),C.createElement("use",{ref:ge,style:{display:"none"},href:"#pause"}))),C.createElement("div",{className:ae.time},C.createElement("time",{id:"time-elapsed",ref:He},"00:00"),C.createElement("span",null," / "),C.createElement("time",{id:"duration",ref:Fe},"00:00"))),C.createElement("div",{className:ae["right-controls"]},_e&&C.createElement(le.Z,{placement:"top",overlayClassName:ae.rateOverlay,getPopupContainer:Ze=>Ze.parentNode,menu:{items:[{key:"1",label:C.createElement("span",{onClick:()=>{We(1),M.current.playbackRate=1}},"1.0x")},{key:"2",label:C.createElement("span",{onClick:()=>{We(1.5),M.current.playbackRate=1.5}},"1.5x")},{key:"3",label:C.createElement("span",{onClick:()=>{We(2),M.current.playbackRate=2}},"2.0x")}]}},C.createElement("div",{className:`${ae.controlText} mr5`},"\u500D\u901F")),C.createElement(ye.CopyToClipboard,{text:Re,onCopy:()=>O.ZP.success("\u590D\u5236\u6210\u529F")},C.createElement("button",{"data-title":"\u590D\u5236\u94FE\u63A5"},C.createElement("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}}))),C.createElement("div",{className:ae["volume-controls"]},C.createElement("button",{"data-title":"\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",className:ae["volume-button"],id:"volume-button",onClick:dt},C.createElement("i",{ref:it,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),C.createElement("i",{ref:Lt,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),C.createElement("i",{ref:pt,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})),C.createElement("input",{className:ae.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:Ut,style:{display:"none"},onClick:se})),C.createElement("button",{"data-title":"\u5168\u5C4F/\u9000\u51FA\u5168\u5C4F",className:ae["fullscreen-button"],onClick:()=>{(0,de.vp)()?(0,de.BU)():(0,de.Dj)(ze.current)}},C.createElement("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})))),C.createElement("div",{className:ae["video-progress"]},C.createElement("progress",{ref:qe,value:"0",min:"0"}),C.createElement("input",{className:ae.seek,ref:rt,value:"0",min:"0",type:"range",step:"1"}),C.createElement("div",{className:ae["seek-tooltip"],ref:we,id:"seek-tooltip"},"00:00"))))),C.createElement("svg",{style:{display:"none"}},C.createElement("defs",null,C.createElement("symbol",{id:"pause",viewBox:"0 0 24 24"},C.createElement("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})),C.createElement("symbol",{id:"play-icon",viewBox:"0 0 24 24"},C.createElement("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})),C.createElement("symbol",{id:"volume-high",viewBox:"0 0 24 24"},C.createElement("path",{d:"M14.016 3.234q3.047 0.656 5.016 3.117t1.969 5.648-1.969 5.648-5.016 3.117v-2.063q2.203-0.656 3.586-2.484t1.383-4.219-1.383-4.219-3.586-2.484v-2.063zM16.5 12q0 2.813-2.484 4.031v-8.063q1.031 0.516 1.758 1.688t0.727 2.344zM3 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6z"})),C.createElement("symbol",{id:"volume-low",viewBox:"0 0 24 24"},C.createElement("path",{d:"M5.016 9h3.984l5.016-5.016v16.031l-5.016-5.016h-3.984v-6zM18.516 12q0 2.766-2.531 4.031v-8.063q1.031 0.516 1.781 1.711t0.75 2.32z"})),C.createElement("symbol",{id:"volume-mute",viewBox:"0 0 24 24"},C.createElement("path",{d:"M12 3.984v4.219l-2.109-2.109zM4.266 3l16.734 16.734-1.266 1.266-2.063-2.063q-1.547 1.313-3.656 1.828v-2.063q1.172-0.328 2.25-1.172l-4.266-4.266v6.75l-5.016-5.016h-3.984v-6h4.734l-4.734-4.734zM18.984 12q0-2.391-1.383-4.219t-3.586-2.484v-2.063q3.047 0.656 5.016 3.117t1.969 5.648q0 2.203-1.031 4.172l-1.5-1.547q0.516-1.266 0.516-2.625zM16.5 12q0 0.422-0.047 0.609l-2.438-2.438v-2.203q1.031 0.516 1.758 1.688t0.727 2.344z"})),C.createElement("symbol",{id:"fullscreen",viewBox:"0 0 24 24"},C.createElement("path",{d:"M14.016 5.016h4.969v4.969h-1.969v-3h-3v-1.969zM17.016 17.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 9.984v-4.969h4.969v1.969h-3v3h-1.969zM6.984 14.016v3h3v1.969h-4.969v-4.969h1.969z"})),C.createElement("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24"},C.createElement("path",{d:"M15.984 8.016h3v1.969h-4.969v-4.969h1.969v3zM14.016 18.984v-4.969h4.969v1.969h-3v3h-1.969zM8.016 8.016v-3h1.969v4.969h-4.969v-1.969h3zM5.016 15.984v-1.969h4.969v4.969h-1.969v-3h-3z"})),C.createElement("symbol",{id:"pip",viewBox:"0 0 24 24"},C.createElement("path",{d:"M21 19.031v-14.063h-18v14.063h18zM23.016 18.984q0 0.797-0.609 1.406t-1.406 0.609h-18q-0.797 0-1.406-0.609t-0.609-1.406v-14.016q0-0.797 0.609-1.383t1.406-0.586h18q0.797 0 1.406 0.586t0.609 1.383v14.016zM18.984 11.016v6h-7.969v-6h7.969z"})))))})},14129:function(Wt,Ve,A){"use strict";A.r(Ve),A.d(Ve,{default:function(){return Re}});var C=A(59301),O=A(42203),le=A(78485),fe=A(43418),V={flex_box_center:"flex_box_center___yF0Vb",flex_space_between:"flex_space_between___vsNYO",flex_box_vertical_center:"flex_box_vertical_center___C4UqH",flex_box_center_end:"flex_box_center_end___EGtmE",flex_box_column:"flex_box_column___uX9g9",bg:"bg___sRga2",menu:"menu___s8xQl",desc:"desc___poG1Z",listItem:"listItem___ml9kN",info:"info___Z8R2Z",add:"add___jH8te",addForm:"addForm___O999t",attendanceCode:"attendanceCode___hPKyl",signInStatus:"signInStatus___usMPT",colorE02020:"colorE02020___hZvSz",color0152d9:"color0152d9___RgXzd",colorFA6400:"colorFA6400___g2yU6",iframe:"iframe___HRzMh"},$=A(2119);const ye={init:[{stage_name:"\u521D\u59CB\u5B66\u4E60",parent:9999999,key:0},{stage_name:"\u7EEA\u8BBA",parent:0,key:1},{discipline_name:"\u7EEA\u8BBA",shixun_count:"1",video_count:"2",parent:1,key:"11"},{shixun_name:"\u7EEA\u8BBA1",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/f066ae1a9a8f418f837e5bf8d02b2690/76df907c20efd95bea0fa23424f10693-hd.m3u8",parent:"11",key:"111"},{shixun_name:"\u7EEA\u8BBA2",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/068ca7853da448c794eeffb0dee8bed4/5bb446a882043683e37474ff408f601b-hd.m3u8",parent:"11",key:"112"},{shixun_name:"C++\u5F00\u53D1\u73AF\u5883\u5E94\u7528\u5165\u95E8",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/zxb937qn/challenges",parent:"11",key:"113"},{stage_name:"\u7B80\u5355\u7A0B\u5E8F\u8BBE\u8BA1",parent:0,key:2},{discipline_name:"\u57FA\u7840\u6570\u636E\u7C7B\u578B\u548C\u8868\u8FBE\u5F0F",shixun_count:"1",video_count:"1",parent:2,key:"21"},{shixun_name:"\u57FA\u7840\u6570\u636E\u7C7B\u578B\u548C\u8868\u8FBE\u5F0F",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/f5f9c87860cb4a98ba86da37b5bfac70/8d50a9c4d5d4d3382c09bad3f4c5dcb6-hd.m3u8",parent:"21",key:"211"},{shixun_name:"C++\u7B80\u5355\u7A0B\u5E8F\u8BBE\u8BA1",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/lg5afhzv/challenges",parent:"21",key:"212"},{discipline_name:"\u5224\u65AD\u8BED\u53E5",shixun_count:"2",video_count:"2",parent:2,key:"22"},{shixun_name:"if\u8BED\u53E5",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/3b4e821b200443948c553e4c6b51d940/b9601216238e60440192c2deb58adc53-hd.m3u8",parent:"22",key:"221"},{shixun_name:"C++\u9009\u62E9\u7ED3\u6784\u2014\u2014\uFF08if\u591A\u91CD\u9009\u62E9\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/23xkyrmn/challenges",parent:"22",key:"222"},{shixun_name:"switch\u8BED\u53E5",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/3b4e821b200443948c553e4c6b51d940/b9601216238e60440192c2deb58adc53-hd.m3u8",parent:"22",key:"223"},{shixun_name:"C++\u9009\u62E9\u7ED3\u6784\u2014\u2014\uFF08\u5DE7\u7528switch\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/sm3c5a7v/challenges",parent:"22",key:"224"},{discipline_name:"\u5FAA\u73AF",shixun_count:"2",video_count:"2",parent:2,key:"23"},{shixun_name:"while\u8BED\u53E5",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/dda06371a1594f5d865479a0fadc77bb/cb504e3af36ebe2ba979e8fe5fbb2222-hd.m3u8",parent:"23",key:"231"},{shixun_name:"C++\u5FAA\u73AF\u7ED3\u6784\u2014\u2014\uFF08\u719F\u6089while\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/8yhf4sn6/challenges",parent:"23",key:"232"},{shixun_name:"for\u8BED\u53E5",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/503194c483f44ccfacc7f9ee14cda70a/36cbd964c6657d1bbc43eb33b98f0c51-hd.m3u8",parent:"23",key:"233"},{shixun_name:"C++\u9009\u62E9\u7ED3\u6784\u2014\u2014\uFF08\u5DE7\u7528switch\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/sm3c5a7v/challenges",parent:"23",key:"234"},{stage_name:"\u51FD\u6570",parent:0,key:3},{discipline_name:"\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u7528",shixun_count:"2",video_count:"1",parent:3,key:"31"},{shixun_name:"\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u7528",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c10e39b3afb14ad0b890368aa1751821/ef361445294452e1d9bfacae80b3ec2f-hd.m3u8",parent:"31",key:"311"},{shixun_name:"C++\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u75281",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/3q4isevr/challenges",parent:"31",key:"312"},{shixun_name:"C++\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u75282",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/tlhxwo64/challenges",parent:"31",key:"313"},{discipline_name:"\u4F20\u8F93\u4F20\u9012",shixun_count:"2",video_count:"1",parent:3,key:"32"},{shixun_name:"\u51FD\u6570\u7684\u53C2\u6570",shixun_type:"\u89C6\u9891",url:"https://www.educoder.net/video/7785?subject_id=jpl5vs26",parent:"32",key:"321"},{shixun_name:"C++\u53C2\u6570\u4F20\u90121",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/2phrn8yk/challenges",parent:"32",key:"322"},{shixun_name:"C++\u53C2\u6570\u4F20\u90122",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/xsq7p4a6/challenges",parent:"32",key:"323"},{discipline_name:"\u51FD\u6570\u91CD\u8F7D",shixun_count:"1",video_count:"1",parent:3,key:"33"},{shixun_name:"\u51FD\u6570\u91CD\u8F7D",shixun_type:"\u89C6\u9891",url:"https://www.educoder.net/video/7785?subject_id=jpl5vs26",parent:"33",key:"331"},{shixun_name:"C++\u51FD\u6570\u91CD\u8F7D",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/6hbqpv7e/challenges",parent:"33",key:"332"},{discipline_name:"\u9012\u5F52\u51FD\u6570",shixun_count:"2",video_count:"1",parent:3,key:"34"},{shixun_name:"\u51FD\u6570\u7684\u9012\u5F52\u8C03\u7528",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/51a0935ddc884f1b9f6c1395f2011425/7308cd65a7fe1d13eebe2600054d29c7-hd.m3u8",parent:"34",key:"341"},{shixun_name:"\u9012\u5F52\u51FD\u6570\u7F16\u5199\u5165\u95E8",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/4qjw9t32/challenges",parent:"34",key:"342"},{shixun_name:"\u9006\u5E8F\u8F93\u51FA\uFF08\u4F7F\u7528\u9012\u5F52\u89E3\u51B3\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/oxtrf27l/challenges",parent:"34",key:"343"},{stage_name:"\u7C7B\u548C\u5BF9\u8C61",parent:0,key:4},{discipline_name:"\u6784\u9020\u51FD\u6570\u548C\u6790\u6784\u51FD\u6570",shixun_count:"2",video_count:"1",parent:4,key:"41"},{shixun_name:"\u6784\u9020\u51FD\u6570\u548C\u6790\u6784\u51FD\u6570",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/b4e17c1e8c8d449f862af9ea94fa9522/bad9e739addf73679a70e38a9d2cc32c-hd.m3u8",parent:"41",key:"411"},{shixun_name:"\u5B9A\u4E49\u548C\u4F7F\u7528\u7ED3\u6784",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/igwom4hs/challenges",parent:"41",key:"412"},{shixun_name:"\u5B9A\u4E49\u548C\u4F7F\u7528\u7ED3\u6784\u4F53",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/5yo6rw3f/challenges",parent:"41",key:"413"},{stage_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",parent:0,key:5},{discipline_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",shixun_count:"1",video_count:"1",parent:5,key:"51"},{shixun_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/fde33b24ff2b4bf5bc5e238dc473df8e/3cf407a74af29554226084d17fa17858-hd.m3u8",parent:"51",key:"511"},{shixun_name:"C++\u7A0B\u5E8F\u7684\u7ED3\u6784",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/yqbh3fx5/challenges",parent:"51",key:"512"},{stage_name:"\u6570\u7EC4\u3001\u6307\u9488\u4E0E\u5B57\u7B26\u4E32",parent:0,key:6},{discipline_name:"\u6570\u7EC4",shixun_count:"1",video_count:"1",parent:6,key:"61"},{shixun_name:"\u6570\u7EC4",shixun_type:"\u89C6\u9891",url:"https://www.educoder.net/video/7785?subject_id=jpl5vs26",parent:"61",key:"611"},{shixun_name:"\u5E73\u5747\u6210\u7EE9\u4E0E\u7B80\u5355\u7EDF\u8BA1",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/4wcfgm5q/challenges",parent:"61",key:"612"},{discipline_name:"\u6307\u9488",shixun_count:"3",video_count:"1",parent:6,key:"62"},{shixun_name:"\u6307\u9488",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/00a5448862c84c42b1a369ac2be88ae9/9b9627710a725e570ede478663c2589d-hd.m3u8",parent:"62",key:"621"},{shixun_name:"\u6307\u9488\u7EC3\u624B-\u5B57\u7B26\u4E32\u5012\u5E8F",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/lkn6xuc3/challenges",parent:"62",key:"622"},{shixun_name:"\u6307\u9488\u6570\u7EC4-\u5355\u8BCD\u5012\u5E8F",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/vtk73ny2/challenges",parent:"62",key:"623"},{shixun_name:"\u7528\u6307\u9488\u89E3\u51B3\u95EE\u9898-\u6587\u672C\u683C\u5F0F\u5904\u7406",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/xfnp73fz/challenges",parent:"62",key:"624"},{stage_name:"\u7C7B\u7684\u7EE7\u627F",parent:0,key:7},{discipline_name:"\u7C7B\u7684\u7EE7\u627F",shixun_count:"1",video_count:"3",parent:7,key:"71"},{shixun_name:"\u7C7B\u7684\u7EE7\u627F(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/1eedcdb9ec43442c93780f04859c9aa9/631b8c88eb263877d24637d5b8d54dc5-hd.m3u8",parent:"71",key:"711"},{shixun_name:"\u7C7B\u7684\u7EE7\u627F(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/fc1e7d8d8140469ba1bc01ee64fcc3c1/9256d13f4a14ae17ba9cac9f895b8a9d-hd.m3u8",parent:"71",key:"712"},{shixun_name:"\u7C7B\u7684\u7EE7\u627F(3)",shixun_type:"\u89C6\u9891",url:"https://www.educoder.net/video/7806?subject_id=jpl5vs26",parent:"71",key:"713"},{shixun_name:"\u7EE7\u627F\u4E0E\u6D3E\u751F",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/f83ipgyo/challenges",parent:"71",key:"714"},{stage_name:"\u591A\u6001\u6027",parent:0,key:8},{discipline_name:"\u591A\u6001\u6027",shixun_count:"1",video_count:"2",parent:8,key:"81"},{shixun_name:"\u591A\u6001\u6027(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/5a960b51ebf346d2b77afb3b70d00768/73d6fa00824f4c73b885d33f688c3294-hd.m3u8",parent:"81",key:"811"},{shixun_name:"\u591A\u6001\u6027(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/08fe97a36e184cf1bf27cdd7a24794c9/625c4e9e863840443f5332ccc02761fc-hd.m3u8",parent:"81",key:"812"},{shixun_name:"\u865A\u51FD\u6570\u4E0E\u591A\u6001\u6027",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/9pjmg7uf/challenges",parent:"81",key:"813"},{stage_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E",parent:0,key:9},{discipline_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E",shixun_count:"1",video_count:"3",parent:9,key:"91"},{shixun_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/8dcf418d2d16404d91af1780f669e549/eb538592d8a3b98e1c2f7f844f85b778-hd.m3u8",parent:"91",key:"911"},{shixun_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/459f2693af7b48f8b854033e666a77f8/f5b140c5adc0f24ac56b72492373306a-hd.m3u8",parent:"91",key:"912"},{shixun_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E(3)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/ccea50bc15d2468aab99aff19eb69e16/a5ecac1ee0c07360d07880187a787085-hd.m3u8",parent:"91",key:"913"},{shixun_name:"\u7FA4\u4F53\u7C7B\u548C\u7FA4\u4F53\u6570\u636E\u7684\u7EC4\u7EC7",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/kfv3my9o/challenges",parent:"91",key:"914"},{stage_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93",parent:0,key:10},{discipline_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93",shixun_count:"1",video_count:"3",parent:10,key:"101"},{shixun_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/2f3154d695a542fbaba5c483d8d7f7a9/aea4302c51501634469ed4b91462c810-hd.m3u8",parent:"101",key:"1011"},{shixun_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/23be6a61e4e54db398b9172b1213a1f2/3f1e88f97957369e29ef2bde63640004-hd.m3u8",parent:"101",key:"1012"},{shixun_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93(3)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/a5887adcc34445bba695de7dcadb781e/0fb3a6a6ad38f7a107054c5f2f0de262-hd.m3u8",parent:"101",key:"1013"},{shixun_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/hmtw5iq6/challenges",parent:"101",key:"1014"},{stage_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165/\u8F93\u51FA11",parent:0,key:1911},{discipline_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165/\u8F93\u51FA",shixun_count:"1",video_count:"2",parent:1911,key:9111},{shixun_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165\u8F93\u51FA(1)22222",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c9e76b949ee847fbb89a926220526692/b80ff8d09a87bfde1064f5b73ae7c34b-hd.m3u8",parent:9111,key:"91111"},{shixun_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165\u8F93\u51FA(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/65c02365a4ad40858b69b8cbe3ca4aa1/18a2c5697d4a84a971c500565509f038-hd.m3u8",parent:"9111",key:"91112"},{shixun_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165/\u8F93\u51FA",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/hsvuixpm/challenges",parent:"9111",key:"91113"},{stage_name:"\u5F02\u5E38\u5904\u7406",parent:0,key:12},{discipline_name:"\u5F02\u5E38\u5904\u7406",shixun_count:"1",video_count:"1",parent:12,key:"121"},{shixun_name:"\u5F02\u5E38\u5904\u7406",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c95499dd4c064584914e32fca9563717/98a8be24326e3eb35375713f5ccbb8bb-hd.m3u8",parent:"121",key:"1211"},{shixun_name:"\u7F16\u5199\u5F02\u5E38\u5904\u7406\u7684\u7C7B",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/nlt6f7ae/challenges",parent:"121",key:"1212"}].map(H=>(H.parent=Number(H.parent),H.key=Number(H.key),H)),review:[{stage_name:"\u590D\u4E60\u5B66\u4E60",parent:9999999,key:0},{stage_name:"\u7B80\u5355\u7A0B\u5E8F\u8BBE\u8BA1",parent:0,key:1},{discipline_name:"\u57FA\u7840\u6570\u636E\u7C7B\u578B\u548C\u8868\u8FBE\u5F0F",shixun_count:"1",video_count:"1",parent:1,key:"11"},{shixun_name:"\u57FA\u7840\u6570\u636E\u7C7B\u578B\u548C\u8868\u8FBE\u5F0F",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/f5f9c87860cb4a98ba86da37b5bfac70/8d50a9c4d5d4d3382c09bad3f4c5dcb6-hd.m3u8",parent:"11",key:"111"},{shixun_name:"C++\u7B80\u5355\u7A0B\u5E8F\u8BBE\u8BA1",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/lg5afhzv/challenges",parent:"11",key:"112"},{discipline_name:"\u5FAA\u73AF",shixun_count:"2",video_count:"2",parent:1,key:"12"},{shixun_name:"while\u8BED\u53E5",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/dda06371a1594f5d865479a0fadc77bb/cb504e3af36ebe2ba979e8fe5fbb2222-hd.m3u8",parent:"12",key:"121"},{shixun_name:"C++\u5FAA\u73AF\u7ED3\u6784\u2014\u2014\uFF08\u719F\u6089while\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/8yhf4sn6/challenges",parent:"12",key:"122"},{shixun_name:"for\u8BED\u53E5",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/503194c483f44ccfacc7f9ee14cda70a/36cbd964c6657d1bbc43eb33b98f0c51-hd.m3u8",parent:"12",key:"123"},{shixun_name:"C++\u9009\u62E9\u7ED3\u6784\u2014\u2014\uFF08\u5DE7\u7528switch\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/sm3c5a7v/challenges",parent:"12",key:"124"},{stage_name:"\u51FD\u6570",parent:0,key:2},{discipline_name:"\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u7528",shixun_count:"2",video_count:"1",parent:2,key:"21"},{shixun_name:"\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u7528",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c10e39b3afb14ad0b890368aa1751821/ef361445294452e1d9bfacae80b3ec2f-hd.m3u8",parent:"21",key:"211"},{shixun_name:"C++\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u75281",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/3q4isevr/challenges",parent:"21",key:"212"},{shixun_name:"C++\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u75282",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/tlhxwo64/challenges",parent:"21",key:"213"},{discipline_name:"\u4F20\u8F93\u4F20\u9012",shixun_count:"2",video_count:"1",parent:2,key:"22"},{shixun_name:"\u51FD\u6570\u7684\u53C2\u6570",shixun_type:"\u89C6\u9891",url:"https://www.educoder.net/video/7785?subject_id=jpl5vs26",parent:"22",key:"221"},{shixun_name:"C++\u53C2\u6570\u4F20\u90121",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/2phrn8yk/challenges",parent:"22",key:"222"},{shixun_name:"C++\u53C2\u6570\u4F20\u90122",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/xsq7p4a6/challenges",parent:"22",key:"223"},{discipline_name:"\u9012\u5F52\u51FD\u6570",shixun_count:"2",video_count:"2",parent:2,key:"23"},{shixun_name:"\u51FD\u6570\u7684\u9012\u5F52\u8C03\u7528",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/51a0935ddc884f1b9f6c1395f2011425/7308cd65a7fe1d13eebe2600054d29c7-hd.m3u8",parent:"23",key:"231"},{shixun_name:"\u9012\u5F52\u51FD\u6570\u7F16\u5199\u5165\u95E8",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/4qjw9t32/challenges",parent:"23",key:"232"},{shixun_name:"\u9006\u5E8F\u8F93\u51FA\uFF08\u4F7F\u7528\u9012\u5F52\u89E3\u51B3\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/oxtrf27l/challenges",parent:"23",key:"233"},{stage_name:"\u7C7B\u548C\u5BF9\u8C61",parent:0,key:3},{discipline_name:"\u6784\u9020\u51FD\u6570\u548C\u6790\u6784\u51FD\u6570",shixun_count:"2",video_count:"1",parent:3,key:"31"},{shixun_name:"\u6784\u9020\u51FD\u6570\u548C\u6790\u6784\u51FD\u6570",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/b4e17c1e8c8d449f862af9ea94fa9522/bad9e739addf73679a70e38a9d2cc32c-hd.m3u8",parent:"31",key:"311"},{shixun_name:"\u5B9A\u4E49\u548C\u4F7F\u7528\u7ED3\u6784",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/igwom4hs/challenges",parent:"31",key:"312"},{shixun_name:"\u5B9A\u4E49\u548C\u4F7F\u7528\u7ED3\u6784\u4F53",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/5yo6rw3f/challenges",parent:"31",key:"313"},{stage_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",parent:0,key:4},{discipline_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",shixun_count:"1",video_count:"1",parent:4,key:"41"},{shixun_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/fde33b24ff2b4bf5bc5e238dc473df8e/3cf407a74af29554226084d17fa17858-hd.m3u8",parent:"41",key:"411"},{shixun_name:"C++\u7A0B\u5E8F\u7684\u7ED3\u6784",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/yqbh3fx5/challenges",parent:"41",key:"412"},{stage_name:"\u6570\u7EC4\u3001\u6307\u9488\u4E0E\u5B57\u7B26\u4E32",parent:0,key:5},{discipline_name:"\u6570\u7EC4",shixun_count:"1",video_count:"1",parent:5,key:"51"},{shixun_name:"\u6570\u7EC4",shixun_type:"\u89C6\u9891",url:"https://www.educoder.net/video/7785?subject_id=jpl5vs26",parent:"51",key:"511"},{shixun_name:"\u5E73\u5747\u6210\u7EE9\u4E0E\u7B80\u5355\u7EDF\u8BA1",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/4wcfgm5q/challenges",parent:"51",key:"512"},{discipline_name:"\u6307\u9488",shixun_count:"1",video_count:"1",parent:5,key:"52"},{shixun_name:"\u6307\u9488",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/00a5448862c84c42b1a369ac2be88ae9/9b9627710a725e570ede478663c2589d-hd.m3u8",parent:"52",key:"521"},{shixun_name:"\u7528\u6307\u9488\u89E3\u51B3\u95EE\u9898-\u6587\u672C\u683C\u5F0F\u5904\u7406",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/xfnp73fz/challenges",parent:"52",key:"522"},{stage_name:"\u7C7B\u7684\u7EE7\u627F",parent:0,key:6},{discipline_name:"\u7C7B\u7684\u7EE7\u627F",shixun_count:"0",video_count:"2",parent:6,key:"61"},{shixun_name:"\u7C7B\u7684\u7EE7\u627F(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/1eedcdb9ec43442c93780f04859c9aa9/631b8c88eb263877d24637d5b8d54dc5-hd.m3u8",parent:"61",key:"611"},{shixun_name:"\u7C7B\u7684\u7EE7\u627F(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/fc1e7d8d8140469ba1bc01ee64fcc3c1/9256d13f4a14ae17ba9cac9f895b8a9d-hd.m3u8",parent:"61",key:"612"},{stage_name:"\u591A\u6001\u6027",parent:0,key:7},{discipline_name:"\u591A\u6001\u6027",shixun_count:"1",video_count:"2",parent:7,key:"71"},{shixun_name:"\u591A\u6001\u6027(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/5a960b51ebf346d2b77afb3b70d00768/73d6fa00824f4c73b885d33f688c3294-hd.m3u8",parent:"71",key:"711"},{shixun_name:"\u591A\u6001\u6027(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/08fe97a36e184cf1bf27cdd7a24794c9/625c4e9e863840443f5332ccc02761fc-hd.m3u8",parent:"71",key:"712"},{shixun_name:"\u865A\u51FD\u6570\u4E0E\u591A\u6001\u6027",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/9pjmg7uf/challenges",parent:"71",key:"713"},{stage_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E",parent:0,key:8},{discipline_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E",shixun_count:"1",video_count:"1",parent:8,key:"81"},{shixun_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/8dcf418d2d16404d91af1780f669e549/eb538592d8a3b98e1c2f7f844f85b778-hd.m3u8",parent:"81",key:"811"},{shixun_name:"\u7FA4\u4F53\u7C7B\u548C\u7FA4\u4F53\u6570\u636E\u7684\u7EC4\u7EC7",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/kfv3my9o/challenges",parent:"81",key:"812"},{stage_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93",parent:0,key:9},{discipline_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93",shixun_count:"1",video_count:"1",parent:9,key:"91"},{shixun_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/2f3154d695a542fbaba5c483d8d7f7a9/aea4302c51501634469ed4b91462c810-hd.m3u8",parent:"91",key:"911"},{shixun_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/hmtw5iq6/challenges",parent:"91",key:"912"},{stage_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165/\u8F93\u51FA",parent:0,key:10},{discipline_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165/\u8F93\u51FA",shixun_count:"0",video_count:"2",parent:10,key:"101"},{shixun_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165\u8F93\u51FA(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c9e76b949ee847fbb89a926220526692/b80ff8d09a87bfde1064f5b73ae7c34b-hd.m3u8",parent:"101",key:"1011"},{shixun_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165\u8F93\u51FA(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/65c02365a4ad40858b69b8cbe3ca4aa1/18a2c5697d4a84a971c500565509f038-hd.m3u8",parent:"101",key:"1012"},{shixun_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165/\u8F93\u51FA",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/hsvuixpm/challenges",parent:"101",key:"1013"},{stage_name:"\u5F02\u5E38\u5904\u7406",parent:0,key:9911},{discipline_name:"\u5F02\u5E38\u5904\u7406",shixun_count:"1",video_count:"1",parent:9911,key:"99111"},{shixun_name:"\u5F02\u5E38\u5904\u7406",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c95499dd4c064584914e32fca9563717/98a8be24326e3eb35375713f5ccbb8bb-hd.m3u8",parent:"99111",key:"991111"},{shixun_name:"\u7F16\u5199\u5F02\u5E38\u5904\u7406\u7684\u7C7B",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/nlt6f7ae/challenges",parent:"99111",key:"991112"}].map(H=>(H.parent=Number(H.parent),H.key=Number(H.key),H)),before:[{stage_name:"\u8003\u524D\u5B66\u4E60",parent:9999999,key:0},{stage_name:"\u7EEA\u8BBA",parent:0,key:1},{discipline_name:"\u7EEA\u8BBA",shixun_count:"1",video_count:"2",parent:1,key:"11"},{shixun_name:"\u7EEA\u8BBA1",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/f066ae1a9a8f418f837e5bf8d02b2690/76df907c20efd95bea0fa23424f10693-hd.m3u8",parent:"11",key:"111"},{shixun_name:"\u7EEA\u8BBA2",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/068ca7853da448c794eeffb0dee8bed4/5bb446a882043683e37474ff408f601b-hd.m3u8",parent:"11",key:"112"},{shixun_name:"C++\u5F00\u53D1\u73AF\u5883\u5E94\u7528\u5165\u95E8",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/zxb937qn/challenges",parent:"11",key:"113"},{stage_name:"\u7B80\u5355\u7A0B\u5E8F\u8BBE\u8BA1",parent:0,key:2},{discipline_name:"\u57FA\u7840\u6570\u636E\u7C7B\u578B\u548C\u8868\u8FBE\u5F0F",shixun_count:"1",video_count:"1",parent:2,key:"21"},{shixun_name:"\u57FA\u7840\u6570\u636E\u7C7B\u578B\u548C\u8868\u8FBE\u5F0F",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/f5f9c87860cb4a98ba86da37b5bfac70/8d50a9c4d5d4d3382c09bad3f4c5dcb6-hd.m3u8",parent:"21",key:"211"},{shixun_name:"C++\u7B80\u5355\u7A0B\u5E8F\u8BBE\u8BA1",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/lg5afhzv/challenges",parent:"21",key:"212"},{stage_name:"\u51FD\u6570",parent:0,key:3},{discipline_name:"\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u7528",shixun_count:"2",video_count:"1",parent:3,key:"31"},{shixun_name:"\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u7528",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c10e39b3afb14ad0b890368aa1751821/ef361445294452e1d9bfacae80b3ec2f-hd.m3u8",parent:"31",key:"311"},{shixun_name:"C++\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u75281",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/3q4isevr/challenges",parent:"31",key:"312"},{shixun_name:"C++\u51FD\u6570\u7684\u5B9A\u4E49\u4E0E\u8C03\u75282",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/tlhxwo64/challenges",parent:"31",key:"313"},{discipline_name:"\u9012\u5F52\u51FD\u6570",shixun_count:"2",video_count:"1",parent:3,key:"32"},{shixun_name:"\u51FD\u6570\u7684\u9012\u5F52\u8C03\u7528",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/51a0935ddc884f1b9f6c1395f2011425/7308cd65a7fe1d13eebe2600054d29c7-hd.m3u8",parent:"32",key:"321"},{shixun_name:"\u9012\u5F52\u51FD\u6570\u7F16\u5199\u5165\u95E8",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/4qjw9t32/challenges",parent:"32",key:"322"},{shixun_name:"\u9006\u5E8F\u8F93\u51FA\uFF08\u4F7F\u7528\u9012\u5F52\u89E3\u51B3\uFF09",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/oxtrf27l/challenges",parent:"32",key:"323"},{stage_name:"\u7C7B\u548C\u5BF9\u8C61",parent:0,key:4},{discipline_name:"\u6784\u9020\u51FD\u6570\u548C\u6790\u6784\u51FD\u6570",shixun_count:"2",video_count:"1",parent:4,key:"41"},{shixun_name:"\u6784\u9020\u51FD\u6570\u548C\u6790\u6784\u51FD\u6570",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/b4e17c1e8c8d449f862af9ea94fa9522/bad9e739addf73679a70e38a9d2cc32c-hd.m3u8",parent:"41",key:"411"},{shixun_name:"\u5B9A\u4E49\u548C\u4F7F\u7528\u7ED3\u6784",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/igwom4hs/challenges",parent:"41",key:"412"},{shixun_name:"\u5B9A\u4E49\u548C\u4F7F\u7528\u7ED3\u6784\u4F53",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/5yo6rw3f/challenges",parent:"41",key:"413"},{stage_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",parent:0,key:5},{discipline_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",shixun_count:"1",video_count:"1",parent:5,key:"51"},{shixun_name:"\u6570\u636E\u7684\u5171\u4EAB\u4E0E\u4FDD\u62A4",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/fde33b24ff2b4bf5bc5e238dc473df8e/3cf407a74af29554226084d17fa17858-hd.m3u8",parent:"51",key:"511"},{shixun_name:"C++\u7A0B\u5E8F\u7684\u7ED3\u6784",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/yqbh3fx5/challenges",parent:"51",key:"512"},{stage_name:"\u6570\u7EC4\u3001\u6307\u9488\u4E0E\u5B57\u7B26\u4E32",parent:0,key:6},{discipline_name:"\u6570\u7EC4",shixun_count:"1",video_count:"1",parent:6,key:"61"},{shixun_name:"\u6570\u7EC4",shixun_type:"\u89C6\u9891",url:"https://www.educoder.net/video/7785?subject_id=jpl5vs26",parent:"61",key:"611"},{shixun_name:"\u5E73\u5747\u6210\u7EE9\u4E0E\u7B80\u5355\u7EDF\u8BA1",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/4wcfgm5q/challenges",parent:"61",key:"612"},{stage_name:"\u7C7B\u7684\u7EE7\u627F",parent:0,key:7},{discipline_name:"\u7C7B\u7684\u7EE7\u627F",shixun_count:"1",video_count:"3",parent:7,key:"71"},{shixun_name:"\u7C7B\u7684\u7EE7\u627F(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/1eedcdb9ec43442c93780f04859c9aa9/631b8c88eb263877d24637d5b8d54dc5-hd.m3u8",parent:"71",key:"711"},{shixun_name:"\u7C7B\u7684\u7EE7\u627F(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/fc1e7d8d8140469ba1bc01ee64fcc3c1/9256d13f4a14ae17ba9cac9f895b8a9d-hd.m3u8",parent:"71",key:"712"},{shixun_name:"\u7C7B\u7684\u7EE7\u627F(3)",shixun_type:"\u89C6\u9891",url:"https://www.educoder.net/video/7806?subject_id=jpl5vs26",parent:"71",key:"713"},{shixun_name:"\u7EE7\u627F\u4E0E\u6D3E\u751F",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/f83ipgyo/challenges",parent:"71",key:"714"},{stage_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E",parent:0,key:8},{discipline_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E",shixun_count:"0",video_count:"1",parent:8,key:"81"},{shixun_name:"\u6A21\u677F\u4E0E\u7FA4\u4F53\u6570\u636E(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/8dcf418d2d16404d91af1780f669e549/eb538592d8a3b98e1c2f7f844f85b778-hd.m3u8",parent:"81",key:"811"},{stage_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93",parent:0,key:9},{discipline_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93",shixun_count:"0",video_count:"1",parent:9,key:"91"},{shixun_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/2f3154d695a542fbaba5c483d8d7f7a9/aea4302c51501634469ed4b91462c810-hd.m3u8",parent:"91",key:"911"},{shixun_name:"\u6CDB\u578B\u7A0B\u5E8F\u8BBE\u8BA1\u4E0EC++\u6807\u51C6\u6A21\u677F\u5E93(2)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/23be6a61e4e54db398b9172b1213a1f2/3f1e88f97957369e29ef2bde63640004-hd.m3u8",parent:"91",key:"912"},{stage_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165/\u8F93\u51FA",parent:0,key:10},{discipline_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165/\u8F93\u51FA",shixun_count:"0",video_count:"1",parent:10,key:"101"},{shixun_name:"\u6D41\u7C7B\u5E93\u4E0E\u8F93\u5165\u8F93\u51FA(1)",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c9e76b949ee847fbb89a926220526692/b80ff8d09a87bfde1064f5b73ae7c34b-hd.m3u8",parent:"101",key:"1011"},{stage_name:"\u5F02\u5E38\u5904\u7406",parent:0,key:9911},{discipline_name:"\u5F02\u5E38\u5904\u7406",shixun_count:"1",video_count:"1",parent:9911,key:"99111"},{shixun_name:"\u5F02\u5E38\u5904\u7406",shixun_type:"\u89C6\u9891",url:"https://video.educoder.net/c95499dd4c064584914e32fca9563717/98a8be24326e3eb35375713f5ccbb8bb-hd.m3u8",parent:"99111",key:"991111"},{shixun_name:"\u7F16\u5199\u5F02\u5E38\u5904\u7406\u7684\u7C7B",shixun_type:"\u5B9E\u8BAD",url:"https://www.educoder.net/shixuns/nlt6f7ae/challenges",parent:"99111",key:"991112"}].map(H=>(H.parent=Number(H.parent),H.key=Number(H.key),H))};var de=A(68906),ae=A(25039),Q=Object.defineProperty,ke=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,N=(H,D,B)=>D in H?Q(H,D,{enumerable:!0,configurable:!0,writable:!0,value:B}):H[D]=B,K=(H,D)=>{for(var B in D||(D={}))ve.call(D,B)&&N(H,B,D[B]);if(ke)for(var B of ke(D))f.call(D,B)&&N(H,B,D[B]);return H};const _e=({classroomList:H,loading:D,dispatch:B})=>{const[z]=(0,O.useSearchParams)(),[b]=(0,C.useState)(K({},(0,O.useParams)())),[oe,he]=(0,C.useState)("init"),[Y,Ne]=(0,C.useState)(""),Ke=(0,C.useRef)();(0,C.useEffect)(()=>{const J=z.get("tabId");J&&(he(J),b.status=J)},[b.categoryId,z.get("tabId")]);const Xe=J=>{he(J.key)},Se=[{name:"\u521D\u59CB\u5B66\u4E60",id:"init"},{name:"\u590D\u4E60\u5B66\u4E60",id:"review"},{name:"\u8003\u524D\u5B66\u4E60",id:"before"}],j=J=>{J.data.type==="playVideo"&&Ne(J.data.url)};(0,C.useEffect)(()=>{oe&&X(),window.addEventListener("message",j)},[oe]);const X=()=>{var J;(J=Ke.current.contentWindow)==null||J.postMessage({data:ye[oe]},"*")};return C.createElement("section",null,C.createElement(de.Z,{isLoading:D["classroomList/getClassroomAttendancesList"],tabDataSource:Se,isAdmin:(0,$.GJ)(),onTabMenuClick:Xe,defaultSelectedKeys:[oe]}),C.createElement("section",null,C.createElement(le.Z,{loading:D["classroomList/getClassroomAttendancesList"],active:!0,avatar:{size:40},paragraph:{rows:5},className:"mt30"},C.createElement("iframe",{src:"/knowledgegraph/parseTree.html",onLoad:X,className:V.iframe,ref:Ke}))),C.createElement(fe.default,{open:!!Y,onCancel:()=>Ne(""),width:800,footer:null,bodyStyle:{padding:0},centered:!0,destroyOnClose:!0},C.createElement(ae.Z,{src:Y,autoPlay:!0,toLog:!1})))};var Re=(0,O.connect)(({classroomList:H,loading:D,globalSetting:B})=>({classroomList:H,globalSetting:B,loading:D.effects}))(_e)},68906:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return ve}});var C=A(59301),O=A(95237),le=A(43604),fe=A(20834),V=A(38854),$=A(8591),ye=A(6848),de={tabMenuContainer:"tabMenuContainer___uf5IP",control:"control___GheLs",iconH:"iconH___Wzw_r",selectBtn:"selectBtn___mfEnI",selectBtn1:"selectBtn1___rJF8S"},ae=A(42203),Q=A(2119),ve=({isLoading:f,addText:N,tabDataSource:K,isAdmin:_e,dispatch:Re,classroomList:H,type:D,isExercise:B,defaultSelectedKeys:z,onTabMenuClick:b,getDropdownMenu:oe,showControlButton:he,buttonText:Y,buttonIcon:Ne="icon-tianjiadaohang",extraNode:Ke,user:Xe,onButtonClick:Se,isModelUser:j})=>{var X,J,M,Ae,ze;const ge=(0,ae.useParams)();return C.createElement("div",{className:de.tabMenuContainer},C.createElement(O.Z,null,C.createElement(le.Z,{flex:"1"},C.createElement(fe.default,{onSelect:Ee=>f?{}:b(Ee),mode:"horizontal",selectedKeys:z},K.map(Ee=>C.createElement(fe.default.Item,{key:typeof Ee.index=="number"?Ee.index:Ee.id},C.createElement("span",{className:"c-grey-666"},Ee.name),Ee.total!==void 0&&_e&&C.createElement("span",{className:"c-grey-999 ml20"},Ee.total||0))))),_e&&B&&C.createElement("i",{className:"iconfont icon-shezhi8",style:{display:"flex",alignItems:"center",cursor:"pointer"},onClick:()=>{Re({type:"classroomList/setActionTabs",payload:{key:"\u5728\u7EBF\u8003\u8BD5\u8BBE\u7F6E"}})}}),_e&&C.createElement(le.Z,{className:"mr20 gutter-row",style:{display:"flex",alignItems:"center",color:"#0152d9",paddingBottom:3}},B&&C.createElement(V.Z,{className:"mr15",placement:"bottom",arrow:!0,dropdownRender:()=>C.createElement(fe.default,null,C.createElement(fe.default.Item,{key:1,onClick:()=>{var Ee;if((0,Q.Rm)()&&!((Ee=H.AssistantObject.exercise)!=null&&Ee.can_download)){$.ZP.warning("\u60A8\u672A\u83B7\u53D6\u6B64\u6743\u9650\uFF0C\u9700\u5411\u8BFE\u5802\u7BA1\u7406\u5458\u7533\u8BF7\u6743\u9650\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD");return}Re({type:"classroomList/setActionTabs",payload:{key:"\u5BFC\u51FA\u6210\u7EE9",type:D,exportType:"exercise",category_id:ge.categoryId}})}},"\u5B66\u751F\u6210\u7EE9"),C.createElement(fe.default.Item,{key:3,onClick:()=>{var Ee;if((0,Q.Rm)()&&!((Ee=H.AssistantObject.exercise)!=null&&Ee.can_download)){$.ZP.warning("\u60A8\u672A\u83B7\u53D6\u6B64\u6743\u9650\uFF0C\u9700\u5411\u8BFE\u5802\u7BA1\u7406\u5458\u7533\u8BF7\u6743\u9650\u624D\u80FD\u4F7F\u7528\u6B64\u529F\u80FD");return}ae.history.push(`/classrooms/${ge==null?void 0:ge.coursesId}/exportlist/exercise_score,export_exercise_users`)}},"\u5386\u53F2\u5BFC\u51FA"))},C.createElement("div",{className:"c-blue font16 ml20 current",style:{marginTop:2}},C.createElement("span",{style:{color:"#666666",cursor:"pointer"}},C.createElement("i",{className:"iconfont icon-xiazai6"})))),C.createElement("div",{className:de.control},C.createElement("div",{className:de.extra},Ke),he&&(Y=="\u6DFB\u52A0\u76F4\u64AD"?C.createElement(V.Z,{menu:{items:(J=(X=[{label:C.createElement("div",{onClick:()=>{Se("\u5916\u94FE")}},"\u5916\u94FE\u76F4\u64AD"),key:"1",show:!0},j&&{label:C.createElement("div",{onClick:()=>{Se("\u5934\u6B4C")}},"\u5934\u6B4C\u76F4\u64AD"),key:"2",show:!0}])==null?void 0:X.filter(Ee=>Ee==null?void 0:Ee.show))==null?void 0:J.map(Ee=>({label:Ee==null?void 0:Ee.label,key:Ee==null?void 0:Ee.key}))}},C.createElement("span",{className:de.selectBtn},C.createElement("span",null,C.createElement("i",{className:`iconfont ${Ne}`})),C.createElement("span",null,Y))):C.createElement("span",{onClick:Se,style:{cursor:"pointer"},className:de.selectBtn},C.createElement("span",null,C.createElement("i",{className:`iconfont ${Ne}`})),C.createElement("span",null,Y))),!!oe&&C.createElement(V.Z,{disabled:((M=Xe==null?void 0:Xe.userInfo)==null?void 0:M.user_status)===2,className:"ml10",dropdownRender:oe},C.createElement("span",{className:((Ae=Xe==null?void 0:Xe.userInfo)==null?void 0:Ae.user_status)===2?de.selectBtn1:de.selectBtn},C.createElement("span",null,C.createElement("i",{className:"iconfont icon-tianjiadaohang"})),C.createElement(ye.Z,{title:((ze=Xe==null?void 0:Xe.userInfo)==null?void 0:ze.user_status)===2&&"\u6559\u5B66\u8BFE\u5802\u8BD5\u7528\u671F\u5DF2\u7ED3\u675F\uFF0C\u5E73\u53F0\u5DF2\u6682\u505C\u63D0\u4F9B\u5728\u7EBF\u8003\u8BD5\u521B\u5EFA\u529F\u80FD"},C.createElement("span",null,N||"\u521B\u5EFA\u8BD5\u5377"))))))))}},39171:function(Wt,Ve,A){"use strict";A.d(Ve,{BU:function(){return O},Dj:function(){return C},gH:function(){return le},vp:function(){return fe}});function C(V){try{V.mozRequestFullScreen?V.mozRequestFullScreen():V.webkitRequestFullScreen&&V.webkitRequestFullScreen()}catch($){console.log($,":e")}}function O(){window.top.document.webkitExitFullscreen?window.top.document.webkitExitFullscreen():document.exitFullscreen?window.top.document.exitFullscreen():document.msExitFullscreen?window.top.document.msExitFullscreen():document.mozCancelFullScreen&&window.top.document.mozCancelFullScreen()}const le=()=>{if(document.webkitExitFullscreen)return"webkitfullscreenchange";if(document.exitFullscreen)return"fullscreenchange";if(document.msExitFullscreen)return"msfullscreenchange";if(document.mozCancelFullScreen)return"mozfullscreenchange"};function fe(){var V=window.top.document.fullscreenElement||window.top.document.mozFullscreenElement||window.top.document.webkitFullscreenElement,$=document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled;return console.log("fullscreenElement",V),window.isFullScreen?window.isFullScreen:V!=null}},93726:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return tn}});class C{static install(){Object.setPrototypeOf=Object.setPrototypeOf||function(l,d){return l.__proto__=d,l},Object.assign=Object.assign||function(l){if(l==null)throw new TypeError("Cannot convert undefined or null to object");let d=Object(l);for(let g=1;g<arguments.length;g++){let v=arguments[g];if(v!=null)for(let S in v)v.hasOwnProperty(S)&&(d[S]=v[S])}return d},typeof self.Promise!="function"&&A(3867).polyfill()}}C.install();var O=C,le=A(86204),fe=A.n(le);class V{static e(l,d){(!l||V.FORCE_GLOBAL_TAG)&&(l=V.GLOBAL_TAG);let g=`[${l}] > ${d}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","error",g),V.ENABLE_ERROR&&(console.error?console.error(g):console.warn?console.warn(g):console.log(g))}static i(l,d){(!l||V.FORCE_GLOBAL_TAG)&&(l=V.GLOBAL_TAG);let g=`[${l}] > ${d}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","info",g),V.ENABLE_INFO&&(console.info?console.info(g):console.log(g))}static w(l,d){(!l||V.FORCE_GLOBAL_TAG)&&(l=V.GLOBAL_TAG);let g=`[${l}] > ${d}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","warn",g),V.ENABLE_WARN&&(console.warn?console.warn(g):console.log(g))}static d(l,d){(!l||V.FORCE_GLOBAL_TAG)&&(l=V.GLOBAL_TAG);let g=`[${l}] > ${d}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","debug",g),V.ENABLE_DEBUG&&(console.debug?console.debug(g):console.log(g))}static v(l,d){(!l||V.FORCE_GLOBAL_TAG)&&(l=V.GLOBAL_TAG);let g=`[${l}] > ${d}`;V.ENABLE_CALLBACK&&V.emitter.emit("log","verbose",g),V.ENABLE_VERBOSE&&console.log(g)}}V.GLOBAL_TAG="flv.js",V.FORCE_GLOBAL_TAG=!1,V.ENABLE_ERROR=!0,V.ENABLE_INFO=!0,V.ENABLE_WARN=!0,V.ENABLE_DEBUG=!0,V.ENABLE_VERBOSE=!0,V.ENABLE_CALLBACK=!1,V.emitter=new(fe());var $=V;class ye{constructor(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}reset(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}addBytes(l){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=l,this._totalBytes+=l):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=l,this._totalBytes+=l):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=l,this._totalBytes+=l,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let l=(this._now()-this._lastCheckpoint)/1e3;return l==0&&(l=1),this._intervalBytes/l/1024}get lastSecondKBps(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}get averageKBps(){let l=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/l/1024}}var de=ye;class ae{constructor(l){this._message=l}get name(){return"RuntimeException"}get message(){return this._message}toString(){return this.name+": "+this.message}}class Q extends ae{constructor(l){super(l)}get name(){return"IllegalStateException"}}class ke extends ae{constructor(l){super(l)}get name(){return"InvalidArgumentException"}}class ve extends ae{constructor(l){super(l)}get name(){return"NotImplementedException"}}const f={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},N={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"};class K{constructor(l){this._type=l||"undefined",this._status=f.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}destroy(){this._status=f.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}isWorking(){return this._status===f.kConnecting||this._status===f.kBuffering}get type(){return this._type}get status(){return this._status}get needStashBuffer(){return this._needStash}get onContentLengthKnown(){return this._onContentLengthKnown}set onContentLengthKnown(l){this._onContentLengthKnown=l}get onURLRedirect(){return this._onURLRedirect}set onURLRedirect(l){this._onURLRedirect=l}get onDataArrival(){return this._onDataArrival}set onDataArrival(l){this._onDataArrival=l}get onError(){return this._onError}set onError(l){this._onError=l}get onComplete(){return this._onComplete}set onComplete(l){this._onComplete=l}open(l,d){throw new ve("Unimplemented abstract function!")}abort(){throw new ve("Unimplemented abstract function!")}}let _e={};function Re(){let Be=self.navigator.userAgent.toLowerCase(),l=/(edge)\/([\w.]+)/.exec(Be)||/(opr)[\/]([\w.]+)/.exec(Be)||/(chrome)[ \/]([\w.]+)/.exec(Be)||/(iemobile)[\/]([\w.]+)/.exec(Be)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(Be)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(Be)||/(webkit)[ \/]([\w.]+)/.exec(Be)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(Be)||/(msie) ([\w.]+)/.exec(Be)||Be.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(Be)||Be.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(Be)||[],d=/(ipad)/.exec(Be)||/(ipod)/.exec(Be)||/(windows phone)/.exec(Be)||/(iphone)/.exec(Be)||/(kindle)/.exec(Be)||/(android)/.exec(Be)||/(windows)/.exec(Be)||/(mac)/.exec(Be)||/(linux)/.exec(Be)||/(cros)/.exec(Be)||[],g={browser:l[5]||l[3]||l[1]||"",version:l[2]||l[4]||"0",majorVersion:l[4]||l[2]||"0",platform:d[0]||""},v={};if(g.browser){v[g.browser]=!0;let S=g.majorVersion.split(".");v.version={major:parseInt(g.majorVersion,10),string:g.version},S.length>1&&(v.version.minor=parseInt(S[1],10)),S.length>2&&(v.version.build=parseInt(S[2],10))}if(g.platform&&(v[g.platform]=!0),(v.chrome||v.opr||v.safari)&&(v.webkit=!0),v.rv||v.iemobile){v.rv&&delete v.rv;let S="msie";g.browser=S,v[S]=!0}if(v.edge){delete v.edge;let S="msedge";g.browser=S,v[S]=!0}if(v.opr){let S="opera";g.browser=S,v[S]=!0}if(v.safari&&v.android){let S="android";g.browser=S,v[S]=!0}v.name=g.browser,v.platform=g.platform;for(let S in _e)_e.hasOwnProperty(S)&&delete _e[S];Object.assign(_e,v)}Re();var H=_e;class D extends K{static isSupported(){try{let l=H.msedge&&H.version.minor>=15048,d=H.msedge?l:!0;return self.fetch&&self.ReadableStream&&d}catch(l){return!1}}constructor(l,d){super("fetch-stream-loader"),this.TAG="FetchStreamLoader",this._seekHandler=l,this._config=d,this._needStash=!0,this._requestAbort=!1,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),super.destroy()}open(l,d){this._dataSource=l,this._range=d;let g=l.url;this._config.reuseRedirectedURL&&l.redirectedURL!=null&&(g=l.redirectedURL);let v=this._seekHandler.getConfig(g,d),S=new self.Headers;if(typeof v.headers=="object"){let q=v.headers;for(let Ye in q)q.hasOwnProperty(Ye)&&S.append(Ye,q[Ye])}let U={method:"GET",headers:S,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(let q in this._config.headers)S.append(q,this._config.headers[q]);l.cors===!1&&(U.mode="same-origin"),l.withCredentials&&(U.credentials="include"),l.referrerPolicy&&(U.referrerPolicy=l.referrerPolicy),this._status=f.kConnecting,self.fetch(v.url,U).then(q=>{if(this._requestAbort){this._requestAbort=!1,this._status=f.kIdle;return}if(q.ok&&q.status>=200&&q.status<=299){if(q.url!==v.url&&this._onURLRedirect){let $e=this._seekHandler.removeURLParameters(q.url);this._onURLRedirect($e)}let Ye=q.headers.get("Content-Length");return Ye!=null&&(this._contentLength=parseInt(Ye),this._contentLength!==0&&this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)),this._pump.call(this,q.body.getReader())}else if(this._status=f.kError,this._onError)this._onError(N.HTTP_STATUS_CODE_INVALID,{code:q.status,msg:q.statusText});else throw new ae("FetchStreamLoader: Http code invalid, "+q.status+" "+q.statusText)}).catch(q=>{if(this._status=f.kError,this._onError)this._onError(N.EXCEPTION,{code:-1,msg:q.message});else throw q})}abort(){this._requestAbort=!0}_pump(l){return l.read().then(d=>{if(d.done)if(this._contentLength!==null&&this._receivedLength<this._contentLength){this._status=f.kError;let g=N.EARLY_EOF,v={code:-1,msg:"Fetch stream meet Early-EOF"};if(this._onError)this._onError(g,v);else throw new ae(v.msg)}else this._status=f.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1);else{if(this._requestAbort===!0)return this._requestAbort=!1,this._status=f.kComplete,l.cancel();this._status=f.kBuffering;let g=d.value.buffer,v=this._range.from+this._receivedLength;this._receivedLength+=g.byteLength,this._onDataArrival&&this._onDataArrival(g,v,this._receivedLength),this._pump(l)}}).catch(d=>{if(d.code===11&&H.msedge)return;this._status=f.kError;let g=0,v=null;if((d.code===19||d.message==="network error")&&(this._contentLength===null||this._contentLength!==null&&this._receivedLength<this._contentLength)?(g=N.EARLY_EOF,v={code:d.code,msg:"Fetch stream meet Early-EOF"}):(g=N.EXCEPTION,v={code:d.code,msg:d.message}),this._onError)this._onError(g,v);else throw new ae(v.msg)})}}var B=D;class z extends K{static isSupported(){try{let l=new XMLHttpRequest;return l.open("GET","https://example.com",!0),l.responseType="moz-chunked-arraybuffer",l.responseType==="moz-chunked-arraybuffer"}catch(l){return $.w("MozChunkedLoader",l.message),!1}}constructor(l,d){super("xhr-moz-chunked-loader"),this.TAG="MozChunkedLoader",this._seekHandler=l,this._config=d,this._needStash=!0,this._xhr=null,this._requestAbort=!1,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),super.destroy()}open(l,d){this._dataSource=l,this._range=d;let g=l.url;this._config.reuseRedirectedURL&&l.redirectedURL!=null&&(g=l.redirectedURL);let v=this._seekHandler.getConfig(g,d);this._requestURL=v.url;let S=this._xhr=new XMLHttpRequest;if(S.open("GET",v.url,!0),S.responseType="moz-chunked-arraybuffer",S.onreadystatechange=this._onReadyStateChange.bind(this),S.onprogress=this._onProgress.bind(this),S.onloadend=this._onLoadEnd.bind(this),S.onerror=this._onXhrError.bind(this),l.withCredentials&&(S.withCredentials=!0),typeof v.headers=="object"){let U=v.headers;for(let q in U)U.hasOwnProperty(q)&&S.setRequestHeader(q,U[q])}if(typeof this._config.headers=="object"){let U=this._config.headers;for(let q in U)U.hasOwnProperty(q)&&S.setRequestHeader(q,U[q])}this._status=f.kConnecting,S.send()}abort(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=f.kComplete}_onReadyStateChange(l){let d=l.target;if(d.readyState===2){if(d.responseURL!=null&&d.responseURL!==this._requestURL&&this._onURLRedirect){let g=this._seekHandler.removeURLParameters(d.responseURL);this._onURLRedirect(g)}if(d.status!==0&&(d.status<200||d.status>299))if(this._status=f.kError,this._onError)this._onError(N.HTTP_STATUS_CODE_INVALID,{code:d.status,msg:d.statusText});else throw new ae("MozChunkedLoader: Http code invalid, "+d.status+" "+d.statusText);else this._status=f.kBuffering}}_onProgress(l){if(this._status===f.kError)return;this._contentLength===null&&l.total!==null&&l.total!==0&&(this._contentLength=l.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));let d=l.target.response,g=this._range.from+this._receivedLength;this._receivedLength+=d.byteLength,this._onDataArrival&&this._onDataArrival(d,g,this._receivedLength)}_onLoadEnd(l){if(this._requestAbort===!0){this._requestAbort=!1;return}else if(this._status===f.kError)return;this._status=f.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)}_onXhrError(l){this._status=f.kError;let d=0,g=null;if(this._contentLength&&l.loaded<this._contentLength?(d=N.EARLY_EOF,g={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(d=N.EXCEPTION,g={code:-1,msg:l.constructor.name+" "+l.type}),this._onError)this._onError(d,g);else throw new ae(g.msg)}}var b=z;class oe extends null{static isSupported(){try{if(typeof self.MSStream=="undefined"||typeof self.MSStreamReader=="undefined")return!1;let l=new XMLHttpRequest;return l.open("GET","https://example.com",!0),l.responseType="ms-stream",l.responseType==="ms-stream"}catch(l){return Log.w("MSStreamLoader",l.message),!1}}constructor(l,d){super("xhr-msstream-loader"),this.TAG="MSStreamLoader",this._seekHandler=l,this._config=d,this._needStash=!0,this._xhr=null,this._reader=null,this._totalRange=null,this._currentRange=null,this._currentRequestURL=null,this._currentRedirectedURL=null,this._contentLength=null,this._receivedLength=0,this._bufferLimit=16*1024*1024,this._lastTimeBufferSize=0,this._isReconnecting=!1}destroy(){this.isWorking()&&this.abort(),this._reader&&(this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr=null),super.destroy()}open(l,d){this._internalOpen(l,d,!1)}_internalOpen(l,d,g){this._dataSource=l,g?this._currentRange=d:this._totalRange=d;let v=l.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?v=this._currentRedirectedURL:l.redirectedURL!=null&&(v=l.redirectedURL));let S=this._seekHandler.getConfig(v,d);this._currentRequestURL=S.url;let U=this._reader=new self.MSStreamReader;U.onprogress=this._msrOnProgress.bind(this),U.onload=this._msrOnLoad.bind(this),U.onerror=this._msrOnError.bind(this);let q=this._xhr=new XMLHttpRequest;if(q.open("GET",S.url,!0),q.responseType="ms-stream",q.onreadystatechange=this._xhrOnReadyStateChange.bind(this),q.onerror=this._xhrOnError.bind(this),l.withCredentials&&(q.withCredentials=!0),typeof S.headers=="object"){let Ye=S.headers;for(let $e in Ye)Ye.hasOwnProperty($e)&&q.setRequestHeader($e,Ye[$e])}if(typeof this._config.headers=="object"){let Ye=this._config.headers;for(let $e in Ye)Ye.hasOwnProperty($e)&&q.setRequestHeader($e,Ye[$e])}this._isReconnecting?this._isReconnecting=!1:this._status=LoaderStatus.kConnecting,q.send()}abort(){this._internalAbort(),this._status=LoaderStatus.kComplete}_internalAbort(){this._reader&&(this._reader.readyState===1&&this._reader.abort(),this._reader.onprogress=null,this._reader.onload=null,this._reader.onerror=null,this._reader=null),this._xhr&&(this._xhr.abort(),this._xhr.onreadystatechange=null,this._xhr=null)}_xhrOnReadyStateChange(l){let d=l.target;if(d.readyState===2)if(d.status>=200&&d.status<=299){if(this._status=LoaderStatus.kBuffering,d.responseURL!=null){let v=this._seekHandler.removeURLParameters(d.responseURL);d.responseURL!==this._currentRequestURL&&v!==this._currentRedirectedURL&&(this._currentRedirectedURL=v,this._onURLRedirect&&this._onURLRedirect(v))}let g=d.getResponseHeader("Content-Length");if(g!=null&&this._contentLength==null){let v=parseInt(g);v>0&&(this._contentLength=v,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else if(this._status=LoaderStatus.kError,this._onError)this._onError(LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:d.status,msg:d.statusText});else throw new RuntimeException("MSStreamLoader: Http code invalid, "+d.status+" "+d.statusText);else if(d.readyState===3&&d.status>=200&&d.status<=299){this._status=LoaderStatus.kBuffering;let g=d.response;this._reader.readAsArrayBuffer(g)}}_xhrOnError(l){this._status=LoaderStatus.kError;let d=LoaderErrors.EXCEPTION,g={code:-1,msg:l.constructor.name+" "+l.type};if(this._onError)this._onError(d,g);else throw new RuntimeException(g.msg)}_msrOnProgress(l){let g=l.target.result;if(g==null){this._doReconnectIfNeeded();return}let v=g.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=g.byteLength;let S=this._totalRange.from+this._receivedLength;this._receivedLength+=v.byteLength,this._onDataArrival&&this._onDataArrival(v,S,this._receivedLength),g.byteLength>=this._bufferLimit&&(Log.v(this.TAG,`MSStream buffer exceeded max size near ${S+v.byteLength}, reconnecting...`),this._doReconnectIfNeeded())}_doReconnectIfNeeded(){if(this._contentLength==null||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();let l={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,l,!0)}}_msrOnLoad(l){this._status=LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)}_msrOnError(l){this._status=LoaderStatus.kError;let d=0,g=null;if(this._contentLength&&this._receivedLength<this._contentLength?(d=LoaderErrors.EARLY_EOF,g={code:-1,msg:"MSStream meet Early-Eof"}):(d=LoaderErrors.EARLY_EOF,g={code:-1,msg:l.constructor.name+" "+l.type}),this._onError)this._onError(d,g);else throw new RuntimeException(g.msg)}}var he=null;class Y extends K{static isSupported(){try{let l=new XMLHttpRequest;return l.open("GET","https://example.com",!0),l.responseType="arraybuffer",l.responseType==="arraybuffer"}catch(l){return $.w("RangeLoader",l.message),!1}}constructor(l,d){super("xhr-range-loader"),this.TAG="RangeLoader",this._seekHandler=l,this._config=d,this._needStash=!1,this._chunkSizeKBList=[128,256,384,512,768,1024,1536,2048,3072,4096,5120,6144,7168,8192],this._currentChunkSizeKB=384,this._currentSpeedNormalized=0,this._zeroSpeedChunkCount=0,this._xhr=null,this._speedSampler=new de,this._requestAbort=!1,this._waitForTotalLength=!1,this._totalLengthReceived=!1,this._currentRequestURL=null,this._currentRedirectedURL=null,this._currentRequestRange=null,this._totalLength=null,this._contentLength=null,this._receivedLength=0,this._lastTimeLoaded=0}destroy(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr=null),super.destroy()}get currentSpeed(){return this._speedSampler.lastSecondKBps}open(l,d){this._dataSource=l,this._range=d,this._status=f.kConnecting;let g=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(g=!0,this._totalLength=this._dataSource.filesize),!this._totalLengthReceived&&!g?(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1})):this._openSubRange()}_openSubRange(){let l=this._currentChunkSizeKB*1024,d=this._range.from+this._receivedLength,g=d+l;this._contentLength!=null&&g-this._range.from>=this._contentLength&&(g=this._range.from+this._contentLength-1),this._currentRequestRange={from:d,to:g},this._internalOpen(this._dataSource,this._currentRequestRange)}_internalOpen(l,d){this._lastTimeLoaded=0;let g=l.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?g=this._currentRedirectedURL:l.redirectedURL!=null&&(g=l.redirectedURL));let v=this._seekHandler.getConfig(g,d);this._currentRequestURL=v.url;let S=this._xhr=new XMLHttpRequest;if(S.open("GET",v.url,!0),S.responseType="arraybuffer",S.onreadystatechange=this._onReadyStateChange.bind(this),S.onprogress=this._onProgress.bind(this),S.onload=this._onLoad.bind(this),S.onerror=this._onXhrError.bind(this),l.withCredentials&&(S.withCredentials=!0),typeof v.headers=="object"){let U=v.headers;for(let q in U)U.hasOwnProperty(q)&&S.setRequestHeader(q,U[q])}if(typeof this._config.headers=="object"){let U=this._config.headers;for(let q in U)U.hasOwnProperty(q)&&S.setRequestHeader(q,U[q])}S.send()}abort(){this._requestAbort=!0,this._internalAbort(),this._status=f.kComplete}_internalAbort(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}_onReadyStateChange(l){let d=l.target;if(d.readyState===2){if(d.responseURL!=null){let g=this._seekHandler.removeURLParameters(d.responseURL);d.responseURL!==this._currentRequestURL&&g!==this._currentRedirectedURL&&(this._currentRedirectedURL=g,this._onURLRedirect&&this._onURLRedirect(g))}if(d.status>=200&&d.status<=299){if(this._waitForTotalLength)return;this._status=f.kBuffering}else if(this._status=f.kError,this._onError)this._onError(N.HTTP_STATUS_CODE_INVALID,{code:d.status,msg:d.statusText});else throw new ae("RangeLoader: Http code invalid, "+d.status+" "+d.statusText)}}_onProgress(l){if(this._status===f.kError)return;if(this._contentLength===null){let g=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,g=!0;let v=l.total;this._internalAbort(),v!=null&v!==0&&(this._totalLength=v)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,g){this._openSubRange();return}this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}let d=l.loaded-this._lastTimeLoaded;this._lastTimeLoaded=l.loaded,this._speedSampler.addBytes(d)}_normalizeSpeed(l){let d=this._chunkSizeKBList,g=d.length-1,v=0,S=0,U=g;if(l<d[0])return d[0];for(;S<=U;){if(v=S+Math.floor((U-S)/2),v===g||l>=d[v]&&l<d[v+1])return d[v];d[v]<l?S=v+1:U=v-1}}_onLoad(l){if(this._status===f.kError)return;if(this._waitForTotalLength){this._waitForTotalLength=!1;return}this._lastTimeLoaded=0;let d=this._speedSampler.lastSecondKBps;if(d===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(d=this._speedSampler.currentKBps)),d!==0){let U=this._normalizeSpeed(d);this._currentSpeedNormalized!==U&&(this._currentSpeedNormalized=U,this._currentChunkSizeKB=U)}let g=l.target.response,v=this._range.from+this._receivedLength;this._receivedLength+=g.byteLength;let S=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():S=!0,this._onDataArrival&&this._onDataArrival(g,v,this._receivedLength),S&&(this._status=f.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}_onXhrError(l){this._status=f.kError;let d=0,g=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(d=N.EARLY_EOF,g={code:-1,msg:"RangeLoader meet Early-Eof"}):(d=N.EXCEPTION,g={code:-1,msg:l.constructor.name+" "+l.type}),this._onError)this._onError(d,g);else throw new ae(g.msg)}}var Ne=Y;class Ke extends K{static isSupported(){try{return typeof self.WebSocket!="undefined"}catch(l){return!1}}constructor(){super("websocket-loader"),this.TAG="WebSocketLoader",this._needStash=!0,this._ws=null,this._requestAbort=!1,this._receivedLength=0}destroy(){this._ws&&this.abort(),super.destroy()}open(l){try{let d=this._ws=new self.WebSocket(l.url);d.binaryType="arraybuffer",d.onopen=this._onWebSocketOpen.bind(this),d.onclose=this._onWebSocketClose.bind(this),d.onmessage=this._onWebSocketMessage.bind(this),d.onerror=this._onWebSocketError.bind(this),this._status=f.kConnecting}catch(d){this._status=f.kError;let g={code:d.code,msg:d.message};if(this._onError)this._onError(N.EXCEPTION,g);else throw new ae(g.msg)}}abort(){let l=this._ws;l&&(l.readyState===0||l.readyState===1)&&(this._requestAbort=!0,l.close()),this._ws=null,this._status=f.kComplete}_onWebSocketOpen(l){this._status=f.kBuffering}_onWebSocketClose(l){if(this._requestAbort===!0){this._requestAbort=!1;return}this._status=f.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)}_onWebSocketMessage(l){if(l.data instanceof ArrayBuffer)this._dispatchArrayBuffer(l.data);else if(l.data instanceof Blob){let d=new FileReader;d.onload=()=>{this._dispatchArrayBuffer(d.result)},d.readAsArrayBuffer(l.data)}else{this._status=f.kError;let d={code:-1,msg:"Unsupported WebSocket message type: "+l.data.constructor.name};if(this._onError)this._onError(N.EXCEPTION,d);else throw new ae(d.msg)}}_dispatchArrayBuffer(l){let d=l,g=this._receivedLength;this._receivedLength+=d.byteLength,this._onDataArrival&&this._onDataArrival(d,g,this._receivedLength)}_onWebSocketError(l){this._status=f.kError;let d={code:l.code,msg:l.message};if(this._onError)this._onError(N.EXCEPTION,d);else throw new ae(d.msg)}}var Xe=Ke;class Se{constructor(l){this._zeroStart=l||!1}getConfig(l,d){let g={};if(d.from!==0||d.to!==-1){let v;d.to!==-1?v=`bytes=${d.from.toString()}-${d.to.toString()}`:v=`bytes=${d.from.toString()}-`,g.Range=v}else this._zeroStart&&(g.Range="bytes=0-");return{url:l,headers:g}}removeURLParameters(l){return l}}var j=Se;class X{constructor(l,d){this._startName=l,this._endName=d}getConfig(l,d){let g=l;if(d.from!==0||d.to!==-1){let v=!0;g.indexOf("?")===-1&&(g+="?",v=!1),v&&(g+="&"),g+=`${this._startName}=${d.from.toString()}`,d.to!==-1&&(g+=`&${this._endName}=${d.to.toString()}`)}return{url:g,headers:{}}}removeURLParameters(l){let d=l.split("?")[0],g,v=l.indexOf("?");v!==-1&&(g=l.substring(v+1));let S="";if(g!=null&&g.length>0){let U=g.split("&");for(let q=0;q<U.length;q++){let Ye=U[q].split("="),$e=q>0;Ye[0]!==this._startName&&Ye[0]!==this._endName&&($e&&(S+="&"),S+=U[q])}}return S.length===0?d:d+"?"+S}}var J=X;class M{constructor(l,d,g){this.TAG="IOController",this._config=d,this._extraData=g,this._stashInitialSize=1024*384,d.stashInitialSize!=null&&d.stashInitialSize>0&&(this._stashInitialSize=d.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=1024*1024*3,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,d.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=l,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(l.url),this._refTotalLength=l.filesize?l.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new de,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}destroy(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}isWorking(){return this._loader&&this._loader.isWorking()&&!this._paused}isPaused(){return this._paused}get status(){return this._loader.status}get extraData(){return this._extraData}set extraData(l){this._extraData=l}get onDataArrival(){return this._onDataArrival}set onDataArrival(l){this._onDataArrival=l}get onSeeked(){return this._onSeeked}set onSeeked(l){this._onSeeked=l}get onError(){return this._onError}set onError(l){this._onError=l}get onComplete(){return this._onComplete}set onComplete(l){this._onComplete=l}get onRedirect(){return this._onRedirect}set onRedirect(l){this._onRedirect=l}get onRecoveredEarlyEof(){return this._onRecoveredEarlyEof}set onRecoveredEarlyEof(l){this._onRecoveredEarlyEof=l}get currentURL(){return this._dataSource.url}get hasRedirect(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null}get currentRedirectedURL(){return this._redirectedURL||this._dataSource.redirectedURL}get currentSpeed(){return this._loaderClass===Ne?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}get loaderType(){return this._loader.type}_selectSeekHandler(){let l=this._config;if(l.seekType==="range")this._seekHandler=new j(this._config.rangeLoadZeroStart);else if(l.seekType==="param"){let d=l.seekParamStart||"bstart",g=l.seekParamEnd||"bend";this._seekHandler=new J(d,g)}else if(l.seekType==="custom"){if(typeof l.customSeekHandler!="function")throw new ke("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new l.customSeekHandler}else throw new ke(`Invalid seekType in config: ${l.seekType}`)}_selectLoader(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=Xe;else if(B.isSupported())this._loaderClass=B;else if(b.isSupported())this._loaderClass=b;else if(Ne.isSupported())this._loaderClass=Ne;else throw new ae("Your browser doesn't support xhr with arraybuffer responseType!")}_createLoader(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}open(l){this._currentRange={from:0,to:-1},l&&(this._currentRange.from=l),this._speedSampler.reset(),l||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}abort(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}pause(){this.isWorking()&&(this._loader.abort(),this._stashUsed!==0?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}resume(){if(this._paused){this._paused=!1;let l=this._resumeFrom;this._resumeFrom=0,this._internalSeek(l,!0)}}seek(l){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(l,!0)}_internalSeek(l,d){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(d),this._loader.destroy(),this._loader=null;let g={from:l,to:-1};this._currentRange={from:g.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,g),this._onSeeked&&this._onSeeked()}updateUrl(l){if(!l||typeof l!="string"||l.length===0)throw new ke("Url must be a non-empty string!");this._dataSource.url=l}_expandBuffer(l){let d=this._stashSize;for(;d+1024*1024*1<l;)d*=2;if(d+=1024*1024*1,d===this._bufferSize)return;let g=new ArrayBuffer(d);if(this._stashUsed>0){let v=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(g,0,d).set(v,0)}this._stashBuffer=g,this._bufferSize=d}_normalizeSpeed(l){let d=this._speedNormalizeList,g=d.length-1,v=0,S=0,U=g;if(l<d[0])return d[0];for(;S<=U;){if(v=S+Math.floor((U-S)/2),v===g||l>=d[v]&&l<d[v+1])return d[v];d[v]<l?S=v+1:U=v-1}}_adjustStashSize(l){let d=0;this._config.isLive||l<512?d=l:l>=512&&l<=1024?d=Math.floor(l*1.5):d=l*2,d>8192&&(d=8192);let g=d*1024+1024*1024*1;this._bufferSize<g&&this._expandBuffer(g),this._stashSize=d*1024}_dispatchChunks(l,d){return this._currentRange.to=d+l.byteLength-1,this._onDataArrival(l,d)}_onURLRedirect(l){this._redirectedURL=l,this._onRedirect&&this._onRedirect(l)}_onContentLengthKnown(l){l&&this._fullRequestFlag&&(this._totalLength=l,this._fullRequestFlag=!1)}_onLoaderChunkArrival(l,d,g){if(!this._onDataArrival)throw new Q("IOController: No existing consumer (onDataArrival) callback!");if(this._paused)return;this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(l.byteLength);let v=this._speedSampler.lastSecondKBps;if(v!==0){let S=this._normalizeSpeed(v);this._speedNormalized!==S&&(this._speedNormalized=S,this._adjustStashSize(S))}if(this._enableStash)if(this._stashUsed===0&&this._stashByteStart===0&&(this._stashByteStart=d),this._stashUsed+l.byteLength<=this._stashSize)new Uint8Array(this._stashBuffer,0,this._stashSize).set(new Uint8Array(l),this._stashUsed),this._stashUsed+=l.byteLength;else{let S=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(this._stashUsed>0){let U=this._stashBuffer.slice(0,this._stashUsed),q=this._dispatchChunks(U,this._stashByteStart);if(q<U.byteLength){if(q>0){let Ye=new Uint8Array(U,q);S.set(Ye,0),this._stashUsed=Ye.byteLength,this._stashByteStart+=q}}else this._stashUsed=0,this._stashByteStart+=q;this._stashUsed+l.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+l.byteLength),S=new Uint8Array(this._stashBuffer,0,this._bufferSize)),S.set(new Uint8Array(l),this._stashUsed),this._stashUsed+=l.byteLength}else{let U=this._dispatchChunks(l,d);if(U<l.byteLength){let q=l.byteLength-U;q>this._bufferSize&&(this._expandBuffer(q),S=new Uint8Array(this._stashBuffer,0,this._bufferSize)),S.set(new Uint8Array(l,U),0),this._stashUsed+=q,this._stashByteStart=d+U}}}else if(this._stashUsed===0){let S=this._dispatchChunks(l,d);if(S<l.byteLength){let U=l.byteLength-S;U>this._bufferSize&&this._expandBuffer(U),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(l,S),0),this._stashUsed+=U,this._stashByteStart=d+S}}else{this._stashUsed+l.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+l.byteLength);let S=new Uint8Array(this._stashBuffer,0,this._bufferSize);S.set(new Uint8Array(l),this._stashUsed),this._stashUsed+=l.byteLength;let U=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(U<this._stashUsed&&U>0){let q=new Uint8Array(this._stashBuffer,U);S.set(q,0)}this._stashUsed-=U,this._stashByteStart+=U}}_flushStashBuffer(l){if(this._stashUsed>0){let d=this._stashBuffer.slice(0,this._stashUsed),g=this._dispatchChunks(d,this._stashByteStart),v=d.byteLength-g;if(g<d.byteLength)if(l)$.w(this.TAG,`${v} bytes unconsumed data remain when flush buffer, dropped`);else{if(g>0){let S=new Uint8Array(this._stashBuffer,0,this._bufferSize),U=new Uint8Array(d,g);S.set(U,0),this._stashUsed=U.byteLength,this._stashByteStart+=g}return 0}return this._stashUsed=0,this._stashByteStart=0,v}return 0}_onLoaderComplete(l,d){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}_onLoaderError(l,d){switch($.e(this.TAG,`Loader error, code = ${d.code}, msg = ${d.msg}`),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,l=N.UNRECOVERABLE_EARLY_EOF),l){case N.EARLY_EOF:{if(!this._config.isLive&&this._totalLength){let g=this._currentRange.to+1;g<this._totalLength&&($.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(g,!1));return}l=N.UNRECOVERABLE_EARLY_EOF;break}case N.UNRECOVERABLE_EARLY_EOF:case N.CONNECTING_TIMEOUT:case N.HTTP_STATUS_CODE_INVALID:case N.EXCEPTION:break}if(this._onError)this._onError(l,d);else throw new ae("IOException: "+d.msg)}}var Ae=M;const ze={enableWorker:!1,enableStashBuffer:!0,stashInitialSize:void 0,isLive:!1,lazyLoad:!0,lazyLoadMaxDuration:3*60,lazyLoadRecoverDuration:30,deferLoadAfterSourceOpen:!0,autoCleanupMaxBackwardDuration:3*60,autoCleanupMinBackwardDuration:2*60,statisticsInfoReportInterval:600,fixAudioTimestampGap:!0,accurateSeek:!1,seekType:"range",seekParamStart:"bstart",seekParamEnd:"bend",rangeLoadZeroStart:!1,customSeekHandler:void 0,reuseRedirectedURL:!1,headers:void 0,customLoader:void 0};function ge(){return Object.assign({},ze)}class Ee{static supportMSEH264Playback(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}static supportNetworkStreamIO(){let l=new Ae({},ge()),d=l.loaderType;return l.destroy(),d=="fetch-stream-loader"||d=="xhr-moz-chunked-loader"}static getNetworkLoaderTypeName(){let l=new Ae({},ge()),d=l.loaderType;return l.destroy(),d}static supportNativeMediaPlayback(l){Ee.videoElement==null&&(Ee.videoElement=window.document.createElement("video"));let d=Ee.videoElement.canPlayType(l);return d==="probably"||d=="maybe"}static getFeatureList(){let l={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return l.mseFlvPlayback=Ee.supportMSEH264Playback(),l.networkStreamIO=Ee.supportNetworkStreamIO(),l.networkLoaderName=Ee.getNetworkLoaderTypeName(),l.mseLiveFlvPlayback=l.mseFlvPlayback&&l.networkStreamIO,l.nativeMP4H264Playback=Ee.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),l.nativeWebmVP8Playback=Ee.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),l.nativeWebmVP9Playback=Ee.supportNativeMediaPlayback('video/webm; codecs="vp9"'),l}}var rt=Ee,Fe={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"};class He{static get forceGlobalTag(){return $.FORCE_GLOBAL_TAG}static set forceGlobalTag(l){$.FORCE_GLOBAL_TAG=l,He._notifyChange()}static get globalTag(){return $.GLOBAL_TAG}static set globalTag(l){$.GLOBAL_TAG=l,He._notifyChange()}static get enableAll(){return $.ENABLE_VERBOSE&&$.ENABLE_DEBUG&&$.ENABLE_INFO&&$.ENABLE_WARN&&$.ENABLE_ERROR}static set enableAll(l){$.ENABLE_VERBOSE=l,$.ENABLE_DEBUG=l,$.ENABLE_INFO=l,$.ENABLE_WARN=l,$.ENABLE_ERROR=l,He._notifyChange()}static get enableDebug(){return $.ENABLE_DEBUG}static set enableDebug(l){$.ENABLE_DEBUG=l,He._notifyChange()}static get enableVerbose(){return $.ENABLE_VERBOSE}static set enableVerbose(l){$.ENABLE_VERBOSE=l,He._notifyChange()}static get enableInfo(){return $.ENABLE_INFO}static set enableInfo(l){$.ENABLE_INFO=l,He._notifyChange()}static get enableWarn(){return $.ENABLE_WARN}static set enableWarn(l){$.ENABLE_WARN=l,He._notifyChange()}static get enableError(){return $.ENABLE_ERROR}static set enableError(l){$.ENABLE_ERROR=l,He._notifyChange()}static getConfig(){return{globalTag:$.GLOBAL_TAG,forceGlobalTag:$.FORCE_GLOBAL_TAG,enableVerbose:$.ENABLE_VERBOSE,enableDebug:$.ENABLE_DEBUG,enableInfo:$.ENABLE_INFO,enableWarn:$.ENABLE_WARN,enableError:$.ENABLE_ERROR,enableCallback:$.ENABLE_CALLBACK}}static applyConfig(l){$.GLOBAL_TAG=l.globalTag,$.FORCE_GLOBAL_TAG=l.forceGlobalTag,$.ENABLE_VERBOSE=l.enableVerbose,$.ENABLE_DEBUG=l.enableDebug,$.ENABLE_INFO=l.enableInfo,$.ENABLE_WARN=l.enableWarn,$.ENABLE_ERROR=l.enableError,$.ENABLE_CALLBACK=l.enableCallback}static _notifyChange(){let l=He.emitter;if(l.listenerCount("change")>0){let d=He.getConfig();l.emit("change",d)}}static registerListener(l){He.emitter.addListener("change",l)}static removeListener(l){He.emitter.removeListener("change",l)}static addLogListener(l){$.emitter.addListener("log",l),$.emitter.listenerCount("log")>0&&($.ENABLE_CALLBACK=!0,He._notifyChange())}static removeLogListener(l){$.emitter.removeListener("log",l),$.emitter.listenerCount("log")===0&&($.ENABLE_CALLBACK=!1,He._notifyChange())}}He.emitter=new(fe());var we=He;class it{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let l=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,d=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&this.duration!=null&&this.metadata!=null&&this.hasKeyframesIndex!=null&&l&&d}isSeekable(){return this.hasKeyframesIndex===!0}getNearestKeyframe(l){if(this.keyframesIndex==null)return null;let d=this.keyframesIndex,g=this._search(d.times,l);return{index:g,milliseconds:d.times[g],fileposition:d.filepositions[g]}}_search(l,d){let g=0,v=l.length-1,S=0,U=0,q=v;for(d<l[0]&&(g=0,U=q+1);U<=q;)if(S=U+Math.floor((q-U)/2),S===v||d>=l[S]&&d<l[S+1]){g=S;break}else l[S]<d?U=S+1:q=S-1;return g}}var pt=it;function Lt(Be,l,d){let g=Be;if(l+d<g.length){for(;d--;)if((g[++l]&192)!==128)return!1;return!0}else return!1}function Ut(Be){let l=[],d=Be,g=0,v=Be.length;for(;g<v;){if(d[g]<128){l.push(String.fromCharCode(d[g])),++g;continue}else if(!(d[g]<192)){if(d[g]<224){if(Lt(d,g,1)){let S=(d[g]&31)<<6|d[g+1]&63;if(S>=128){l.push(String.fromCharCode(S&65535)),g+=2;continue}}}else if(d[g]<240){if(Lt(d,g,2)){let S=(d[g]&15)<<12|(d[g+1]&63)<<6|d[g+2]&63;if(S>=2048&&(S&63488)!==55296){l.push(String.fromCharCode(S&65535)),g+=3;continue}}}else if(d[g]<248&&Lt(d,g,3)){let S=(d[g]&7)<<18|(d[g+1]&63)<<12|(d[g+2]&63)<<6|d[g+3]&63;if(S>65536&&S<1114112){S-=65536,l.push(String.fromCharCode(S>>>10|55296)),l.push(String.fromCharCode(S&1023|56320)),g+=4;continue}}}l.push("\uFFFD"),++g}return l.join("")}var $t=Ut;let vt=function(){let Be=new ArrayBuffer(2);return new DataView(Be).setInt16(0,256,!0),new Int16Array(Be)[0]===256}();class Bt{static parseScriptData(l,d,g){let v={};try{let S=Bt.parseValue(l,d,g),U=Bt.parseValue(l,d+S.size,g-S.size);v[S.data]=U.data}catch(S){$.e("AMF",S.toString())}return v}static parseObject(l,d,g){if(g<3)throw new Q("Data not enough when parse ScriptDataObject");let v=Bt.parseString(l,d,g),S=Bt.parseValue(l,d+v.size,g-v.size),U=S.objectEnd;return{data:{name:v.data,value:S.data},size:v.size+S.size,objectEnd:U}}static parseVariable(l,d,g){return Bt.parseObject(l,d,g)}static parseString(l,d,g){if(g<2)throw new Q("Data not enough when parse String");let S=new DataView(l,d,g).getUint16(0,!vt),U;return S>0?U=$t(new Uint8Array(l,d+2,S)):U="",{data:U,size:2+S}}static parseLongString(l,d,g){if(g<4)throw new Q("Data not enough when parse LongString");let S=new DataView(l,d,g).getUint32(0,!vt),U;return S>0?U=$t(new Uint8Array(l,d+4,S)):U="",{data:U,size:4+S}}static parseDate(l,d,g){if(g<10)throw new Q("Data size invalid when parse Date");let v=new DataView(l,d,g),S=v.getFloat64(0,!vt),U=v.getInt16(8,!vt);return S+=U*60*1e3,{data:new Date(S),size:10}}static parseValue(l,d,g){if(g<1)throw new Q("Data not enough when parse Value");let v=new DataView(l,d,g),S=1,U=v.getUint8(0),q,Ye=!1;try{switch(U){case 0:q=v.getFloat64(1,!vt),S+=8;break;case 1:{q=!!v.getUint8(1),S+=1;break}case 2:{let $e=Bt.parseString(l,d+1,g-1);q=$e.data,S+=$e.size;break}case 3:{q={};let $e=0;for((v.getUint32(g-4,!vt)&16777215)===9&&($e=3);S<g-4;){let lt=Bt.parseObject(l,d+S,g-S-$e);if(lt.objectEnd)break;q[lt.data.name]=lt.data.value,S+=lt.size}S<=g-3&&(v.getUint32(S-1,!vt)&16777215)===9&&(S+=3);break}case 8:{q={},S+=4;let $e=0;for((v.getUint32(g-4,!vt)&16777215)===9&&($e=3);S<g-8;){let lt=Bt.parseVariable(l,d+S,g-S-$e);if(lt.objectEnd)break;q[lt.data.name]=lt.data.value,S+=lt.size}S<=g-3&&(v.getUint32(S-1,!vt)&16777215)===9&&(S+=3);break}case 9:q=void 0,S=1,Ye=!0;break;case 10:{q=[];let $e=v.getUint32(1,!vt);S+=4;for(let lt=0;lt<$e;lt++){let Pt=Bt.parseValue(l,d+S,g-S);q.push(Pt.data),S+=Pt.size}break}case 11:{let $e=Bt.parseDate(l,d+1,g-1);q=$e.data,S+=$e.size;break}case 12:{let $e=Bt.parseString(l,d+1,g-1);q=$e.data,S+=$e.size;break}default:S=g,$.w("AMF","Unsupported AMF value type "+U)}}catch($e){$.e("AMF",$e.toString())}return{data:q,size:S,objectEnd:Ye}}}var Ht=Bt;class Zt{constructor(l){this.TAG="ExpGolomb",this._buffer=l,this._buffer_index=0,this._total_bytes=l.byteLength,this._total_bits=l.byteLength*8,this._current_word=0,this._current_word_bits_left=0}destroy(){this._buffer=null}_fillCurrentWord(){let l=this._total_bytes-this._buffer_index;if(l<=0)throw new Q("ExpGolomb: _fillCurrentWord() but no bytes available");let d=Math.min(4,l),g=new Uint8Array(4);g.set(this._buffer.subarray(this._buffer_index,this._buffer_index+d)),this._current_word=new DataView(g.buffer).getUint32(0,!1),this._buffer_index+=d,this._current_word_bits_left=d*8}readBits(l){if(l>32)throw new ke("ExpGolomb: readBits() bits exceeded max 32bits!");if(l<=this._current_word_bits_left){let U=this._current_word>>>32-l;return this._current_word<<=l,this._current_word_bits_left-=l,U}let d=this._current_word_bits_left?this._current_word:0;d=d>>>32-this._current_word_bits_left;let g=l-this._current_word_bits_left;this._fillCurrentWord();let v=Math.min(g,this._current_word_bits_left),S=this._current_word>>>32-v;return this._current_word<<=v,this._current_word_bits_left-=v,d=d<<v|S,d}readBool(){return this.readBits(1)===1}readByte(){return this.readBits(8)}_skipLeadingZero(){let l;for(l=0;l<this._current_word_bits_left;l++)if(this._current_word&2147483648>>>l)return this._current_word<<=l,this._current_word_bits_left-=l,l;return this._fillCurrentWord(),l+this._skipLeadingZero()}readUEG(){let l=this._skipLeadingZero();return this.readBits(l+1)-1}readSEG(){let l=this.readUEG();return l&1?l+1>>>1:-1*(l>>>1)}}var jt=Zt;class R{static _ebsp2rbsp(l){let d=l,g=d.byteLength,v=new Uint8Array(g),S=0;for(let U=0;U<g;U++)U>=2&&d[U]===3&&d[U-1]===0&&d[U-2]===0||(v[S]=d[U],S++);return new Uint8Array(v.buffer,0,S)}static parseSPS(l){let d=R._ebsp2rbsp(l),g=new jt(d);g.readByte();let v=g.readByte();g.readByte();let S=g.readByte();g.readUEG();let U=R.getProfileString(v),q=R.getLevelString(S),Ye=1,$e=420,lt=[0,420,422,444],Pt=8;if((v===100||v===110||v===122||v===244||v===44||v===83||v===86||v===118||v===128||v===138||v===144)&&(Ye=g.readUEG(),Ye===3&&g.readBits(1),Ye<=3&&($e=lt[Ye]),Pt=g.readUEG()+8,g.readUEG(),g.readBits(1),g.readBool())){let Vt=Ye!==3?8:12;for(let Mt=0;Mt<Vt;Mt++)g.readBool()&&(Mt<6?R._skipScalingList(g,16):R._skipScalingList(g,64))}g.readUEG();let Dt=g.readUEG();if(Dt===0)g.readUEG();else if(Dt===1){g.readBits(1),g.readSEG(),g.readSEG();let Vt=g.readUEG();for(let Mt=0;Mt<Vt;Mt++)g.readSEG()}let Oe=g.readUEG();g.readBits(1);let Ft=g.readUEG(),nt=g.readUEG(),Ue=g.readBits(1);Ue===0&&g.readBits(1),g.readBits(1);let Ge=0,mt=0,Rt=0,Nt=0;g.readBool()&&(Ge=g.readUEG(),mt=g.readUEG(),Rt=g.readUEG(),Nt=g.readUEG());let Ai=1,ut=1,at=0,Z=!0,ee=0,me=0;if(g.readBool()){if(g.readBool()){let Vt=g.readByte(),Mt=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Jt=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Vt>0&&Vt<16?(Ai=Mt[Vt-1],ut=Jt[Vt-1]):Vt===255&&(Ai=g.readByte()<<8|g.readByte(),ut=g.readByte()<<8|g.readByte())}if(g.readBool()&&g.readBool(),g.readBool()&&(g.readBits(4),g.readBool()&&g.readBits(24)),g.readBool()&&(g.readUEG(),g.readUEG()),g.readBool()){let Vt=g.readBits(32),Mt=g.readBits(32);Z=g.readBool(),ee=Mt,me=Vt*2,at=ee/me}}let pe=1;(Ai!==1||ut!==1)&&(pe=Ai/ut);let Pe=0,Le=0;if(Ye===0)Pe=1,Le=2-Ue;else{let Vt=Ye===3?1:2,Mt=Ye===1?2:1;Pe=Vt,Le=Mt*(2-Ue)}let Tt=(Ft+1)*16,Ot=(2-Ue)*((nt+1)*16);Tt-=(Ge+mt)*Pe,Ot-=(Rt+Nt)*Le;let gt=Math.ceil(Tt*pe);return g.destroy(),g=null,{profile_string:U,level_string:q,bit_depth:Pt,ref_frames:Oe,chroma_format:$e,chroma_format_string:R.getChromaFormatString($e),frame_rate:{fixed:Z,fps:at,fps_den:me,fps_num:ee},sar_ratio:{width:Ai,height:ut},codec_size:{width:Tt,height:Ot},present_size:{width:gt,height:Ot}}}static _skipScalingList(l,d){let g=8,v=8,S=0;for(let U=0;U<d;U++)v!==0&&(S=l.readSEG(),v=(g+S+256)%256),g=v===0?g:v}static getProfileString(l){switch(l){case 66:return"Baseline";case 77:return"Main";case 88:return"Extended";case 100:return"High";case 110:return"High10";case 122:return"High422";case 244:return"High444";default:return"Unknown"}}static getLevelString(l){return(l/10).toFixed(1)}static getChromaFormatString(l){switch(l){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}var P=R,L={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};function F(Be){return Be>>>8&255|(Be&255)<<8}function ne(Be){return(Be&4278190080)>>>24|(Be&16711680)>>>8|(Be&65280)<<8|(Be&255)<<24}function I(Be,l){return Be[l]<<24|Be[l+1]<<16|Be[l+2]<<8|Be[l+3]}class G{constructor(l,d){this.TAG="FLVDemuxer",this._config=d,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=l.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=l.hasAudioTrack,this._hasVideo=l.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new pt,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){let g=new ArrayBuffer(2);return new DataView(g).setInt16(0,256,!0),new Int16Array(g)[0]===256}()}destroy(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null}static probe(l){let d=new Uint8Array(l),g={match:!1};if(d[0]!==70||d[1]!==76||d[2]!==86||d[3]!==1)return g;let v=(d[4]&4)>>>2!==0,S=(d[4]&1)!==0,U=I(d,5);return U<9?g:{match:!0,consumed:U,dataOffset:U,hasAudioTrack:v,hasVideoTrack:S}}bindDataSource(l){return l.onDataArrival=this.parseChunks.bind(this),this}get onTrackMetadata(){return this._onTrackMetadata}set onTrackMetadata(l){this._onTrackMetadata=l}get onMediaInfo(){return this._onMediaInfo}set onMediaInfo(l){this._onMediaInfo=l}get onMetaDataArrived(){return this._onMetaDataArrived}set onMetaDataArrived(l){this._onMetaDataArrived=l}get onScriptDataArrived(){return this._onScriptDataArrived}set onScriptDataArrived(l){this._onScriptDataArrived=l}get onError(){return this._onError}set onError(l){this._onError=l}get onDataAvailable(){return this._onDataAvailable}set onDataAvailable(l){this._onDataAvailable=l}get timestampBase(){return this._timestampBase}set timestampBase(l){this._timestampBase=l}get overridedDuration(){return this._duration}set overridedDuration(l){this._durationOverrided=!0,this._duration=l,this._mediaInfo.duration=l}set overridedHasAudio(l){this._hasAudioFlagOverrided=!0,this._hasAudio=l,this._mediaInfo.hasAudio=l}set overridedHasVideo(l){this._hasVideoFlagOverrided=!0,this._hasVideo=l,this._mediaInfo.hasVideo=l}resetMediaInfo(){this._mediaInfo=new pt}_isInitialMetadataDispatched(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?this._videoInitialMetadataDispatched:!1}parseChunks(l,d){if(!this._onError||!this._onMediaInfo||!this._onTrackMetadata||!this._onDataAvailable)throw new Q("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");let g=0,v=this._littleEndian;if(d===0)if(l.byteLength>13)g=G.probe(l).dataOffset;else return 0;for(this._firstParse&&(this._firstParse=!1,d+g!==this._dataOffset&&$.w(this.TAG,"First time parsing but chunk byteStart invalid!"),new DataView(l,g).getUint32(0,!v)!==0&&$.w(this.TAG,"PrevTagSize0 !== 0 !!!"),g+=4);g<l.byteLength;){this._dispatch=!0;let S=new DataView(l,g);if(g+11+4>l.byteLength)break;let U=S.getUint8(0),q=S.getUint32(0,!v)&16777215;if(g+11+q+4>l.byteLength)break;if(U!==8&&U!==9&&U!==18){$.w(this.TAG,`Unsupported tag type ${U}, skipped`),g+=11+q+4;continue}let Ye=S.getUint8(4),$e=S.getUint8(5),lt=S.getUint8(6),Pt=S.getUint8(7),Dt=lt|$e<<8|Ye<<16|Pt<<24;(S.getUint32(7,!v)&16777215)!==0&&$.w(this.TAG,"Meet tag which has StreamID != 0!");let Ft=g+11;switch(U){case 8:this._parseAudioData(l,Ft,q,Dt);break;case 9:this._parseVideoData(l,Ft,q,Dt,d+g);break;case 18:this._parseScriptData(l,Ft,q);break}let nt=S.getUint32(11+q,!v);nt!==11+q&&$.w(this.TAG,`Invalid PrevTagSize ${nt}`),g+=11+q+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),g}_parseScriptData(l,d,g){let v=Ht.parseScriptData(l,d,g);if(v.hasOwnProperty("onMetaData")){if(v.onMetaData==null||typeof v.onMetaData!="object"){$.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&$.w(this.TAG,"Found another onMetaData tag!"),this._metadata=v;let S=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},S)),typeof S.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=S.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof S.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=S.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof S.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=S.audiodatarate),typeof S.videodatarate=="number"&&(this._mediaInfo.videoDataRate=S.videodatarate),typeof S.width=="number"&&(this._mediaInfo.width=S.width),typeof S.height=="number"&&(this._mediaInfo.height=S.height),typeof S.duration=="number"){if(!this._durationOverrided){let U=Math.floor(S.duration*this._timescale);this._duration=U,this._mediaInfo.duration=U}}else this._mediaInfo.duration=0;if(typeof S.framerate=="number"){let U=Math.floor(S.framerate*1e3);if(U>0){let q=U/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=q,this._referenceFrameRate.fps_num=U,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=q}}if(typeof S.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;let U=S.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(U),S.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=S,$.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(v).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},v))}_parseKeyframesIndex(l){let d=[],g=[];for(let v=1;v<l.times.length;v++){let S=this._timestampBase+Math.floor(l.times[v]*1e3);d.push(S),g.push(l.filepositions[v])}return{times:d,filepositions:g}}_parseAudioData(l,d,g,v){if(g<=1){$.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");return}if(this._hasAudioFlagOverrided===!0&&this._hasAudio===!1)return;let S=this._littleEndian,q=new DataView(l,d,g).getUint8(0),Ye=q>>>4;if(Ye!==2&&Ye!==10){this._onError(L.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+Ye);return}let $e=0,lt=(q&12)>>>2;if(lt>=0&<<=4)$e=this._flvSoundRateTable[lt];else{this._onError(L.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+lt);return}let Pt=(q&2)>>>1,Dt=q&1,Oe=this._audioMetadata,Ft=this._audioTrack;if(Oe||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),Oe=this._audioMetadata={},Oe.type="audio",Oe.id=Ft.id,Oe.timescale=this._timescale,Oe.duration=this._duration,Oe.audioSampleRate=$e,Oe.channelCount=Dt===0?1:2),Ye===10){let nt=this._parseAACAudioData(l,d+1,g-1);if(nt==null)return;if(nt.packetType===0){Oe.config&&$.w(this.TAG,"Found another AudioSpecificConfig!");let Ue=nt.data;Oe.audioSampleRate=Ue.samplingRate,Oe.channelCount=Ue.channelCount,Oe.codec=Ue.codec,Oe.originalCodec=Ue.originalCodec,Oe.config=Ue.config,Oe.refSampleDuration=1024/Oe.audioSampleRate*Oe.timescale,$.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",Oe);let Ge=this._mediaInfo;Ge.audioCodec=Oe.originalCodec,Ge.audioSampleRate=Oe.audioSampleRate,Ge.audioChannelCount=Oe.channelCount,Ge.hasVideo?Ge.videoCodec!=null&&(Ge.mimeType='video/x-flv; codecs="'+Ge.videoCodec+","+Ge.audioCodec+'"'):Ge.mimeType='video/x-flv; codecs="'+Ge.audioCodec+'"',Ge.isComplete()&&this._onMediaInfo(Ge)}else if(nt.packetType===1){let Ue=this._timestampBase+v,Ge={unit:nt.data,length:nt.data.byteLength,dts:Ue,pts:Ue};Ft.samples.push(Ge),Ft.length+=nt.data.length}else $.e(this.TAG,`Flv: Unsupported AAC data type ${nt.packetType}`)}else if(Ye===2){if(!Oe.codec){let mt=this._parseMP3AudioData(l,d+1,g-1,!0);if(mt==null)return;Oe.audioSampleRate=mt.samplingRate,Oe.channelCount=mt.channelCount,Oe.codec=mt.codec,Oe.originalCodec=mt.originalCodec,Oe.refSampleDuration=1152/Oe.audioSampleRate*Oe.timescale,$.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",Oe);let Rt=this._mediaInfo;Rt.audioCodec=Oe.codec,Rt.audioSampleRate=Oe.audioSampleRate,Rt.audioChannelCount=Oe.channelCount,Rt.audioDataRate=mt.bitRate,Rt.hasVideo?Rt.videoCodec!=null&&(Rt.mimeType='video/x-flv; codecs="'+Rt.videoCodec+","+Rt.audioCodec+'"'):Rt.mimeType='video/x-flv; codecs="'+Rt.audioCodec+'"',Rt.isComplete()&&this._onMediaInfo(Rt)}let nt=this._parseMP3AudioData(l,d+1,g-1,!1);if(nt==null)return;let Ue=this._timestampBase+v,Ge={unit:nt,length:nt.byteLength,dts:Ue,pts:Ue};Ft.samples.push(Ge),Ft.length+=nt.length}}_parseAACAudioData(l,d,g){if(g<=1){$.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}let v={},S=new Uint8Array(l,d,g);return v.packetType=S[0],S[0]===0?v.data=this._parseAACAudioSpecificConfig(l,d+1,g-1):v.data=S.subarray(1),v}_parseAACAudioSpecificConfig(l,d,g){let v=new Uint8Array(l,d,g),S=null,U=0,q=0,Ye=null,$e=0,lt=null;if(U=q=v[0]>>>3,$e=(v[0]&7)<<1|v[1]>>>7,$e<0||$e>=this._mpegSamplingRates.length){this._onError(L.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}let Pt=this._mpegSamplingRates[$e],Dt=(v[1]&120)>>>3;if(Dt<0||Dt>=8){this._onError(L.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}U===5&&(lt=(v[1]&7)<<1|v[2]>>>7,Ye=(v[2]&124)>>>2);let Oe=self.navigator.userAgent.toLowerCase();return Oe.indexOf("firefox")!==-1?$e>=6?(U=5,S=new Array(4),lt=$e-3):(U=2,S=new Array(2),lt=$e):Oe.indexOf("android")!==-1?(U=2,S=new Array(2),lt=$e):(U=5,lt=$e,S=new Array(4),$e>=6?lt=$e-3:Dt===1&&(U=2,S=new Array(2),lt=$e)),S[0]=U<<3,S[0]|=($e&15)>>>1,S[1]=($e&15)<<7,S[1]|=(Dt&15)<<3,U===5&&(S[1]|=(lt&15)>>>1,S[2]=(lt&1)<<7,S[2]|=8,S[3]=0),{config:S,samplingRate:Pt,channelCount:Dt,codec:"mp4a.40."+U,originalCodec:"mp4a.40."+q}}_parseMP3AudioData(l,d,g,v){if(g<4){$.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");return}let S=this._littleEndian,U=new Uint8Array(l,d,g),q=null;if(v){if(U[0]!==255)return;let Ye=U[1]>>>3&3,$e=(U[1]&6)>>1,lt=(U[2]&240)>>>4,Pt=(U[2]&12)>>>2,Oe=(U[3]>>>6&3)!==3?2:1,Ft=0,nt=0,Ue=34,Ge="mp3";switch(Ye){case 0:Ft=this._mpegAudioV25SampleRateTable[Pt];break;case 2:Ft=this._mpegAudioV20SampleRateTable[Pt];break;case 3:Ft=this._mpegAudioV10SampleRateTable[Pt];break}switch($e){case 1:Ue=34,lt<this._mpegAudioL3BitRateTable.length&&(nt=this._mpegAudioL3BitRateTable[lt]);break;case 2:Ue=33,lt<this._mpegAudioL2BitRateTable.length&&(nt=this._mpegAudioL2BitRateTable[lt]);break;case 3:Ue=32,lt<this._mpegAudioL1BitRateTable.length&&(nt=this._mpegAudioL1BitRateTable[lt]);break}q={bitRate:nt,samplingRate:Ft,channelCount:Oe,codec:Ge,originalCodec:Ge}}else q=U;return q}_parseVideoData(l,d,g,v,S){if(g<=1){$.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");return}if(this._hasVideoFlagOverrided===!0&&this._hasVideo===!1)return;let U=new Uint8Array(l,d,g)[0],q=(U&240)>>>4,Ye=U&15;if(Ye!==7){this._onError(L.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${Ye}`);return}this._parseAVCVideoPacket(l,d+1,g-1,v,S,q)}_parseAVCVideoPacket(l,d,g,v,S,U){if(g<4){$.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}let q=this._littleEndian,Ye=new DataView(l,d,g),$e=Ye.getUint8(0),Pt=(Ye.getUint32(0,!q)&16777215)<<8>>8;if($e===0)this._parseAVCDecoderConfigurationRecord(l,d+4,g-4);else if($e===1)this._parseAVCVideoData(l,d+4,g-4,v,S,U,Pt);else if($e!==2){this._onError(L.FORMAT_ERROR,`Flv: Invalid video packet type ${$e}`);return}}_parseAVCDecoderConfigurationRecord(l,d,g){if(g<7){$.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}let v=this._videoMetadata,S=this._videoTrack,U=this._littleEndian,q=new DataView(l,d,g);v?typeof v.avcc!="undefined"&&$.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),v=this._videoMetadata={},v.type="video",v.id=S.id,v.timescale=this._timescale,v.duration=this._duration);let Ye=q.getUint8(0),$e=q.getUint8(1),lt=q.getUint8(2),Pt=q.getUint8(3);if(Ye!==1||$e===0){this._onError(L.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");return}if(this._naluLengthSize=(q.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(L.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`);return}let Dt=q.getUint8(5)&31;if(Dt===0){this._onError(L.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else Dt>1&&$.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${Dt}`);let Oe=6;for(let nt=0;nt<Dt;nt++){let Ue=q.getUint16(Oe,!U);if(Oe+=2,Ue===0)continue;let Ge=new Uint8Array(l,d+Oe,Ue);Oe+=Ue;let mt=P.parseSPS(Ge);if(nt!==0)continue;v.codecWidth=mt.codec_size.width,v.codecHeight=mt.codec_size.height,v.presentWidth=mt.present_size.width,v.presentHeight=mt.present_size.height,v.profile=mt.profile_string,v.level=mt.level_string,v.bitDepth=mt.bit_depth,v.chromaFormat=mt.chroma_format,v.sarRatio=mt.sar_ratio,v.frameRate=mt.frame_rate,(mt.frame_rate.fixed===!1||mt.frame_rate.fps_num===0||mt.frame_rate.fps_den===0)&&(v.frameRate=this._referenceFrameRate);let Rt=v.frameRate.fps_den,Nt=v.frameRate.fps_num;v.refSampleDuration=v.timescale*(Rt/Nt);let wi=Ge.subarray(1,4),Ai="avc1.";for(let at=0;at<3;at++){let Z=wi[at].toString(16);Z.length<2&&(Z="0"+Z),Ai+=Z}v.codec=Ai;let ut=this._mediaInfo;ut.width=v.codecWidth,ut.height=v.codecHeight,ut.fps=v.frameRate.fps,ut.profile=v.profile,ut.level=v.level,ut.refFrames=mt.ref_frames,ut.chromaFormat=mt.chroma_format_string,ut.sarNum=v.sarRatio.width,ut.sarDen=v.sarRatio.height,ut.videoCodec=Ai,ut.hasAudio?ut.audioCodec!=null&&(ut.mimeType='video/x-flv; codecs="'+ut.videoCodec+","+ut.audioCodec+'"'):ut.mimeType='video/x-flv; codecs="'+ut.videoCodec+'"',ut.isComplete()&&this._onMediaInfo(ut)}let Ft=q.getUint8(Oe);if(Ft===0){this._onError(L.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS");return}else Ft>1&&$.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${Ft}`);Oe++;for(let nt=0;nt<Ft;nt++){let Ue=q.getUint16(Oe,!U);Oe+=2,Ue!==0&&(Oe+=Ue)}v.avcc=new Uint8Array(g),v.avcc.set(new Uint8Array(l,d,g),0),$.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",v)}_parseAVCVideoData(l,d,g,v,S,U,q){let Ye=this._littleEndian,$e=new DataView(l,d,g),lt=[],Pt=0,Dt=0;const Oe=this._naluLengthSize;let Ft=this._timestampBase+v,nt=U===1;for(;Dt<g;){if(Dt+4>=g){$.w(this.TAG,`Malformed Nalu near timestamp ${Ft}, offset = ${Dt}, dataSize = ${g}`);break}let Ue=$e.getUint32(Dt,!Ye);if(Oe===3&&(Ue>>>=8),Ue>g-Oe){$.w(this.TAG,`Malformed Nalus near timestamp ${Ft}, NaluSize > DataSize!`);return}let Ge=$e.getUint8(Dt+Oe)&31;Ge===5&&(nt=!0);let mt=new Uint8Array(l,d+Dt,Oe+Ue),Rt={type:Ge,data:mt};lt.push(Rt),Pt+=mt.byteLength,Dt+=Oe+Ue}if(lt.length){let Ue=this._videoTrack,Ge={units:lt,length:Pt,isKeyframe:nt,dts:Ft,cts:q,pts:Ft+q};nt&&(Ge.fileposition=S),Ue.samples.push(Ge),Ue.length+=Pt}}}var W=G;class w{static init(){w.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]};for(let d in w.types)w.types.hasOwnProperty(d)&&(w.types[d]=[d.charCodeAt(0),d.charCodeAt(1),d.charCodeAt(2),d.charCodeAt(3)]);let l=w.constants={};l.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),l.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),l.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),l.STSC=l.STCO=l.STTS,l.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),l.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),l.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),l.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),l.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),l.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(l){let d=8,g=null,v=Array.prototype.slice.call(arguments,1),S=v.length;for(let q=0;q<S;q++)d+=v[q].byteLength;g=new Uint8Array(d),g[0]=d>>>24&255,g[1]=d>>>16&255,g[2]=d>>>8&255,g[3]=d&255,g.set(l,4);let U=8;for(let q=0;q<S;q++)g.set(v[q],U),U+=v[q].byteLength;return g}static generateInitSegment(l){let d=w.box(w.types.ftyp,w.constants.FTYP),g=w.moov(l),v=new Uint8Array(d.byteLength+g.byteLength);return v.set(d,0),v.set(g,d.byteLength),v}static moov(l){let d=w.mvhd(l.timescale,l.duration),g=w.trak(l),v=w.mvex(l);return w.box(w.types.moov,d,g,v)}static mvhd(l,d){return w.box(w.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,l>>>24&255,l>>>16&255,l>>>8&255,l&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]))}static trak(l){return w.box(w.types.trak,w.tkhd(l),w.mdia(l))}static tkhd(l){let d=l.id,g=l.duration,v=l.presentWidth,S=l.presentHeight;return w.box(w.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,d>>>24&255,d>>>16&255,d>>>8&255,d&255,0,0,0,0,g>>>24&255,g>>>16&255,g>>>8&255,g&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,v>>>8&255,v&255,0,0,S>>>8&255,S&255,0,0]))}static mdia(l){return w.box(w.types.mdia,w.mdhd(l),w.hdlr(l),w.minf(l))}static mdhd(l){let d=l.timescale,g=l.duration;return w.box(w.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,d>>>24&255,d>>>16&255,d>>>8&255,d&255,g>>>24&255,g>>>16&255,g>>>8&255,g&255,85,196,0,0]))}static hdlr(l){let d=null;return l.type==="audio"?d=w.constants.HDLR_AUDIO:d=w.constants.HDLR_VIDEO,w.box(w.types.hdlr,d)}static minf(l){let d=null;return l.type==="audio"?d=w.box(w.types.smhd,w.constants.SMHD):d=w.box(w.types.vmhd,w.constants.VMHD),w.box(w.types.minf,d,w.dinf(),w.stbl(l))}static dinf(){return w.box(w.types.dinf,w.box(w.types.dref,w.constants.DREF))}static stbl(l){return w.box(w.types.stbl,w.stsd(l),w.box(w.types.stts,w.constants.STTS),w.box(w.types.stsc,w.constants.STSC),w.box(w.types.stsz,w.constants.STSZ),w.box(w.types.stco,w.constants.STCO))}static stsd(l){return l.type==="audio"?l.codec==="mp3"?w.box(w.types.stsd,w.constants.STSD_PREFIX,w.mp3(l)):w.box(w.types.stsd,w.constants.STSD_PREFIX,w.mp4a(l)):w.box(w.types.stsd,w.constants.STSD_PREFIX,w.avc1(l))}static mp3(l){let d=l.channelCount,g=l.audioSampleRate,v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,d,0,16,0,0,0,0,g>>>8&255,g&255,0,0]);return w.box(w.types[".mp3"],v)}static mp4a(l){let d=l.channelCount,g=l.audioSampleRate,v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,d,0,16,0,0,0,0,g>>>8&255,g&255,0,0]);return w.box(w.types.mp4a,v,w.esds(l))}static esds(l){let d=l.config||[],g=d.length,v=new Uint8Array([0,0,0,0,3,23+g,0,1,0,4,15+g,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([g]).concat(d).concat([6,1,2]));return w.box(w.types.esds,v)}static avc1(l){let d=l.avcc,g=l.codecWidth,v=l.codecHeight,S=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,g>>>8&255,g&255,v>>>8&255,v&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return w.box(w.types.avc1,S,w.box(w.types.avcC,d))}static mvex(l){return w.box(w.types.mvex,w.trex(l))}static trex(l){let d=l.id,g=new Uint8Array([0,0,0,0,d>>>24&255,d>>>16&255,d>>>8&255,d&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return w.box(w.types.trex,g)}static moof(l,d){return w.box(w.types.moof,w.mfhd(l.sequenceNumber),w.traf(l,d))}static mfhd(l){let d=new Uint8Array([0,0,0,0,l>>>24&255,l>>>16&255,l>>>8&255,l&255]);return w.box(w.types.mfhd,d)}static traf(l,d){let g=l.id,v=w.box(w.types.tfhd,new Uint8Array([0,0,0,0,g>>>24&255,g>>>16&255,g>>>8&255,g&255])),S=w.box(w.types.tfdt,new Uint8Array([0,0,0,0,d>>>24&255,d>>>16&255,d>>>8&255,d&255])),U=w.sdtp(l),q=w.trun(l,U.byteLength+16+16+8+16+8+8);return w.box(w.types.traf,v,S,q,U)}static sdtp(l){let d=l.samples||[],g=d.length,v=new Uint8Array(4+g);for(let S=0;S<g;S++){let U=d[S].flags;v[S+4]=U.isLeading<<6|U.dependsOn<<4|U.isDependedOn<<2|U.hasRedundancy}return w.box(w.types.sdtp,v)}static trun(l,d){let g=l.samples||[],v=g.length,S=12+16*v,U=new Uint8Array(S);d+=8+S,U.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255],0);for(let q=0;q<v;q++){let Ye=g[q].duration,$e=g[q].size,lt=g[q].flags,Pt=g[q].cts;U.set([Ye>>>24&255,Ye>>>16&255,Ye>>>8&255,Ye&255,$e>>>24&255,$e>>>16&255,$e>>>8&255,$e&255,lt.isLeading<<2|lt.dependsOn,lt.isDependedOn<<6|lt.hasRedundancy<<4|lt.isNonSync,0,0,Pt>>>24&255,Pt>>>16&255,Pt>>>8&255,Pt&255],12+16*q)}return w.box(w.types.trun,U)}static mdat(l){return w.box(w.types.mdat,l)}}w.init();var se=w;class Te{static getSilentFrame(l,d){if(l==="mp4a.40.2"){if(d===1)return new Uint8Array([0,200,0,128,35,128]);if(d===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(d===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(d===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(d===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(d===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(d===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(d===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(d===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}}var We=Te;class Qe{constructor(l,d,g,v,S){this.dts=l,this.pts=d,this.duration=g,this.originalDts=v,this.isSyncPoint=S,this.fileposition=null}}class dt{constructor(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}appendSyncPoint(l){l.isSyncPoint=!0,this.syncPoints.push(l)}}class Ze{constructor(){this._list=[]}clear(){this._list=[]}appendArray(l){let d=this._list;l.length!==0&&(d.length>0&&l[0].originalDts<d[d.length-1].originalDts&&this.clear(),Array.prototype.push.apply(d,l))}getLastSyncPointBeforeDts(l){if(this._list.length==0)return null;let d=this._list,g=0,v=d.length-1,S=0,U=0,q=v;for(l<d[0].dts&&(g=0,U=q+1);U<=q;)if(S=U+Math.floor((q-U)/2),S===v||l>=d[S].dts&&l<d[S+1].dts){g=S;break}else d[S].dts<l?U=S+1:q=S-1;return this._list[g]}}class ct{constructor(l){this._type=l,this._list=[],this._lastAppendLocation=-1}get type(){return this._type}get length(){return this._list.length}isEmpty(){return this._list.length===0}clear(){this._list=[],this._lastAppendLocation=-1}_searchNearestSegmentBefore(l){let d=this._list;if(d.length===0)return-2;let g=d.length-1,v=0,S=0,U=g,q=0;if(l<d[0].originalBeginDts)return q=-1,q;for(;S<=U;)if(v=S+Math.floor((U-S)/2),v===g||l>d[v].lastSample.originalDts&&l<d[v+1].originalBeginDts){q=v;break}else d[v].originalBeginDts<l?S=v+1:U=v-1;return q}_searchNearestSegmentAfter(l){return this._searchNearestSegmentBefore(l)+1}append(l){let d=this._list,g=l,v=this._lastAppendLocation,S=0;v!==-1&&v<d.length&&g.originalBeginDts>=d[v].lastSample.originalDts&&(v===d.length-1||v<d.length-1&&g.originalBeginDts<d[v+1].originalBeginDts)?S=v+1:d.length>0&&(S=this._searchNearestSegmentBefore(g.originalBeginDts)+1),this._lastAppendLocation=S,this._list.splice(S,0,g)}getLastSegmentBefore(l){let d=this._searchNearestSegmentBefore(l);return d>=0?this._list[d]:null}getLastSampleBefore(l){let d=this.getLastSegmentBefore(l);return d!=null?d.lastSample:null}getLastSyncPointBefore(l){let d=this._searchNearestSegmentBefore(l),g=this._list[d].syncPoints;for(;g.length===0&&d>0;)d--,g=this._list[d].syncPoints;return g.length>0?g[g.length-1]:null}}class tt{constructor(l){this.TAG="MP4Remuxer",this._config=l,this._isLive=l.isLive===!0,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new ct("audio"),this._videoSegmentInfoList=new ct("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(H.chrome&&(H.version.major<50||H.version.major===50&&H.version.build<2661)),this._fillSilentAfterSeek=H.msedge||H.msie,this._mp3UseMpegAudio=!H.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}destroy(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null}bindDataSource(l){return l.onDataAvailable=this.remux.bind(this),l.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}get onInitSegment(){return this._onInitSegment}set onInitSegment(l){this._onInitSegment=l}get onMediaSegment(){return this._onMediaSegment}set onMediaSegment(l){this._onMediaSegment=l}insertDiscontinuity(){this._audioNextDts=this._videoNextDts=void 0}seek(l){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}remux(l,d){if(!this._onMediaSegment)throw new Q("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(l,d),this._remuxVideo(d),this._remuxAudio(l)}_onTrackMetadataReceived(l,d){let g=null,v="mp4",S=d.codec;if(l==="audio")this._audioMeta=d,d.codec==="mp3"&&this._mp3UseMpegAudio?(v="mpeg",S="",g=new Uint8Array):g=se.generateInitSegment(d);else if(l==="video")this._videoMeta=d,g=se.generateInitSegment(d);else return;if(!this._onInitSegment)throw new Q("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(l,{type:l,data:g.buffer,codec:S,container:`${l}/${v}`,mediaDuration:d.duration})}_calculateDtsBase(l,d){this._dtsBaseInited||(l.samples&&l.samples.length&&(this._audioDtsBase=l.samples[0].dts),d.samples&&d.samples.length&&(this._videoDtsBase=d.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}flushStashedSamples(){let l=this._videoStashedLastSample,d=this._audioStashedLastSample,g={type:"video",id:1,sequenceNumber:0,samples:[],length:0};l!=null&&(g.samples.push(l),g.length=l.length);let v={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};d!=null&&(v.samples.push(d),v.length=d.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(g,!0),this._remuxAudio(v,!0)}_remuxAudio(l,d){if(this._audioMeta==null)return;let g=l,v=g.samples,S,U=-1,q=-1,Ye=-1,$e=this._audioMeta.refSampleDuration,lt=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,Pt=this._dtsBaseInited&&this._audioNextDts===void 0,Dt=!1;if(!v||v.length===0||v.length===1&&!d)return;let Oe=0,Ft=null,nt=0;lt?(Oe=0,nt=g.length):(Oe=8,nt=8+g.length);let Ue=null;if(v.length>1&&(Ue=v.pop(),nt-=Ue.length),this._audioStashedLastSample!=null){let ut=this._audioStashedLastSample;this._audioStashedLastSample=null,v.unshift(ut),nt+=ut.length}Ue!=null&&(this._audioStashedLastSample=Ue);let Ge=v[0].dts-this._dtsBase;if(this._audioNextDts)S=Ge-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())S=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(Dt=!0);else{let ut=this._audioSegmentInfoList.getLastSampleBefore(Ge);if(ut!=null){let at=Ge-(ut.originalDts+ut.duration);at<=3&&(at=0);let Z=ut.dts+ut.duration+at;S=Ge-Z}else S=0}if(Dt){let ut=Ge-S,at=this._videoSegmentInfoList.getLastSegmentBefore(Ge);if(at!=null&&at.beginDts<ut){let Z=We.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(Z){let ee=at.beginDts,me=ut-at.beginDts;$.v(this.TAG,`InsertPrefixSilentAudio: dts: ${ee}, duration: ${me}`),v.unshift({unit:Z,dts:ee,pts:ee}),nt+=Z.byteLength}}else Dt=!1}let mt=[];for(let ut=0;ut<v.length;ut++){let at=v[ut],Z=at.unit,ee=at.dts-this._dtsBase,me=ee-S;U===-1&&(U=me);let Ce=0;ut!==v.length-1?Ce=v[ut+1].dts-this._dtsBase-S-me:Ue!=null?Ce=Ue.dts-this._dtsBase-S-me:mt.length>=1?Ce=mt[mt.length-1].duration:Ce=Math.floor($e);let pe=!1,Pe=null;if(Ce>$e*1.5&&this._audioMeta.codec!=="mp3"&&this._fillAudioTimestampGap&&!H.safari){pe=!0;let Le=Math.abs(Ce-$e),Tt=Math.ceil(Le/$e),Ot=me+$e;$.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
|
|
dts: ${me+Ce} ms, expected: ${me+Math.round($e)} ms, delta: ${Math.round(Le)} ms, generate: ${Tt} frames`);let gt=We.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);gt==null&&($.w(this.TAG,`Unable to generate silent frame for ${this._audioMeta.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),gt=Z),Pe=[];for(let Mt=0;Mt<Tt;Mt++){let Jt=Math.round(Ot);if(Pe.length>0){let xt=Pe[Pe.length-1];xt.duration=Jt-xt.dts}let Gt={dts:Jt,pts:Jt,cts:0,unit:gt,size:gt.byteLength,duration:0,originalDts:ee,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};Pe.push(Gt),nt+=Gt.size,Ot+=$e}let Vt=Pe[Pe.length-1];Vt.duration=me+Ce-Vt.dts,Ce=Math.round($e)}mt.push({dts:me,pts:me,cts:0,unit:at.unit,size:at.unit.byteLength,duration:Ce,originalDts:ee,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),pe&&mt.push.apply(mt,Pe)}lt?Ft=new Uint8Array(nt):(Ft=new Uint8Array(nt),Ft[0]=nt>>>24&255,Ft[1]=nt>>>16&255,Ft[2]=nt>>>8&255,Ft[3]=nt&255,Ft.set(se.types.mdat,4));for(let ut=0;ut<mt.length;ut++){let at=mt[ut].unit;Ft.set(at,Oe),Oe+=at.byteLength}let Rt=mt[mt.length-1];q=Rt.dts+Rt.duration,this._audioNextDts=q;let Nt=new dt;Nt.beginDts=U,Nt.endDts=q,Nt.beginPts=U,Nt.endPts=q,Nt.originalBeginDts=mt[0].originalDts,Nt.originalEndDts=Rt.originalDts+Rt.duration,Nt.firstSample=new Qe(mt[0].dts,mt[0].pts,mt[0].duration,mt[0].originalDts,!1),Nt.lastSample=new Qe(Rt.dts,Rt.pts,Rt.duration,Rt.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(Nt),g.samples=mt,g.sequenceNumber++;let wi=null;lt?wi=new Uint8Array:wi=se.moof(g,U),g.samples=[],g.length=0;let Ai={type:"audio",data:this._mergeBoxes(wi,Ft).buffer,sampleCount:mt.length,info:Nt};lt&&Pt&&(Ai.timestampOffset=U),this._onMediaSegment("audio",Ai)}_remuxVideo(l,d){if(this._videoMeta==null)return;let g=l,v=g.samples,S,U=-1,q=-1,Ye=-1,$e=-1;if(!v||v.length===0||v.length===1&&!d)return;let lt=8,Pt=null,Dt=8+l.length,Oe=null;if(v.length>1&&(Oe=v.pop(),Dt-=Oe.length),this._videoStashedLastSample!=null){let Rt=this._videoStashedLastSample;this._videoStashedLastSample=null,v.unshift(Rt),Dt+=Rt.length}Oe!=null&&(this._videoStashedLastSample=Oe);let Ft=v[0].dts-this._dtsBase;if(this._videoNextDts)S=Ft-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())S=0;else{let Rt=this._videoSegmentInfoList.getLastSampleBefore(Ft);if(Rt!=null){let Nt=Ft-(Rt.originalDts+Rt.duration);Nt<=3&&(Nt=0);let wi=Rt.dts+Rt.duration+Nt;S=Ft-wi}else S=0}let nt=new dt,Ue=[];for(let Rt=0;Rt<v.length;Rt++){let Nt=v[Rt],wi=Nt.dts-this._dtsBase,Ai=Nt.isKeyframe,ut=wi-S,at=Nt.cts,Z=ut+at;U===-1&&(U=ut,Ye=Z);let ee=0;if(Rt!==v.length-1?ee=v[Rt+1].dts-this._dtsBase-S-ut:Oe!=null?ee=Oe.dts-this._dtsBase-S-ut:Ue.length>=1?ee=Ue[Ue.length-1].duration:ee=Math.floor(this._videoMeta.refSampleDuration),Ai){let me=new Qe(ut,Z,ee,Nt.dts,!0);me.fileposition=Nt.fileposition,nt.appendSyncPoint(me)}Ue.push({dts:ut,pts:Z,cts:at,units:Nt.units,size:Nt.length,isKeyframe:Ai,duration:ee,originalDts:wi,flags:{isLeading:0,dependsOn:Ai?2:1,isDependedOn:Ai?1:0,hasRedundancy:0,isNonSync:Ai?0:1}})}Pt=new Uint8Array(Dt),Pt[0]=Dt>>>24&255,Pt[1]=Dt>>>16&255,Pt[2]=Dt>>>8&255,Pt[3]=Dt&255,Pt.set(se.types.mdat,4);for(let Rt=0;Rt<Ue.length;Rt++){let Nt=Ue[Rt].units;for(;Nt.length;){let Ai=Nt.shift().data;Pt.set(Ai,lt),lt+=Ai.byteLength}}let Ge=Ue[Ue.length-1];if(q=Ge.dts+Ge.duration,$e=Ge.pts+Ge.duration,this._videoNextDts=q,nt.beginDts=U,nt.endDts=q,nt.beginPts=Ye,nt.endPts=$e,nt.originalBeginDts=Ue[0].originalDts,nt.originalEndDts=Ge.originalDts+Ge.duration,nt.firstSample=new Qe(Ue[0].dts,Ue[0].pts,Ue[0].duration,Ue[0].originalDts,Ue[0].isKeyframe),nt.lastSample=new Qe(Ge.dts,Ge.pts,Ge.duration,Ge.originalDts,Ge.isKeyframe),this._isLive||this._videoSegmentInfoList.append(nt),g.samples=Ue,g.sequenceNumber++,this._forceFirstIDR){let Rt=Ue[0].flags;Rt.dependsOn=2,Rt.isNonSync=0}let mt=se.moof(g,U);g.samples=[],g.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(mt,Pt).buffer,sampleCount:Ue.length,info:nt})}_mergeBoxes(l,d){let g=new Uint8Array(l.byteLength+d.byteLength);return g.set(l,0),g.set(d,l.byteLength),g}}var bt=tt,ce={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"};class Yt{constructor(l,d){this.TAG="TransmuxingController",this._emitter=new(fe()),this._config=d,l.segments||(l.segments=[{duration:l.duration,filesize:l.filesize,url:l.url}]),typeof l.cors!="boolean"&&(l.cors=!0),typeof l.withCredentials!="boolean"&&(l.withCredentials=!1),this._mediaDataSource=l,this._currentSegmentIndex=0;let g=0;this._mediaDataSource.segments.forEach(v=>{v.timestampBase=g,g+=v.duration,v.cors=l.cors,v.withCredentials=l.withCredentials,d.referrerPolicy&&(v.referrerPolicy=d.referrerPolicy)}),!isNaN(g)&&this._mediaDataSource.duration!==g&&(this._mediaDataSource.duration=g),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}destroy(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null}on(l,d){this._emitter.addListener(l,d)}off(l,d){this._emitter.removeListener(l,d)}start(){this._loadSegment(0),this._enableStatisticsReporter()}_loadSegment(l,d){this._currentSegmentIndex=l;let g=this._mediaDataSource.segments[l],v=this._ioctl=new Ae(g,this._config,l);v.onError=this._onIOException.bind(this),v.onSeeked=this._onIOSeeked.bind(this),v.onComplete=this._onIOComplete.bind(this),v.onRedirect=this._onIORedirect.bind(this),v.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),d?this._demuxer.bindDataSource(this._ioctl):v.onDataArrival=this._onInitChunkArrival.bind(this),v.open(d)}stop(){this._internalAbort(),this._disableStatisticsReporter()}_internalAbort(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)}pause(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())}resume(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())}seek(l){if(this._mediaInfo==null||!this._mediaInfo.isSeekable())return;let d=this._searchSegmentIndexContains(l);if(d===this._currentSegmentIndex){let g=this._mediaInfo.segments[d];if(g==null)this._pendingSeekTime=l;else{let v=g.getNearestKeyframe(l);this._remuxer.seek(v.milliseconds),this._ioctl.seek(v.fileposition),this._pendingResolveSeekPoint=v.milliseconds}}else{let g=this._mediaInfo.segments[d];if(g==null)this._pendingSeekTime=l,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(d);else{let v=g.getNearestKeyframe(l);this._internalAbort(),this._remuxer.seek(l),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[d].timestampBase,this._loadSegment(d,v.fileposition),this._pendingResolveSeekPoint=v.milliseconds,this._reportSegmentMediaInfo(d)}}this._enableStatisticsReporter()}_searchSegmentIndexContains(l){let d=this._mediaDataSource.segments,g=d.length-1;for(let v=0;v<d.length;v++)if(l<d[v].timestampBase){g=v-1;break}return g}_onInitChunkArrival(l,d){let g=null,v=0;if(d>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,v=this._demuxer.parseChunks(l,d);else if((g=W.probe(l)).match){this._demuxer=new W(g,this._config),this._remuxer||(this._remuxer=new bt(this._config));let S=this._mediaDataSource;S.duration!=null&&!isNaN(S.duration)&&(this._demuxer.overridedDuration=S.duration),typeof S.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=S.hasAudio),typeof S.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=S.hasVideo),this._demuxer.timestampBase=S.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),v=this._demuxer.parseChunks(l,d)}else g=null,$.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(()=>{this._internalAbort()}),this._emitter.emit(ce.DEMUX_ERROR,L.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),v=0;return v}_onMediaInfo(l){this._mediaInfo==null&&(this._mediaInfo=Object.assign({},l),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,pt.prototype));let d=Object.assign({},l);Object.setPrototypeOf(d,pt.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=d,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(()=>{let g=this._pendingSeekTime;this._pendingSeekTime=null,this.seek(g)})}_onMetaDataArrived(l){this._emitter.emit(ce.METADATA_ARRIVED,l)}_onScriptDataArrived(l){this._emitter.emit(ce.SCRIPTDATA_ARRIVED,l)}_onIOSeeked(){this._remuxer.insertDiscontinuity()}_onIOComplete(l){let g=l+1;g<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(g)):(this._remuxer.flushStashedSamples(),this._emitter.emit(ce.LOADING_COMPLETE),this._disableStatisticsReporter())}_onIORedirect(l){let d=this._ioctl.extraData;this._mediaDataSource.segments[d].redirectedURL=l}_onIORecoveredEarlyEof(){this._emitter.emit(ce.RECOVERED_EARLY_EOF)}_onIOException(l,d){$.e(this.TAG,`IOException: type = ${l}, code = ${d.code}, msg = ${d.msg}`),this._emitter.emit(ce.IO_ERROR,l,d),this._disableStatisticsReporter()}_onDemuxException(l,d){$.e(this.TAG,`DemuxException: type = ${l}, info = ${d}`),this._emitter.emit(ce.DEMUX_ERROR,l,d)}_onRemuxerInitSegmentArrival(l,d){this._emitter.emit(ce.INIT_SEGMENT,l,d)}_onRemuxerMediaSegmentArrival(l,d){if(this._pendingSeekTime==null&&(this._emitter.emit(ce.MEDIA_SEGMENT,l,d),this._pendingResolveSeekPoint!=null&&l==="video")){let g=d.info.syncPoints,v=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,H.safari&&g.length>0&&g[0].originalDts===v&&(v=g[0].pts),this._emitter.emit(ce.RECOMMEND_SEEKPOINT,v)}}_enableStatisticsReporter(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))}_disableStatisticsReporter(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}_reportSegmentMediaInfo(l){let d=this._mediaInfo.segments[l],g=Object.assign({},d);g.duration=this._mediaInfo.duration,g.segmentCount=this._mediaInfo.segmentCount,delete g.segments,delete g.keyframesIndex,this._emitter.emit(ce.MEDIA_INFO,g)}_reportStatisticsInfo(){let l={};l.url=this._ioctl.currentURL,l.hasRedirect=this._ioctl.hasRedirect,l.hasRedirect&&(l.redirectedURL=this._ioctl.currentRedirectedURL),l.speed=this._ioctl.currentSpeed,l.loaderType=this._ioctl.loaderType,l.currentSegmentIndex=this._currentSegmentIndex,l.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(ce.STATISTICS_INFO,l)}}var Ct=Yt,je=function(Be){let l="TransmuxingWorker",d=null,g=nt.bind(this);O.install(),Be.addEventListener("message",function(Ue){switch(Ue.data.cmd){case"init":d=new Ct(Ue.data.param[0],Ue.data.param[1]),d.on(ce.IO_ERROR,Dt.bind(this)),d.on(ce.DEMUX_ERROR,Oe.bind(this)),d.on(ce.INIT_SEGMENT,v.bind(this)),d.on(ce.MEDIA_SEGMENT,S.bind(this)),d.on(ce.LOADING_COMPLETE,U.bind(this)),d.on(ce.RECOVERED_EARLY_EOF,q.bind(this)),d.on(ce.MEDIA_INFO,Ye.bind(this)),d.on(ce.METADATA_ARRIVED,$e.bind(this)),d.on(ce.SCRIPTDATA_ARRIVED,lt.bind(this)),d.on(ce.STATISTICS_INFO,Pt.bind(this)),d.on(ce.RECOMMEND_SEEKPOINT,Ft.bind(this));break;case"destroy":d&&(d.destroy(),d=null),Be.postMessage({msg:"destroyed"});break;case"start":d.start();break;case"stop":d.stop();break;case"seek":d.seek(Ue.data.param);break;case"pause":d.pause();break;case"resume":d.resume();break;case"logging_config":{let Ge=Ue.data.param;we.applyConfig(Ge),Ge.enableCallback===!0?we.addLogListener(g):we.removeLogListener(g);break}}});function v(Ue,Ge){let mt={msg:ce.INIT_SEGMENT,data:{type:Ue,data:Ge}};Be.postMessage(mt,[Ge.data])}function S(Ue,Ge){let mt={msg:ce.MEDIA_SEGMENT,data:{type:Ue,data:Ge}};Be.postMessage(mt,[Ge.data])}function U(){let Ue={msg:ce.LOADING_COMPLETE};Be.postMessage(Ue)}function q(){let Ue={msg:ce.RECOVERED_EARLY_EOF};Be.postMessage(Ue)}function Ye(Ue){let Ge={msg:ce.MEDIA_INFO,data:Ue};Be.postMessage(Ge)}function $e(Ue){let Ge={msg:ce.METADATA_ARRIVED,data:Ue};Be.postMessage(Ge)}function lt(Ue){let Ge={msg:ce.SCRIPTDATA_ARRIVED,data:Ue};Be.postMessage(Ge)}function Pt(Ue){let Ge={msg:ce.STATISTICS_INFO,data:Ue};Be.postMessage(Ge)}function Dt(Ue,Ge){Be.postMessage({msg:ce.IO_ERROR,data:{type:Ue,info:Ge}})}function Oe(Ue,Ge){Be.postMessage({msg:ce.DEMUX_ERROR,data:{type:Ue,info:Ge}})}function Ft(Ue){Be.postMessage({msg:ce.RECOMMEND_SEEKPOINT,data:Ue})}function nt(Ue,Ge){Be.postMessage({msg:"logcat_callback",data:{type:Ue,logcat:Ge}})}};class vi{constructor(l,d){if(this.TAG="Transmuxer",this._emitter=new(fe()),d.enableWorker&&typeof Worker!="undefined")try{let g=A(82059);this._worker=g(je),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[l,d]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},we.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:we.getConfig()})}catch(g){$.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new Ct(l,d)}else this._controller=new Ct(l,d);if(this._controller){let g=this._controller;g.on(ce.IO_ERROR,this._onIOError.bind(this)),g.on(ce.DEMUX_ERROR,this._onDemuxError.bind(this)),g.on(ce.INIT_SEGMENT,this._onInitSegment.bind(this)),g.on(ce.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),g.on(ce.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),g.on(ce.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),g.on(ce.MEDIA_INFO,this._onMediaInfo.bind(this)),g.on(ce.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),g.on(ce.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),g.on(ce.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),g.on(ce.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}destroy(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),we.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null}on(l,d){this._emitter.addListener(l,d)}off(l,d){this._emitter.removeListener(l,d)}hasWorker(){return this._worker!=null}open(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()}close(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()}seek(l){this._worker?this._worker.postMessage({cmd:"seek",param:l}):this._controller.seek(l)}pause(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}resume(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}_onInitSegment(l,d){Promise.resolve().then(()=>{this._emitter.emit(ce.INIT_SEGMENT,l,d)})}_onMediaSegment(l,d){Promise.resolve().then(()=>{this._emitter.emit(ce.MEDIA_SEGMENT,l,d)})}_onLoadingComplete(){Promise.resolve().then(()=>{this._emitter.emit(ce.LOADING_COMPLETE)})}_onRecoveredEarlyEof(){Promise.resolve().then(()=>{this._emitter.emit(ce.RECOVERED_EARLY_EOF)})}_onMediaInfo(l){Promise.resolve().then(()=>{this._emitter.emit(ce.MEDIA_INFO,l)})}_onMetaDataArrived(l){Promise.resolve().then(()=>{this._emitter.emit(ce.METADATA_ARRIVED,l)})}_onScriptDataArrived(l){Promise.resolve().then(()=>{this._emitter.emit(ce.SCRIPTDATA_ARRIVED,l)})}_onStatisticsInfo(l){Promise.resolve().then(()=>{this._emitter.emit(ce.STATISTICS_INFO,l)})}_onIOError(l,d){Promise.resolve().then(()=>{this._emitter.emit(ce.IO_ERROR,l,d)})}_onDemuxError(l,d){Promise.resolve().then(()=>{this._emitter.emit(ce.DEMUX_ERROR,l,d)})}_onRecommendSeekpoint(l){Promise.resolve().then(()=>{this._emitter.emit(ce.RECOMMEND_SEEKPOINT,l)})}_onLoggingConfigChanged(l){this._worker&&this._worker.postMessage({cmd:"logging_config",param:l})}_onWorkerMessage(l){let d=l.data,g=d.data;if(d.msg==="destroyed"||this._workerDestroying){this._workerDestroying=!1,this._worker.terminate(),this._worker=null;return}switch(d.msg){case ce.INIT_SEGMENT:case ce.MEDIA_SEGMENT:this._emitter.emit(d.msg,g.type,g.data);break;case ce.LOADING_COMPLETE:case ce.RECOVERED_EARLY_EOF:this._emitter.emit(d.msg);break;case ce.MEDIA_INFO:Object.setPrototypeOf(g,pt.prototype),this._emitter.emit(d.msg,g);break;case ce.METADATA_ARRIVED:case ce.SCRIPTDATA_ARRIVED:case ce.STATISTICS_INFO:this._emitter.emit(d.msg,g);break;case ce.IO_ERROR:case ce.DEMUX_ERROR:this._emitter.emit(d.msg,g.type,g.info);break;case ce.RECOMMEND_SEEKPOINT:this._emitter.emit(d.msg,g);break;case"logcat_callback":$.emitter.emit("log",g.type,g.logcat);break;default:break}}}var ci=vi,ui={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"};class ft{constructor(l){this.TAG="MSEController",this._config=l,this._emitter=new(fe()),this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new Ze}destroy(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}on(l,d){this._emitter.addListener(l,d)}off(l,d){this._emitter.removeListener(l,d)}attachMediaElement(l){if(this._mediaSource)throw new Q("MediaSource has been attached to an HTMLMediaElement!");let d=this._mediaSource=new window.MediaSource;d.addEventListener("sourceopen",this.e.onSourceOpen),d.addEventListener("sourceended",this.e.onSourceEnded),d.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=l,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),l.src=this._mediaSourceObjectURL}detachMediaElement(){if(this._mediaSource){let l=this._mediaSource;for(let d in this._sourceBuffers){let g=this._pendingSegments[d];g.splice(0,g.length),this._pendingSegments[d]=null,this._pendingRemoveRanges[d]=null,this._lastInitSegments[d]=null;let v=this._sourceBuffers[d];if(v){if(l.readyState!=="closed"){try{l.removeSourceBuffer(v)}catch(S){$.e(this.TAG,S.message)}v.removeEventListener("error",this.e.onSourceBufferError),v.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[d]=null,this._sourceBuffers[d]=null}}if(l.readyState==="open")try{l.endOfStream()}catch(d){$.e(this.TAG,d.message)}l.removeEventListener("sourceopen",this.e.onSourceOpen),l.removeEventListener("sourceended",this.e.onSourceEnded),l.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)}appendInitSegment(l,d){if(!this._mediaSource||this._mediaSource.readyState!=="open"){this._pendingSourceBufferInit.push(l),this._pendingSegments[l.type].push(l);return}let g=l,v=`${g.container}`;g.codec&&g.codec.length>0&&(v+=`;codecs=${g.codec}`);let S=!1;if($.v(this.TAG,"Received Initialization Segment, mimeType: "+v),this._lastInitSegments[g.type]=g,v!==this._mimeTypes[g.type]){if(this._mimeTypes[g.type])$.v(this.TAG,`Notice: ${g.type} mimeType changed, origin: ${this._mimeTypes[g.type]}, target: ${v}`);else{S=!0;try{let U=this._sourceBuffers[g.type]=this._mediaSource.addSourceBuffer(v);U.addEventListener("error",this.e.onSourceBufferError),U.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(U){$.e(this.TAG,U.message),this._emitter.emit(ui.ERROR,{code:U.code,msg:U.message});return}}this._mimeTypes[g.type]=v}d||this._pendingSegments[g.type].push(g),S||this._sourceBuffers[g.type]&&!this._sourceBuffers[g.type].updating&&this._doAppendSegments(),H.safari&&g.container==="audio/mpeg"&&g.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=g.mediaDuration/1e3,this._updateMediaSourceDuration())}appendMediaSegment(l){let d=l;this._pendingSegments[d.type].push(d),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();let g=this._sourceBuffers[d.type];g&&!g.updating&&!this._hasPendingRemoveRanges()&&this._doAppendSegments()}seek(l){for(let d in this._sourceBuffers){if(!this._sourceBuffers[d])continue;let g=this._sourceBuffers[d];if(this._mediaSource.readyState==="open")try{g.abort()}catch(S){$.e(this.TAG,S.message)}this._idrList.clear();let v=this._pendingSegments[d];if(v.splice(0,v.length),this._mediaSource.readyState!=="closed"){for(let S=0;S<g.buffered.length;S++){let U=g.buffered.start(S),q=g.buffered.end(S);this._pendingRemoveRanges[d].push({start:U,end:q})}if(g.updating||this._doRemoveRanges(),H.safari){let S=this._lastInitSegments[d];S&&(this._pendingSegments[d].push(S),g.updating||this._doAppendSegments())}}}}endOfStream(){let l=this._mediaSource,d=this._sourceBuffers;if(!l||l.readyState!=="open"){l&&l.readyState==="closed"&&this._hasPendingSegments()&&(this._hasPendingEos=!0);return}d.video&&d.video.updating||d.audio&&d.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,l.endOfStream())}getNearestKeyframe(l){return this._idrList.getLastSyncPointBeforeDts(l)}_needCleanupSourceBuffer(){if(!this._config.autoCleanupSourceBuffer)return!1;let l=this._mediaElement.currentTime;for(let d in this._sourceBuffers){let g=this._sourceBuffers[d];if(g){let v=g.buffered;if(v.length>=1&&l-v.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}_doCleanupSourceBuffer(){let l=this._mediaElement.currentTime;for(let d in this._sourceBuffers){let g=this._sourceBuffers[d];if(g){let v=g.buffered,S=!1;for(let U=0;U<v.length;U++){let q=v.start(U),Ye=v.end(U);if(q<=l&&l<Ye+3){if(l-q>=this._config.autoCleanupMaxBackwardDuration){S=!0;let $e=l-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[d].push({start:q,end:$e})}}else Ye<l&&(S=!0,this._pendingRemoveRanges[d].push({start:q,end:Ye}))}S&&!g.updating&&this._doRemoveRanges()}}}_updateMediaSourceDuration(){let l=this._sourceBuffers;if(this._mediaElement.readyState===0||this._mediaSource.readyState!=="open"||l.video&&l.video.updating||l.audio&&l.audio.updating)return;let d=this._mediaSource.duration,g=this._pendingMediaDuration;g>0&&(isNaN(d)||g>d)&&($.v(this.TAG,`Update MediaSource duration from ${d} to ${g}`),this._mediaSource.duration=g),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}_doRemoveRanges(){for(let l in this._pendingRemoveRanges){if(!this._sourceBuffers[l]||this._sourceBuffers[l].updating)continue;let d=this._sourceBuffers[l],g=this._pendingRemoveRanges[l];for(;g.length&&!d.updating;){let v=g.shift();d.remove(v.start,v.end)}}}_doAppendSegments(){let l=this._pendingSegments;for(let d in l)if(!(!this._sourceBuffers[d]||this._sourceBuffers[d].updating)&&l[d].length>0){let g=l[d].shift();if(g.timestampOffset){let v=this._sourceBuffers[d].timestampOffset,S=g.timestampOffset/1e3;Math.abs(v-S)>.1&&($.v(this.TAG,`Update MPEG audio timestampOffset from ${v} to ${S}`),this._sourceBuffers[d].timestampOffset=S),delete g.timestampOffset}if(!g.data||g.data.byteLength===0)continue;try{this._sourceBuffers[d].appendBuffer(g.data),this._isBufferFull=!1,d==="video"&&g.hasOwnProperty("info")&&this._idrList.appendArray(g.info.syncPoints)}catch(v){this._pendingSegments[d].unshift(g),v.code===22?(this._isBufferFull||this._emitter.emit(ui.BUFFER_FULL),this._isBufferFull=!0):($.e(this.TAG,v.message),this._emitter.emit(ui.ERROR,{code:v.code,msg:v.message}))}}}_onSourceOpen(){if($.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0){let l=this._pendingSourceBufferInit;for(;l.length;){let d=l.shift();this.appendInitSegment(d,!0)}}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(ui.SOURCE_OPEN)}_onSourceEnded(){$.v(this.TAG,"MediaSource onSourceEnded")}_onSourceClose(){$.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))}_hasPendingSegments(){let l=this._pendingSegments;return l.video.length>0||l.audio.length>0}_hasPendingRemoveRanges(){let l=this._pendingRemoveRanges;return l.video.length>0||l.audio.length>0}_onSourceBufferUpdateEnd(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(ui.UPDATE_END)}_onSourceBufferError(l){$.e(this.TAG,`SourceBuffer Error: ${l}`)}}var Qt=ft;const st={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},At={NETWORK_EXCEPTION:N.EXCEPTION,NETWORK_STATUS_CODE_INVALID:N.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:N.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:N.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:L.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:L.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:L.CODEC_UNSUPPORTED};class Xt{constructor(l,d){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(fe()),this._config=ge(),typeof d=="object"&&Object.assign(this._config,d),l.type.toLowerCase()!=="flv")throw new ke("FlvPlayer requires an flv MediaDataSource input!");l.isLive===!0&&(this._config.isLive=!0),this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this),onvSeeking:this._onvSeeking.bind(this),onvCanPlay:this._onvCanPlay.bind(this),onvStalled:this._onvStalled.bind(this),onvProgress:this._onvProgress.bind(this)},self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now,this._pendingSeekTime=null,this._requestSetTime=!1,this._seekpointRecord=null,this._progressChecker=null,this._mediaDataSource=l,this._mediaElement=null,this._msectl=null,this._transmuxer=null,this._mseSourceOpened=!1,this._hasPendingLoad=!1,this._receivedCanPlay=!1,this._mediaInfo=null,this._statisticsInfo=null;let g=H.chrome&&(H.version.major<50||H.version.major===50&&H.version.build<2661);this._alwaysSeekKeyframe=!!(g||H.msedge||H.msie),this._alwaysSeekKeyframe&&(this._config.accurateSeek=!1)}destroy(){this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._transmuxer&&this.unload(),this._mediaElement&&this.detachMediaElement(),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}on(l,d){l===Fe.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(Fe.MEDIA_INFO,this.mediaInfo)}):l===Fe.STATISTICS_INFO&&this._statisticsInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(Fe.STATISTICS_INFO,this.statisticsInfo)}),this._emitter.addListener(l,d)}off(l,d){this._emitter.removeListener(l,d)}attachMediaElement(l){if(this._mediaElement=l,l.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),l.addEventListener("seeking",this.e.onvSeeking),l.addEventListener("canplay",this.e.onvCanPlay),l.addEventListener("stalled",this.e.onvStalled),l.addEventListener("progress",this.e.onvProgress),this._msectl=new Qt(this._config),this._msectl.on(ui.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(ui.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(ui.SOURCE_OPEN,()=>{this._mseSourceOpened=!0,this._hasPendingLoad&&(this._hasPendingLoad=!1,this.load())}),this._msectl.on(ui.ERROR,d=>{this._emitter.emit(Fe.ERROR,st.MEDIA_ERROR,At.MEDIA_MSE_ERROR,d)}),this._msectl.attachMediaElement(l),this._pendingSeekTime!=null)try{l.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(d){}}detachMediaElement(){this._mediaElement&&(this._msectl.detachMediaElement(),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement.removeEventListener("seeking",this.e.onvSeeking),this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay),this._mediaElement.removeEventListener("stalled",this.e.onvStalled),this._mediaElement.removeEventListener("progress",this.e.onvProgress),this._mediaElement=null),this._msectl&&(this._msectl.destroy(),this._msectl=null)}load(){if(!this._mediaElement)throw new Q("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new Q("FlvPlayer.load() has been called, please call unload() first!");if(!this._hasPendingLoad){if(this._config.deferLoadAfterSourceOpen&&this._mseSourceOpened===!1){this._hasPendingLoad=!0;return}this._mediaElement.readyState>0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new ci(this._mediaDataSource,this._config),this._transmuxer.on(ce.INIT_SEGMENT,(l,d)=>{this._msectl.appendInitSegment(d)}),this._transmuxer.on(ce.MEDIA_SEGMENT,(l,d)=>{if(this._msectl.appendMediaSegment(d),this._config.lazyLoad&&!this._config.isLive){let g=this._mediaElement.currentTime;d.info.endDts>=(g+this._config.lazyLoadMaxDuration)*1e3&&this._progressChecker==null&&($.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}}),this._transmuxer.on(ce.LOADING_COMPLETE,()=>{this._msectl.endOfStream(),this._emitter.emit(Fe.LOADING_COMPLETE)}),this._transmuxer.on(ce.RECOVERED_EARLY_EOF,()=>{this._emitter.emit(Fe.RECOVERED_EARLY_EOF)}),this._transmuxer.on(ce.IO_ERROR,(l,d)=>{this._emitter.emit(Fe.ERROR,st.NETWORK_ERROR,l,d)}),this._transmuxer.on(ce.DEMUX_ERROR,(l,d)=>{this._emitter.emit(Fe.ERROR,st.MEDIA_ERROR,l,{code:-1,msg:d})}),this._transmuxer.on(ce.MEDIA_INFO,l=>{this._mediaInfo=l,this._emitter.emit(Fe.MEDIA_INFO,Object.assign({},l))}),this._transmuxer.on(ce.METADATA_ARRIVED,l=>{this._emitter.emit(Fe.METADATA_ARRIVED,l)}),this._transmuxer.on(ce.SCRIPTDATA_ARRIVED,l=>{this._emitter.emit(Fe.SCRIPTDATA_ARRIVED,l)}),this._transmuxer.on(ce.STATISTICS_INFO,l=>{this._statisticsInfo=this._fillStatisticsInfo(l),this._emitter.emit(Fe.STATISTICS_INFO,Object.assign({},this._statisticsInfo))}),this._transmuxer.on(ce.RECOMMEND_SEEKPOINT,l=>{this._mediaElement&&!this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=l/1e3)}),this._transmuxer.open()}}unload(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)}play(){return this._mediaElement.play()}pause(){this._mediaElement.pause()}get type(){return this._type}get buffered(){return this._mediaElement.buffered}get duration(){return this._mediaElement.duration}get volume(){return this._mediaElement.volume}set volume(l){this._mediaElement.volume=l}get muted(){return this._mediaElement.muted}set muted(l){this._mediaElement.muted=l}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(l){this._mediaElement?this._internalSeek(l):this._pendingSeekTime=l}get mediaInfo(){return Object.assign({},this._mediaInfo)}get statisticsInfo(){return this._statisticsInfo==null&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)}_fillStatisticsInfo(l){if(l.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return l;let d=!0,g=0,v=0;if(this._mediaElement.getVideoPlaybackQuality){let S=this._mediaElement.getVideoPlaybackQuality();g=S.totalVideoFrames,v=S.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(g=this._mediaElement.webkitDecodedFrameCount,v=this._mediaElement.webkitDroppedFrameCount):d=!1;return d&&(l.decodedFrames=g,l.droppedFrames=v),l}_onmseUpdateEnd(){if(!this._config.lazyLoad||this._config.isLive)return;let l=this._mediaElement.buffered,d=this._mediaElement.currentTime,g=0,v=0;for(let S=0;S<l.length;S++){let U=l.start(S),q=l.end(S);if(U<=d&&d<q){g=U,v=q;break}}v>=d+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&($.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}_onmseBufferFull(){$.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._progressChecker==null&&this._suspendTransmuxer()}_suspendTransmuxer(){this._transmuxer&&(this._transmuxer.pause(),this._progressChecker==null&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))}_checkProgressAndResume(){let l=this._mediaElement.currentTime,d=this._mediaElement.buffered,g=!1;for(let v=0;v<d.length;v++){let S=d.start(v),U=d.end(v);if(l>=S&&l<U){l>=U-this._config.lazyLoadRecoverDuration&&(g=!0);break}}g&&(window.clearInterval(this._progressChecker),this._progressChecker=null,g&&($.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}_isTimepointBuffered(l){let d=this._mediaElement.buffered;for(let g=0;g<d.length;g++){let v=d.start(g),S=d.end(g);if(l>=v&&l<S)return!0}return!1}_internalSeek(l){let d=this._isTimepointBuffered(l),g=!1,v=0;if(l<1&&this._mediaElement.buffered.length>0){let S=this._mediaElement.buffered.start(0);(S<1&&l<S||H.safari)&&(g=!0,v=H.safari?.1:S)}if(g)this._requestSetTime=!0,this._mediaElement.currentTime=v;else if(d){if(!this._alwaysSeekKeyframe)this._requestSetTime=!0,this._mediaElement.currentTime=l;else{let S=this._msectl.getNearestKeyframe(Math.floor(l*1e3));this._requestSetTime=!0,S!=null?this._mediaElement.currentTime=S.dts/1e3:this._mediaElement.currentTime=l}this._progressChecker!=null&&this._checkProgressAndResume()}else this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(l),this._transmuxer.seek(Math.floor(l*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=l)}_checkAndApplyUnbufferedSeekpoint(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){let l=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(l)||(this._progressChecker!=null&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(l),this._transmuxer.seek(Math.floor(l*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=l))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}_checkAndResumeStuckPlayback(l){let d=this._mediaElement;if(l||!this._receivedCanPlay||d.readyState<2){let g=d.buffered;g.length>0&&d.currentTime<g.start(0)&&($.w(this.TAG,`Playback seems stuck at ${d.currentTime}, seek to ${g.start(0)}`),this._requestSetTime=!0,this._mediaElement.currentTime=g.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)}_onvLoadedMetadata(l){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}_onvSeeking(l){let d=this._mediaElement.currentTime,g=this._mediaElement.buffered;if(this._requestSetTime){this._requestSetTime=!1;return}if(d<1&&g.length>0){let v=g.start(0);if(v<1&&d<v||H.safari){this._requestSetTime=!0,this._mediaElement.currentTime=H.safari?.1:v;return}}if(this._isTimepointBuffered(d)){if(this._alwaysSeekKeyframe){let v=this._msectl.getNearestKeyframe(Math.floor(d*1e3));v!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=v.dts/1e3)}this._progressChecker!=null&&this._checkProgressAndResume();return}this._seekpointRecord={seekPoint:d,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}_onvCanPlay(l){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}_onvStalled(l){this._checkAndResumeStuckPlayback(!0)}_onvProgress(l){this._checkAndResumeStuckPlayback()}}var It=Xt;class ii{constructor(l,d){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(fe()),this._config=ge(),typeof d=="object"&&Object.assign(this._config,d),l.type.toLowerCase()==="flv")throw new ke("NativePlayer does't support flv MediaDataSource input!");if(l.hasOwnProperty("segments"))throw new ke(`NativePlayer(${l.type}) doesn't support multipart playback!`);this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=l,this._mediaElement=null}destroy(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}on(l,d){l===Fe.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(Fe.MEDIA_INFO,this.mediaInfo)}):l===Fe.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(Fe.STATISTICS_INFO,this.statisticsInfo)}),this._emitter.addListener(l,d)}off(l,d){this._emitter.removeListener(l,d)}attachMediaElement(l){if(this._mediaElement=l,l.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{l.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(d){}}detachMediaElement(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement.removeEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._mediaElement=null),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}load(){if(!this._mediaElement)throw new Q("HTMLMediaElement must be attached before load()!");this._mediaElement.src=this._mediaDataSource.url,this._mediaElement.readyState>0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)}unload(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)}play(){return this._mediaElement.play()}pause(){this._mediaElement.pause()}get type(){return this._type}get buffered(){return this._mediaElement.buffered}get duration(){return this._mediaElement.duration}get volume(){return this._mediaElement.volume}set volume(l){this._mediaElement.volume=l}get muted(){return this._mediaElement.muted}set muted(l){this._mediaElement.muted=l}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(l){this._mediaElement?this._mediaElement.currentTime=l:this._pendingSeekTime=l}get mediaInfo(){let d={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(d.duration=Math.floor(this._mediaElement.duration*1e3),this._mediaElement instanceof HTMLVideoElement&&(d.width=this._mediaElement.videoWidth,d.height=this._mediaElement.videoHeight)),d}get statisticsInfo(){let l={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return l;let d=!0,g=0,v=0;if(this._mediaElement.getVideoPlaybackQuality){let S=this._mediaElement.getVideoPlaybackQuality();g=S.totalVideoFrames,v=S.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(g=this._mediaElement.webkitDecodedFrameCount,v=this._mediaElement.webkitDroppedFrameCount):d=!1;return d&&(l.decodedFrames=g,l.droppedFrames=v),l}_onvLoadedMetadata(l){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(Fe.MEDIA_INFO,this.mediaInfo)}_reportStatisticsInfo(){this._emitter.emit(Fe.STATISTICS_INFO,this.statisticsInfo)}}var si=ii;O.install();function hi(Be,l){let d=Be;if(d==null||typeof d!="object")throw new ke("MediaDataSource must be an javascript object!");if(!d.hasOwnProperty("type"))throw new ke("MediaDataSource must has type field to indicate video file type!");switch(d.type){case"flv":return new It(d,l);default:return new si(d,l)}}function Ei(){return rt.supportMSEH264Playback()}function ni(){return rt.getFeatureList()}let fi={};fi.createPlayer=hi,fi.isSupported=Ei,fi.getFeatureList=ni,fi.BaseLoader=K,fi.LoaderStatus=f,fi.LoaderErrors=N,fi.Events=Fe,fi.ErrorTypes=st,fi.ErrorDetails=At,fi.FlvPlayer=It,fi.NativePlayer=si,fi.LoggingControl=we,Object.defineProperty(fi,"version",{enumerable:!0,get:function(){return"__VERSION__"}});var tn=fi},36785:function(Wt,Ve,A){"use strict";A.d(Ve,{o2:function(){return V},yT:function(){return $}});var C=A(26390),O=A(33166);const le=O.i.map(ye=>`${ye}-inverse`),fe=["success","processing","error","default","warning"];function V(ye){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0)?[].concat((0,C.Z)(le),(0,C.Z)(O.i)).includes(ye):O.i.includes(ye)}function $(ye){return fe.includes(ye)}},79676:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return $}});var C=A(19447);function O(ye,de,ae,Q){if(Q===!1)return{adjustX:!1,adjustY:!1};const ke=Q&&typeof Q=="object"?Q:{},ve={};switch(ye){case"top":case"bottom":ve.shiftX=de.dropdownArrowOffset*2+ae;break;case"left":case"right":ve.shiftY=de.dropdownArrowOffsetVertical*2+ae;break}const f=Object.assign(Object.assign({},ve),ke);return f.shiftX||(f.adjustX=!0),f.shiftY||(f.adjustY=!0),f}const le={left:{points:["cr","cl"]},right:{points:["cl","cr"]},top:{points:["bc","tc"]},bottom:{points:["tc","bc"]},topLeft:{points:["bl","tl"]},leftTop:{points:["tr","tl"]},topRight:{points:["br","tr"]},rightTop:{points:["tl","tr"]},bottomRight:{points:["tr","br"]},rightBottom:{points:["bl","br"]},bottomLeft:{points:["tl","bl"]},leftBottom:{points:["br","bl"]}},fe={topLeft:{points:["bl","tc"]},leftTop:{points:["tr","cl"]},topRight:{points:["br","tc"]},rightTop:{points:["tl","cr"]},bottomRight:{points:["tr","bc"]},rightBottom:{points:["bl","cr"]},bottomLeft:{points:["tl","bc"]},leftBottom:{points:["br","cl"]}},V=new Set(["topLeft","topRight","bottomLeft","bottomRight","leftTop","leftBottom","rightTop","rightBottom"]);function $(ye){const{arrowWidth:de,autoAdjustOverflow:ae,arrowPointAtCenter:Q,offset:ke,borderRadius:ve,visibleFirst:f}=ye,N=de/2,K={};return Object.keys(le).forEach(_e=>{const Re=Q&&fe[_e]||le[_e],H=Object.assign(Object.assign({},Re),{offset:[0,0]});switch(K[_e]=H,V.has(_e)&&(H.autoArrow=!1),_e){case"top":case"topLeft":case"topRight":H.offset[1]=-N-ke;break;case"bottom":case"bottomLeft":case"bottomRight":H.offset[1]=N+ke;break;case"left":case"leftTop":case"leftBottom":H.offset[0]=-N-ke;break;case"right":case"rightTop":case"rightBottom":H.offset[0]=N+ke;break}const D=(0,C.fS)({contentRadius:ve,limitVerticalRadius:!0});if(Q)switch(_e){case"topLeft":case"bottomLeft":H.offset[0]=-D.dropdownArrowOffset-N;break;case"topRight":case"bottomRight":H.offset[0]=D.dropdownArrowOffset+N;break;case"leftTop":case"rightTop":H.offset[1]=-D.dropdownArrowOffset-N;break;case"leftBottom":case"rightBottom":H.offset[1]=D.dropdownArrowOffset+N;break}H.overflow=O(_e,D,de,ae),f&&(H.htmlRegion="visibleFirst")}),K}},91857:function(Wt,Ve,A){"use strict";var C=A(59301),O=A(53878),le=A(92310),fe=A.n(le),V=A(31561),$=A(80764),ye=A(35788),de=A(64002),ae=A(79676),Q=A(53487),ke=A(92343),ve=A(36355),f=A(20834),N=A(40875),K=A(88088),_e=A(47211);const Re=null,H=b=>{const{menu:oe,arrow:he,prefixCls:Y,children:Ne,trigger:Ke,disabled:Xe,dropdownRender:Se,getPopupContainer:j,overlayClassName:X,rootClassName:J,open:M,onOpenChange:Ae,visible:ze,onVisibleChange:ge,mouseEnterDelay:Ee=.15,mouseLeaveDelay:rt=.1,autoAdjustOverflow:qe=!0,placement:Fe="",overlay:He,transitionName:we}=b,{getPopupContainer:it,getPrefixCls:pt,direction:Lt}=C.useContext(ve.E_),Ut=C.useMemo(()=>{const se=pt();return we!==void 0?we:Fe.includes("top")?`${se}-slide-down`:`${se}-slide-up`},[pt,Fe,we]),$t=C.useMemo(()=>Fe?Fe.includes("Center")?Fe.slice(0,Fe.indexOf("Center")):Fe:Lt==="rtl"?"bottomRight":"bottomLeft",[Fe,Lt]),vt=pt("dropdown",Y),[Bt,Ht]=(0,_e.Z)(vt),[,Zt]=(0,K.Z)(),jt=C.Children.only(Ne),R=(0,ke.Tm)(jt,{className:fe()(`${vt}-trigger`,{[`${vt}-rtl`]:Lt==="rtl"},jt.props.className),disabled:Xe}),P=Xe?[]:Ke;let x;P&&P.includes("contextMenu")&&(x=!0);const[L,F]=(0,ye.Z)(!1,{value:M!=null?M:ze}),ne=(0,$.useEvent)(se=>{Ae==null||Ae(se),ge==null||ge(se),F(se)}),I=fe()(X,J,Ht,{[`${vt}-rtl`]:Lt==="rtl"}),G=(0,ae.Z)({arrowPointAtCenter:typeof he=="object"&&he.pointAtCenter,autoAdjustOverflow:qe,offset:Zt.marginXXS,arrowWidth:he?Zt.sizePopupArrow:0,borderRadius:Zt.borderRadius}),W=C.useCallback(()=>{F(!1)},[]),w=()=>{let se;return oe!=null&&oe.items?se=C.createElement(f.default,Object.assign({},oe)):typeof He=="function"?se=He():se=He,Se&&(se=Se(se)),se=C.Children.only(typeof se=="string"?C.createElement("span",null,se):se),C.createElement(N.J,{prefixCls:`${vt}-menu`,expandIcon:C.createElement("span",{className:`${vt}-menu-submenu-arrow`},C.createElement(O.Z,{className:`${vt}-menu-submenu-arrow-icon`})),mode:"vertical",selectable:!1,onClick:W,validator:Te=>{let{mode:We}=Te}},se)};return Bt(C.createElement(V.Z,Object.assign({alignPoint:x},(0,de.Z)(b,["rootClassName"]),{mouseEnterDelay:Ee,mouseLeaveDelay:rt,visible:L,builtinPlacements:G,arrow:!!he,overlayClassName:I,prefixCls:vt,getPopupContainer:j||it,transitionName:Ut,trigger:P,overlay:w,placement:$t,onVisibleChange:ne}),R))};function D(b){return Object.assign(Object.assign({},b),{align:{overflow:{adjustX:!1,adjustY:!1}}})}const B=(0,Q.Z)(H,"dropdown",b=>b,D),z=b=>C.createElement(B,Object.assign({},b),C.createElement("span",null));H._InternalPanelDoNotUseOrYouWillBeFired=z,Ve.Z=H},38854:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return K}});var C=A(91857),O=A(92310),le=A.n(O),fe=A(59301),V=A(19362),$=A(3113),ye=A(36355),de=A(81327),ae=A(33234),Q=A(47211),ke=function(_e,Re){var H={};for(var D in _e)Object.prototype.hasOwnProperty.call(_e,D)&&Re.indexOf(D)<0&&(H[D]=_e[D]);if(_e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var B=0,D=Object.getOwnPropertySymbols(_e);B<D.length;B++)Re.indexOf(D[B])<0&&Object.prototype.propertyIsEnumerable.call(_e,D[B])&&(H[D[B]]=_e[D[B]]);return H};const ve=_e=>{const{getPopupContainer:Re,getPrefixCls:H,direction:D}=fe.useContext(ye.E_),{prefixCls:B,type:z="default",danger:b,disabled:oe,loading:he,onClick:Y,htmlType:Ne,children:Ke,className:Xe,menu:Se,arrow:j,autoFocus:X,overlay:J,trigger:M,align:Ae,open:ze,onOpenChange:ge,placement:Ee,getPopupContainer:rt,href:qe,icon:Fe=fe.createElement(V.Z,null),title:He,buttonsRender:we=w=>w,mouseEnterDelay:it,mouseLeaveDelay:pt,overlayClassName:Lt,overlayStyle:Ut,destroyPopupOnHide:$t,dropdownRender:vt}=_e,Bt=ke(_e,["prefixCls","type","danger","disabled","loading","onClick","htmlType","children","className","menu","arrow","autoFocus","overlay","trigger","align","open","onOpenChange","placement","getPopupContainer","href","icon","title","buttonsRender","mouseEnterDelay","mouseLeaveDelay","overlayClassName","overlayStyle","destroyPopupOnHide","dropdownRender"]),Ht=H("dropdown",B),Zt=`${Ht}-button`,[jt,R]=(0,Q.Z)(Ht),P={menu:Se,arrow:j,autoFocus:X,align:Ae,disabled:oe,trigger:oe?[]:M,onOpenChange:ge,getPopupContainer:rt||Re,mouseEnterDelay:it,mouseLeaveDelay:pt,overlayClassName:Lt,overlayStyle:Ut,destroyPopupOnHide:$t,dropdownRender:vt},{compactSize:x,compactItemClassnames:L}=(0,ae.ri)(Ht,D),F=le()(Zt,L,Xe,R);"overlay"in _e&&(P.overlay=J),"open"in _e&&(P.open=ze),"placement"in _e?P.placement=Ee:P.placement=D==="rtl"?"bottomLeft":"bottomRight";const ne=fe.createElement($.ZP,{type:z,danger:b,disabled:oe,loading:he,onClick:Y,htmlType:Ne,href:qe,title:He},Ke),I=fe.createElement($.ZP,{type:z,danger:b,icon:Fe}),[G,W]=we([ne,I]);return jt(fe.createElement(de.Z.Compact,Object.assign({className:F,size:x,block:!0},Bt),G,fe.createElement(C.Z,Object.assign({},P),W)))};ve.__ANT_BUTTON=!0;var f=ve;const N=C.Z;N.Button=f;var K=N},47211:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return ke}});var C=A(17313),O=A(13826),le=A(92899),fe=A(29878),V=A(19447),$=A(83116),ye=A(37613),ae=ve=>{const{componentCls:f,menuCls:N,colorError:K,colorTextLightSolid:_e}=ve,Re=`${N}-item`;return{[`${f}, ${f}-menu-submenu`]:{[`${N} ${Re}`]:{[`&${Re}-danger:not(${Re}-disabled)`]:{color:K,"&:hover":{color:_e,backgroundColor:K}}}}}};const Q=ve=>{const{componentCls:f,menuCls:N,zIndexPopup:K,dropdownArrowDistance:_e,sizePopupArrow:Re,antCls:H,iconCls:D,motionDurationMid:B,dropdownPaddingVertical:z,fontSize:b,dropdownEdgeChildPadding:oe,colorTextDisabled:he,fontSizeIcon:Y,controlPaddingHorizontal:Ne,colorBgElevated:Ke}=ve;return[{[f]:Object.assign(Object.assign({},(0,C.Wf)(ve)),{position:"absolute",top:-9999,left:{_skip_check_:!0,value:-9999},zIndex:K,display:"block","&::before":{position:"absolute",insetBlock:-_e+Re/2,zIndex:-9999,opacity:1e-4,content:'""'},[`&-trigger${H}-btn`]:{[`& > ${D}-down, & > ${H}-btn-icon > ${D}-down`]:{fontSize:Y}},[`${f}-wrap`]:{position:"relative",[`${H}-btn > ${D}-down`]:{fontSize:Y},[`${D}-down::before`]:{transition:`transform ${B}`}},[`${f}-wrap-open`]:{[`${D}-down::before`]:{transform:"rotate(180deg)"}},"\n &-hidden,\n &-menu-hidden,\n &-menu-submenu-hidden\n ":{display:"none"},[`&${H}-slide-down-enter${H}-slide-down-enter-active${f}-placement-bottomLeft,
|
|
&${H}-slide-down-appear${H}-slide-down-appear-active${f}-placement-bottomLeft,
|
|
&${H}-slide-down-enter${H}-slide-down-enter-active${f}-placement-bottom,
|
|
&${H}-slide-down-appear${H}-slide-down-appear-active${f}-placement-bottom,
|
|
&${H}-slide-down-enter${H}-slide-down-enter-active${f}-placement-bottomRight,
|
|
&${H}-slide-down-appear${H}-slide-down-appear-active${f}-placement-bottomRight`]:{animationName:O.fJ},[`&${H}-slide-up-enter${H}-slide-up-enter-active${f}-placement-topLeft,
|
|
&${H}-slide-up-appear${H}-slide-up-appear-active${f}-placement-topLeft,
|
|
&${H}-slide-up-enter${H}-slide-up-enter-active${f}-placement-top,
|
|
&${H}-slide-up-appear${H}-slide-up-appear-active${f}-placement-top,
|
|
&${H}-slide-up-enter${H}-slide-up-enter-active${f}-placement-topRight,
|
|
&${H}-slide-up-appear${H}-slide-up-appear-active${f}-placement-topRight`]:{animationName:O.Qt},[`&${H}-slide-down-leave${H}-slide-down-leave-active${f}-placement-bottomLeft,
|
|
&${H}-slide-down-leave${H}-slide-down-leave-active${f}-placement-bottom,
|
|
&${H}-slide-down-leave${H}-slide-down-leave-active${f}-placement-bottomRight`]:{animationName:O.Uw},[`&${H}-slide-up-leave${H}-slide-up-leave-active${f}-placement-topLeft,
|
|
&${H}-slide-up-leave${H}-slide-up-leave-active${f}-placement-top,
|
|
&${H}-slide-up-leave${H}-slide-up-leave-active${f}-placement-topRight`]:{animationName:O.ly}})},(0,V.ZP)(ve,{colorBg:Ke,limitVerticalRadius:!0,arrowPlacement:{top:!0,bottom:!0}}),{[`${f} ${N}`]:{position:"relative",margin:0},[`${N}-submenu-popup`]:{position:"absolute",zIndex:K,background:"transparent",boxShadow:"none",transformOrigin:"0 0","ul, li":{listStyle:"none",margin:0}},[`${f}, ${f}-menu-submenu`]:{[N]:Object.assign(Object.assign({padding:oe,listStyleType:"none",backgroundColor:Ke,backgroundClip:"padding-box",borderRadius:ve.borderRadiusLG,outline:"none",boxShadow:ve.boxShadowSecondary},(0,C.Qy)(ve)),{[`${N}-item-group-title`]:{padding:`${z}px ${Ne}px`,color:ve.colorTextDescription,transition:`all ${B}`},[`${N}-item`]:{position:"relative",display:"flex",alignItems:"center"},[`${N}-item-icon`]:{minWidth:b,marginInlineEnd:ve.marginXS,fontSize:ve.fontSizeSM},[`${N}-title-content`]:{flex:"auto","> a":{color:"inherit",transition:`all ${B}`,"&:hover":{color:"inherit"},"&::after":{position:"absolute",inset:0,content:'""'}}},[`${N}-item, ${N}-submenu-title`]:Object.assign(Object.assign({clear:"both",margin:0,padding:`${z}px ${Ne}px`,color:ve.colorText,fontWeight:"normal",fontSize:b,lineHeight:ve.lineHeight,cursor:"pointer",transition:`all ${B}`,borderRadius:ve.borderRadiusSM,"&:hover, &-active":{backgroundColor:ve.controlItemBgHover}},(0,C.Qy)(ve)),{"&-selected":{color:ve.colorPrimary,backgroundColor:ve.controlItemBgActive,"&:hover, &-active":{backgroundColor:ve.controlItemBgActiveHover}},"&-disabled":{color:he,cursor:"not-allowed","&:hover":{color:he,backgroundColor:Ke,cursor:"not-allowed"},a:{pointerEvents:"none"}},"&-divider":{height:1,margin:`${ve.marginXXS}px 0`,overflow:"hidden",lineHeight:0,backgroundColor:ve.colorSplit},[`${f}-menu-submenu-expand-icon`]:{position:"absolute",insetInlineEnd:ve.paddingXS,[`${f}-menu-submenu-arrow-icon`]:{marginInlineEnd:"0 !important",color:ve.colorTextDescription,fontSize:Y,fontStyle:"normal"}}}),[`${N}-item-group-list`]:{margin:`0 ${ve.marginXS}px`,padding:0,listStyle:"none"},[`${N}-submenu-title`]:{paddingInlineEnd:Ne+ve.fontSizeSM},[`${N}-submenu-vertical`]:{position:"relative"},[`${N}-submenu${N}-submenu-disabled ${f}-menu-submenu-title`]:{[`&, ${f}-menu-submenu-arrow-icon`]:{color:he,backgroundColor:Ke,cursor:"not-allowed"}},[`${N}-submenu-selected ${f}-menu-submenu-title`]:{color:ve.colorPrimary}})}},[(0,O.oN)(ve,"slide-up"),(0,O.oN)(ve,"slide-down"),(0,le.Fm)(ve,"move-up"),(0,le.Fm)(ve,"move-down"),(0,fe._y)(ve,"zoom-big")]]};var ke=(0,$.Z)("Dropdown",(ve,f)=>{let{rootPrefixCls:N}=f;const{marginXXS:K,sizePopupArrow:_e,controlHeight:Re,fontSize:H,lineHeight:D,paddingXXS:B,componentCls:z,borderRadiusLG:b}=ve,oe=(Re-H*D)/2,{dropdownArrowOffset:he}=(0,V.fS)({contentRadius:b}),Y=(0,ye.TS)(ve,{menuCls:`${z}-menu`,rootPrefixCls:N,dropdownArrowDistance:_e/2+K,dropdownArrowOffset:he,dropdownPaddingVertical:oe,dropdownEdgeChildPadding:B});return[Q(Y),ae(Y)]},ve=>({zIndexPopup:ve.zIndexPopupBase+50}))},99580:function(Wt,Ve,A){"use strict";A.d(Ve,{D:function(){return B},Z:function(){return oe}});var C=A(5891),O=A(59301),le={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"bars",theme:"outlined"},fe=le,V=A(88853),$=function(Y,Ne){return O.createElement(V.Z,(0,C.Z)({},Y,{ref:Ne,icon:fe}))},ye=O.forwardRef($),de=ye,ae=A(16537),Q=A(53878),ke=A(92310),ve=A.n(ke),f=A(64002),K=he=>!isNaN(parseFloat(he))&&isFinite(he),_e=A(36355),Re=A(84966),H=function(he,Y){var Ne={};for(var Ke in he)Object.prototype.hasOwnProperty.call(he,Ke)&&Y.indexOf(Ke)<0&&(Ne[Ke]=he[Ke]);if(he!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Xe=0,Ke=Object.getOwnPropertySymbols(he);Xe<Ke.length;Xe++)Y.indexOf(Ke[Xe])<0&&Object.prototype.propertyIsEnumerable.call(he,Ke[Xe])&&(Ne[Ke[Xe]]=he[Ke[Xe]]);return Ne};const D={xs:"479.98px",sm:"575.98px",md:"767.98px",lg:"991.98px",xl:"1199.98px",xxl:"1599.98px"},B=O.createContext({}),z=(()=>{let he=0;return function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return he+=1,`${Y}${he}`}})();var oe=O.forwardRef((he,Y)=>{const{prefixCls:Ne,className:Ke,trigger:Xe,children:Se,defaultCollapsed:j=!1,theme:X="dark",style:J={},collapsible:M=!1,reverseArrow:Ae=!1,width:ze=200,collapsedWidth:ge=80,zeroWidthTriggerStyle:Ee,breakpoint:rt,onCollapse:qe,onBreakpoint:Fe}=he,He=H(he,["prefixCls","className","trigger","children","defaultCollapsed","theme","style","collapsible","reverseArrow","width","collapsedWidth","zeroWidthTriggerStyle","breakpoint","onCollapse","onBreakpoint"]),{siderHook:we}=(0,O.useContext)(Re.Gs),[it,pt]=(0,O.useState)("collapsed"in he?he.collapsed:j),[Lt,Ut]=(0,O.useState)(!1);(0,O.useEffect)(()=>{"collapsed"in he&&pt(he.collapsed)},[he.collapsed]);const $t=(R,P)=>{"collapsed"in he||pt(R),qe==null||qe(R,P)},vt=(0,O.useRef)();vt.current=R=>{Ut(R.matches),Fe==null||Fe(R.matches),it!==R.matches&&$t(R.matches,"responsive")},(0,O.useEffect)(()=>{function R(x){return vt.current(x)}let P;if(typeof window!="undefined"){const{matchMedia:x}=window;if(x&&rt&&rt in D){P=x(`(max-width: ${D[rt]})`);try{P.addEventListener("change",R)}catch(L){P.addListener(R)}R(P)}}return()=>{try{P==null||P.removeEventListener("change",R)}catch(x){P==null||P.removeListener(R)}}},[rt]),(0,O.useEffect)(()=>{const R=z("ant-sider-");return we.addSider(R),()=>we.removeSider(R)},[]);const Bt=()=>{$t(!it,"clickTrigger")},{getPrefixCls:Ht}=(0,O.useContext)(_e.E_),Zt=()=>{const R=Ht("layout-sider",Ne),P=(0,f.Z)(He,["collapsed"]),x=it?ge:ze,L=K(x)?`${x}px`:String(x),F=parseFloat(String(ge||0))===0?O.createElement("span",{onClick:Bt,className:ve()(`${R}-zero-width-trigger`,`${R}-zero-width-trigger-${Ae?"right":"left"}`),style:Ee},Xe||O.createElement(de,null)):null,G={expanded:Ae?O.createElement(Q.Z,null):O.createElement(ae.Z,null),collapsed:Ae?O.createElement(ae.Z,null):O.createElement(Q.Z,null)}[it?"collapsed":"expanded"],W=Xe!==null?F||O.createElement("div",{className:`${R}-trigger`,onClick:Bt,style:{width:L}},Xe||G):null,w=Object.assign(Object.assign({},J),{flex:`0 0 ${L}`,maxWidth:L,minWidth:L,width:L}),se=ve()(R,`${R}-${X}`,{[`${R}-collapsed`]:!!it,[`${R}-has-trigger`]:M&&Xe!==null&&!F,[`${R}-below`]:!!Lt,[`${R}-zero-width`]:parseFloat(L)===0},Ke);return O.createElement("aside",Object.assign({className:se},P,{style:w,ref:Y}),O.createElement("div",{className:`${R}-children`},Se),M||Lt&&F?W:null)},jt=O.useMemo(()=>({siderCollapsed:it}),[it]);return O.createElement(B.Provider,{value:jt},Zt())})},84966:function(Wt,Ve,A){"use strict";A.d(Ve,{VY:function(){return B},$_:function(){return D},h4:function(){return H},Gs:function(){return f},ZP:function(){return z}});var C=A(26390),O=A(92310),le=A.n(O),fe=A(64002),V=A(59301),$=A(36355),ye=A(83116),ae=b=>{const{componentCls:oe,bodyBg:he,lightSiderBg:Y,lightTriggerBg:Ne,lightTriggerColor:Ke}=b;return{[`${oe}-sider-light`]:{background:Y,[`${oe}-sider-trigger`]:{color:Ke,background:Ne},[`${oe}-sider-zero-width-trigger`]:{color:Ke,background:Ne,border:`1px solid ${he}`,borderInlineStart:0}}}};const Q=b=>{const{antCls:oe,componentCls:he,colorText:Y,triggerColor:Ne,footerBg:Ke,triggerBg:Xe,headerHeight:Se,headerPadding:j,headerColor:X,footerPadding:J,triggerHeight:M,zeroTriggerHeight:Ae,zeroTriggerWidth:ze,motionDurationMid:ge,motionDurationSlow:Ee,fontSize:rt,borderRadius:qe,bodyBg:Fe,headerBg:He,siderBg:we}=b;return{[he]:Object.assign(Object.assign({display:"flex",flex:"auto",flexDirection:"column",minHeight:0,background:Fe,"&, *":{boxSizing:"border-box"},[`&${he}-has-sider`]:{flexDirection:"row",[`> ${he}, > ${he}-content`]:{width:0}},[`${he}-header, &${he}-footer`]:{flex:"0 0 auto"},[`${he}-sider`]:{position:"relative",minWidth:0,background:we,transition:`all ${ge}, background 0s`,"&-children":{height:"100%",marginTop:-.1,paddingTop:.1,[`${oe}-menu${oe}-menu-inline-collapsed`]:{width:"auto"}},"&-has-trigger":{paddingBottom:M},"&-right":{order:1},"&-trigger":{position:"fixed",bottom:0,zIndex:1,height:M,color:Ne,lineHeight:`${M}px`,textAlign:"center",background:Xe,cursor:"pointer",transition:`all ${ge}`},"&-zero-width":{"> *":{overflow:"hidden"},"&-trigger":{position:"absolute",top:Se,insetInlineEnd:-ze,zIndex:1,width:ze,height:Ae,color:Ne,fontSize:b.fontSizeXL,display:"flex",alignItems:"center",justifyContent:"center",background:we,borderStartStartRadius:0,borderStartEndRadius:qe,borderEndEndRadius:qe,borderEndStartRadius:0,cursor:"pointer",transition:`background ${Ee} ease`,"&::after":{position:"absolute",inset:0,background:"transparent",transition:`all ${Ee}`,content:'""'},"&:hover::after":{background:"rgba(255, 255, 255, 0.2)"},"&-right":{insetInlineStart:-ze,borderStartStartRadius:qe,borderStartEndRadius:0,borderEndEndRadius:0,borderEndStartRadius:qe}}}}},ae(b)),{"&-rtl":{direction:"rtl"}}),[`${he}-header`]:{height:Se,padding:j,color:X,lineHeight:`${Se}px`,background:He,[`${oe}-menu`]:{lineHeight:"inherit"}},[`${he}-footer`]:{padding:J,color:Y,fontSize:rt,background:Ke},[`${he}-content`]:{flex:"auto",minHeight:0}}};var ke=(0,ye.Z)("Layout",b=>[Q(b)],b=>{const{colorBgLayout:oe,controlHeight:he,controlHeightLG:Y,colorText:Ne,controlHeightSM:Ke,marginXXS:Xe,colorTextLightSolid:Se,colorBgContainer:j}=b,X=Y*1.25;return{colorBgHeader:"#001529",colorBgBody:oe,colorBgTrigger:"#002140",bodyBg:oe,headerBg:"#001529",headerHeight:he*2,headerPadding:`0 ${X}px`,headerColor:Ne,footerPadding:`${Ke}px ${X}px`,footerBg:oe,siderBg:"#001529",triggerHeight:Y+Xe*2,triggerBg:"#002140",triggerColor:Se,zeroTriggerWidth:Y,zeroTriggerHeight:Y,lightSiderBg:j,lightTriggerBg:j,lightTriggerColor:Ne}},{deprecatedTokens:[["colorBgBody","bodyBg"],["colorBgHeader","headerBg"],["colorBgTrigger","triggerBg"]]}),ve=function(b,oe){var he={};for(var Y in b)Object.prototype.hasOwnProperty.call(b,Y)&&oe.indexOf(Y)<0&&(he[Y]=b[Y]);if(b!=null&&typeof Object.getOwnPropertySymbols=="function")for(var Ne=0,Y=Object.getOwnPropertySymbols(b);Ne<Y.length;Ne++)oe.indexOf(Y[Ne])<0&&Object.prototype.propertyIsEnumerable.call(b,Y[Ne])&&(he[Y[Ne]]=b[Y[Ne]]);return he};const f=V.createContext({siderHook:{addSider:()=>null,removeSider:()=>null}});function N(b){let{suffixCls:oe,tagName:he,displayName:Y}=b;return Ne=>V.forwardRef((Xe,Se)=>V.createElement(Ne,Object.assign({ref:Se,suffixCls:oe,tagName:he},Xe)))}const K=V.forwardRef((b,oe)=>{const{prefixCls:he,suffixCls:Y,className:Ne,tagName:Ke}=b,Xe=ve(b,["prefixCls","suffixCls","className","tagName"]),{getPrefixCls:Se}=V.useContext($.E_),j=Se("layout",he),[X,J]=ke(j),M=Y?`${j}-${Y}`:j;return X(V.createElement(Ke,Object.assign({className:le()(he||M,Ne,J),ref:oe},Xe)))}),_e=V.forwardRef((b,oe)=>{const{direction:he}=V.useContext($.E_),[Y,Ne]=V.useState([]),{prefixCls:Ke,className:Xe,rootClassName:Se,children:j,hasSider:X,tagName:J,style:M}=b,Ae=ve(b,["prefixCls","className","rootClassName","children","hasSider","tagName","style"]),ze=(0,fe.Z)(Ae,["suffixCls"]),{getPrefixCls:ge,layout:Ee}=V.useContext($.E_),rt=ge("layout",Ke),[qe,Fe]=ke(rt),He=le()(rt,{[`${rt}-has-sider`]:typeof X=="boolean"?X:Y.length>0,[`${rt}-rtl`]:he==="rtl"},Ee==null?void 0:Ee.className,Xe,Se,Fe),we=V.useMemo(()=>({siderHook:{addSider:it=>{Ne(pt=>[].concat((0,C.Z)(pt),[it]))},removeSider:it=>{Ne(pt=>pt.filter(Lt=>Lt!==it))}}}),[]);return qe(V.createElement(f.Provider,{value:we},V.createElement(J,Object.assign({ref:oe,className:He,style:Object.assign(Object.assign({},Ee==null?void 0:Ee.style),M)},ze),j)))}),Re=N({tagName:"div",displayName:"Layout"})(_e),H=N({suffixCls:"header",tagName:"header",displayName:"Header"})(K),D=N({suffixCls:"footer",tagName:"footer",displayName:"Footer"})(K),B=N({suffixCls:"content",tagName:"main",displayName:"Content"})(K);var z=Re},40875:function(Wt,Ve,A){"use strict";A.d(Ve,{J:function(){return $}});var C=A(59301),O=A(33234),le=A(80764),fe=function(ye,de){var ae={};for(var Q in ye)Object.prototype.hasOwnProperty.call(ye,Q)&&de.indexOf(Q)<0&&(ae[Q]=ye[Q]);if(ye!=null&&typeof Object.getOwnPropertySymbols=="function")for(var ke=0,Q=Object.getOwnPropertySymbols(ye);ke<Q.length;ke++)de.indexOf(Q[ke])<0&&Object.prototype.propertyIsEnumerable.call(ye,Q[ke])&&(ae[Q[ke]]=ye[Q[ke]]);return ae};const V=C.createContext(null),$=C.forwardRef((ye,de)=>{const{children:ae}=ye,Q=fe(ye,["children"]),ke=C.useContext(V),ve=C.useMemo(()=>Object.assign(Object.assign({},ke),Q),[ke,Q.prefixCls,Q.mode,Q.selectable]);return C.createElement(V.Provider,{value:ve},C.createElement(O.BR,null,(0,le.supportNodeRef)(ae)?C.cloneElement(ae,{ref:de}):ae))});Ve.Z=V},20834:function(Wt,Ve,A){"use strict";A.d(Ve,{default:function(){return jt}});var C=A(22798),O=A(59301),le=A(99580),fe=A(92310),V=A.n(fe),$=A(36355),ye=function(R,P){var x={};for(var L in R)Object.prototype.hasOwnProperty.call(R,L)&&P.indexOf(L)<0&&(x[L]=R[L]);if(R!=null&&typeof Object.getOwnPropertySymbols=="function")for(var F=0,L=Object.getOwnPropertySymbols(R);F<L.length;F++)P.indexOf(L[F])<0&&Object.prototype.propertyIsEnumerable.call(R,L[F])&&(x[L[F]]=R[L[F]]);return x},ae=R=>{const{prefixCls:P,className:x,dashed:L}=R,F=ye(R,["prefixCls","className","dashed"]),{getPrefixCls:ne}=O.useContext($.E_),I=ne("menu",P),G=V()({[`${I}-item-divider-dashed`]:!!L},x);return O.createElement(C.iz,Object.assign({className:G},F))},Q=A(38298),ke=A(64002),ve=A(6848),f=A(92343),K=(0,O.createContext)({prefixCls:"",firstLevel:!0,inlineCollapsed:!1}),Re=R=>{var P;const{className:x,children:L,icon:F,title:ne,danger:I}=R,{prefixCls:G,firstLevel:W,direction:w,disableMenuItemTitleTooltip:se,inlineCollapsed:Te}=O.useContext(K),We=bt=>{const wt=O.createElement("span",{className:`${G}-title-content`},L);return(!F||(0,f.l$)(L)&&L.type==="span")&&L&&bt&&W&&typeof L=="string"?O.createElement("div",{className:`${G}-inline-collapsed-noicon`},L.charAt(0)):wt},{siderCollapsed:Qe}=O.useContext(le.D);let dt=ne;typeof ne=="undefined"?dt=W?L:"":ne===!1&&(dt="");const Ze={title:dt};!Qe&&!Te&&(Ze.title=null,Ze.open=!1);const ct=(0,Q.Z)(L).length;let tt=O.createElement(C.ck,Object.assign({},(0,ke.Z)(R,["title","icon","danger"]),{className:V()({[`${G}-item-danger`]:I,[`${G}-item-only-child`]:(F?ct+1:ct)===1},x),title:typeof ne=="string"?ne:void 0}),(0,f.Tm)(F,{className:V()((0,f.l$)(F)?(P=F.props)===null||P===void 0?void 0:P.className:"",`${G}-item-icon`)}),We(Te));return se||(tt=O.createElement(ve.Z,Object.assign({},Ze,{placement:w==="rtl"?"left":"right",overlayClassName:`${G}-inline-collapsed-tooltip`}),tt)),tt},D=R=>{var P;const{popupClassName:x,icon:L,title:F,theme:ne}=R,I=O.useContext(K),{prefixCls:G,inlineCollapsed:W,theme:w}=I,se=(0,C.Xl)();let Te;if(!L)Te=W&&!se.length&&F&&typeof F=="string"?O.createElement("div",{className:`${G}-inline-collapsed-noicon`},F.charAt(0)):O.createElement("span",{className:`${G}-title-content`},F);else{const Qe=(0,f.l$)(F)&&F.type==="span";Te=O.createElement(O.Fragment,null,(0,f.Tm)(L,{className:V()((0,f.l$)(L)?(P=L.props)===null||P===void 0?void 0:P.className:"",`${G}-item-icon`)}),Qe?F:O.createElement("span",{className:`${G}-title-content`},F))}const We=O.useMemo(()=>Object.assign(Object.assign({},I),{firstLevel:!1}),[I]);return O.createElement(K.Provider,{value:We},O.createElement(C.Wd,Object.assign({},(0,ke.Z)(R,["icon"]),{title:Te,popupClassName:V()(G,x,`${G}-${ne||w}`)})))},B=A(19362),z=A(80764),b=A(62892),oe=A(40875),he=function(R,P){var x={};for(var L in R)Object.prototype.hasOwnProperty.call(R,L)&&P.indexOf(L)<0&&(x[L]=R[L]);if(R!=null&&typeof Object.getOwnPropertySymbols=="function")for(var F=0,L=Object.getOwnPropertySymbols(R);F<L.length;F++)P.indexOf(L[F])<0&&Object.prototype.propertyIsEnumerable.call(R,L[F])&&(x[L[F]]=R[L[F]]);return x};function Y(R){return(R||[]).map((P,x)=>{if(P&&typeof P=="object"){const L=P,{label:F,children:ne,key:I,type:G}=L,W=he(L,["label","children","key","type"]),w=I!=null?I:`tmp-${x}`;return ne||G==="group"?G==="group"?O.createElement(C.BW,Object.assign({key:w},W,{title:F}),Y(ne)):O.createElement(D,Object.assign({key:w},W,{title:F}),Y(ne)):G==="divider"?O.createElement(ae,Object.assign({key:w},W)):O.createElement(Re,Object.assign({key:w},W),F)}return null}).filter(P=>P)}function Ne(R){return O.useMemo(()=>R&&Y(R),[R])}var Ke=A(64993),Xe=A(17313),Se=A(8378),j=A(13826),X=A(29878),J=A(83116),M=A(37613),ze=R=>{const{componentCls:P,motionDurationSlow:x,horizontalLineHeight:L,colorSplit:F,lineWidth:ne,lineType:I,itemPaddingInline:G}=R;return{[`${P}-horizontal`]:{lineHeight:L,border:0,borderBottom:`${ne}px ${I} ${F}`,boxShadow:"none","&::after":{display:"block",clear:"both",height:0,content:'"\\20"'},[`${P}-item, ${P}-submenu`]:{position:"relative",display:"inline-block",verticalAlign:"bottom",paddingInline:G},[`> ${P}-item:hover,
|
|
> ${P}-item-active,
|
|
> ${P}-submenu ${P}-submenu-title:hover`]:{backgroundColor:"transparent"},[`${P}-item, ${P}-submenu-title`]:{transition:[`border-color ${x}`,`background ${x}`].join(",")},[`${P}-submenu-arrow`]:{display:"none"}}}},Ee=R=>{let{componentCls:P,menuArrowOffset:x}=R;return{[`${P}-rtl`]:{direction:"rtl"},[`${P}-submenu-rtl`]:{transformOrigin:"100% 0"},[`${P}-rtl${P}-vertical,
|
|
${P}-submenu-rtl ${P}-vertical`]:{[`${P}-submenu-arrow`]:{"&::before":{transform:`rotate(-45deg) translateY(-${x})`},"&::after":{transform:`rotate(45deg) translateY(${x})`}}}}};const rt=R=>Object.assign({},(0,Xe.oN)(R));var Fe=(R,P)=>{const{componentCls:x,itemColor:L,itemSelectedColor:F,groupTitleColor:ne,itemBg:I,subMenuItemBg:G,itemSelectedBg:W,activeBarHeight:w,activeBarWidth:se,activeBarBorderWidth:Te,motionDurationSlow:We,motionEaseInOut:Qe,motionEaseOut:dt,itemPaddingInline:Ze,motionDurationMid:ct,itemHoverColor:tt,lineType:bt,colorSplit:wt,itemDisabledColor:ce,dangerItemColor:Yt,dangerItemHoverColor:Ct,dangerItemSelectedColor:ai,dangerItemActiveBg:je,dangerItemSelectedBg:vi,itemHoverBg:ci,itemActiveBg:gi,menuSubMenuBg:ui,horizontalItemSelectedColor:ft,horizontalItemSelectedBg:Qt,horizontalItemBorderRadius:st,horizontalItemHoverBg:At,popupBg:Xt}=R;return{[`${x}-${P}, ${x}-${P} > ${x}`]:{color:L,background:I,[`&${x}-root:focus-visible`]:Object.assign({},rt(R)),[`${x}-item-group-title`]:{color:ne},[`${x}-submenu-selected`]:{[`> ${x}-submenu-title`]:{color:F}},[`${x}-item-disabled, ${x}-submenu-disabled`]:{color:`${ce} !important`},[`${x}-item:not(${x}-item-selected):not(${x}-submenu-selected)`]:{[`&:hover, > ${x}-submenu-title:hover`]:{color:tt}},[`&:not(${x}-horizontal)`]:{[`${x}-item:not(${x}-item-selected)`]:{"&:hover":{backgroundColor:ci},"&:active":{backgroundColor:gi}},[`${x}-submenu-title`]:{"&:hover":{backgroundColor:ci},"&:active":{backgroundColor:gi}}},[`${x}-item-danger`]:{color:Yt,[`&${x}-item:hover`]:{[`&:not(${x}-item-selected):not(${x}-submenu-selected)`]:{color:Ct}},[`&${x}-item:active`]:{background:je}},[`${x}-item a`]:{"&, &:hover":{color:"inherit"}},[`${x}-item-selected`]:{color:F,[`&${x}-item-danger`]:{color:ai},"a, a:hover":{color:"inherit"}},[`& ${x}-item-selected`]:{backgroundColor:W,[`&${x}-item-danger`]:{backgroundColor:vi}},[`${x}-item, ${x}-submenu-title`]:{[`&:not(${x}-item-disabled):focus-visible`]:Object.assign({},rt(R))},[`&${x}-submenu > ${x}`]:{backgroundColor:ui},[`&${x}-popup > ${x}`]:{backgroundColor:Xt},[`&${x}-horizontal`]:Object.assign(Object.assign({},P==="dark"?{borderBottom:0}:{}),{[`> ${x}-item, > ${x}-submenu`]:{top:Te,marginTop:-Te,marginBottom:0,borderRadius:st,"&::after":{position:"absolute",insetInline:Ze,bottom:0,borderBottom:`${w}px solid transparent`,transition:`border-color ${We} ${Qe}`,content:'""'},"&:hover, &-active, &-open":{background:At,"&::after":{borderBottomWidth:w,borderBottomColor:ft}},"&-selected":{color:ft,backgroundColor:Qt,"&:hover":{backgroundColor:Qt},"&::after":{borderBottomWidth:w,borderBottomColor:ft}}}}),[`&${x}-root`]:{[`&${x}-inline, &${x}-vertical`]:{borderInlineEnd:`${Te}px ${bt} ${wt}`}},[`&${x}-inline`]:{[`${x}-sub${x}-inline`]:{background:G},[`${x}-item, ${x}-submenu-title`]:Te&&se?{width:`calc(100% + ${Te}px)`}:{},[`${x}-item`]:{position:"relative","&::after":{position:"absolute",insetBlock:0,insetInlineEnd:0,borderInlineEnd:`${se}px solid ${F}`,transform:"scaleY(0.0001)",opacity:0,transition:[`transform ${ct} ${dt}`,`opacity ${ct} ${dt}`].join(","),content:'""'},[`&${x}-item-danger`]:{"&::after":{borderInlineEndColor:ai}}},[`${x}-selected, ${x}-item-selected`]:{"&::after":{transform:"scaleY(1)",opacity:1,transition:[`transform ${ct} ${Qe}`,`opacity ${ct} ${Qe}`].join(",")}}}}}};const He=R=>{const{componentCls:P,itemHeight:x,itemMarginInline:L,padding:F,menuArrowSize:ne,marginXS:I,itemMarginBlock:G}=R,W=F+ne+I;return{[`${P}-item`]:{position:"relative",overflow:"hidden"},[`${P}-item, ${P}-submenu-title`]:{height:x,lineHeight:`${x}px`,paddingInline:F,overflow:"hidden",textOverflow:"ellipsis",marginInline:L,marginBlock:G,width:`calc(100% - ${L*2}px)`},[`> ${P}-item,
|
|
> ${P}-submenu > ${P}-submenu-title`]:{height:x,lineHeight:`${x}px`},[`${P}-item-group-list ${P}-submenu-title,
|
|
${P}-submenu-title`]:{paddingInlineEnd:W}}};var it=R=>{const{componentCls:P,iconCls:x,itemHeight:L,colorTextLightSolid:F,dropdownWidth:ne,controlHeightLG:I,motionDurationMid:G,motionEaseOut:W,paddingXL:w,itemMarginInline:se,fontSizeLG:Te,motionDurationSlow:We,paddingXS:Qe,boxShadowSecondary:dt,collapsedWidth:Ze,collapsedIconSize:ct}=R,tt={height:L,lineHeight:`${L}px`,listStylePosition:"inside",listStyleType:"disc"};return[{[P]:{"&-inline, &-vertical":Object.assign({[`&${P}-root`]:{boxShadow:"none"}},He(R))},[`${P}-submenu-popup`]:{[`${P}-vertical`]:Object.assign(Object.assign({},He(R)),{boxShadow:dt})}},{[`${P}-submenu-popup ${P}-vertical${P}-sub`]:{minWidth:ne,maxHeight:`calc(100vh - ${I*2.5}px)`,padding:"0",overflow:"hidden",borderInlineEnd:0,"&:not([class*='-active'])":{overflowX:"hidden",overflowY:"auto"}}},{[`${P}-inline`]:{width:"100%",[`&${P}-root`]:{[`${P}-item, ${P}-submenu-title`]:{display:"flex",alignItems:"center",transition:[`border-color ${We}`,`background ${We}`,`padding ${G} ${W}`].join(","),[`> ${P}-title-content`]:{flex:"auto",minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},"> *":{flex:"none"}}},[`${P}-sub${P}-inline`]:{padding:0,border:0,borderRadius:0,boxShadow:"none",[`& > ${P}-submenu > ${P}-submenu-title`]:tt,[`& ${P}-item-group-title`]:{paddingInlineStart:w}},[`${P}-item`]:tt}},{[`${P}-inline-collapsed`]:{width:Ze,[`&${P}-root`]:{[`${P}-item, ${P}-submenu ${P}-submenu-title`]:{[`> ${P}-inline-collapsed-noicon`]:{fontSize:Te,textAlign:"center"}}},[`> ${P}-item,
|
|
> ${P}-item-group > ${P}-item-group-list > ${P}-item,
|
|
> ${P}-item-group > ${P}-item-group-list > ${P}-submenu > ${P}-submenu-title,
|
|
> ${P}-submenu > ${P}-submenu-title`]:{insetInlineStart:0,paddingInline:`calc(50% - ${Te/2}px - ${se}px)`,textOverflow:"clip",[`
|
|
${P}-submenu-arrow,
|
|
${P}-submenu-expand-icon
|
|
`]:{opacity:0},[`${P}-item-icon, ${x}`]:{margin:0,fontSize:ct,lineHeight:`${L}px`,"+ span":{display:"inline-block",opacity:0}}},[`${P}-item-icon, ${x}`]:{display:"inline-block"},"&-tooltip":{pointerEvents:"none",[`${P}-item-icon, ${x}`]:{display:"none"},"a, a:hover":{color:F}},[`${P}-item-group-title`]:Object.assign(Object.assign({},Xe.vS),{paddingInline:Qe})}}]};const pt=R=>{const{componentCls:P,motionDurationSlow:x,motionDurationMid:L,motionEaseInOut:F,motionEaseOut:ne,iconCls:I,iconSize:G,iconMarginInlineEnd:W}=R;return{[`${P}-item, ${P}-submenu-title`]:{position:"relative",display:"block",margin:0,whiteSpace:"nowrap",cursor:"pointer",transition:[`border-color ${x}`,`background ${x}`,`padding ${x} ${F}`].join(","),[`${P}-item-icon, ${I}`]:{minWidth:G,fontSize:G,transition:[`font-size ${L} ${ne}`,`margin ${x} ${F}`,`color ${x}`].join(","),"+ span":{marginInlineStart:W,opacity:1,transition:[`opacity ${x} ${F}`,`margin ${x}`,`color ${x}`].join(",")}},[`${P}-item-icon`]:Object.assign({},(0,Xe.Ro)()),[`&${P}-item-only-child`]:{[`> ${I}, > ${P}-item-icon`]:{marginInlineEnd:0}}},[`${P}-item-disabled, ${P}-submenu-disabled`]:{background:"none !important",cursor:"not-allowed","&::after":{borderColor:"transparent !important"},a:{color:"inherit !important"},[`> ${P}-submenu-title`]:{color:"inherit !important",cursor:"not-allowed"}}}},Lt=R=>{const{componentCls:P,motionDurationSlow:x,motionEaseInOut:L,borderRadius:F,menuArrowSize:ne,menuArrowOffset:I}=R;return{[`${P}-submenu`]:{"&-expand-icon, &-arrow":{position:"absolute",top:"50%",insetInlineEnd:R.margin,width:ne,color:"currentcolor",transform:"translateY(-50%)",transition:`transform ${x} ${L}, opacity ${x}`},"&-arrow":{"&::before, &::after":{position:"absolute",width:ne*.6,height:ne*.15,backgroundColor:"currentcolor",borderRadius:F,transition:[`background ${x} ${L}`,`transform ${x} ${L}`,`top ${x} ${L}`,`color ${x} ${L}`].join(","),content:'""'},"&::before":{transform:`rotate(45deg) translateY(-${I})`},"&::after":{transform:`rotate(-45deg) translateY(${I})`}}}}},Ut=R=>{const{antCls:P,componentCls:x,fontSize:L,motionDurationSlow:F,motionDurationMid:ne,motionEaseInOut:I,paddingXS:G,padding:W,colorSplit:w,lineWidth:se,zIndexPopup:Te,borderRadiusLG:We,subMenuItemBorderRadius:Qe,menuArrowSize:dt,menuArrowOffset:Ze,lineType:ct,menuPanelMaskInset:tt,groupTitleLineHeight:bt,groupTitleFontSize:wt}=R;return[{"":{[`${x}`]:Object.assign(Object.assign({},(0,Xe.dF)()),{"&-hidden":{display:"none"}})},[`${x}-submenu-hidden`]:{display:"none"}},{[x]:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},(0,Xe.Wf)(R)),(0,Xe.dF)()),{marginBottom:0,paddingInlineStart:0,fontSize:L,lineHeight:0,listStyle:"none",outline:"none",transition:`width ${F} cubic-bezier(0.2, 0, 0, 1) 0s`,"ul, ol":{margin:0,padding:0,listStyle:"none"},"&-overflow":{display:"flex",[`${x}-item`]:{flex:"none"}},[`${x}-item, ${x}-submenu, ${x}-submenu-title`]:{borderRadius:R.itemBorderRadius},[`${x}-item-group-title`]:{padding:`${G}px ${W}px`,fontSize:wt,lineHeight:bt,transition:`all ${F}`},[`&-horizontal ${x}-submenu`]:{transition:[`border-color ${F} ${I}`,`background ${F} ${I}`].join(",")},[`${x}-submenu, ${x}-submenu-inline`]:{transition:[`border-color ${F} ${I}`,`background ${F} ${I}`,`padding ${ne} ${I}`].join(",")},[`${x}-submenu ${x}-sub`]:{cursor:"initial",transition:[`background ${F} ${I}`,`padding ${F} ${I}`].join(",")},[`${x}-title-content`]:{transition:`color ${F}`},[`${x}-item a`]:{"&::before":{position:"absolute",inset:0,backgroundColor:"transparent",content:'""'}},[`${x}-item-divider`]:{overflow:"hidden",lineHeight:0,borderColor:w,borderStyle:ct,borderWidth:0,borderTopWidth:se,marginBlock:se,padding:0,"&-dashed":{borderStyle:"dashed"}}}),pt(R)),{[`${x}-item-group`]:{[`${x}-item-group-list`]:{margin:0,padding:0,[`${x}-item, ${x}-submenu-title`]:{paddingInline:`${L*2}px ${W}px`}}},"&-submenu":{"&-popup":{position:"absolute",zIndex:Te,borderRadius:We,boxShadow:"none",transformOrigin:"0 0",[`&${x}-submenu`]:{background:"transparent"},"&::before":{position:"absolute",inset:`${tt}px 0 0`,zIndex:-1,width:"100%",height:"100%",opacity:0,content:'""'}},"&-placement-rightTop::before":{top:0,insetInlineStart:tt},"\n &-placement-leftTop,\n &-placement-bottomRight,\n ":{transformOrigin:"100% 0"},"\n &-placement-leftBottom,\n &-placement-topRight,\n ":{transformOrigin:"100% 100%"},"\n &-placement-rightBottom,\n &-placement-topLeft,\n ":{transformOrigin:"0 100%"},"\n &-placement-bottomLeft,\n &-placement-rightTop,\n ":{transformOrigin:"0 0"},"\n &-placement-leftTop,\n &-placement-leftBottom\n ":{paddingInlineEnd:R.paddingXS},"\n &-placement-rightTop,\n &-placement-rightBottom\n ":{paddingInlineStart:R.paddingXS},"\n &-placement-topRight,\n &-placement-topLeft\n ":{paddingBottom:R.paddingXS},"\n &-placement-bottomRight,\n &-placement-bottomLeft\n ":{paddingTop:R.paddingXS},[`> ${x}`]:Object.assign(Object.assign(Object.assign({borderRadius:We},pt(R)),Lt(R)),{[`${x}-item, ${x}-submenu > ${x}-submenu-title`]:{borderRadius:Qe},[`${x}-submenu-title::after`]:{transition:`transform ${F} ${I}`}})}}),Lt(R)),{[`&-inline-collapsed ${x}-submenu-arrow,
|
|
&-inline ${x}-submenu-arrow`]:{"&::before":{transform:`rotate(-45deg) translateX(${Ze})`},"&::after":{transform:`rotate(45deg) translateX(-${Ze})`}},[`${x}-submenu-open${x}-submenu-inline > ${x}-submenu-title > ${x}-submenu-arrow`]:{transform:`translateY(-${dt*.2}px)`,"&::after":{transform:`rotate(-45deg) translateX(-${Ze})`},"&::before":{transform:`rotate(45deg) translateX(${Ze})`}}})},{[`${P}-layout-header`]:{[x]:{lineHeight:"inherit"}}}]};var $t=(R,P)=>(0,J.Z)("Menu",L=>{if(P===!1)return[];const{colorBgElevated:F,colorPrimary:ne,colorTextLightSolid:I,controlHeightLG:G,fontSize:W,darkItemColor:w,darkDangerItemColor:se,darkItemBg:Te,darkSubMenuItemBg:We,darkItemSelectedColor:Qe,darkItemSelectedBg:dt,darkDangerItemSelectedBg:Ze,darkItemHoverBg:ct,darkGroupTitleColor:tt,darkItemHoverColor:bt,darkItemDisabledColor:wt,darkDangerItemHoverColor:ce,darkDangerItemSelectedColor:Yt,darkDangerItemActiveBg:Ct}=L,ai=W/7*5,je=(0,M.TS)(L,{menuArrowSize:ai,menuHorizontalHeight:G*1.15,menuArrowOffset:`${ai*.25}px`,menuPanelMaskInset:-7,menuSubMenuBg:F}),vi=(0,M.TS)(je,{itemColor:w,itemHoverColor:bt,groupTitleColor:tt,itemSelectedColor:Qe,itemBg:Te,popupBg:Te,subMenuItemBg:We,itemActiveBg:"transparent",itemSelectedBg:dt,activeBarHeight:0,activeBarBorderWidth:0,itemHoverBg:ct,itemDisabledColor:wt,dangerItemColor:se,dangerItemHoverColor:ce,dangerItemSelectedColor:Yt,dangerItemActiveBg:Ct,dangerItemSelectedBg:Ze,menuSubMenuBg:We,horizontalItemSelectedColor:I,horizontalItemSelectedBg:ne});return[Ut(je),ze(je),it(je),Fe(je,"light"),Fe(vi,"dark"),Ee(je),(0,Se.Z)(je),(0,j.oN)(je,"slide-up"),(0,j.oN)(je,"slide-down"),(0,X._y)(je,"zoom-big")]},L=>{const{colorPrimary:F,colorError:ne,colorTextDisabled:I,colorErrorBg:G,colorText:W,colorTextDescription:w,colorBgContainer:se,colorFillAlter:Te,colorFillContent:We,lineWidth:Qe,lineWidthBold:dt,controlItemBgActive:Ze,colorBgTextHover:ct,controlHeightLG:tt,lineHeight:bt,colorBgElevated:wt,marginXXS:ce,padding:Yt,fontSize:Ct,controlHeightSM:ai,fontSizeLG:je,colorTextLightSolid:vi,colorErrorHover:ci}=L,gi=new Ke.C(vi).setAlpha(.65).toRgbString();return{dropdownWidth:160,zIndexPopup:L.zIndexPopupBase+50,radiusItem:L.borderRadiusLG,itemBorderRadius:L.borderRadiusLG,radiusSubMenuItem:L.borderRadiusSM,subMenuItemBorderRadius:L.borderRadiusSM,colorItemText:W,itemColor:W,colorItemTextHover:W,itemHoverColor:W,colorItemTextHoverHorizontal:F,horizontalItemHoverColor:F,colorGroupTitle:w,groupTitleColor:w,colorItemTextSelected:F,itemSelectedColor:F,colorItemTextSelectedHorizontal:F,horizontalItemSelectedColor:F,colorItemBg:se,itemBg:se,colorItemBgHover:ct,itemHoverBg:ct,colorItemBgActive:We,itemActiveBg:Ze,colorSubItemBg:Te,subMenuItemBg:Te,colorItemBgSelected:Ze,itemSelectedBg:Ze,colorItemBgSelectedHorizontal:"transparent",horizontalItemSelectedBg:"transparent",colorActiveBarWidth:0,activeBarWidth:0,colorActiveBarHeight:dt,activeBarHeight:dt,colorActiveBarBorderSize:Qe,activeBarBorderWidth:Qe,colorItemTextDisabled:I,itemDisabledColor:I,colorDangerItemText:ne,dangerItemColor:ne,colorDangerItemTextHover:ne,dangerItemHoverColor:ne,colorDangerItemTextSelected:ne,dangerItemSelectedColor:ne,colorDangerItemBgActive:G,dangerItemActiveBg:G,colorDangerItemBgSelected:G,dangerItemSelectedBg:G,itemMarginInline:L.marginXXS,horizontalItemBorderRadius:0,horizontalItemHoverBg:"transparent",itemHeight:tt,groupTitleLineHeight:bt,collapsedWidth:tt*2,popupBg:wt,itemMarginBlock:ce,itemPaddingInline:Yt,horizontalLineHeight:`${tt*1.15}px`,iconSize:Ct,iconMarginInlineEnd:ai-Ct,collapsedIconSize:je,groupTitleFontSize:Ct,darkItemDisabledColor:new Ke.C(vi).setAlpha(.25).toRgbString(),darkItemColor:gi,darkDangerItemColor:ne,darkItemBg:"#001529",darkSubMenuItemBg:"#000c17",darkItemSelectedColor:vi,darkItemSelectedBg:F,darkDangerItemSelectedBg:ne,darkItemHoverBg:"transparent",darkGroupTitleColor:gi,darkItemHoverColor:vi,darkDangerItemHoverColor:ci,darkDangerItemSelectedColor:vi,darkDangerItemActiveBg:ne}},{deprecatedTokens:[["colorGroupTitle","groupTitleColor"],["radiusItem","itemBorderRadius"],["radiusSubMenuItem","subMenuItemBorderRadius"],["colorItemText","itemColor"],["colorItemTextHover","itemHoverColor"],["colorItemTextHoverHorizontal","horizontalItemHoverColor"],["colorItemTextSelected","itemSelectedColor"],["colorItemTextSelectedHorizontal","horizontalItemSelectedColor"],["colorItemTextDisabled","itemDisabledColor"],["colorDangerItemText","dangerItemColor"],["colorDangerItemTextHover","dangerItemHoverColor"],["colorDangerItemTextSelected","dangerItemSelectedColor"],["colorDangerItemBgActive","dangerItemActiveBg"],["colorDangerItemBgSelected","dangerItemSelectedBg"],["colorItemBg","itemBg"],["colorItemBgHover","itemHoverBg"],["colorSubItemBg","subMenuItemBg"],["colorItemBgActive","itemActiveBg"],["colorItemBgSelectedHorizontal","horizontalItemSelectedBg"],["colorActiveBarWidth","activeBarWidth"],["colorActiveBarHeight","activeBarHeight"],["colorActiveBarBorderSize","activeBarBorderWidth"],["colorItemBgSelected","itemSelectedBg"]]})(R),vt=function(R,P){var x={};for(var L in R)Object.prototype.hasOwnProperty.call(R,L)&&P.indexOf(L)<0&&(x[L]=R[L]);if(R!=null&&typeof Object.getOwnPropertySymbols=="function")for(var F=0,L=Object.getOwnPropertySymbols(R);F<L.length;F++)P.indexOf(L[F])<0&&Object.prototype.propertyIsEnumerable.call(R,L[F])&&(x[L[F]]=R[L[F]]);return x},Ht=(0,O.forwardRef)((R,P)=>{var x,L;const F=O.useContext(oe.Z),ne=F||{},{getPrefixCls:I,getPopupContainer:G,direction:W,menu:w}=O.useContext($.E_),se=I(),{prefixCls:Te,className:We,style:Qe,theme:dt="light",expandIcon:Ze,_internalDisableMenuItemTitleTooltip:ct,inlineCollapsed:tt,siderCollapsed:bt,items:wt,children:ce,rootClassName:Yt,mode:Ct,selectable:ai,onClick:je,overflowedIndicatorPopupClassName:vi}=R,ci=vt(R,["prefixCls","className","style","theme","expandIcon","_internalDisableMenuItemTitleTooltip","inlineCollapsed","siderCollapsed","items","children","rootClassName","mode","selectable","onClick","overflowedIndicatorPopupClassName"]),gi=(0,ke.Z)(ci,["collapsedWidth"]),ui=Ne(wt)||ce;(x=ne.validator)===null||x===void 0||x.call(ne,{mode:Ct});const ft=(0,z.useEvent)(function(){var fi;je==null||je.apply(void 0,arguments),(fi=ne.onClick)===null||fi===void 0||fi.call(ne)}),Qt=ne.mode||Ct,st=ai!=null?ai:ne.selectable,At=O.useMemo(()=>bt!==void 0?bt:tt,[tt,bt]),Xt={horizontal:{motionName:`${se}-slide-up`},inline:(0,b.Z)(se),other:{motionName:`${se}-zoom-big`}},It=I("menu",Te||ne.prefixCls),[ii,si]=$t(It,!F),hi=V()(`${It}-${dt}`,w==null?void 0:w.className,We);let Ei;if(typeof Ze=="function")Ei=Ze;else if(Ze===null||Ze===!1)Ei=null;else if(ne.expandIcon===null||ne.expandIcon===!1)Ei=null;else{const fi=Ze!=null?Ze:ne.expandIcon;Ei=(0,f.Tm)(fi,{className:V()(`${It}-submenu-expand-icon`,(0,f.l$)(fi)?(L=fi.props)===null||L===void 0?void 0:L.className:"")})}const ni=O.useMemo(()=>({prefixCls:It,inlineCollapsed:At||!1,direction:W,firstLevel:!0,theme:dt,mode:Qt,disableMenuItemTitleTooltip:ct}),[It,At,W,ct,dt]);return ii(O.createElement(oe.Z.Provider,{value:null},O.createElement(K.Provider,{value:ni},O.createElement(C.ZP,Object.assign({getPopupContainer:G,overflowedIndicator:O.createElement(B.Z,null),overflowedIndicatorPopupClassName:V()(It,`${It}-${dt}`,vi),mode:Qt,selectable:st,onClick:ft},gi,{inlineCollapsed:At,style:Object.assign(Object.assign({},w==null?void 0:w.style),Qe),className:hi,prefixCls:It,direction:W,defaultMotions:Xt,expandIcon:Ei,ref:P,rootClassName:V()(Yt,si)}),ui))))});const Zt=(0,O.forwardRef)((R,P)=>{const x=(0,O.useRef)(null),L=O.useContext(le.D);return(0,O.useImperativeHandle)(P,()=>({menu:x.current,focus:F=>{var ne;(ne=x.current)===null||ne===void 0||ne.focus(F)}})),O.createElement(Ht,Object.assign({ref:x},R,L))});Zt.Item=Re,Zt.SubMenu=D,Zt.Divider=ae,Zt.ItemGroup=C.BW;var jt=Zt},78485:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return P}});var C=A(92310),O=A.n(C),le=A(59301),fe=A(36355),V=A(64002),ye=x=>{const{prefixCls:L,className:F,style:ne,size:I,shape:G}=x,W=O()({[`${L}-lg`]:I==="large",[`${L}-sm`]:I==="small"}),w=O()({[`${L}-circle`]:G==="circle",[`${L}-square`]:G==="square",[`${L}-round`]:G==="round"}),se=le.useMemo(()=>typeof I=="number"?{width:I,height:I,lineHeight:`${I}px`}:{},[I]);return le.createElement("span",{className:O()(L,W,w,F),style:Object.assign(Object.assign({},se),ne)})},de=A(9792),ae=A(83116),Q=A(37613);const ke=new de.Keyframes("ant-skeleton-loading",{"0%":{backgroundPosition:"100% 50%"},"100%":{backgroundPosition:"0 50%"}}),ve=x=>({height:x,lineHeight:`${x}px`}),f=x=>Object.assign({width:x},ve(x)),N=x=>({background:x.skeletonLoadingBackground,backgroundSize:"400% 100%",animationName:ke,animationDuration:x.skeletonLoadingMotionDuration,animationTimingFunction:"ease",animationIterationCount:"infinite"}),K=x=>Object.assign({width:x*5,minWidth:x*5},ve(x)),_e=x=>{const{skeletonAvatarCls:L,gradientFromColor:F,controlHeight:ne,controlHeightLG:I,controlHeightSM:G}=x;return{[`${L}`]:Object.assign({display:"inline-block",verticalAlign:"top",background:F},f(ne)),[`${L}${L}-circle`]:{borderRadius:"50%"},[`${L}${L}-lg`]:Object.assign({},f(I)),[`${L}${L}-sm`]:Object.assign({},f(G))}},Re=x=>{const{controlHeight:L,borderRadiusSM:F,skeletonInputCls:ne,controlHeightLG:I,controlHeightSM:G,gradientFromColor:W}=x;return{[`${ne}`]:Object.assign({display:"inline-block",verticalAlign:"top",background:W,borderRadius:F},K(L)),[`${ne}-lg`]:Object.assign({},K(I)),[`${ne}-sm`]:Object.assign({},K(G))}},H=x=>Object.assign({width:x},ve(x)),D=x=>{const{skeletonImageCls:L,imageSizeBase:F,gradientFromColor:ne,borderRadiusSM:I}=x;return{[`${L}`]:Object.assign(Object.assign({display:"flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",background:ne,borderRadius:I},H(F*2)),{[`${L}-path`]:{fill:"#bfbfbf"},[`${L}-svg`]:Object.assign(Object.assign({},H(F)),{maxWidth:F*4,maxHeight:F*4}),[`${L}-svg${L}-svg-circle`]:{borderRadius:"50%"}}),[`${L}${L}-circle`]:{borderRadius:"50%"}}},B=(x,L,F)=>{const{skeletonButtonCls:ne}=x;return{[`${F}${ne}-circle`]:{width:L,minWidth:L,borderRadius:"50%"},[`${F}${ne}-round`]:{borderRadius:L}}},z=x=>Object.assign({width:x*2,minWidth:x*2},ve(x)),b=x=>{const{borderRadiusSM:L,skeletonButtonCls:F,controlHeight:ne,controlHeightLG:I,controlHeightSM:G,gradientFromColor:W}=x;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({[`${F}`]:Object.assign({display:"inline-block",verticalAlign:"top",background:W,borderRadius:L,width:ne*2,minWidth:ne*2},z(ne))},B(x,ne,F)),{[`${F}-lg`]:Object.assign({},z(I))}),B(x,I,`${F}-lg`)),{[`${F}-sm`]:Object.assign({},z(G))}),B(x,G,`${F}-sm`))},oe=x=>{const{componentCls:L,skeletonAvatarCls:F,skeletonTitleCls:ne,skeletonParagraphCls:I,skeletonButtonCls:G,skeletonInputCls:W,skeletonImageCls:w,controlHeight:se,controlHeightLG:Te,controlHeightSM:We,gradientFromColor:Qe,padding:dt,marginSM:Ze,borderRadius:ct,titleHeight:tt,blockRadius:bt,paragraphLiHeight:wt,controlHeightXS:ce,paragraphMarginTop:Yt}=x;return{[`${L}`]:{display:"table",width:"100%",[`${L}-header`]:{display:"table-cell",paddingInlineEnd:dt,verticalAlign:"top",[`${F}`]:Object.assign({display:"inline-block",verticalAlign:"top",background:Qe},f(se)),[`${F}-circle`]:{borderRadius:"50%"},[`${F}-lg`]:Object.assign({},f(Te)),[`${F}-sm`]:Object.assign({},f(We))},[`${L}-content`]:{display:"table-cell",width:"100%",verticalAlign:"top",[`${ne}`]:{width:"100%",height:tt,background:Qe,borderRadius:bt,[`+ ${I}`]:{marginBlockStart:We}},[`${I}`]:{padding:0,"> li":{width:"100%",height:wt,listStyle:"none",background:Qe,borderRadius:bt,"+ li":{marginBlockStart:ce}}},[`${I}> li:last-child:not(:first-child):not(:nth-child(2))`]:{width:"61%"}},[`&-round ${L}-content`]:{[`${ne}, ${I} > li`]:{borderRadius:ct}}},[`${L}-with-avatar ${L}-content`]:{[`${ne}`]:{marginBlockStart:Ze,[`+ ${I}`]:{marginBlockStart:Yt}}},[`${L}${L}-element`]:Object.assign(Object.assign(Object.assign(Object.assign({display:"inline-block",width:"auto"},b(x)),_e(x)),Re(x)),D(x)),[`${L}${L}-block`]:{width:"100%",[`${G}`]:{width:"100%"},[`${W}`]:{width:"100%"}},[`${L}${L}-active`]:{[`
|
|
${ne},
|
|
${I} > li,
|
|
${F},
|
|
${G},
|
|
${W},
|
|
${w}
|
|
`]:Object.assign({},N(x))}}};var he=(0,ae.Z)("Skeleton",x=>{const{componentCls:L}=x,F=(0,Q.TS)(x,{skeletonAvatarCls:`${L}-avatar`,skeletonTitleCls:`${L}-title`,skeletonParagraphCls:`${L}-paragraph`,skeletonButtonCls:`${L}-button`,skeletonInputCls:`${L}-input`,skeletonImageCls:`${L}-image`,imageSizeBase:x.controlHeight*1.5,borderRadius:100,skeletonLoadingBackground:`linear-gradient(90deg, ${x.gradientFromColor} 25%, ${x.gradientToColor} 37%, ${x.gradientFromColor} 63%)`,skeletonLoadingMotionDuration:"1.4s"});return[oe(F)]},x=>{const{colorFillContent:L,colorFill:F}=x,ne=L,I=F;return{color:ne,colorGradientEnd:I,gradientFromColor:ne,gradientToColor:I,titleHeight:x.controlHeight/2,blockRadius:x.borderRadiusSM,paragraphMarginTop:x.marginLG+x.marginXXS,paragraphLiHeight:x.controlHeight/2}},{deprecatedTokens:[["color","gradientFromColor"],["colorGradientEnd","gradientToColor"]]}),Ne=x=>{const{prefixCls:L,className:F,rootClassName:ne,active:I,shape:G="circle",size:W="default"}=x,{getPrefixCls:w}=le.useContext(fe.E_),se=w("skeleton",L),[Te,We]=he(se),Qe=(0,V.Z)(x,["prefixCls","className"]),dt=O()(se,`${se}-element`,{[`${se}-active`]:I},F,ne,We);return Te(le.createElement("div",{className:dt},le.createElement(ye,Object.assign({prefixCls:`${se}-avatar`,shape:G,size:W},Qe))))},Xe=x=>{const{prefixCls:L,className:F,rootClassName:ne,active:I,block:G=!1,size:W="default"}=x,{getPrefixCls:w}=le.useContext(fe.E_),se=w("skeleton",L),[Te,We]=he(se),Qe=(0,V.Z)(x,["prefixCls"]),dt=O()(se,`${se}-element`,{[`${se}-active`]:I,[`${se}-block`]:G},F,ne,We);return Te(le.createElement("div",{className:dt},le.createElement(ye,Object.assign({prefixCls:`${se}-button`,size:W},Qe))))};const Se="M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z";var X=x=>{const{prefixCls:L,className:F,rootClassName:ne,style:I,active:G}=x,{getPrefixCls:W}=le.useContext(fe.E_),w=W("skeleton",L),[se,Te]=he(w),We=O()(w,`${w}-element`,{[`${w}-active`]:G},F,ne,Te);return se(le.createElement("div",{className:We},le.createElement("div",{className:O()(`${w}-image`,F),style:I},le.createElement("svg",{viewBox:"0 0 1098 1024",xmlns:"http://www.w3.org/2000/svg",className:`${w}-image-svg`},le.createElement("path",{d:Se,className:`${w}-image-path`})))))},M=x=>{const{prefixCls:L,className:F,rootClassName:ne,active:I,block:G,size:W="default"}=x,{getPrefixCls:w}=le.useContext(fe.E_),se=w("skeleton",L),[Te,We]=he(se),Qe=(0,V.Z)(x,["prefixCls"]),dt=O()(se,`${se}-element`,{[`${se}-active`]:I,[`${se}-block`]:G},F,ne,We);return Te(le.createElement("div",{className:dt},le.createElement(ye,Object.assign({prefixCls:`${se}-input`,size:W},Qe))))},Ae=A(5891),ze={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM288 604a64 64 0 10128 0 64 64 0 10-128 0zm118-224a48 48 0 1096 0 48 48 0 10-96 0zm158 228a96 96 0 10192 0 96 96 0 10-192 0zm148-314a56 56 0 10112 0 56 56 0 10-112 0z"}}]},name:"dot-chart",theme:"outlined"},ge=ze,Ee=A(88853),rt=function(L,F){return le.createElement(Ee.Z,(0,Ae.Z)({},L,{ref:F,icon:ge}))},qe=le.forwardRef(rt),Fe=qe,we=x=>{const{prefixCls:L,className:F,rootClassName:ne,style:I,active:G,children:W}=x,{getPrefixCls:w}=le.useContext(fe.E_),se=w("skeleton",L),[Te,We]=he(se),Qe=O()(se,`${se}-element`,{[`${se}-active`]:G},We,F,ne),dt=W!=null?W:le.createElement(Fe,null);return Te(le.createElement("div",{className:Qe},le.createElement("div",{className:O()(`${se}-image`,F),style:I},dt)))},it=A(26390),Lt=x=>{const L=w=>{const{width:se,rows:Te=2}=x;if(Array.isArray(se))return se[w];if(Te-1===w)return se},{prefixCls:F,className:ne,style:I,rows:G}=x,W=(0,it.Z)(Array(G)).map((w,se)=>le.createElement("li",{key:se,style:{width:L(se)}}));return le.createElement("ul",{className:O()(F,ne),style:I},W)},$t=x=>{let{prefixCls:L,className:F,width:ne,style:I}=x;return le.createElement("h3",{className:O()(L,F),style:Object.assign({width:ne},I)})};function vt(x){return x&&typeof x=="object"?x:{}}function Bt(x,L){return x&&!L?{size:"large",shape:"square"}:{size:"large",shape:"circle"}}function Ht(x,L){return!x&&L?{width:"38%"}:x&&L?{width:"50%"}:{}}function Zt(x,L){const F={};return(!x||!L)&&(F.width="61%"),!x&&L?F.rows=3:F.rows=2,F}const jt=x=>{const{prefixCls:L,loading:F,className:ne,rootClassName:I,style:G,children:W,avatar:w=!1,title:se=!0,paragraph:Te=!0,active:We,round:Qe}=x,{getPrefixCls:dt,direction:Ze,skeleton:ct}=le.useContext(fe.E_),tt=dt("skeleton",L),[bt,wt]=he(tt);if(F||!("loading"in x)){const ce=!!w,Yt=!!se,Ct=!!Te;let ai;if(ce){const ci=Object.assign(Object.assign({prefixCls:`${tt}-avatar`},Bt(Yt,Ct)),vt(w));ai=le.createElement("div",{className:`${tt}-header`},le.createElement(ye,Object.assign({},ci)))}let je;if(Yt||Ct){let ci;if(Yt){const ui=Object.assign(Object.assign({prefixCls:`${tt}-title`},Ht(ce,Ct)),vt(se));ci=le.createElement($t,Object.assign({},ui))}let gi;if(Ct){const ui=Object.assign(Object.assign({prefixCls:`${tt}-paragraph`},Zt(ce,Yt)),vt(Te));gi=le.createElement(Lt,Object.assign({},ui))}je=le.createElement("div",{className:`${tt}-content`},ci,gi)}const vi=O()(tt,{[`${tt}-with-avatar`]:ce,[`${tt}-active`]:We,[`${tt}-rtl`]:Ze==="rtl",[`${tt}-round`]:Qe},ct==null?void 0:ct.className,ne,I,wt);return bt(le.createElement("div",{className:vi,style:Object.assign(Object.assign({},ct==null?void 0:ct.style),G)},ai,je))}return typeof W!="undefined"?W:null};jt.Button=Xe,jt.Avatar=Ne,jt.Input=M,jt.Image=X,jt.Node=we;var R=jt,P=R},81327:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return Re}});var C=A(59301),O=A(92310),le=A.n(O),fe=A(38298),V=A(36355),$=A(33234);const ye=C.createContext({latestIndex:0}),de=ye.Provider;var Q=H=>{let{className:D,index:B,children:z,split:b,style:oe}=H;const{latestIndex:he}=C.useContext(ye);return z==null?null:C.createElement(C.Fragment,null,C.createElement("div",{className:D,style:oe},z),B<he&&b&&C.createElement("span",{className:`${D}-split`},b))},ke=A(2856);function ve(H){return["small","middle","large"].includes(H)}function f(H){return H?typeof H=="number"&&!Number.isNaN(H):!1}var N=function(H,D){var B={};for(var z in H)Object.prototype.hasOwnProperty.call(H,z)&&D.indexOf(z)<0&&(B[z]=H[z]);if(H!=null&&typeof Object.getOwnPropertySymbols=="function")for(var b=0,z=Object.getOwnPropertySymbols(H);b<z.length;b++)D.indexOf(z[b])<0&&Object.prototype.propertyIsEnumerable.call(H,z[b])&&(B[z[b]]=H[z[b]]);return B};const _e=C.forwardRef((H,D)=>{var B,z;const{getPrefixCls:b,space:oe,direction:he}=C.useContext(V.E_),{size:Y=(oe==null?void 0:oe.size)||"small",align:Ne,className:Ke,rootClassName:Xe,children:Se,direction:j="horizontal",prefixCls:X,split:J,style:M,wrap:Ae=!1,classNames:ze,styles:ge}=H,Ee=N(H,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[rt,qe]=Array.isArray(Y)?Y:[Y,Y],Fe=ve(qe),He=ve(rt),we=f(qe),it=f(rt),pt=(0,fe.Z)(Se,{keepEmpty:!0}),Lt=Ne===void 0&&j==="horizontal"?"center":Ne,Ut=b("space",X),[$t,vt]=(0,ke.Z)(Ut),Bt=le()(Ut,oe==null?void 0:oe.className,vt,`${Ut}-${j}`,{[`${Ut}-rtl`]:he==="rtl",[`${Ut}-align-${Lt}`]:Lt,[`${Ut}-gap-row-${qe}`]:Fe,[`${Ut}-gap-col-${rt}`]:He},Ke,Xe),Ht=le()(`${Ut}-item`,(B=ze==null?void 0:ze.item)!==null&&B!==void 0?B:(z=oe==null?void 0:oe.classNames)===null||z===void 0?void 0:z.item);let Zt=0;const jt=pt.map((x,L)=>{var F,ne;x!=null&&(Zt=L);const I=x&&x.key||`${Ht}-${L}`;return C.createElement(Q,{className:Ht,key:I,index:L,split:J,style:(F=ge==null?void 0:ge.item)!==null&&F!==void 0?F:(ne=oe==null?void 0:oe.styles)===null||ne===void 0?void 0:ne.item},x)}),R=C.useMemo(()=>({latestIndex:Zt}),[Zt]);if(pt.length===0)return null;const P={};return Ae&&(P.flexWrap="wrap"),!He&&it&&(P.columnGap=rt),!Fe&&we&&(P.rowGap=qe),$t(C.createElement("div",Object.assign({ref:D,className:Bt,style:Object.assign(Object.assign(Object.assign({},P),oe==null?void 0:oe.style),M)},Ee),C.createElement(de,{value:R},jt)))});_e.Compact=$.ZP;var Re=_e},8378:function(Wt,Ve){"use strict";const A=C=>({[C.componentCls]:{[`${C.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${C.motionDurationMid} ${C.motionEaseInOut},
|
|
opacity ${C.motionDurationMid} ${C.motionEaseInOut} !important`}},[`${C.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${C.motionDurationMid} ${C.motionEaseInOut},
|
|
opacity ${C.motionDurationMid} ${C.motionEaseInOut} !important`}}});Ve.Z=A},92899:function(Wt,Ve,A){"use strict";A.d(Ve,{Fm:function(){return ve}});var C=A(9792),O=A(95406);const le=new C.Keyframes("antMoveDownIn",{"0%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),fe=new C.Keyframes("antMoveDownOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, 100%, 0)",transformOrigin:"0 0",opacity:0}}),V=new C.Keyframes("antMoveLeftIn",{"0%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),$=new C.Keyframes("antMoveLeftOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(-100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),ye=new C.Keyframes("antMoveRightIn",{"0%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),de=new C.Keyframes("antMoveRightOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(100%, 0, 0)",transformOrigin:"0 0",opacity:0}}),ae=new C.Keyframes("antMoveUpIn",{"0%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1}}),Q=new C.Keyframes("antMoveUpOut",{"0%":{transform:"translate3d(0, 0, 0)",transformOrigin:"0 0",opacity:1},"100%":{transform:"translate3d(0, -100%, 0)",transformOrigin:"0 0",opacity:0}}),ke={"move-up":{inKeyframes:ae,outKeyframes:Q},"move-down":{inKeyframes:le,outKeyframes:fe},"move-left":{inKeyframes:V,outKeyframes:$},"move-right":{inKeyframes:ye,outKeyframes:de}},ve=(f,N)=>{const{antCls:K}=f,_e=`${K}-${N}`,{inKeyframes:Re,outKeyframes:H}=ke[N];return[(0,O.R)(_e,Re,H,f.motionDurationMid),{[`
|
|
${_e}-enter,
|
|
${_e}-appear
|
|
`]:{opacity:0,animationTimingFunction:f.motionEaseOutCirc},[`${_e}-leave`]:{animationTimingFunction:f.motionEaseInOutCirc}}]}},13826:function(Wt,Ve,A){"use strict";A.d(Ve,{Qt:function(){return V},Uw:function(){return fe},fJ:function(){return le},ly:function(){return $},oN:function(){return ve}});var C=A(9792),O=A(95406);const le=new C.Keyframes("antSlideUpIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1}}),fe=new C.Keyframes("antSlideUpOut",{"0%":{transform:"scaleY(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"0% 0%",opacity:0}}),V=new C.Keyframes("antSlideDownIn",{"0%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0},"100%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1}}),$=new C.Keyframes("antSlideDownOut",{"0%":{transform:"scaleY(1)",transformOrigin:"100% 100%",opacity:1},"100%":{transform:"scaleY(0.8)",transformOrigin:"100% 100%",opacity:0}}),ye=new C.Keyframes("antSlideLeftIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1}}),de=new C.Keyframes("antSlideLeftOut",{"0%":{transform:"scaleX(1)",transformOrigin:"0% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"0% 0%",opacity:0}}),ae=new C.Keyframes("antSlideRightIn",{"0%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0},"100%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1}}),Q=new C.Keyframes("antSlideRightOut",{"0%":{transform:"scaleX(1)",transformOrigin:"100% 0%",opacity:1},"100%":{transform:"scaleX(0.8)",transformOrigin:"100% 0%",opacity:0}}),ke={"slide-up":{inKeyframes:le,outKeyframes:fe},"slide-down":{inKeyframes:V,outKeyframes:$},"slide-left":{inKeyframes:ye,outKeyframes:de},"slide-right":{inKeyframes:ae,outKeyframes:Q}},ve=(f,N)=>{const{antCls:K}=f,_e=`${K}-${N}`,{inKeyframes:Re,outKeyframes:H}=ke[N];return[(0,O.R)(_e,Re,H,f.motionDurationMid),{[`
|
|
${_e}-enter,
|
|
${_e}-appear
|
|
`]:{transform:"scale(0)",transformOrigin:"0% 0%",opacity:0,animationTimingFunction:f.motionEaseOutQuint,"&-prepare":{transform:"scale(1)"}},[`${_e}-leave`]:{animationTimingFunction:f.motionEaseInQuint}}]}},19447:function(Wt,Ve,A){"use strict";A.d(Ve,{ZP:function(){return V},fS:function(){return le},qN:function(){return O}});var C=A(47585);const O=8;function le($){const ye=O,{contentRadius:de,limitVerticalRadius:ae}=$,Q=de>12?de+2:12;return{dropdownArrowOffset:Q,dropdownArrowOffsetVertical:ae?ye:Q}}function fe($,ye){return $?ye:{}}function V($,ye){const{componentCls:de,sizePopupArrow:ae,borderRadiusXS:Q,borderRadiusOuter:ke,boxShadowPopoverArrow:ve}=$,{colorBg:f,contentRadius:N=$.borderRadiusLG,limitVerticalRadius:K,arrowDistance:_e=0,arrowPlacement:Re={left:!0,right:!0,top:!0,bottom:!0}}=ye,{dropdownArrowOffsetVertical:H,dropdownArrowOffset:D}=le({contentRadius:N,limitVerticalRadius:K});return{[de]:Object.assign(Object.assign(Object.assign(Object.assign({[`${de}-arrow`]:[Object.assign(Object.assign({position:"absolute",zIndex:1,display:"block"},(0,C.r)(ae,Q,ke,f,ve)),{"&:before":{background:f}})]},fe(!!Re.top,{[[`&-placement-top ${de}-arrow`,`&-placement-topLeft ${de}-arrow`,`&-placement-topRight ${de}-arrow`].join(",")]:{bottom:_e,transform:"translateY(100%) rotate(180deg)"},[`&-placement-top ${de}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(100%) rotate(180deg)"},[`&-placement-topLeft ${de}-arrow`]:{left:{_skip_check_:!0,value:D}},[`&-placement-topRight ${de}-arrow`]:{right:{_skip_check_:!0,value:D}}})),fe(!!Re.bottom,{[[`&-placement-bottom ${de}-arrow`,`&-placement-bottomLeft ${de}-arrow`,`&-placement-bottomRight ${de}-arrow`].join(",")]:{top:_e,transform:"translateY(-100%)"},[`&-placement-bottom ${de}-arrow`]:{left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%) translateY(-100%)"},[`&-placement-bottomLeft ${de}-arrow`]:{left:{_skip_check_:!0,value:D}},[`&-placement-bottomRight ${de}-arrow`]:{right:{_skip_check_:!0,value:D}}})),fe(!!Re.left,{[[`&-placement-left ${de}-arrow`,`&-placement-leftTop ${de}-arrow`,`&-placement-leftBottom ${de}-arrow`].join(",")]:{right:{_skip_check_:!0,value:_e},transform:"translateX(100%) rotate(90deg)"},[`&-placement-left ${de}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(100%) rotate(90deg)"},[`&-placement-leftTop ${de}-arrow`]:{top:H},[`&-placement-leftBottom ${de}-arrow`]:{bottom:H}})),fe(!!Re.right,{[[`&-placement-right ${de}-arrow`,`&-placement-rightTop ${de}-arrow`,`&-placement-rightBottom ${de}-arrow`].join(",")]:{left:{_skip_check_:!0,value:_e},transform:"translateX(-100%) rotate(-90deg)"},[`&-placement-right ${de}-arrow`]:{top:{_skip_check_:!0,value:"50%"},transform:"translateY(-50%) translateX(-100%) rotate(-90deg)"},[`&-placement-rightTop ${de}-arrow`]:{top:H},[`&-placement-rightBottom ${de}-arrow`]:{bottom:H}}))}}},47585:function(Wt,Ve,A){"use strict";A.d(Ve,{r:function(){return C}});const C=(O,le,fe,V,$)=>{const ye=O/2,de=0,ae=ye,Q=fe*1/Math.sqrt(2),ke=ye-fe*(1-1/Math.sqrt(2)),ve=ye-le*(1/Math.sqrt(2)),f=fe*(Math.sqrt(2)-1)+le*(1/Math.sqrt(2)),N=2*ye-ve,K=f,_e=2*ye-Q,Re=ke,H=2*ye-de,D=ae,B=ye*Math.sqrt(2)+fe*(Math.sqrt(2)-2),z=fe*(Math.sqrt(2)-1);return{pointerEvents:"none",width:O,height:O,overflow:"hidden","&::before":{position:"absolute",bottom:0,insetInlineStart:0,width:O,height:O/2,background:V,clipPath:{_multi_value_:!0,value:[`polygon(${z}px 100%, 50% ${z}px, ${2*ye-z}px 100%, ${z}px 100%)`,`path('M ${de} ${ae} A ${fe} ${fe} 0 0 0 ${Q} ${ke} L ${ve} ${f} A ${le} ${le} 0 0 1 ${N} ${K} L ${_e} ${Re} A ${fe} ${fe} 0 0 0 ${H} ${D} Z')`]},content:'""'},"&::after":{content:'""',position:"absolute",width:B,height:B,bottom:0,insetInline:0,margin:"auto",borderRadius:{_skip_check_:!0,value:`0 0 ${le}px 0`},transform:"translateY(50%) rotate(-135deg)",boxShadow:$,zIndex:0,background:"transparent"}}}},33166:function(Wt,Ve,A){"use strict";A.d(Ve,{i:function(){return C}});const C=["blue","purple","cyan","green","magenta","pink","red","orange","yellow","volcano","geekblue","lime","gold"]},45157:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return O}});var C=A(33166);function O(le,fe){return C.i.reduce((V,$)=>{const ye=le[`${$}1`],de=le[`${$}3`],ae=le[`${$}6`],Q=le[`${$}7`];return Object.assign(Object.assign({},V),fe($,{lightColor:ye,lightBorderColor:de,darkColor:ae,textColor:Q}))},{})}},6848:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return Xe}});var C=A(59301),O=A(92310),le=A.n(O),fe=A(55477),V=A(35788),$=A(62892),ye=A(79676),de=A(92343),ae=A(36355),Q=A(33234),ke=A(88088),ve=A(17313),f=A(29878),N=A(19447),K=A(45157),_e=A(37613),Re=A(83116);const H=Se=>{const{componentCls:j,tooltipMaxWidth:X,tooltipColor:J,tooltipBg:M,tooltipBorderRadius:Ae,zIndexPopup:ze,controlHeight:ge,boxShadowSecondary:Ee,paddingSM:rt,paddingXS:qe,tooltipRadiusOuter:Fe}=Se;return[{[j]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,ve.Wf)(Se)),{position:"absolute",zIndex:ze,display:"block",width:"max-content",maxWidth:X,visibility:"visible",transformOrigin:"var(--arrow-x, 50%) var(--arrow-y, 50%)","&-hidden":{display:"none"},"--antd-arrow-background-color":M,[`${j}-inner`]:{minWidth:ge,minHeight:ge,padding:`${rt/2}px ${qe}px`,color:J,textAlign:"start",textDecoration:"none",wordWrap:"break-word",backgroundColor:M,borderRadius:Ae,boxShadow:Ee,boxSizing:"border-box"},[["&-placement-left","&-placement-leftTop","&-placement-leftBottom","&-placement-right","&-placement-rightTop","&-placement-rightBottom"].join(",")]:{[`${j}-inner`]:{borderRadius:Math.min(Ae,N.qN)}},[`${j}-content`]:{position:"relative"}}),(0,K.Z)(Se,(He,we)=>{let{darkColor:it}=we;return{[`&${j}-${He}`]:{[`${j}-inner`]:{backgroundColor:it},[`${j}-arrow`]:{"--antd-arrow-background-color":it}}}})),{"&-rtl":{direction:"rtl"}})},(0,N.ZP)((0,_e.TS)(Se,{borderRadiusOuter:Fe}),{colorBg:"var(--antd-arrow-background-color)",contentRadius:Ae,limitVerticalRadius:!0}),{[`${j}-pure`]:{position:"relative",maxWidth:"none",margin:Se.sizePopupArrow}}]};var D=(Se,j)=>(0,Re.Z)("Tooltip",J=>{if(j===!1)return[];const{borderRadius:M,colorTextLightSolid:Ae,colorBgDefault:ze,borderRadiusOuter:ge}=J,Ee=(0,_e.TS)(J,{tooltipMaxWidth:250,tooltipColor:Ae,tooltipBorderRadius:M,tooltipBg:ze,tooltipRadiusOuter:ge>4?4:ge});return[H(Ee),(0,f._y)(J,"zoom-big-fast")]},J=>{let{zIndexPopupBase:M,colorBgSpotlight:Ae}=J;return{zIndexPopup:M+70,colorBgDefault:Ae}},{resetStyle:!1})(Se),B=A(36785);function z(Se,j){const X=(0,B.o2)(j),J=le()({[`${Se}-${j}`]:j&&X}),M={},Ae={};return j&&!X&&(M.background=j,Ae["--antd-arrow-background-color"]=j),{className:J,overlayStyle:M,arrowStyle:Ae}}var oe=Se=>{const{prefixCls:j,className:X,placement:J="top",title:M,color:Ae,overlayInnerStyle:ze}=Se,{getPrefixCls:ge}=C.useContext(ae.E_),Ee=ge("tooltip",j),[rt,qe]=D(Ee,!0),Fe=z(Ee,Ae),He=Fe.arrowStyle,we=Object.assign(Object.assign({},ze),Fe.overlayStyle),it=le()(qe,Ee,`${Ee}-pure`,`${Ee}-placement-${J}`,X,Fe.className);return rt(C.createElement("div",{className:it,style:He},C.createElement("div",{className:`${Ee}-arrow`}),C.createElement(fe.G,Object.assign({},Se,{className:qe,prefixCls:Ee,overlayInnerStyle:we}),M)))},he=function(Se,j){var X={};for(var J in Se)Object.prototype.hasOwnProperty.call(Se,J)&&j.indexOf(J)<0&&(X[J]=Se[J]);if(Se!=null&&typeof Object.getOwnPropertySymbols=="function")for(var M=0,J=Object.getOwnPropertySymbols(Se);M<J.length;M++)j.indexOf(J[M])<0&&Object.prototype.propertyIsEnumerable.call(Se,J[M])&&(X[J[M]]=Se[J[M]]);return X};const Y=(Se,j)=>{const X={},J=Object.assign({},Se);return j.forEach(M=>{Se&&M in Se&&(X[M]=Se[M],delete J[M])}),{picked:X,omitted:J}};function Ne(Se,j){const X=Se.type;if((X.__ANT_BUTTON===!0||Se.type==="button")&&Se.props.disabled||X.__ANT_SWITCH===!0&&(Se.props.disabled||Se.props.loading)||X.__ANT_RADIO===!0&&Se.props.disabled){const{picked:J,omitted:M}=Y(Se.props.style,["position","left","right","top","bottom","float","display","zIndex"]),Ae=Object.assign(Object.assign({display:"inline-block"},J),{cursor:"not-allowed",width:Se.props.block?"100%":void 0}),ze=Object.assign(Object.assign({},M),{pointerEvents:"none"}),ge=(0,de.Tm)(Se,{style:ze,className:null});return C.createElement("span",{style:Ae,className:le()(Se.props.className,`${j}-disabled-compatible-wrapper`)},ge)}return Se}const Ke=C.forwardRef((Se,j)=>{var X,J;const{prefixCls:M,openClassName:Ae,getTooltipContainer:ze,overlayClassName:ge,color:Ee,overlayInnerStyle:rt,children:qe,afterOpenChange:Fe,afterVisibleChange:He,destroyTooltipOnHide:we,arrow:it=!0,title:pt,overlay:Lt,builtinPlacements:Ut,arrowPointAtCenter:$t=!1,autoAdjustOverflow:vt=!0}=Se,Bt=!!it,[,Ht]=(0,ke.Z)(),{getPopupContainer:Zt,getPrefixCls:jt,direction:R}=C.useContext(ae.E_),P=C.useRef(null),x=()=>{var Qt;(Qt=P.current)===null||Qt===void 0||Qt.forceAlign()};C.useImperativeHandle(j,()=>({forceAlign:x,forcePopupAlign:()=>{x()}}));const[L,F]=(0,V.Z)(!1,{value:(X=Se.open)!==null&&X!==void 0?X:Se.visible,defaultValue:(J=Se.defaultOpen)!==null&&J!==void 0?J:Se.defaultVisible}),ne=!pt&&!Lt&&pt!==0,I=Qt=>{var st,At;F(ne?!1:Qt),ne||((st=Se.onOpenChange)===null||st===void 0||st.call(Se,Qt),(At=Se.onVisibleChange)===null||At===void 0||At.call(Se,Qt))},G=C.useMemo(()=>{var Qt,st;let At=$t;return typeof it=="object"&&(At=(st=(Qt=it.pointAtCenter)!==null&&Qt!==void 0?Qt:it.arrowPointAtCenter)!==null&&st!==void 0?st:$t),Ut||(0,ye.Z)({arrowPointAtCenter:At,autoAdjustOverflow:vt,arrowWidth:Bt?Ht.sizePopupArrow:0,borderRadius:Ht.borderRadius,offset:Ht.marginXXS,visibleFirst:!0})},[$t,it,Ut,Ht]),W=C.useMemo(()=>pt===0?pt:Lt||pt||"",[Lt,pt]),w=C.createElement(Q.BR,null,typeof W=="function"?W():W),{getPopupContainer:se,placement:Te="top",mouseEnterDelay:We=.1,mouseLeaveDelay:Qe=.1,overlayStyle:dt,rootClassName:Ze}=Se,ct=he(Se,["getPopupContainer","placement","mouseEnterDelay","mouseLeaveDelay","overlayStyle","rootClassName"]),tt=jt("tooltip",M),bt=jt(),wt=Se["data-popover-inject"];let ce=L;!("open"in Se)&&!("visible"in Se)&&ne&&(ce=!1);const Yt=Ne((0,de.l$)(qe)&&!(0,de.M2)(qe)?qe:C.createElement("span",null,qe),tt),Ct=Yt.props,ai=!Ct.className||typeof Ct.className=="string"?le()(Ct.className,Ae||`${tt}-open`):Ct.className,[je,vi]=D(tt,!wt),ci=z(tt,Ee),gi=ci.arrowStyle,ui=Object.assign(Object.assign({},rt),ci.overlayStyle),ft=le()(ge,{[`${tt}-rtl`]:R==="rtl"},ci.className,Ze,vi);return je(C.createElement(fe.Z,Object.assign({},ct,{showArrow:Bt,placement:Te,mouseEnterDelay:We,mouseLeaveDelay:Qe,prefixCls:tt,overlayClassName:ft,overlayStyle:Object.assign(Object.assign({},gi),dt),getTooltipContainer:se||ze||Zt,ref:P,builtinPlacements:G,overlay:w,visible:ce,onVisibleChange:I,afterVisibleChange:Fe!=null?Fe:He,overlayInnerStyle:ui,arrowContent:C.createElement("span",{className:`${tt}-arrow-content`}),motion:{motionName:(0,$.m)(bt,"zoom-big-fast",Se.transitionName),motionDeadline:1e3},destroyTooltipOnHide:!!we}),ce?(0,de.Tm)(Yt,{className:ai}):Yt))});Ke._InternalPanelDoNotUseOrYouWillBeFired=oe;var Xe=Ke},25769:function(Wt,Ve,A){"use strict";var C=A(98040),O={"text/plain":"Text","text/html":"Url",default:"Text"},le="Copy to clipboard: #{key}, Enter";function fe($){var ye=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return $.replace(/#{\s*key\s*}/g,ye)}function V($,ye){var de,ae,Q,ke,ve,f,N=!1;ye||(ye={}),de=ye.debug||!1;try{Q=C(),ke=document.createRange(),ve=document.getSelection(),f=document.createElement("span"),f.textContent=$,f.ariaHidden="true",f.style.all="unset",f.style.position="fixed",f.style.top=0,f.style.clip="rect(0, 0, 0, 0)",f.style.whiteSpace="pre",f.style.webkitUserSelect="text",f.style.MozUserSelect="text",f.style.msUserSelect="text",f.style.userSelect="text",f.addEventListener("copy",function(_e){if(_e.stopPropagation(),ye.format)if(_e.preventDefault(),typeof _e.clipboardData=="undefined"){de&&console.warn("unable to use e.clipboardData"),de&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var Re=O[ye.format]||O.default;window.clipboardData.setData(Re,$)}else _e.clipboardData.clearData(),_e.clipboardData.setData(ye.format,$);ye.onCopy&&(_e.preventDefault(),ye.onCopy(_e.clipboardData))}),document.body.appendChild(f),ke.selectNodeContents(f),ve.addRange(ke);var K=document.execCommand("copy");if(!K)throw new Error("copy command was unsuccessful");N=!0}catch(_e){de&&console.error("unable to copy using execCommand: ",_e),de&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ye.format||"text",$),ye.onCopy&&ye.onCopy(window.clipboardData),N=!0}catch(Re){de&&console.error("unable to copy using clipboardData: ",Re),de&&console.error("falling back to prompt"),ae=fe("message"in ye?ye.message:le),window.prompt(ae,$)}}finally{ve&&(typeof ve.removeRange=="function"?ve.removeRange(ke):ve.removeAllRanges()),f&&document.body.removeChild(f),Q()}return N}Wt.exports=V},3867:function(Wt,Ve,A){var C=A(97671);(function(O,le){Wt.exports=le()})(this,function(){"use strict";function O(I){var G=typeof I;return I!==null&&(G==="object"||G==="function")}function le(I){return typeof I=="function"}var fe=void 0;Array.isArray?fe=Array.isArray:fe=function(I){return Object.prototype.toString.call(I)==="[object Array]"};var V=fe,$=0,ye=void 0,de=void 0,ae=function(G,W){b[$]=G,b[$+1]=W,$+=2,$===2&&(de?de(oe):Y())};function Q(I){de=I}function ke(I){ae=I}var ve=typeof window!="undefined"?window:void 0,f=ve||{},N=f.MutationObserver||f.WebKitMutationObserver,K=typeof self=="undefined"&&typeof C!="undefined"&&{}.toString.call(C)==="[object process]",_e=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function Re(){return function(){return C.nextTick(oe)}}function H(){return typeof ye!="undefined"?function(){ye(oe)}:z()}function D(){var I=0,G=new N(oe),W=document.createTextNode("");return G.observe(W,{characterData:!0}),function(){W.data=I=++I%2}}function B(){var I=new MessageChannel;return I.port1.onmessage=oe,function(){return I.port2.postMessage(0)}}function z(){var I=setTimeout;return function(){return I(oe,1)}}var b=new Array(1e3);function oe(){for(var I=0;I<$;I+=2){var G=b[I],W=b[I+1];G(W),b[I]=void 0,b[I+1]=void 0}$=0}function he(){try{var I=Function("return this")().require("vertx");return ye=I.runOnLoop||I.runOnContext,H()}catch(G){return z()}}var Y=void 0;K?Y=Re():N?Y=D():_e?Y=B():ve===void 0?Y=he():Y=z();function Ne(I,G){var W=this,w=new this.constructor(Se);w[Xe]===void 0&&Bt(w);var se=W._state;if(se){var Te=arguments[se-1];ae(function(){return Lt(se,w,Te,W._result)})}else it(W,w,I,G);return w}function Ke(I){var G=this;if(I&&typeof I=="object"&&I.constructor===G)return I;var W=new G(Se);return qe(W,I),W}var Xe=Math.random().toString(36).substring(2);function Se(){}var j=void 0,X=1,J=2;function M(){return new TypeError("You cannot resolve a promise with itself")}function Ae(){return new TypeError("A promises callback cannot return that same promise.")}function ze(I,G,W,w){try{I.call(G,W,w)}catch(se){return se}}function ge(I,G,W){ae(function(w){var se=!1,Te=ze(W,G,function(We){se||(se=!0,G!==We?qe(w,We):He(w,We))},function(We){se||(se=!0,we(w,We))},"Settle: "+(w._label||" unknown promise"));!se&&Te&&(se=!0,we(w,Te))},I)}function Ee(I,G){G._state===X?He(I,G._result):G._state===J?we(I,G._result):it(G,void 0,function(W){return qe(I,W)},function(W){return we(I,W)})}function rt(I,G,W){G.constructor===I.constructor&&W===Ne&&G.constructor.resolve===Ke?Ee(I,G):W===void 0?He(I,G):le(W)?ge(I,G,W):He(I,G)}function qe(I,G){if(I===G)we(I,M());else if(O(G)){var W=void 0;try{W=G.then}catch(w){we(I,w);return}rt(I,G,W)}else He(I,G)}function Fe(I){I._onerror&&I._onerror(I._result),pt(I)}function He(I,G){I._state===j&&(I._result=G,I._state=X,I._subscribers.length!==0&&ae(pt,I))}function we(I,G){I._state===j&&(I._state=J,I._result=G,ae(Fe,I))}function it(I,G,W,w){var se=I._subscribers,Te=se.length;I._onerror=null,se[Te]=G,se[Te+X]=W,se[Te+J]=w,Te===0&&I._state&&ae(pt,I)}function pt(I){var G=I._subscribers,W=I._state;if(G.length!==0){for(var w=void 0,se=void 0,Te=I._result,We=0;We<G.length;We+=3)w=G[We],se=G[We+W],w?Lt(W,w,se,Te):se(Te);I._subscribers.length=0}}function Lt(I,G,W,w){var se=le(W),Te=void 0,We=void 0,Qe=!0;if(se){try{Te=W(w)}catch(dt){Qe=!1,We=dt}if(G===Te){we(G,Ae());return}}else Te=w;G._state!==j||(se&&Qe?qe(G,Te):Qe===!1?we(G,We):I===X?He(G,Te):I===J&&we(G,Te))}function Ut(I,G){try{G(function(w){qe(I,w)},function(w){we(I,w)})}catch(W){we(I,W)}}var $t=0;function vt(){return $t++}function Bt(I){I[Xe]=$t++,I._state=void 0,I._result=void 0,I._subscribers=[]}function Ht(){return new Error("Array Methods must be provided an Array")}var Zt=function(){function I(G,W){this._instanceConstructor=G,this.promise=new G(Se),this.promise[Xe]||Bt(this.promise),V(W)?(this.length=W.length,this._remaining=W.length,this._result=new Array(this.length),this.length===0?He(this.promise,this._result):(this.length=this.length||0,this._enumerate(W),this._remaining===0&&He(this.promise,this._result))):we(this.promise,Ht())}return I.prototype._enumerate=function(W){for(var w=0;this._state===j&&w<W.length;w++)this._eachEntry(W[w],w)},I.prototype._eachEntry=function(W,w){var se=this._instanceConstructor,Te=se.resolve;if(Te===Ke){var We=void 0,Qe=void 0,dt=!1;try{We=W.then}catch(ct){dt=!0,Qe=ct}if(We===Ne&&W._state!==j)this._settledAt(W._state,w,W._result);else if(typeof We!="function")this._remaining--,this._result[w]=W;else if(se===F){var Ze=new se(Se);dt?we(Ze,Qe):rt(Ze,W,We),this._willSettleAt(Ze,w)}else this._willSettleAt(new se(function(ct){return ct(W)}),w)}else this._willSettleAt(Te(W),w)},I.prototype._settledAt=function(W,w,se){var Te=this.promise;Te._state===j&&(this._remaining--,W===J?we(Te,se):this._result[w]=se),this._remaining===0&&He(Te,this._result)},I.prototype._willSettleAt=function(W,w){var se=this;it(W,void 0,function(Te){return se._settledAt(X,w,Te)},function(Te){return se._settledAt(J,w,Te)})},I}();function jt(I){return new Zt(this,I).promise}function R(I){var G=this;return V(I)?new G(function(W,w){for(var se=I.length,Te=0;Te<se;Te++)G.resolve(I[Te]).then(W,w)}):new G(function(W,w){return w(new TypeError("You must pass an array to race."))})}function P(I){var G=this,W=new G(Se);return we(W,I),W}function x(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var F=function(){function I(G){this[Xe]=vt(),this._result=this._state=void 0,this._subscribers=[],Se!==G&&(typeof G!="function"&&x(),this instanceof I?Ut(this,G):L())}return I.prototype.catch=function(W){return this.then(null,W)},I.prototype.finally=function(W){var w=this,se=w.constructor;return le(W)?w.then(function(Te){return se.resolve(W()).then(function(){return Te})},function(Te){return se.resolve(W()).then(function(){throw Te})}):w.then(W,W)},I}();F.prototype.then=Ne,F.all=jt,F.race=R,F.resolve=Ke,F.reject=P,F._setScheduler=Q,F._setAsap=ke,F._asap=ae;function ne(){var I=void 0;if(typeof A.g!="undefined")I=A.g;else if(typeof self!="undefined")I=self;else try{I=Function("return this")()}catch(w){throw new Error("polyfill failed because global object is unavailable in this environment")}var G=I.Promise;if(G){var W=null;try{W=Object.prototype.toString.call(G.resolve())}catch(w){}if(W==="[object Promise]"&&!G.cast)return}I.Promise=F}return F.polyfill=ne,F.Promise=F,F})},86204:function(Wt){"use strict";var Ve=typeof Reflect=="object"?Reflect:null,A=Ve&&typeof Ve.apply=="function"?Ve.apply:function(B,z,b){return Function.prototype.apply.call(B,z,b)},C;Ve&&typeof Ve.ownKeys=="function"?C=Ve.ownKeys:Object.getOwnPropertySymbols?C=function(B){return Object.getOwnPropertyNames(B).concat(Object.getOwnPropertySymbols(B))}:C=function(B){return Object.getOwnPropertyNames(B)};function O(D){console&&console.warn&&console.warn(D)}var le=Number.isNaN||function(B){return B!==B};function fe(){fe.init.call(this)}Wt.exports=fe,Wt.exports.once=_e,fe.EventEmitter=fe,fe.prototype._events=void 0,fe.prototype._eventsCount=0,fe.prototype._maxListeners=void 0;var V=10;function $(D){if(typeof D!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof D)}Object.defineProperty(fe,"defaultMaxListeners",{enumerable:!0,get:function(){return V},set:function(D){if(typeof D!="number"||D<0||le(D))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+D+".");V=D}}),fe.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},fe.prototype.setMaxListeners=function(B){if(typeof B!="number"||B<0||le(B))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+B+".");return this._maxListeners=B,this};function ye(D){return D._maxListeners===void 0?fe.defaultMaxListeners:D._maxListeners}fe.prototype.getMaxListeners=function(){return ye(this)},fe.prototype.emit=function(B){for(var z=[],b=1;b<arguments.length;b++)z.push(arguments[b]);var oe=B==="error",he=this._events;if(he!==void 0)oe=oe&&he.error===void 0;else if(!oe)return!1;if(oe){var Y;if(z.length>0&&(Y=z[0]),Y instanceof Error)throw Y;var Ne=new Error("Unhandled error."+(Y?" ("+Y.message+")":""));throw Ne.context=Y,Ne}var Ke=he[B];if(Ke===void 0)return!1;if(typeof Ke=="function")A(Ke,this,z);else for(var Xe=Ke.length,Se=f(Ke,Xe),b=0;b<Xe;++b)A(Se[b],this,z);return!0};function de(D,B,z,b){var oe,he,Y;if($(z),he=D._events,he===void 0?(he=D._events=Object.create(null),D._eventsCount=0):(he.newListener!==void 0&&(D.emit("newListener",B,z.listener?z.listener:z),he=D._events),Y=he[B]),Y===void 0)Y=he[B]=z,++D._eventsCount;else if(typeof Y=="function"?Y=he[B]=b?[z,Y]:[Y,z]:b?Y.unshift(z):Y.push(z),oe=ye(D),oe>0&&Y.length>oe&&!Y.warned){Y.warned=!0;var Ne=new Error("Possible EventEmitter memory leak detected. "+Y.length+" "+String(B)+" listeners added. Use emitter.setMaxListeners() to increase limit");Ne.name="MaxListenersExceededWarning",Ne.emitter=D,Ne.type=B,Ne.count=Y.length,O(Ne)}return D}fe.prototype.addListener=function(B,z){return de(this,B,z,!1)},fe.prototype.on=fe.prototype.addListener,fe.prototype.prependListener=function(B,z){return de(this,B,z,!0)};function ae(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Q(D,B,z){var b={fired:!1,wrapFn:void 0,target:D,type:B,listener:z},oe=ae.bind(b);return oe.listener=z,b.wrapFn=oe,oe}fe.prototype.once=function(B,z){return $(z),this.on(B,Q(this,B,z)),this},fe.prototype.prependOnceListener=function(B,z){return $(z),this.prependListener(B,Q(this,B,z)),this},fe.prototype.removeListener=function(B,z){var b,oe,he,Y,Ne;if($(z),oe=this._events,oe===void 0)return this;if(b=oe[B],b===void 0)return this;if(b===z||b.listener===z)--this._eventsCount===0?this._events=Object.create(null):(delete oe[B],oe.removeListener&&this.emit("removeListener",B,b.listener||z));else if(typeof b!="function"){for(he=-1,Y=b.length-1;Y>=0;Y--)if(b[Y]===z||b[Y].listener===z){Ne=b[Y].listener,he=Y;break}if(he<0)return this;he===0?b.shift():N(b,he),b.length===1&&(oe[B]=b[0]),oe.removeListener!==void 0&&this.emit("removeListener",B,Ne||z)}return this},fe.prototype.off=fe.prototype.removeListener,fe.prototype.removeAllListeners=function(B){var z,b,oe;if(b=this._events,b===void 0)return this;if(b.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):b[B]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete b[B]),this;if(arguments.length===0){var he=Object.keys(b),Y;for(oe=0;oe<he.length;++oe)Y=he[oe],Y!=="removeListener"&&this.removeAllListeners(Y);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(z=b[B],typeof z=="function")this.removeListener(B,z);else if(z!==void 0)for(oe=z.length-1;oe>=0;oe--)this.removeListener(B,z[oe]);return this};function ke(D,B,z){var b=D._events;if(b===void 0)return[];var oe=b[B];return oe===void 0?[]:typeof oe=="function"?z?[oe.listener||oe]:[oe]:z?K(oe):f(oe,oe.length)}fe.prototype.listeners=function(B){return ke(this,B,!0)},fe.prototype.rawListeners=function(B){return ke(this,B,!1)},fe.listenerCount=function(D,B){return typeof D.listenerCount=="function"?D.listenerCount(B):ve.call(D,B)},fe.prototype.listenerCount=ve;function ve(D){var B=this._events;if(B!==void 0){var z=B[D];if(typeof z=="function")return 1;if(z!==void 0)return z.length}return 0}fe.prototype.eventNames=function(){return this._eventsCount>0?C(this._events):[]};function f(D,B){for(var z=new Array(B),b=0;b<B;++b)z[b]=D[b];return z}function N(D,B){for(;B+1<D.length;B++)D[B]=D[B+1];D.pop()}function K(D){for(var B=new Array(D.length),z=0;z<B.length;++z)B[z]=D[z].listener||D[z];return B}function _e(D,B){return new Promise(function(z,b){function oe(Y){D.removeListener(B,he),b(Y)}function he(){typeof D.removeListener=="function"&&D.removeListener("error",oe),z([].slice.call(arguments))}H(D,B,he,{once:!0}),B!=="error"&&Re(D,oe,{once:!0})})}function Re(D,B,z){typeof D.on=="function"&&H(D,"error",B,z)}function H(D,B,z,b){if(typeof D.on=="function")b.once?D.once(B,z):D.on(B,z);else if(typeof D.addEventListener=="function")D.addEventListener(B,function oe(he){b.once&&D.removeEventListener(B,oe),z(he)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof D)}},31561:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return he}});var C=A(5891),O=A(80962),le=A(29043),fe=A(19149),V=A(35593),$=A(92310),ye=A.n($),de=A(20475),ae=A(59301),Q=A(85108),ke=A(23073),ve=Q.Z.ESC,f=Q.Z.TAB;function N(Y){var Ne=Y.visible,Ke=Y.triggerRef,Xe=Y.onVisibleChange,Se=Y.autoFocus,j=Y.overlayRef,X=ae.useRef(!1),J=function(){if(Ne){var ge,Ee;(ge=Ke.current)===null||ge===void 0||(Ee=ge.focus)===null||Ee===void 0||Ee.call(ge),Xe==null||Xe(!1)}},M=function(){var ge;return(ge=j.current)!==null&&ge!==void 0&&ge.focus?(j.current.focus(),X.current=!0,!0):!1},Ae=function(ge){switch(ge.keyCode){case ve:J();break;case f:{var Ee=!1;X.current||(Ee=M()),Ee?ge.preventDefault():J();break}}};ae.useEffect(function(){return Ne?(window.addEventListener("keydown",Ae),Se&&(0,ke.Z)(M,3),function(){window.removeEventListener("keydown",Ae),X.current=!1}):function(){X.current=!1}},[Ne])}var K=(0,ae.forwardRef)(function(Y,Ne){var Ke=Y.overlay,Xe=Y.arrow,Se=Y.prefixCls,j=(0,ae.useMemo)(function(){var J;return typeof Ke=="function"?J=Ke():J=Ke,J},[Ke]),X=(0,de.sQ)(Ne,j==null?void 0:j.ref);return ae.createElement(ae.Fragment,null,Xe&&ae.createElement("div",{className:"".concat(Se,"-arrow")}),ae.cloneElement(j,{ref:(0,de.Yr)(j)?X:void 0}))}),_e=K,Re={adjustX:1,adjustY:1},H=[0,0],D={topLeft:{points:["bl","tl"],overflow:Re,offset:[0,-4],targetOffset:H},top:{points:["bc","tc"],overflow:Re,offset:[0,-4],targetOffset:H},topRight:{points:["br","tr"],overflow:Re,offset:[0,-4],targetOffset:H},bottomLeft:{points:["tl","bl"],overflow:Re,offset:[0,4],targetOffset:H},bottom:{points:["tc","bc"],overflow:Re,offset:[0,4],targetOffset:H},bottomRight:{points:["tr","br"],overflow:Re,offset:[0,4],targetOffset:H}},B=D,z=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function b(Y,Ne){var Ke,Xe=Y.arrow,Se=Xe===void 0?!1:Xe,j=Y.prefixCls,X=j===void 0?"rc-dropdown":j,J=Y.transitionName,M=Y.animation,Ae=Y.align,ze=Y.placement,ge=ze===void 0?"bottomLeft":ze,Ee=Y.placements,rt=Ee===void 0?B:Ee,qe=Y.getPopupContainer,Fe=Y.showAction,He=Y.hideAction,we=Y.overlayClassName,it=Y.overlayStyle,pt=Y.visible,Lt=Y.trigger,Ut=Lt===void 0?["hover"]:Lt,$t=Y.autoFocus,vt=Y.overlay,Bt=Y.children,Ht=Y.onVisibleChange,Zt=(0,fe.Z)(Y,z),jt=ae.useState(),R=(0,le.Z)(jt,2),P=R[0],x=R[1],L="visible"in Y?pt:P,F=ae.useRef(null),ne=ae.useRef(null),I=ae.useRef(null);ae.useImperativeHandle(Ne,function(){return F.current});var G=function(ct){x(ct),Ht==null||Ht(ct)};N({visible:L,triggerRef:I,onVisibleChange:G,autoFocus:$t,overlayRef:ne});var W=function(ct){var tt=Y.onOverlayClick;x(!1),tt&&tt(ct)},w=function(){return ae.createElement(_e,{ref:ne,overlay:vt,prefixCls:X,arrow:Se})},se=function(){return typeof vt=="function"?w:w()},Te=function(){var ct=Y.minOverlayWidthMatchTrigger,tt=Y.alignPoint;return"minOverlayWidthMatchTrigger"in Y?ct:!tt},We=function(){var ct=Y.openClassName;return ct!==void 0?ct:"".concat(X,"-open")},Qe=ae.cloneElement(Bt,{className:ye()((Ke=Bt.props)===null||Ke===void 0?void 0:Ke.className,L&&We()),ref:(0,de.Yr)(Bt)?(0,de.sQ)(I,Bt.ref):void 0}),dt=He;return!dt&&Ut.indexOf("contextMenu")!==-1&&(dt=["click"]),ae.createElement(V.Z,(0,C.Z)({builtinPlacements:rt},Zt,{prefixCls:X,ref:F,popupClassName:ye()(we,(0,O.Z)({},"".concat(X,"-show-arrow"),Se)),popupStyle:it,action:Ut,showAction:Fe,hideAction:dt,popupPlacement:ge,popupAlign:Ae,popupTransitionName:J,popupAnimation:M,popupVisible:L,stretch:Te()?"minWidth":"",popup:se(),onPopupVisibleChange:G,onPopupClick:W,getPopupContainer:qe}),Qe)}var oe=ae.forwardRef(b),he=oe},22798:function(Wt,Ve,A){"use strict";A.d(Ve,{iz:function(){return nt},ck:function(){return st},BW:function(){return Ft},sN:function(){return st},Wd:function(){return $e},ZP:function(){return at},Xl:function(){return Ke}});var C=A(5891),O=A(80962),le=A(57259),fe=A(26390),V=A(29043),$=A(19149),ye=A(92310),de=A.n(ye),ae=A(11780),Q=A(35788),ke=A(51346),ve=A(51395),f=A(59301),N=A(4676),K=f.createContext(null);function _e(Z,ee){return Z===void 0?null:"".concat(Z,"-").concat(ee)}function Re(Z){var ee=f.useContext(K);return _e(ee,Z)}var H=A(79722),D=["children","locked"],B=f.createContext(null);function z(Z,ee){var me=(0,le.Z)({},Z);return Object.keys(ee).forEach(function(Ce){var pe=ee[Ce];pe!==void 0&&(me[Ce]=pe)}),me}function b(Z){var ee=Z.children,me=Z.locked,Ce=(0,$.Z)(Z,D),pe=f.useContext(B),Pe=(0,H.Z)(function(){return z(pe,Ce)},[pe,Ce],function(Le,Tt){return!me&&(Le[0]!==Tt[0]||!(0,ke.Z)(Le[1],Tt[1],!0))});return f.createElement(B.Provider,{value:Pe},ee)}var oe=[],he=f.createContext(null);function Y(){return f.useContext(he)}var Ne=f.createContext(oe);function Ke(Z){var ee=f.useContext(Ne);return f.useMemo(function(){return Z!==void 0?[].concat((0,fe.Z)(ee),[Z]):ee},[ee,Z])}var Xe=f.createContext(null),Se=f.createContext({}),j=Se,X=A(48886);function J(Z){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,X.Z)(Z)){var me=Z.nodeName.toLowerCase(),Ce=["input","select","textarea","button"].includes(me)||Z.isContentEditable||me==="a"&&!!Z.getAttribute("href"),pe=Z.getAttribute("tabindex"),Pe=Number(pe),Le=null;return pe&&!Number.isNaN(Pe)?Le=Pe:Ce&&Le===null&&(Le=0),Ce&&Z.disabled&&(Le=null),Le!==null&&(Le>=0||ee&&Le<0)}return!1}function M(Z){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,me=(0,fe.Z)(Z.querySelectorAll("*")).filter(function(Ce){return J(Ce,ee)});return J(Z,ee)&&me.unshift(Z),me}var Ae=null;function ze(){Ae=document.activeElement}function ge(){Ae=null}function Ee(){if(Ae)try{Ae.focus()}catch(Z){}}function rt(Z,ee){if(ee.keyCode===9){var me=M(Z),Ce=me[ee.shiftKey?0:me.length-1],pe=Ce===document.activeElement||Z===document.activeElement;if(pe){var Pe=me[ee.shiftKey?me.length-1:0];Pe.focus(),ee.preventDefault()}}}var qe=A(85108),Fe=A(23073),He=qe.Z.LEFT,we=qe.Z.RIGHT,it=qe.Z.UP,pt=qe.Z.DOWN,Lt=qe.Z.ENTER,Ut=qe.Z.ESC,$t=qe.Z.HOME,vt=qe.Z.END,Bt=[it,pt,He,we];function Ht(Z,ee,me,Ce){var pe,Pe,Le,Tt,Ot="prev",gt="next",Vt="children",Mt="parent";if(Z==="inline"&&Ce===Lt)return{inlineTrigger:!0};var Jt=(pe={},(0,O.Z)(pe,it,Ot),(0,O.Z)(pe,pt,gt),pe),Gt=(Pe={},(0,O.Z)(Pe,He,me?gt:Ot),(0,O.Z)(Pe,we,me?Ot:gt),(0,O.Z)(Pe,pt,Vt),(0,O.Z)(Pe,Lt,Vt),Pe),xt=(Le={},(0,O.Z)(Le,it,Ot),(0,O.Z)(Le,pt,gt),(0,O.Z)(Le,Lt,Vt),(0,O.Z)(Le,Ut,Mt),(0,O.Z)(Le,He,me?Vt:Mt),(0,O.Z)(Le,we,me?Mt:Vt),Le),Si={inline:Jt,horizontal:Gt,vertical:xt,inlineSub:Jt,horizontalSub:xt,verticalSub:xt},ei=(Tt=Si["".concat(Z).concat(ee?"":"Sub")])===null||Tt===void 0?void 0:Tt[Ce];switch(ei){case Ot:return{offset:-1,sibling:!0};case gt:return{offset:1,sibling:!0};case Mt:return{offset:-1,sibling:!1};case Vt:return{offset:1,sibling:!1};default:return null}}function Zt(Z){for(var ee=Z;ee;){if(ee.getAttribute("data-menu-list"))return ee;ee=ee.parentElement}return null}function jt(Z,ee){for(var me=Z||document.activeElement;me;){if(ee.has(me))return me;me=me.parentElement}return null}function R(Z,ee){var me=M(Z,!0);return me.filter(function(Ce){return ee.has(Ce)})}function P(Z,ee,me){var Ce=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Z)return null;var pe=R(Z,ee),Pe=pe.length,Le=pe.findIndex(function(Tt){return me===Tt});return Ce<0?Le===-1?Le=Pe-1:Le-=1:Ce>0&&(Le+=1),Le=(Le+Pe)%Pe,pe[Le]}var x=function(ee,me){var Ce=new Set,pe=new Map,Pe=new Map;return ee.forEach(function(Le){var Tt=document.querySelector("[data-menu-id='".concat(_e(me,Le),"']"));Tt&&(Ce.add(Tt),Pe.set(Tt,Le),pe.set(Le,Tt))}),{elements:Ce,key2element:pe,element2key:Pe}};function L(Z,ee,me,Ce,pe,Pe,Le,Tt,Ot,gt){var Vt=f.useRef(),Mt=f.useRef();Mt.current=ee;var Jt=function(){Fe.Z.cancel(Vt.current)};return f.useEffect(function(){return function(){Jt()}},[]),function(Gt){var xt=Gt.which;if([].concat(Bt,[Lt,Ut,$t,vt]).includes(xt)){var Si=Pe(),ei=x(Si,Ce),Ci=ei,pi=Ci.elements,di=Ci.key2element,oi=Ci.element2key,li=di.get(ee),bi=jt(li,pi),$i=oi.get(bi),_i=Ht(Z,Le($i,!0).length===1,me,xt);if(!_i&&xt!==$t&&xt!==vt)return;(Bt.includes(xt)||[$t,vt].includes(xt))&&Gt.preventDefault();var Kt=function(Ni){if(Ni){var Qi=Ni,fn=Ni.querySelector("a");fn!=null&&fn.getAttribute("href")&&(Qi=fn);var Ti=oi.get(Ni);Tt(Ti),Jt(),Vt.current=(0,Fe.Z)(function(){Mt.current===Ti&&Qi.focus()})}};if([$t,vt].includes(xt)||_i.sibling||!bi){var ot;!bi||Z==="inline"?ot=pe.current:ot=Zt(bi);var Ui,Di=R(ot,pi);xt===$t?Ui=Di[0]:xt===vt?Ui=Di[Di.length-1]:Ui=P(ot,pi,bi,_i.offset),Kt(Ui)}else if(_i.inlineTrigger)Ot($i);else if(_i.offset>0)Ot($i,!0),Jt(),Vt.current=(0,Fe.Z)(function(){ei=x(Si,Ce);var Yi=bi.getAttribute("aria-controls"),Ni=document.getElementById(Yi),Qi=P(Ni,ei.elements);Kt(Qi)},5);else if(_i.offset<0){var Bi=Le($i,!0),Zi=Bi[Bi.length-2],qi=di.get(Zi);Ot(Zi,!1),Kt(qi)}}gt==null||gt(Gt)}}function F(Z){Promise.resolve().then(Z)}var ne="__RC_UTIL_PATH_SPLIT__",I=function(ee){return ee.join(ne)},G=function(ee){return ee.split(ne)},W="rc-menu-more";function w(){var Z=f.useState({}),ee=(0,V.Z)(Z,2),me=ee[1],Ce=(0,f.useRef)(new Map),pe=(0,f.useRef)(new Map),Pe=f.useState([]),Le=(0,V.Z)(Pe,2),Tt=Le[0],Ot=Le[1],gt=(0,f.useRef)(0),Vt=(0,f.useRef)(!1),Mt=function(){Vt.current||me({})},Jt=(0,f.useCallback)(function(di,oi){var li=I(oi);pe.current.set(li,di),Ce.current.set(di,li),gt.current+=1;var bi=gt.current;F(function(){bi===gt.current&&Mt()})},[]),Gt=(0,f.useCallback)(function(di,oi){var li=I(oi);pe.current.delete(li),Ce.current.delete(di)},[]),xt=(0,f.useCallback)(function(di){Ot(di)},[]),Si=(0,f.useCallback)(function(di,oi){var li=Ce.current.get(di)||"",bi=G(li);return oi&&Tt.includes(bi[0])&&bi.unshift(W),bi},[Tt]),ei=(0,f.useCallback)(function(di,oi){return di.some(function(li){var bi=Si(li,!0);return bi.includes(oi)})},[Si]),Ci=function(){var oi=(0,fe.Z)(Ce.current.keys());return Tt.length&&oi.push(W),oi},pi=(0,f.useCallback)(function(di){var oi="".concat(Ce.current.get(di)).concat(ne),li=new Set;return(0,fe.Z)(pe.current.keys()).forEach(function(bi){bi.startsWith(oi)&&li.add(pe.current.get(bi))}),li},[]);return f.useEffect(function(){return function(){Vt.current=!0}},[]),{registerPath:Jt,unregisterPath:Gt,refreshOverflowKeys:xt,isSubPathKey:ei,getKeyPath:Si,getKeys:Ci,getSubPathKeys:pi}}function se(Z){var ee=f.useRef(Z);ee.current=Z;var me=f.useCallback(function(){for(var Ce,pe=arguments.length,Pe=new Array(pe),Le=0;Le<pe;Le++)Pe[Le]=arguments[Le];return(Ce=ee.current)===null||Ce===void 0?void 0:Ce.call.apply(Ce,[ee].concat(Pe))},[]);return Z?me:void 0}var Te=Math.random().toFixed(5).toString().slice(2),We=0;function Qe(Z){var ee=(0,Q.Z)(Z,{value:Z}),me=(0,V.Z)(ee,2),Ce=me[0],pe=me[1];return f.useEffect(function(){We+=1;var Pe="".concat(Te,"-").concat(We);pe("rc-menu-uuid-".concat(Pe))},[]),Ce}var dt=A(79545),Ze=A(68550),ct=A(17928),tt=A(7711),bt=A(64002),wt=A(20475);function ce(Z,ee,me,Ce){var pe=f.useContext(B),Pe=pe.activeKey,Le=pe.onActive,Tt=pe.onInactive,Ot={active:Pe===Z};return ee||(Ot.onMouseEnter=function(gt){me==null||me({key:Z,domEvent:gt}),Le(Z)},Ot.onMouseLeave=function(gt){Ce==null||Ce({key:Z,domEvent:gt}),Tt(Z)}),Ot}function Yt(Z){var ee=f.useContext(B),me=ee.mode,Ce=ee.rtl,pe=ee.inlineIndent;if(me!=="inline")return null;var Pe=Z;return Ce?{paddingRight:Pe*pe}:{paddingLeft:Pe*pe}}function Ct(Z){var ee=Z.icon,me=Z.props,Ce=Z.children,pe;return ee===null||ee===!1?null:(typeof ee=="function"?pe=f.createElement(ee,(0,le.Z)({},me)):typeof ee!="boolean"&&(pe=ee),pe||Ce||null)}var ai=["item"];function je(Z){var ee=Z.item,me=(0,$.Z)(Z,ai);return Object.defineProperty(me,"item",{get:function(){return(0,ve.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),ee}}),me}var vi=["title","attribute","elementRef"],ci=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],gi=["active"],ui=function(Z){(0,ct.Z)(me,Z);var ee=(0,tt.Z)(me);function me(){return(0,dt.Z)(this,me),ee.apply(this,arguments)}return(0,Ze.Z)(me,[{key:"render",value:function(){var pe=this.props,Pe=pe.title,Le=pe.attribute,Tt=pe.elementRef,Ot=(0,$.Z)(pe,vi),gt=(0,bt.Z)(Ot,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,ve.ZP)(!Le,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),f.createElement(ae.Z.Item,(0,C.Z)({},Le,{title:typeof Pe=="string"?Pe:void 0},gt,{ref:Tt}))}}]),me}(f.Component),ft=f.forwardRef(function(Z,ee){var me,Ce=Z.style,pe=Z.className,Pe=Z.eventKey,Le=Z.warnKey,Tt=Z.disabled,Ot=Z.itemIcon,gt=Z.children,Vt=Z.role,Mt=Z.onMouseEnter,Jt=Z.onMouseLeave,Gt=Z.onClick,xt=Z.onKeyDown,Si=Z.onFocus,ei=(0,$.Z)(Z,ci),Ci=Re(Pe),pi=f.useContext(B),di=pi.prefixCls,oi=pi.onItemClick,li=pi.disabled,bi=pi.overflowDisabled,$i=pi.itemIcon,_i=pi.selectedKeys,Kt=pi.onActive,ot=f.useContext(j),Ui=ot._internalRenderMenuItem,Di="".concat(di,"-item"),Bi=f.useRef(),Zi=f.useRef(),qi=li||Tt,Yi=(0,wt.x1)(ee,Zi),Ni=Ke(Pe),Qi=function(Fi){return{key:Pe,keyPath:(0,fe.Z)(Ni).reverse(),item:Bi.current,domEvent:Fi}},fn=Ot||$i,Ti=ce(Pe,qi,Mt,Jt),Ki=Ti.active,In=(0,$.Z)(Ti,gi),mn=_i.includes(Pe),Tn=Yt(Ni.length),nn=function(Fi){if(!qi){var zi=Qi(Fi);Gt==null||Gt(je(zi)),oi(zi)}},ji=function(Fi){if(xt==null||xt(Fi),Fi.which===qe.Z.ENTER){var zi=Qi(Fi);Gt==null||Gt(je(zi)),oi(zi)}},on=function(Fi){Kt(Pe),Si==null||Si(Fi)},En={};Z.role==="option"&&(En["aria-selected"]=mn);var Rn=f.createElement(ui,(0,C.Z)({ref:Bi,elementRef:Yi,role:Vt===null?"none":Vt||"menuitem",tabIndex:Tt?null:-1,"data-menu-id":bi&&Ci?null:Ci},ei,In,En,{component:"li","aria-disabled":Tt,style:(0,le.Z)((0,le.Z)({},Tn),Ce),className:de()(Di,(me={},(0,O.Z)(me,"".concat(Di,"-active"),Ki),(0,O.Z)(me,"".concat(Di,"-selected"),mn),(0,O.Z)(me,"".concat(Di,"-disabled"),qi),me),pe),onClick:nn,onKeyDown:ji,onFocus:on}),gt,f.createElement(Ct,{props:(0,le.Z)((0,le.Z)({},Z),{},{isSelected:mn}),icon:fn}));return Ui&&(Rn=Ui(Rn,Z,{selected:mn})),Rn});function Qt(Z,ee){var me=Z.eventKey,Ce=Y(),pe=Ke(me);return f.useEffect(function(){if(Ce)return Ce.registerPath(me,pe),function(){Ce.unregisterPath(me,pe)}},[pe]),Ce?null:f.createElement(ft,(0,C.Z)({},Z,{ref:ee}))}var st=f.forwardRef(Qt),At=["className","children"],Xt=function(ee,me){var Ce=ee.className,pe=ee.children,Pe=(0,$.Z)(ee,At),Le=f.useContext(B),Tt=Le.prefixCls,Ot=Le.mode,gt=Le.rtl;return f.createElement("ul",(0,C.Z)({className:de()(Tt,gt&&"".concat(Tt,"-rtl"),"".concat(Tt,"-sub"),"".concat(Tt,"-").concat(Ot==="inline"?"inline":"vertical"),Ce),role:"menu"},Pe,{"data-menu-list":!0,ref:me}),pe)},It=f.forwardRef(Xt);It.displayName="SubMenuList";var ii=It,si=A(38298);function hi(Z,ee){return(0,si.Z)(Z).map(function(me,Ce){if(f.isValidElement(me)){var pe,Pe,Le=me.key,Tt=(pe=(Pe=me.props)===null||Pe===void 0?void 0:Pe.eventKey)!==null&&pe!==void 0?pe:Le,Ot=Tt==null;Ot&&(Tt="tmp_key-".concat([].concat((0,fe.Z)(ee),[Ce]).join("-")));var gt={key:Tt,eventKey:Tt};return f.cloneElement(me,gt)}return me})}var Ei=A(35593),ni={adjustX:1,adjustY:1},fi={topLeft:{points:["bl","tl"],overflow:ni},topRight:{points:["br","tr"],overflow:ni},bottomLeft:{points:["tl","bl"],overflow:ni},bottomRight:{points:["tr","br"],overflow:ni},leftTop:{points:["tr","tl"],overflow:ni},leftBottom:{points:["br","bl"],overflow:ni},rightTop:{points:["tl","tr"],overflow:ni},rightBottom:{points:["bl","br"],overflow:ni}},tn={topLeft:{points:["bl","tl"],overflow:ni},topRight:{points:["br","tr"],overflow:ni},bottomLeft:{points:["tl","bl"],overflow:ni},bottomRight:{points:["tr","br"],overflow:ni},rightTop:{points:["tr","tl"],overflow:ni},rightBottom:{points:["br","bl"],overflow:ni},leftTop:{points:["tl","tr"],overflow:ni},leftBottom:{points:["bl","br"],overflow:ni}},Be=null;function l(Z,ee,me){if(ee)return ee;if(me)return me[Z]||me.other}var d={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function g(Z){var ee=Z.prefixCls,me=Z.visible,Ce=Z.children,pe=Z.popup,Pe=Z.popupStyle,Le=Z.popupClassName,Tt=Z.popupOffset,Ot=Z.disabled,gt=Z.mode,Vt=Z.onVisibleChange,Mt=f.useContext(B),Jt=Mt.getPopupContainer,Gt=Mt.rtl,xt=Mt.subMenuOpenDelay,Si=Mt.subMenuCloseDelay,ei=Mt.builtinPlacements,Ci=Mt.triggerSubMenuAction,pi=Mt.forceSubMenuRender,di=Mt.rootClassName,oi=Mt.motion,li=Mt.defaultMotions,bi=f.useState(!1),$i=(0,V.Z)(bi,2),_i=$i[0],Kt=$i[1],ot=Gt?(0,le.Z)((0,le.Z)({},tn),ei):(0,le.Z)((0,le.Z)({},fi),ei),Ui=d[gt],Di=l(gt,oi,li),Bi=f.useRef(Di);gt!=="inline"&&(Bi.current=Di);var Zi=(0,le.Z)((0,le.Z)({},Bi.current),{},{leavedClassName:"".concat(ee,"-hidden"),removeOnLeave:!1,motionAppear:!0}),qi=f.useRef();return f.useEffect(function(){return qi.current=(0,Fe.Z)(function(){Kt(me)}),function(){Fe.Z.cancel(qi.current)}},[me]),f.createElement(Ei.Z,{prefixCls:ee,popupClassName:de()("".concat(ee,"-popup"),(0,O.Z)({},"".concat(ee,"-rtl"),Gt),Le,di),stretch:gt==="horizontal"?"minWidth":null,getPopupContainer:Jt,builtinPlacements:ot,popupPlacement:Ui,popupVisible:_i,popup:pe,popupStyle:Pe,popupAlign:Tt&&{offset:Tt},action:Ot?[]:[Ci],mouseEnterDelay:xt,mouseLeaveDelay:Si,onPopupVisibleChange:Vt,forceRender:pi,popupMotion:Zi,fresh:!0},Ce)}var v=A(43469);function S(Z){var ee=Z.id,me=Z.open,Ce=Z.keyPath,pe=Z.children,Pe="inline",Le=f.useContext(B),Tt=Le.prefixCls,Ot=Le.forceSubMenuRender,gt=Le.motion,Vt=Le.defaultMotions,Mt=Le.mode,Jt=f.useRef(!1);Jt.current=Mt===Pe;var Gt=f.useState(!Jt.current),xt=(0,V.Z)(Gt,2),Si=xt[0],ei=xt[1],Ci=Jt.current?me:!1;f.useEffect(function(){Jt.current&&ei(!1)},[Mt]);var pi=(0,le.Z)({},l(Pe,gt,Vt));Ce.length>1&&(pi.motionAppear=!1);var di=pi.onVisibleChanged;return pi.onVisibleChanged=function(oi){return!Jt.current&&!oi&&ei(!0),di==null?void 0:di(oi)},Si?null:f.createElement(b,{mode:Pe,locked:!Jt.current},f.createElement(v.default,(0,C.Z)({visible:Ci},pi,{forceRender:Ot,removeOnLeave:!1,leavedClassName:"".concat(Tt,"-hidden")}),function(oi){var li=oi.className,bi=oi.style;return f.createElement(ii,{id:ee,className:li,style:bi},pe)}))}var U=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],q=["active"],Ye=function(ee){var me,Ce=ee.style,pe=ee.className,Pe=ee.title,Le=ee.eventKey,Tt=ee.warnKey,Ot=ee.disabled,gt=ee.internalPopupClose,Vt=ee.children,Mt=ee.itemIcon,Jt=ee.expandIcon,Gt=ee.popupClassName,xt=ee.popupOffset,Si=ee.popupStyle,ei=ee.onClick,Ci=ee.onMouseEnter,pi=ee.onMouseLeave,di=ee.onTitleClick,oi=ee.onTitleMouseEnter,li=ee.onTitleMouseLeave,bi=(0,$.Z)(ee,U),$i=Re(Le),_i=f.useContext(B),Kt=_i.prefixCls,ot=_i.mode,Ui=_i.openKeys,Di=_i.disabled,Bi=_i.overflowDisabled,Zi=_i.activeKey,qi=_i.selectedKeys,Yi=_i.itemIcon,Ni=_i.expandIcon,Qi=_i.onItemClick,fn=_i.onOpenChange,Ti=_i.onActive,Ki=f.useContext(j),In=Ki._internalRenderSubMenuItem,mn=f.useContext(Xe),Tn=mn.isSubPathKey,nn=Ke(),ji="".concat(Kt,"-submenu"),on=Di||Ot,En=f.useRef(),Rn=f.useRef(),ln=Mt!=null?Mt:Yi,Fi=Jt!=null?Jt:Ni,zi=Ui.includes(Le),gn=!Bi&&zi,_n=Tn(qi,Le),an=ce(Le,on,oi,li),An=an.active,un=(0,$.Z)(an,q),Ln=f.useState(!1),On=(0,V.Z)(Ln,2),Pn=On[0],jn=On[1],Hn=function(rn){on||jn(rn)},xn=function(rn){Hn(!0),Ci==null||Ci({key:Le,domEvent:rn})},qn=function(rn){Hn(!1),pi==null||pi({key:Le,domEvent:rn})},Fn=f.useMemo(function(){return An||(ot!=="inline"?Pn||Tn([Zi],Le):!1)},[ot,An,Zi,Pn,Le,Tn]),wn=Yt(nn.length),Qn=function(rn){on||(di==null||di({key:Le,domEvent:rn}),ot==="inline"&&fn(Le,!zi))},Mn=se(function(Xi){ei==null||ei(je(Xi)),Qi(Xi)}),Dn=function(rn){ot!=="inline"&&fn(Le,rn)},Bn=function(){Ti(Le)},Ji=$i&&"".concat($i,"-popup"),Sn=f.createElement("div",(0,C.Z)({role:"menuitem",style:wn,className:"".concat(ji,"-title"),tabIndex:on?null:-1,ref:En,title:typeof Pe=="string"?Pe:null,"data-menu-id":Bi&&$i?null:$i,"aria-expanded":gn,"aria-haspopup":!0,"aria-controls":Ji,"aria-disabled":on,onClick:Qn,onFocus:Bn},un),Pe,f.createElement(Ct,{icon:ot!=="horizontal"?Fi:void 0,props:(0,le.Z)((0,le.Z)({},ee),{},{isOpen:gn,isSubMenu:!0})},f.createElement("i",{className:"".concat(ji,"-arrow")}))),Gi=f.useRef(ot);if(ot!=="inline"&&nn.length>1?Gi.current="vertical":Gi.current=ot,!Bi){var cn=Gi.current;Sn=f.createElement(g,{mode:cn,prefixCls:ji,visible:!gt&&gn&&ot!=="inline",popupClassName:Gt,popupOffset:xt,popupStyle:Si,popup:f.createElement(b,{mode:cn==="horizontal"?"vertical":cn},f.createElement(ii,{id:Ji,ref:Rn},Vt)),disabled:on,onVisibleChange:Dn},Sn)}var pn=f.createElement(ae.Z.Item,(0,C.Z)({role:"none"},bi,{component:"li",style:Ce,className:de()(ji,"".concat(ji,"-").concat(ot),pe,(me={},(0,O.Z)(me,"".concat(ji,"-open"),gn),(0,O.Z)(me,"".concat(ji,"-active"),Fn),(0,O.Z)(me,"".concat(ji,"-selected"),_n),(0,O.Z)(me,"".concat(ji,"-disabled"),on),me)),onMouseEnter:xn,onMouseLeave:qn}),Sn,!Bi&&f.createElement(S,{id:Ji,open:gn,keyPath:nn},Vt));return In&&(pn=In(pn,ee,{selected:_n,active:Fn,open:gn,disabled:on})),f.createElement(b,{onItemClick:Mn,mode:ot==="horizontal"?"vertical":ot,itemIcon:ln,expandIcon:Fi},pn)};function $e(Z){var ee=Z.eventKey,me=Z.children,Ce=Ke(ee),pe=hi(me,Ce),Pe=Y();f.useEffect(function(){if(Pe)return Pe.registerPath(ee,Ce),function(){Pe.unregisterPath(ee,Ce)}},[Ce]);var Le;return Pe?Le=pe:Le=f.createElement(Ye,Z,pe),f.createElement(Ne.Provider,{value:Ce},Le)}var lt=A(80665),Pt=["className","title","eventKey","children"],Dt=["children"],Oe=function(ee){var me=ee.className,Ce=ee.title,pe=ee.eventKey,Pe=ee.children,Le=(0,$.Z)(ee,Pt),Tt=f.useContext(B),Ot=Tt.prefixCls,gt="".concat(Ot,"-item-group");return f.createElement("li",(0,C.Z)({role:"presentation"},Le,{onClick:function(Mt){return Mt.stopPropagation()},className:de()(gt,me)}),f.createElement("div",{role:"presentation",className:"".concat(gt,"-title"),title:typeof Ce=="string"?Ce:void 0},Ce),f.createElement("ul",{role:"group",className:"".concat(gt,"-list")},Pe))};function Ft(Z){var ee=Z.children,me=(0,$.Z)(Z,Dt),Ce=Ke(me.eventKey),pe=hi(ee,Ce),Pe=Y();return Pe?pe:f.createElement(Oe,(0,bt.Z)(me,["warnKey"]),pe)}function nt(Z){var ee=Z.className,me=Z.style,Ce=f.useContext(B),pe=Ce.prefixCls,Pe=Y();return Pe?null:f.createElement("li",{role:"separator",className:de()("".concat(pe,"-item-divider"),ee),style:me})}var Ue=["label","children","key","type"];function Ge(Z){return(Z||[]).map(function(ee,me){if(ee&&(0,lt.Z)(ee)==="object"){var Ce=ee,pe=Ce.label,Pe=Ce.children,Le=Ce.key,Tt=Ce.type,Ot=(0,$.Z)(Ce,Ue),gt=Le!=null?Le:"tmp-".concat(me);return Pe||Tt==="group"?Tt==="group"?f.createElement(Ft,(0,C.Z)({key:gt},Ot,{title:pe}),Ge(Pe)):f.createElement($e,(0,C.Z)({key:gt},Ot,{title:pe}),Ge(Pe)):Tt==="divider"?f.createElement(nt,(0,C.Z)({key:gt},Ot)):f.createElement(st,(0,C.Z)({key:gt},Ot),pe)}return null}).filter(function(ee){return ee})}function mt(Z,ee,me){var Ce=Z;return ee&&(Ce=Ge(ee)),hi(Ce,me)}var Rt=["prefixCls","rootClassName","style","className","tabIndex","items","children","direction","id","mode","inlineCollapsed","disabled","disabledOverflow","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","defaultOpenKeys","openKeys","activeKey","defaultActiveFirst","selectable","multiple","defaultSelectedKeys","selectedKeys","onSelect","onDeselect","inlineIndent","motion","defaultMotions","triggerSubMenuAction","builtinPlacements","itemIcon","expandIcon","overflowedIndicator","overflowedIndicatorPopupClassName","getPopupContainer","onClick","onOpenChange","onKeyDown","openAnimation","openTransitionName","_internalRenderMenuItem","_internalRenderSubMenuItem"],Nt=[],wi=f.forwardRef(function(Z,ee){var me,Ce,pe=Z,Pe=pe.prefixCls,Le=Pe===void 0?"rc-menu":Pe,Tt=pe.rootClassName,Ot=pe.style,gt=pe.className,Vt=pe.tabIndex,Mt=Vt===void 0?0:Vt,Jt=pe.items,Gt=pe.children,xt=pe.direction,Si=pe.id,ei=pe.mode,Ci=ei===void 0?"vertical":ei,pi=pe.inlineCollapsed,di=pe.disabled,oi=pe.disabledOverflow,li=pe.subMenuOpenDelay,bi=li===void 0?.1:li,$i=pe.subMenuCloseDelay,_i=$i===void 0?.1:$i,Kt=pe.forceSubMenuRender,ot=pe.defaultOpenKeys,Ui=pe.openKeys,Di=pe.activeKey,Bi=pe.defaultActiveFirst,Zi=pe.selectable,qi=Zi===void 0?!0:Zi,Yi=pe.multiple,Ni=Yi===void 0?!1:Yi,Qi=pe.defaultSelectedKeys,fn=pe.selectedKeys,Ti=pe.onSelect,Ki=pe.onDeselect,In=pe.inlineIndent,mn=In===void 0?24:In,Tn=pe.motion,nn=pe.defaultMotions,ji=pe.triggerSubMenuAction,on=ji===void 0?"hover":ji,En=pe.builtinPlacements,Rn=pe.itemIcon,ln=pe.expandIcon,Fi=pe.overflowedIndicator,zi=Fi===void 0?"...":Fi,gn=pe.overflowedIndicatorPopupClassName,_n=pe.getPopupContainer,an=pe.onClick,An=pe.onOpenChange,un=pe.onKeyDown,Ln=pe.openAnimation,On=pe.openTransitionName,Pn=pe._internalRenderMenuItem,jn=pe._internalRenderSubMenuItem,Hn=(0,$.Z)(pe,Rt),xn=f.useMemo(function(){return mt(Gt,Jt,Nt)},[Gt,Jt]),qn=f.useState(!1),Fn=(0,V.Z)(qn,2),wn=Fn[0],Qn=Fn[1],Mn=f.useRef(),Dn=Qe(Si),Bn=xt==="rtl",Ji=(0,Q.Z)(ot,{value:Ui,postState:function(Li){return Li||Nt}}),Sn=(0,V.Z)(Ji,2),Gi=Sn[0],cn=Sn[1],pn=function(Li){var Mi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Wi(){cn(Li),An==null||An(Li)}Mi?(0,N.flushSync)(Wi):Wi()},Xi=f.useState(Gi),rn=(0,V.Z)(Xi,2),zn=rn[0],sr=rn[1],Nn=f.useRef(!1),dr=f.useMemo(function(){return(Ci==="inline"||Ci==="vertical")&&pi?["vertical",pi]:[Ci,!1]},[Ci,pi]),Wn=(0,V.Z)(dr,2),Zn=Wn[0],St=Wn[1],yt=Zn==="inline",yi=f.useState(Zn),Hi=(0,V.Z)(yi,2),xi=Hi[0],kn=Hi[1],hr=f.useState(St),ar=(0,V.Z)(hr,2),Jn=ar[0],ts=ar[1];f.useEffect(function(){kn(Zn),ts(St),Nn.current&&(yt?cn(zn):pn(Nt))},[Zn,St]);var is=f.useState(0),Fr=(0,V.Z)(is,2),yr=Fr[0],ns=Fr[1],Ir=yr>=xn.length-1||xi!=="horizontal"||oi;f.useEffect(function(){yt&&sr(Gi)},[Gi]),f.useEffect(function(){return Nn.current=!0,function(){Nn.current=!1}},[]);var vn=w(),Mr=vn.registerPath,Br=vn.unregisterPath,$n=vn.refreshOverflowKeys,er=vn.isSubPathKey,rs=vn.getKeyPath,tr=vn.getKeys,ss=vn.getSubPathKeys,Nr=f.useMemo(function(){return{registerPath:Mr,unregisterPath:Br}},[Mr,Br]),as=f.useMemo(function(){return{isSubPathKey:er}},[er]);f.useEffect(function(){$n(Ir?Nt:xn.slice(yr+1).map(function(Vi){return Vi.key}))},[yr,Ir]);var os=(0,Q.Z)(Di||Bi&&((me=xn[0])===null||me===void 0?void 0:me.key),{value:Di}),en=(0,V.Z)(os,2),fr=en[0],or=en[1],lr=se(function(Vi){or(Vi)}),ls=se(function(){or(void 0)});(0,f.useImperativeHandle)(ee,function(){return{list:Mn.current,focus:function(Li){var Mi,Wi=tr(),Cn=x(Wi,Dn),Sr=Cn.elements,Dr=Cn.key2element,fs=Cn.element2key,Gr=R(Mn.current,Sr),br=fr!=null?fr:Gr[0]?fs.get(Gr[0]):(Mi=xn.find(function(kr){return!kr.props.disabled}))===null||Mi===void 0?void 0:Mi.key,mr=Dr.get(br);if(br&&mr){var De;mr==null||(De=mr.focus)===null||De===void 0||De.call(mr,Li)}}}});var Oi=(0,Q.Z)(Qi||[],{value:fn,postState:function(Li){return Array.isArray(Li)?Li:Li==null?Nt:[Li]}}),Er=(0,V.Z)(Oi,2),ir=Er[0],_r=Er[1],us=function(Li){if(qi){var Mi=Li.key,Wi=ir.includes(Mi),Cn;Ni?Wi?Cn=ir.filter(function(Dr){return Dr!==Mi}):Cn=[].concat((0,fe.Z)(ir),[Mi]):Cn=[Mi],_r(Cn);var Sr=(0,le.Z)((0,le.Z)({},Li),{},{selectedKeys:Cn});Wi?Ki==null||Ki(Sr):Ti==null||Ti(Sr)}!Ni&&Gi.length&&xi!=="inline"&&pn(Nt)},cs=se(function(Vi){an==null||an(je(Vi)),us(Vi)}),wr=se(function(Vi,Li){var Mi=Gi.filter(function(Cn){return Cn!==Vi});if(Li)Mi.push(Vi);else if(xi!=="inline"){var Wi=ss(Vi);Mi=Mi.filter(function(Cn){return!Wi.has(Cn)})}(0,ke.Z)(Gi,Mi,!0)||pn(Mi,!0)}),$r=function(Li,Mi){var Wi=Mi!=null?Mi:!Gi.includes(Li);wr(Li,Wi)},ds=L(xi,fr,Bn,Dn,Mn,tr,rs,or,$r,un);f.useEffect(function(){Qn(!0)},[]);var hs=f.useMemo(function(){return{_internalRenderMenuItem:Pn,_internalRenderSubMenuItem:jn}},[Pn,jn]),xr=xi!=="horizontal"||oi?xn:xn.map(function(Vi,Li){return f.createElement(b,{key:Vi.key,overflowDisabled:Li>yr},Vi)}),Ur=f.createElement(ae.Z,(0,C.Z)({id:Si,ref:Mn,prefixCls:"".concat(Le,"-overflow"),component:"ul",itemComponent:st,className:de()(Le,"".concat(Le,"-root"),"".concat(Le,"-").concat(xi),gt,(Ce={},(0,O.Z)(Ce,"".concat(Le,"-inline-collapsed"),Jn),(0,O.Z)(Ce,"".concat(Le,"-rtl"),Bn),Ce),Tt),dir:xt,style:Ot,role:"menu",tabIndex:Mt,data:xr,renderRawItem:function(Li){return Li},renderRawRest:function(Li){var Mi=Li.length,Wi=Mi?xn.slice(-Mi):null;return f.createElement($e,{eventKey:W,title:zi,disabled:Ir,internalPopupClose:Mi===0,popupClassName:gn},Wi)},maxCount:xi!=="horizontal"||oi?ae.Z.INVALIDATE:ae.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Li){ns(Li)},onKeyDown:ds},Hn));return f.createElement(j.Provider,{value:hs},f.createElement(K.Provider,{value:Dn},f.createElement(b,{prefixCls:Le,rootClassName:Tt,mode:xi,openKeys:Gi,rtl:Bn,disabled:di,motion:wn?Tn:null,defaultMotions:wn?nn:null,activeKey:fr,onActive:lr,onInactive:ls,selectedKeys:ir,inlineIndent:mn,subMenuOpenDelay:bi,subMenuCloseDelay:_i,forceSubMenuRender:Kt,builtinPlacements:En,triggerSubMenuAction:on,getPopupContainer:_n,itemIcon:Rn,expandIcon:ln,onItemClick:cs,onOpenChange:wr},f.createElement(Xe.Provider,{value:as},Ur),f.createElement("div",{style:{display:"none"},"aria-hidden":!0},f.createElement(he.Provider,{value:Nr},xn)))))}),Ai=wi,ut=Ai;ut.Item=st,ut.SubMenu=$e,ut.ItemGroup=Ft,ut.Divider=nt;var at=ut},11780:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return ze}});var C=A(5891),O=A(57259),le=A(29043),fe=A(19149),V=A(59301),$=A(92310),ye=A.n($),de=A(29301),ae=A(28800),Q=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],ke=void 0;function ve(ge,Ee){var rt=ge.prefixCls,qe=ge.invalidate,Fe=ge.item,He=ge.renderItem,we=ge.responsive,it=ge.responsiveDisabled,pt=ge.registerSize,Lt=ge.itemKey,Ut=ge.className,$t=ge.style,vt=ge.children,Bt=ge.display,Ht=ge.order,Zt=ge.component,jt=Zt===void 0?"div":Zt,R=(0,fe.Z)(ge,Q),P=we&&!Bt;function x(G){pt(Lt,G)}V.useEffect(function(){return function(){x(null)}},[]);var L=He&&Fe!==ke?He(Fe,{index:Ht}):vt,F;qe||(F={opacity:P?0:1,height:P?0:ke,overflowY:P?"hidden":ke,order:we?Ht:ke,pointerEvents:P?"none":ke,position:P?"absolute":ke});var ne={};P&&(ne["aria-hidden"]=!0);var I=V.createElement(jt,(0,C.Z)({className:ye()(!qe&&rt,Ut),style:(0,O.Z)((0,O.Z)({},F),$t)},ne,R,{ref:Ee}),L);return we&&(I=V.createElement(de.Z,{onResize:function(W){var w=W.offsetWidth;x(w)},disabled:it},I)),I}var f=V.forwardRef(ve);f.displayName="Item";var N=f,K=A(8107),_e=A(4676),Re=A(23073);function H(ge){if(typeof MessageChannel=="undefined")(0,Re.Z)(ge);else{var Ee=new MessageChannel;Ee.port1.onmessage=function(){return ge()},Ee.port2.postMessage(void 0)}}function D(){var ge=V.useRef(null),Ee=function(qe){ge.current||(ge.current=[],H(function(){(0,_e.unstable_batchedUpdates)(function(){ge.current.forEach(function(Fe){Fe()}),ge.current=null})})),ge.current.push(qe)};return Ee}function B(ge,Ee){var rt=V.useState(Ee),qe=(0,le.Z)(rt,2),Fe=qe[0],He=qe[1],we=(0,K.Z)(function(it){ge(function(){He(it)})});return[Fe,we]}var z=V.createContext(null),b=["component"],oe=["className"],he=["className"],Y=function(Ee,rt){var qe=V.useContext(z);if(!qe){var Fe=Ee.component,He=Fe===void 0?"div":Fe,we=(0,fe.Z)(Ee,b);return V.createElement(He,(0,C.Z)({},we,{ref:rt}))}var it=qe.className,pt=(0,fe.Z)(qe,oe),Lt=Ee.className,Ut=(0,fe.Z)(Ee,he);return V.createElement(z.Provider,{value:null},V.createElement(N,(0,C.Z)({ref:rt,className:ye()(it,Lt)},pt,Ut)))},Ne=V.forwardRef(Y);Ne.displayName="RawItem";var Ke=Ne,Xe=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Se="responsive",j="invalidate";function X(ge){return"+ ".concat(ge.length," ...")}function J(ge,Ee){var rt=ge.prefixCls,qe=rt===void 0?"rc-overflow":rt,Fe=ge.data,He=Fe===void 0?[]:Fe,we=ge.renderItem,it=ge.renderRawItem,pt=ge.itemKey,Lt=ge.itemWidth,Ut=Lt===void 0?10:Lt,$t=ge.ssr,vt=ge.style,Bt=ge.className,Ht=ge.maxCount,Zt=ge.renderRest,jt=ge.renderRawRest,R=ge.suffix,P=ge.component,x=P===void 0?"div":P,L=ge.itemComponent,F=ge.onVisibleChange,ne=(0,fe.Z)(ge,Xe),I=$t==="full",G=D(),W=B(G,null),w=(0,le.Z)(W,2),se=w[0],Te=w[1],We=se||0,Qe=B(G,new Map),dt=(0,le.Z)(Qe,2),Ze=dt[0],ct=dt[1],tt=B(G,0),bt=(0,le.Z)(tt,2),wt=bt[0],ce=bt[1],Yt=B(G,0),Ct=(0,le.Z)(Yt,2),ai=Ct[0],je=Ct[1],vi=B(G,0),ci=(0,le.Z)(vi,2),gi=ci[0],ui=ci[1],ft=(0,V.useState)(null),Qt=(0,le.Z)(ft,2),st=Qt[0],At=Qt[1],Xt=(0,V.useState)(null),It=(0,le.Z)(Xt,2),ii=It[0],si=It[1],hi=V.useMemo(function(){return ii===null&&I?Number.MAX_SAFE_INTEGER:ii||0},[ii,se]),Ei=(0,V.useState)(!1),ni=(0,le.Z)(Ei,2),fi=ni[0],tn=ni[1],Be="".concat(qe,"-item"),l=Math.max(wt,ai),d=Ht===Se,g=He.length&&d,v=Ht===j,S=g||typeof Ht=="number"&&He.length>Ht,U=(0,V.useMemo)(function(){var at=He;return g?se===null&&I?at=He:at=He.slice(0,Math.min(He.length,We/Ut)):typeof Ht=="number"&&(at=He.slice(0,Ht)),at},[He,Ut,se,Ht,g]),q=(0,V.useMemo)(function(){return g?He.slice(hi+1):He.slice(U.length)},[He,U,g,hi]),Ye=(0,V.useCallback)(function(at,Z){var ee;return typeof pt=="function"?pt(at):(ee=pt&&(at==null?void 0:at[pt]))!==null&&ee!==void 0?ee:Z},[pt]),$e=(0,V.useCallback)(we||function(at){return at},[we]);function lt(at,Z,ee){ii===at&&(Z===void 0||Z===st)||(si(at),ee||(tn(at<He.length-1),F==null||F(at)),Z!==void 0&&At(Z))}function Pt(at,Z){Te(Z.clientWidth)}function Dt(at,Z){ct(function(ee){var me=new Map(ee);return Z===null?me.delete(at):me.set(at,Z),me})}function Oe(at,Z){je(Z),ce(ai)}function Ft(at,Z){ui(Z)}function nt(at){return Ze.get(Ye(U[at],at))}(0,ae.Z)(function(){if(We&&typeof l=="number"&&U){var at=gi,Z=U.length,ee=Z-1;if(!Z){lt(0,null);return}for(var me=0;me<Z;me+=1){var Ce=nt(me);if(I&&(Ce=Ce||0),Ce===void 0){lt(me-1,void 0,!0);break}if(at+=Ce,ee===0&&at<=We||me===ee-1&&at+nt(ee)<=We){lt(ee,null);break}else if(at+l>We){lt(me-1,at-Ce-gi+ai);break}}R&&nt(0)+gi>We&&At(null)}},[We,Ze,ai,gi,Ye,U]);var Ue=fi&&!!q.length,Ge={};st!==null&&g&&(Ge={position:"absolute",left:st,top:0});var mt={prefixCls:Be,responsive:g,component:L,invalidate:v},Rt=it?function(at,Z){var ee=Ye(at,Z);return V.createElement(z.Provider,{key:ee,value:(0,O.Z)((0,O.Z)({},mt),{},{order:Z,item:at,itemKey:ee,registerSize:Dt,display:Z<=hi})},it(at,Z))}:function(at,Z){var ee=Ye(at,Z);return V.createElement(N,(0,C.Z)({},mt,{order:Z,key:ee,item:at,renderItem:$e,itemKey:ee,registerSize:Dt,display:Z<=hi}))},Nt={order:Ue?hi:Number.MAX_SAFE_INTEGER,className:"".concat(Be,"-rest"),registerSize:Oe,display:Ue},wi=Zt||X,Ai=jt?V.createElement(z.Provider,{value:(0,O.Z)((0,O.Z)({},mt),Nt)},jt(q)):V.createElement(N,(0,C.Z)({},mt,Nt),typeof wi=="function"?wi(q):wi),ut=V.createElement(x,(0,C.Z)({className:ye()(!v&&qe,Bt),style:vt,ref:Ee},ne),U.map(Rt),S?Ai:null,R&&V.createElement(N,(0,C.Z)({},mt,{responsive:d,responsiveDisabled:!g,order:hi,className:"".concat(Be,"-suffix"),registerSize:Ft,display:!0,style:Ge}),R));return d?V.createElement(de.Z,{onResize:Pt,disabled:!g},ut):ut}var M=V.forwardRef(J);M.displayName="Overflow",M.Item=Ke,M.RESPONSIVE=Se,M.INVALIDATE=j;var Ae=M,ze=Ae},29301:function(Wt,Ve,A){"use strict";A.d(Ve,{Z:function(){return j}});var C=A(5891),O=A(59301),le=A(38298),fe=A(51395),V=A(57259),$=A(80665),ye=A(85899),de=A(20475),ae=O.createContext(null);function Q(X){var J=X.children,M=X.onBatchResize,Ae=O.useRef(0),ze=O.useRef([]),ge=O.useContext(ae),Ee=O.useCallback(function(rt,qe,Fe){Ae.current+=1;var He=Ae.current;ze.current.push({size:rt,element:qe,data:Fe}),Promise.resolve().then(function(){He===Ae.current&&(M==null||M(ze.current),ze.current=[])}),ge==null||ge(rt,qe,Fe)},[M,ge]);return O.createElement(ae.Provider,{value:Ee},J)}var ke=A(76374),ve=new Map;function f(X){X.forEach(function(J){var M,Ae=J.target;(M=ve.get(Ae))===null||M===void 0||M.forEach(function(ze){return ze(Ae)})})}var N=new ke.Z(f),K=null,_e=null;function Re(X,J){ve.has(X)||(ve.set(X,new Set),N.observe(X)),ve.get(X).add(J)}function H(X,J){ve.has(X)&&(ve.get(X).delete(J),ve.get(X).size||(N.unobserve(X),ve.delete(X)))}var D=A(79545),B=A(68550),z=A(17928),b=A(7711),oe=function(X){(0,z.Z)(M,X);var J=(0,b.Z)(M);function M(){return(0,D.Z)(this,M),J.apply(this,arguments)}return(0,B.Z)(M,[{key:"render",value:function(){return this.props.children}}]),M}(O.Component);function he(X,J){var M=X.children,Ae=X.disabled,ze=O.useRef(null),ge=O.useRef(null),Ee=O.useContext(ae),rt=typeof M=="function",qe=rt?M(ze):M,Fe=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),He=!rt&&O.isValidElement(qe)&&(0,de.Yr)(qe),we=He?(0,de.C4)(qe):null,it=(0,de.x1)(we,ze),pt=function(){var vt;return(0,ye.ZP)(ze.current)||(ze.current&&(0,$.Z)(ze.current)==="object"?(0,ye.ZP)((vt=ze.current)===null||vt===void 0?void 0:vt.nativeElement):null)||(0,ye.ZP)(ge.current)};O.useImperativeHandle(J,function(){return pt()});var Lt=O.useRef(X);Lt.current=X;var Ut=O.useCallback(function($t){var vt=Lt.current,Bt=vt.onResize,Ht=vt.data,Zt=$t.getBoundingClientRect(),jt=Zt.width,R=Zt.height,P=$t.offsetWidth,x=$t.offsetHeight,L=Math.floor(jt),F=Math.floor(R);if(Fe.current.width!==L||Fe.current.height!==F||Fe.current.offsetWidth!==P||Fe.current.offsetHeight!==x){var ne={width:L,height:F,offsetWidth:P,offsetHeight:x};Fe.current=ne;var I=P===Math.round(jt)?jt:P,G=x===Math.round(R)?R:x,W=(0,V.Z)((0,V.Z)({},ne),{},{offsetWidth:I,offsetHeight:G});Ee==null||Ee(W,$t,Ht),Bt&&Promise.resolve().then(function(){Bt(W,$t)})}},[]);return O.useEffect(function(){var $t=pt();return $t&&!Ae&&Re($t,Ut),function(){return H($t,Ut)}},[ze.current,Ae]),O.createElement(oe,{ref:ge},He?O.cloneElement(qe,{ref:it}):qe)}var Y=O.forwardRef(he),Ne=Y,Ke="rc-observer-key";function Xe(X,J){var M=X.children,Ae=typeof M=="function"?[M]:(0,le.Z)(M);return Ae.map(function(ze,ge){var Ee=(ze==null?void 0:ze.key)||"".concat(Ke,"-").concat(ge);return O.createElement(Ne,(0,C.Z)({},X,{key:Ee,ref:ge===0?J:void 0}),ze)})}var Se=O.forwardRef(Xe);Se.Collection=Q;var j=Se},55477:function(Wt,Ve,A){"use strict";A.d(Ve,{G:function(){return f},Z:function(){return Re}});var C=A(5891),O=A(57259),le=A(19149),fe=A(35593),V=A(59301),$={shiftX:64,adjustY:1},ye={adjustX:1,shiftY:!0},de=[0,0],ae={left:{points:["cr","cl"],overflow:ye,offset:[-4,0],targetOffset:de},right:{points:["cl","cr"],overflow:ye,offset:[4,0],targetOffset:de},top:{points:["bc","tc"],overflow:$,offset:[0,-4],targetOffset:de},bottom:{points:["tc","bc"],overflow:$,offset:[0,4],targetOffset:de},topLeft:{points:["bl","tl"],overflow:$,offset:[0,-4],targetOffset:de},leftTop:{points:["tr","tl"],overflow:ye,offset:[-4,0],targetOffset:de},topRight:{points:["br","tr"],overflow:$,offset:[0,-4],targetOffset:de},rightTop:{points:["tl","tr"],overflow:ye,offset:[4,0],targetOffset:de},bottomRight:{points:["tr","br"],overflow:$,offset:[0,4],targetOffset:de},rightBottom:{points:["bl","br"],overflow:ye,offset:[4,0],targetOffset:de},bottomLeft:{points:["tl","bl"],overflow:$,offset:[0,4],targetOffset:de},leftBottom:{points:["br","bl"],overflow:ye,offset:[-4,0],targetOffset:de}},Q=null,ke=A(92310),ve=A.n(ke);function f(H){var D=H.children,B=H.prefixCls,z=H.id,b=H.overlayInnerStyle,oe=H.className,he=H.style;return V.createElement("div",{className:ve()("".concat(B,"-content"),oe),style:he},V.createElement("div",{className:"".concat(B,"-inner"),id:z,role:"tooltip",style:b},typeof D=="function"?D():D))}var N=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow"],K=function(D,B){var z=D.overlayClassName,b=D.trigger,oe=b===void 0?["hover"]:b,he=D.mouseEnterDelay,Y=he===void 0?0:he,Ne=D.mouseLeaveDelay,Ke=Ne===void 0?.1:Ne,Xe=D.overlayStyle,Se=D.prefixCls,j=Se===void 0?"rc-tooltip":Se,X=D.children,J=D.onVisibleChange,M=D.afterVisibleChange,Ae=D.transitionName,ze=D.animation,ge=D.motion,Ee=D.placement,rt=Ee===void 0?"right":Ee,qe=D.align,Fe=qe===void 0?{}:qe,He=D.destroyTooltipOnHide,we=He===void 0?!1:He,it=D.defaultVisible,pt=D.getTooltipContainer,Lt=D.overlayInnerStyle,Ut=D.arrowContent,$t=D.overlay,vt=D.id,Bt=D.showArrow,Ht=Bt===void 0?!0:Bt,Zt=(0,le.Z)(D,N),jt=(0,V.useRef)(null);(0,V.useImperativeHandle)(B,function(){return jt.current});var R=(0,O.Z)({},Zt);"visible"in D&&(R.popupVisible=D.visible);var P=function(){return V.createElement(f,{key:"content",prefixCls:j,id:vt,overlayInnerStyle:Lt},$t)};return V.createElement(fe.Z,(0,C.Z)({popupClassName:z,prefixCls:j,popup:P,action:oe,builtinPlacements:ae,popupPlacement:rt,ref:jt,popupAlign:Fe,getPopupContainer:pt,onPopupVisibleChange:J,afterPopupVisibleChange:M,popupTransitionName:Ae,popupAnimation:ze,popupMotion:ge,defaultPopupVisible:it,autoDestroy:we,mouseLeaveDelay:Ke,popupStyle:Xe,mouseEnterDelay:Y,arrow:Ht},R),X)},_e=(0,V.forwardRef)(K),Re=_e},93144:function(Wt,Ve){"use strict";Ve.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var A=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(A)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(A==null?void 0:A.substr(0,4))}},83145:function(Wt,Ve,A){"use strict";Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.CopyToClipboard=void 0;var C=le(A(59301)),O=le(A(25769));function le(D){return D&&D.__esModule?D:{default:D}}function fe(D){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fe=function(z){return typeof z}:fe=function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z},fe(D)}function V(D,B){var z=Object.keys(D);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(D);B&&(b=b.filter(function(oe){return Object.getOwnPropertyDescriptor(D,oe).enumerable})),z.push.apply(z,b)}return z}function $(D){for(var B=1;B<arguments.length;B++){var z=arguments[B]!=null?arguments[B]:{};B%2?V(z,!0).forEach(function(b){Re(D,b,z[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(z)):V(z).forEach(function(b){Object.defineProperty(D,b,Object.getOwnPropertyDescriptor(z,b))})}return D}function ye(D,B){if(D==null)return{};var z=de(D,B),b,oe;if(Object.getOwnPropertySymbols){var he=Object.getOwnPropertySymbols(D);for(oe=0;oe<he.length;oe++)b=he[oe],!(B.indexOf(b)>=0)&&Object.prototype.propertyIsEnumerable.call(D,b)&&(z[b]=D[b])}return z}function de(D,B){if(D==null)return{};var z={},b=Object.keys(D),oe,he;for(he=0;he<b.length;he++)oe=b[he],!(B.indexOf(oe)>=0)&&(z[oe]=D[oe]);return z}function ae(D,B){if(!(D instanceof B))throw new TypeError("Cannot call a class as a function")}function Q(D,B){for(var z=0;z<B.length;z++){var b=B[z];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(D,b.key,b)}}function ke(D,B,z){return B&&Q(D.prototype,B),z&&Q(D,z),D}function ve(D,B){return B&&(fe(B)==="object"||typeof B=="function")?B:N(D)}function f(D){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(z){return z.__proto__||Object.getPrototypeOf(z)},f(D)}function N(D){if(D===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function K(D,B){if(typeof B!="function"&&B!==null)throw new TypeError("Super expression must either be null or a function");D.prototype=Object.create(B&&B.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),B&&_e(D,B)}function _e(D,B){return _e=Object.setPrototypeOf||function(b,oe){return b.__proto__=oe,b},_e(D,B)}function Re(D,B,z){return B in D?Object.defineProperty(D,B,{value:z,enumerable:!0,configurable:!0,writable:!0}):D[B]=z,D}var H=function(D){K(B,D);function B(){var z,b;ae(this,B);for(var oe=arguments.length,he=new Array(oe),Y=0;Y<oe;Y++)he[Y]=arguments[Y];return b=ve(this,(z=f(B)).call.apply(z,[this].concat(he))),Re(N(b),"onClick",function(Ne){var Ke=b.props,Xe=Ke.text,Se=Ke.onCopy,j=Ke.children,X=Ke.options,J=C.default.Children.only(j),M=(0,O.default)(Xe,X);Se&&Se(Xe,M),J&&J.props&&typeof J.props.onClick=="function"&&J.props.onClick(Ne)}),b}return ke(B,[{key:"render",value:function(){var b=this.props,oe=b.text,he=b.onCopy,Y=b.options,Ne=b.children,Ke=ye(b,["text","onCopy","options","children"]),Xe=C.default.Children.only(Ne);return C.default.cloneElement(Xe,$({},Ke,{onClick:this.onClick}))}}]),B}(C.default.PureComponent);Ve.CopyToClipboard=H,Re(H,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Wt,Ve,A){"use strict";var C=A(83145),O=C.CopyToClipboard;O.CopyToClipboard=O,Wt.exports=O},76374:function(Wt,Ve,A){"use strict";var C=function(){if(typeof Map!="undefined")return Map;function j(X,J){var M=-1;return X.some(function(Ae,ze){return Ae[0]===J?(M=ze,!0):!1}),M}return function(){function X(){this.__entries__=[]}return Object.defineProperty(X.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),X.prototype.get=function(J){var M=j(this.__entries__,J),Ae=this.__entries__[M];return Ae&&Ae[1]},X.prototype.set=function(J,M){var Ae=j(this.__entries__,J);~Ae?this.__entries__[Ae][1]=M:this.__entries__.push([J,M])},X.prototype.delete=function(J){var M=this.__entries__,Ae=j(M,J);~Ae&&M.splice(Ae,1)},X.prototype.has=function(J){return!!~j(this.__entries__,J)},X.prototype.clear=function(){this.__entries__.splice(0)},X.prototype.forEach=function(J,M){M===void 0&&(M=null);for(var Ae=0,ze=this.__entries__;Ae<ze.length;Ae++){var ge=ze[Ae];J.call(M,ge[1],ge[0])}},X}()}(),O=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,le=function(){return typeof A.g!="undefined"&&A.g.Math===Math?A.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),fe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(le):function(j){return setTimeout(function(){return j(Date.now())},1e3/60)}}(),V=2;function $(j,X){var J=!1,M=!1,Ae=0;function ze(){J&&(J=!1,j()),M&&Ee()}function ge(){fe(ze)}function Ee(){var rt=Date.now();if(J){if(rt-Ae<V)return;M=!0}else J=!0,M=!1,setTimeout(ge,X);Ae=rt}return Ee}var ye=20,de=["top","right","bottom","left","width","height","size","weight"],ae=typeof MutationObserver!="undefined",Q=function(){function j(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=$(this.refresh.bind(this),ye)}return j.prototype.addObserver=function(X){~this.observers_.indexOf(X)||this.observers_.push(X),this.connected_||this.connect_()},j.prototype.removeObserver=function(X){var J=this.observers_,M=J.indexOf(X);~M&&J.splice(M,1),!J.length&&this.connected_&&this.disconnect_()},j.prototype.refresh=function(){var X=this.updateObservers_();X&&this.refresh()},j.prototype.updateObservers_=function(){var X=this.observers_.filter(function(J){return J.gatherActive(),J.hasActive()});return X.forEach(function(J){return J.broadcastActive()}),X.length>0},j.prototype.connect_=function(){!O||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),ae?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},j.prototype.disconnect_=function(){!O||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},j.prototype.onTransitionEnd_=function(X){var J=X.propertyName,M=J===void 0?"":J,Ae=de.some(function(ze){return!!~M.indexOf(ze)});Ae&&this.refresh()},j.getInstance=function(){return this.instance_||(this.instance_=new j),this.instance_},j.instance_=null,j}(),ke=function(j,X){for(var J=0,M=Object.keys(X);J<M.length;J++){var Ae=M[J];Object.defineProperty(j,Ae,{value:X[Ae],enumerable:!1,writable:!1,configurable:!0})}return j},ve=function(j){var X=j&&j.ownerDocument&&j.ownerDocument.defaultView;return X||le},f=oe(0,0,0,0);function N(j){return parseFloat(j)||0}function K(j){for(var X=[],J=1;J<arguments.length;J++)X[J-1]=arguments[J];return X.reduce(function(M,Ae){var ze=j["border-"+Ae+"-width"];return M+N(ze)},0)}function _e(j){for(var X=["top","right","bottom","left"],J={},M=0,Ae=X;M<Ae.length;M++){var ze=Ae[M],ge=j["padding-"+ze];J[ze]=N(ge)}return J}function Re(j){var X=j.getBBox();return oe(0,0,X.width,X.height)}function H(j){var X=j.clientWidth,J=j.clientHeight;if(!X&&!J)return f;var M=ve(j).getComputedStyle(j),Ae=_e(M),ze=Ae.left+Ae.right,ge=Ae.top+Ae.bottom,Ee=N(M.width),rt=N(M.height);if(M.boxSizing==="border-box"&&(Math.round(Ee+ze)!==X&&(Ee-=K(M,"left","right")+ze),Math.round(rt+ge)!==J&&(rt-=K(M,"top","bottom")+ge)),!B(j)){var qe=Math.round(Ee+ze)-X,Fe=Math.round(rt+ge)-J;Math.abs(qe)!==1&&(Ee-=qe),Math.abs(Fe)!==1&&(rt-=Fe)}return oe(Ae.left,Ae.top,Ee,rt)}var D=function(){return typeof SVGGraphicsElement!="undefined"?function(j){return j instanceof ve(j).SVGGraphicsElement}:function(j){return j instanceof ve(j).SVGElement&&typeof j.getBBox=="function"}}();function B(j){return j===ve(j).document.documentElement}function z(j){return O?D(j)?Re(j):H(j):f}function b(j){var X=j.x,J=j.y,M=j.width,Ae=j.height,ze=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,ge=Object.create(ze.prototype);return ke(ge,{x:X,y:J,width:M,height:Ae,top:J,right:X+M,bottom:Ae+J,left:X}),ge}function oe(j,X,J,M){return{x:j,y:X,width:J,height:M}}var he=function(){function j(X){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=oe(0,0,0,0),this.target=X}return j.prototype.isActive=function(){var X=z(this.target);return this.contentRect_=X,X.width!==this.broadcastWidth||X.height!==this.broadcastHeight},j.prototype.broadcastRect=function(){var X=this.contentRect_;return this.broadcastWidth=X.width,this.broadcastHeight=X.height,X},j}(),Y=function(){function j(X,J){var M=b(J);ke(this,{target:X,contentRect:M})}return j}(),Ne=function(){function j(X,J,M){if(this.activeObservations_=[],this.observations_=new C,typeof X!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=X,this.controller_=J,this.callbackCtx_=M}return j.prototype.observe=function(X){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(X instanceof ve(X).Element))throw new TypeError('parameter 1 is not of type "Element".');var J=this.observations_;J.has(X)||(J.set(X,new he(X)),this.controller_.addObserver(this),this.controller_.refresh())}},j.prototype.unobserve=function(X){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(X instanceof ve(X).Element))throw new TypeError('parameter 1 is not of type "Element".');var J=this.observations_;J.has(X)&&(J.delete(X),J.size||this.controller_.removeObserver(this))}},j.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},j.prototype.gatherActive=function(){var X=this;this.clearActive(),this.observations_.forEach(function(J){J.isActive()&&X.activeObservations_.push(J)})},j.prototype.broadcastActive=function(){if(this.hasActive()){var X=this.callbackCtx_,J=this.activeObservations_.map(function(M){return new Y(M.target,M.broadcastRect())});this.callback_.call(X,J,X),this.clearActive()}},j.prototype.clearActive=function(){this.activeObservations_.splice(0)},j.prototype.hasActive=function(){return this.activeObservations_.length>0},j}(),Ke=typeof WeakMap!="undefined"?new WeakMap:new C,Xe=function(){function j(X){if(!(this instanceof j))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var J=Q.getInstance(),M=new Ne(X,J,this);Ke.set(this,M)}return j}();["observe","unobserve","disconnect"].forEach(function(j){Xe.prototype[j]=function(){var X;return(X=Ke.get(this))[j].apply(X,arguments)}});var Se=function(){return typeof le.ResizeObserver!="undefined"?le.ResizeObserver:Xe}();Ve.Z=Se},98040:function(Wt){Wt.exports=function(){var Ve=document.getSelection();if(!Ve.rangeCount)return function(){};for(var A=document.activeElement,C=[],O=0;O<Ve.rangeCount;O++)C.push(Ve.getRangeAt(O));switch(A.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":A.blur();break;default:A=null;break}return Ve.removeAllRanges(),function(){Ve.type==="Caret"&&Ve.removeAllRanges(),Ve.rangeCount||C.forEach(function(le){Ve.addRange(le)}),A&&A.focus()}}},82059:function(Wt){var Ve=arguments[3],A=arguments[4],C=arguments[5],O=JSON.stringify;Wt.exports=function(le,fe){for(var V,$=Object.keys(C),ye=0,de=$.length;ye<de;ye++){var ae=$[ye],Q=C[ae].exports;if(Q===le||Q&&Q.default===le){V=ae;break}}if(!V){V=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var ke={},ye=0,de=$.length;ye<de;ye++){var ae=$[ye];ke[ae]=ae}A[V]=["function(require,module,exports){"+le+"(self); }",ke]}var ve=Math.floor(Math.pow(16,8)*Math.random()).toString(16),f={};f[V]=V,A[ve]=["function(require,module,exports){var f = require("+O(V)+");(f.default ? f.default : f)(self);}",f];var N={};K(ve);function K(z){N[z]=!0;for(var b in A[z][1]){var oe=A[z][1][b];N[oe]||K(oe)}}var _e="("+Ve+")({"+Object.keys(N).map(function(z){return O(z)+":["+A[z][0]+","+O(A[z][1])+"]"}).join(",")+"},{},["+O(ve)+"])",Re=window.URL||window.webkitURL||window.mozURL||window.msURL,H=new Blob([_e],{type:"text/javascript"});if(fe&&fe.bare)return H;var D=Re.createObjectURL(H),B=new Worker(D);return B.objectURL=D,B}},37312:function(Wt,Ve,A){"use strict";A.d(Ve,{ZP:function(){return vr}});function C(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var O={exports:{}};(function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(u,c,h){if(h=h||{},u=u.trim(),c=c.trim(),!c){if(!h.alwaysNormalize)return u;var m=o.parseURL(u);if(!m)throw new Error("Error trying to parse base URL.");return m.path=o.normalizePath(m.path),o.buildURLFromParts(m)}var p=o.parseURL(c);if(!p)throw new Error("Error trying to parse relative URL.");if(p.scheme)return h.alwaysNormalize?(p.path=o.normalizePath(p.path),o.buildURLFromParts(p)):c;var E=o.parseURL(u);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var y=n.exec(E.path);E.netLoc=y[1],E.path=y[2]}E.netLoc&&!E.path&&(E.path="/");var _={scheme:E.scheme,netLoc:p.netLoc,path:null,params:p.params,query:p.query,fragment:p.fragment};if(!p.netLoc&&(_.netLoc=E.netLoc,p.path[0]!=="/"))if(!p.path)_.path=E.path,p.params||(_.params=E.params,p.query||(_.query=E.query));else{var T=E.path,k=T.substring(0,T.lastIndexOf("/")+1)+p.path;_.path=o.normalizePath(k)}return _.path===null&&(_.path=h.alwaysNormalize?o.normalizePath(p.path):p.path),o.buildURLFromParts(_)},parseURL:function(u){var c=i.exec(u);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(u){for(u=u.split("").reverse().join("").replace(r,"");u.length!==(u=u.replace(s,"")).length;);return u.split("").reverse().join("")},buildURLFromParts:function(u){return u.scheme+u.netLoc+u.path+u.params+u.query+u.fragment}};a.exports=o})()})(O);var le=O.exports;function fe(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(a);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(a,n).enumerable})),t.push.apply(t,i)}return t}function V(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fe(Object(t),!0).forEach(function(i){de(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):fe(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function $(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var i=t.call(a,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function ye(a){var e=$(a,"string");return typeof e=="symbol"?e:String(e)}function de(a,e,t){return e=ye(e),e in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function ae(){return ae=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(a[i]=t[i])}return a},ae.apply(this,arguments)}const Q=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},ke=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=ve},ve=Number.MAX_SAFE_INTEGER||9007199254740991;let f=function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a}({}),N=function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a}({}),K=function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.UNKNOWN="unknown",a}({});const _e=function(){},Re={trace:_e,debug:_e,log:_e,warn:_e,info:_e,error:_e};let H=Re;function D(a){const e=self.console[a];return e?e.bind(self.console,`[${a}] >`):_e}function B(a,...e){e.forEach(function(t){H[t]=a[t]?a[t].bind(a):D(t)})}function z(a,e){if(typeof console=="object"&&a===!0||typeof a=="object"){B(a,"debug","log","info","warn","error");try{H.log(`Debug logs enabled for "${e}" in hls.js version 1.5.19`)}catch(t){H=Re}}else H=Re}const b=H,oe=/^(\d+)x(\d+)$/,he=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Y{constructor(e){typeof e=="string"&&(e=Y.parseAttrList(e)),ae(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let n=0;n<t.length/2;n++)i[n]=parseInt(t.slice(n*2,n*2+2),16);return i}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=oe.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},n='"';for(he.lastIndex=0;(t=he.exec(e))!==null;){let r=t[2];r.indexOf(n)===0&&r.lastIndexOf(n)===r.length-1&&(r=r.slice(1,-1));const s=t[1].trim();i[s]=r}return i}}function Ne(a){return a!=="ID"&&a!=="CLASS"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Ke(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"}class Xe{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const n in i)if(Object.prototype.hasOwnProperty.call(e,n)&&e[n]!==i[n]){b.warn(`DATERANGE tag attribute: "${n}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=n;break}e=ae(new Y({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);Q(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(Q(e))return e}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 isValid(){return!!this.id&&!this._badValueForSameId&&Q(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Se{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 j={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class X{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[j.AUDIO]:null,[j.VIDEO]:null,[j.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let n;i.length===1?n=(t==null?void 0:t.byteRangeEndOffset)||0:n=parseInt(i[1]),this._byteRange=[n,parseInt(i[0])+n]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=le.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class J extends X{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=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.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Se,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!Q(this.programDateTime))return null;const e=Q(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,n,r,s=!1){const{elementaryStreams:o}=this,u=o[e];if(!u){o[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:r,partial:s};return}u.startPTS=Math.min(u.startPTS,t),u.endPTS=Math.max(u.endPTS,i),u.startDTS=Math.min(u.startDTS,n),u.endDTS=Math.max(u.endDTS,r)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[j.AUDIO]=null,e[j.VIDEO]=null,e[j.AUDIOVIDEO]=null}}class M extends X{constructor(e,t,i,n,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Se,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const s=e.enumeratedString("BYTERANGE");s&&this.setByteRange(s,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const Ae=10;class ze{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 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.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?Q(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Ae}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function ge(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Ee(a){const e=Fe(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function rt(a){const e=function(i,n,r){const s=i[n];i[n]=i[r],i[r]=s};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function qe(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),n=i[i.length-1].split(",");if(n.length===2){const r=n[0]==="base64",s=n[1];r?(i.splice(-1,1),t=ge(s)):t=Ee(s)}}return t}function Fe(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}const He=typeof self!="undefined"?self:void 0;var we={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},it={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function pt(a){switch(a){case it.FAIRPLAY:return we.FAIRPLAY;case it.PLAYREADY:return we.PLAYREADY;case it.WIDEVINE:return we.WIDEVINE;case it.CLEARKEY:return we.CLEARKEY}}var Lt={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",FAIRPLAY:"94ce86fb07ff4f43adb893d2fa968ca2",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function Ut(a){if(a===Lt.WIDEVINE)return we.WIDEVINE;if(a===Lt.PLAYREADY)return we.PLAYREADY;if(a===Lt.CENC||a===Lt.CLEARKEY)return we.CLEARKEY}function $t(a){switch(a){case we.FAIRPLAY:return it.FAIRPLAY;case we.PLAYREADY:return it.PLAYREADY;case we.WIDEVINE:return it.WIDEVINE;case we.CLEARKEY:return it.CLEARKEY}}function vt(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[we.FAIRPLAY,we.WIDEVINE,we.PLAYREADY,we.CLEARKEY].filter(n=>!!e[n]):[];return!i[we.WIDEVINE]&&t&&i.push(we.WIDEVINE),i}const Bt=function(a){return He!=null&&(a=He.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Ht(a,e,t,i){let n;switch(a){case we.FAIRPLAY:n=["cenc","sinf"];break;case we.WIDEVINE:case we.PLAYREADY:n=["cenc"];break;case we.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return Zt(n,e,t,i)}function Zt(a,e,t,i){return[{initDataTypes:a,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs="${r}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs="${r}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function jt(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),s=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(s){const o=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(o){const u=ge(o).subarray(0,16);return rt(u),u}}return null}function R(a,e,t){return Uint8Array.prototype.slice?a.slice(e,t):new Uint8Array(Array.prototype.slice.call(a,e,t))}const P=(a,e)=>e+10<=a.length&&a[e]===73&&a[e+1]===68&&a[e+2]===51&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128,x=(a,e)=>e+10<=a.length&&a[e]===51&&a[e+1]===68&&a[e+2]===73&&a[e+3]<255&&a[e+4]<255&&a[e+6]<128&&a[e+7]<128&&a[e+8]<128&&a[e+9]<128,L=(a,e)=>{const t=e;let i=0;for(;P(a,e);){i+=10;const n=F(a,e+6);i+=n,x(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)},F=(a,e)=>{let t=0;return t=(a[e]&127)<<21,t|=(a[e+1]&127)<<14,t|=(a[e+2]&127)<<7,t|=a[e+3]&127,t},ne=(a,e)=>P(a,e)&&F(a,e+6)+10<=a.length-e,I=a=>{const e=w(a);for(let t=0;t<e.length;t++){const i=e[t];if(G(i))return dt(i)}},G=a=>a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp",W=a=>{const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=F(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}},w=a=>{let e=0;const t=[];for(;P(a,e);){const i=F(a,e+6);e+=10;const n=e+i;for(;e+8<n;){const r=W(a.subarray(e)),s=se(r);s&&t.push(s),e+=r.size+10}x(a,e)&&(e+=10)}return t},se=a=>a.type==="PRIV"?Te(a):a.type[0]==="W"?Qe(a):We(a),Te=a=>{if(a.size<2)return;const e=Ze(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}},We=a=>{if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=Ze(a.data.subarray(t),!0);t+=i.length+1;const n=Ze(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=Ze(a.data.subarray(1));return{key:a.type,data:e}},Qe=a=>{if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=Ze(a.data.subarray(t),!0);t+=i.length+1;const n=Ze(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=Ze(a.data);return{key:a.type,data:e}},dt=a=>{if(a.data.byteLength===8){const e=new Uint8Array(a.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}},Ze=(a,e=!1)=>{const t=tt();if(t){const c=t.decode(a);if(e){const h=c.indexOf("\0");return h!==-1?c.substring(0,h):c}return c.replace(/\0/g,"")}const i=a.length;let n,r,s,o="",u=0;for(;u<i;){if(n=a[u++],n===0&&e)return o;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(n);break;case 12:case 13:r=a[u++],o+=String.fromCharCode((n&31)<<6|r&63);break;case 14:r=a[u++],s=a[u++],o+=String.fromCharCode((n&15)<<12|(r&63)<<6|(s&63)<<0);break}}return o};let ct;function tt(){if(!navigator.userAgent.includes("PlayStation 4"))return!ct&&typeof self.TextDecoder!="undefined"&&(ct=new self.TextDecoder("utf-8")),ct}const bt={hexDump:function(a){let e="";for(let t=0;t<a.length;t++){let i=a[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},wt=Math.pow(2,32)-1,ce=[].push,Yt={video:1,audio:2,id3:3,text:4};function Ct(a){return String.fromCharCode.apply(null,a)}function ai(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function je(a,e){const t=ci(a,e);return t<0?4294967296+t:t}function vi(a,e){let t=je(a,e);return t*=Math.pow(2,32),t+=je(a,e+4),t}function ci(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function gi(a,e,t){a[e]=t>>24,a[e+1]=t>>16&255,a[e+2]=t>>8&255,a[e+3]=t&255}function ui(a){const e=a.byteLength;for(let t=0;t<e;){const i=je(a,t);if(i>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ft(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const r=je(a,n),s=Ct(a.subarray(n+4,n+8)),o=r>1?n+r:i;if(s===e[0])if(e.length===1)t.push(a.subarray(n+8,o));else{const u=ft(a.subarray(n+8,o),e.slice(1));u.length&&ce.apply(t,u)}n=o}return t}function Qt(a){const e=[],t=a[0];let i=8;const n=je(a,i);i+=4;let r=0,s=0;t===0?(r=je(a,i),s=je(a,i+4),i+=8):(r=vi(a,i),s=vi(a,i+8),i+=16),i+=2;let o=a.length+s;const u=ai(a,i);i+=2;for(let c=0;c<u;c++){let h=i;const m=je(a,h);h+=4;const p=m&2147483647;if((m&2147483648)>>>31===1)return b.warn("SIDX has hierarchical references (not supported)"),null;const y=je(a,h);h+=4,e.push({referenceSize:p,subsegmentDuration:y,info:{duration:y/n,start:o,end:o+p-1}}),o+=p,h+=4,i=h}return{earliestPresentationTime:r,timescale:n,version:t,referencesCount:u,references:e}}function st(a){const e=[],t=ft(a,["moov","trak"]);for(let n=0;n<t.length;n++){const r=t[n],s=ft(r,["tkhd"])[0];if(s){let o=s[0];const u=je(s,o===0?12:20),c=ft(r,["mdia","mdhd"])[0];if(c){o=c[0];const h=je(c,o===0?12:20),m=ft(r,["mdia","hdlr"])[0];if(m){const p=Ct(m.subarray(8,12)),E={soun:j.AUDIO,vide:j.VIDEO}[p];if(E){const y=ft(r,["mdia","minf","stbl","stsd"])[0],_=At(y);e[u]={timescale:h,type:E},e[E]=V({timescale:h,id:u},_)}}}}}return ft(a,["moov","mvex","trex"]).forEach(n=>{const r=je(n,4),s=e[r];s&&(s.default={duration:je(n,12),flags:je(n,20)})}),e}function At(a){const e=a.subarray(8),t=e.subarray(86),i=Ct(e.subarray(4,8));let n=i;const r=i==="enca"||i==="encv";if(r){const o=ft(e,[i])[0].subarray(i==="enca"?28:78);ft(o,["sinf"]).forEach(c=>{const h=ft(c,["schm"])[0];if(h){const m=Ct(h.subarray(4,8));if(m==="cbcs"||m==="cenc"){const p=ft(c,["frma"])[0];p&&(n=Ct(p))}}})}switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const s=ft(t,["avcC"])[0];n+="."+It(s[1])+It(s[2])+It(s[3]);break}case"mp4a":{const s=ft(e,[i])[0],o=ft(s.subarray(28),["esds"])[0];if(o&&o.length>12){let u=4;if(o[u++]!==3)break;u=Xt(o,u),u+=2;const c=o[u++];if(c&128&&(u+=2),c&64&&(u+=o[u++]),o[u++]!==4)break;u=Xt(o,u);const h=o[u++];if(h===64)n+="."+It(h);else break;if(u+=12,o[u++]!==5)break;u=Xt(o,u);const m=o[u++];let p=(m&248)>>3;p===31&&(p+=1+((m&7)<<3)+((o[u]&224)>>5)),n+="."+p}break}case"hvc1":case"hev1":{const s=ft(t,["hvcC"])[0],o=s[1],u=["","A","B","C"][o>>6],c=o&31,h=je(s,2),m=(o&32)>>5?"H":"L",p=s[12],E=s.subarray(6,12);n+="."+u+c,n+="."+h.toString(16).toUpperCase(),n+="."+m+p;let y="";for(let _=E.length;_--;){const T=E[_];(T||y)&&(y="."+T.toString(16).toUpperCase()+y)}n+=y;break}case"dvh1":case"dvhe":{const s=ft(t,["dvcC"])[0],o=s[2]>>1&127,u=s[2]<<5&32|s[3]>>3&31;n+="."+ii(o)+"."+ii(u);break}case"vp09":{const s=ft(t,["vpcC"])[0],o=s[4],u=s[5],c=s[6]>>4&15;n+="."+ii(o)+"."+ii(u)+"."+ii(c);break}case"av01":{const s=ft(t,["av1C"])[0],o=s[1]>>>5,u=s[1]&31,c=s[2]>>>7?"H":"M",h=(s[2]&64)>>6,m=(s[2]&32)>>5,p=o===2&&h?m?12:10:h?10:8,E=(s[2]&16)>>4,y=(s[2]&8)>>3,_=(s[2]&4)>>2,T=s[2]&3;n+="."+o+"."+ii(u)+c+"."+ii(p)+"."+E+"."+y+_+T+"."+ii(1)+"."+ii(1)+"."+ii(1)+"."+0;break}}return{codec:n,encrypted:r}}function Xt(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function It(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function ii(a){return(a<10?"0":"")+a}function si(a,e){if(!a||!e)return a;const t=e.keyId;return t&&e.isCommonEncryption&&ft(a,["moov","trak"]).forEach(n=>{const s=ft(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=ft(s,["enca"]);const u=o.length>0;u||(o=ft(s,["encv"])),o.forEach(c=>{const h=u?c.subarray(28):c.subarray(78);ft(h,["sinf"]).forEach(p=>{const E=hi(p);if(E){const y=E.subarray(8,24);y.some(_=>_!==0)||(b.log(`[eme] Patching keyId in 'enc${u?"a":"v"}>sinf>>tenc' box: ${bt.hexDump(y)} -> ${bt.hexDump(t)}`),E.set(t,8))}})})}),a}function hi(a){const e=ft(a,["schm"])[0];if(e){const t=Ct(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ft(a,["schi","tenc"])[0]}return null}function Ei(a,e){return ft(e,["moof","traf"]).reduce((t,i)=>{const n=ft(i,["tfdt"])[0],r=n[0],s=ft(i,["tfhd"]).reduce((o,u)=>{const c=je(u,4),h=a[c];if(h){let m=je(n,4);if(r===1){if(m===wt)return b.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;m*=wt+1,m+=je(n,8)}const p=h.timescale||9e4,E=m/p;if(Q(E)&&(o===null||E<o))return E}return o},null);return s!==null&&Q(s)&&(t===null||s<t)?s:t},null)}function ni(a,e){let t=0,i=0,n=0;const r=ft(a,["moof","traf"]);for(let s=0;s<r.length;s++){const o=r[s],u=ft(o,["tfhd"])[0],c=je(u,4),h=e[c];if(!h)continue;const m=h.default,p=je(u,0)|(m==null?void 0:m.flags);let E=m==null?void 0:m.duration;p&8&&(p&2?E=je(u,12):E=je(u,8));const y=h.timescale||9e4,_=ft(o,["trun"]);for(let T=0;T<_.length;T++){if(t=fi(_[T]),!t&&E){const k=je(_[T],4);t=E*k}h.type===j.VIDEO?i+=t/y:h.type===j.AUDIO&&(n+=t/y)}}if(i===0&&n===0){let s=1/0,o=0,u=0;const c=ft(a,["sidx"]);for(let h=0;h<c.length;h++){const m=Qt(c[h]);if(m!=null&&m.references){s=Math.min(s,m.earliestPresentationTime/m.timescale);const p=m.references.reduce((E,y)=>E+y.info.duration||0,0);o=Math.max(o,p+m.earliestPresentationTime/m.timescale),u=o-s}}if(u&&Q(u))return u}return i||n}function fi(a){const e=je(a,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const n=je(a,4);for(let r=0;r<n;r++){if(e&256){const s=je(a,t);i+=s,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function tn(a,e,t){ft(e,["moof","traf"]).forEach(i=>{ft(i,["tfhd"]).forEach(n=>{const r=je(n,4),s=a[r];if(!s)return;const o=s.timescale||9e4;ft(i,["tfdt"]).forEach(u=>{const c=u[0],h=t*o;if(h){let m=je(u,4);if(c===0)m-=h,m=Math.max(m,0),gi(u,4,m);else{m*=Math.pow(2,32),m+=je(u,8),m-=h,m=Math.max(m,0);const p=Math.floor(m/(wt+1)),E=Math.floor(m%(wt+1));gi(u,4,p),gi(u,8,E)}}})})})}function Be(a){const e={valid:null,remainder:null},t=ft(a,["moof"]);if(t.length<2)return e.remainder=a,e;const i=t[t.length-1];return e.valid=R(a,0,i.byteOffset-8),e.remainder=R(a,i.byteOffset-8),e}function l(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function d(a,e){const t=[],i=e.samples,n=e.timescale,r=e.id;let s=!1;return ft(i,["moof"]).map(u=>{const c=u.byteOffset-8;ft(u,["traf"]).map(m=>{const p=ft(m,["tfdt"]).map(E=>{const y=E[0];let _=je(E,4);return y===1&&(_*=Math.pow(2,32),_+=je(E,8)),_/n})[0];return p!==void 0&&(a=p),ft(m,["tfhd"]).map(E=>{const y=je(E,4),_=je(E,0)&16777215,T=(_&1)!==0,k=(_&2)!==0,te=(_&8)!==0;let ie=0;const be=(_&16)!==0;let re=0;const Me=(_&32)!==0;let xe=8;y===r&&(T&&(xe+=8),k&&(xe+=4),te&&(ie=je(E,xe),xe+=4),be&&(re=je(E,xe),xe+=4),Me&&(xe+=4),e.type==="video"&&(s=g(e.codec)),ft(m,["trun"]).map(Je=>{const ht=Je[0],Ie=je(Je,0)&16777215,et=(Ie&1)!==0;let ri=0;const Et=(Ie&4)!==0,ti=(Ie&256)!==0;let qt=0;const zt=(Ie&512)!==0;let Ri=0;const Pi=(Ie&1024)!==0,kt=(Ie&2048)!==0;let _t=0;const Ii=je(Je,4);let mi=8;et&&(ri=je(Je,mi),mi+=4),Et&&(mi+=4);let ki=ri+c;for(let sn=0;sn<Ii;sn++){if(ti?(qt=je(Je,mi),mi+=4):qt=ie,zt?(Ri=je(Je,mi),mi+=4):Ri=re,Pi&&(mi+=4),kt&&(ht===0?_t=je(Je,mi):_t=ci(Je,mi),mi+=4),e.type===j.VIDEO){let hn=0;for(;hn<Ri;){const yn=je(i,ki);if(ki+=4,v(s,i[ki])){const Kn=i.subarray(ki,ki+yn);S(Kn,s?2:1,a+_t/n,t)}ki+=yn,hn+=yn+4}}a+=qt/n}}))})})}),t}function g(a){if(!a)return!1;const e=a.indexOf("."),t=e<0?a:a.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function v(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function S(a,e,t,i){const n=U(a);let r=0;r+=e;let s=0,o=0,u=0;for(;r<n.length;){s=0;do{if(r>=n.length)break;u=n[r++],s+=u}while(u===255);o=0;do{if(r>=n.length)break;u=n[r++],o+=u}while(u===255);const c=n.length-r;let h=r;if(o<c)r+=o;else if(o>c){b.error(`Malformed SEI payload. ${o} is too small, only ${c} bytes left to parse.`);break}if(s===4){if(n[h++]===181){const p=ai(n,h);if(h+=2,p===49){const E=je(n,h);if(h+=4,E===1195456820){const y=n[h++];if(y===3){const _=n[h++],T=31&_,k=64&_,te=k?2+T*3:0,ie=new Uint8Array(te);if(k){ie[0]=_;for(let be=1;be<te;be++)ie[be]=n[h++]}i.push({type:y,payloadType:s,pts:t,bytes:ie})}}}}}else if(s===5&&o>16){const m=[];for(let y=0;y<16;y++){const _=n[h++].toString(16);m.push(_.length==1?"0"+_:_),(y===3||y===5||y===7||y===9)&&m.push("-")}const p=o-16,E=new Uint8Array(p);for(let y=0;y<p;y++)E[y]=n[h++];i.push({payloadType:s,pts:t,uuid:m.join(""),userData:Ze(E),userDataBytes:E})}}}function U(a){const e=a.byteLength,t=[];let i=1;for(;i<e-2;)a[i]===0&&a[i+1]===0&&a[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return a;const n=e-t.length,r=new Uint8Array(n);let s=0;for(i=0;i<n;s++,i++)s===t[0]&&(s++,t.shift()),r[i]=a[s];return r}function q(a){const e=a[0];let t="",i="",n=0,r=0,s=0,o=0,u=0,c=0;if(e===0){for(;Ct(a.subarray(c,c+1))!=="\0";)t+=Ct(a.subarray(c,c+1)),c+=1;for(t+=Ct(a.subarray(c,c+1)),c+=1;Ct(a.subarray(c,c+1))!=="\0";)i+=Ct(a.subarray(c,c+1)),c+=1;i+=Ct(a.subarray(c,c+1)),c+=1,n=je(a,12),r=je(a,16),o=je(a,20),u=je(a,24),c=28}else if(e===1){c+=4,n=je(a,c),c+=4;const m=je(a,c);c+=4;const p=je(a,c);for(c+=4,s=Za(2,32)*m+p,ke(s)||(s=Number.MAX_SAFE_INTEGER,b.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=je(a,c),c+=4,u=je(a,c),c+=4;Ct(a.subarray(c,c+1))!=="\0";)t+=Ct(a.subarray(c,c+1)),c+=1;for(t+=Ct(a.subarray(c,c+1)),c+=1;Ct(a.subarray(c,c+1))!=="\0";)i+=Ct(a.subarray(c,c+1)),c+=1;i+=Ct(a.subarray(c,c+1)),c+=1}const h=a.subarray(c,a.byteLength);return{schemeIdUri:t,value:i,timeScale:n,presentationTime:s,presentationTimeDelta:r,eventDuration:o,id:u,payload:h}}function Ye(a,...e){const t=e.length;let i=8,n=t;for(;n--;)i+=e[n].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(a,4),n=0,i=8;n<t;n++)r.set(e[n],i),i+=e[n].byteLength;return r}function $e(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let i,n;if(e){i=1,n=new Uint8Array(e.length*16);for(let o=0;o<e.length;o++){const u=e[o];if(u.byteLength!==16)throw new RangeError("Invalid key");n.set(u,o*16)}}else i=0,n=new Uint8Array;let r;i>0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const s=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(s.buffer).setUint32(0,t.byteLength,!1),Ye([112,115,115,104],new Uint8Array([i,0,0,0]),a,r,n,s,t||new Uint8Array)}function lt(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let i=0;for(;i+32<t;){const n=new DataView(a,i),r=Pt(n);e.push(r),i+=r.size}}return e}function Pt(a){const e=a.getUint32(0),t=a.byteOffset,i=a.byteLength;if(i<e)return{offset:t,size:i};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const r=a.getUint32(8)>>>24;if(r!==0&&r!==1)return{offset:t,size:e};const s=a.buffer,o=bt.hexDump(new Uint8Array(s,t+12,16)),u=a.getUint32(28);let c=null,h=null;if(r===0){if(e-32<u||u<22)return{offset:t,size:e};h=new Uint8Array(s,t+32,u)}else if(r===1){if(!u||i<t+32+u*16+16)return{offset:t,size:e};c=[];for(let m=0;m<u;m++)c.push(new Uint8Array(s,t+32+m*16,16))}return{version:r,systemId:o,kids:c,data:h,offset:t,size:e}}let Dt={};class Oe{static clearKeyUriToKeyIdMap(){Dt={}}constructor(e,t,i,n=[1],r=null){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=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=n,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case it.FAIRPLAY:case it.WIDEVINE:case it.PLAYREADY:case it.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&b.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=Ft(e);return new Oe(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=qe(this.uri);if(t)switch(this.keyFormat){case it.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case it.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=$e(i,null,t),this.keyId=jt(t);break}default:{let i=t.subarray(0,16);if(i.length!==16){const n=new Uint8Array(16);n.set(i,16-i.length),i=n}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=Dt[this.uri];if(!i){const n=Object.keys(Dt).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),Dt[this.uri]=i}this.keyId=i}return this}}function Ft(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const nt=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ue(a){return nt.test(a)}function Ge(a,e,t){if(a.variableList!==null||a.hasVariableRefs)for(let i=t.length;i--;){const n=t[i],r=e[n];r&&(e[n]=mt(a,r))}}function mt(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(nt,i=>{const n=i.substring(2,i.length-1),r=t==null?void 0:t[n];return r===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),i):r})}return e}function Rt(a,e,t){let i=a.variableList;i||(a.variableList=i={});let n,r;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const s=new self.URL(t).searchParams;if(s.has(n))r=s.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(s){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${s.message}`))}}else n=e.NAME,r=e.VALUE;n in i?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):i[n]=r||""}function Nt(a,e,t){const i=e.IMPORT;if(t&&i in t){let n=a.variableList;n||(a.variableList=n={}),n[i]=t[i]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function wi(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Ai(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}const ut={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,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 at(a,e){const t=ut[e];return!!t&&!!t[a.slice(0,4)]}function Z(a,e,t=!0){return!a.split(",").some(i=>!ee(i,e,t))}function ee(a,e,t=!0){var i;const n=wi(t);return(i=n==null?void 0:n.isTypeSupported(me(a,e)))!=null?i:!1}function me(a,e){return`${e}/mp4;codecs="${a}"`}function Ce(a){if(a){const e=a.substring(0,4);return ut.video[e]}return 2}function pe(a){return a.split(",").reduce((e,t)=>{const i=ut.video[t];return i?(i*2+e)/(e?3:2):(ut.audio[t]+e)/(e?2:1)},0)}const Pe={};function Le(a,e=!0){if(Pe[a])return Pe[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[a];for(let i=0;i<t.length;i++)if(ee(t[i],"audio",e))return Pe[a]=t[i],t[i];return a}const Tt=/flac|opus/i;function Ot(a,e=!0){return a.replace(Tt,t=>Le(t.toLowerCase(),e))}function gt(a,e){return a&&a!=="mp4a"?a:e&&e.split(",")[0]}function Vt(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");if(i.length>2){let n=i.shift()+".";n+=parseInt(i.shift()).toString(16),n+=("000"+parseInt(i.shift()).toString(16)).slice(-4),e[t]=n}}return e.join(",")}const Mt=/#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,Jt=/#EXT-X-MEDIA:(.*)/g,Gt=/^#EXT(?:INF|-X-TARGETDURATION):/m,xt=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Si=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(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 ei{static findGroup(e,t){for(let i=0;i<e.length;i++){const n=e[i];if(n.id===t)return n}}static resolve(e,t){return le.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Gt.test(e)}static parseMasterPlaylist(e,t){const i=Ue(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},r=[];Mt.lastIndex=0;let s;for(;(s=Mt.exec(e))!=null;)if(s[1]){var o;const c=new Y(s[1]);Ge(n,c,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const h=mt(n,s[2]),m={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:ei.resolve(h,t)},p=c.decimalResolution("RESOLUTION");p&&(m.width=p.width,m.height=p.height),di(c.CODECS,m),(o=m.unknownCodecs)!=null&&o.length||r.push(m),n.levels.push(m)}else if(s[3]){const c=s[3],h=s[4];switch(c){case"SESSION-DATA":{const m=new Y(h);Ge(n,m,["DATA-ID","LANGUAGE","VALUE","URI"]);const p=m["DATA-ID"];p&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[p]=m);break}case"SESSION-KEY":{const m=Ci(h,t,n);m.encrypted&&m.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(m)):b.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${h}"`);break}case"DEFINE":{{const m=new Y(h);Ge(n,m,["NAME","VALUE","QUERYPARAM"]),Rt(n,m,t)}break}case"CONTENT-STEERING":{const m=new Y(h);Ge(n,m,["SERVER-URI","PATHWAY-ID"]),n.contentSteering={uri:ei.resolve(m["SERVER-URI"],t),pathwayId:m["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=pi(h);break}}}const u=r.length>0&&r.length<n.levels.length;return n.levels=u?r:n.levels,n.levels.length===0&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(e,t,i){let n;const r={},s=i.levels,o={AUDIO:s.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:s.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let u=0;for(Jt.lastIndex=0;(n=Jt.exec(e))!==null;){const c=new Y(n[1]),h=c.TYPE;if(h){const m=o[h],p=r[h]||[];r[h]=p,Ge(i,c,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const E=c.LANGUAGE,y=c["ASSOC-LANGUAGE"],_=c.CHANNELS,T=c.CHARACTERISTICS,k=c["INSTREAM-ID"],te={attrs:c,bitrate:0,id:u++,groupId:c["GROUP-ID"]||"",name:c.NAME||E||"",type:h,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:E,url:c.URI?ei.resolve(c.URI,t):""};if(y&&(te.assocLang=y),_&&(te.channels=_),T&&(te.characteristics=T),k&&(te.instreamId=k),m!=null&&m.length){const ie=ei.findGroup(m,te.groupId)||m[0];oi(te,ie,"audioCodec"),oi(te,ie,"textCodec")}p.push(te)}}return r}static parseLevelPlaylist(e,t,i,n,r,s){const o=new ze(t),u=o.fragments;let c=null,h=0,m=0,p=0,E=0,y=null,_=new J(n,t),T,k,te,ie=-1,be=!1,re=null;for(xt.lastIndex=0,o.m3u8=e,o.hasVariableRefs=Ue(e);(T=xt.exec(e))!==null;){be&&(be=!1,_=new J(n,t),_.start=p,_.sn=h,_.cc=E,_.level=i,c&&(_.initSegment=c,_.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,re&&(_.setByteRange(re),re=null)));const ht=T[1];if(ht){_.duration=parseFloat(ht);const Ie=(" "+T[2]).slice(1);_.title=Ie||null,_.tagList.push(Ie?["INF",ht,Ie]:["INF",ht])}else if(T[3]){if(Q(_.duration)){_.start=p,te&&_i(_,te,o),_.sn=h,_.level=i,_.cc=E,u.push(_);const Ie=(" "+T[3]).slice(1);_.relurl=mt(o,Ie),bi(_,y),y=_,p+=_.duration,h++,m=0,be=!0}}else if(T[4]){const Ie=(" "+T[4]).slice(1);y?_.setByteRange(Ie,y):_.setByteRange(Ie)}else if(T[5])_.rawProgramDateTime=(" "+T[5]).slice(1),_.tagList.push(["PROGRAM-DATE-TIME",_.rawProgramDateTime]),ie===-1&&(ie=u.length);else{if(T=T[0].match(Si),!T){b.warn("No matches on slow regex match for level playlist!");continue}for(k=1;k<T.length&&typeof T[k]=="undefined";k++);const Ie=(" "+T[k]).slice(1),et=(" "+T[k+1]).slice(1),ri=T[k+2]?(" "+T[k+2]).slice(1):"";switch(Ie){case"PLAYLIST-TYPE":o.type=et.toUpperCase();break;case"MEDIA-SEQUENCE":h=o.startSN=parseInt(et);break;case"SKIP":{const Et=new Y(et);Ge(o,Et,["RECENTLY-REMOVED-DATERANGES"]);const ti=Et.decimalInteger("SKIPPED-SEGMENTS");if(Q(ti)){o.skippedSegments=ti;for(let zt=ti;zt--;)u.unshift(null);h+=ti}const qt=Et.enumeratedString("RECENTLY-REMOVED-DATERANGES");qt&&(o.recentlyRemovedDateranges=qt.split(" "));break}case"TARGETDURATION":o.targetduration=Math.max(parseInt(et),1);break;case"VERSION":o.version=parseInt(et);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":(et||ri)&&_.tagList.push(ri?[et,ri]:[et]);break;case"DISCONTINUITY":E++,_.tagList.push(["DIS"]);break;case"GAP":_.gap=!0,_.tagList.push([Ie]);break;case"BITRATE":_.tagList.push([Ie,et]);break;case"DATERANGE":{const Et=new Y(et);Ge(o,Et,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),Ge(o,Et,Et.clientAttrs);const ti=new Xe(Et,o.dateRanges[Et.ID]);ti.isValid||o.skippedSegments?o.dateRanges[ti.id]=ti:b.warn(`Ignoring invalid DATERANGE tag: "${et}"`),_.tagList.push(["EXT-X-DATERANGE",et]);break}case"DEFINE":{{const Et=new Y(et);Ge(o,Et,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in Et?Nt(o,Et,s):Rt(o,Et,t)}break}case"DISCONTINUITY-SEQUENCE":E=parseInt(et);break;case"KEY":{const Et=Ci(et,t,o);if(Et.isSupported()){if(Et.method==="NONE"){te=void 0;break}te||(te={}),te[Et.keyFormat]&&(te=ae({},te)),te[Et.keyFormat]=Et}else b.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${et}"`);break}case"START":o.startTimeOffset=pi(et);break;case"MAP":{const Et=new Y(et);if(Ge(o,Et,["BYTERANGE","URI"]),_.duration){const ti=new J(n,t);$i(ti,Et,i,te),c=ti,_.initSegment=c,c.rawProgramDateTime&&!_.rawProgramDateTime&&(_.rawProgramDateTime=c.rawProgramDateTime)}else{const ti=_.byteRangeEndOffset;if(ti){const qt=_.byteRangeStartOffset;re=`${ti-qt}@${qt}`}else re=null;$i(_,Et,i,te),c=_,be=!0}break}case"SERVER-CONTROL":{const Et=new Y(et);o.canBlockReload=Et.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=Et.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&Et.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=Et.optionalFloat("PART-HOLD-BACK",0),o.holdBack=Et.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const Et=new Y(et);o.partTarget=Et.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Et=o.partList;Et||(Et=o.partList=[]);const ti=m>0?Et[Et.length-1]:void 0,qt=m++,zt=new Y(et);Ge(o,zt,["BYTERANGE","URI"]);const Ri=new M(zt,_,t,qt,ti);Et.push(Ri),_.duration+=Ri.duration;break}case"PRELOAD-HINT":{const Et=new Y(et);Ge(o,Et,["URI"]),o.preloadHint=Et;break}case"RENDITION-REPORT":{const Et=new Y(et);Ge(o,Et,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(Et);break}default:b.warn(`line parsed but not handled: ${T}`);break}}}y&&!y.relurl?(u.pop(),p-=y.duration,o.partList&&(o.fragmentHint=y)):o.partList&&(bi(_,y),_.cc=E,o.fragmentHint=_,te&&_i(_,te,o));const Me=u.length,xe=u[0],Je=u[Me-1];if(p+=o.skippedSegments*o.targetduration,p>0&&Me&&Je){o.averagetargetduration=p/Me;const ht=Je.sn;o.endSN=ht!=="initSegment"?ht:0,o.live||(Je.endList=!0),xe&&(o.startCC=xe.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(p+=o.fragmentHint.duration),o.totalduration=p,o.endCC=E,ie>0&&li(u,ie),o}}function Ci(a,e,t){var i,n;const r=new Y(a);Ge(t,r,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const s=(i=r.METHOD)!=null?i:"",o=r.URI,u=r.hexadecimalInteger("IV"),c=r.KEYFORMATVERSIONS,h=(n=r.KEYFORMAT)!=null?n:"identity";o&&r.IV&&!u&&b.error(`Invalid IV: ${r.IV}`);const m=o?ei.resolve(o,e):"",p=(c||"1").split("/").map(Number).filter(Number.isFinite);return new Oe(s,m,h,p,u)}function pi(a){const t=new Y(a).decimalFloatingPoint("TIME-OFFSET");return Q(t)?t:null}function di(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(r=>at(r,i));n.length&&(e[`${i}Codec`]=n.join(","),t=t.filter(r=>n.indexOf(r)===-1))}),e.unknownCodecs=t}function oi(a,e,t){const i=e[t];i&&(a[t]=i)}function li(a,e){let t=a[e];for(let i=e;i--;){const n=a[i];if(!n)return;n.programDateTime=t.programDateTime-n.duration*1e3,t=n}}function bi(a,e){a.rawProgramDateTime?a.programDateTime=Date.parse(a.rawProgramDateTime):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime),Q(a.programDateTime)||(a.programDateTime=null,a.rawProgramDateTime=null)}function $i(a,e,t,i){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",i&&(a.levelkeys=i),a.initSegment=null}function _i(a,e,t){a.levelkeys=e;const{encryptedFragments:i}=t;(!i.length||i[i.length-1].levelkeys!==e)&&Object.keys(e).some(n=>e[n].isCommonEncryption)&&i.push(a)}var Kt={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ot={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function Ui(a){const{type:e}=a;switch(e){case Kt.AUDIO_TRACK:return ot.AUDIO;case Kt.SUBTITLE_TRACK:return ot.SUBTITLE;default:return ot.MAIN}}function Di(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Bi{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_LOADING,this.onLevelLoading,this),e.on(f.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(f.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_LOADING,this.onLevelLoading,this),e.off(f.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(f.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,r=i||n,s=new r(t);return this.loaders[e.type]=s,s}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Kt.MANIFEST,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:r,url:s,deliveryDirectives:o}=t;this.load({id:i,level:n,pathwayId:r,responseType:"text",type:Kt.LEVEL,url:s,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:r,deliveryDirectives:s}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:Kt.AUDIO_TRACK,url:r,deliveryDirectives:s})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:r,deliveryDirectives:s}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:Kt.SUBTITLE_TRACK,url:r,deliveryDirectives:s})}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const c=n.context;if(c&&c.url===e.url&&c.level===e.level){b.trace("[playlist-loader]: playlist request ongoing");return}b.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let r;if(e.type===Kt.MANIFEST?r=i.manifestLoadPolicy.default:r=ae({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),Q((t=e.deliveryDirectives)==null?void 0:t.part)){let c;if(e.type===Kt.LEVEL&&e.level!==null?c=this.hls.levels[e.level].details:e.type===Kt.AUDIO_TRACK&&e.id!==null?c=this.hls.audioTracks[e.id].details:e.type===Kt.SUBTITLE_TRACK&&e.id!==null&&(c=this.hls.subtitleTracks[e.id].details),c){const h=c.partTarget,m=c.targetduration;if(h&&m){const p=Math.max(h*3,m*.8)*1e3;r=ae({},r,{maxTimeToFirstByteMs:Math.min(p,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(p,r.maxTimeToFirstByteMs)})}}}const s=r.errorRetry||r.timeoutRetry||{},o={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0},u={onSuccess:(c,h,m,p)=>{const E=this.getInternalLoader(m);this.resetInternalLoader(m.type);const y=c.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(c,m,new Error("no EXTM3U delimiter"),p||null,h);return}h.parsing.start=performance.now(),ei.isMediaPlaylist(y)?this.handleTrackOrLevelPlaylist(c,h,m,p||null,E):this.handleMasterPlaylist(c,h,m,p)},onError:(c,h,m,p)=>{this.handleNetworkError(h,m,!1,c,p)},onTimeout:(c,h,m)=>{this.handleNetworkError(h,m,!0,void 0,c)}};n.load(e,o,u)}handleMasterPlaylist(e,t,i,n){const r=this.hls,s=e.data,o=Di(e,i),u=ei.parseMasterPlaylist(s,o);if(u.playlistParsingError){this.handleManifestParsingError(e,i,u.playlistParsingError,n,t);return}const{contentSteering:c,levels:h,sessionData:m,sessionKeys:p,startTimeOffset:E,variableList:y}=u;this.variableList=y;const{AUDIO:_=[],SUBTITLES:T,"CLOSED-CAPTIONS":k}=ei.parseMasterPlaylistMedia(s,o,u);_.length&&!_.some(ie=>!ie.url)&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(b.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Y({}),bitrate:0,url:""})),r.trigger(f.MANIFEST_LOADED,{levels:h,audioTracks:_,subtitles:T,captions:k,contentSteering:c,url:o,stats:t,networkDetails:n,sessionData:m,sessionKeys:p,startTimeOffset:E,variableList:y})}handleTrackOrLevelPlaylist(e,t,i,n,r){const s=this.hls,{id:o,level:u,type:c}=i,h=Di(e,i),m=0,p=Q(u)?u:Q(o)?o:0,E=Ui(i),y=ei.parseLevelPlaylist(e.data,h,p,E,m,this.variableList);if(c===Kt.MANIFEST){const _={attrs:new Y({}),bitrate:0,details:y,name:"",url:h};s.trigger(f.MANIFEST_LOADED,{levels:[_],audioTracks:[],url:h,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=y,this.handlePlaylistLoaded(y,e,t,i,n,r)}handleManifestParsingError(e,t,i,n,r){this.hls.trigger(f.ERROR,{type:N.NETWORK_ERROR,details:K.MANIFEST_PARSING_ERROR,fatal:t.type===Kt.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:r})}handleNetworkError(e,t,i=!1,n,r){let s=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===Kt.LEVEL?s+=`: ${e.level} id: ${e.id}`:(e.type===Kt.AUDIO_TRACK||e.type===Kt.SUBTITLE_TRACK)&&(s+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(s);b.warn(`[playlist-loader]: ${s}`);let u=K.UNKNOWN,c=!1;const h=this.getInternalLoader(e);switch(e.type){case Kt.MANIFEST:u=i?K.MANIFEST_LOAD_TIMEOUT:K.MANIFEST_LOAD_ERROR,c=!0;break;case Kt.LEVEL:u=i?K.LEVEL_LOAD_TIMEOUT:K.LEVEL_LOAD_ERROR,c=!1;break;case Kt.AUDIO_TRACK:u=i?K.AUDIO_TRACK_LOAD_TIMEOUT:K.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case Kt.SUBTITLE_TRACK:u=i?K.SUBTITLE_TRACK_LOAD_TIMEOUT:K.SUBTITLE_LOAD_ERROR,c=!1;break}h&&this.resetInternalLoader(e.type);const m={type:N.NETWORK_ERROR,details:u,fatal:c,url:e.url,loader:h,context:e,error:o,networkDetails:t,stats:r};if(n){const p=(t==null?void 0:t.url)||e.url;m.response=V({url:p,data:void 0},n)}this.hls.trigger(f.ERROR,m)}handlePlaylistLoaded(e,t,i,n,r,s){const o=this.hls,{type:u,level:c,id:h,groupId:m,deliveryDirectives:p}=n,E=Di(t,n),y=Ui(n),_=typeof n.level=="number"&&y===ot.MAIN?c:void 0;if(!e.fragments.length){const k=new Error("No Segments found in Playlist");o.trigger(f.ERROR,{type:N.NETWORK_ERROR,details:K.LEVEL_EMPTY_ERROR,fatal:!1,url:E,error:k,reason:k.message,response:t,context:n,level:_,parent:y,networkDetails:r,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const T=e.playlistParsingError;if(T){o.trigger(f.ERROR,{type:N.NETWORK_ERROR,details:K.LEVEL_PARSING_ERROR,fatal:!1,url:E,error:T,reason:T.message,response:t,context:n,level:_,parent:y,networkDetails:r,stats:i});return}switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),(!s.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),u){case Kt.MANIFEST:case Kt.LEVEL:o.trigger(f.LEVEL_LOADED,{details:e,level:_||0,id:h||0,stats:i,networkDetails:r,deliveryDirectives:p});break;case Kt.AUDIO_TRACK:o.trigger(f.AUDIO_TRACK_LOADED,{details:e,id:h||0,groupId:m||"",stats:i,networkDetails:r,deliveryDirectives:p});break;case Kt.SUBTITLE_TRACK:o.trigger(f.SUBTITLE_TRACK_LOADED,{details:e,id:h||0,groupId:m||"",stats:i,networkDetails:r,deliveryDirectives:p});break}}}function Zi(a,e){let t;try{t=new Event("addtrack")}catch(i){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function qi(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(e.id))try{if(a.addCue(e),!a.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(i){b.debug(`[texttrack-utils]: ${i}`);try{const n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,a.addCue(n)}catch(n){b.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function Yi(a){const e=a.mode;if(e==="disabled"&&(a.mode="hidden"),a.cues)for(let t=a.cues.length;t--;)a.removeCue(a.cues[t]);e==="disabled"&&(a.mode=e)}function Ni(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const r=fn(a.cues,e,t);for(let s=0;s<r.length;s++)(!i||i(r[s]))&&a.removeCue(r[s])}n==="disabled"&&(a.mode=n)}function Qi(a,e){if(e<a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let i=0,n=t;for(;i<=n;){const r=Math.floor((n+i)/2);if(e<a[r].startTime)n=r-1;else if(e>a[r].startTime&&i<t)i=r+1;else return r}return a[i].startTime-e<e-a[n].startTime?i:n}function fn(a,e,t){const i=[],n=Qi(a,e);if(n>-1)for(let r=n,s=a.length;r<s;r++){const o=a[r];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function Ti(a){const e=[];for(let t=0;t<a.length;t++){const i=a[t];(i.kind==="subtitles"||i.kind==="captions")&&i.label&&e.push(a[t])}return e}var Ki={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const In=.25;function mn(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Tn(a,e,t,i,n){let r=new a(e,t,"");try{r.value=i,n&&(r.type=n)}catch(s){r=new a(e,t,JSON.stringify(n?V({type:n},i):i))}return r}const nn=(()=>{const a=mn();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function ji(a,e){return a.getTime()/1e3-e}function on(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class En{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(f.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(f.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Yi(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return Zi(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:i,enableID3MetadataCues:n}}}=this;if(!i&&!n)return;const{samples:r}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=mn();if(s)for(let o=0;o<r.length;o++){const u=r[o].type;if(u===Ki.emsg&&!i||!n)continue;const c=w(r[o].data);if(c){const h=r[o].pts;let m=h+r[o].duration;m>nn&&(m=nn),m-h<=0&&(m=h+In);for(let E=0;E<c.length;E++){const y=c[E];if(!G(y)){this.updateId3CueEnds(h,u);const _=Tn(s,h,m,y,u);_&&this.id3Track.addCue(_)}}}}}updateId3CueEnds(e,t){var i;const n=(i=this.id3Track)==null?void 0:i.cues;if(n)for(let r=n.length;r--;){const s=n[r];s.type===t&&s.startTime<e&&s.endTime===nn&&(s.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:r,hls:s}=this;if(!s)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:u}}=s;if(r&&(o||u)){let c;n==="audio"?c=h=>h.type===Ki.audioId3&&u:n==="video"?c=h=>h.type===Ki.emsg&&o:c=h=>h.type===Ki.audioId3&&u||h.type===Ki.emsg&&o,Ni(r,t,i,c)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:n}=this,{dateRanges:r}=t,s=Object.keys(r);if(n){const h=Object.keys(i).filter(m=>!s.includes(m));for(let m=h.length;m--;){const p=h[m];Object.keys(i[p].cues).forEach(E=>{n.removeCue(i[p].cues[E])}),delete i[p]}}const o=t.fragments[t.fragments.length-1];if(s.length===0||!Q(o==null?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const u=o.programDateTime/1e3-o.start,c=mn();for(let h=0;h<s.length;h++){const m=s[h],p=r[m],E=ji(p.startDate,u),y=i[m],_=(y==null?void 0:y.cues)||{};let T=(y==null?void 0:y.durationKnown)||!1,k=nn;const te=p.endDate;if(te)k=ji(te,u),T=!0;else if(p.endOnNext&&!T){const be=s.reduce((re,Me)=>{if(Me!==p.id){const xe=r[Me];if(xe.class===p.class&&xe.startDate>p.startDate&&(!re||p.startDate<re.startDate))return xe}return re},null);be&&(k=ji(be.startDate,u),T=!0)}const ie=Object.keys(p.attr);for(let be=0;be<ie.length;be++){const re=ie[be];if(!Ne(re))continue;const Me=_[re];if(Me)T&&!y.durationKnown&&(Me.endTime=k);else if(c){let xe=p.attr[re];Ke(re)&&(xe=on(xe));const Je=Tn(c,E,k,{key:re,data:xe},Ki.dateRange);Je&&(Je.id=m,this.id3Track.addCue(Je),_[re]=Je)}}i[m]={cues:_,dateRange:p,durationKnown:T}}}}class Rn{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:r,liveSyncDurationCount:s,lowLatencyMode:o}=this.config,u=this.hls.userConfig;let c=o&&i||t;(u.liveSyncDuration||u.liveSyncDurationCount||c===0)&&(c=r!==void 0?r:s*n);const h=n;return c+Math.min(this.stallCount*1,h)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(e===null||t===null||i===null)return null;const n=i.edge,r=e-t-this.edgeStalled,s=n-i.totalduration,o=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(s,r),o)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(f.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(f.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(f.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(f.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(f.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(f.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===K.BUFFER_STALLED_ERROR&&(this.stallCount++,(i=this.levelDetails)!=null&&i.live&&b.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(i===null)return;this._latency=i;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:r}=this.config;if(!n||r===1||!t.live)return;const s=this.targetLatency;if(s===null)return;const o=i-s,u=Math.min(this.maxLatency,s+t.targetduration);if(o<u&&o>.05&&this.forwardBufferLength>1){const h=Math.min(2,Math.max(1,r)),m=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(h,Math.max(1,m))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const ln=["NONE","TYPE-0","TYPE-1",null];function Fi(a){return ln.indexOf(a)>-1}const zi=["SDR","PQ","HLG"];function gn(a){return!!a&&zi.indexOf(a)>-1}var _n={No:"",Yes:"YES",v2:"v2"};function an(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?_n.v2:_n.Yes:_n.No}class An{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class un{constructor(e){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.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Ln(this._audioGroups,e)}hasSubtitleGroup(e){return Ln(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let i=this._audioGroups;i||(i=this._audioGroups=[]),i.indexOf(t)===-1&&i.push(t)}else if(e==="text"){let i=this._subtitleGroups;i||(i=this._subtitleGroups=[]),i.indexOf(t)===-1&&i.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function Ln(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function On(a,e){const t=e.startPTS;if(Q(t)){let i=0,n;e.sn>a.sn?(i=t-a.start,n=a):(i=a.start-t,n=e),n.duration!==i&&(n.duration=i)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.start=a.start+(a.minEndPTS-a.start):e.start=a.start+a.duration:e.start=Math.max(a.start-e.duration,0)}function Pn(a,e,t,i,n,r){i-t<=0&&(b.warn("Fragment should have a positive duration",e),i=t+e.duration,r=n+e.duration);let o=t,u=i;const c=e.startPTS,h=e.endPTS;if(Q(c)){const T=Math.abs(c-t);Q(e.deltaPTS)?e.deltaPTS=Math.max(T,e.deltaPTS):e.deltaPTS=T,o=Math.max(t,c),t=Math.min(t,c),n=Math.min(n,e.startDTS),u=Math.min(i,h),i=Math.max(i,h),r=Math.max(r,e.endDTS)}const m=t-e.start;e.start!==0&&(e.start=t),e.duration=i-e.start,e.startPTS=t,e.maxStartPTS=o,e.startDTS=n,e.endPTS=i,e.minEndPTS=u,e.endDTS=r;const p=e.sn;if(!a||p<a.startSN||p>a.endSN)return 0;let E;const y=p-a.startSN,_=a.fragments;for(_[y]=e,E=y;E>0;E--)On(_[E],_[E-1]);for(E=y;E<_.length-1;E++)On(_[E],_[E+1]);return a.fragmentHint&&On(_[_.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,m}function jn(a,e){let t=null;const i=a.fragments;for(let o=i.length-1;o>=0;o--){const u=i[o].initSegment;if(u){t=u;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let n;qn(a,e,(o,u,c,h)=>{if(e.skippedSegments&&u.cc!==o.cc){const m=o.cc-u.cc;for(let p=c;p<h.length;p++)h[p].cc+=m}Q(o.startPTS)&&Q(o.endPTS)&&(u.start=u.startPTS=o.startPTS,u.startDTS=o.startDTS,u.maxStartPTS=o.maxStartPTS,u.endPTS=o.endPTS,u.endDTS=o.endDTS,u.minEndPTS=o.minEndPTS,u.duration=o.endPTS-o.startPTS,u.duration&&(n=u),e.PTSKnown=e.alignedSliding=!0),u.elementaryStreams=o.elementaryStreams,u.loader=o.loader,u.stats=o.stats,o.initSegment&&(u.initSegment=o.initSegment,t=o.initSegment)});const r=e.fragments;if(t&&(e.fragmentHint?r.concat(e.fragmentHint):r).forEach(u=>{var c;u&&(!u.initSegment||u.initSegment.relurl===((c=t)==null?void 0:c.relurl))&&(u.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=r.some(o=>!o),e.deltaUpdateFailed){b.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let o=e.skippedSegments;o--;)r.shift();e.startSN=r[0].sn}else e.canSkipDateRanges&&(e.dateRanges=Hn(a.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));e.startCC=e.fragments[0].cc,e.endCC=r[r.length-1].cc}xn(a.partList,e.partList,(o,u)=>{u.elementaryStreams=o.elementaryStreams,u.stats=o.stats}),n?Pn(e,n,n.startPTS,n.endPTS,n.startDTS,n.endDTS):Fn(a,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const s=e.advancedDateTime;if(e.advanced&&s){const o=e.edge;e.driftStart||(e.driftStartTime=s,e.driftStart=o),e.driftEndTime=s,e.driftEnd=o}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime}function Hn(a,e,t){const i=ae({},a);return t&&t.forEach(n=>{delete i[n]}),Object.keys(e).forEach(n=>{const r=new Xe(e[n].attr,i[n]);r.isValid?i[n]=r:b.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[n].attr)}"`)}),i}function xn(a,e,t){if(a&&e){let i=0;for(let n=0,r=a.length;n<=r;n++){const s=a[n],o=e[n+i];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?t(s,o):i--}}}function qn(a,e,t){const i=e.skippedSegments,n=Math.max(a.startSN,e.startSN)-e.startSN,r=(a.fragmentHint?1:0)+(i?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,s=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,u=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let c=n;c<=r;c++){const h=u[s+c];let m=o[c];i&&!m&&c<i&&(m=e.fragments[c]=h),h&&m&&t(h,m,c,o)}}function Fn(a,e){const t=e.startSN+e.skippedSegments-a.startSN,i=a.fragments;t<0||t>=i.length||wn(e,i[t].start)}function wn(a,e){if(e){const t=a.fragments;for(let i=a.skippedSegments;i<t.length;i++)t[i].start+=e;a.fragmentHint&&(a.fragmentHint.start+=e)}}function Qn(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const i=a.fragments;if(i.length&&t*4>e){const r=i[i.length-1].duration*1e3;r<t&&(t=r)}}else t/=2;return Math.round(t)}function Mn(a,e,t){if(!(a!=null&&a.details))return null;const i=a.details;let n=i.fragments[e-i.startSN];return n||(n=i.fragmentHint,n&&n.sn===e)?n:e<i.startSN&&t&&t.sn===e?t:null}function Dn(a,e,t){var i;return a!=null&&a.details?Bn((i=a.details)==null?void 0:i.partList,e,t):null}function Bn(a,e,t){if(a)for(let i=a.length;i--;){const n=a[i];if(n.index===t&&n.fragment.sn===e)return n}return null}function Ji(a){a.forEach((e,t)=>{const{details:i}=e;i!=null&&i.fragments&&i.fragments.forEach(n=>{n.level=t})})}function Sn(a){switch(a.details){case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_TIMEOUT:case K.LEVEL_LOAD_TIMEOUT:case K.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Gi(a,e){const t=Sn(e);return a.default[`${t?"timeout":"error"}Retry`]}function cn(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function pn(a){return V(V({},a),{errorRetry:null,timeoutRetry:null})}function Xi(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,r=e<a.maxNumRetry&&(rn(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,r):r}function rn(a){return a===0&&navigator.onLine===!1||!!a&&(a<400||a>499)}const zn={search:function(a,e){let t=0,i=a.length-1,n=null,r=null;for(;t<=i;){n=(t+i)/2|0,r=a[n];const s=e(r);if(s>0)t=n+1;else if(s<0)i=n-1;else return r}return null}};function sr(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!Q(e))return null;const i=a[0].programDateTime;if(e<(i||0))return null;const n=a[a.length-1].endProgramDateTime;if(e>=(n||0))return null;t=t||0;for(let r=0;r<a.length;++r){const s=a[r];if(Zn(e,t,s))return s}return null}function Nn(a,e,t=0,i=0,n=.005){let r=null;if(a){r=e[a.sn-e[0].sn+1]||null;const o=a.endDTS-t;o>0&&o<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(r=e[0]);if(r&&((!a||a.level===r.level)&&Wn(t,i,r)===0||dr(r,a,Math.min(n,i))))return r;const s=zn.search(e,Wn.bind(null,t,i));return s&&(s!==a||!r)?s:r}function dr(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((n,r)=>(r[0]==="INF"&&(n+=parseFloat(r[1])),n),t);return a.start<=i}return!1}function Wn(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-i<=a?1:t.start-i>a&&t.start?-1:0}function Zn(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function St(a,e){return zn.search(a,t=>t.cc<e?1:t.cc>e?-1:0)}var yt={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},yi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4};class Hi{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=b.log.bind(b,"[info]:"),this.warn=b.warn.bind(b,"[warning]:"),this.error=b.error.bind(b,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(f.ERROR,this.onError,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(f.ERROR,this.onError,this),e.off(f.ERROR,this.onErrorOut,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===ot.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,n;if(t.fatal)return;const r=this.hls,s=t.context;switch(t.details){case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case K.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction={action:yt.DoNothing,flags:yi.None};return}case K.FRAG_GAP:case K.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=yt.SendAlternateToPenaltyBox;return}case K.LEVEL_EMPTY_ERROR:case K.LEVEL_PARSING_ERROR:{var o,u;const c=t.parent===ot.MAIN?t.level:r.loadLevel;t.details===K.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(u=o.levelDetails)!=null&&u.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.SUBTITLE_LOAD_ERROR:case K.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const c=r.levels[r.loadLevel];if(c&&(s.type===Kt.AUDIO_TRACK&&c.hasAudioGroup(s.groupId)||s.type===Kt.SUBTITLE_TRACK&&c.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=yt.SendAlternateToPenaltyBox,t.errorAction.flags=yi.MoveAllAlternatesMatchingHost;return}}return;case K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const c=r.levels[r.loadLevel],h=c==null?void 0:c.attrs["HDCP-LEVEL"];h?t.errorAction={action:yt.SendAlternateToPenaltyBox,flags:yi.MoveAllAlternatesMatchingHDCP,hdcpLevel:h}:this.keySystemError(t)}return;case K.BUFFER_ADD_CODEC_ERROR:case K.REMUX_ALLOC_ERROR:case K.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(n=t.level)!=null?n:r.loadLevel);return;case K.INTERNAL_EXCEPTION:case K.BUFFER_APPENDING_ERROR:case K.BUFFER_FULL_ERROR:case K.LEVEL_SWITCH_ERROR:case K.BUFFER_STALLED_ERROR:case K.BUFFER_SEEK_OVER_HOLE:case K.BUFFER_NUDGE_ON_STALL:t.errorAction={action:yt.DoNothing,flags:yi.None};return}t.type===N.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=Gi(i.config.playlistLoadPolicy,e),r=this.playlistError++;if(Xi(n,r,Sn(e),e.response))return{action:yt.RetryRequest,flags:yi.None,retryConfig:n,retryCount:r};const o=this.getLevelSwitchAction(e,t);return n&&(o.retryConfig=n,o.retryCount=r),o}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:s}=t.config,o=Gi(e.details.startsWith("key")?s:r,e),u=t.levels.reduce((h,m)=>h+m.fragmentError,0);if(n&&(e.details!==K.FRAG_GAP&&n.fragmentError++,Xi(o,u,Sn(e),e.response)))return{action:yt.RetryRequest,flags:yi.None,retryConfig:o,retryCount:u};const c=this.getLevelSwitchAction(e,i);return o&&(c.retryConfig=o,c.retryCount=u),c}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var r,s;const c=e.details;n.loadError++,c===K.BUFFER_APPEND_ERROR&&n.fragmentError++;let h=-1;const{levels:m,loadLevel:p,minAutoLevel:E,maxAutoLevel:y}=i;i.autoLevelEnabled||(i.loadLevel=-1);const _=(r=e.frag)==null?void 0:r.type,k=(_===ot.AUDIO&&c===K.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(c===K.BUFFER_ADD_CODEC_ERROR||c===K.BUFFER_APPEND_ERROR))&&m.some(({audioCodec:Me})=>n.audioCodec!==Me),ie=e.sourceBufferName==="video"&&(c===K.BUFFER_ADD_CODEC_ERROR||c===K.BUFFER_APPEND_ERROR)&&m.some(({codecSet:Me,audioCodec:xe})=>n.codecSet!==Me&&n.audioCodec===xe),{type:be,groupId:re}=(s=e.context)!=null?s:{};for(let Me=m.length;Me--;){const xe=(Me+p)%m.length;if(xe!==p&&xe>=E&&xe<=y&&m[xe].loadError===0){var o,u;const Je=m[xe];if(c===K.FRAG_GAP&&_===ot.MAIN&&e.frag){const ht=m[xe].details;if(ht){const Ie=Nn(e.frag,ht.fragments,e.frag.start);if(Ie!=null&&Ie.gap)continue}}else{if(be===Kt.AUDIO_TRACK&&Je.hasAudioGroup(re)||be===Kt.SUBTITLE_TRACK&&Je.hasSubtitleGroup(re))continue;if(_===ot.AUDIO&&(o=n.audioGroups)!=null&&o.some(ht=>Je.hasAudioGroup(ht))||_===ot.SUBTITLE&&(u=n.subtitleGroups)!=null&&u.some(ht=>Je.hasSubtitleGroup(ht))||k&&n.audioCodec===Je.audioCodec||!k&&n.audioCodec!==Je.audioCodec||ie&&n.codecSet===Je.codecSet)continue}h=xe;break}}if(h>-1&&i.loadLevel!==h)return e.levelRetry=!0,this.playlistError=0,{action:yt.SendAlternateToPenaltyBox,flags:yi.None,nextAutoLevel:h}}return{action:yt.SendAlternateToPenaltyBox,flags:yi.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case yt.DoNothing:break;case yt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==K.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case yt.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n,hdcpLevel:r,nextAutoLevel:s}=i;switch(n){case yi.None:this.switchLevel(e,s);break;case yi.MoveAllAlternatesMatchingHDCP:r&&(t.maxHdcpLevel=ln[ln.indexOf(r)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}i.resolved||this.switchLevel(e,s)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class xi{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=b.log.bind(b,`${t}:`),this.warn=b.warn.bind(b,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=t==null?void 0:t.renditionReports;if(n){let r=-1;for(let s=0;s<n.length;s++){const o=n[s];let u;try{u=new self.URL(o.URI,t.url).href}catch(c){b.warn(`Could not construct new URL for Rendition Report: ${c}`),u=o.URI||""}if(u===e){r=s;break}else u===e.substring(0,u.length)&&(r=s)}if(r!==-1){const s=n[r],o=parseInt(s["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let u=parseInt(s["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const h=Math.min(t.age-t.partTarget,t.targetduration);u>=0&&h>t.partTarget&&(u+=1)}const c=i&&an(i);return new An(o,u>=0?u:void 0,c)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:n,stats:r}=t,s=self.performance.now(),o=r.loading.first?Math.max(0,s-r.loading.first):0;if(n.advancedDateTime=Date.now()-o,n.live||i!=null&&i.live){if(n.reloaded(i),i&&this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),i&&n.fragments.length>0&&jn(i,n),!this.canLoad||!n.live)return;let u,c,h;if(n.canBlockReload&&n.endSN&&n.advanced){const T=this.hls.config.lowLatencyMode,k=n.lastPartSn,te=n.endSN,ie=n.lastPartIndex,be=ie!==-1,re=k===te,Me=T?0:ie;be?(c=re?te+1:k,h=re?Me:ie+1):c=te+1;const xe=n.age,Je=xe+n.ageHeader;let ht=Math.min(Je-n.partTarget,n.targetduration*1.5);if(ht>0){if(i&&ht>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${ht} with playlist age: ${n.age}`),ht=0;else{const Ie=Math.floor(ht/n.targetduration);if(c+=Ie,h!==void 0){const et=Math.round(ht%n.targetduration/n.partTarget);h+=et}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${xe.toFixed(2)}s goal: ${ht} skip sn ${Ie} to part ${h}`)}n.tuneInGoal=ht}if(u=this.getDeliveryDirectives(n,t.deliveryDirectives,c,h),T||!re){this.loadPlaylist(u);return}}else(n.canBlockReload||n.canSkipUntil)&&(u=this.getDeliveryDirectives(n,t.deliveryDirectives,c,h));const m=this.hls.mainForwardBufferInfo,p=m?m.end-m.len:0,E=(n.edge-p)*1e3,y=Qn(n,E);n.updated&&s>this.requestScheduled+y&&(this.requestScheduled=r.loading.start),c!==void 0&&n.canBlockReload?this.requestScheduled=r.loading.first+y-(n.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+y<s?this.requestScheduled=s:this.requestScheduled-s<=0&&(this.requestScheduled+=y);let _=this.requestScheduled-s;_=Math.max(0,_),this.log(`reload live playlist ${e} in ${Math.round(_)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(u),_)}else this.clearTimer()}getDeliveryDirectives(e,t,i,n){let r=an(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,r=_n.No),new An(i,n,r)}checkRetry(e){const t=e.details,i=Sn(e),n=e.errorAction,{action:r,retryCount:s=0,retryConfig:o}=n||{},u=!!n&&!!o&&(r===yt.RetryRequest||!n.resolved&&r===yt.SendAlternateToPenaltyBox);if(u){var c;if(this.requestScheduled=-1,s>=o.maxNumRetry)return!1;if(i&&(c=e.context)!=null&&c.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const h=cn(o,s);this.timer=self.setTimeout(()=>this.loadPlaylist(),h),this.warn(`Retrying playlist loading ${s+1}/${o.maxNumRetry} after "${t}" in ${h}ms`)}e.levelRetry=!0,n.resolved=!0}return u}}class kn{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class hr{constructor(e,t,i,n=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new kn(e),this.fast_=new kn(t),this.defaultTTFB_=n,this.ttfb_=new kn(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new kn(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new kn(t,n.getEstimate(),n.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new kn(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,n=e/1e3,r=i/n;this.fast_.sample(n,r),this.slow_.sample(n,r)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const ar={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Jn={};function ts(a,e,t,i,n,r){const s=a.audioCodec?a.audioGroups:null,o=r==null?void 0:r.audioCodec,u=r==null?void 0:r.channels,c=u?parseInt(u):o?1/0:2;let h=null;if(s!=null&&s.length)try{s.length===1&&s[0]?h=e.groups[s[0]].channels:h=s.reduce((m,p)=>{if(p){const E=e.groups[p];if(!E)throw new Error(`Audio track group ${p} not found`);Object.keys(E.channels).forEach(y=>{m[y]=(m[y]||0)+E.channels[y]})}return m},{2:0})}catch(m){return!0}return a.videoCodec!==void 0&&(a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(i,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(n,8e6))||!!h&&Q(c)&&Object.keys(h).some(m=>parseInt(m)>c)}function is(a,e,t){const i=a.videoCodec,n=a.audioCodec;if(!i||!n||!t)return Promise.resolve(ar);const r={width:a.width,height:a.height,bitrate:Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)),framerate:a.frameRate||30},s=a.videoRange;s!=="SDR"&&(r.transferFunction=s.toLowerCase());const o=i.split(",").map(u=>({type:"media-source",video:V(V({},r),{},{contentType:me(u,"video")})}));return n&&a.audioGroups&&a.audioGroups.forEach(u=>{var c;u&&((c=e.groups[u])==null||c.tracks.forEach(h=>{if(h.groupId===u){const m=h.channels||"",p=parseFloat(m);Q(p)&&p>2&&o.push.apply(o,n.split(",").map(E=>({type:"media-source",audio:{contentType:me(E,"audio"),channels:""+p}})))}}))}),Promise.all(o.map(u=>{const c=Fr(u);return Jn[c]||(Jn[c]=t.decodingInfo(u))})).then(u=>({supported:!u.some(c=>!c.supported),configurations:o,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:o,decodingInfoResults:[],error:u}))}function Fr(a){const{audio:e,video:t}=a,i=t||e;if(i){const n=i.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${n}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${n}`}return""}function yr(){if(typeof matchMedia=="function"){const a=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(a.media!==e.media)return a.matches===!0}return!1}function ns(a,e){let t=!1,i=[];return a&&(t=a!=="SDR",i=[a]),e&&(i=e.allowedVideoRanges||zi.slice(0),t=e.preferHDR!==void 0?e.preferHDR:yr(),t?i=i.filter(n=>n!=="SDR"):i=["SDR"]),{preferHDR:t,allowedVideoRanges:i}}function Ir(a,e,t,i,n){const r=Object.keys(a),s=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,u=s&&parseInt(s)===2;let c=!0,h=!1,m=1/0,p=1/0,E=1/0,y=0,_=[];const{preferHDR:T,allowedVideoRanges:k}=ns(e,n);for(let re=r.length;re--;){const Me=a[r[re]];c=Me.channels[2]>0,m=Math.min(m,Me.minHeight),p=Math.min(p,Me.minFramerate),E=Math.min(E,Me.minBitrate);const xe=k.filter(Je=>Me.videoRanges[Je]>0);xe.length>0&&(h=!0,_=xe)}m=Q(m)?m:0,p=Q(p)?p:0;const te=Math.max(1080,m),ie=Math.max(30,p);return E=Q(E)?E:t,t=Math.max(E,t),h||(e=void 0,_=[]),{codecSet:r.reduce((re,Me)=>{const xe=a[Me];if(Me===re)return re;if(xe.minBitrate>t)return vn(Me,`min bitrate of ${xe.minBitrate} > current estimate of ${t}`),re;if(!xe.hasDefaultAudio)return vn(Me,"no renditions with default or auto-select sound found"),re;if(o&&Me.indexOf(o.substring(0,4))%5!==0)return vn(Me,`audio codec preference "${o}" not found`),re;if(s&&!u){if(!xe.channels[s])return vn(Me,`no renditions with ${s} channel sound found (channels options: ${Object.keys(xe.channels)})`),re}else if((!o||u)&&c&&xe.channels[2]===0)return vn(Me,"no renditions with stereo sound found"),re;return xe.minHeight>te?(vn(Me,`min resolution of ${xe.minHeight} > maximum of ${te}`),re):xe.minFramerate>ie?(vn(Me,`min framerate of ${xe.minFramerate} > maximum of ${ie}`),re):_.some(Je=>xe.videoRanges[Je]>0)?xe.maxScore<y?(vn(Me,`max score of ${xe.maxScore} < selected max of ${y}`),re):re&&(pe(Me)>=pe(re)||xe.fragmentError>a[re].fragmentError)?re:(y=xe.maxScore,Me):(vn(Me,`no variants with VIDEO-RANGE of ${JSON.stringify(_)} found`),re)},void 0),videoRanges:_,preferHDR:T,minFramerate:p,minBitrate:E}}function vn(a,e){b.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function Mr(a){return a.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const n=t.channels||"2";return i.channels[n]=(i.channels[n]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Br(a,e,t,i){return a.slice(t,i+1).reduce((n,r)=>{if(!r.codecSet)return n;const s=r.audioGroups;let o=n[r.codecSet];o||(n[r.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!s,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,r.bitrate);const u=Math.min(r.height,r.width);return o.minHeight=Math.min(o.minHeight,u),o.minFramerate=Math.min(o.minFramerate,r.frameRate),o.maxScore=Math.max(o.maxScore,r.score),o.fragmentError+=r.fragmentError,o.videoRanges[r.videoRange]=(o.videoRanges[r.videoRange]||0)+1,s&&s.forEach(c=>{if(!c)return;const h=e.groups[c];h&&(o.hasDefaultAudio=o.hasDefaultAudio||e.hasDefaultAudio?h.hasDefault:h.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(h.channels).forEach(m=>{o.channels[m]=(o.channels[m]||0)+h.channels[m]}))}),n},{})}function $n(a,e,t){if("attrs"in a){const i=e.indexOf(a);if(i!==-1)return i}for(let i=0;i<e.length;i++){const n=e[i];if(er(a,n,t))return i}return-1}function er(a,e,t){const{groupId:i,name:n,lang:r,assocLang:s,characteristics:o,default:u}=a,c=a.forced;return(i===void 0||e.groupId===i)&&(n===void 0||e.name===n)&&(r===void 0||e.lang===r)&&(r===void 0||e.assocLang===s)&&(u===void 0||e.default===u)&&(c===void 0||e.forced===c)&&(o===void 0||rs(o,e.characteristics))&&(t===void 0||t(a,e))}function rs(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function tr(a,e){const{audioCodec:t,channels:i}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(i===void 0||i===(e.channels||"2"))}function ss(a,e,t,i,n){const r=e[i],o=e.reduce((p,E,y)=>{const _=E.uri;return(p[_]||(p[_]=[])).push(y),p},{})[r.uri];o.length>1&&(i=Math.max.apply(Math,o));const u=r.videoRange,c=r.frameRate,h=r.codecSet.substring(0,4),m=Nr(e,i,p=>{if(p.videoRange!==u||p.frameRate!==c||p.codecSet.substring(0,4)!==h)return!1;const E=p.audioGroups,y=t.filter(_=>!E||E.indexOf(_.groupId)!==-1);return $n(a,y,n)>-1});return m>-1?m:Nr(e,i,p=>{const E=p.audioGroups,y=t.filter(_=>!E||E.indexOf(_.groupId)!==-1);return $n(a,y,n)>-1})}function Nr(a,e,t){for(let i=e;i>-1;i--)if(t(a[i]))return i;for(let i=e+1;i<a.length;i++)if(t(a[i]))return i;return-1}class as{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:i,hls:n}=this,{autoLevelEnabled:r,media:s}=n;if(!t||!s)return;const o=performance.now(),u=i?i.stats:t.stats,c=i?i.duration:t.duration,h=o-u.loading.start,m=n.minAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||t.level<=m){this.clearTimer(),this._nextAutoLevel=-1;return}if(!r||s.paused||!s.playbackRate||!s.readyState)return;const p=n.mainForwardBufferInfo;if(p===null)return;const E=this.bwEstimator.getEstimateTTFB(),y=Math.abs(s.playbackRate);if(h<=Math.max(E,1e3*(c/(y*2))))return;const _=p.len/y,T=u.loading.first?u.loading.first-u.loading.start:-1,k=u.loaded&&T>-1,te=this.getBwEstimate(),ie=n.levels,be=ie[t.level],re=u.total||Math.max(u.loaded,Math.round(c*be.averageBitrate/8));let Me=k?h-T:h;Me<1&&k&&(Me=Math.min(h,u.loaded*8/te));const xe=k?u.loaded*1e3/Me:0,Je=xe?(re-u.loaded)/xe:re*8/te+E/1e3;if(Je<=_)return;const ht=xe?xe*8:te;let Ie=Number.POSITIVE_INFINITY,et;for(et=t.level-1;et>m;et--){const Et=ie[et].maxBitrate;if(Ie=this.getTimeToLoadFrag(E/1e3,ht,c*Et,!ie[et].details),Ie<_)break}if(Ie>=Je||Ie>c*10)return;n.nextLoadLevel=n.nextAutoLevel=et,k?this.bwEstimator.sample(h-Math.min(E,T),u.loaded):this.bwEstimator.sampleTTFB(h);const ri=ie[et].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>ri&&this.resetEstimator(ri),this.clearTimer(),b.warn(`[abr] Fragment ${t.sn}${i?" part "+i.index:""} of level ${t.level} is loading too slowly;
|
|
Time to underbuffer: ${_.toFixed(3)} s
|
|
Estimated load time for current fragment: ${Je.toFixed(3)} s
|
|
Estimated load time for down switch fragment: ${Ie.toFixed(3)} s
|
|
TTFB estimate: ${T|0} ms
|
|
Current BW estimate: ${Q(te)?te|0:"Unknown"} bps
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
Switching to level ${et} @ ${ri|0} bps`),n.trigger(f.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:i,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(b.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new hr(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.FRAG_LOADING,this.onFragLoading,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(f.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.FRAG_LOADING,this.onFragLoading,this),e.off(f.FRAG_LOADED,this.onFragLoaded,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(f.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){if(!i.bitrateTest){var n;this.fragCurrent=i,this.partCurrent=(n=t.part)!=null?n:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case K.BUFFER_ADD_CODEC_ERROR:case K.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case K.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:n,partCurrent:r}=this;if(i&&n&&i.sn===n.sn&&i.level===n.level){const s=performance.now(),o=r?r.stats:i.stats,u=s-o.loading.start,c=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&c>-1){const m=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(u-Math.min(m,c),o.loaded)}else this.bwEstimator.sampleTTFB(u)}break}}}getTimeToLoadFrag(e,t,i,n){const r=e+i/t,s=n?this.lastLevelLoadSec:0;return r+s}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,r=n.end-n.start;Q(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===ot.MAIN&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const r=i?i.duration:t.duration,s=this.hls.levels[t.level],o=(s.loaded?s.loaded.bytes:0)+n.loaded,u=(s.loaded?s.loaded.duration:0)+r;s.loaded={bytes:o,duration:u},s.realBitrate=Math.round(8*o/u)}if(t.bitrateTest){const r={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered(f.FRAG_BUFFERED,r),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,r=n!=null&&n.stats.loaded?n.stats:i.stats;if(r.aborted||this.ignoreFragment(i))return;const s=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ot.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,n,1,1);if(r>-1)return r;const s=this.hls.firstLevel,o=Math.min(Math.max(s,t),e);return b.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,i=this.bwEstimator.canEstimate(),n=this.lastLoadedFragLevel>-1;if(e!==-1&&(!i||!n||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const r=i&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const s=this.hls.levels;if(s.length>Math.max(e,r)&&s[e].loadError<=s[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:n,config:r,minAutoLevel:s}=i,o=t?t.duration:e?e.duration:0,u=this.getBwEstimate(),c=this.getStarvationDelay();let h=r.abrBandWidthFactor,m=r.abrBandWidthUpFactor;if(c){const T=this.findBestLevel(u,s,n,c,0,h,m);if(T>=0)return T}let p=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!c){const T=this.bitrateTestDelay;T&&(p=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-T,b.info(`[abr] bitrate test took ${Math.round(1e3*T)}ms, set first fragment max fetchDuration to ${Math.round(1e3*p)} ms`),h=m=1)}const E=this.findBestLevel(u,s,n,c,p,h,m);if(b.info(`[abr] ${c?"rebuffering expected":"buffer is empty"}, optimal quality level ${E}`),E>-1)return E;const y=i.levels[s],_=i.levels[i.loadLevel];return(y==null?void 0:y.bitrate)<(_==null?void 0:_.bitrate)?s:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,n=e.mainForwardBufferInfo;return(n?n.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,n,r,s,o){var u;const c=n+r,h=this.lastLoadedFragLevel,m=h===-1?this.hls.firstLevel:h,{fragCurrent:p,partCurrent:E}=this,{levels:y,allAudioTracks:_,loadLevel:T,config:k}=this.hls;if(y.length===1)return 0;const te=y[m],ie=!!(te!=null&&(u=te.details)!=null&&u.live),be=T===-1||h===-1;let re,Me="SDR",xe=(te==null?void 0:te.frameRate)||0;const{audioPreference:Je,videoPreference:ht}=k,Ie=this.audioTracksByGroup||(this.audioTracksByGroup=Mr(_));if(be){if(this.firstSelection!==-1)return this.firstSelection;const qt=this.codecTiers||(this.codecTiers=Br(y,Ie,t,i)),zt=Ir(qt,Me,e,Je,ht),{codecSet:Ri,videoRanges:Pi,minFramerate:kt,minBitrate:_t,preferHDR:Ii}=zt;re=Ri,Me=Ii?Pi[Pi.length-1]:Pi[0],xe=kt,e=Math.max(e,_t),b.log(`[abr] picked start tier ${JSON.stringify(zt)}`)}else re=te==null?void 0:te.codecSet,Me=te==null?void 0:te.videoRange;const et=E?E.duration:p?p.duration:0,ri=this.bwEstimator.getEstimateTTFB()/1e3,Et=[];for(let qt=i;qt>=t;qt--){var ti;const zt=y[qt],Ri=qt>m;if(!zt)continue;if(k.useMediaCapabilities&&!zt.supportedResult&&!zt.supportedPromise){const sn=navigator.mediaCapabilities;typeof(sn==null?void 0:sn.decodingInfo)=="function"&&ts(zt,Ie,Me,xe,e,Je)?(zt.supportedPromise=is(zt,Ie,sn),zt.supportedPromise.then(hn=>{if(!this.hls)return;zt.supportedResult=hn;const yn=this.hls.levels,Kn=yn.indexOf(zt);hn.error?b.warn(`[abr] MediaCapabilities decodingInfo error: "${hn.error}" for level ${Kn} ${JSON.stringify(hn)}`):hn.supported||(b.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${Kn} ${JSON.stringify(hn)}`),Kn>-1&&yn.length>1&&(b.log(`[abr] Removing unsupported level ${Kn}`),this.hls.removeLevel(Kn)))})):zt.supportedResult=ar}if(re&&zt.codecSet!==re||Me&&zt.videoRange!==Me||Ri&&xe>zt.frameRate||!Ri&&xe>0&&xe<zt.frameRate||zt.supportedResult&&!((ti=zt.supportedResult.decodingInfoResults)!=null&&ti[0].smooth)){Et.push(qt);continue}const Pi=zt.details,kt=(E?Pi==null?void 0:Pi.partTarget:Pi==null?void 0:Pi.averagetargetduration)||et;let _t;Ri?_t=o*e:_t=s*e;const Ii=et&&n>=et*2&&r===0?y[qt].averageBitrate:y[qt].maxBitrate,mi=this.getTimeToLoadFrag(ri,_t,Ii*kt,Pi===void 0);if(_t>=Ii&&(qt===h||zt.loadError===0&&zt.fragmentError===0)&&(mi<=ri||!Q(mi)||ie&&!this.bitrateTestDelay||mi<c)){const sn=this.forcedAutoLevel;return qt!==T&&(sn===-1||sn!==T)&&(Et.length&&b.trace(`[abr] Skipped level(s) ${Et.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${y[Et[0]].codecs}" ${y[Et[0]].videoRange}; not compatible with "${te.codecs}" ${Me}`),b.info(`[abr] switch candidate:${m}->${qt} adjustedbw(${Math.round(_t)})-bitrate=${Math.round(_t-Ii)} ttfb:${ri.toFixed(1)} avgDuration:${kt.toFixed(1)} maxFetchDuration:${c.toFixed(1)} fetchDuration:${mi.toFixed(1)} firstSelection:${be} codecSet:${re} videoRange:${Me} hls.loadLevel:${T}`)),be&&(this.firstSelection=qt),qt}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,n=Math.min(Math.max(e,i),t);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}}class os{constructor(){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(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var en={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class fr{constructor(e){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=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(f.BUFFER_APPENDED,this.onBufferAppended,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(f.BUFFER_APPENDED,this.onBufferAppended,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let n=i.length;n--;){const r=i[n];if(!r)break;const s=r.end;if(r.start<=e&&s!==null&&e<=s)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,n=Object.keys(i);for(let r=n.length;r--;){const s=i[n[r]];if((s==null?void 0:s.body.type)===t&&s.buffered){const o=s.body;if(o.start<=e&&e<=o.end)return o}}return null}detectEvictedFragments(e,t,i,n){this.timeRanges&&(this.timeRanges[e]=t);const r=(n==null?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(s=>{const o=this.fragments[s];if(!o||r>=o.body.sn)return;if(!o.buffered&&!o.loaded){o.body.type===i&&this.removeFragment(o.body);return}const u=o.range[e];u&&u.time.some(c=>{const h=!this.isTimeBuffered(c.startPTS,c.endPTS,t);return h&&this.removeFragment(o.body),h})})}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:n}=e;if(!t||i.sn==="initSegment")return;const r=lr(i),s=this.fragments[r];if(!s||s.buffered&&i.gap)return;const o=!i.relurl;Object.keys(t).forEach(u=>{const c=i.elementaryStreams[u];if(!c)return;const h=t[u],m=o||c.partial===!0;s.range[u]=this.getBufferedTimes(i,n,m,h)}),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=i.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),or(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter(n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=lr(e);let n=this.fragments[i];!n&&t&&(n=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(e,t,i,n){const r={time:[],partial:i},s=e.start,o=e.end,u=e.minEndPTS||o,c=e.maxStartPTS||s;for(let h=0;h<n.length;h++){const m=n.start(h)-this.bufferPadding,p=n.end(h)+this.bufferPadding;if(c>=m&&u<=p){r.time.push({startPTS:Math.max(s,n.start(h)),endPTS:Math.min(o,n.end(h))});break}else if(s<p&&o>m){const E=Math.max(s,n.start(h)),y=Math.min(o,n.end(h));y>E&&(r.partial=!0,r.time.push({startPTS:E,endPTS:y}))}else if(o<=m)break}return r}getPartialFragment(e){let t=null,i,n,r,s=0;const{bufferPadding:o,fragments:u}=this;return Object.keys(u).forEach(c=>{const h=u[c];h&&or(h)&&(n=h.body.start-o,r=h.body.end+o,e>=n&&e<=r&&(i=Math.min(e-n,r-e),s<=i&&(t=h.body,s=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||or(t))}getState(e){const t=lr(e),i=this.fragments[t];return i?i.buffered?or(i)?en.PARTIAL:en.OK:en.APPENDING:en.NOT_LOADED}isTimeBuffered(e,t,i){let n,r;for(let s=0;s<i.length;s++){if(n=i.start(s)-this.bufferPadding,r=i.end(s)+this.bufferPadding,e>=n&&t<=r)return!0;if(t<=n)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:n}=t;if(i.sn==="initSegment"||i.bitrateTest)return;const r=n?null:t,s=lr(i);this.fragments[s]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:r}=t;if(i.sn==="initSegment")return;const s=i.type;if(n){let o=this.activePartLists[s];o||(this.activePartLists[s]=o=[]),o.push(n)}this.timeRanges=r,Object.keys(r).forEach(o=>{const u=r[o];this.detectEvictedFragments(o,u,s,n)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=lr(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,n,r){n&&!this.hasGaps||Object.keys(this.fragments).forEach(s=>{const o=this.fragments[s];if(!o)return;const u=o.body;u.type!==i||n&&!u.gap||u.start<t&&u.end>e&&(o.buffered||r)&&this.removeFragment(u)})}removeFragment(e){const t=lr(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=i.filter(r=>r.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function or(a){var e,t,i;return a.buffered&&(a.body.gap||((e=a.range.video)==null?void 0:e.partial)||((t=a.range.audio)==null?void 0:t.partial)||((i=a.range.audiovideo)==null?void 0:i.partial))}function lr(a){return`${a.type}_${a.level}_${a.sn}`}const ls={length:0,start:()=>0,end:()=>0};class Oi{static isBuffered(e,t){try{if(e){const i=Oi.getBuffered(e);for(let n=0;n<i.length;n++)if(t>=i.start(n)&&t<=i.end(n))return!0}}catch(i){}return!1}static bufferInfo(e,t,i){try{if(e){const n=Oi.getBuffered(e),r=[];let s;for(s=0;s<n.length;s++)r.push({start:n.start(s),end:n.end(s)});return this.bufferedInfo(r,t,i)}}catch(n){}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.sort(function(c,h){const m=c.start-h.start;return m||h.end-c.end});let n=[];if(i)for(let c=0;c<e.length;c++){const h=n.length;if(h){const m=n[h-1].end;e[c].start-m<i?e[c].end>m&&(n[h-1].end=e[c].end):n.push(e[c])}else n.push(e[c])}else n=e;let r=0,s,o=t,u=t;for(let c=0;c<n.length;c++){const h=n[c].start,m=n[c].end;if(t+i>=h&&t<m)o=h,u=m,r=u-t;else if(t+i<h){s=h;break}}return{len:r,start:o||0,end:u||0,nextStart:s}}static getBuffered(e){try{return e.buffered}catch(t){return b.log("failed to get media.buffered",t),ls}}}class Er{constructor(e,t,i,n=0,r=-1,s=!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=ir(),this.buffering={audio:ir(),video:ir(),audiovideo:ir()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=r,this.partial=s}}function ir(){return{start:0,executeStart:0,executeEnd:0,end:0}}function _r(a,e){for(let i=0,n=a.length;i<n;i++){var t;if(((t=a[i])==null?void 0:t.cc)===e)return a[i]}return null}function us(a,e,t){return!!(e&&(t.endCC>t.startCC||a&&a.cc<t.startCC))}function cs(a,e){const t=a.fragments,i=e.fragments;if(!i.length||!t.length){b.log("No fragments to align");return}const n=_r(t,i[0].cc);if(!n||n&&!n.startPTS){b.log("No frag in previous level to align on");return}return n}function wr(a,e){if(a){const t=a.start+e;a.start=a.startPTS=t,a.endPTS=t+a.duration}}function $r(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)wr(t[i],a);e.fragmentHint&&wr(e.fragmentHint,a),e.alignedSliding=!0}function ds(a,e,t){e&&(hs(a,t,e),!t.alignedSliding&&e&&xr(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&Fn(e,t))}function hs(a,e,t){if(us(a,t,e)){const i=cs(t,e);i&&Q(i.start)&&(b.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),$r(i.start,e))}}function xr(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,i=e.fragments;if(!t.length||!i.length)return;let n,r;const s=Math.min(e.endCC,a.endCC);e.startCC<s&&a.startCC<s&&(n=_r(i,s),r=_r(t,s)),(!n||!r)&&(n=i[Math.floor(i.length/2)],r=_r(t,n.cc)||t[Math.floor(t.length/2)]);const o=n.programDateTime,u=r.programDateTime;if(!o||!u)return;const c=(u-o)/1e3-(r.start-n.start);$r(c,a)}const Ur=Math.pow(2,17);class Vi{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const i=e.url;if(!i)return Promise.reject(new Wi({type:N.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const n=this.config,r=n.fLoader,s=n.loader;return new Promise((o,u)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(E=>E[0]==="GAP")){u(Mi(e));return}else e.gap=!1;const c=this.loader=e.loader=r?new r(n):new s(n),h=Li(e),m=pn(n.fragLoadPolicy.default),p={loadPolicy:m,timeout:m.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Ur};e.stats=c.stats,c.load(h,p,{onSuccess:(E,y,_,T)=>{this.resetLoader(e,c);let k=E.data;_.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(k.slice(0,16)),k=k.slice(16)),o({frag:e,part:null,payload:k,networkDetails:T})},onError:(E,y,_,T)=>{this.resetLoader(e,c),u(new Wi({type:N.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:V({url:i,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:_,stats:T}))},onAbort:(E,y,_)=>{this.resetLoader(e,c),u(new Wi({type:N.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:_,stats:E}))},onTimeout:(E,y,_)=>{this.resetLoader(e,c),u(new Wi({type:N.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${p.timeout}ms`),networkDetails:_,stats:E}))},onProgress:(E,y,_,T)=>{t&&t({frag:e,part:null,payload:_,networkDetails:T})}})})}loadPart(e,t,i){this.abort();const n=this.config,r=n.fLoader,s=n.loader;return new Promise((o,u)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){u(Mi(e,t));return}const c=this.loader=e.loader=r?new r(n):new s(n),h=Li(e,t),m=pn(n.fragLoadPolicy.default),p={loadPolicy:m,timeout:m.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Ur};t.stats=c.stats,c.load(h,p,{onSuccess:(E,y,_,T)=>{this.resetLoader(e,c),this.updateStatsFromPart(e,t);const k={frag:e,part:t,payload:E.data,networkDetails:T};i(k),o(k)},onError:(E,y,_,T)=>{this.resetLoader(e,c),u(new Wi({type:N.NETWORK_ERROR,details:K.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:V({url:h.url,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:_,stats:T}))},onAbort:(E,y,_)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,c),u(new Wi({type:N.NETWORK_ERROR,details:K.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:_,stats:E}))},onTimeout:(E,y,_)=>{this.resetLoader(e,c),u(new Wi({type:N.NETWORK_ERROR,details:K.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${p.timeout}ms`),networkDetails:_,stats:E}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,r=n.total;if(i.loaded+=n.loaded,r){const u=Math.round(e.duration/t.duration),c=Math.min(Math.round(i.loaded/r),u),m=(u-c)*Math.round(i.loaded/c);i.total=i.loaded+m}else i.total=Math.max(i.loaded,i.total);const s=i.loading,o=n.loading;s.start?s.first+=o.first-o.start:(s.start=o.start,s.first=o.first),s.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Li(a,e=null){const t=e||a,i={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},n=t.byteRangeStartOffset,r=t.byteRangeEndOffset;if(Q(n)&&Q(r)){var s;let o=n,u=r;if(a.sn==="initSegment"&&((s=a.decryptdata)==null?void 0:s.method)==="AES-128"){const c=r-n;c%16&&(u=r+(16-c%16)),n!==0&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=u}return i}function Mi(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:N.MEDIA_ERROR,details:K.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new Wi(i)}class Wi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Cn{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Sr{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function Dr(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?R(a,0,e-t):a}class fs{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_(e){const t=new DataView(e),i=new Uint32Array(4);for(let n=0;n<4;n++)i[n]=t.getUint32(n*4);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,n=i[0],r=i[1],s=i[2],o=i[3],u=this.invSubMix,c=u[0],h=u[1],m=u[2],p=u[3],E=new Uint32Array(256);let y=0,_=0,T=0;for(T=0;T<256;T++)T<128?E[T]=T<<1:E[T]=T<<1^283;for(T=0;T<256;T++){let k=_^_<<1^_<<2^_<<3^_<<4;k=k>>>8^k&255^99,e[y]=k,t[k]=y;const te=E[y],ie=E[te],be=E[ie];let re=E[k]*257^k*16843008;n[y]=re<<24|re>>>8,r[y]=re<<16|re>>>16,s[y]=re<<8|re>>>24,o[y]=re,re=be*16843009^ie*65537^te*257^y*16843008,c[k]=re<<24|re>>>8,h[k]=re<<16|re>>>16,m[k]=re<<8|re>>>24,p[k]=re,y?(y=te^E[E[E[be^te]]],_^=E[E[_]]):y=_=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,n=0;for(;n<t.length&&i;)i=t[n]===this.key[n],n++;if(i)return;this.key=t;const r=this.keySize=t.length;if(r!==4&&r!==6&&r!==8)throw new Error("Invalid aes key size="+r);const s=this.ksRows=(r+6+1)*4;let o,u;const c=this.keySchedule=new Uint32Array(s),h=this.invKeySchedule=new Uint32Array(s),m=this.sBox,p=this.rcon,E=this.invSubMix,y=E[0],_=E[1],T=E[2],k=E[3];let te,ie;for(o=0;o<s;o++){if(o<r){te=c[o]=t[o];continue}ie=te,o%r===0?(ie=ie<<8|ie>>>24,ie=m[ie>>>24]<<24|m[ie>>>16&255]<<16|m[ie>>>8&255]<<8|m[ie&255],ie^=p[o/r|0]<<24):r>6&&o%r===4&&(ie=m[ie>>>24]<<24|m[ie>>>16&255]<<16|m[ie>>>8&255]<<8|m[ie&255]),c[o]=te=(c[o-r]^ie)>>>0}for(u=0;u<s;u++)o=s-u,u&3?ie=c[o]:ie=c[o-4],u<4||o<=4?h[u]=ie:h[u]=y[m[ie>>>24]]^_[m[ie>>>16&255]]^T[m[ie>>>8&255]]^k[m[ie&255]],h[u]=h[u]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const n=this.keySize+6,r=this.invKeySchedule,s=this.invSBox,o=this.invSubMix,u=o[0],c=o[1],h=o[2],m=o[3],p=this.uint8ArrayToUint32Array_(i);let E=p[0],y=p[1],_=p[2],T=p[3];const k=new Int32Array(e),te=new Int32Array(k.length);let ie,be,re,Me,xe,Je,ht,Ie,et,ri,Et,ti,qt,zt;const Ri=this.networkToHostOrderSwap;for(;t<k.length;){for(et=Ri(k[t]),ri=Ri(k[t+1]),Et=Ri(k[t+2]),ti=Ri(k[t+3]),xe=et^r[0],Je=ti^r[1],ht=Et^r[2],Ie=ri^r[3],qt=4,zt=1;zt<n;zt++)ie=u[xe>>>24]^c[Je>>16&255]^h[ht>>8&255]^m[Ie&255]^r[qt],be=u[Je>>>24]^c[ht>>16&255]^h[Ie>>8&255]^m[xe&255]^r[qt+1],re=u[ht>>>24]^c[Ie>>16&255]^h[xe>>8&255]^m[Je&255]^r[qt+2],Me=u[Ie>>>24]^c[xe>>16&255]^h[Je>>8&255]^m[ht&255]^r[qt+3],xe=ie,Je=be,ht=re,Ie=Me,qt=qt+4;ie=s[xe>>>24]<<24^s[Je>>16&255]<<16^s[ht>>8&255]<<8^s[Ie&255]^r[qt],be=s[Je>>>24]<<24^s[ht>>16&255]<<16^s[Ie>>8&255]<<8^s[xe&255]^r[qt+1],re=s[ht>>>24]<<24^s[Ie>>16&255]<<16^s[xe>>8&255]<<8^s[Je&255]^r[qt+2],Me=s[Ie>>>24]<<24^s[xe>>16&255]<<16^s[Je>>8&255]<<8^s[ht&255]^r[qt+3],te[t]=Ri(ie^E),te[t+1]=Ri(Me^y),te[t+2]=Ri(re^_),te[t+3]=Ri(be^T),E=et,y=ri,_=Et,T=ti,t=t+4}return te.buffer}}const Gr=16;class br{constructor(e,{removePKCS7Padding:t=!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.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(i){}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:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const i=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Dr(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i){return this.useSoftware?new Promise((n,r)=>{this.softwareDecrypt(new Uint8Array(e),t,i);const s=this.flush();s?n(s.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i)}softwareDecrypt(e,t,i){const{currentIV:n,currentResult:r,remainderData:s}=this;this.logOnce("JS AES decrypt"),s&&(e=l(s,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;n&&(i=n);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new fs),u.expandKey(t);const c=r;return this.currentResult=u.decrypt(o.buffer,0,i),this.currentIV=R(o,-16).buffer,c||null}webCryptoDecrypt(e,t,i){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i));this.key=t,this.fastAesKey=new Sr(this.subtle,t)}return this.fastAesKey.expandKey().then(n=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Cn(this.subtle,new Uint8Array(i)).decrypt(e.buffer,n)):Promise.reject(new Error("web crypto not initialized"))).catch(n=>(b.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(e,t,i)))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const n=this.flush();if(n)return n.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%Gr;return i!==e.length&&(t=R(e,0,i),this.remainderData=R(e,i)),t}logOnce(e){this.logEnabled&&(b.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const mr={toString:function(a){let e="";const t=a.length;for(let i=0;i<t;i++)e+=`[${a.start(i).toFixed(3)}-${a.end(i).toFixed(3)}]`;return e}},De={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class kr extends os{constructor(e,t,i,n,r){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=De.STOPPED,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.loadedmetadata=!1,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.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=r,this.logPrefix=n,this.log=b.log.bind(b,`${n}:`),this.warn=b.warn.bind(b,`${n}:`),this.hls=e,this.fragmentLoader=new Vi(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new br(e.config),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=De.STOPPED}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const i=t.partList;if(i!=null&&i.length){const r=i[i.length-1];return Oi.isBuffered(this.media,r.start+r.duration/2)}const n=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(n)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);const n=this.config;this.levels&&n.autoStartLoad&&this.state===De.STOPPED&&this.startLoad(n.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:i,mediaBuffer:n,state:r}=this,s=i?i.currentTime:0,o=Oi.bufferInfo(n||i,s,e.maxBufferHole);if(this.log(`media seeking to ${Q(s)?s.toFixed(3):s}, state: ${r}`),this.state===De.ENDED)this.resetLoadingState();else if(t){const u=e.maxFragLookUpTolerance,c=t.start-u,h=t.start+t.duration+u;if(!o.len||h<o.start||c>o.end){const m=s>h;(s<c||m)&&(m&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}i&&(this.fragmentTracker.removeFragmentsInRange(s,1/0,this.playlistType,!0),this.lastCurrentTime=s),!this.loadedmetadata&&!o.len&&(this.nextLoadPosition=this.startPosition=s),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=De.STOPPED,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(e,t,i){this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const n=r=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${r.part?" p: "+r.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(r)};this._doFragLoad(e,t,i,n).then(r=>{if(!r)return;const s=this.state;if(this.fragContextChanged(e)){(s===De.FRAG_LOADING||!this.fragCurrent&&s===De.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=De.IDLE);return}"payload"in r&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(f.FRAG_LOADED,r)),this._handleFragmentLoadComplete(r)}).catch(r=>{this.state===De.STOPPED||this.state===De.ERROR||(this.warn(`Frag error: ${(r==null?void 0:r.message)||r}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===en.APPENDING){const r=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,r),o=Math.max(e.duration,s?s.len:this.config.maxBufferLength),u=this.backtrackFragment;((u?e.sn-u.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&i.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===en.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger(f.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{if(!i||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:n}=this,{payload:r}=i,s=e.decryptdata;if(r&&r.byteLength>0&&s!=null&&s.key&&s.iv&&s.method==="AES-128"){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),s.key.buffer,s.iv.buffer).catch(u=>{throw n.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:e}),u}).then(u=>{const c=self.performance.now();return n.trigger(f.FRAG_DECRYPTED,{frag:e,payload:u,stats:{tstart:o,tdecrypt:c}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===De.STOPPED||this.state===De.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=De.IDLE,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,n,r,s;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===ot.MAIN?"level":"track"} ${e.level} (frag:[${((i=e.startPTS)!=null?i:NaN).toFixed(3)}-${((n=e.endPTS)!=null?n:NaN).toFixed(3)}] > buffer:${o?mr.toString(Oi.getBuffered(o)):"(detached)"})`),e.sn!=="initSegment"){var u;if(e.type!==ot.SUBTITLE){const h=e.elementaryStreams;if(!Object.keys(h).some(m=>!!h[m])){this.state=De.IDLE;return}}const c=(u=this.levels)==null?void 0:u[e.level];c!=null&&c.fragmentError&&(this.log(`Resetting level fragment error count of ${c.fragmentError} on frag buffered`),c.fragmentError=0)}this.state=De.IDLE,o&&(!this.loadedmetadata&&e.type==ot.MAIN&&o.buffered.length&&((r=this.fragCurrent)==null?void 0:r.sn)===((s=this.fragPrevious)==null?void 0:s.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:r}=e,s=!r||r.length===0||r.some(u=>!u),o=new Er(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!s);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){var r;const s=t==null?void 0:t.details;if(!this.levels||!s)throw new Error(`frag load aborted, missing level${s?"":" detail"}s`);let o=null;if(e.encrypted&&!((r=e.decryptdata)!=null&&r.key)?(this.log(`Loading key for ${e.sn} of [${s.startSN}-${s.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=De.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(h=>{if(!this.fragContextChanged(h.frag))return this.hls.trigger(f.KEY_LOADED,h),this.state===De.KEY_LOADING&&(this.state=De.IDLE),h}),this.hls.trigger(f.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&s.encryptedFragments.length&&this.keyLoader.loadClear(e,s.encryptedFragments),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const h=s.partList;if(h&&n){i>e.end&&s.fragmentHint&&(e=s.fragmentHint);const m=this.getNextPart(h,e,i);if(m>-1){const p=h[m];this.log(`Loading part sn: ${e.sn} p: ${p.index} cc: ${e.cc} of playlist [${s.startSN}-${s.endSN}] parts [0-${m}-${h.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=p.start+p.duration,this.state=De.FRAG_LOADING;let E;return o?E=o.then(y=>!y||this.fragContextChanged(y.frag)?null:this.doFragPartsLoad(e,p,t,n)).catch(y=>this.handleFragLoadError(y)):E=this.doFragPartsLoad(e,p,t,n).catch(y=>this.handleFragLoadError(y)),this.hls.trigger(f.FRAG_LOADING,{frag:e,part:p,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):E}else if(!e.url||this.loadedEndOfParts(h,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${s?"of ["+s.startSN+"-"+s.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),Q(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=De.FRAG_LOADING;const u=this.config.progressive;let c;return u&&o?c=o.then(h=>!h||this.fragContextChanged(h==null?void 0:h.frag)?null:this.fragmentLoader.load(e,n)).catch(h=>this.handleFragLoadError(h)):c=Promise.all([this.fragmentLoader.load(e,u?n:void 0),o]).then(([h])=>(!u&&h&&n&&n(h),h)).catch(h=>this.handleFragLoadError(h)),this.hls.trigger(f.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):c}doFragPartsLoad(e,t,i,n){return new Promise((r,s)=>{var o;const u=[],c=(o=i.details)==null?void 0:o.partList,h=m=>{this.fragmentLoader.loadPart(e,m,n).then(p=>{u[m.index]=p;const E=p.part;this.hls.trigger(f.FRAG_LOADED,p);const y=Dn(i,e.sn,m.index+1)||Bn(c,e.sn,m.index+1);if(y)h(y);else return r({frag:e,part:E,partsLoaded:u})}).catch(s)};h(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===K.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(f.ERROR,t)}else this.hls.trigger(f.ERROR,{type:N.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==De.PARSING){!this.fragCurrent&&this.state!==De.STOPPED&&this.state!==De.ERROR&&(this.state=De.IDLE);return}const{frag:i,part:n,level:r}=t,s=self.performance.now();i.stats.parsing.end=s,n&&(n.stats.parsing.end=s),this.updateLevelTiming(i,n,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:r,part:s}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${r} of level ${n}. The current chunk will not be buffered.`),null;const o=t[n],u=s>-1?Dn(o,r,s):null,c=u?u.fragment:Mn(o,r,i);return c?(i&&i!==c&&(c.stats=i.stats),{frag:c,part:u,level:o}):null}bufferFragmentData(e,t,i,n,r){var s;if(!e||this.state!==De.PARSING)return;const{data1:o,data2:u}=e;let c=o;if(o&&u&&(c=l(o,u)),!((s=c)!=null&&s.length))return;const h={type:e.type,frag:t,part:i,chunkMeta:n,parent:t.type,data:c};if(this.hls.trigger(f.BUFFER_APPENDING,h),e.dropped&&e.independent&&!i){if(r)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Oi.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=Oi.bufferInfo(t,i,0),r=e.duration,s=Math.min(this.config.maxFragLookUpTolerance*2,r*.25),o=Math.max(Math.min(e.start-s,n.end-s),i+s);e.start-o>s&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return Q(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:n}}=this,r=Oi.bufferInfo(e,t,n);if(r.len===0&&r.nextStart!==void 0){const s=this.fragmentTracker.getBufferedFrag(t,i);if(s&&r.nextStart<s.end)return Oi.bufferInfo(e,t,Math.max(r.nextStart,n))}return r}getMaxBufferLength(e){const{config:t}=this;let i;return e?i=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):i=t.maxBufferLength,Math.min(i,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const i=this.config,n=Math.max(Math.min(e-t,i.maxBufferLength),t),r=Math.max(e-t*3,i.maxMaxBufferLength/2,n);return r>=n?(i.maxMaxBufferLength=r,this.warn(`Reduce max buffer length to ${r}s`),!0):!1}getAppendedFrag(e,t=ot.MAIN){const i=this.fragmentTracker.getAppendedFrag(e,ot.MAIN);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:r}=this,s=i[0].start;let o;if(t.live){const u=r.initialLiveManifestSize;if(n<u)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${u})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<s)&&(o=this.getInitialLiveFragment(t,i),this.startPosition=this.nextLoadPosition=o?this.hls.liveSyncPosition||o.start:e)}else e<=s&&(o=i[0]);if(!o){const u=r.lowLatencyMode?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,u,t)}return this.mapToInitFragWhenRequired(o)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===en.OK||i===en.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,r){const s=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,s&&e&&!e.gap&&i.nextStart){const u=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n);if(u!==null&&i.len+u.len>=r)return this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let n=-1,r=!1,s=!0;for(let o=0,u=e.length;o<u;o++){const c=e[o];if(s=s&&!c.independent,n>-1&&i<c.start)break;const h=c.loaded;h?n=-1:(r||c.independent||s)&&c.fragment===t&&(n=o),r=h}return n}loadedEndOfParts(e,t){const i=e[e.length-1];return i&&t>i.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let n=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),n=sr(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const r=i.sn+1;if(r>=e.startSN&&r<=e.endSN){const s=t[r-e.startSN];i.cc===s.cc&&(n=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=St(t,i.cc),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const r=this.hls.liveSyncPosition;r!==null&&(n=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:r}=this,{fragments:s,endSN:o}=i;const{fragmentHint:u}=i,{maxFragLookUpTolerance:c}=n,h=i.partList,m=!!(n.lowLatencyMode&&h!=null&&h.length&&u);m&&u&&!this.bitrateTest&&(s=s.concat(u),o=u.sn);let p;if(e<t){const E=e>t-c?0:c;p=Nn(r,s,e,E)}else p=s[s.length-1];if(p){const E=p.sn-i.startSN,y=this.fragmentTracker.getState(p);if((y===en.OK||y===en.PARTIAL&&p.gap)&&(r=p),r&&p.sn===r.sn&&(!m||h[0].fragment.sn>p.sn)&&r&&p.level===r.level){const T=s[E+1];p.sn<o&&this.fragmentTracker.getState(T)!==en.OK?p=T:p=null}}return p}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const n=this.hls.liveSyncPosition,r=i.currentTime,s=e.fragments[0].start,o=e.edge,u=r>=s-t.maxFragLookUpTolerance&&r<=o;if(n!==null&&i.duration>n&&(r<n||!u)){const c=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!u&&i.readyState<4||r<o-c)&&(this.loadedmetadata||(this.nextLoadPosition=n),i.readyState&&(this.warn(`Playback: ${r.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),i.currentTime=n))}}alignPlaylists(e,t,i){const n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const r=e.fragments[0].start,s=!t,o=e.alignedSliding&&Q(r);if(s||!o&&!r){const{fragPrevious:u}=this;ds(u,i,e);const c=e.fragments[0].start;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${u?u.sn:"na"} fragments: ${n}`),c}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let i=this.startPosition;if(i<t&&(i=-1),i===-1||this.lastCurrentTime===-1){const n=this.startTimeOffset!==null,r=n?this.startTimeOffset:e.startTimeOffset;r!==null&&Q(r)?(i=t+r,r<0&&(i+=e.totalduration),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Start time offset ${r} found in ${n?"multivariant":"media"} playlist, adjust startPosition to ${i}`),this.startPosition=i):e.live?i=this.hls.liveSyncPosition||t:this.startPosition=i=0,this.lastCurrentTime=i}this.nextLoadPosition=i}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==De.FRAG_LOADING_WAITING_RETRY)&&(this.state=De.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const h=this.getCurrentContext(t.chunkMeta);h&&(t.frag=h.frag)}const i=t.frag;if(!i||i.type!==e||!this.levels)return;if(this.fragContextChanged(i)){var n;this.warn(`Frag load error must match current frag to retry ${i.url} > ${(n=this.fragCurrent)==null?void 0:n.url}`);return}const r=t.details===K.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const s=t.errorAction,{action:o,retryCount:u=0,retryConfig:c}=s||{};if(s&&o===yt.RetryRequest&&c){this.resetStartWhenNotLoaded(this.levelLastLoaded);const h=cn(c,u);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${u+1}/${c.maxNumRetry} in ${h}ms`),s.resolved=!0,this.retryDate=self.performance.now()+h,this.state=De.FRAG_LOADING_WAITING_RETRY}else if(c&&s)if(this.resetFragmentErrors(e),u<c.maxNumRetry)!r&&o!==yt.RemoveAlternatePermanently&&(s.resolved=!0);else{b.warn(`${t.details} reached or exceeded max retry (${u})`);return}else(s==null?void 0:s.action)===yt.SendAlternateToPenaltyBox?this.state=De.WAITING_LEVEL:this.state=De.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===De.PARSING||this.state===De.PARSED){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),r=n&&n.len>.5;r&&this.reduceMaxBufferLength(n.len,(t==null?void 0:t.duration)||10);const s=!r;return s&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===ot.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==De.STOPPED&&(this.state=De.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=Oi.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===De.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=De.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){var r;const s=i.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((u,c)=>{const h=e.elementaryStreams[c];if(h){const m=h.endPTS-h.startPTS;if(m<=0)return this.warn(`Could not parse fragment ${e.sn} ${c} duration reliably (${m})`),u||!1;const p=n?0:Pn(s,e,h.startPTS,h.endPTS,h.startDTS,h.endDTS);return this.hls.trigger(f.LEVEL_PTS_UPDATED,{details:s,level:i,drift:p,type:c,frag:e,start:h.startPTS,end:h.endPTS}),!0}return u},!1)&&((r=this.transmuxer)==null?void 0:r.error)===null){const u=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(i.fragmentError===0&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(u.message),this.hls.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:u,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=De.PARSED,this.hls.trigger(f.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class Ks{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;if(e.length)e.length===1?i=e[0]:i=Ya(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function Ya(a,e){const t=new Uint8Array(e);let i=0;for(let n=0;n<a.length;n++){const r=a[n];t.set(r,i),i+=r.length}return t}function Xa(){return typeof __HLS_WORKER_BUNDLE__=="function"}function qa(){const a=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(a);return{worker:new self.Worker(e),objectURL:e}}function Qa(a){const e=new self.URL(a,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function Yn(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ms{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(e,t,i,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){this.cachedData&&(e=l(this.cachedData,e),this.cachedData=null);let i=L(e,0),n=i?i.length:0,r;const s=this._audioTrack,o=this._id3Track,u=i?I(i):void 0,c=e.length;for((this.basePTS===null||this.frameIndex===0&&Q(u))&&(this.basePTS=Ja(u,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),i&&i.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ki.audioId3,duration:Number.POSITIVE_INFINITY});n<c;){if(this.canParse(e,n)){const h=this.appendFrame(s,e,n);h?(this.frameIndex++,this.lastPTS=h.sample.pts,n+=h.length,r=n):n=c}else ne(e,n)?(i=L(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ki.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,r=n):n++;if(n===c&&r!==c){const h=R(e,r);this.cachedData?this.cachedData=l(this.cachedData,h):this.cachedData=h}}return{audioTrack:s,videoTrack:Yn(),id3Track:o,textTrack:Yn()}}demuxSampleAes(e,t,i){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Yn(),id3Track:this._id3Track,textTrack:Yn()}}destroy(){}}const Ja=(a,e,t)=>{if(Q(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};function eo(a,e,t,i){let n,r,s,o;const u=navigator.userAgent.toLowerCase(),c=i,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];n=((e[t+2]&192)>>>6)+1;const m=(e[t+2]&60)>>>2;if(m>h.length-1){const p=new Error(`invalid ADTS sampling index:${m}`);a.emit(f.ERROR,f.ERROR,{type:N.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!0,error:p,reason:p.message});return}return s=(e[t+2]&1)<<2,s|=(e[t+3]&192)>>>6,b.log(`manifest codec:${i}, ADTS type:${n}, samplingIndex:${m}`),/firefox/i.test(u)?m>=6?(n=5,o=new Array(4),r=m-3):(n=2,o=new Array(2),r=m):u.indexOf("android")!==-1?(n=2,o=new Array(2),r=m):(n=5,o=new Array(4),i&&(i.indexOf("mp4a.40.29")!==-1||i.indexOf("mp4a.40.5")!==-1)||!i&&m>=6?r=m-3:((i&&i.indexOf("mp4a.40.2")!==-1&&(m>=6&&s===1||/vivaldi/i.test(u))||!i&&s===1)&&(n=2,o=new Array(2)),r=m)),o[0]=n<<3,o[0]|=(m&14)>>1,o[1]|=(m&1)<<7,o[1]|=s<<3,n===5&&(o[1]|=(r&14)>>1,o[2]=(r&1)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:h[m],channelCount:s,codec:"mp4a.40."+n,manifestCodec:c}}function Hs(a,e){return a[e]===255&&(a[e+1]&246)===240}function Vs(a,e){return a[e+1]&1?7:9}function gs(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function to(a,e){return e+5<a.length}function Kr(a,e){return e+1<a.length&&Hs(a,e)}function io(a,e){return to(a,e)&&Hs(a,e)&&gs(a,e)<=a.length-e}function no(a,e){if(Kr(a,e)){const t=Vs(a,e);if(e+t>=a.length)return!1;const i=gs(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||Kr(a,n)}return!1}function js(a,e,t,i,n){if(!a.samplerate){const r=eo(e,t,i,n);if(!r)return;a.config=r.config,a.samplerate=r.samplerate,a.channelCount=r.channelCount,a.codec=r.codec,a.manifestCodec=r.manifestCodec,b.log(`parsed codec:${a.codec}, rate:${r.samplerate}, channels:${r.channelCount}`)}}function zs(a){return 1024*9e4/a}function ro(a,e){const t=Vs(a,e);if(e+t<=a.length){const i=gs(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ws(a,e,t,i,n){const r=zs(a.samplerate),s=i+n*r,o=ro(e,t);let u;if(o){const{frameLength:m,headerLength:p}=o,E=p+m,y=Math.max(0,t+E-e.length);y?(u=new Uint8Array(E-p),u.set(e.subarray(t+p,e.length),0)):u=e.subarray(t+p,t+E);const _={unit:u,pts:s};return y||a.samples.push(_),{sample:_,length:E,missing:y}}const c=e.length-t;return u=new Uint8Array(c),u.set(e.subarray(t,e.length),0),{sample:{unit:u,pts:s},length:c,missing:-1}}let Hr=null;const so=[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],ao=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],oo=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],lo=[0,1,1,4];function Zs(a,e,t,i,n){if(t+24>e.length)return;const r=Ys(e,t);if(r&&t+r.frameLength<=e.length){const s=r.samplesPerFrame*9e4/r.sampleRate,o=i+n*s,u={unit:e.subarray(t,t+r.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=r.channelCount,a.samplerate=r.sampleRate,a.samples.push(u),{sample:u,length:r.frameLength,missing:0}}}function Ys(a,e){const t=a[e+1]>>3&3,i=a[e+1]>>1&3,n=a[e+2]>>4&15,r=a[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&r!==3){const s=a[e+2]>>1&1,o=a[e+3]>>6,u=t===3?3-i:i===3?3:4,c=so[u*14+n-1]*1e3,m=ao[(t===3?0:t===2?1:2)*3+r],p=o===3?1:2,E=oo[t][i],y=lo[i],_=E*8*y,T=Math.floor(E*c/m+s)*y;if(Hr===null){const ie=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Hr=ie?parseInt(ie[1]):0}return!!Hr&&Hr<=87&&i===2&&c>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:m,channelCount:p,frameLength:T,samplesPerFrame:_}}}function ps(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Xs(a,e){return e+1<a.length&&ps(a,e)}function uo(a,e){return ps(a,e)&&4<=a.length-e}function qs(a,e){if(e+1<a.length&&ps(a,e)){const i=Ys(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const r=e+n;return r===a.length||Xs(a,r)}return!1}class co extends ms{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=L(e,0);let i=(t==null?void 0:t.length)||0;if(qs(e,i))return!1;for(let n=e.length;i<n;i++)if(no(e,i))return b.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return io(e,t)}appendFrame(e,t,i){js(e,this.observer,t,i,e.manifestCodec);const n=Ws(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const ho=/\/emsg[-/]ID3/i;class fo{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,n){const r=this.videoTrack=Yn("video",1),s=this.audioTrack=Yn("audio",1),o=this.txtTrack=Yn("text",1);if(this.id3Track=Yn("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const u=st(e);if(u.video){const{id:c,timescale:h,codec:m}=u.video;r.id=c,r.timescale=o.timescale=h,r.codec=m}if(u.audio){const{id:c,timescale:h,codec:m}=u.audio;s.id=c,s.timescale=h,s.codec=m}o.id=Yt.text,r.sampleDuration=0,r.duration=s.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return ui(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=l(this.remainderData,e));const o=Be(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const s=this.extractID3Track(n,t);return r.samples=d(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(t,this.timeOffset);return i.samples=d(e,t),{videoTrack:t,audioTrack:Yn(),id3Track:n,textTrack:Yn()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=ft(e.samples,["emsg"]);n&&n.forEach(r=>{const s=q(r);if(ho.test(s.schemeIdUri)){const o=Q(s.presentationTime)?s.presentationTime/s.timeScale:t+s.presentationTimeDelta/s.timeScale;let u=s.eventDuration===4294967295?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;u<=.001&&(u=Number.POSITIVE_INFINITY);const c=s.payload;i.samples.push({data:c,len:c.byteLength,dts:o,pts:o,type:Ki.emsg,duration:u})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const Qs=(a,e)=>{let t=0,i=5;e+=i;const n=new Uint32Array(1),r=new Uint32Array(1),s=new Uint8Array(1);for(;i>0;){s[0]=a[e];const o=Math.min(i,8),u=8-o;r[0]=4278190080>>>24+u<<u,n[0]=(s[0]&r[0])>>u,t=t?t<<o|n[0]:n[0],e+=1,i-=o}return t};class mo extends ms{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){const n=Js(e,t,i,this.basePTS,this.frameIndex);if(n!==-1)return{sample:e.samples[e.samples.length-1],length:n,missing:0}}static probe(e){if(!e)return!1;const t=L(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&I(t)!==void 0&&Qs(e,i)<16}}function Js(a,e,t,i,n){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const r=e[t+4]>>6;if(r>=3)return-1;const o=[48e3,44100,32e3][r],u=e[t+4]&63,h=[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][u*3+r]*2;if(t+h>e.length)return-1;const m=e[t+6]>>5;let p=0;m===2?p+=2:(m&1&&m!==1&&(p+=2),m&4&&(p+=2));const E=(e[t+6]<<8|e[t+7])>>12-p&1,_=[2,1,2,3,3,4,4,5][m]+E,T=e[t+5]>>3,k=e[t+5]&7,te=new Uint8Array([r<<6|T<<1|k>>2,(k&3)<<6|m<<3|E<<2|u>>4,u<<4&224]),ie=1536/o*9e4,be=i+n*ie,re=e.subarray(t,t+h);return a.config=te,a.channelCount=_,a.samplerate=o,a.samples.push({unit:re,pts:be}),h}class go{constructor(){this.VideoSample=null}createVideoSample(e,t,i,n){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:n,length:0}}getLastNalUnit(e){var t;let i=this.VideoSample,n;if((!i||i.units.length===0)&&(i=e[e.length-1]),(t=i)!=null&&t.units){const r=i.units;n=r[r.length-1]}return n}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const i=t.samples,n=i.length;if(n){const r=i[n-1];e.pts=r.pts,e.dts=r.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&b.log(e.pts+"/"+e.dts+":"+e.debug)}}class ea{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,n=new Uint8Array(4),r=Math.min(4,t);if(r===0)throw new Error("no bytes available");n.set(e.subarray(i,i+r)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=r*8,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&b.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,i=8,n;for(let r=0;r<e;r++)i!==0&&(n=this.readEG(),i=(t+n+256)%256),t=i===0?t:i}readSPS(){let e=0,t=0,i=0,n=0,r,s,o;const u=this.readUByte.bind(this),c=this.readBits.bind(this),h=this.readUEG.bind(this),m=this.readBoolean.bind(this),p=this.skipBits.bind(this),E=this.skipEG.bind(this),y=this.skipUEG.bind(this),_=this.skipScalingList.bind(this);u();const T=u();if(c(5),p(3),u(),y(),T===100||T===110||T===122||T===244||T===44||T===83||T===86||T===118||T===128){const Me=h();if(Me===3&&p(1),y(),y(),p(1),m())for(s=Me!==3?8:12,o=0;o<s;o++)m()&&(o<6?_(16):_(64))}y();const k=h();if(k===0)h();else if(k===1)for(p(1),E(),E(),r=h(),o=0;o<r;o++)E();y(),p(1);const te=h(),ie=h(),be=c(1);be===0&&p(1),p(1),m()&&(e=h(),t=h(),i=h(),n=h());let re=[1,1];if(m()&&m())switch(u()){case 1:re=[1,1];break;case 2:re=[12,11];break;case 3:re=[10,11];break;case 4:re=[16,11];break;case 5:re=[40,33];break;case 6:re=[24,11];break;case 7:re=[20,11];break;case 8:re=[32,11];break;case 9:re=[80,33];break;case 10:re=[18,11];break;case 11:re=[15,11];break;case 12:re=[64,33];break;case 13:re=[160,99];break;case 14:re=[4,3];break;case 15:re=[3,2];break;case 16:re=[2,1];break;case 255:{re=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((te+1)*16-e*2-t*2),height:(2-be)*(ie+1)*16-(be?2:4)*(i+n),pixelRatio:re}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class po extends go{parseAVCPES(e,t,i,n,r){const s=this.parseAVCNALu(e,i.data);let o=this.VideoSample,u,c=!1;i.data=null,o&&s.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"")),s.forEach(h=>{var m;switch(h.type){case 1:{let _=!1;u=!0;const T=h.data;if(c&&T.length>4){const k=new ea(T).readSliceType();(k===2||k===4||k===7||k===9)&&(_=!0)}if(_){var p;(p=o)!=null&&p.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),o.frame=!0,o.key=_;break}case 5:u=!0,(m=o)!=null&&m.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),o.key=!0,o.frame=!0;break;case 6:{u=!0,S(h.data,1,i.pts,t.samples);break}case 7:{var E,y;u=!0,c=!0;const _=h.data,k=new ea(_).readSPS();if(!e.sps||e.width!==k.width||e.height!==k.height||((E=e.pixelRatio)==null?void 0:E[0])!==k.pixelRatio[0]||((y=e.pixelRatio)==null?void 0:y[1])!==k.pixelRatio[1]){e.width=k.width,e.height=k.height,e.pixelRatio=k.pixelRatio,e.sps=[_],e.duration=r;const te=_.subarray(1,4);let ie="avc1.";for(let be=0;be<3;be++){let re=te[be].toString(16);re.length<2&&(re="0"+re),ie+=re}e.codec=ie}break}case 8:u=!0,e.pps=[h.data];break;case 9:u=!0,e.audFound=!0,o&&this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:u=!0;break;default:u=!1,o&&(o.debug+="unknown NAL "+h.type+" ");break}o&&u&&o.units.push(h)}),n&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let n=e.naluState||0;const r=n,s=[];let o=0,u,c,h,m=-1,p=0;for(n===-1&&(m=0,p=t[0]&31,n=0,o=1);o<i;){if(u=t[o++],!n){n=u?0:1;continue}if(n===1){n=u?0:2;continue}if(!u)n=3;else if(u===1){if(c=o-n-1,m>=0){const E={data:t.subarray(m,c),type:p};s.push(E)}else{const E=this.getLastNalUnit(e.samples);E&&(r&&o<=4-r&&E.state&&(E.data=E.data.subarray(0,E.data.byteLength-r)),c>0&&(E.data=l(E.data,t.subarray(0,c)),E.state=0))}o<i?(h=t[o]&31,m=o,p=h,n=0):n=-1}else n=0}if(m>=0&&n>=0){const E={data:t.subarray(m,i),type:p,state:n};s.push(E)}if(s.length===0){const E=this.getLastNalUnit(e.samples);E&&(E.data=l(E.data,t))}return e.naluState=n,s}}class vo{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new br(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const r=n.subarray(16,n.length-n.length%16),s=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(s).then(o=>{const u=new Uint8Array(o);n.set(u,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)})}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length){i();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,i=new Int8Array(t);let n=0;for(let r=32;r<e.length-16;r+=160,n+=16)i.set(e.subarray(r,r+16),n);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let n=0;for(let r=32;r<e.length-16;r+=160,n+=16)e.set(i.subarray(n,n+16),r);return e}decryptAvcSample(e,t,i,n,r){const s=U(r.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then(u=>{r.data=this.getAvcDecryptedUnit(s,u),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)})}decryptAvcSamples(e,t,i,n){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length){n();return}const r=e[t].units;for(;!(i>=r.length);i++){const s=r[i];if(!(s.data.length<=48||s.type!==1&&s.type!==5)&&(this.decryptAvcSample(e,t,i,n,s),!this.decrypter.isSync()))return}}}}const dn=188;class ur{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._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=e,this.config=t,this.typeSupported=i,this.videoParser=new po}static probe(e){const t=ur.syncOffset(e);return t>0&&b.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let i=Math.min(dn*5,t-dn)+1,n=0;for(;n<i;){let r=!1,s=-1,o=0;for(let u=n;u<t;u+=dn)if(e[u]===71&&(t-u===dn||e[u+dn]===71)){if(o++,s===-1&&(s=u,s!==0&&(i=Math.min(s+dn*99,e.length-dn)+1)),r||(r=vs(e,u)===0),r&&o>1&&(s===0&&o>2||u+dn>i))return s}else{if(o)return-1;break}n++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:Yt[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,i,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=ur.createTrack("video"),this._audioTrack=ur.createTrack("audio",n),this._id3Track=ur.createTrack("id3"),this._txtTrack=ur.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,n=!1){i||(this.sampleAes=null);let r;const s=this._videoTrack,o=this._audioTrack,u=this._id3Track,c=this._txtTrack;let h=s.pid,m=s.pesData,p=o.pid,E=u.pid,y=o.pesData,_=u.pesData,T=null,k=this.pmtParsed,te=this._pmtId,ie=e.length;if(this.remainderData&&(e=l(this.remainderData,e),ie=e.length,this.remainderData=null),ie<dn&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:s,id3Track:u,textTrack:c};const be=Math.max(0,ur.syncOffset(e));ie-=(ie-be)%dn,ie<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,ie,e.buffer.byteLength-ie));let re=0;for(let xe=be;xe<ie;xe+=dn)if(e[xe]===71){const Je=!!(e[xe+1]&64),ht=vs(e,xe),Ie=(e[xe+3]&48)>>4;let et;if(Ie>1){if(et=xe+5+e[xe+4],et===xe+dn)continue}else et=xe+4;switch(ht){case h:Je&&(m&&(r=Tr(m))&&this.videoParser.parseAVCPES(s,c,r,!1,this._duration),m={data:[],size:0}),m&&(m.data.push(e.subarray(et,xe+dn)),m.size+=xe+dn-et);break;case p:if(Je){if(y&&(r=Tr(y)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,r);break;case"mp3":this.parseMPEGPES(o,r);break;case"ac3":this.parseAC3PES(o,r);break}y={data:[],size:0}}y&&(y.data.push(e.subarray(et,xe+dn)),y.size+=xe+dn-et);break;case E:Je&&(_&&(r=Tr(_))&&this.parseID3PES(u,r),_={data:[],size:0}),_&&(_.data.push(e.subarray(et,xe+dn)),_.size+=xe+dn-et);break;case 0:Je&&(et+=e[et]+1),te=this._pmtId=yo(e,et);break;case te:{Je&&(et+=e[et]+1);const ri=Eo(e,et,this.typeSupported,i,this.observer);h=ri.videoPid,h>0&&(s.pid=h,s.segmentCodec=ri.segmentVideoCodec),p=ri.audioPid,p>0&&(o.pid=p,o.segmentCodec=ri.segmentAudioCodec),E=ri.id3Pid,E>0&&(u.pid=E),T!==null&&!k&&(b.warn(`MPEG-TS PMT found at ${xe} after unknown PID '${T}'. Backtracking to sync byte @${be} to parse all TS packets.`),T=null,xe=be-188),k=this.pmtParsed=!0;break}case 17:case 8191:break;default:T=ht;break}}else re++;re>0&&Vr(this.observer,new Error(`Found ${re} TS packet/s that do not start with 0x47`)),s.pesData=m,o.pesData=y,u.pesData=_;const Me={audioTrack:o,videoTrack:s,id3Track:u,textTrack:c};return n&&this.extractRemainingSamples(Me),Me}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:n,textTrack:r}=e,s=i.pesData,o=t.pesData,u=n.pesData;let c;if(s&&(c=Tr(s))?(this.videoParser.parseAVCPES(i,r,c,!0,this._duration),i.pesData=null):i.pesData=s,o&&(c=Tr(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,c);break;case"mp3":this.parseMPEGPES(t,c);break;case"ac3":this.parseAC3PES(t,c);break}t.pesData=null}else o!=null&&o.size&&b.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;u&&(c=Tr(u))?(this.parseID3PES(n,c),n.pesData=null):n.pesData=u}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new vo(this.observer,this.config,t);return this.decrypt(n,r)}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:r}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,()=>{i(e)}):i(e)}):r.samples&&t.decryptAvcSamples(r.samples,0,0,()=>{i(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let r=t.data;if(n){this.aacOverFlow=null;const m=n.missing,p=n.sample.unit.byteLength;if(m===-1)r=l(n.sample.unit,r);else{const E=p-m;n.sample.unit.set(r.subarray(0,m),E),e.samples.push(n.sample),i=n.missing}}let s,o;for(s=i,o=r.length;s<o-1&&!Kr(r,s);s++);if(s!==i){let m;const p=s<o-1;if(p?m=`AAC PES did not start with ADTS header,offset:${s}`:m="No ADTS header found in AAC PES",Vr(this.observer,new Error(m),p),!p)return}js(e,this.observer,r,s,this.audioCodec);let u;if(t.pts!==void 0)u=t.pts;else if(n){const m=zs(e.samplerate);u=n.sample.pts+m}else{b.warn("[tsdemuxer]: AAC PES unknown PTS");return}let c=0,h;for(;s<o;)if(h=Ws(e,r,s,u,c),s+=h.length,h.missing){this.aacOverFlow=h;break}else for(c++;s<o-1&&!Kr(r,s);s++);}parseMPEGPES(e,t){const i=t.data,n=i.length;let r=0,s=0;const o=t.pts;if(o===void 0){b.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;s<n;)if(Xs(i,s)){const u=Zs(e,i,s,o,r);if(u)s+=u.length,r++;else break}else s++}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(n===void 0){b.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const r=i.length;let s=0,o=0,u;for(;o<r&&(u=Js(e,i,o,n,s++))>0;)o+=u}}parseID3PES(e,t){if(t.pts===void 0){b.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=ae({},t,{type:this._videoTrack?Ki.emsg:Ki.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function vs(a,e){return((a[e+1]&31)<<8)+a[e+2]}function yo(a,e){return(a[e+10]&31)<<8|a[e+11]}function Eo(a,e,t,i,n){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},s=(a[e+1]&15)<<8|a[e+2],o=e+3+s-4,u=(a[e+10]&15)<<8|a[e+11];for(e+=12+u;e<o;){const c=vs(a,e),h=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){ys("ADTS AAC");break}case 15:r.audioPid===-1&&(r.audioPid=c);break;case 21:r.id3Pid===-1&&(r.id3Pid=c);break;case 219:if(!i){ys("H.264");break}case 27:r.videoPid===-1&&(r.videoPid=c,r.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?b.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=c,r.segmentAudioCodec="mp3");break;case 193:if(!i){ys("AC-3");break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=c,r.segmentAudioCodec="ac3"):b.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&h>0){let m=e+5,p=h;for(;p>2;){switch(a[m]){case 106:t.ac3!==!0?b.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=c,r.segmentAudioCodec="ac3");break}const y=a[m+1]+2;m+=y,p-=y}}break;case 194:case 135:return Vr(n,new Error("Unsupported EC-3 in M2TS found")),r;case 36:return Vr(n,new Error("Unsupported HEVC in M2TS found")),r}e+=h+5}return r}function Vr(a,e,t){b.warn(`parsing error: ${e.message}`),a.emit(f.ERROR,f.ERROR,{type:N.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function ys(a){b.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Tr(a){let e=0,t,i,n,r,s;const o=a.data;if(!a||a.size===0)return null;for(;o[0].length<19&&o.length>1;)o[0]=l(o[0],o[1]),o.splice(1,1);if(t=o[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(i=(t[4]<<8)+t[5],i&&i>a.size-6)return null;const c=t[7];c&192&&(r=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,c&64?(s=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,r-s>60*9e4&&(b.warn(`${Math.round((r-s)/9e4)}s delta between PTS and DTS, align them`),r=s)):s=r),n=t[8];let h=n+9;if(a.size<=h)return null;a.size-=h;const m=new Uint8Array(a.size);for(let p=0,E=o.length;p<E;p++){t=o[p];let y=t.byteLength;if(h)if(h>y){h-=y;continue}else t=t.subarray(h),y-=h,h=0;m.set(t,e),e+=y}return i&&(i-=n+3),{data:m,pts:r,dts:s,len:i}}return null}class _o extends ms{resetInitSegment(e,t,i,n){super.resetInitSegment(e,t,i,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:n,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=L(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&I(t)!==void 0&&Qs(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(qs(e,i))return b.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return uo(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return Zs(e,t,i,this.basePTS,this.frameIndex)}}class ta{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const cr=Math.pow(2,32)-1;class ue{static init(){ue.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in ue.types)ue.types.hasOwnProperty(e)&&(ue.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);ue.HDLR_TYPES={video:t,audio:i};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);ue.STTS=ue.STSC=ue.STCO=r,ue.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ue.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),ue.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),ue.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);ue.FTYP=ue.box(ue.types.ftyp,s,u,s,o),ue.DINF=ue.box(ue.types.dinf,ue.box(ue.types.dref,n))}static box(e,...t){let i=8,n=t.length;const r=n;for(;n--;)i+=t[n].byteLength;const s=new Uint8Array(i);for(s[0]=i>>24&255,s[1]=i>>16&255,s[2]=i>>8&255,s[3]=i&255,s.set(e,4),n=0,i=8;n<r;n++)s.set(t[n],i),i+=t[n].byteLength;return s}static hdlr(e){return ue.box(ue.types.hdlr,ue.HDLR_TYPES[e])}static mdat(e){return ue.box(ue.types.mdat,e)}static mdhd(e,t){t*=e;const i=Math.floor(t/(cr+1)),n=Math.floor(t%(cr+1));return ue.box(ue.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,85,196,0,0]))}static mdia(e){return ue.box(ue.types.mdia,ue.mdhd(e.timescale,e.duration),ue.hdlr(e.type),ue.minf(e))}static mfhd(e){return ue.box(ue.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?ue.box(ue.types.minf,ue.box(ue.types.smhd,ue.SMHD),ue.DINF,ue.stbl(e)):ue.box(ue.types.minf,ue.box(ue.types.vmhd,ue.VMHD),ue.DINF,ue.stbl(e))}static moof(e,t,i){return ue.box(ue.types.moof,ue.mfhd(e),ue.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=ue.trak(e[t]);return ue.box.apply(null,[ue.types.moov,ue.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(ue.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=ue.trex(e[t]);return ue.box.apply(null,[ue.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/(cr+1)),n=Math.floor(t%(cr+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,i>>24,i>>16&255,i>>8&255,i&255,n>>24,n>>16&255,n>>8&255,n&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return ue.box(ue.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,r;for(n=0;n<t.length;n++)r=t[n].flags,i[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return ue.box(ue.types.sdtp,i)}static stbl(e){return ue.box(ue.types.stbl,ue.stsd(e),ue.box(ue.types.stts,ue.STTS),ue.box(ue.types.stsc,ue.STSC),ue.box(ue.types.stsz,ue.STSZ),ue.box(ue.types.stco,ue.STCO))}static avc1(e){let t=[],i=[],n,r,s;for(n=0;n<e.sps.length;n++)r=e.sps[n],s=r.byteLength,t.push(s>>>8&255),t.push(s&255),t=t.concat(Array.prototype.slice.call(r));for(n=0;n<e.pps.length;n++)r=e.pps[n],s=r.byteLength,i.push(s>>>8&255),i.push(s&255),i=i.concat(Array.prototype.slice.call(r));const o=ue.box(ue.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(i))),u=e.width,c=e.height,h=e.pixelRatio[0],m=e.pixelRatio[1];return ue.box(ue.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,c>>8&255,c&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,ue.box(ue.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),ue.box(ue.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,m>>24,m>>16&255,m>>8&255,m&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return ue.box(ue.types.mp4a,ue.audioStsd(e),ue.box(ue.types.esds,ue.esds(e)))}static mp3(e){return ue.box(ue.types[".mp3"],ue.audioStsd(e))}static ac3(e){return ue.box(ue.types["ac-3"],ue.audioStsd(e),ue.box(ue.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?ue.box(ue.types.stsd,ue.STSD,ue.mp3(e)):e.segmentCodec==="ac3"?ue.box(ue.types.stsd,ue.STSD,ue.ac3(e)):ue.box(ue.types.stsd,ue.STSD,ue.mp4a(e)):ue.box(ue.types.stsd,ue.STSD,ue.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,n=e.width,r=e.height,s=Math.floor(i/(cr+1)),o=Math.floor(i%(cr+1));return ue.box(ue.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,n&255,0,0,r>>8&255,r&255,0,0]))}static traf(e,t){const i=ue.sdtp(e),n=e.id,r=Math.floor(t/(cr+1)),s=Math.floor(t%(cr+1));return ue.box(ue.types.traf,ue.box(ue.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255])),ue.box(ue.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&255])),ue.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,ue.box(ue.types.trak,ue.tkhd(e),ue.mdia(e))}static trex(e){const t=e.id;return ue.box(ue.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],n=i.length,r=12+16*n,s=new Uint8Array(r);let o,u,c,h,m,p;for(t+=8+r,s.set([e.type==="video"?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,n&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<n;o++)u=i[o],c=u.duration,h=u.size,m=u.flags,p=u.cts,s.set([c>>>24&255,c>>>16&255,c>>>8&255,c&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,m.isLeading<<2|m.dependsOn,m.isDependedOn<<6|m.hasRedundancy<<4|m.paddingValue<<1|m.isNonSync,m.degradPrio&61440,m.degradPrio&15,p>>>24&255,p>>>16&255,p>>>8&255,p&255],12+16*o);return ue.box(ue.types.trun,s)}static initSegment(e){ue.types||ue.init();const t=ue.moov(e);return l(ue.FTYP,t)}}ue.types=void 0,ue.HDLR_TYPES=void 0,ue.STTS=void 0,ue.STSC=void 0,ue.STCO=void 0,ue.STSZ=void 0,ue.VMHD=void 0,ue.SMHD=void 0,ue.STSD=void 0,ue.FTYP=void 0,ue.DINF=void 0;const ia=9e4;function Es(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function xo(a,e,t=1,i=!1){return Es(a,e,1/t,i)}function Or(a,e=!1){return Es(a,1e3,1/ia,e)}function So(a,e=1){return Es(a,ia,1/e)}const bo=10*1e3,na=1024,To=1152,Ao=1536;let Ar=null,_s=null;class jr{constructor(e,t,i,n=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,Ar===null){const s=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ar=s?parseInt(s[1]):0}if(_s===null){const r=navigator.userAgent.match(/Safari\/(\d+)/i);_s=r?parseInt(r[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){b.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){b.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){b.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((r,s)=>{let o=s.pts,u=o-r;return u<-4294967296&&(t=!0,o=Un(o,i),u=o-r),u>0?r:o},i);return t&&b.debug("PTS rollover detected"),n}remux(e,t,i,n,r,s,o,u){let c,h,m,p,E,y,_=r,T=r;const k=e.pid>-1,te=t.pid>-1,ie=t.samples.length,be=e.samples.length>0,re=o&&ie>0||ie>1;if((!k||be)&&(!te||re)||this.ISGenerated||o){if(this.ISGenerated){var xe,Je,ht,Ie;const ti=this.videoTrackConfig;ti&&(t.width!==ti.width||t.height!==ti.height||((xe=t.pixelRatio)==null?void 0:xe[0])!==((Je=ti.pixelRatio)==null?void 0:Je[0])||((ht=t.pixelRatio)==null?void 0:ht[1])!==((Ie=ti.pixelRatio)==null?void 0:Ie[1]))&&this.resetInitSegment()}else m=this.generateIS(e,t,r,s);const et=this.isVideoContiguous;let ri=-1,Et;if(re&&(ri=Co(t.samples),!et&&this.config.forceKeyFrameOnDiscontinuity))if(y=!0,ri>0){b.warn(`[mp4-remuxer]: Dropped ${ri} out of ${ie} video samples due to a missing keyframe`);const ti=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(ri),t.dropped+=ri,T+=(t.samples[0].pts-ti)/t.inputTimeScale,Et=T}else ri===-1&&(b.warn(`[mp4-remuxer]: No keyframe found out of ${ie} video samples`),y=!1);if(this.ISGenerated){if(be&&re){const ti=this.getVideoStartPts(t.samples),zt=(Un(e.samples[0].pts,ti)-ti)/t.inputTimeScale;_+=Math.max(0,zt),T+=Math.max(0,-zt)}if(be){if(e.samplerate||(b.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),m=this.generateIS(e,t,r,s)),h=this.remuxAudio(e,_,this.isAudioContiguous,s,te||re||u===ot.AUDIO?T:void 0),re){const ti=h?h.endPTS-h.startPTS:0;t.inputTimeScale||(b.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),m=this.generateIS(e,t,r,s)),c=this.remuxVideo(t,T,et,ti)}}else re&&(c=this.remuxVideo(t,T,et,0));c&&(c.firstKeyFrame=ri,c.independent=ri!==-1,c.firstKeyFramePTS=Et)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(E=ra(i,r,this._initPTS,this._initDTS)),n.samples.length&&(p=sa(n,r,this._initPTS))),{audio:h,video:c,initSegment:m,independent:y,text:p,id3:E}}generateIS(e,t,i,n){const r=e.samples,s=t.samples,o=this.typeSupported,u={},c=this._initPTS;let h=!c||n,m="audio/mp4",p,E,y;if(h&&(p=E=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(m="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}u.audio={id:"audio",container:m,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):ue.initSegment([e]),metadata:{channelCount:e.channelCount}},h&&(y=e.inputTimeScale,!c||y!==c.timescale?p=E=r[0].pts-Math.round(y*i):h=!1)}if(t.sps&&t.pps&&s.length){if(t.timescale=t.inputTimeScale,u.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:ue.initSegment([t]),metadata:{width:t.width,height:t.height}},h)if(y=t.inputTimeScale,!c||y!==c.timescale){const _=this.getVideoStartPts(s),T=Math.round(y*i);E=Math.min(E,Un(s[0].dts,_)-T),p=Math.min(p,_-T)}else h=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(u).length)return this.ISGenerated=!0,h?(this._initPTS={baseTime:p,timescale:y},this._initDTS={baseTime:E,timescale:y}):p=y=void 0,{tracks:u,initPTS:p,timescale:y}}remuxVideo(e,t,i,n){const r=e.inputTimeScale,s=e.samples,o=[],u=s.length,c=this._initPTS;let h=this.nextAvcDts,m=8,p=this.videoSampleDuration,E,y,_=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,k=!1;if(!i||h===null){const kt=t*r,_t=s[0].pts-Un(s[0].dts,s[0].pts);Ar&&h!==null&&Math.abs(kt-_t-h)<15e3?i=!0:h=kt-_t}const te=c.baseTime*r/c.timescale;for(let kt=0;kt<u;kt++){const _t=s[kt];_t.pts=Un(_t.pts-te,h),_t.dts=Un(_t.dts-te,h),_t.dts<s[kt>0?kt-1:kt].dts&&(k=!0)}k&&s.sort(function(kt,_t){const Ii=kt.dts-_t.dts,mi=kt.pts-_t.pts;return Ii||mi}),E=s[0].dts,y=s[s.length-1].dts;const ie=y-E,be=ie?Math.round(ie/(u-1)):p||e.inputTimeScale/30;if(i){const kt=E-h,_t=kt>be,Ii=kt<-1;if((_t||Ii)&&(_t?b.warn(`AVC: ${Or(kt,!0)} ms (${kt}dts) hole between fragments detected at ${t.toFixed(3)}`):b.warn(`AVC: ${Or(-kt,!0)} ms (${kt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Ii||h>=s[0].pts||Ar)){E=h;const mi=s[0].pts-kt;if(_t)s[0].dts=E,s[0].pts=mi;else for(let ki=0;ki<s.length&&!(s[ki].dts>mi);ki++)s[ki].dts-=kt,s[ki].pts-=kt;b.log(`Video: Initial PTS/DTS adjusted: ${Or(mi,!0)}/${Or(E,!0)}, delta: ${Or(kt,!0)} ms`)}}E=Math.max(0,E);let re=0,Me=0,xe=E;for(let kt=0;kt<u;kt++){const _t=s[kt],Ii=_t.units,mi=Ii.length;let ki=0;for(let sn=0;sn<mi;sn++)ki+=Ii[sn].data.length;Me+=ki,re+=mi,_t.length=ki,_t.dts<xe?(_t.dts=xe,xe+=be/4|0||1):xe=_t.dts,_=Math.min(_t.pts,_),T=Math.max(_t.pts,T)}y=s[u-1].dts;const Je=Me+4*re+8;let ht;try{ht=new Uint8Array(Je)}catch(kt){this.observer.emit(f.ERROR,f.ERROR,{type:N.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:kt,bytes:Je,reason:`fail allocating video mdat ${Je}`});return}const Ie=new DataView(ht.buffer);Ie.setUint32(0,Je),ht.set(ue.types.mdat,4);let et=!1,ri=Number.POSITIVE_INFINITY,Et=Number.POSITIVE_INFINITY,ti=Number.NEGATIVE_INFINITY,qt=Number.NEGATIVE_INFINITY;for(let kt=0;kt<u;kt++){const _t=s[kt],Ii=_t.units;let mi=0;for(let hn=0,yn=Ii.length;hn<yn;hn++){const Kn=Ii[hn],Pr=Kn.data,Gs=Kn.data.byteLength;Ie.setUint32(m,Gs),m+=4,ht.set(Pr,m),m+=Gs,mi+=4+Gs}let ki;if(kt<u-1)p=s[kt+1].dts-_t.dts,ki=s[kt+1].pts-_t.pts;else{const hn=this.config,yn=kt>0?_t.dts-s[kt-1].dts:be;if(ki=kt>0?_t.pts-s[kt-1].pts:be,hn.stretchShortVideoTrack&&this.nextAudioPts!==null){const Kn=Math.floor(hn.maxBufferHole*r),Pr=(n?_+n*r:this.nextAudioPts)-_t.pts;Pr>Kn?(p=Pr-yn,p<0?p=yn:et=!0,b.log(`[mp4-remuxer]: It is approximately ${Pr/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=yn}else p=yn}const sn=Math.round(_t.pts-_t.dts);ri=Math.min(ri,p),ti=Math.max(ti,p),Et=Math.min(Et,ki),qt=Math.max(qt,ki),o.push(new aa(_t.key,p,mi,sn))}if(o.length){if(Ar){if(Ar<70){const kt=o[0].flags;kt.dependsOn=2,kt.isNonSync=0}}else if(_s&&qt-Et<ti-ri&&be/ti<.025&&o[0].cts===0){b.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let kt=E;for(let _t=0,Ii=o.length;_t<Ii;_t++){const mi=kt+o[_t].duration,ki=kt+o[_t].cts;if(_t<Ii-1){const sn=mi+o[_t+1].cts;o[_t].duration=sn-ki}else o[_t].duration=_t?o[_t-1].duration:be;o[_t].cts=0,kt=mi}}}p=et||!p?be:p,this.nextAvcDts=h=y+p,this.videoSampleDuration=p,this.isVideoContiguous=!0;const Pi={data1:ue.moof(e.sequenceNumber++,E,ae({},e,{samples:o})),data2:ht,startPTS:_/r,endPTS:(T+p)/r,startDTS:E/r,endDTS:h/r,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,Pi}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return To;case"ac3":return Ao;default:return na}}remuxAudio(e,t,i,n,r){const s=e.inputTimeScale,o=e.samplerate?e.samplerate:s,u=s/o,c=this.getSamplesPerFrame(e),h=c*u,m=this._initPTS,p=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,E=[],y=r!==void 0;let _=e.samples,T=p?0:8,k=this.nextAudioPts||-1;const te=t*s,ie=m.baseTime*s/m.timescale;if(this.isAudioContiguous=i=i||_.length&&k>0&&(n&&Math.abs(te-k)<9e3||Math.abs(Un(_[0].pts-ie,te)-k)<20*h),_.forEach(function(zt){zt.pts=Un(zt.pts-ie,te)}),!i||k<0){if(_=_.filter(zt=>zt.pts>=0),!_.length)return;r===0?k=0:n&&!y?k=Math.max(0,te):k=_[0].pts}if(e.segmentCodec==="aac"){const zt=this.config.maxAudioFramesDrift;for(let Ri=0,Pi=k;Ri<_.length;Ri++){const kt=_[Ri],_t=kt.pts,Ii=_t-Pi,mi=Math.abs(1e3*Ii/s);if(Ii<=-zt*h&&y)Ri===0&&(b.warn(`Audio frame @ ${(_t/s).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*Ii/s)} ms.`),this.nextAudioPts=k=Pi=_t);else if(Ii>=zt*h&&mi<bo&&y){let ki=Math.round(Ii/h);Pi=_t-ki*h,Pi<0&&(ki--,Pi+=h),Ri===0&&(this.nextAudioPts=k=Pi),b.warn(`[mp4-remuxer]: Injecting ${ki} audio frame @ ${(Pi/s).toFixed(3)}s due to ${Math.round(1e3*Ii/s)} ms gap.`);for(let sn=0;sn<ki;sn++){const hn=Math.max(Pi,0);let yn=ta.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);yn||(b.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),yn=kt.unit.subarray()),_.splice(Ri,0,{unit:yn,pts:hn}),Pi+=h,Ri++}}kt.pts=Pi,Pi+=h}}let be=null,re=null,Me,xe=0,Je=_.length;for(;Je--;)xe+=_[Je].unit.byteLength;for(let zt=0,Ri=_.length;zt<Ri;zt++){const Pi=_[zt],kt=Pi.unit;let _t=Pi.pts;if(re!==null){const mi=E[zt-1];mi.duration=Math.round((_t-re)/u)}else if(i&&e.segmentCodec==="aac"&&(_t=k),be=_t,xe>0){xe+=T;try{Me=new Uint8Array(xe)}catch(mi){this.observer.emit(f.ERROR,f.ERROR,{type:N.MUX_ERROR,details:K.REMUX_ALLOC_ERROR,fatal:!1,error:mi,bytes:xe,reason:`fail allocating audio mdat ${xe}`});return}p||(new DataView(Me.buffer).setUint32(0,xe),Me.set(ue.types.mdat,4))}else return;Me.set(kt,T);const Ii=kt.byteLength;T+=Ii,E.push(new aa(!0,c,Ii,0)),re=_t}const ht=E.length;if(!ht)return;const Ie=E[E.length-1];this.nextAudioPts=k=re+u*Ie.duration;const et=p?new Uint8Array(0):ue.moof(e.sequenceNumber++,be/u,ae({},e,{samples:E}));e.samples=[];const ri=be/s,Et=k/s,qt={data1:et,data2:Me,startPTS:ri,endPTS:Et,startDTS:ri,endDTS:Et,type:"audio",hasAudio:!0,hasVideo:!1,nb:ht};return this.isAudioContiguous=!0,qt}remuxEmptyAudio(e,t,i,n){const r=e.inputTimeScale,s=e.samplerate?e.samplerate:r,o=r/s,u=this.nextAudioPts,c=this._initDTS,h=c.baseTime*9e4/c.timescale,m=(u!==null?u:n.startDTS*r)+h,p=n.endDTS*r+h,E=o*na,y=Math.ceil((p-m)/E),_=ta.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(b.warn("[mp4-remuxer]: remux empty Audio"),!_){b.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const T=[];for(let k=0;k<y;k++){const te=m+k*E;T.push({unit:_,pts:te,dts:te})}return e.samples=T,this.remuxAudio(e,t,i,!1)}}function Un(a,e){let t;if(e===null)return a;for(e<a?t=-8589934592:t=8589934592;Math.abs(a-e)>4294967296;)a+=t;return a}function Co(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function ra(a,e,t,i){const n=a.samples.length;if(!n)return;const r=a.inputTimeScale;for(let o=0;o<n;o++){const u=a.samples[o];u.pts=Un(u.pts-t.baseTime*r/t.timescale,e*r)/r,u.dts=Un(u.dts-i.baseTime*r/i.timescale,e*r)/r}const s=a.samples;return a.samples=[],{samples:s}}function sa(a,e,t){const i=a.samples.length;if(!i)return;const n=a.inputTimeScale;for(let s=0;s<i;s++){const o=a.samples[s];o.pts=Un(o.pts-t.baseTime*n/t.timescale,e*n)/n}a.samples.sort((s,o)=>s.pts-o.pts);const r=a.samples;return a.samples=[],{samples:r}}class aa{constructor(e,t,i,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=n,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class Ro{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(si(e,n)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const n=this.initData=st(e);n.audio&&(t=oa(n.audio,j.AUDIO)),n.video&&(i=oa(n.video,j.VIDEO));const r={};n.audio&&n.video?r.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:n.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:n.video?r.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:b.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,i,n,r,s){var o,u;let{initPTS:c,lastEndTime:h}=this;const m={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};Q(h)||(h=this.lastEndTime=r||0);const p=t.samples;if(!(p!=null&&p.length))return m;const E={initPTS:void 0,timescale:1};let y=this.initData;if((o=y)!=null&&o.length||(this.generateInitSegment(p),y=this.initData),!((u=y)!=null&&u.length))return b.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),m;this.emitInitSegment&&(E.tracks=this.initTracks,this.emitInitSegment=!1);const _=ni(p,y),T=Ei(y,p),k=T===null?r:T;(Lo(c,k,r,_)||E.timescale!==c.timescale&&s)&&(E.initPTS=k-r,c&&c.timescale===1&&b.warn(`Adjusting initPTS by ${E.initPTS-c.baseTime}`),this.initPTS=c={baseTime:E.initPTS,timescale:1});const te=e?k-c.baseTime/c.timescale:h,ie=te+_;tn(y,p,c.baseTime/c.timescale),_>0?this.lastEndTime=ie:(b.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const be=!!y.audio,re=!!y.video;let Me="";be&&(Me+="audio"),re&&(Me+="video");const xe={data1:p,startPTS:te,startDTS:te,endPTS:ie,endDTS:ie,type:Me,hasAudio:be,hasVideo:re,nb:1,dropped:0};return m.audio=xe.type==="audio"?xe:void 0,m.video=xe.type!=="audio"?xe:void 0,m.initSegment=E,m.id3=ra(i,r,c,c),n.samples.length&&(m.text=sa(n,r,c)),m}}function Lo(a,e,t,i){if(a===null)return!0;const n=Math.max(i,1),r=e-a.baseTime/a.timescale;return Math.abs(r-t)>n}function oa(a,e){const t=a==null?void 0:a.codec;if(t&&t.length>4)return t;if(e===j.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return Ot(t,!1);const i="mp4a.40.5";return b.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${i}"`),i}return b.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let nr;try{nr=self.performance.now.bind(self.performance)}catch(a){b.debug("Unable to use Performance API on this environment"),nr=He==null?void 0:He.Date.now}const zr=[{demux:fo,remux:Ro},{demux:ur,remux:jr},{demux:co,remux:jr},{demux:_o,remux:jr}];zr.splice(2,0,{demux:mo,remux:jr});class la{constructor(e,t,i,n,r){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.vendor=n,this.id=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const r=i.transmuxing;r.executeStart=nr();let s=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:u}=this;n&&(this.currentTransmuxState=n);const{contiguous:c,discontinuity:h,trackSwitch:m,accurateTimeOffset:p,timeOffset:E,initSegmentChange:y}=n||o,{audioCodec:_,videoCodec:T,defaultInitPts:k,duration:te,initSegmentData:ie}=u,be=Io(s,t);if(be&&be.method==="AES-128"){const Je=this.getDecrypter();if(Je.isSync()){let ht=Je.softwareDecrypt(s,be.key.buffer,be.iv.buffer);if(i.part>-1&&(ht=Je.flush()),!ht)return r.executeEnd=nr(),xs(i);s=new Uint8Array(ht)}else return this.decryptionPromise=Je.webCryptoDecrypt(s,be.key.buffer,be.iv.buffer).then(ht=>{const Ie=this.push(ht,null,i);return this.decryptionPromise=null,Ie}),this.decryptionPromise}const re=this.needsProbing(h,m);if(re){const Je=this.configureTransmuxer(s);if(Je)return b.warn(`[transmuxer] ${Je.message}`),this.observer.emit(f.ERROR,f.ERROR,{type:N.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,fatal:!1,error:Je,reason:Je.message}),r.executeEnd=nr(),xs(i)}(h||m||y||re)&&this.resetInitSegment(ie,_,T,te,t),(h||y||re)&&this.resetInitialTimestamp(k),c||this.resetContiguity();const Me=this.transmux(s,be,E,p,i),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,r.executeEnd=nr(),Me}flush(e){const t=e.transmuxing;t.executeStart=nr();const{decrypter:i,currentTransmuxState:n,decryptionPromise:r}=this;if(r)return r.then(()=>this.flush(e));const s=[],{timeOffset:o}=n;if(i){const m=i.flush();m&&s.push(this.push(m,null,e))}const{demuxer:u,remuxer:c}=this;if(!u||!c)return t.executeEnd=nr(),[xs(e)];const h=u.flush(o);return Wr(h)?h.then(m=>(this.flushRemux(s,m,e),s)):(this.flushRemux(s,h,e),s)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:r,id3Track:s,textTrack:o}=t,{accurateTimeOffset:u,timeOffset:c}=this.currentTransmuxState;b.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const h=this.remuxer.remux(n,r,s,o,c,u,!0,this.id);e.push({remuxResult:h,chunkMeta:i}),i.transmuxing.executeEnd=nr()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;!t||!i||(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,n,r){const{demuxer:s,remuxer:o}=this;!s||!o||(s.resetInitSegment(e,t,i,n),o.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,r){let s;return t&&t.method==="SAMPLE-AES"?s=this.transmuxSampleAes(e,t,i,n,r):s=this.transmuxUnencrypted(e,i,n,r),s}transmuxUnencrypted(e,t,i,n){const{audioTrack:r,videoTrack:s,id3Track:o,textTrack:u}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,s,o,u,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,r){return this.demuxer.demuxSampleAes(e,t,i).then(s=>({remuxResult:this.remuxer.remux(s.audioTrack,s.videoTrack,s.id3Track,s.textTrack,i,n,!1,this.id),chunkMeta:r}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n,vendor:r}=this;let s;for(let p=0,E=zr.length;p<E;p++){var o;if((o=zr[p].demux)!=null&&o.probe(e)){s=zr[p];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const u=this.demuxer,c=this.remuxer,h=s.remux,m=s.demux;(!c||!(c instanceof h))&&(this.remuxer=new h(i,t,n,r)),(!u||!(u instanceof m))&&(this.demuxer=new m(i,t,n),this.probe=m.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new br(this.config)),e}}function Io(a,e){let t=null;return a.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const xs=a=>({remuxResult:{},chunkMeta:a});function Wr(a){return"then"in a&&a.then instanceof Function}class wo{constructor(e,t,i,n,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=n,this.defaultInitPts=r||null}}class Do{constructor(e,t,i,n,r,s){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=n,this.timeOffset=r,this.initSegmentChange=s}}var ua={exports:{}};(function(a){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(u,c,h){this.fn=u,this.context=c,this.once=h||!1}function r(u,c,h,m,p){if(typeof h!="function")throw new TypeError("The listener must be a function");var E=new n(h,m||u,p),y=t?t+c:c;return u._events[y]?u._events[y].fn?u._events[y]=[u._events[y],E]:u._events[y].push(E):(u._events[y]=E,u._eventsCount++),u}function s(u,c){--u._eventsCount===0?u._events=new i:delete u._events[c]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],h,m;if(this._eventsCount===0)return c;for(m in h=this._events)e.call(h,m)&&c.push(t?m.slice(1):m);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},o.prototype.listeners=function(c){var h=t?t+c:c,m=this._events[h];if(!m)return[];if(m.fn)return[m.fn];for(var p=0,E=m.length,y=new Array(E);p<E;p++)y[p]=m[p].fn;return y},o.prototype.listenerCount=function(c){var h=t?t+c:c,m=this._events[h];return m?m.fn?1:m.length:0},o.prototype.emit=function(c,h,m,p,E,y){var _=t?t+c:c;if(!this._events[_])return!1;var T=this._events[_],k=arguments.length,te,ie;if(T.fn){switch(T.once&&this.removeListener(c,T.fn,void 0,!0),k){case 1:return T.fn.call(T.context),!0;case 2:return T.fn.call(T.context,h),!0;case 3:return T.fn.call(T.context,h,m),!0;case 4:return T.fn.call(T.context,h,m,p),!0;case 5:return T.fn.call(T.context,h,m,p,E),!0;case 6:return T.fn.call(T.context,h,m,p,E,y),!0}for(ie=1,te=new Array(k-1);ie<k;ie++)te[ie-1]=arguments[ie];T.fn.apply(T.context,te)}else{var be=T.length,re;for(ie=0;ie<be;ie++)switch(T[ie].once&&this.removeListener(c,T[ie].fn,void 0,!0),k){case 1:T[ie].fn.call(T[ie].context);break;case 2:T[ie].fn.call(T[ie].context,h);break;case 3:T[ie].fn.call(T[ie].context,h,m);break;case 4:T[ie].fn.call(T[ie].context,h,m,p);break;default:if(!te)for(re=1,te=new Array(k-1);re<k;re++)te[re-1]=arguments[re];T[ie].fn.apply(T[ie].context,te)}}return!0},o.prototype.on=function(c,h,m){return r(this,c,h,m,!1)},o.prototype.once=function(c,h,m){return r(this,c,h,m,!0)},o.prototype.removeListener=function(c,h,m,p){var E=t?t+c:c;if(!this._events[E])return this;if(!h)return s(this,E),this;var y=this._events[E];if(y.fn)y.fn===h&&(!p||y.once)&&(!m||y.context===m)&&s(this,E);else{for(var _=0,T=[],k=y.length;_<k;_++)(y[_].fn!==h||p&&!y[_].once||m&&y[_].context!==m)&&T.push(y[_]);T.length?this._events[E]=T.length===1?T[0]:T:s(this,E)}return this},o.prototype.removeAllListeners=function(c){var h;return c?(h=t?t+c:c,this._events[h]&&s(this,h)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,a.exports=o})(ua);var ko=ua.exports,Ss=C(ko);class ca{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const r=e.config;this.hls=e,this.id=t,this.useWorker=!!r.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const s=(c,h)=>{h=h||{},h.frag=this.frag,h.id=this.id,c===f.ERROR&&(this.error=h.error),this.hls.trigger(c,h)};this.observer=new Ss,this.observer.on(f.FRAG_DECRYPTED,s),this.observer.on(f.ERROR,s);const o=wi(r.preferManagedMediaSource)||{isTypeSupported:()=>!1},u={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&typeof Worker!="undefined"&&(r.workerPath||Xa())){try{r.workerPath?(b.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=Qa(r.workerPath)):(b.log(`injecting Web Worker for "${t}"`),this.workerContext=qa()),this.onwmsg=m=>this.onWorkerMessage(m);const{worker:h}=this.workerContext;h.addEventListener("message",this.onwmsg),h.onerror=m=>{const p=new Error(`${m.message} (${m.filename}:${m.lineno})`);r.enableWorker=!1,b.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(f.ERROR,{type:N.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:p})},h.postMessage({cmd:"init",typeSupported:u,vendor:"",id:t,config:JSON.stringify(r)})}catch(h){b.warn(`Error setting up "${t}" Web Worker, fallback to inline`,h),this.resetWorker(),this.error=null,this.transmuxer=new la(this.observer,u,r,"",t)}return}this.transmuxer=new la(this.observer,u,r,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,n,r,s,o,u,c,h){var m,p;c.transmuxing.start=self.performance.now();const{transmuxer:E}=this,y=s?s.start:r.start,_=r.decryptdata,T=this.frag,k=!(T&&r.cc===T.cc),te=!(T&&c.level===T.level),ie=T?c.sn-T.sn:-1,be=this.part?c.part-this.part.index:-1,re=ie===0&&c.id>1&&c.id===(T==null?void 0:T.stats.chunkCount),Me=!te&&(ie===1||ie===0&&(be===1||re&&be<=0)),xe=self.performance.now();(te||ie||r.stats.parsing.start===0)&&(r.stats.parsing.start=xe),s&&(be||!Me)&&(s.stats.parsing.start=xe);const Je=!(T&&((m=r.initSegment)==null?void 0:m.url)===((p=T.initSegment)==null?void 0:p.url)),ht=new Do(k,Me,u,te,y,Je);if(!Me||k||Je){b.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${c.sn} p: ${c.part} level: ${c.level} id: ${c.id}
|
|
discontinuity: ${k}
|
|
trackSwitch: ${te}
|
|
contiguous: ${Me}
|
|
accurateTimeOffset: ${u}
|
|
timeOffset: ${y}
|
|
initSegmentChange: ${Je}`);const Ie=new wo(i,n,t,o,h);this.configureTransmuxer(Ie)}if(this.frag=r,this.part=s,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:_,chunkMeta:c,state:ht},e instanceof ArrayBuffer?[e]:[]);else if(E){const Ie=E.push(e,_,c,ht);Wr(Ie)?(E.async=!0,Ie.then(et=>{this.handleTransmuxComplete(et)}).catch(et=>{this.transmuxerError(et,c,"transmuxer-interface push error")})):(E.async=!1,this.handleTransmuxComplete(Ie))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);Wr(i)||t.async?(Wr(i)||(i=Promise.resolve(i)),i.then(r=>{this.handleFlushResult(r,e)}).catch(r=>{this.transmuxerError(r,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){b.warn(`worker message received with no ${t?"event name":"data"}`);return}const i=this.hls;if(this.hls)switch(t.event){case"init":{var n;const r=(n=this.workerContext)==null?void 0:n.objectURL;r&&self.URL.revokeObjectURL(r);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":b[t.data.logType]&&b[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function da(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!Cr(a[t].attrs,e[t].attrs))return!1;return!0}function Cr(a,e,t){const i=a["STABLE-RENDITION-ID"];return i&&!t?i===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(n=>a[n]!==e[n])}function bs(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}const ha=100;class Oo extends kr{constructor(e,t,i){super(e,t,i,"[audio-stream-controller]",ot.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(f.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(f.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(f.ERROR,this.onError,this),e.on(f.BUFFER_RESET,this.onBufferReset,this),e.on(f.BUFFER_CREATED,this.onBufferCreated,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(f.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(f.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(f.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(f.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(f.ERROR,this.onError,this),e.off(f.BUFFER_RESET,this.onBufferReset,this),e.off(f.BUFFER_CREATED,this.onBufferCreated,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(f.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(f.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:r}){if(i==="main"){const s=t.cc;this.initPTS[t.cc]={baseTime:n,timescale:r},this.log(`InitPTS for cc: ${s} found from main: ${n}`),this.videoTrackCC=s,this.state===De.WAITING_INIT_PTS&&this.tick()}}startLoad(e){if(!this.levels){this.startPosition=e,this.state=De.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(ha),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=De.IDLE):(this.loadedmetadata=!1,this.state=De.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case De.IDLE:this.doTickIdle();break;case De.WAITING_TRACK:{var e;const{levels:i,trackId:n}=this,r=i==null||(e=i[n])==null?void 0:e.details;if(r){if(this.waitForCdnTuneIn(r))break;this.state=De.WAITING_INIT_PTS}break}case De.FRAG_LOADING_WAITING_RETRY:{var t;const i=performance.now(),n=this.retryDate;if(!n||i>=n||(t=this.media)!=null&&t.seeking){const{levels:r,trackId:s}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((r==null?void 0:r[s])||null),this.state=De.IDLE}break}case De.WAITING_INIT_PTS:{const i=this.waitingData;if(i){const{frag:n,part:r,cache:s,complete:o}=i;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=De.FRAG_LOADING;const u=s.flush(),c={frag:n,part:r,payload:u,networkDetails:null};this._handleFragmentLoadProgress(c),o&&super._handleFragmentLoadComplete(c)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${n.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const u=this.getLoadPosition(),c=Oi.bufferInfo(this.mediaBuffer,u,this.config.maxBufferHole);Wn(c.end,this.config.maxFragLookUpTolerance,n)<0&&(this.log(`Waiting fragment cc (${n.cc}) @ ${n.start} cancelled because another fragment at ${c.end} is needed`),this.clearWaitingFragment())}}else this.state=De.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=De.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:n}=this,r=e.config;if(!this.buffering||!i&&(this.startFragRequested||!r.startFragPrefetch)||!(t!=null&&t[n]))return;const s=t[n],o=s.details;if(!o||o.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(o)){this.state=De.WAITING_TRACK;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,j.AUDIO,ot.AUDIO));const c=this.getFwdBufferInfo(u,ot.AUDIO);if(c===null)return;const{bufferedTrack:h,switchingTrack:m}=this;if(!m&&this._streamEnded(c,o)){e.trigger(f.BUFFER_EOS,{type:"audio"}),this.state=De.ENDED;return}const p=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,ot.MAIN),E=c.len,y=this.getMaxBufferLength(p==null?void 0:p.len),_=o.fragments,T=_[0].start;let k=this.flushing?this.getLoadPosition():c.end;if(m&&i){const re=this.getLoadPosition();h&&!Cr(m.attrs,h.attrs)&&(k=re),o.PTSKnown&&re<T&&(c.end>T||c.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=T+.05)}if(E>=y&&!m&&k<_[_.length-1].start)return;let te=this.getNextFragment(k,o),ie=!1;if(te&&this.isLoopLoading(te,k)&&(ie=!!te.gap,te=this.getNextFragmentLoopLoading(te,o,c,ot.MAIN,y)),!te){this.bufferFlushed=!0;return}const be=p&&te.start>p.end+o.targetduration;if(be||!(p!=null&&p.len)&&c.len){const re=this.getAppendedFrag(te.start,ot.MAIN);if(re===null||(ie||(ie=!!re.gap||!!be&&p.len===0),be&&!ie||ie&&c.nextStart&&c.nextStart<re.end))return}this.loadFragment(te,s,k)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new un(i))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),i?this.setInterval(ha):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=De.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=De.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(f.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:n}=this,{details:r,id:s}=t;if(!n){this.warn(`Audio tracks were reset while loading level ${s}`);return}this.log(`Audio track ${s} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const o=n[s];let u=0;if(r.live||(i=o.details)!=null&&i.live){this.checkLiveUpdate(r);const h=this.mainDetails;if(r.deltaUpdateFailed||!h)return;if(!o.details&&r.hasProgramDateTime&&h.hasProgramDateTime)xr(r,h),u=r.fragments[0].start;else{var c;u=this.alignPlaylists(r,o.details,(c=this.levelLastLoaded)==null?void 0:c.details)}}o.details=r,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!r.live)&&this.setStartPosition(this.mainDetails||r,u),this.state===De.WAITING_TRACK&&!this.waitForCdnTuneIn(r)&&(this.state=De.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:n,payload:r}=e,{config:s,trackId:o,levels:u}=this;if(!u){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const c=u[o];if(!c){this.warn("Audio track is undefined on fragment load progress");return}const h=c.details;if(!h){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const m=s.defaultAudioCodec||c.audioCodec||"mp4a.40.2";let p=this.transmuxer;p||(p=this.transmuxer=new ca(this.hls,ot.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const E=this.initPTS[i.cc],y=(t=i.initSegment)==null?void 0:t.data;if(E!==void 0){const T=n?n.index:-1,k=T!==-1,te=new Er(i.level,i.sn,i.stats.chunkCount,r.byteLength,T,k);p.push(r,y,m,"",i,n,h.totalduration,!1,te,E)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${h.startSN} ,${h.endSN}],track ${o}`);const{cache:_}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Ks,complete:!1};_.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=De.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==ot.AUDIO){if(!this.loadedmetadata&&i.type===ot.MAIN){const r=this.videoBuffer||this.media;r&&Oi.getBuffered(r).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(i.sn!=="initSegment"){this.fragPrevious=i;const r=this.switchingTrack;r&&(this.bufferedTrack=r,this.switchingTrack=null,this.hls.trigger(f.AUDIO_TRACK_SWITCHED,V({},r)))}this.fragBufferedComplete(i,n)}onError(e,t){var i;if(t.fatal){this.state=De.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ot.AUDIO,t);break;case K.AUDIO_TRACK_LOAD_ERROR:case K.AUDIO_TRACK_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===De.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===Kt.AUDIO_TRACK&&(this.state=De.IDLE);break;case K.BUFFER_APPEND_ERROR:case K.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===K.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==j.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==j.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===De.ENDED&&(this.state=De.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,ot.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:r,chunkMeta:s}=e,o=this.getCurrentContext(s);if(!o){this.resetWhenMissingContext(s);return}const{frag:u,part:c,level:h}=o,{details:m}=h,{audio:p,text:E,id3:y,initSegment:_}=r;if(this.fragContextChanged(u)||!m){this.fragmentTracker.removeFragment(u);return}if(this.state=De.PARSING,this.switchingTrack&&p&&this.completeAudioSwitch(this.switchingTrack),_!=null&&_.tracks){const T=u.initSegment||u;this._bufferInitSegment(h,_.tracks,T,s),n.trigger(f.FRAG_PARSING_INIT_SEGMENT,{frag:T,id:i,tracks:_.tracks})}if(p){const{startPTS:T,endPTS:k,startDTS:te,endDTS:ie}=p;c&&(c.elementaryStreams[j.AUDIO]={startPTS:T,endPTS:k,startDTS:te,endDTS:ie}),u.setElementaryStreamInfo(j.AUDIO,T,k,te,ie),this.bufferFragmentData(p,u,c,s)}if(y!=null&&(t=y.samples)!=null&&t.length){const T=ae({id:i,frag:u,details:m},y);n.trigger(f.FRAG_PARSING_METADATA,T)}if(E){const T=ae({id:i,frag:u,details:m},E);n.trigger(f.FRAG_PARSING_USERDATA,T)}}_bufferInitSegment(e,t,i,n){if(this.state!==De.PARSING)return;t.video&&delete t.video;const r=t.audio;if(!r)return;r.id="audio";const s=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${s}/${r.codec}]`),s&&s.split(",").length===1&&(r.levelCodec=s),this.hls.trigger(f.BUFFER_CODECS,t);const o=r.initSegment;if(o!=null&&o.byteLength){const u={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:o};this.hls.trigger(f.BUFFER_APPENDING,u)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||n===en.NOT_LOADED||n===en.PARTIAL){var r;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((r=t.details)!=null&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=De.WAITING_INIT_PTS;const s=this.mainDetails;s&&s.fragments[0].start!==t.details.fragments[0].start&&xr(t.details,s)}else this.startFragRequested=!0,super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,n=i==null?void 0:i.attrs,r=e.attrs;t&&n&&(n.CHANNELS!==r.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(f.AUDIO_TRACK_SWITCHED,V({},e))}}class Po extends xi{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.LEVEL_LOADING,this.onLevelLoading,this),e.on(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(f.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(f.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.LEVEL_LOADING,this.onLevelLoading,this),e.off(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(f.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(f.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:n,details:r}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==n){this.warn(`Audio track with id:${i} and group:${n} not found in active group ${s==null?void 0:s.groupId}`);return}const o=s.details;s.details=t.details,this.log(`Audio track ${i} "${s.name}" lang:${s.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,n=this.groupIds;let r=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(o=>(n==null?void 0:n.indexOf(o))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(p=>!i||i.indexOf(p.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(p=>p.default)&&(this.selectDefaultTrack=!1),o.forEach((p,E)=>{p.id=E});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const u=this.hls.config.audioPreference;if(!r&&u){const p=$n(u,o,tr);if(p>-1)r=o[p];else{const E=$n(u,this.tracks);r=this.tracks[E]}}let c=this.findTrackId(r);c===-1&&r&&(c=this.findTrackId(null));const h={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(f.AUDIO_TRACKS_UPDATED,h);const m=this.trackId;if(c!==-1&&m===-1)this.setAudioTrack(c);else if(o.length&&m===-1){var s;const p=new Error(`No audio track selected for current audio group-ID(s): ${(s=this.groupIds)==null?void 0:s.join(",")} track count: ${o.length}`);this.warn(p.message),this.hls.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:p})}}else this.shouldReloadPlaylist(r)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===Kt.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const n=this.currentTrack;if(n&&er(e,n,tr))return n;const r=$n(e,this.tracksInGroup,tr);if(r>-1){const s=this.tracksInGroup[r];return this.setAudioTrack(r),s}else if(n){let s=t.loadLevel;s===-1&&(s=t.firstAutoLevel);const o=ss(e,t.levels,i,s,tr);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const s=$n(e,i);if(s>-1)return i[s]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e],r=n.details&&!n.details.live;if(e===this.trackId&&n===i&&r||(this.log(`Switching to audio-track ${e} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=e,this.currentTrack=n,this.hls.trigger(f.AUDIO_TRACK_SWITCHING,V({},n)),r))return;const s=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(s)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(!(this.selectDefaultTrack&&!n.default)&&(!e||er(e,n,tr)))return i}if(e){const{name:i,lang:n,assocLang:r,characteristics:s,audioCodec:o,channels:u}=e;for(let c=0;c<t.length;c++){const h=t[c];if(er({name:i,lang:n,assocLang:r,characteristics:s,audioCodec:o,channels:u},h,tr))return c}for(let c=0;c<t.length;c++){const h=t[c];if(Cr(e.attrs,h.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return c}for(let c=0;c<t.length;c++){const h=t[c];if(Cr(e.attrs,h.attrs,["LANGUAGE"]))return c}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const i=t.id,n=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}this.log(`loading audio-track playlist ${i} "${t.name}" lang:${t.lang} group:${n}`),this.clearTimer(),this.hls.trigger(f.AUDIO_TRACK_LOADING,{url:r,id:i,groupId:n,deliveryDirectives:e||null})}}}const fa=500;class Fo extends kr{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",ot.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.ERROR,this.onError,this),e.on(f.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(f.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(f.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(f.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.ERROR,this.onError,this),e.off(f.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(f.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(f.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(f.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=De.IDLE,this.setInterval(fa),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(this.fragPrevious=i,this.state=De.IDLE,!n)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let s;const o=i.start;for(let c=0;c<r.length;c++)if(o>=r[c].start&&o<=r[c].end){s=r[c];break}const u=i.start+i.duration;s?s.end=u:(s={start:o,end:u},r.push(s)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(i===0&&n!==Number.POSITIVE_INFINITY){const r=n-1;if(r<=0)return;t.endOffsetSubtitles=Math.max(0,r),this.tracksBuffered.forEach(s=>{for(let o=0;o<s.length;){if(s[o].end<=r){s.shift();continue}else if(s[o].start<r)s[o].start=r;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(i,r,ot.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===ot.MAIN){var i;(i=this.media)!=null&&i.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===ot.SUBTITLE&&(t.details===K.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==De.STOPPED&&(this.state=De.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&da(this.levels,t)){this.levels=t.map(i=>new un(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new un(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ot.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,!((i=this.levels)!=null&&i.length)||this.currentTrackId===-1){this.clearInterval();return}const n=this.levels[this.currentTrackId];n!=null&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.setInterval(fa)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:r}=this,{details:s,id:o}=t;if(!r){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const u=r[o];if(o>=r.length||!u)return;this.log(`Subtitle track ${o} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let c=0;if(s.live||(i=u.details)!=null&&i.live){const m=this.mainDetails;if(s.deltaUpdateFailed||!m)return;const p=m.fragments[0];if(!u.details)s.hasProgramDateTime&&m.hasProgramDateTime?(xr(s,m),c=s.fragments[0].start):p&&(c=p.start,wn(s,c));else{var h;c=this.alignPlaylists(s,u.details,(h=this.levelLastLoaded)==null?void 0:h.details),c===0&&p&&(c=p.start,wn(s,c))}}u.details=s,this.levelLastLoaded=u,o===n&&(!this.startFragRequested&&(this.mainDetails||!s.live)&&this.setStartPosition(this.mainDetails||s,c),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===De.IDLE&&(Nn(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),u.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n!=null&&n.key&&n.iv&&n.method==="AES-128"){const s=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer).catch(o=>{throw r.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const u=performance.now();r.trigger(f.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:s,tdecrypt:u}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=De.IDLE})}}doTick(){if(!this.media){this.state=De.IDLE;return}if(this.state===De.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:n}=this,r=this.getLoadPosition(),s=Oi.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,n.maxBufferHole),{end:o,len:u}=s,c=this.getFwdBufferInfo(this.media,ot.MAIN),h=i.details,m=this.getMaxBufferLength(c==null?void 0:c.len)+h.levelTargetDuration;if(u>m)return;const p=h.fragments,E=p.length,y=h.edge;let _=null;const T=this.fragPrevious;if(o<y){const k=n.maxFragLookUpTolerance,te=o>y-k?0:k;_=Nn(T,p,Math.max(p[0].start,o),te),!_&&T&&T.start<p[0].start&&(_=p[0])}else _=p[E-1];if(!_)return;if(_=this.mapToInitFragWhenRequired(_),_.sn!=="initSegment"){const k=_.sn-h.startSN,te=p[k-1];te&&te.cc===_.cc&&this.fragmentTracker.getState(te)===en.NOT_LOADED&&(_=te)}this.fragmentTracker.getState(_)===en.NOT_LOADED&&this.loadFragment(_,i,o)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,i){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,i))}get mediaBufferTimeRanges(){return new Mo(this.tracksBuffered[this.currentTrackId]||[])}}class Mo{constructor(e){this.buffered=void 0;const t=(i,n,r)=>{if(n=n>>>0,n>r-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${r})`);return e[n][i]};this.buffered={get length(){return e.length},end(i){return t("end",i,e.length)},start(i){return t("start",i,e.length)}}}}class Bo extends xi{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=Ti(this.media.textTracks);for(let r=0;r<i.length;r++)if(i[r].mode==="hidden")t=i[r];else if(i[r].mode==="showing"){t=i[r];break}const n=this.findTrackForTextTrack(t);this.subtitleTrack!==n&&this.setSubtitleTrack(n)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.LEVEL_LOADING,this.onLevelLoading,this),e.on(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(f.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(f.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.LEVEL_LOADING,this.onLevelLoading,this),e.off(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(f.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(f.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Ti(this.media.textTracks).forEach(t=>{Yi(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:n,details:r}=t,s=this.tracksInGroup[i];if(!s||s.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${s==null?void 0:s.groupId}`);return}const o=s.details;s.details=t.details,this.log(`Subtitle track ${i} "${s.name}" lang:${s.lang} group:${n} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,n=this.groupIds;let r=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(s=>(n==null?void 0:n.indexOf(s))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const s=this.tracks.filter(h=>!i||i.indexOf(h.groupId)!==-1);if(s.length)this.selectDefaultTrack&&!s.some(h=>h.default)&&(this.selectDefaultTrack=!1),s.forEach((h,m)=>{h.id=m});else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=s;const o=this.hls.config.subtitlePreference;if(!r&&o){this.selectDefaultTrack=!1;const h=$n(o,s);if(h>-1)r=s[h];else{const m=$n(o,this.tracks);r=this.tracks[m]}}let u=this.findTrackId(r);u===-1&&r&&(u=this.findTrackId(null));const c={subtitleTracks:s};this.log(`Updating subtitle tracks, ${s.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(f.SUBTITLE_TRACKS_UPDATED,c),u!==-1&&this.trackId===-1&&this.setSubtitleTrack(u)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const r=t[n];if(!(i&&!r.default||!i&&!e)&&(!e||er(r,e)))return n}if(e){for(let n=0;n<t.length;n++){const r=t[n];if(Cr(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const r=t[n];if(Cr(e.attrs,r.attrs,["LANGUAGE"]))return n}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(bs(n,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===Kt.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&er(e,i))return i;const n=$n(e,this.tracksInGroup);if(n>-1){const r=this.tracksInGroup[n];return this.setSubtitleTrack(n),r}else{if(i)return null;{const r=$n(e,t);if(r>-1)return t[r]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,n=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(f.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:n,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Ti(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(r=>bs(i,r))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(r=>{r.mode!=="disabled"&&r!==n&&(r.mode="disabled")}),n){const r=this.subtitleDisplay?"showing":"hidden";n.mode!==r&&(n.mode=r)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!Q(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger(f.SUBTITLE_TRACK_SWITCH,{id:e});return}const r=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:s,groupId:o="",name:u,type:c,url:h}=n;this.hls.trigger(f.SUBTITLE_TRACK_SWITCH,{id:s,groupId:o,name:u,type:c,url:h});const m=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(m)}}class No{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const n=this.queues[t];n.push(e),n.length===1&&!i&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise(r=>{t=r}),n={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(n,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(n){b.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${n}`),i.onError(n);const r=this.buffers[e];r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const ma=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class $o{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=i=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:i,mediaSource:n}=this;this.log("Media source opened"),i&&(i.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(f.MEDIA_ATTACHED,{media:i,mediaSource:n})),n&&n.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:i,_objectUrl:n}=this;i!==n&&b.error(`Media element src was set while attaching MediaSource (${n} > ${i})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=Ai(wi(e.config.preferManagedMediaSource)),this.log=b.log.bind(b,t),this.warn=b.warn.bind(b,t),this.error=b.error.bind(b,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.BUFFER_RESET,this.onBufferReset,this),e.on(f.BUFFER_APPENDING,this.onBufferAppending,this),e.on(f.BUFFER_CODECS,this.onBufferCodecs,this),e.on(f.BUFFER_EOS,this.onBufferEos,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(f.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(f.FRAG_PARSED,this.onFragParsed,this),e.on(f.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.BUFFER_RESET,this.onBufferReset,this),e.off(f.BUFFER_APPENDING,this.onBufferAppending,this),e.off(f.BUFFER_CODECS,this.onBufferCodecs,this),e.off(f.BUFFER_EOS,this.onBufferEos,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(f.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(f.FRAG_PARSED,this.onFragParsed,this),e.off(f.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new No(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,n=wi(this.appendSource);if(i&&n){var r;const s=this.mediaSource=new n;this.log(`created media source: ${(r=s.constructor)==null?void 0:r.name}`),s.addEventListener("sourceopen",this._onMediaSourceOpen),s.addEventListener("sourceended",this._onMediaSourceEnded),s.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.addEventListener("startstreaming",this._onStartStreaming),s.addEventListener("endstreaming",this._onEndStreaming));const o=this._objectUrl=self.URL.createObjectURL(s);if(this.appendSource)try{i.removeAttribute("src");const u=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||u&&s instanceof u,ga(i),Uo(i,o),i.load()}catch(u){i.src=o}else i.src=o;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(n){this.warn(`onMediaDetaching: ${n.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&ga(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(f.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer(),this.hls.resumeBuffering()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var i;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(i=this.mediaSource)!=null&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(n){this.warn(`onBufferReset ${e}`,n)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,n=Object.keys(t);if(n.forEach(s=>{if(i){const u=this.tracks[s];if(u&&typeof u.buffer.changeType=="function"){var o;const{id:c,codec:h,levelCodec:m,container:p,metadata:E}=t[s],y=gt(u.codec,u.levelCodec),_=y==null?void 0:y.replace(ma,"$1");let T=gt(h,m);const k=(o=T)==null?void 0:o.replace(ma,"$1");if(T&&_!==k){s.slice(0,5)==="audio"&&(T=Ot(T,this.appendSource));const te=`${p};codecs=${T}`;this.appendChangeType(s,te),this.log(`switching codec ${y} to ${T}`),this.tracks[s]={buffer:u.buffer,codec:h,container:p,levelCodec:m,metadata:E,id:c}}}}else this.pendingTracks[s]=t[s]}),i)return;const r=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==r&&(this.log(`${r} bufferCodec event(s) expected ${n.join(",")}`),this.bufferCodecEventsExpected=r),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,n={execute:()=>{const r=this.sourceBuffer[e];r&&(this.log(`changing ${e} sourceBuffer type to ${t}`),r.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:r=>{this.warn(`Failed to change ${e} SourceBuffer type`,r)}};i.append(n,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:n,tracks:r}=this,{data:s,type:o,frag:u,part:c,chunkMeta:h}=t,m=h.buffering[o],p=self.performance.now();m.start=p;const E=u.stats.buffering,y=c?c.stats.buffering:null;E.start===0&&(E.start=p),y&&y.start===0&&(y.start=p);const _=r.audio;let T=!1;o==="audio"&&(_==null?void 0:_.container)==="audio/mpeg"&&(T=!this.lastMpegAudioChunk||h.id===1||this.lastMpegAudioChunk.sn!==h.sn,this.lastMpegAudioChunk=h);const k=u.start,te={execute:()=>{if(m.executeStart=self.performance.now(),T){const ie=this.sourceBuffer[o];if(ie){const be=k-ie.timestampOffset;Math.abs(be)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${k} (delta: ${be}) sn: ${u.sn})`),ie.timestampOffset=k)}}this.appendExecutor(s,o)},onStart:()=>{},onComplete:()=>{const ie=self.performance.now();m.executeEnd=m.end=ie,E.first===0&&(E.first=ie),y&&y.first===0&&(y.first=ie);const{sourceBuffer:be}=this,re={};for(const Me in be)re[Me]=Oi.getBuffered(be[Me]);this.appendErrors[o]=0,o==="audio"||o==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(f.BUFFER_APPENDED,{type:o,frag:u,part:c,chunkMeta:h,parent:u.type,timeRanges:re})},onError:ie=>{const be={type:N.MEDIA_ERROR,parent:u.type,details:K.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:u,part:c,chunkMeta:h,error:ie,err:ie,fatal:!1};if(ie.code===DOMException.QUOTA_EXCEEDED_ERR)be.details=K.BUFFER_FULL_ERROR;else{const re=++this.appendErrors[o];be.details=K.BUFFER_APPEND_ERROR,this.warn(`Failed ${re}/${i.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),re>=i.config.appendErrorMaxRetry&&(be.fatal=!0)}i.trigger(f.ERROR,be)}};n.append(te,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:i}=this,n=r=>({execute:this.removeExecutor.bind(this,r,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(f.BUFFER_FLUSHED,{type:r})},onError:s=>{this.warn(`Failed to remove from ${r} SourceBuffer`,s)}});t.type?i.append(n(t.type),t.type):this.getSourceBufferTypes().forEach(r=>{i.append(n(r),r)})}onFragParsed(e,t){const{frag:i,part:n}=t,r=[],s=n?n.elementaryStreams:i.elementaryStreams;s[j.AUDIOVIDEO]?r.push("audiovideo"):(s[j.AUDIO]&&r.push("audio"),s[j.VIDEO]&&r.push("video"));const o=()=>{const u=self.performance.now();i.stats.buffering.end=u,n&&(n.stats.buffering.end=u);const c=n?n.stats:i.stats;this.hls.trigger(f.FRAG_BUFFERED,{frag:i,part:n,stats:c,id:i.type})};r.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(o,r)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((n,r)=>{const s=this.sourceBuffer[r];return s&&(!t.type||t.type===r)&&(s.ending=!0,s.ended||(s.ended=!0,this.log(`${r} sourceBuffer now EOS`))),n&&!!(!s||s.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(r=>{const s=this.sourceBuffer[r];s&&(s.ending=!1)});const{mediaSource:n}=this;if(!n||n.readyState!=="open"){n&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${n.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),n.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.getSourceBufferTypes().length)return;const r=e.config,s=i.currentTime,o=t.levelTargetDuration,u=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(Q(u)&&u>0){const c=Math.max(u,o),h=Math.floor(s/o)*o-c;this.flushBackBuffer(s,o,h)}if(Q(r.frontBufferFlushThreshold)&&r.frontBufferFlushThreshold>0){const c=Math.max(r.maxBufferLength,r.frontBufferFlushThreshold),h=Math.max(c,o),m=Math.floor(s/o)*o+h;this.flushFrontBuffer(s,o,m)}}flushBackBuffer(e,t,i){const{details:n,sourceBuffer:r}=this;this.getSourceBufferTypes().forEach(o=>{const u=r[o];if(u){const c=Oi.getBuffered(u);if(c.length>0&&i>c.start(0)){if(this.hls.trigger(f.BACK_BUFFER_REACHED,{bufferEnd:i}),n!=null&&n.live)this.hls.trigger(f.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(u.ended&&c.end(c.length-1)-e<t*2){this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(f.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:o})}}})}flushFrontBuffer(e,t,i){const{sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(s=>{const o=n[s];if(o){const u=Oi.getBuffered(o),c=u.length;if(c<2)return;const h=u.start(c-1),m=u.end(c-1);if(i>h||e>=h&&e<=m)return;if(o.ended&&e-m<2*t){this.log(`Cannot flush ${s} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(f.BUFFER_FLUSHING,{startOffset:h,endOffset:1/0,type:s})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:i,mediaSource:n}=this,r=e.fragments[0].start+e.totalduration,s=i.duration,o=Q(n.duration)?n.duration:0;e.live&&t.config.liveDurationInfinity?(n.duration=1/0,this.updateSeekableRange(e)):(r>o&&r>s||!Q(s))&&(this.log(`Updating Media Source duration to ${r.toFixed(3)}`),n.duration=r)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&t!=null&&t.setLiveSeekableRange){const r=Math.max(0,i[0].start),s=Math.max(r,r+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${r}-${s}.`),t.setLiveSeekableRange(r,s)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,n=Object.keys(i).length;if(n&&(!e||n===2||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const r=this.getSourceBufferTypes();if(r.length)this.hls.trigger(f.BUFFER_CREATED,{tracks:this.tracks}),r.forEach(s=>{t.executeNext(s)});else{const s=new Error("could not create source buffer for media codec(s)");this.hls.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:s,reason:s.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const r in e)if(!t[r]){var n;const s=e[r];if(!s)throw Error(`source buffer exists for track ${r}, however track does not`);let o=((n=s.levelCodec)==null?void 0:n.indexOf(","))===-1?s.levelCodec:s.codec;o&&r.slice(0,5)==="audio"&&(o=Ot(o,this.appendSource));const u=`${s.container};codecs=${o}`;this.log(`creating sourceBuffer(${u})`);try{const c=t[r]=i.addSourceBuffer(u),h=r;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(h,"bufferedchange",(m,p)=>{const E=p.removedRanges;E!=null&&E.length&&this.hls.trigger(f.BUFFER_FLUSHED,{type:r})}),this.tracks[r]={buffer:c,codec:o,container:s.container,levelCodec:s.levelCodec,metadata:s.metadata,id:s.id}}catch(c){this.error(`error while trying to add sourceBuffer: ${c.message}`),this.hls.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:c,sourceBufferName:r,mimeType:u})}}}get mediaSrc(){var e,t;const i=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return i==null?void 0:i.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const n=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(i=this.mediaSource)==null?void 0:i.readyState}`);this.error(`${n}`,t),this.hls.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(n)}removeExecutor(e,t,i){const{media:n,mediaSource:r,operationQueue:s,sourceBuffer:o}=this,u=o[e];if(!n||!r||!u){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),s.shiftAndExecuteNext(e);return}const c=Q(n.duration)?n.duration:1/0,h=Q(r.duration)?r.duration:1/0,m=Math.max(0,t),p=Math.min(i,c,h);p>m&&(!u.ending||u.ended)?(u.ended=!1,this.log(`Removing [${m},${p}] from the ${e} SourceBuffer`),u.remove(m,p)):s.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(!i){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}i.ended=!1,i.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:i}=this,n=t.map(r=>i.appendBlocker(r));Promise.all(n).then(()=>{e(),t.forEach(r=>{const s=this.sourceBuffer[r];s!=null&&s.updating||i.shiftAndExecuteNext(r)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const n=this.sourceBuffer[e];if(!n)return;const r=i.bind(this,e);this.listeners[e].push({event:t,listener:r}),n.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(i=>{t.removeEventListener(i.event,i.listener)})}}function ga(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function Uo(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}const Go={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},pa=a=>String.fromCharCode(Go[a]||a),Vn=15,rr=100,Ko={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Ho={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Vo={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},jo={25:2,26:4,29:6,30:8,31:10,27:13,28:15},zo=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Wo{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;b.log(`${this.time} [${e}] ${i}`)}}}const gr=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class va{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let i=0;i<t.length;i++){const n=t[i];e.hasOwnProperty(n)&&(this[n]=e[n])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class Zo{constructor(){this.uchar=" ",this.penState=new va}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class Yo{constructor(e){this.chars=[],this.pos=0,this.currPenState=new va,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<rr;t++)this.chars.push(new Zo);this.logger=e}equals(e){for(let t=0;t<rr;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<rr;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<rr;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>rr&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=rr)}moveCursor(e){const t=this.pos+e;if(e>1)for(let i=this.pos+1;i<t+1;i++)this.chars[i].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=pa(e);if(this.pos>=rr){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<rr;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let i=0;i<rr;i++){const n=this.chars[i].uchar;n!==" "&&(t=!1),e.push(n)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Ts{constructor(e){this.rows=[],this.currRow=Vn-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Vn;t++)this.rows.push(new Yo(e));this.logger=e}reset(){for(let e=0;e<Vn;e++)this.rows[e].clear();this.currRow=Vn-1}equals(e){let t=!0;for(let i=0;i<Vn;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<Vn;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Vn;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Vn;o++)this.rows[o].clear();const r=this.currRow+1-this.nrRollUpRows,s=this.lastOutputScreen;if(s){const o=s.rows[r].cueStartTime,u=this.logger.time;if(o!==null&&u!==null&&o<u)for(let c=0;c<this.nrRollUpRows;c++)this.rows[t-this.nrRollUpRows+c+1].copy(s.rows[r+c])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const r=e.indent,s=Math.max(r-1,0);i.setCursor(e.indent),e.color=i.chars[s].penState.foreground}const n={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",n=-1;for(let r=0;r<Vn;r++){const s=this.rows[r].getTextString();s&&(n=r+1,e?t.push("Row "+n+": '"+s+"'"):t.push(s.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
|
|
`)),i}getTextAndFormat(){return this.rows}}class ya{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ts(i),this.nonDisplayedMemory=new Ts(i),this.lastOutputScreen=new Ts(i),this.currRollUpRow=this.displayedMemory.rows[Vn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Vn-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let i=0;i<e.length;i++)this.writeScreen.insertChar(e[i]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=n[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Ea{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=qo(),this.logger=void 0;const n=this.logger=new Wo;this.channels=[null,new ya(e,t,n),new ya(e+1,i,n)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let i=0;i<t.length;i+=2){const n=t[i]&127,r=t[i+1]&127;let s=!1,o=null;if(n===0&&r===0)continue;this.logger.log(3,()=>"["+gr([t[i],t[i+1]])+"] -> ("+gr([n,r])+")");const u=this.cmdHistory;if(n>=16&&n<=31){if(Xo(n,r,u)){Zr(null,null,u),this.logger.log(3,()=>"Repeated command ("+gr([n,r])+") is dropped");continue}Zr(n,r,this.cmdHistory),s=this.parseCmd(n,r),s||(s=this.parseMidrow(n,r)),s||(s=this.parsePAC(n,r)),s||(s=this.parseBackgroundAttributes(n,r))}else Zr(null,null,u);if(!s&&(o=this.parseChars(n,r),o)){const h=this.currentChannel;h&&h>0?this.channels[h].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!s&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+gr([n,r])+" orig: "+gr([t[i],t[i+1]]))}}parseCmd(e,t){const i=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=33&&t<=35;if(!(i||n))return!1;const r=e===20||e===21||e===23?1:2,s=this.channels[r];return e===20||e===21||e===28||e===29?t===32?s.ccRCL():t===33?s.ccBS():t===34?s.ccAOF():t===35?s.ccAON():t===36?s.ccDER():t===37?s.ccRU(2):t===38?s.ccRU(3):t===39?s.ccRU(4):t===40?s.ccFON():t===41?s.ccRDC():t===42?s.ccTR():t===43?s.ccRTD():t===44?s.ccEDM():t===45?s.ccCR():t===46?s.ccENM():t===47&&s.ccEOC():s.ccTO(t-32),this.currentChannel=r,!0}parseMidrow(e,t){let i=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?i=1:i=2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[i];return n?(n.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+gr([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let i;const n=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,r=(e===16||e===24)&&t>=64&&t<=95;if(!(n||r))return!1;const s=e<=23?1:2;t>=64&&t<=95?i=s===1?Ko[e]:Vo[e]:i=s===1?Ho[e]:jo[e];const o=this.channels[s];return o?(o.setPAC(this.interpretPAC(i,t)),this.currentChannel=s,!0):!1}interpretPAC(e,t){let i;const n={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?i=t-96:i=t-64,n.underline=(i&1)===1,i<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(n.italics=!0,n.color="white"):n.indent=Math.floor((i-16)/2)*4,n}parseChars(e,t){let i,n=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let s;r===17?s=t+80:r===18?s=t+112:s=t+144,this.logger.log(2,()=>"Special char '"+pa(s)+"' in channel "+i),n=[s]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+gr(n).join(",")),n}parseBackgroundAttributes(e,t){const i=(e===16||e===24)&&t>=32&&t<=47,n=(e===23||e===31)&&t>=45&&t<=47;if(!(i||n))return!1;let r;const s={};e===16||e===24?(r=Math.floor((t-32)/2),s.background=zo[r],t%2===1&&(s.background=s.background+"_semi")):t===45?s.background="transparent":(s.foreground="black",t===47&&(s.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(s),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Zr(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const i=this.channels[t];i&&i.cueSplitAtTime(e)}}}function Zr(a,e,t){t.a=a,t.b=e}function Xo(a,e,t){return t.a===a&&t.b===e}function qo(){return{a:null,b:null}}class Yr{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var As=function(){if(He!=null&&He.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,u){if(typeof u!="string"||!Array.isArray(o))return!1;const c=u.toLowerCase();return~o.indexOf(c)?c:!1}function i(o){return t(a,o)}function n(o){return t(e,o)}function r(o,...u){let c=1;for(;c<arguments.length;c++){const h=arguments[c];for(const m in h)o[m]=h[m]}return o}function s(o,u,c){const h=this,m={enumerable:!0};h.hasBeenReset=!1;let p="",E=!1,y=o,_=u,T=c,k=null,te="",ie=!0,be="auto",re="start",Me=50,xe="middle",Je=50,ht="middle";Object.defineProperty(h,"id",r({},m,{get:function(){return p},set:function(Ie){p=""+Ie}})),Object.defineProperty(h,"pauseOnExit",r({},m,{get:function(){return E},set:function(Ie){E=!!Ie}})),Object.defineProperty(h,"startTime",r({},m,{get:function(){return y},set:function(Ie){if(typeof Ie!="number")throw new TypeError("Start time must be set to a number.");y=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",r({},m,{get:function(){return _},set:function(Ie){if(typeof Ie!="number")throw new TypeError("End time must be set to a number.");_=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",r({},m,{get:function(){return T},set:function(Ie){T=""+Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",r({},m,{get:function(){return k},set:function(Ie){k=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",r({},m,{get:function(){return te},set:function(Ie){const et=i(Ie);if(et===!1)throw new SyntaxError("An invalid or illegal string was specified.");te=et,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",r({},m,{get:function(){return ie},set:function(Ie){ie=!!Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",r({},m,{get:function(){return be},set:function(Ie){if(typeof Ie!="number"&&Ie!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");be=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",r({},m,{get:function(){return re},set:function(Ie){const et=n(Ie);if(!et)throw new SyntaxError("An invalid or illegal string was specified.");re=et,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",r({},m,{get:function(){return Me},set:function(Ie){if(Ie<0||Ie>100)throw new Error("Position must be between 0 and 100.");Me=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",r({},m,{get:function(){return xe},set:function(Ie){const et=n(Ie);if(!et)throw new SyntaxError("An invalid or illegal string was specified.");xe=et,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",r({},m,{get:function(){return Je},set:function(Ie){if(Ie<0||Ie>100)throw new Error("Size must be between 0 and 100.");Je=Ie,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",r({},m,{get:function(){return ht},set:function(Ie){const et=n(Ie);if(!et)throw new SyntaxError("An invalid or illegal string was specified.");ht=et,this.hasBeenReset=!0}})),h.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class Qo{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function _a(a){function e(i,n,r,s){return(i|0)*3600+(n|0)*60+(r|0)+parseFloat(s||0)}const t=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class Jo{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let n=0;n<i.length;++n)if(t===i[n]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}}function xa(a,e,t,i){const n=i?a.split(i):[a];for(const r in n){if(typeof n[r]!="string")continue;const s=n[r].split(t);if(s.length!==2)continue;const o=s[0],u=s[1];e(o,u)}}const Cs=new As(0,0,""),Xr=Cs.align==="middle"?"middle":"center";function el(a,e,t){const i=a;function n(){const o=_a(a);if(o===null)throw new Error("Malformed timestamp: "+i);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function r(o,u){const c=new Jo;xa(o,function(p,E){let y;switch(p){case"region":for(let _=t.length-1;_>=0;_--)if(t[_].id===E){c.set(p,t[_].region);break}break;case"vertical":c.alt(p,E,["rl","lr"]);break;case"line":y=E.split(","),c.integer(p,y[0]),c.percent(p,y[0])&&c.set("snapToLines",!1),c.alt(p,y[0],["auto"]),y.length===2&&c.alt("lineAlign",y[1],["start",Xr,"end"]);break;case"position":y=E.split(","),c.percent(p,y[0]),y.length===2&&c.alt("positionAlign",y[1],["start",Xr,"end","line-left","line-right","auto"]);break;case"size":c.percent(p,E);break;case"align":c.alt(p,E,["start",Xr,"end","left","right"]);break}},/:/,/\s/),u.region=c.get("region",null),u.vertical=c.get("vertical","");let h=c.get("line","auto");h==="auto"&&Cs.line===-1&&(h=-1),u.line=h,u.lineAlign=c.get("lineAlign","start"),u.snapToLines=c.get("snapToLines",!0),u.size=c.get("size",100),u.align=c.get("align",Xr);let m=c.get("position","auto");m==="auto"&&Cs.position===50&&(m=u.align==="start"||u.align==="left"?0:u.align==="end"||u.align==="right"?100:50),u.position=m}function s(){a=a.replace(/^\s+/,"")}if(s(),e.startTime=n(),s(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);a=a.slice(3),s(),e.endTime=n(),s(),r(a,e)}function Sa(a){return a.replace(/<br(?: \/)?>/gi,`
|
|
`)}class tl{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Qo,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function i(){let r=t.buffer,s=0;for(r=Sa(r);s<r.length&&r[s]!=="\r"&&r[s]!==`
|
|
`;)++s;const o=r.slice(0,s);return r[s]==="\r"&&++s,r[s]===`
|
|
`&&++s,t.buffer=r.slice(s),o}function n(r){xa(r,function(s,o){},/:/)}try{let r="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;r=i();const o=r.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let s=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:r=i(),t.state){case"HEADER":/:/.test(r)?n(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;if(t.cue=new As(0,0,""),t.state="CUE",r.indexOf("-->")===-1){t.cue.id=r;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{el(r,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=r.indexOf("-->")!==-1;if(!r||o&&(s=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
|
|
`),t.cue.text+=r}continue;case"BADCUE":r||(t.state="ID")}}}catch(r){t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`
|
|
|
|
`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const il=/\r\n|\n\r|\n|\r/g,Rs=function(e,t,i=0){return e.slice(i,i+t.length)===t},nl=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!Q(t)||!Q(i)||!Q(n)||!Q(r))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*r,t},Ls=function(e){let t=5381,i=e.length;for(;i;)t=t*33^e.charCodeAt(--i);return(t>>>0).toString()};function Is(a,e,t){return Ls(a.toString())+Ls(e.toString())+Ls(t)}const rl=function(e,t,i){let n=e[t],r=e[n.prevCC];if(!r||!r.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(s=r)!=null&&s.new;){var s;e.ccOffset+=n.start-r.start,n.new=!1,n=r,r=e[n.prevCC]}e.presentationOffset=i};function sl(a,e,t,i,n,r,s){const o=new tl,u=Ze(new Uint8Array(a)).trim().replace(il,`
|
|
`).split(`
|
|
`),c=[],h=e?So(e.baseTime,e.timescale):0;let m="00:00.000",p=0,E=0,y,_=!0;o.oncue=function(T){const k=t[i];let te=t.ccOffset;const ie=(p-h)/9e4;if(k!=null&&k.new&&(E!==void 0?te=t.ccOffset=k.start:rl(t,i,ie)),ie){if(!e){y=new Error("Missing initPTS for VTT MPEGTS");return}te=ie-t.presentationOffset}const be=T.endTime-T.startTime,re=Un((T.startTime+te-E)*9e4,n*9e4)/9e4;T.startTime=Math.max(re,0),T.endTime=Math.max(re+be,0);const Me=T.text.trim();T.text=decodeURIComponent(encodeURIComponent(Me)),T.id||(T.id=Is(T.startTime,T.endTime,Me)),T.endTime>0&&c.push(T)},o.onparsingerror=function(T){y=T},o.onflush=function(){if(y){s(y);return}r(c)},u.forEach(T=>{if(_)if(Rs(T,"X-TIMESTAMP-MAP=")){_=!1,T.slice(16).split(",").forEach(k=>{Rs(k,"LOCAL:")?m=k.slice(6):Rs(k,"MPEGTS:")&&(p=parseInt(k.slice(7)))});try{E=nl(m)/1e3}catch(k){y=k}return}else T===""&&(_=!1);o.parse(T+`
|
|
`)}),o.flush()}const ws="stpp.ttml.im1t",ba=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ta=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,al={left:"start",center:"center",right:"end",start:"start",end:"end"};function Aa(a,e,t,i){const n=ft(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const r=n.map(o=>Ze(o)),s=xo(e.baseTime,1,e.timescale);try{r.forEach(o=>t(ol(o,s)))}catch(o){i(o)}}function ol(a,e){const n=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(r).reduce((m,p)=>(m[p]=n.getAttribute(`ttp:${p}`)||r[p],m),{}),o=n.getAttribute("xml:space")!=="preserve",u=Ca(Ds(n,"styling","style")),c=Ca(Ds(n,"layout","region")),h=Ds(n,"body","[begin]");return[].map.call(h,m=>{const p=Ra(m,o);if(!p||!m.hasAttribute("begin"))return null;const E=Os(m.getAttribute("begin"),s),y=Os(m.getAttribute("dur"),s);let _=Os(m.getAttribute("end"),s);if(E===null)throw La(m);if(_===null){if(y===null)throw La(m);_=E+y}const T=new As(E-e,_-e,p);T.id=Is(T.startTime,T.endTime,T.text);const k=c[m.getAttribute("region")],te=u[m.getAttribute("style")],ie=ll(k,te,u),{textAlign:be}=ie;if(be){const re=al[be];re&&(T.lineAlign=re),T.align=be}return ae(T,ie),T}).filter(m=>m!==null)}function Ds(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function Ca(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Ra(a,e){return[].slice.call(a.childNodes).reduce((t,i,n)=>{var r;return i.nodeName==="br"&&n?t+`
|
|
`:(r=i.childNodes)!=null&&r.length?Ra(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function ll(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let n=null;const r=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],s=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return s&&t.hasOwnProperty(s)&&(n=t[s]),r.reduce((o,u)=>{const c=ks(e,i,u)||ks(a,i,u)||ks(n,i,u);return c&&(o[u]=c),o},{})}function ks(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function La(a){return new Error(`Could not parse ttml timestamp ${a}`)}function Os(a,e){if(!a)return null;let t=_a(a);return t===null&&(ba.test(a)?t=ul(a,e):Ta.test(a)&&(t=cl(a,e))),t}function ul(a,e){const t=ba.exec(a),i=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+i/e.frameRate}function cl(a,e){const t=Ta.exec(a),i=Number(t[1]);switch(t[2]){case"h":return i*3600;case"m":return i*60;case"ms":return i*1e3;case"f":return i/e.frameRate;case"t":return i/e.tickRate}return i}class dl{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Da(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(f.FRAG_LOADING,this.onFragLoading,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this),e.on(f.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(f.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(f.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(f.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(f.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(f.FRAG_LOADING,this.onFragLoading,this),e.off(f.FRAG_LOADED,this.onFragLoaded,this),e.off(f.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(f.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(f.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(f.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(f.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new Yr(this,"textTrack1"),t=new Yr(this,"textTrack2"),i=new Yr(this,"textTrack3"),n=new Yr(this,"textTrack4");this.cea608Parser1=new Ea(1,e,t),this.cea608Parser2=new Ea(3,i,n)}}addCues(e,t,i,n,r){let s=!1;for(let o=r.length;o--;){const u=r[o],c=hl(u[0],u[1],t,i);if(c>=0&&(u[0]=Math.min(u[0],t),u[1]=Math.max(u[1],i),s=!0,c/(i-t)>.5))return}if(s||r.push([t,i]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,i,n)}else{const o=this.Cues.newCue(null,t,i,n);this.hls.trigger(f.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:r}){const{unparsedVttFrags:s}=this;i==="main"&&(this.initPTS[t.cc]={baseTime:n,timescale:r}),s.length&&(this.unparsedVttFrags=[],s.forEach(o=>{this.onFragLoaded(f.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const r=i.textTracks[n];if(wa(r,{name:e,lang:t,attrs:{}}))return r}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:i,media:n}=this,{label:r,languageCode:s}=t[e],o=this.getExistingTrack(r,s);if(o)i[e]=o,Yi(i[e]),Zi(i[e],n);else{const u=this.createTextTrack("captions",r,s);u&&(u[e]=!0,i[e]=u)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const i=t.label,n={_id:e,label:i,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=n,this.hls.trigger(f.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}createTextTrack(e,t,i){const n=this.media;if(n)return n.addTextTrack(e,t,i)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{Yi(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Da(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let i=0;i<t.length;i++)Yi(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(r=>r.textCodec===ws);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(da(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const s=this.media,o=s?Ti(s.textTracks):null;if(this.tracks.forEach((u,c)=>{let h;if(o){let m=null;for(let p=0;p<o.length;p++)if(o[p]&&wa(o[p],u)){m=o[p],o[p]=null;break}m&&(h=m)}if(h)Yi(h);else{const m=Ia(u);h=this.createTextTrack(m,u.name,u.lang),h&&(h.mode="disabled")}h&&this.textTracks.push(h)}),o!=null&&o.length){const u=o.filter(c=>c!==null).map(c=>c.label);u.length&&b.warn(`Media element contains unused subtitle tracks: ${u.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const s=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(f.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:s})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(i=>{const n=/(?:CC|SERVICE)([1-4])/.exec(i.instreamId);if(!n)return;const r=`textTrack${n[1]}`,s=this.captionsProperties[r];s&&(s.label=i.name,i.lang&&(s.languageCode=i.lang),s.media=i)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===ot.MAIN){var i,n;const{cea608Parser1:r,cea608Parser2:s,lastSn:o}=this,{cc:u,sn:c}=t.frag,h=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;r&&s&&(c!==o+1||c===o&&h!==this.lastPartIndex+1||u!==this.lastCc)&&(r.reset(),s.reset()),this.lastCc=u,this.lastSn=c,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===ot.SUBTITLE)if(n.byteLength){const r=i.decryptdata,s="stats"in t;if(r==null||!r.encrypted||s){const o=this.tracks[i.level],u=this.vttCCs;u[i.cc]||(u[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===ws?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Aa(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),i.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{b.log(`Failed to parse IMSC1: ${n}`),i.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:r,unparsedVttFrags:s}=this,o=r.length-1;if(!r[i.cc]&&o===-1){s.push(e);return}const u=this.hls,c=(t=i.initSegment)!=null&&t.data?l(i.initSegment.data,new Uint8Array(n)):n;sl(c,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,h=>{this._appendCues(h,i.level),u.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},h=>{const m=h.message==="Missing initPTS for VTT MPEGTS";m?s.push(e):this._fallbackToIMSC1(i,n),b.log(`Failed to parse VTT cue: ${h}`),!(m&&o>i.cc)&&u.trigger(f.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:h})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Aa(t,this.initPTS[e.cc],()=>{i.textCodec=ws,this._parseIMSC1(e,t)},()=>{i.textCodec="wvtt"})}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const n=this.textTracks[t];if(!n||n.mode==="disabled")return;e.forEach(r=>qi(n,r))}else{const n=this.tracks[t];if(!n)return;const r=n.default?"default":"subtitles"+t;i.trigger(f.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===ot.SUBTITLE&&this.onFragLoaded(f.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:n}=this;if(!this.enabled||!i||!n)return;const{frag:r,samples:s}=t;if(!(r.type===ot.MAIN&&this.closedCaptionsForLevel(r)==="NONE"))for(let o=0;o<s.length;o++){const u=s[o].bytes;if(u){const c=this.extractCea608Data(u);i.addData(s[o].pts,c[0]),n.addData(s[o].pts,c[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:n,type:r}){const{media:s}=this;if(!(!s||s.currentTime<i)){if(!r||r==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(u=>Ni(o[u],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(u=>Ni(o[u],t,n))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let n=2;for(let r=0;r<i;r++){const s=e[n++],o=127&e[n++],u=127&e[n++];if(o===0&&u===0)continue;if((4&s)!==0){const h=3&s;(h===0||h===1)&&(t[h].push(o),t[h].push(u))}}return t}}function Ia(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function wa(a,e){return!!a&&a.kind===Ia(e)&&bs(e,a)}function hl(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function Da(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class Ps{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(f.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.BUFFER_CODECS,this.onBufferCodecs,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(f.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.BUFFER_CODECS,this.onBufferCodecs,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&Q(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&b.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter((n,r)=>this.isLevelAllowed(n)&&r<=e);return this.clientRect=null,Ps.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,!t.width&&!t.height&&(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(t){}return e}isLevelAllowed(e){return!this.restrictedLevels.some(i=>e.bitrate===i.bitrate&&e.width===i.width&&e.height===i.height)}static getMaxLevelByMediaSize(e,t,i){if(!(e!=null&&e.length))return-1;const n=(o,u)=>u?o.width!==u.width||o.height!==u.height:!0;let r=e.length-1;const s=Math.max(t,i);for(let o=0;o<e.length;o+=1){const u=e[o];if((u.width>=s||u.height>=s)&&n(u,e[o+1])){r=o;break}}return r}}class fl{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(f.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(f.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const n=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=n,n&&typeof n.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const r=n-this.lastTime,s=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,u=1e3*s/r,c=this.hls;if(c.trigger(f.FPS_DROP,{currentDropped:s,currentDecoded:o,totalDroppedFrames:i}),u>0&&s>c.config.fpsDroppedMonitoringThreshold*o){let h=c.currentLevel;b.warn("drop FPS ratio greater than max allowed value for currentLevel: "+h),h>0&&(c.autoLevelCapping===-1||c.autoLevelCapping>=h)&&(h=h-1,c.trigger(f.FPS_DROP_LEVEL_CAPPING,{level:h,droppedLevel:c.currentLevel}),c.autoLevelCapping=h,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const qr="[eme]";class Rr{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Rr.CDMCleanupPromise?[Rr.CDMCleanupPromise]:[],this.debug=b.debug.bind(b,qr),this.log=b.log.bind(b,qr),this.warn=b.warn.bind(b,qr),this.error=b.error.bind(b,qr),this.onMediaEncrypted=t=>{const{initDataType:i,initData:n}=t,r=`"${t.type}" event: init data type: "${i}"`;if(this.debug(r),n!==null){if(!this.keyFormatPromise){let s=Object.keys(this.keySystemAccessPromises);s.length||(s=vt(this.config));const o=s.map($t).filter(u=>!!u);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(s=>{const o=pt(s);let u,c;if(i==="sinf"){if(o!==we.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const y=Ct(new Uint8Array(n));try{const _=ge(JSON.parse(y).sinf),T=hi(_);if(!T)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");u=T.subarray(8,24),c=we.FAIRPLAY}catch(_){this.warn(`${r} Failed to parse sinf: ${_}`);return}}else{if(o!==we.WIDEVINE&&o!==we.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}const y=lt(n),_=y.filter(k=>!!k.systemId&&Ut(k.systemId)===o);_.length>1&&this.warn(`${r} Using first of ${_.length} pssh found for selected key-system ${o}`);const T=_[0];if(!T){y.length===0||y.some(k=>!k.systemId)?this.warn(`${r} contains incomplete or invalid pssh data`):this.log(`ignoring ${r} for ${y.map(k=>Ut(k.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(c=Ut(T.systemId),T.version===0&&T.data)if(c===we.WIDEVINE){const k=T.data.length-22;u=T.data.subarray(k,k+16)}else c===we.PLAYREADY&&(u=jt(T.data))}if(!c||!u){this.log(`Unable to handle ${r} with key-system ${o}`);return}const h=bt.hexDump(u),{keyIdToKeySessionPromise:m,mediaKeySessions:p}=this;let E=m[h];for(let y=0;y<p.length;y++){const _=p[y],T=_.decryptdata;if(!T.keyId)continue;const k=bt.hexDump(T.keyId);if(h===k||T.uri.replace(/-/g,"").indexOf(h)!==-1){if(E=m[k],T.pssh)break;delete m[k],T.pssh=new Uint8Array(n),T.keyId=u,E=m[h]=E.then(()=>this.generateRequestWithPreferredKeySession(_,i,n,"encrypted-event-key-match")),E.catch(te=>this.handleError(te));break}}if(!E){if(c!==o){this.log(`Ignoring "${r}" with ${c} init data for selected key-system ${o}`);return}E=m[h]=this.getKeySystemSelectionPromise([c]).then(({keySystem:y,mediaKeys:_})=>{var T;this.throwIfDestroyed();const k=new Oe("ISO-23001-7",h,(T=$t(y))!=null?T:"");return k.pssh=new Uint8Array(n),k.keyId=u,this.attemptSetMediaKeys(y,_).then(()=>{this.throwIfDestroyed();const te=this.createMediaKeySessionContext({decryptdata:k,keySystem:y,mediaKeys:_});return this.generateRequestWithPreferredKeySession(te,i,n,"encrypted-event-no-match")})}),E.catch(y=>this.handleError(y))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(f.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(f.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(f.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(f.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(f.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(f.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t[e];if(n)return n.licenseUrl;if(e===we.WIDEVINE&&i)return i}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(s,o,u)=>!!s&&u.indexOf(s)===o,n=t.map(s=>s.audioCodec).filter(i),r=t.map(s=>s.videoCodec).filter(i);return n.length+r.length===0&&r.push("avc1.42e01e"),new Promise((s,o)=>{const u=c=>{const h=c.shift();this.getMediaKeysPromise(h,n,r).then(m=>s({keySystem:h,mediaKeys:m})).catch(m=>{c.length?u(c):m instanceof Gn?o(m):o(new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_ACCESS,error:m,fatal:!0},m.message))})};u(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return Bt===null&&self.location.protocol==="http:"&&(n=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(n))}return i(e,t)}getMediaKeysPromise(e,t,i){const n=Ht(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let s=r==null?void 0:r.keySystemAccess;if(!s){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(n)}`),s=this.requestMediaKeySystemAccess(e,n);const o=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch(u=>{this.log(`Failed to obtain access to key-system "${e}": ${u}`)}),s.then(u=>{this.log(`Access for key-system "${u.keySystem}" obtained`);const c=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=u.createMediaKeys().then(h=>(this.log(`Media-keys created for "${e}"`),c.then(m=>m?this.setMediaKeysServerCertificate(h,e,m):h))),o.mediaKeys.catch(h=>{this.error(`Failed to create media-keys for "${e}"}: ${h}`)}),o.mediaKeys})}return s.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${bt.hexDump(e.keyId||[])}`);const n=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,r,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return bt.hexDump(e.keyId)}updateKeySession(e,t){var i;const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${bt.hexDump(((i=e.decryptdata)==null?void 0:i.keyId)||[])}
|
|
} (data length: ${t&&t.byteLength})`),n.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,i)=>{const n=vt(this.config),r=e.map(pt).filter(s=>!!s&&n.indexOf(s)!==-1);return this.getKeySystemSelectionPromise(r).then(({keySystem:s})=>{const o=$t(s);o?t(o):i(new Error(`Unable to find format for key-system "${s}"`))}).catch(i)})}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),n=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${n}`);let r=this.keyIdToKeySessionPromise[i];return r||(r=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then(({keySystem:s,mediaKeys:o})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${n}`),this.attemptSetMediaKeys(s,o).then(()=>{this.throwIfDestroyed();const u=this.createMediaKeySessionContext({keySystem:s,mediaKeys:o,decryptdata:t});return this.generateRequestWithPreferredKeySession(u,"cenc",t.pssh,"playlist-key")}))),r.catch(s=>this.handleError(s))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Gn?this.hls.trigger(f.ERROR,e.data):this.hls.trigger(f.ERROR,{type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=pt(e.keyFormat),r=n?[n]:vt(this.config);return this.attemptKeySystemAccess(r)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=vt(this.config)),e.length===0)throw new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(r=>i.indexOf(r)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var r,s;const o=(r=this.config.drmSystems)==null||(s=r[e.keySystem])==null?void 0:s.generateRequest;if(o)try{const y=o.call(this.hls,t,i,e);if(!y)throw new Error("Invalid response from configured generateRequest filter");t=y.initDataType,i=e.decryptdata.pssh=y.initData?new Uint8Array(y.initData):null}catch(y){var u;if(this.warn(y.message),(u=this.hls)!=null&&u.config.debug)throw y}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const c=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${c} (init data type: ${t} length: ${i?i.byteLength:null})`);const h=new Ss,m=e._onmessage=y=>{const _=e.mediaKeysSession;if(!_){h.emit("error",new Error("invalid state"));return}const{messageType:T,message:k}=y;this.log(`"${T}" message event for session "${_.sessionId}" message size: ${k.byteLength}`),T==="license-request"||T==="license-renewal"?this.renewLicense(e,k).catch(te=>{this.handleError(te),h.emit("error",te)}):T==="license-release"?e.keySystem===we.FAIRPLAY&&(this.updateKeySession(e,Fe("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${T}"`)},p=e._onkeystatuseschange=y=>{if(!e.mediaKeysSession){h.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const T=e.keyStatus;h.emit("keyStatus",T),T==="expired"&&(this.warn(`${e.keySystem} expired for key ${c}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",m),e.mediaKeysSession.addEventListener("keystatuseschange",p);const E=new Promise((y,_)=>{h.on("error",_),h.on("keyStatus",T=>{T.startsWith("usable")?y():T==="output-restricted"?_(new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):T==="internal-error"?_(new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${T}"`)):T==="expired"?_(new Error("key expired while generating request")):this.warn(`unhandled key status change "${T}"`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{var y;this.log(`Request generated for key-session "${(y=e.mediaKeysSession)==null?void 0:y.sessionId}" keyId: ${c}`)}).catch(y=>{throw new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_NO_SESSION,error:y,fatal:!1},`Error generating key-session request: ${y}`)}).then(()=>E).catch(y=>{throw h.removeAllListeners(),this.removeSession(e),y}).then(()=>(h.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${bt.hexDump("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${bt.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,i=t.loader,n=new i(t),r=this.getServerCertificateUrl(e);return r?(this.log(`Fetching server certificate for "${e}"`),new Promise((s,o)=>{const u={responseType:"arraybuffer",url:r},c=t.certLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},m={onSuccess:(p,E,y,_)=>{s(p.data)},onError:(p,E,y,_)=>{o(new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:V({url:u.url,data:void 0},p)},`"${e}" certificate request failed (${r}). Status: ${p.code} (${p.text})`))},onTimeout:(p,E,y)=>{o(new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:y,response:{url:u.url,data:void 0}},`"${e}" certificate request timed out (${r})`))},onAbort:(p,E,y)=>{o(new Error("aborted"))}};n.load(u,h,m)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,r)=>{e.setServerCertificate(i).then(s=>{this.log(`setServerCertificate ${s?"success":"not supported by CDM"} (${i==null?void 0:i.byteLength}) on "${t}"`),n(e)}).catch(s=>{r(new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:s,fatal:!0},s.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:n,fatal:!0},n.message)}))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const n=new DOMParser().parseFromString(i,"application/xml"),r=n.querySelectorAll("HttpHeader");if(r.length>0){let h;for(let m=0,p=r.length;m<p;m++){var s,o;h=r[m];const E=(s=h.querySelector("name"))==null?void 0:s.textContent,y=(o=h.querySelector("value"))==null?void 0:o.textContent;E&&y&&e.setRequestHeader(E,y)}}const u=n.querySelector("Challenge"),c=u==null?void 0:u.textContent;if(!c)throw new Error("Cannot find <Challenge> in key message");return Fe(atob(c))}setupLicenseXHR(e,t,i,n){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,n)}).catch(s=>{if(!i.decryptdata)throw s;return e.open("POST",t,!0),r.call(this.hls,e,t,i,n)}).then(s=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:s||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise((n,r)=>{const s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${s}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let u=o.response;this.log(`License received ${u instanceof ArrayBuffer?u.byteLength:u}`);const c=this.config.licenseResponseCallback;if(c)try{u=c.call(this.hls,o,s,e)}catch(h){this.error(h)}n(u)}else{const u=i.errorRetry,c=u?u.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>c||o.status>=400&&o.status<500)r(new Gn({type:N.KEY_SYSTEM_ERROR,details:K.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:s,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${s}). Status: ${o.status} (${o.statusText})`));else{const h=c-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${h} attempts left`),this.requestLicense(e,t).then(n,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,s,e,t).then(({xhr:u,licenseChallenge:c})=>{e.keySystem==we.PLAYREADY&&(c=this.unpackPlayReadyKeyMessage(u,c)),u.send(c)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.removeEventListener("encrypted",this.onMediaEncrypted),i.removeEventListener("waitingforkey",this.onWaitingForKey),i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Oe.clearKeyUriToKeyIdMap();const i=t.length;Rr.CDMCleanupPromise=Promise.all(t.map(n=>this.removeSession(n)).concat(e==null?void 0:e.setMediaKeys(null).catch(n=>{this.log(`Could not clear media keys: ${n}`)}))).then(()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(n=>{this.log(`Could not close sessions and clear media keys: ${n}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,r)=>(n.indexOf(r.keyFormat)===-1&&n.push(r.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(e);return n>-1&&this.mediaKeySessions.splice(n,1),t.remove().catch(r=>{this.log(`Could not remove session: ${r}`)}).then(()=>t.close()).catch(r=>{this.log(`Could not close session: ${r}`)})}}}Rr.CDMCleanupPromise=void 0;class Gn extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var bn;(function(a){a.MANIFEST="m",a.AUDIO="a",a.VIDEO="v",a.MUXED="av",a.INIT="i",a.CAPTION="c",a.TIMED_TEXT="tt",a.KEY="k",a.OTHER="o"})(bn||(bn={}));var Fs;(function(a){a.DASH="d",a.HLS="h",a.SMOOTH="s",a.OTHER="o"})(Fs||(Fs={}));var pr;(function(a){a.OBJECT="CMCD-Object",a.REQUEST="CMCD-Request",a.SESSION="CMCD-Session",a.STATUS="CMCD-Status"})(pr||(pr={}));const ml={[pr.OBJECT]:["br","d","ot","tb"],[pr.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[pr.SESSION]:["cid","pr","sf","sid","st","v"],[pr.STATUS]:["bs","rtp"]};class Lr{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(i=>i instanceof Lr?i:new Lr(i))),this.value=e,this.params=t}}class ka{constructor(e){this.description=void 0,this.description=e}}const gl="Dict";function pl(a){return Array.isArray(a)?JSON.stringify(a):a instanceof Map?"Map{}":a instanceof Set?"Set{}":typeof a=="object"?JSON.stringify(a):String(a)}function vl(a,e,t,i){return new Error(`failed to ${a} "${pl(e)}" as ${t}`,{cause:i})}const Oa="Bare Item",yl="Boolean",El="Byte Sequence",_l="Decimal",xl="Integer";function Sl(a){return a<-999999999999999||999999999999999<a}const bl=/[\x00-\x1f\x7f]+/,Tl="Token",Al="Key";function Xn(a,e,t){return vl("serialize",a,e,t)}function Cl(a){if(typeof a!="boolean")throw Xn(a,yl);return a?"?1":"?0"}function Rl(a){return btoa(String.fromCharCode(...a))}function Ll(a){if(ArrayBuffer.isView(a)===!1)throw Xn(a,El);return`:${Rl(a)}:`}function Pa(a){if(Sl(a))throw Xn(a,xl);return a.toString()}function Il(a){return`@${Pa(a.getTime()/1e3)}`}function Fa(a,e){if(a<0)return-Fa(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const n=Math.floor(a*t);return(n%2===0?n:n+1)/t}else return Math.round(a*t)/t}function wl(a){const e=Fa(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Xn(a,_l);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Dl="String";function kl(a){if(bl.test(a))throw Xn(a,Dl);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Ol(a){return a.description||a.toString().slice(7,-1)}function Ma(a){const e=Ol(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Xn(e,Tl);return e}function Ms(a){switch(typeof a){case"number":if(!Q(a))throw Xn(a,Oa);return Number.isInteger(a)?Pa(a):wl(a);case"string":return kl(a);case"symbol":return Ma(a);case"boolean":return Cl(a);case"object":if(a instanceof Date)return Il(a);if(a instanceof Uint8Array)return Ll(a);if(a instanceof ka)return Ma(a);default:throw Xn(a,Oa)}}function Bs(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw Xn(a,Al);return a}function Ns(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${Bs(e)}`:`;${Bs(e)}=${Ms(t)}`).join("")}function Ba(a){return a instanceof Lr?`${Ms(a.value)}${Ns(a.params)}`:Ms(a)}function Pl(a){return`(${a.value.map(Ba).join(" ")})${Ns(a.params)}`}function Fl(a,e={whitespace:!0}){if(typeof a!="object")throw Xn(a,gl);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,r])=>{r instanceof Lr||(r=new Lr(r));let s=Bs(n);return r.value===!0?s+=Ns(r.params):(s+="=",Array.isArray(r.value)?s+=Pl(r):s+=Ba(r)),s}).join(`,${i}`)}function Ml(a,e){return Fl(a,e)}const Bl=a=>a==="ot"||a==="sf"||a==="st",Nl=a=>typeof a=="number"?Q(a):a!=null&&a!==""&&a!==!1;function $l(a,e){const t=new URL(a),i=new URL(e);if(t.origin!==i.origin)return a;const n=t.pathname.split("/").slice(1),r=i.pathname.split("/").slice(1,-1);for(;n[0]===r[0];)n.shift(),r.shift();for(;r.length;)r.shift(),n.unshift("..");return n.join("/")}function Ul(){try{return crypto.randomUUID()}catch(a){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const r=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?r:r&3|8).toString(16)})}}}const Qr=a=>Math.round(a),Gl=(a,e)=>(e!=null&&e.baseUrl&&(a=$l(a,e.baseUrl)),encodeURIComponent(a)),Jr=a=>Qr(a/100)*100,Kl={br:Qr,d:Qr,bl:Jr,dl:Jr,mtp:Jr,nor:Gl,rtp:Jr,tb:Qr};function Hl(a,e){const t={};if(a==null||typeof a!="object")return t;const i=Object.keys(a).sort(),n=ae({},Kl,e==null?void 0:e.formatters),r=e==null?void 0:e.filter;return i.forEach(s=>{if(r!=null&&r(s))return;let o=a[s];const u=n[s];u&&(o=u(o,e)),!(s==="v"&&o===1)&&(s=="pr"&&o===1||Nl(o)&&(Bl(s)&&typeof o=="string"&&(o=new ka(o)),t[s]=o))}),t}function Na(a,e={}){return a?Ml(Hl(a,e),ae({whitespace:!1},e)):""}function Vl(a,e={}){if(!a)return{};const t=Object.entries(a),i=Object.entries(ml).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),n=t.reduce((r,s)=>{var o,u;const[c,h]=s,m=((o=i.find(p=>p[1].includes(c)))==null?void 0:o[0])||pr.REQUEST;return(u=r[m])!=null||(r[m]={}),r[m][c]=h,r},{});return Object.entries(n).reduce((r,[s,o])=>(r[s]=Na(o,e),r),{})}function jl(a,e,t){return ae(a,Vl(e,t))}const zl="CMCD";function Wl(a,e={}){if(!a)return"";const t=Na(a,e);return`${zl}=${encodeURIComponent(t)}`}const $a=/CMCD=[^&#]+/;function Zl(a,e,t){const i=Wl(e,t);if(!i)return a;if($a.test(a))return a.replace($a,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Yl{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=n=>{try{this.apply(n,{ot:bn.MANIFEST,su:!this.initialized})}catch(r){b.warn("Could not generate manifest CMCD data.",r)}},this.applyFragmentData=n=>{try{const r=n.frag,s=this.hls.levels[r.level],o=this.getObjectType(r),u={d:r.duration*1e3,ot:o};(o===bn.VIDEO||o===bn.AUDIO||o==bn.MUXED)&&(u.br=s.bitrate/1e3,u.tb=this.getTopBandwidth(o)/1e3,u.bl=this.getBufferLength(o)),this.apply(n,u)}catch(r){b.warn("Could not generate segment CMCD data.",r)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;i!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||Ul(),this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHED,this.onMediaDetached,this),e.on(f.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHED,this.onMediaDetached,this),e.off(f.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,n;this.audioBuffer=(i=t.tracks.audio)==null?void 0:i.buffer,this.videoBuffer=(n=t.tracks.video)==null?void 0:n.buffer}createData(){var e;return{v:1,sf:Fs.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){ae(t,this.createData());const i=t.ot===bn.INIT||t.ot===bn.VIDEO||t.ot===bn.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:n}=this;n&&(t=Object.keys(t).reduce((r,s)=>(n.includes(s)&&(r[s]=t[s]),r),{})),this.useHeaders?(e.headers||(e.headers={}),jl(e.headers,t)):e.url=Zl(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return bn.TIMED_TEXT;if(e.sn==="initSegment")return bn.INIT;if(t==="audio")return bn.AUDIO;if(t==="main")return this.hls.audioTracks.length?bn.VIDEO:bn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===bn.AUDIO)i=n.audioTracks;else{const r=n.maxAutoLevel,s=r>-1?r+1:n.levels.length;i=n.levels.slice(0,s)}for(const r of i)r.bitrate>t&&(t=r.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,i=e===bn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Oi.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new i(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,s,o){t(r),this.loader.load(r,s,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(r){this.loader=void 0,this.loader=new i(r)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(r,s,o){t(r),this.loader.load(r,s,o)}}}}const Xl=3e5;class ql{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=b.log.bind(b,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(i=>i!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;i!==null&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((i==null?void 0:i.action)===yt.SendAlternateToPenaltyBox&&i.flags===yi.MoveAllAlternatesMatchingHost){const n=this.levels;let r=this.pathwayPriority,s=this.pathwayId;if(t.context){const{groupId:o,pathwayId:u,type:c}=t.context;o&&n?s=this.getPathwayForGroupId(o,c,s):u&&(s=u)}s in this.penalizedPathways||(this.penalizedPathways[s]=performance.now()),!r&&n&&(r=n.reduce((o,u)=>(o.indexOf(u.pathwayId)===-1&&o.push(u.pathwayId),o),[])),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==s),i.resolved||b.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${s} levels: ${n&&n.length} priorities: ${JSON.stringify(r)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const i=this.penalizedPathways,n=performance.now();Object.keys(i).forEach(r=>{n-i[r]>Xl&&delete i[r]});for(let r=0;r<e.length;r++){const s=e[r];if(s in i)continue;if(s===this.pathwayId)return;const o=this.hls.nextLoadLevel,u=this.hls.levels[o];if(t=this.getLevelsForPathway(s),t.length>0){this.log(`Setting Pathway to "${s}"`),this.pathwayId=s,Ji(t),this.hls.trigger(f.LEVELS_UPDATED,{levels:t});const c=this.hls.levels[o];u&&c&&this.levels&&(c.attrs["STABLE-VARIANT-ID"]!==u.attrs["STABLE-VARIANT-ID"]&&c.bitrate!==u.bitrate&&this.log(`Unstable Pathways change from bitrate ${u.bitrate} to ${c.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let r=0;r<n.length;r++)if(t===Kt.AUDIO_TRACK&&n[r].hasAudioGroup(e)||t===Kt.SUBTITLE_TRACK&&n[r].hasSubtitleGroup(e))return n[r].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},n={};e.forEach(r=>{const{ID:s,"BASE-ID":o,"URI-REPLACEMENT":u}=r;if(t.some(h=>h.pathwayId===s))return;const c=this.getLevelsForPathway(o).map(h=>{const m=new Y(h.attrs);m["PATHWAY-ID"]=s;const p=m.AUDIO&&`${m.AUDIO}_clone_${s}`,E=m.SUBTITLES&&`${m.SUBTITLES}_clone_${s}`;p&&(i[m.AUDIO]=p,m.AUDIO=p),E&&(n[m.SUBTITLES]=E,m.SUBTITLES=E);const y=Ga(h.uri,m["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",u),_=new un({attrs:m,audioCodec:h.audioCodec,bitrate:h.bitrate,height:h.height,name:h.name,url:y,videoCodec:h.videoCodec,width:h.width});if(h.audioGroups)for(let T=1;T<h.audioGroups.length;T++)_.addGroupId("audio",`${h.audioGroups[T]}_clone_${s}`);if(h.subtitleGroups)for(let T=1;T<h.subtitleGroups.length;T++)_.addGroupId("text",`${h.subtitleGroups[T]}_clone_${s}`);return _});t.push(...c),Ua(this.audioTracks,i,u,s),Ua(this.subtitleTracks,n,u,s)})}loadSteeringManifest(e){const t=this.hls.config,i=t.loader;this.loader&&this.loader.destroy(),this.loader=new i(t);let n;try{n=new self.URL(e)}catch(h){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const h=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+h)}const r={responseType:"json",url:n.href},s=t.steeringManifestLoadPolicy.default,o=s.errorRetry||s.timeoutRetry||{},u={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},c={onSuccess:(h,m,p,E)=>{this.log(`Loaded steering manifest: "${n}"`);const y=h.data;if(y.VERSION!==1){this.log(`Steering VERSION ${y.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=y.TTL;const{"RELOAD-URI":_,"PATHWAY-CLONES":T,"PATHWAY-PRIORITY":k}=y;if(_)try{this.uri=new self.URL(_,n).href}catch(ie){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${_}`);return}this.scheduleRefresh(this.uri||p.url),T&&this.clonePathways(T);const te={steeringManifest:y,url:n.toString()};this.hls.trigger(f.STEERING_MANIFEST_LOADED,te),k&&this.updatePathwayPriority(k)},onError:(h,m,p,E)=>{if(this.log(`Error loading steering manifest: ${h.code} ${h.text} (${m.url})`),this.stopLoad(),h.code===410){this.enabled=!1,this.log(`Steering manifest ${m.url} no longer available`);return}let y=this.timeToLoad*1e3;if(h.code===429){const _=this.loader;if(typeof(_==null?void 0:_.getResponseHeader)=="function"){const T=_.getResponseHeader("Retry-After");T&&(y=parseFloat(T)*1e3)}this.log(`Steering manifest ${m.url} rate limited`);return}this.scheduleRefresh(this.uri||m.url,y)},onTimeout:(h,m,p)=>{this.log(`Timeout loading steering manifest (${m.url})`),this.scheduleRefresh(this.uri||m.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(r,u,c)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var i;const n=(i=this.hls)==null?void 0:i.media;if(n&&!n.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Ua(a,e,t,i){a&&Object.keys(e).forEach(n=>{const r=a.filter(s=>s.groupId===n).map(s=>{const o=ae({},s);return o.details=void 0,o.attrs=new Y(o.attrs),o.url=o.attrs.URI=Ga(s.url,s.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[n],o.attrs["PATHWAY-ID"]=i,o});a.push(...r)})}function Ga(a,e,t,i){const{HOST:n,PARAMS:r,[t]:s}=i;let o;e&&(o=s==null?void 0:s[e],o&&(a=o));const u=new self.URL(a);return n&&!o&&(u.host=n),r&&Object.keys(r).sort().forEach(c=>{c&&u.searchParams.set(c,r[c])}),u.href}const Ql=/^age:\s*[\d.]+\s*$/im;class Ka{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Se,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return r(i,t.url)}).catch(s=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),r(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(s=>{this.callbacks.onError({code:i.status,text:s.message},t,i,n)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const n=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:s}=i.loadPolicy;if(n)for(const o in n)e.setRequestHeader(o,n[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&Q(r)?r:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const n=t.readyState,r=this.config;if(!i.aborted&&n>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),n===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const s=t.status,o=t.responseType==="text"?t.responseText:null;if(s>=200&&s<300){const m=o!=null?o:t.response;if(m!=null){i.loading.end=Math.max(self.performance.now(),i.loading.first);const p=t.responseType==="arraybuffer"?m.byteLength:m.length;if(i.loaded=i.total=p,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first),!this.callbacks)return;const E=this.callbacks.onProgress;if(E&&E(i,e,m,t),!this.callbacks)return;const y={url:t.responseURL,data:m,code:s};this.callbacks.onSuccess(y,i,e,t);return}}const u=r.loadPolicy.errorRetry,c=i.retry,h={url:e.url,data:void 0,code:s};Xi(u,c,!1,h)?this.retry(u):(b.error(`${s} while loading ${e.url}`),this.callbacks.onError({code:s,text:t.statusText},e,t,i))}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Xi(e,t,!0))this.retry(e);else{var i;b.warn(`timeout while loading ${(i=this.context)==null?void 0:i.url}`);const n=this.callbacks;n&&(this.abortInternal(),n.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=cn(e,i.retry),i.retry++,b.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Ql.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function Jl(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const eu=/(\d+)-(\d+)\/(\d+)/;class Ha{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||ru,this.controller=new self.AbortController,this.stats=new Se}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const r=tu(e,this.controller.signal),s=i.onProgress,o=e.responseType==="arraybuffer",u=o?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:h}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=c&&Q(c)?c:h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(n,e,this.response)},t.timeout),self.fetch(this.request).then(m=>{this.response=this.loader=m;const p=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=h,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),i.onTimeout(n,e,this.response)},h-(p-n.loading.start)),!m.ok){const{status:E,statusText:y}=m;throw new su(y||"fetch, bad network response",E,m)}return n.loading.first=p,n.total=nu(m.headers)||n.total,s&&Q(t.highWaterMark)?this.loadProgressively(m,n,e,t.highWaterMark,s):o?m.arrayBuffer():e.responseType==="json"?m.json():m.text()}).then(m=>{const p=this.response;if(!p)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const E=m[u];E&&(n.loaded=n.total=E);const y={url:p.url,data:m,code:p.status};s&&!Q(t.highWaterMark)&&s(n,e,m,p),i.onSuccess(y,n,e,p)}).catch(m=>{if(self.clearTimeout(this.requestTimeout),n.aborted)return;const p=m&&m.code||0,E=m?m.message:null;i.onError({code:p,text:E},e,m?m.details:null,n)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,n=0,r){const s=new Ks,o=e.body.getReader(),u=()=>o.read().then(c=>{if(c.done)return s.dataLength&&r(t,i,s.flush(),e),Promise.resolve(new ArrayBuffer(0));const h=c.value,m=h.length;return t.loaded+=m,m<n||s.dataLength?(s.push(h),s.dataLength>=n&&r(t,i,s.flush(),e)):r(t,i,h,e),u()}).catch(()=>Promise.reject());return u()}}function tu(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ae({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function iu(a){const e=eu.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function nu(a){const e=a.get("Content-Range");if(e){const i=iu(e);if(Q(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function ru(a,e){return new self.Request(a.url,e)}class su extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const au=/\s/,ou={newCue(a,e,t,i){const n=[];let r,s,o,u,c;const h=self.VTTCue||self.TextTrackCue;for(let p=0;p<i.rows.length;p++)if(r=i.rows[p],o=!0,u=0,c="",!r.isEmpty()){var m;for(let _=0;_<r.chars.length;_++)au.test(r.chars[_].uchar)&&o?u++:(c+=r.chars[_].uchar,o=!1);r.cueStartTime=e,e===t&&(t+=1e-4),u>=16?u--:u++;const E=Sa(c.trim()),y=Is(e,t,E);a!=null&&(m=a.cues)!=null&&m.getCueById(y)||(s=new h(e,t,E),s.id=y,s.line=p+1,s.align="left",s.position=10+Math.min(80,Math.floor(u*8/32)*10),n.push(s))}return a&&n.length&&(n.sort((p,E)=>p.line==="auto"||E.line==="auto"?0:p.line>8&&E.line>8?E.line-p.line:p.line-E.line),n.forEach(p=>qi(a,p))),n}},lu={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Va=V(V({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ka,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:as,bufferController:$o,capLevelController:Ps,errorController:Hi,fpsController:fl,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Bt,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:lu},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},uu()),{},{subtitleStreamController:Fo,subtitleTrackController:Bo,timelineController:dl,audioStreamController:Oo,audioTrackController:Po,emeController:Rr,cmcdController:Yl,contentSteeringController:ql});function uu(){return{cueHandler:ou,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function cu(a,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=$s(a),i=["manifest","level","frag"],n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return i.forEach(r=>{const s=`${r==="level"?"playlist":r}LoadPolicy`,o=e[s]===void 0,u=[];n.forEach(c=>{const h=`${r}Loading${c}`,m=e[h];if(m!==void 0&&o){u.push(h);const p=t[s].default;switch(e[s]={default:p},c){case"TimeOut":p.maxLoadTimeMs=m,p.maxTimeToFirstByteMs=m;break;case"MaxRetry":p.errorRetry.maxNumRetry=m,p.timeoutRetry.maxNumRetry=m;break;case"RetryDelay":p.errorRetry.retryDelayMs=m,p.timeoutRetry.retryDelayMs=m;break;case"MaxRetryTimeout":p.errorRetry.maxRetryDelayMs=m,p.timeoutRetry.maxRetryDelayMs=m;break}}}),u.length&&b.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${s}": ${JSON.stringify(e[s])}`)}),V(V({},t),e)}function $s(a){return a&&typeof a=="object"?Array.isArray(a)?a.map($s):Object.keys(a).reduce((e,t)=>(e[t]=$s(a[t]),e),{}):a}function du(a){const e=a.loader;e!==Ha&&e!==Ka?(b.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):Jl()&&(a.loader=Ha,a.progressive=!0,a.enableSoftwareAES=!0,b.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Us;class hu extends xi{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,n=[],r={},s={};let o=!1,u=!1,c=!1;t.levels.forEach(h=>{var m,p;const E=h.attrs;let{audioCodec:y,videoCodec:_}=h;((m=y)==null?void 0:m.indexOf("mp4a.40.34"))!==-1&&(Us||(Us=/chrome|firefox/i.test(navigator.userAgent)),Us&&(h.audioCodec=y=void 0)),y&&(h.audioCodec=y=Ot(y,i)),((p=_)==null?void 0:p.indexOf("avc1"))===0&&(_=h.videoCodec=Vt(_));const{width:T,height:k,unknownCodecs:te}=h;if(o||(o=!!(T&&k)),u||(u=!!_),c||(c=!!y),te!=null&&te.length||y&&!Z(y,"audio",i)||_&&!Z(_,"video",i))return;const{CODECS:ie,"FRAME-RATE":be,"HDCP-LEVEL":re,"PATHWAY-ID":Me,RESOLUTION:xe,"VIDEO-RANGE":Je}=E,Ie=`${`${Me||"."}-`}${h.bitrate}-${xe}-${be}-${ie}-${Je}-${re}`;if(r[Ie])if(r[Ie].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const et=s[Ie]+=1;h.attrs["PATHWAY-ID"]=new Array(et+1).join(".");const ri=new un(h);r[Ie]=ri,n.push(ri)}else r[Ie].addGroupId("audio",E.AUDIO),r[Ie].addGroupId("text",E.SUBTITLES);else{const et=new un(h);r[Ie]=et,s[Ie]=1,n.push(et)}}),this.filterAndSortMediaOptions(n,t,o,u,c)}filterAndSortMediaOptions(e,t,i,n,r){let s=[],o=[],u=e;if((i||n)&&r&&(u=u.filter(({videoCodec:y,videoRange:_,width:T,height:k})=>(!!y||!!(T&&k))&&gn(_))),u.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const y=new Error("no level with compatible codecs found in manifest");this.hls.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:y,reason:y.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:y}=this.hls.config;s=t.audioTracks.filter(_=>!_.audioCodec||Z(_.audioCodec,"audio",y)),ja(s)}t.subtitles&&(o=t.subtitles,ja(o));const c=u.slice(0);u.sort((y,_)=>{if(y.attrs["HDCP-LEVEL"]!==_.attrs["HDCP-LEVEL"])return(y.attrs["HDCP-LEVEL"]||"")>(_.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&y.height!==_.height)return y.height-_.height;if(y.frameRate!==_.frameRate)return y.frameRate-_.frameRate;if(y.videoRange!==_.videoRange)return zi.indexOf(y.videoRange)-zi.indexOf(_.videoRange);if(y.videoCodec!==_.videoCodec){const T=Ce(y.videoCodec),k=Ce(_.videoCodec);if(T!==k)return k-T}if(y.uri===_.uri&&y.codecSet!==_.codecSet){const T=pe(y.codecSet),k=pe(_.codecSet);if(T!==k)return k-T}return y.averageBitrate!==_.averageBitrate?y.averageBitrate-_.averageBitrate:0});let h=c[0];if(this.steering&&(u=this.steering.filterParsedLevels(u),u.length!==c.length)){for(let y=0;y<c.length;y++)if(c[y].pathwayId===u[0].pathwayId){h=c[y];break}}this._levels=u;for(let y=0;y<u.length;y++)if(u[y]===h){var m;this._firstLevel=y;const _=h.bitrate,T=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${u.length} level(s) found, first bitrate: ${_}`),((m=this.hls.userConfig)==null?void 0:m.abrEwmaDefaultEstimate)===void 0){const k=Math.min(_,this.hls.config.abrEwmaDefaultEstimateMax);k>T&&T===Va.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=k)}break}const p=r&&!n,E={levels:u,audioTracks:s,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:n,altAudio:!p&&s.some(y=>!!y.url)};this.hls.trigger(f.MANIFEST_PARSED,E),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const h=new Error("invalid level idx"),m=e<0;if(this.hls.trigger(f.ERROR,{type:N.OTHER_ERROR,details:K.LEVEL_SWITCH_ERROR,level:e,fatal:m,error:h,reason:h.message}),m)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,r=n?n.attrs["PATHWAY-ID"]:void 0,s=t[e],o=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,i===e&&s.details&&n&&r===o)return;this.log(`Switching to level ${e} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${o?" with Pathway "+o:""} from level ${i}${r?" with Pathway "+r:""}`);const u={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(f.LEVEL_SWITCHING,u);const c=s.details;if(!c||c.live){const h=this.switchParams(s.uri,n==null?void 0:n.details,c);this.loadPlaylist(h)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===Kt.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ot.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(r=>!!i[r]))return;const n=this._levels[t.level];n!=null&&n.loadError&&(this.log(`Resetting level error count of ${n.loadError} on frag buffered`),n.loadError=0)}}onLevelLoaded(e,t){var i;const{level:n,details:r}=t,s=this._levels[n];if(!s){var o;this.warn(`Invalid level index ${n}`),(o=t.deliveryDirectives)!=null&&o.skip&&(r.deltaUpdateFailed=!0);return}n===this.currentLevelIndex?(s.fragmentError===0&&(s.loadError=0),this.playlistLoaded(n,t,s.details)):(i=t.deliveryDirectives)!=null&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let n=i.uri;if(e)try{n=e.addDirectives(n)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}const r=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${r?" Pathway "+r:""} ${n}`),this.clearTimer(),this.hls.trigger(f.LEVEL_LOADING,{url:n,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter((n,r)=>r!==e?!0:(this.steering&&this.steering.removeLevel(n),n===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,n.details&&n.details.fragments.forEach(s=>s.level=-1)),!1));Ji(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(f.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(f.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function ja(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}class fu{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[i].loader;if(n){var t;if(e&&e!==((t=n.context)==null?void 0:t.frag.type))return;n.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=K.KEY_LOAD_ERROR,i,n,r){return new Wi({type:N.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:n})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:n}=e;for(let r=0;r<t.length;r++){const s=t[r];if(n<=s.cc&&(i==="initSegment"||s.sn==="initSegment"||i<s.sn)){this.emeController.selectKeySystemFormat(s).then(o=>{s.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const c=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,c))}const s=r.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));let o=this.keyUriToKeyInfo[s];if((i=o)!=null&&i.decryptdata.key)return r.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((n=o)!=null&&n.keyLoadPromise){var u;switch((u=o.mediaKeySessionContext)==null?void 0:u.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(c=>(r.key=c.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[s]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return r.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,K.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(i);if(n)return(e.keyLoadPromise=n.then(r=>(e.mediaKeySessionContext=r,i))).catch(r=>{throw e.keyLoadPromise=null,r})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=i.loader,r=new n(i);return t.keyLoader=e.loader=r,e.keyLoadPromise=new Promise((s,o)=>{const u={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},c=i.keyLoadPolicy.default,h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},m={onSuccess:(p,E,y,_)=>{const{frag:T,keyInfo:k,url:te}=y;if(!T.decryptdata||k!==this.keyUriToKeyInfo[te])return o(this.createKeyLoadError(T,K.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),_));k.decryptdata.key=T.decryptdata.key=new Uint8Array(p.data),T.keyLoader=null,k.loader=null,s({frag:T,keyInfo:k})},onError:(p,E,y,_)=>{this.resetLoader(E),o(this.createKeyLoadError(t,K.KEY_LOAD_ERROR,new Error(`HTTP Error ${p.code} loading key ${p.text}`),y,V({url:u.url,data:void 0},p)))},onTimeout:(p,E,y)=>{this.resetLoader(E),o(this.createKeyLoadError(t,K.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),y))},onAbort:(p,E,y)=>{this.resetLoader(E),o(this.createKeyLoadError(t,K.INTERNAL_ABORTED,new Error("key loading aborted"),y))}};r.load(u,h,m)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[n],r&&r.destroy()}}function za(){return self.SourceBuffer||self.WebKitSourceBuffer}function Wa(){if(!wi())return!1;const e=za();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function mu(){if(!Wa())return!1;const a=wi();return typeof(a==null?void 0:a.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>a.isTypeSupported(me(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(me(e,"audio"))))}function gu(){var a;const e=za();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const pu=250,es=2,vu=.1,yu=.05;class Eu{constructor(e,t,i,n){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=n}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:n,stalled:r}=this;if(n===null)return;const{currentTime:s,seeking:o}=n,u=this.seeking&&!o,c=!this.seeking&&o;if(this.seeking=o,s!==e){if(this.moved=!0,o||(this.nudgeRetry=0),r!==null){if(this.stallReported){const T=self.performance.now()-r;b.warn(`playback not stuck anymore @${s}, after ${Math.round(T)}ms`),this.stallReported=!1}this.stalled=null}return}if(c||u){this.stalled=null;return}if(n.paused&&!o||n.ended||n.playbackRate===0||!Oi.getBuffered(n).length){this.nudgeRetry=0;return}const h=Oi.bufferInfo(n,s,0),m=h.nextStart||0;if(o){const T=h.len>es,k=!m||t&&t.start<=s||m-s>es&&!this.fragmentTracker.getPartialFragment(s);if(T||k)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var p;if(!(h.len>0)&&!m)return;const k=Math.max(m,h.start||0)-s,te=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,be=(te==null||(p=te.details)==null?void 0:p.live)?te.details.targetduration*2:es,re=this.fragmentTracker.getPartialFragment(s);if(k>0&&(k<=be||re)){n.paused||this._trySkipBufferHole(re);return}}const E=self.performance.now();if(r===null){this.stalled=E;return}const y=E-r;if(!o&&y>=pu&&(this._reportStall(h),!this.media))return;const _=Oi.bufferInfo(n,s,i.maxBufferHole);this._tryFixBufferStall(_,y)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:n,media:r}=this;if(r===null)return;const s=r.currentTime,o=n.getPartialFragment(s);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-s<i.maxBufferHole)&&t>i.highBufferWatchdogPeriod*1e3&&(b.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:n}=this;if(!n&&i){this.stallReported=!0;const r=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);b.warn(r.message),t.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:n}=this;if(n===null)return 0;const r=n.currentTime,s=Oi.bufferInfo(n,r,0),o=r<s.start?s.start:s.nextStart;if(o){const u=s.len<=t.maxBufferHole,c=s.len>0&&s.len<1&&n.readyState<3,h=o-r;if(h>0&&(u||c)){if(h>t.maxBufferHole){const{fragmentTracker:p}=this;let E=!1;if(r===0){const y=p.getAppendedFrag(0,ot.MAIN);y&&o<y.end&&(E=!0)}if(!E){const y=e||p.getAppendedFrag(r,ot.MAIN);if(y){let _=!1,T=y.end;for(;T<o;){const k=p.getPartialFragment(T);if(k)T+=k.duration;else{_=!0;break}}if(_)return 0}}}const m=Math.max(o+yu,r+vu);if(b.warn(`skipping hole, adjusting currentTime from ${r} to ${m}`),this.moved=!0,this.stalled=null,n.currentTime=m,e&&!e.gap){const p=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${m}`);i.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:p,reason:p.message,frag:e})}return m}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:i,nudgeRetry:n}=this;if(i===null)return;const r=i.currentTime;if(this.nudgeRetry++,n<e.nudgeMaxRetry){const s=r+(n+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${r} to ${s}`);b.warn(o.message),i.currentTime=s,t.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{const s=new Error(`Playhead still not moving while enough data buffered @${r} after ${e.nudgeMaxRetry} nudges`);b.error(s.message),t.trigger(f.ERROR,{type:N.MEDIA_ERROR,details:K.BUFFER_STALLED_ERROR,error:s,fatal:!0})}}}const _u=100;class xu extends kr{constructor(e,t,i){super(e,t,i,"[stream-controller]",ot.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.MANIFEST_PARSED,this.onManifestParsed,this),e.on(f.LEVEL_LOADING,this.onLevelLoading,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(f.ERROR,this.onError,this),e.on(f.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(f.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(f.BUFFER_CREATED,this.onBufferCreated,this),e.on(f.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(f.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(f.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.MANIFEST_PARSED,this.onManifestParsed,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(f.ERROR,this.onError,this),e.off(f.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(f.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(f.BUFFER_CREATED,this.onBufferCreated,this),e.off(f.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:i}=this;if(this.stopLoad(),this.setInterval(_u),this.level=-1,!this.startFragRequested){let n=i.startLevel;n===-1&&(i.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=i.firstAutoLevel),i.nextLoadLevel=n,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=De.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=De.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case De.WAITING_LEVEL:{const{levels:t,level:i}=this,n=t==null?void 0:t[i],r=n==null?void 0:n.details;if(r&&(!r.live||this.levelLastLoaded===n)){if(this.waitForCdnTuneIn(r))break;this.state=De.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=De.IDLE;break}break}case De.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||(e=this.media)!=null&&e.seeking){const{levels:n,level:r}=this,s=n==null?void 0:n[r];this.resetStartWhenNotLoaded(s||null),this.state=De.IDLE}}break}this.state===De.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(t===null||!n&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const r=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[r]))return;const s=i[r],o=this.getMainFwdBufferInfo();if(o===null)return;const u=this.getLevelDetails();if(u&&this._streamEnded(o,u)){const _={};this.altAudio&&(_.type="video"),this.hls.trigger(f.BUFFER_EOS,_),this.state=De.ENDED;return}if(!this.buffering)return;e.loadLevel!==r&&e.manualLevel===-1&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const c=s.details;if(!c||this.state===De.WAITING_LEVEL||c.live&&this.levelLastLoaded!==s){this.level=r,this.state=De.WAITING_LEVEL;return}const h=o.len,m=this.getMaxBufferLength(s.maxBitrate);if(h>=m)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const p=this.backtrackFragment?this.backtrackFragment.start:o.end;let E=this.getNextFragment(p,c);if(this.couldBacktrack&&!this.fragPrevious&&E&&E.sn!=="initSegment"&&this.fragmentTracker.getState(E)!==en.OK){var y;const T=((y=this.backtrackFragment)!=null?y:E).sn-c.startSN,k=c.fragments[T-1];k&&E.cc===k.cc&&(E=k,this.fragmentTracker.removeFragment(k))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(E&&this.isLoopLoading(E,p)){if(!E.gap){const T=this.audioOnly&&!this.altAudio?j.AUDIO:j.VIDEO,k=(T===j.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;k&&this.afterBufferFlushed(k,T,ot.MAIN)}E=this.getNextFragmentLoopLoading(E,c,o,ot.MAIN,m)}E&&(E.initSegment&&!E.initSegment.data&&!this.bitrateTest&&(E=E.initSegment),this.loadFragment(E,s,p))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);this.fragCurrent=e,n===en.NOT_LOADED||n===en.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ot.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let i;const n=this.getAppendedFrag(t.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const r=this.getLevelDetails();if(r!=null&&r.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<r.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,u=e[o],c=this.fragLastKbps;c&&this.fragCurrent?i=this.fragCurrent.duration*u.maxBitrate/(1e3*c)+1:i=0}else i=0;const s=this.getBufferedFrag(t.currentTime+i);if(s){const o=this.followingBufferedFrag(s);if(o){this.abortCurrentFrag();const u=o.maxStartPTS?o.maxStartPTS:o.start,c=o.duration,h=Math.max(s.end,u+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,c*(this.couldBacktrack?.5:.125)),c*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(h,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case De.KEY_LOADING:case De.FRAG_LOADING:case De.FRAG_LOADING_WAITING_RETRY:case De.PARSING:case De.PARSED:this.state=De.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new Eu(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;Q(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();if(i===null||i.len===0){this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(f.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,n=!1;t.levels.forEach(r=>{const s=r.audioCodec;s&&(i=i||s.indexOf("mp4a.40.2")!==-1,n=n||s.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=i&&n&&!gu(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==De.IDLE)return;const n=i[t.level];(!n.details||n.details.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(n.details))&&(this.state=De.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:n}=this,r=t.level,s=t.details,o=s.totalduration;if(!n){this.warn(`Levels were reset while loading level ${r}`);return}this.log(`Level ${r} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""}, cc [${s.startCC}, ${s.endCC}] duration:${o}`);const u=n[r],c=this.fragCurrent;c&&(this.state===De.FRAG_LOADING||this.state===De.FRAG_LOADING_WAITING_RETRY)&&c.level!==t.level&&c.loader&&this.abortCurrentFrag();let h=0;if(s.live||(i=u.details)!=null&&i.live){var m;if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;h=this.alignPlaylists(s,u.details,(m=this.levelLastLoaded)==null?void 0:m.details)}if(u.details=s,this.levelLastLoaded=u,this.hls.trigger(f.LEVEL_UPDATED,{details:s,level:r}),this.state===De.WAITING_LEVEL){if(this.waitForCdnTuneIn(s))return;this.state=De.IDLE}this.startFragRequested?s.live&&this.synchronizeToLiveEdge(s):this.setStartPosition(s,h),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:n,payload:r}=e,{levels:s}=this;if(!s){this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);return}const o=s[i.level],u=o.details;if(!u){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const c=o.videoCodec,h=u.PTSKnown||!u.live,m=(t=i.initSegment)==null?void 0:t.data,p=this._getAudioCodec(o),E=this.transmuxer=this.transmuxer||new ca(this.hls,ot.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),y=n?n.index:-1,_=y!==-1,T=new Er(i.level,i.sn,i.stats.chunkCount,r.byteLength,y,_),k=this.initPTS[i.cc];E.push(r,m,p,c,i,n,u.totalduration,h,T,k)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const s=this.fragCurrent;s&&(this.log("Switching to main audio track, cancel main fragment load"),s.abortRequests(),this.fragmentTracker.removeFragment(s)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const r=this.hls;i&&(r.trigger(f.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),r.trigger(f.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,n=!!this.hls.audioTracks[i].url;if(n){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=n,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,r,s=!1;for(const o in i){const u=i[o];if(u.id==="main"){if(r=o,n=u,o==="video"){const c=i[o];c&&(this.videoBuffer=c.buffer)}}else s=!0}s&&n?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i&&i.type!==ot.MAIN)return;if(this.fragContextChanged(i)){this.warn(`Fragment ${i.sn}${n?" p: "+n.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),this.state===De.PARSED&&(this.state=De.IDLE);return}const r=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),i.sn!=="initSegment"&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}onError(e,t){var i;if(t.fatal){this.state=De.ERROR;return}switch(t.details){case K.FRAG_GAP:case K.FRAG_PARSING_ERROR:case K.FRAG_DECRYPT_ERROR:case K.FRAG_LOAD_ERROR:case K.FRAG_LOAD_TIMEOUT:case K.KEY_LOAD_ERROR:case K.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ot.MAIN,t);break;case K.LEVEL_LOAD_ERROR:case K.LEVEL_LOAD_TIMEOUT:case K.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===De.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===Kt.LEVEL&&(this.state=De.IDLE);break;case K.BUFFER_APPEND_ERROR:case K.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===K.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case K.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Oi.getBuffered(e).length){const i=this.state!==De.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,i)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=De.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==j.AUDIO||this.audioOnly&&!this.altAudio){const i=(t===j.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,t,ot.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const n=Oi.getBuffered(e),s=(n.length?n.start(0):0)-i;s>0&&(s<this.config.maxBufferHole||s<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${s} to match buffer start`),i+=s,this.startPosition=i),this.log(`seek to target start position ${i} from current time ${t}`),e.currentTime=i}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:n}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=De.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),n.trigger(f.FRAG_LOADED,i),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const i="main",{hls:n}=this,{remuxResult:r,chunkMeta:s}=e,o=this.getCurrentContext(s);if(!o){this.resetWhenMissingContext(s);return}const{frag:u,part:c,level:h}=o,{video:m,text:p,id3:E,initSegment:y}=r,{details:_}=h,T=this.altAudio?void 0:r.audio;if(this.fragContextChanged(u)){this.fragmentTracker.removeFragment(u);return}if(this.state=De.PARSING,y){if(y!=null&&y.tracks){const ie=u.initSegment||u;this._bufferInitSegment(h,y.tracks,ie,s),n.trigger(f.FRAG_PARSING_INIT_SEGMENT,{frag:ie,id:i,tracks:y.tracks})}const k=y.initPTS,te=y.timescale;Q(k)&&(this.initPTS[u.cc]={baseTime:k,timescale:te},n.trigger(f.INIT_PTS_FOUND,{frag:u,id:i,initPTS:k,timescale:te}))}if(m&&_&&u.sn!=="initSegment"){const k=_.fragments[u.sn-1-_.startSN],te=u.sn===_.startSN,ie=!k||u.cc>k.cc;if(r.independent!==!1){const{startPTS:be,endPTS:re,startDTS:Me,endDTS:xe}=m;if(c)c.elementaryStreams[m.type]={startPTS:be,endPTS:re,startDTS:Me,endDTS:xe};else if(m.firstKeyFrame&&m.independent&&s.id===1&&!ie&&(this.couldBacktrack=!0),m.dropped&&m.independent){const Je=this.getMainFwdBufferInfo(),ht=(Je?Je.end:this.getLoadPosition())+this.config.maxBufferHole,Ie=m.firstKeyFramePTS?m.firstKeyFramePTS:be;if(!te&&ht<Ie-this.config.maxBufferHole&&!ie){this.backtrack(u);return}else ie&&(u.gap=!0);u.setElementaryStreamInfo(m.type,u.start,re,u.start,xe,!0)}else te&&be>es&&(u.gap=!0);u.setElementaryStreamInfo(m.type,be,re,Me,xe),this.backtrackFragment&&(this.backtrackFragment=u),this.bufferFragmentData(m,u,c,s,te||ie)}else if(te||ie)u.gap=!0;else{this.backtrack(u);return}}if(T){const{startPTS:k,endPTS:te,startDTS:ie,endDTS:be}=T;c&&(c.elementaryStreams[j.AUDIO]={startPTS:k,endPTS:te,startDTS:ie,endDTS:be}),u.setElementaryStreamInfo(j.AUDIO,k,te,ie,be),this.bufferFragmentData(T,u,c,s)}if(_&&E!=null&&(t=E.samples)!=null&&t.length){const k={id:i,frag:u,details:_,samples:E.samples};n.trigger(f.FRAG_PARSING_METADATA,k)}if(_&&p){const k={id:i,frag:u,details:_,samples:p.samples};n.trigger(f.FRAG_PARSING_USERDATA,k)}}_bufferInitSegment(e,t,i,n){if(this.state!==De.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:s,audiovideo:o}=t;if(r){let u=e.audioCodec;const c=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const h=r.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&c.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&c.indexOf("android")!==-1&&r.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),e.audioCodec&&e.audioCodec!==u&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${u}"`),r.levelCodec=u,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${u||""}/${e.audioCodec||""}/${r.codec}]`)}s&&(s.levelCodec=e.videoCodec,s.id="main",this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${e.videoCodec||""}/${s.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(f.BUFFER_CODECS,t),Object.keys(t).forEach(u=>{const h=t[u].initSegment;h!=null&&h.byteLength&&this.hls.trigger(f.BUFFER_APPENDING,{type:u,data:h,frag:i,part:null,chunkMeta:n,parent:i.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,ot.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=De.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Oi.isBuffered(e,i)?t=this.getAppendedFrag(i):Oi.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,r=t.level;(!n||t.sn!==n.sn||n.level!==r)&&(this.fragPlaying=t,this.hls.trigger(f.FRAG_CHANGED,{frag:t}),(!n||n.level!==r)&&this.hls.trigger(f.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&Q(t)&&Q(i.programDateTime)){const n=i.programDateTime+(t-i.start)*1e3;return new Date(n)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class vr{static get version(){return"1.5.19"}static isMSESupported(){return Wa()}static isSupported(){return mu()}static getMediaSource(){return wi()}static get Events(){return f}static get ErrorTypes(){return N}static get ErrorDetails(){return K}static get DefaultConfig(){return vr.defaultConfig?vr.defaultConfig:Va}static set DefaultConfig(e){vr.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new Ss,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,z(e.debug||!1,"Hls instance");const t=this.config=cu(vr.DefaultConfig,e);this.userConfig=e,t.progressive&&du(t);const{abrController:i,bufferController:n,capLevelController:r,errorController:s,fpsController:o}=t,u=new s(this),c=this.abrController=new i(this),h=this.bufferController=new n(this),m=this.capLevelController=new r(this),p=new o(this),E=new Bi(this),y=new En(this),_=t.contentSteeringController,T=_?new _(this):null,k=this.levelController=new hu(this,T),te=new fr(this),ie=new fu(this.config),be=this.streamController=new xu(this,te,ie);m.setStreamController(be),p.setStreamController(be);const re=[E,k,be];T&&re.splice(1,0,T),this.networkControllers=re;const Me=[c,h,m,p,y,te];this.audioTrackController=this.createController(t.audioTrackController,re);const xe=t.audioStreamController;xe&&re.push(new xe(this,te,ie)),this.subtitleTrackController=this.createController(t.subtitleTrackController,re);const Je=t.subtitleStreamController;Je&&re.push(new Je(this,te,ie)),this.createController(t.timelineController,Me),ie.emeController=this.emeController=this.createController(t.emeController,Me),this.cmcdController=this.createController(t.cmcdController,Me),this.latencyController=this.createController(Rn,Me),this.coreComponents=Me,re.push(u);const ht=u.onErrorOut;typeof ht=="function"&&this.on(f.ERROR,ht,u)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,n){this._emitter.off(e,t,i,n)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(i){if(b.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const n=e===f.ERROR;this.trigger(f.ERROR,{type:N.OTHER_ERROR,details:K.INTERNAL_EXCEPTION,fatal:n,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){b.log("destroy"),this.trigger(f.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){b.log("attachMedia"),this._media=e,this.trigger(f.MEDIA_ATTACHING,{media:e})}detachMedia(){b.log("detachMedia"),this.trigger(f.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,n=this.url=le.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,b.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(f.MANIFEST_LOADING,{url:e})}startLoad(e=-1){b.log(`startLoad(${e})`),this.started=!0,this.resumeBuffering();for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].startLoad(e),!(!this.started||!this.networkControllers));t++);}stopLoad(){b.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}resumeBuffering(){b.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()})}pauseBuffering(){b.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()})}swapAudioCodec(){b.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){b.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){b.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){b.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){b.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){b.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){b.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(b.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Fi(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let n=0;n<i;n++)if(e[n].maxBitrate>=t)return n;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let n;if(t===-1&&e!=null&&e.length?n=e.length-1:n=t,i)for(let r=n;r--;){const s=e[r].attrs["HDCP-LEVEL"];if(s&&s<=i)return r}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}vr.defaultConfig=void 0}}]);
|
|
}()); |