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.
NewEduCoderBuild/p__Video__Detail__id.a29833...

121 lines
1.1 MiB

!(function(){var dl=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[6444],{65030:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return ke}});var F=U(27247),pe=U(11913),Se=U(43079),ue=U(43403),G=U(92310),p=U.n(G),ve=U(29301),oe=U(76846),l=U(96452),Z=U(6089),k=U(80402),g=U(34280),v=U(49658),E=U(59301),A=U(32855),M=U(77900),j=U(8654);function V(ge){var Ae=ge.prefixCls,ee=ge.align,Re=ge.arrow,Te=ge.arrowPos,q=Re||{},W=q.className,z=q.content,re=Te.x,X=re===void 0?0:re,$=Te.y,Q=$===void 0?0:$,ce=E.useRef();if(!ee||!ee.points)return null;var he={position:"absolute"};if(ee.autoArrow!==!1){var we=ee.points[0],Ke=ee.points[1],Ve=we[0],Je=we[1],Ge=Ke[0],Fe=Ke[1];Ve===Ge||!["t","b"].includes(Ve)?he.top=Q:Ve==="t"?he.top=0:he.bottom=0,Je===Fe||!["l","r"].includes(Je)?he.left=X:Je==="l"?he.left=0:he.right=0}return E.createElement("div",{ref:ce,className:p()("".concat(Ae,"-arrow"),W),style:he},z)}function L(ge){var Ae=ge.prefixCls,ee=ge.open,Re=ge.zIndex,Te=ge.mask,q=ge.motion;return Te?E.createElement(M.default,(0,A.Z)({},q,{motionAppear:!0,visible:ee,removeOnLeave:!0}),function(W){var z=W.className;return E.createElement("div",{style:{zIndex:Re},className:p()("".concat(Ae,"-mask"),z)})}):null}var I=E.memo(function(ge){var Ae=ge.children;return Ae},function(ge,Ae){return Ae.cache}),w=I,R=E.forwardRef(function(ge,Ae){var ee=ge.popup,Re=ge.className,Te=ge.prefixCls,q=ge.style,W=ge.target,z=ge.onVisibleChanged,re=ge.open,X=ge.keepDom,$=ge.fresh,Q=ge.onClick,ce=ge.mask,he=ge.arrow,we=ge.arrowPos,Ke=ge.align,Ve=ge.motion,Je=ge.maskMotion,Ge=ge.forceRender,Fe=ge.getPopupContainer,pt=ge.autoDestroy,De=ge.portal,it=ge.zIndex,Bt=ge.onMouseEnter,vt=ge.onMouseLeave,dt=ge.onPointerEnter,Vt=ge.onPointerDownCapture,ni=ge.ready,Qt=ge.offsetX,Wt=ge.offsetY,ri=ge.offsetR,Rt=ge.offsetB,ut=ge.onAlign,st=ge.onPrepare,Nt=ge.stretch,Ht=ge.targetWidth,wt=ge.targetHeight,gt=typeof ee=="function"?ee():ee,St=re||X,Ei=(Fe==null?void 0:Fe.length)>0,zt=E.useState(!Fe||!Ei),si=(0,pe.Z)(zt,2),It=si[0],We=si[1];if((0,g.Z)(function(){!It&&Ei&&W&&We(!0)},[It,Ei,W]),!It)return null;var h="auto",m={left:"-1000vw",top:"-1000vh",right:h,bottom:h};if(ni||!re){var y,C=Ke.points,H=Ke.dynamicInset||((y=Ke._experimental)===null||y===void 0?void 0:y.dynamicInset),me=H&&C[0][1]==="r",fe=H&&C[0][0]==="b";me?(m.right=ri,m.left=h):(m.left=Qt,m.right=h),fe?(m.bottom=Rt,m.top=h):(m.top=Wt,m.bottom=h)}var Ce={};return Nt&&(Nt.includes("height")&&wt?Ce.height=wt:Nt.includes("minHeight")&&wt&&(Ce.minHeight=wt),Nt.includes("width")&&Ht?Ce.width=Ht:Nt.includes("minWidth")&&Ht&&(Ce.minWidth=Ht)),re||(Ce.pointerEvents="none"),E.createElement(De,{open:Ge||St,getContainer:Fe&&function(){return Fe(W)},autoDestroy:pt},E.createElement(L,{prefixCls:Te,open:re,zIndex:it,mask:ce,motion:Je}),E.createElement(ve.Z,{onResize:ut,disabled:!re},function(je){return E.createElement(M.default,(0,A.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Ge,leavedClassName:"".concat(Te,"-hidden")},Ve,{onAppearPrepare:st,onEnterPrepare:st,visible:re,onVisibleChanged:function(kt){var Mt;Ve==null||(Mt=Ve.onVisibleChanged)===null||Mt===void 0||Mt.call(Ve,kt),z(kt)}}),function(at,kt){var Mt=at.className,xt=at.style,Kt=p()(Te,Mt,Re);return E.createElement("div",{ref:(0,j.sQ)(je,Ae,kt),className:Kt,style:(0,F.Z)((0,F.Z)((0,F.Z)((0,F.Z)({"--arrow-x":"".concat(we.x||0,"px"),"--arrow-y":"".concat(we.y||0,"px")},m),Ce),xt),{},{boxSizing:"border-box",zIndex:it},q),onMouseEnter:Bt,onMouseLeave:vt,onPointerEnter:dt,onClick:Q,onPointerDownCapture:Vt},he&&E.createElement(V,{prefixCls:Te,arrow:he,arrowPos:we,align:Ke}),E.createElement(w,{cache:!re&&!$},gt))})}))}),Y=R,se=E.forwardRef(function(ge,Ae){var ee=ge.children,Re=ge.getTriggerDOMNode,Te=(0,j.Yr)(ee),q=E.useCallback(function(z){(0,j.mH)(Ae,Re?Re(z):z)},[Re]),W=(0,j.x1)(q,(0,j.C4)(ee));return Te?E.cloneElement(ee,{ref:W}):ee}),ne=se,ye=E.createContext(null),Ie=ye;function xe(ge){return ge?Array.isArray(ge)?ge:[ge]:[]}function $e(ge,Ae,ee,Re){return E.useMemo(function(){var Te=xe(ee!=null?ee:Ae),q=xe(Re!=null?Re:Ae),W=new Set(Te),z=new Set(q);return ge&&(W.has("hover")&&(W.delete("hover"),W.add("click")),z.has("hover")&&(z.delete("hover"),z.add("click"))),[W,z]},[ge,Ae,ee,Re])}var J=U(29194);function D(){var ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ee=arguments.length>2?arguments[2]:void 0;return ee?ge[0]===Ae[0]:ge[0]===Ae[0]&&ge[1]===Ae[1]}function N(ge,Ae,ee,Re){for(var Te=ee.points,q=Object.keys(ge),W=0;W<q.length;W+=1){var z,re=q[W];if(D((z=ge[re])===null||z===void 0?void 0:z.points,Te,Re))return"".concat(Ae,"-placement-").concat(re)}return""}function O(ge,Ae,ee,Re){return Ae||(ee?{motionName:"".concat(ge,"-").concat(ee)}:Re?{motionName:Re}:null)}function ae(ge){return ge.ownerDocument.defaultView}function te(ge){for(var Ae=[],ee=ge==null?void 0:ge.parentElement,Re=["hidden","scroll","clip","auto"];ee;){var Te=ae(ee).getComputedStyle(ee),q=Te.overflowX,W=Te.overflowY,z=Te.overflow;[q,W,z].some(function(re){return Re.includes(re)})&&Ae.push(ee),ee=ee.parentElement}return Ae}function S(ge){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(ge)?Ae:ge}function b(ge){return S(parseFloat(ge),0)}function K(ge,Ae){var ee=(0,F.Z)({},ge);return(Ae||[]).forEach(function(Re){if(!(Re instanceof HTMLBodyElement||Re instanceof HTMLHtmlElement)){var Te=ae(Re).getComputedStyle(Re),q=Te.overflow,W=Te.overflowClipMargin,z=Te.borderTopWidth,re=Te.borderBottomWidth,X=Te.borderLeftWidth,$=Te.borderRightWidth,Q=Re.getBoundingClientRect(),ce=Re.offsetHeight,he=Re.clientHeight,we=Re.offsetWidth,Ke=Re.clientWidth,Ve=b(z),Je=b(re),Ge=b(X),Fe=b($),pt=S(Math.round(Q.width/we*1e3)/1e3),De=S(Math.round(Q.height/ce*1e3)/1e3),it=(we-Ke-Ge-Fe)*pt,Bt=(ce-he-Ve-Je)*De,vt=Ve*De,dt=Je*De,Vt=Ge*pt,ni=Fe*pt,Qt=0,Wt=0;if(q==="clip"){var ri=b(W);Qt=ri*pt,Wt=ri*De}var Rt=Q.x+Vt-Qt,ut=Q.y+vt-Wt,st=Rt+Q.width+2*Qt-Vt-ni-it,Nt=ut+Q.height+2*Wt-vt-dt-Bt;ee.left=Math.max(ee.left,Rt),ee.top=Math.max(ee.top,ut),ee.right=Math.min(ee.right,st),ee.bottom=Math.min(ee.bottom,Nt)}}),ee}function le(ge){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ee="".concat(Ae),Re=ee.match(/^(.*)\%$/);return Re?ge*(parseFloat(Re[1])/100):parseFloat(ee)}function Ee(ge,Ae){var ee=Ae||[],Re=(0,pe.Z)(ee,2),Te=Re[0],q=Re[1];return[le(ge.width,Te),le(ge.height,q)]}function Ne(){var ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[ge[0],ge[1]]}function Qe(ge,Ae){var ee=Ae[0],Re=Ae[1],Te,q;return ee==="t"?q=ge.y:ee==="b"?q=ge.y+ge.height:q=ge.y+ge.height/2,Re==="l"?Te=ge.x:Re==="r"?Te=ge.x+ge.width:Te=ge.x+ge.width/2,{x:Te,y:q}}function bt(ge,Ae){var ee={t:"b",b:"t",l:"r",r:"l"};return ge.map(function(Re,Te){return Te===Ae?ee[Re]||"c":Re}).join("")}function Lt(ge,Ae,ee,Re,Te,q,W){var z=E.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Te[Re]||{}}),re=(0,pe.Z)(z,2),X=re[0],$=re[1],Q=E.useRef(0),ce=E.useMemo(function(){return Ae?te(Ae):[]},[Ae]),he=E.useRef({}),we=function(){he.current={}};ge||we();var Ke=(0,Z.Z)(function(){if(Ae&&ee&&ge){let un=function(dn,kn){var jn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yt,as=St.x+dn,Qn=St.y+kn,Yi=as+fe,pn=Qn+me,os=Math.max(as,jn.left),ii=Math.max(Qn,jn.top),pi=Math.min(Yi,jn.right),ji=Math.min(pn,jn.bottom);return Math.max(0,(pi-os)*(ji-ii))},zi=function(){Ri=St.y+vi,rn=Ri+me,Zi=St.x+hi,$i=Zi+fe};var Ge,Fe,pt,De,it=Ae,Bt=it.ownerDocument,vt=ae(it),dt=vt.getComputedStyle(it),Vt=dt.position,ni=it.style.left,Qt=it.style.top,Wt=it.style.right,ri=it.style.bottom,Rt=it.style.overflow,ut=(0,F.Z)((0,F.Z)({},Te[Re]),q),st=Bt.createElement("div");(Ge=it.parentElement)===null||Ge===void 0||Ge.appendChild(st),st.style.left="".concat(it.offsetLeft,"px"),st.style.top="".concat(it.offsetTop,"px"),st.style.position=Vt,st.style.height="".concat(it.offsetHeight,"px"),st.style.width="".concat(it.offsetWidth,"px"),it.style.left="0",it.style.top="0",it.style.right="auto",it.style.bottom="auto",it.style.overflow="hidden";var Nt;if(Array.isArray(ee))Nt={x:ee[0],y:ee[1],width:0,height:0};else{var Ht,wt,gt=ee.getBoundingClientRect();gt.x=(Ht=gt.x)!==null&&Ht!==void 0?Ht:gt.left,gt.y=(wt=gt.y)!==null&&wt!==void 0?wt:gt.top,Nt={x:gt.x,y:gt.y,width:gt.width,height:gt.height}}var St=it.getBoundingClientRect(),Ei=vt.getComputedStyle(it),zt=Ei.height,si=Ei.width;St.x=(Fe=St.x)!==null&&Fe!==void 0?Fe:St.left,St.y=(pt=St.y)!==null&&pt!==void 0?pt:St.top;var It=Bt.documentElement,We=It.clientWidth,h=It.clientHeight,m=It.scrollWidth,y=It.scrollHeight,C=It.scrollTop,H=It.scrollLeft,me=St.height,fe=St.width,Ce=Nt.height,je=Nt.width,at={left:0,top:0,right:We,bottom:h},kt={left:-H,top:-C,right:m-H,bottom:y-C},Mt=ut.htmlRegion,xt="visible",Kt="visibleFirst";Mt!=="scroll"&&Mt!==Kt&&(Mt=xt);var Et=Mt===Kt,ct=K(kt,ce),ot=K(at,ce),yt=Mt===xt?ot:ct,Tt=Et?ot:yt;it.style.left="auto",it.style.top="auto",it.style.right="0",it.style.bottom="0";var mi=it.getBoundingClientRect();it.style.left=ni,it.style.top=Qt,it.style.right=Wt,it.style.bottom=ri,it.style.overflow=Rt,(De=it.parentElement)===null||De===void 0||De.removeChild(st);var Xt=S(Math.round(fe/parseFloat(si)*1e3)/1e3),Yt=S(Math.round(me/parseFloat(zt)*1e3)/1e3);if(Xt===0||Yt===0||(0,oe.Sh)(ee)&&!(0,J.Z)(ee))return;var ht=ut.offset,At=ut.targetOffset,Pt=Ee(St,ht),be=(0,pe.Z)(Pt,2),Be=be[0],et=be[1],qe=Ee(Nt,At),rt=(0,pe.Z)(qe,2),_t=rt[0],Ot=rt[1];Nt.x-=_t,Nt.y-=Ot;var Ut=ut.points||[],bi=(0,pe.Z)(Ut,2),qt=bi[0],yi=bi[1],ci=Ne(yi),di=Ne(qt),Si=Qe(Nt,ci),wi=Qe(St,di),Ii=(0,F.Z)({},ut),hi=Si.x-wi.x+Be,vi=Si.y-wi.y+et,Di=un(hi,vi),Ti=un(hi,vi,ot),Ai=Qe(Nt,["t","l"]),Fi=Qe(St,["t","l"]),Li=Qe(Nt,["b","r"]),Oi=Qe(St,["b","r"]),Xi=ut.overflow||{},Ui=Xi.adjustX,Ci=Xi.adjustY,ki=Xi.shiftX,qi=Xi.shiftY,Qi=function(kn){return typeof kn=="boolean"?kn:kn>=0},Ri,rn,Zi,$i;zi();var ei=Qi(Ci),Dt=di[0]===ci[0];if(ei&&di[0]==="t"&&(rn>Tt.bottom||he.current.bt)){var gi=vi;Dt?gi-=me-Ce:gi=Ai.y-Oi.y-et;var Mi=un(hi,gi),Gi=un(hi,gi,ot);Mi>Di||Mi===Di&&(!Et||Gi>=Ti)?(he.current.bt=!0,vi=gi,et=-et,Ii.points=[bt(di,0),bt(ci,0)]):he.current.bt=!1}if(ei&&di[0]==="b"&&(Ri<Tt.top||he.current.tb)){var cn=vi;Dt?cn+=me-Ce:cn=Li.y-Fi.y-et;var hn=un(hi,cn),tn=un(hi,cn,ot);hn>Di||hn===Di&&(!Et||tn>=Ti)?(he.current.tb=!0,vi=cn,et=-et,Ii.points=[bt(di,0),bt(ci,0)]):he.current.tb=!1}var ln=Qi(Ui),xn=di[1]===ci[1];if(ln&&di[1]==="l"&&($i>Tt.right||he.current.rl)){var gn=hi;xn?gn-=fe-je:gn=Ai.x-Oi.x-Be;var bn=un(gn,vi),nn=un(gn,vi,ot);bn>Di||bn===Di&&(!Et||nn>=Ti)?(he.current.rl=!0,hi=gn,Be=-Be,Ii.points=[bt(di,1),bt(ci,1)]):he.current.rl=!1}if(ln&&di[1]==="r"&&(Zi<Tt.left||he.current.lr)){var yn=hi;xn?yn+=fe-je:yn=Li.x-Fi.x-Be;var sn=un(yn,vi),On=un(yn,vi,ot);sn>Di||sn===Di&&(!Et||On>=Ti)?(he.current.lr=!0,hi=yn,Be=-Be,Ii.points=[bt(di,1),bt(ci,1)]):he.current.lr=!1}zi();var fn=ki===!0?0:ki;typeof fn=="number"&&(Zi<ot.left&&(hi-=Zi-ot.left-Be,Nt.x+je<ot.left+fn&&(hi+=Nt.x-ot.left+je-fn)),$i>ot.right&&(hi-=$i-ot.right-Be,Nt.x>ot.right-fn&&(hi+=Nt.x-ot.right+fn)));var _n=qi===!0?0:qi;typeof _n=="number"&&(Ri<ot.top&&(vi-=Ri-ot.top-et,Nt.y+Ce<ot.top+_n&&(vi+=Nt.y-ot.top+Ce-_n)),rn>ot.bottom&&(vi-=rn-ot.bottom-et,Nt.y>ot.bottom-_n&&(vi+=Nt.y-ot.bottom+_n)));var Cn=St.x+hi,_i=Cn+fe,Kn=St.y+vi,$n=Kn+me,Fn=Nt.x,Bn=Fn+je,rs=Nt.y,ds=rs+Ce,Gn=Math.max(Cn,Fn),Bi=Math.min(_i,Bn),ps=(Gn+Bi)/2,ms=ps-Cn,Yn=Math.max(Kn,rs),Xn=Math.min($n,ds),qn=(Yn+Xn)/2,Vn=qn-Kn;W==null||W(Ae,Ii);var vn=mi.right-St.x-(hi+St.width),An=mi.bottom-St.y-(vi+St.height);Xt===1&&(hi=Math.round(hi),vn=Math.round(vn)),Yt===1&&(vi=Math.round(vi),An=Math.round(An));var wn={ready:!0,offsetX:hi/Xt,offsetY:vi/Yt,offsetR:vn/Xt,offsetB:An/Yt,arrowX:ms/Xt,arrowY:Vn/Yt,scaleX:Xt,scaleY:Yt,align:Ii};$(wn)}}),Ve=function(){Q.current+=1;var Fe=Q.current;Promise.resolve().then(function(){Q.current===Fe&&Ke()})},Je=function(){$(function(Fe){return(0,F.Z)((0,F.Z)({},Fe),{},{ready:!1})})};return(0,g.Z)(Je,[Re]),(0,g.Z)(function(){ge||Je()},[ge]),[X.ready,X.offsetX,X.offsetY,X.offsetR,X.offsetB,X.arrowX,X.arrowY,X.scaleX,X.scaleY,X.align,Ve]}var ti=U(3300);function ze(ge,Ae,ee,Re,Te){(0,g.Z)(function(){if(ge&&Ae&&ee){let Q=function(){Re(),Te()};var q=Ae,W=ee,z=te(q),re=te(W),X=ae(W),$=new Set([X].concat((0,ti.Z)(z),(0,ti.Z)(re)));return $.forEach(function(ce){ce.addEventListener("scroll",Q,{passive:!0})}),X.addEventListener("resize",Q,{passive:!0}),Re(),function(){$.forEach(function(ce){ce.removeEventListener("scroll",Q),X.removeEventListener("resize",Q)})}}},[ge,Ae,ee])}var Ct=U(48736);function Ze(ge,Ae,ee,Re,Te,q,W,z){var re=E.useRef(ge);re.current=ge;var X=E.useRef(!1);E.useEffect(function(){if(Ae&&Re&&(!Te||q)){var Q=function(){X.current=!1},ce=function(pt){var De;re.current&&!W(((De=pt.composedPath)===null||De===void 0||(De=De.call(pt))===null||De===void 0?void 0:De[0])||pt.target)&&!X.current&&z(!1)},he=ae(Re);he.addEventListener("pointerdown",Q,!0),he.addEventListener("mousedown",ce,!0),he.addEventListener("contextmenu",ce,!0);var we=(0,l.A)(ee);if(we&&(we.addEventListener("mousedown",ce,!0),we.addEventListener("contextmenu",ce,!0)),0)var Ke,Ve,Je,Ge;return function(){he.removeEventListener("pointerdown",Q,!0),he.removeEventListener("mousedown",ce,!0),he.removeEventListener("contextmenu",ce,!0),we&&(we.removeEventListener("mousedown",ce,!0),we.removeEventListener("contextmenu",ce,!0))}}},[Ae,ee,Re,Te,q]);function $(){X.current=!0}return $}var mt=["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 Ye(){var ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ue.Z,Ae=E.forwardRef(function(ee,Re){var Te=ee.prefixCls,q=Te===void 0?"rc-trigger-popup":Te,W=ee.children,z=ee.action,re=z===void 0?"hover":z,X=ee.showAction,$=ee.hideAction,Q=ee.popupVisible,ce=ee.defaultPopupVisible,he=ee.onPopupVisibleChange,we=ee.afterPopupVisibleChange,Ke=ee.mouseEnterDelay,Ve=ee.mouseLeaveDelay,Je=Ve===void 0?.1:Ve,Ge=ee.focusDelay,Fe=ee.blurDelay,pt=ee.mask,De=ee.maskClosable,it=De===void 0?!0:De,Bt=ee.getPopupContainer,vt=ee.forceRender,dt=ee.autoDestroy,Vt=ee.destroyPopupOnHide,ni=ee.popup,Qt=ee.popupClassName,Wt=ee.popupStyle,ri=ee.popupPlacement,Rt=ee.builtinPlacements,ut=Rt===void 0?{}:Rt,st=ee.popupAlign,Nt=ee.zIndex,Ht=ee.stretch,wt=ee.getPopupClassNameFromAlign,gt=ee.fresh,St=ee.alignPoint,Ei=ee.onPopupClick,zt=ee.onPopupAlign,si=ee.arrow,It=ee.popupMotion,We=ee.maskMotion,h=ee.popupTransitionName,m=ee.popupAnimation,y=ee.maskTransitionName,C=ee.maskAnimation,H=ee.className,me=ee.getTriggerDOMNode,fe=(0,Se.Z)(ee,mt),Ce=dt||Vt||!1,je=E.useState(!1),at=(0,pe.Z)(je,2),kt=at[0],Mt=at[1];(0,g.Z)(function(){Mt((0,v.Z)())},[]);var xt=E.useRef({}),Kt=E.useContext(Ie),Et=E.useMemo(function(){return{registerSubPopup:function(pi,ji){xt.current[pi]=ji,Kt==null||Kt.registerSubPopup(pi,ji)}}},[Kt]),ct=(0,k.Z)(),ot=E.useState(null),yt=(0,pe.Z)(ot,2),Tt=yt[0],mi=yt[1],Xt=E.useRef(null),Yt=(0,Z.Z)(function(ii){Xt.current=ii,(0,oe.Sh)(ii)&&Tt!==ii&&mi(ii),Kt==null||Kt.registerSubPopup(ct,ii)}),ht=E.useState(null),At=(0,pe.Z)(ht,2),Pt=At[0],be=At[1],Be=E.useRef(null),et=(0,Z.Z)(function(ii){(0,oe.Sh)(ii)&&Pt!==ii&&(be(ii),Be.current=ii)}),qe=E.Children.only(W),rt=(qe==null?void 0:qe.props)||{},_t={},Ot=(0,Z.Z)(function(ii){var pi,ji,an=Pt;return(an==null?void 0:an.contains(ii))||((pi=(0,l.A)(an))===null||pi===void 0?void 0:pi.host)===ii||ii===an||(Tt==null?void 0:Tt.contains(ii))||((ji=(0,l.A)(Tt))===null||ji===void 0?void 0:ji.host)===ii||ii===Tt||Object.values(xt.current).some(function(en){return(en==null?void 0:en.contains(ii))||ii===en})}),Ut=O(q,It,m,h),bi=O(q,We,C,y),qt=E.useState(ce||!1),yi=(0,pe.Z)(qt,2),ci=yi[0],di=yi[1],Si=Q!=null?Q:ci,wi=(0,Z.Z)(function(ii){Q===void 0&&di(ii)});(0,g.Z)(function(){di(Q||!1)},[Q]);var Ii=E.useRef(Si);Ii.current=Si;var hi=E.useRef([]);hi.current=[];var vi=(0,Z.Z)(function(ii){var pi;wi(ii),((pi=hi.current[hi.current.length-1])!==null&&pi!==void 0?pi:Si)!==ii&&(hi.current.push(ii),he==null||he(ii))}),Di=E.useRef(),Ti=function(){clearTimeout(Di.current)},Ai=function(pi){var ji=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Ti(),ji===0?vi(pi):Di.current=setTimeout(function(){vi(pi)},ji*1e3)};E.useEffect(function(){return Ti},[]);var Fi=E.useState(!1),Li=(0,pe.Z)(Fi,2),Oi=Li[0],Xi=Li[1];(0,g.Z)(function(ii){(!ii||Si)&&Xi(!0)},[Si]);var Ui=E.useState(null),Ci=(0,pe.Z)(Ui,2),ki=Ci[0],qi=Ci[1],Qi=E.useState(null),Ri=(0,pe.Z)(Qi,2),rn=Ri[0],Zi=Ri[1],$i=function(pi){Zi([pi.clientX,pi.clientY])},ei=Lt(Si,Tt,St&&rn!==null?rn:Pt,ri,ut,st,zt),Dt=(0,pe.Z)(ei,11),gi=Dt[0],Mi=Dt[1],Gi=Dt[2],cn=Dt[3],hn=Dt[4],tn=Dt[5],ln=Dt[6],xn=Dt[7],gn=Dt[8],bn=Dt[9],nn=Dt[10],yn=$e(kt,re,X,$),sn=(0,pe.Z)(yn,2),On=sn[0],fn=sn[1],_n=On.has("click"),Cn=fn.has("click")||fn.has("contextMenu"),_i=(0,Z.Z)(function(){Oi||nn()}),Kn=function(){Ii.current&&St&&Cn&&Ai(!1)};ze(Si,Pt,Tt,_i,Kn),(0,g.Z)(function(){_i()},[rn,ri]),(0,g.Z)(function(){Si&&!(ut!=null&&ut[ri])&&_i()},[JSON.stringify(st)]);var $n=E.useMemo(function(){var ii=N(ut,q,bn,St);return p()(ii,wt==null?void 0:wt(bn))},[bn,wt,ut,q,St]);E.useImperativeHandle(Re,function(){return{nativeElement:Be.current,popupElement:Xt.current,forceAlign:_i}});var Fn=E.useState(0),Bn=(0,pe.Z)(Fn,2),rs=Bn[0],ds=Bn[1],Gn=E.useState(0),Bi=(0,pe.Z)(Gn,2),ps=Bi[0],ms=Bi[1],Yn=function(){if(Ht&&Pt){var pi=Pt.getBoundingClientRect();ds(pi.width),ms(pi.height)}},Xn=function(){Yn(),_i()},qn=function(pi){Xi(!1),nn(),we==null||we(pi)},Vn=function(){return new Promise(function(pi){Yn(),qi(function(){return pi})})};(0,g.Z)(function(){ki&&(nn(),ki(),qi(null))},[ki]);function vn(ii,pi,ji,an){_t[ii]=function(en){var gs;an==null||an(en),Ai(pi,ji);for(var Mn=arguments.length,_s=new Array(Mn>1?Mn-1:0),Jn=1;Jn<Mn;Jn++)_s[Jn-1]=arguments[Jn];(gs=rt[ii])===null||gs===void 0||gs.call.apply(gs,[rt,en].concat(_s))}}(_n||Cn)&&(_t.onClick=function(ii){var pi;Ii.current&&Cn?Ai(!1):!Ii.current&&_n&&($i(ii),Ai(!0));for(var ji=arguments.length,an=new Array(ji>1?ji-1:0),en=1;en<ji;en++)an[en-1]=arguments[en];(pi=rt.onClick)===null||pi===void 0||pi.call.apply(pi,[rt,ii].concat(an))});var An=Ze(Si,Cn,Pt,Tt,pt,it,Ot,Ai),wn=On.has("hover"),un=fn.has("hover"),zi,dn;wn&&(vn("onMouseEnter",!0,Ke,function(ii){$i(ii)}),vn("onPointerEnter",!0,Ke,function(ii){$i(ii)}),zi=function(pi){(Si||Oi)&&Tt!==null&&Tt!==void 0&&Tt.contains(pi.target)&&Ai(!0,Ke)},St&&(_t.onMouseMove=function(ii){var pi;(pi=rt.onMouseMove)===null||pi===void 0||pi.call(rt,ii)})),un&&(vn("onMouseLeave",!1,Je),vn("onPointerLeave",!1,Je),dn=function(){Ai(!1,Je)}),On.has("focus")&&vn("onFocus",!0,Ge),fn.has("focus")&&vn("onBlur",!1,Fe),On.has("contextMenu")&&(_t.onContextMenu=function(ii){var pi;Ii.current&&fn.has("contextMenu")?Ai(!1):($i(ii),Ai(!0)),ii.preventDefault();for(var ji=arguments.length,an=new Array(ji>1?ji-1:0),en=1;en<ji;en++)an[en-1]=arguments[en];(pi=rt.onContextMenu)===null||pi===void 0||pi.call.apply(pi,[rt,ii].concat(an))}),H&&(_t.className=p()(rt.className,H));var kn=E.useRef(!1);kn.current||(kn.current=vt||Si||Oi);var jn=(0,F.Z)((0,F.Z)({},rt),_t),as={},Qn=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Qn.forEach(function(ii){fe[ii]&&(as[ii]=function(){for(var pi,ji=arguments.length,an=new Array(ji),en=0;en<ji;en++)an[en]=arguments[en];(pi=jn[ii])===null||pi===void 0||pi.call.apply(pi,[jn].concat(an)),fe[ii].apply(fe,an)})});var Yi=E.cloneElement(qe,(0,F.Z)((0,F.Z)({},jn),as)),pn={x:tn,y:ln},os=si?(0,F.Z)({},si!==!0?si:{}):null;return E.createElement(E.Fragment,null,E.createElement(ve.Z,{disabled:!Si,ref:et,onResize:Xn},E.createElement(ne,{getTriggerDOMNode:me},Yi)),kn.current&&E.createElement(Ie.Provider,{value:Et},E.createElement(Y,{portal:ge,ref:Yt,prefixCls:q,popup:ni,className:p()(Qt,$n),style:Wt,target:Pt,onMouseEnter:zi,onMouseLeave:dn,onPointerEnter:zi,zIndex:Nt,open:Si,keepDom:Oi,fresh:gt,onClick:Ei,onPointerDownCapture:An,mask:pt,motion:Ut,maskMotion:bi,onVisibleChanged:qn,onPrepare:Vn,forceRender:vt,autoDestroy:Ce,getPopupContainer:Bt,align:bn,arrow:os,arrowPos:pn,ready:gi,offsetX:Mi,offsetY:Gi,offsetR:cn,offsetB:hn,onAlign:_i,stretch:Ht,targetWidth:rs/xn,targetHeight:ps/gn})))});return Ae}var ke=Ye(ue.Z)},57884:function(Zt,nt,U){"use strict";var F=U(59301),pe=U(93314),Se=U(99571),ue=Object.defineProperty,G=Object.defineProperties,p=Object.getOwnPropertyDescriptors,ve=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,Z=(E,A,M)=>A in E?ue(E,A,{enumerable:!0,configurable:!0,writable:!0,value:M}):E[A]=M,k=(E,A)=>{for(var M in A||(A={}))oe.call(A,M)&&Z(E,M,A[M]);if(ve)for(var M of ve(A))l.call(A,M)&&Z(E,M,A[M]);return E},g=(E,A)=>G(E,p(A));const v=({img:E,buttonProps:A={},styles:M={},customText:j,ButtonText:V,ButtonClick:L,Buttonclass:I,ButtonTwo:w,imgStyles:R,loading:Y=!1,className:se=""})=>F.createElement("section",{className:`tc animated fadeIn ${se}`,style:k({color:"#999",margin:"100px auto",visibility:Y?"hidden":"visible"},M)},F.createElement("img",{src:E||pe,style:g(k({},R),{pointerEvents:"none",userSelect:"none"})}),F.createElement("p",{className:"mt20 font14"},j||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),V&&F.createElement(Se.ZP,k({className:I,onClick:L},A),V),w&&w);nt.Z=v},41550:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return I}});var F=U(59301),pe={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},Se=U(99571),ue=U(70557),G=U(51124),p=U(25399),ve=U(49661),oe=U(72664),l=U(57884),Z=U(90524),k=U(14794),g=U(59301),v=Object.defineProperty,E=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,j=(w,R,Y)=>R in w?v(w,R,{enumerable:!0,configurable:!0,writable:!0,value:Y}):w[R]=Y,V=(w,R)=>{for(var Y in R||(R={}))A.call(R,Y)&&j(w,Y,R[Y]);if(E)for(var Y of E(R))M.call(R,Y)&&j(w,Y,R[Y]);return w},L=(w,R,Y)=>new Promise((se,ne)=>{var ye=$e=>{try{xe(Y.next($e))}catch(J){ne(J)}},Ie=$e=>{try{xe(Y.throw($e))}catch(J){ne(J)}},xe=$e=>$e.done?se($e.value):Promise.resolve($e.value).then(ye,Ie);xe((Y=Y.apply(w,R)).next())}),I=({editOffice:w="view",data:R,issaver:Y,onSaver:se,theme:ne,type:ye,filename:Ie,monacoEditor:xe,className:$e,style:J,close:D,onClose:N,hasMask:O,disabledDownload:ae,onImgDimensions:te,showNodata:S,recordInfo:b})=>{const[K,le]=(0,F.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Ee,Ne]=(0,F.useState)(""),[Qe,bt]=(0,F.useState)(),Lt=window.ENV==="build"?"/react/build":"",ti=location.host.startsWith("localhost")?Z.Z.PROXY_SERVER:Z.Z.API_SERVER,Ct=10*(1024*1024),Ze=(0,F.useRef)();R!=null&&R.startsWith("/api")&&ye!=="txt"&&(R=Z.Z.API_SERVER+R);const mt=ee=>ee.substring(ee.lastIndexOf("/")+1).split(".").pop();Ie&&xe&&(xe.filename=Ie),(0,F.useEffect)(()=>{var ee,Re;const Te=(Re=(ee=document.cookie)==null?void 0:ee.replace(/\s/g,""))==null?void 0:Re.split(";");Te==null||Te.map(q=>{let W=q.split("=");W[0]==="_educoder_session"&&Ne(W[1])})},[]),(0,F.useEffect)(()=>{ye==="office"&&(R.indexOf("bigfilescdn.")>-1||R.indexOf("bigfiles1")>-1?bt({url:R,fileType:mt(R),model:R.indexOf("model=edit")?"edit":"view"}):ke())},[ye,R]);function Ye(ee){return L(this,null,function*(){ee.data.type==="pdfdata"&&(se(ee.data.data),window.removeEventListener("message",Ye,!1)),console.log("mess---:",ee.data)})}const ke=()=>L(void 0,null,function*(){console.log("data:",R);let ee=R;R.startsWith("http")||(ee=location.origin+ee);let Re=new URL(ee).pathname.split("/").pop();const Te=yield(0,oe.gJ)({attachment_id:Re});Te.url=ti+Te.url,bt(Te)}),ge=()=>{if(R.startsWith("http")||R.startsWith("blob:")){Ae();return}(0,ve.Sv)(Ie||"educoder",R,Ie)},Ae=()=>{b&&(0,k.fc)({id:b==null?void 0:b.id,watch_type:1,course_id:b==null?void 0:b.course_id}),(0,ve.Nd)(Ie||"educoder",decodeURIComponent(R))};return g.createElement("div",{style:V({},J||{}),className:`${O&&pe.bgBlack} ${ye?pe.wrp:"hide"}`},D&&g.createElement("div",{className:pe.close,ref:Ze},!!te&&g.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>Ze.current},g.createElement("span",{onClick:()=>{N(),te()}},g.createElement("i",{className:"icon-yulanpizhu"}))),!ae&&g.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>Ze.current},g.createElement("span",{onClick:Ae},g.createElement("i",{className:"icon-quxiaozhiding"}))),Y&&g.createElement(p.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>Ze.current},g.createElement("span",{className:"",onClick:()=>{const ee=document.getElementById("pdfiframe");window.addEventListener("message",Ye,!1),setTimeout(()=>{ee.contentWindow.postMessage("getData","*")},300)}},g.createElement("i",{className:"icon-baocun"}))),g.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>Ze.current},g.createElement("span",{className:"",onClick:()=>{N()}},g.createElement("i",{className:"icon-guanbi1"})))),g.createElement("div",{className:`${pe[$e]} ${$e} ${pe.monaco} ${ye==="txt"?"show":"hide"}`},ye==="txt"&&g.createElement(g.Fragment,null,g.createElement(G.ZP,V({},xe)))),ye==="audio"&&g.createElement("audio",{src:`${(R==null?void 0:R.indexOf("http://"))>-1||(R==null?void 0:R.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${R}`,autoPlay:!0}),ye==="video"&&g.createElement(g.Fragment,null,(R==null?void 0:R.indexOf("http"))>-1?g.createElement("video",{controls:!0,src:`${R}`,autoPlay:!0}):g.createElement("video",{controls:!0,src:`data:video/mp4;base64,${R}`,autoPlay:!0})),ye==="office"&&Qe&&g.createElement("iframe",{src:`${Lt}/office.html?key=${Qe.key}&url=${btoa(Qe.url)}&callbackUrl=${ti+(Qe.callbackUrl||"")}&fileType=${Qe.fileType}&title=${Qe.title||""}&model=${w}&officeServer=${Z.Z.ONLYOFFICE}&disabledDownload=${!!ae}`}),ye==="html"&&g.createElement("iframe",{src:R+"&disposition=inline"}),ye==="pdf"&&g.createElement("iframe",{id:"pdfiframe",src:`${Lt}/js/pdfview/index.html?filename=${Ie||"educoder.pdf"}&url=${encodeURIComponent(R)}&disabledDownload=${!!ae}&model=${w}`}),ye==="image"&&g.createElement("img",{src:`${(R==null?void 0:R.indexOf("http://"))>-1||(R==null?void 0:R.indexOf("https://"))>-1?"":"data:image/png;base64,"}${R}`}),(ye==="other"||ye==="download")&&g.createElement(g.Fragment,null,S?g.createElement(l.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:g.createElement(Se.ZP,{icon:g.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:ge,disabled:ae},"\u4E0B\u8F7D")}):g.createElement(Se.ZP,{type:"primary",size:"middle",onClick:ge,disabled:ae},g.createElement(ue.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")),ye==="flowChart"&&g.createElement("div",{className:"embed"},g.createElement("iframe",{src:`/drawio/src/main/webapp/viewer.html?id=${R||""}&gapi=0&od=0&db=0&gh=0&gl=0`,width:"100%",height:"100%",frameBorder:"0"})))}},93152:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return A}});var F=U(59301),pe=U(6767),Se=U(75727),ue=U(60513),G=U(68535),p=U(34055),ve=U(56102),oe=U(2610),l={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"},Z=(M,j,V)=>new Promise((L,I)=>{var w=se=>{try{Y(V.next(se))}catch(ne){I(ne)}},R=se=>{try{Y(V.throw(se))}catch(ne){I(ne)}},Y=se=>se.done?L(se.value):Promise.resolve(se.value).then(w,R);Y((V=V.apply(M,j)).next())});function k(M){if(isNaN(M))return{minutes:"00",seconds:"00"};const j=new Date(M*1e3).toISOString().substr(11,8);return{hour:j.substr(0,2),minutes:j.substr(3,2),seconds:j.substr(6,2)}}Object.defineProperty(HTMLMediaElement.prototype,"playing",{get:function(){return this.currentTime>0&&!this.paused&&!this.ended&&this.readyState>2}});function g(M,j){return M-j}function v(M){M.sort(g);let j=0;for(let V=0;V<M.length-1;V++){let L=Math.abs(M[V+1]-M[V]);L<21&&(j+=L)}return j}const E=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;var A=(0,F.forwardRef)(({allow_skip:M,src:j,toLog:V,videoId:L,logWatchHistory:I,courseId:w=null,startTime:R,handlePause:Y=()=>{},handlePlay:se=()=>{},handlePlayEnded:ne=()=>{},autoPlay:ye=!1,onPlayEnded:Ie=()=>{},isShowWaterMark:xe=!0},$e)=>{var J;j=j==null?void 0:j.replace("http://","https://");const N=((J=j==null?void 0:j.split("."))==null?void 0:J.pop())==="flv",O=(0,F.useRef)(),ae=(0,F.useRef)(),te=(0,F.useRef)(),S=(0,F.useRef)(),b=(0,F.useRef)(),K=(0,F.useRef)(),le=(0,F.useRef)(),Ee=(0,F.useRef)(),Ne=(0,F.useRef)(),Qe=(0,F.useRef)(),bt=(0,F.useRef)(),Lt=(0,F.useRef)(),ti=(0,F.useRef)(),ze=(0,F.useRef)(),Ct=navigator.userAgent.toLowerCase().match(E),Ze=Ct?Ct[0]:"pc",mt=(0,F.useRef)(!1),Ye=(0,p.eY)();let ke=0,ge=0,Ae=0,ee=null,Re=!1,Te=20,q=1,W=!1,z=!1,re=[];(0,F.useImperativeHandle)($e,()=>({getLastUpdatedTime:()=>O.current.currentTime,getDuration:()=>O.current.duration})),pe.ZP.config({maxCount:1,getContainer:()=>te.current});const X=(0,F.useCallback)((Ve,Je=!1)=>{let Ge={point:O.current.currentTime};ee?(Ge.log_id=ee,Ge.watch_duration=v(re),Ge.total_duration=ge):(w?(Ge.video_id=parseInt(L,10),Ge.course_id=w):Ge.video_id=L,Ge.duration=ke,Ge.device=Ze),Je&&(Ge.ed="1");function Fe(){return Z(this,null,function*(){W=!0,ee=yield I==null?void 0:I(Ge),W=!1,Ve&&Ve()})}Fe()},[L,w]);(0,F.useEffect)(()=>{O.current&&(S.current.style.display="none",b.current.style.display="block"),pe.ZP.destroy();let Ve=null;return ue.Z.isSupported&&N&&j&&(j==null?void 0:j.indexOf(".m3u8"))<0?(Ve=ue.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:j,muted:!1}),O.current&&(Ve.attachMediaElement(O.current),Ve.load())):O.current.setAttribute("src",j),Q(),()=>{Ve&&(Ve.unload(),Ve.pause(),Ve.destroy(),Ve=null)}},[O,N,j]);function $(){O.current.paused?(S.current.style.display="none",b.current.style.display="block"):(S.current.style.display="block",b.current.style.display="none")}function Q(){bt.current.style.display="none",ti.current.style.display="none",Lt.current.style.display="none",O.current.muted||O.current.volume===0?bt.current.style.display="block":O.current.volume>0&&O.current.volume<=.5?ti.current.style.display="block":Lt.current.style.display="block"}(0,F.useEffect)(()=>{const Ve=document.getElementById("play"),Je=document.querySelectorAll(".playback-icons use");function Ge(){se(),R&&!mt.current&&(O.current.currentTime=R),mt.current=!0,re.push(O.current.currentTime),Re||(Re=!0,V&&X())}function Fe(){return Z(this,null,function*(){$(),re.push(O.current.currentTime),V&&X(()=>{ee=null,Ae=0,Re=!1,W=!1,z=!1,re=[],ge=0,q=1},!0),Ie()})}function pt(){K.current.value=Math.round(O.current.currentTime),le.current.value=Math.round(O.current.currentTime)}function De(){const ut=k(Math.round(O.current.currentTime));Ne.current.innerText=`${ut.hour>0?ut.hour+":":""}${ut.minutes}:${ut.seconds}`,Ne.current.setAttribute("datetime",`${ut.hour>0?" "+ut.hour+" ":""}${ut.minutes}m ${ut.seconds}s`)}function it(){var ut,st,Nt,Ht,wt,gt,St;const Ei=Math.round((ut=O.current)==null?void 0:ut.duration);(Nt=(st=K.current)==null?void 0:st.setAttribute)==null||Nt.call(st,"max",Ei),(wt=(Ht=le.current)==null?void 0:Ht.setAttribute)==null||wt.call(Ht,"max",Ei);const zt=k(Ei);Ee.current&&(Ee.current.innerText=`${zt.hour>0?zt.hour+":":""}${zt.minutes}:${zt.seconds}`,(St=(gt=Ee.current).setAttribute)==null||St.call(gt,"datetime",`${zt.hour>0?" "+zt.hour+" ":""}${zt.minutes}m ${zt.seconds}s`))}function Bt(){try{const ut=Math.round(O.current.duration);K.current.setAttribute("max",ut),le.current.setAttribute("max",ut);const st=k(ut);Ee.current.innerText=`${st.hour>0?st.hour+":":""}${st.minutes}:${st.seconds}`,Ee.current.setAttribute("datetime",`${st.hour>0?" "+st.hour+" ":""}${st.minutes}m ${st.seconds}s`),pt(),De();const{width:Nt,height:Ht,x:wt,y:gt}=ae.current.getBoundingClientRect();if(wt<0||gt<0,!z){let St=O.current.currentTime,Ei=St-Ae;Math.abs(Ei)<10?(ge+=Math.abs(Ei),Ae=St,W||ge-q*Te>=0&&(q++,re.push(Ae),V&&X())):(Ae=St,V&&X())}}catch(ut){console.log("videoplaying:",ut)}}function vt(){z=!0}function dt(){O.current.playing&&re.push(O.current.currentTime,Ae),Ae=O.current.currentTime,z=!1}function Vt(){ke=O.current.duration,ke<=20&&(Te=ke/3),O.current.addEventListener("play",Ge)}function ni(ut){ut.preventDefault(),(0,oe.vp)()?(O.current.style.width="100%",O.current.style.height="100%"):O.current.style.cssText=""}function Qt(){Y()}function Wt(ut){if(!M){pe.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");return}const st=ut.target.dataset.seek?ut.target.dataset.seek:ut.target.value;O.current.currentTime=st,le.current.value=st,K.current.value=st}function ri(ut){const st=Math.round(ut.offsetX/ut.target.clientWidth*parseInt(ut.target.getAttribute("max"),10));K.current.setAttribute("data-seek",st);const Nt=k(st);Qe.current.textContent=`${Nt.hour>0?Nt.hour+":":""}${Nt.minutes}:${Nt.seconds}`;const Ht=O.current.getBoundingClientRect();Qe.current.style.left=`${ut.pageX-Ht.left}px`}function Rt(ut){switch(ut.code){case"Space":ut.preventDefault(),we();break;case"ArrowRight":if(ut.preventDefault(),!M){pe.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(O.current.currentTime>=O.current.duration)break;O.current.currentTime=parseInt(O.current.currentTime)+5,pt();break;case"ArrowLeft":if(ut.preventDefault(),!M){pe.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(O.current.currentTime===0)break;O.current.currentTime=parseInt(O.current.currentTime)-5,pt();break;case"ArrowUp":ut.preventDefault(),O.current.volume<1&&(O.current.volume=(parseInt(O.current.volume*10)+1)/10);break;case"ArrowDown":ut.preventDefault(),O.current.volume>0&&(O.current.volume=(parseInt(O.current.volume*10)-1)/10);break}}return te.current.addEventListener((0,oe.gH)(),ni),O.current.addEventListener("canplay",Vt),O.current.addEventListener("ended",Fe),O.current.addEventListener("seeking",vt),O.current.addEventListener("seeked",dt),O.current.addEventListener("loadedmetadata",it),K.current.addEventListener("mousemove",ri),K.current.addEventListener("input",Wt),O.current.addEventListener("timeupdate",Bt),O.current.addEventListener("pause",Qt),O.current.addEventListener("volumechange",Q),document.addEventListener("keydown",Rt),()=>{var ut,st,Nt,Ht,wt,gt,St,Ei,zt,si,It,We;(ut=O.current)==null||ut.removeEventListener("canplay",Vt),(st=O.current)==null||st.removeEventListener("play",Ge),(Nt=O.current)==null||Nt.removeEventListener("ended",Fe),(Ht=O.current)==null||Ht.removeEventListener("seeking",vt),(wt=O.current)==null||wt.removeEventListener("seeked",dt),(gt=K.current)==null||gt.removeEventListener("mousemove",ri),(St=K.current)==null||St.removeEventListener("input",Wt),(Ei=O.current)==null||Ei.removeEventListener("timeupdate",Bt),(zt=O.current)==null||zt.removeEventListener("pause",Qt),(si=O.current)==null||si.removeEventListener("loadedmetadata",it),(It=O.current)==null||It.removeEventListener("volumechange",Q),document.removeEventListener("keydown",Rt),(We=O.current)!=null&&We.playing&&(re.push(Ae,O.current.currentTime),V&&X())}},[O,j]),(0,F.useEffect)(()=>{if(O.current.onended=()=>{ne(O)},O.current.oncontextmenu=()=>!1,(j==null?void 0:j.indexOf(".m3u8"))>-1){if(O.current.canPlayType("application/vnd.apple.mpegurl"))O.current.src=j;else if(G.ZP.isSupported()){var Ve=new G.ZP;Ve.loadSource(j),Ve.attachMedia(O.current)}}},[j]);const[ce,he]=(0,F.useState)(1),we=()=>{O.current.paused||O.current.ended?O.current.play():O.current.pause(),$()};function Ke(){O.current.muted=!O.current.muted,O.current.muted?(ze.current.setAttribute("data-volume",volume.value),ze.current.value=0):ze.current.value=ze.current.dataset.volume}return F.createElement("div",{style:{position:"relative"},ref:te},F.createElement("div",{ref:ae,className:`${l.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${l.animate__loop}`},xe&&Ye?Ye.login:" "),F.createElement("div",{className:l.container},F.createElement("div",{className:l["video-container"],id:"video-container"},F.createElement("div",{className:l["playback-animation"],id:"playback-animation"},F.createElement("svg",{className:l["playback-icons"]},F.createElement("use",{className:"hidden",href:"#play-icon"}),F.createElement("use",{href:"#pause"}))),F.createElement("video",{className:l.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:O,autoPlay:ye}),F.createElement("div",{className:`${l["video-controls"]} `,id:"video-controls"},F.createElement("div",{className:l["bottom-controls"]},F.createElement("div",{className:l["left-controls"]},F.createElement("button",{"data-title":"\u64AD\u653E/\u6682\u505C",id:"play",onClick:we},F.createElement("svg",{className:l["playback-icons"]},F.createElement("use",{ref:b,href:"#play-icon"}),F.createElement("use",{ref:S,style:{display:"none"},href:"#pause"}))),F.createElement("div",{className:l.time},F.createElement("time",{id:"time-elapsed",ref:Ne},"00:00"),F.createElement("span",null," / "),F.createElement("time",{id:"duration",ref:Ee},"00:00"))),F.createElement("div",{className:l["right-controls"]},M&&F.createElement(Se.Z,{placement:"top",overlayClassName:l.rateOverlay,getPopupContainer:Ve=>Ve.parentNode,menu:{items:[{key:"1",label:F.createElement("span",{onClick:()=>{he(1),O.current.playbackRate=1}},"1.0x")},{key:"2",label:F.createElement("span",{onClick:()=>{he(1.5),O.current.playbackRate=1.5}},"1.5x")},{key:"3",label:F.createElement("span",{onClick:()=>{he(2),O.current.playbackRate=2}},"2.0x")}]}},F.createElement("div",{className:`${l.controlText} mr5`},"\u500D\u901F")),F.createElement(ve.CopyToClipboard,{text:j,onCopy:()=>pe.ZP.success("\u590D\u5236\u6210\u529F")},F.createElement("button",{"data-title":"\u590D\u5236\u94FE\u63A5"},F.createElement("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}}))),F.createElement("div",{className:l["volume-controls"]},F.createElement("button",{"data-title":"\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",className:l["volume-button"],id:"volume-button",onClick:Ke},F.createElement("i",{ref:bt,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),F.createElement("i",{ref:ti,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),F.createElement("i",{ref:Lt,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})),F.createElement("input",{className:l.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:ze,style:{display:"none"},onClick:Q})),F.createElement("button",{"data-title":"\u5168\u5C4F/\u9000\u51FA\u5168\u5C4F",className:l["fullscreen-button"],onClick:()=>{(0,oe.vp)()?(0,oe.BU)():(0,oe.Dj)(te.current)}},F.createElement("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})))),F.createElement("div",{className:l["video-progress"]},F.createElement("progress",{ref:le,value:"0",min:"0"}),F.createElement("input",{className:l.seek,ref:K,value:"0",min:"0",type:"range",step:"1"}),F.createElement("div",{className:l["seek-tooltip"],ref:Qe,id:"seek-tooltip"},"00:00"))))),F.createElement("svg",{style:{display:"none"}},F.createElement("defs",null,F.createElement("symbol",{id:"pause",viewBox:"0 0 24 24"},F.createElement("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})),F.createElement("symbol",{id:"play-icon",viewBox:"0 0 24 24"},F.createElement("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})),F.createElement("symbol",{id:"volume-high",viewBox:"0 0 24 24"},F.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"})),F.createElement("symbol",{id:"volume-low",viewBox:"0 0 24 24"},F.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"})),F.createElement("symbol",{id:"volume-mute",viewBox:"0 0 24 24"},F.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"})),F.createElement("symbol",{id:"fullscreen",viewBox:"0 0 24 24"},F.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"})),F.createElement("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24"},F.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"})),F.createElement("symbol",{id:"pip",viewBox:"0 0 24 24"},F.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"})))))})},51124:function(Zt,nt,U){"use strict";U.d(nt,{SV:function(){return Ct},ZP:function(){return ze}});var F=U(59301),pe=U(76374);const Se={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},ue={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},G={keywords:["abstract","amp","array","auto","bool","break","case","catch","char","class","const","constexpr","const_cast","continue","cpu","decltype","default","delegate","delete","do","double","dynamic_cast","each","else","enum","event","explicit","export","extern","false","final","finally","float","friend","gcnew","generic","goto","in","initonly","inline","int","interface","interior_ptr","internal","literal","long","mutable","namespace","new","noexcept","nullptr","__nullptr","operator","override","partial","pascal","pin_ptr","private","property","protected","public","ref","register","reinterpret_cast","restrict","return","safe_cast","sealed","short","signed","sizeof","static","static_assert","static_cast","struct","switch","template","this","thread_local","throw","tile_static","true","try","typedef","typeid","typename","union","unsigned","using","virtual","void","volatile","wchar_t","where","while","_asm","_based","_cdecl","_declspec","_fastcall","_if_exists","_if_not_exists","_inline","_multiple_inheritance","_pascal","_single_inheritance","_stdcall","_virtual_inheritance","_w64","__abstract","__alignof","__asm","__assume","__based","__box","__builtin_alignof","__cdecl","__clrcall","__declspec","__delegate","__event","__except","__fastcall","__finally","__forceinline","__gc","__hook","__identifier","__if_exists","__if_not_exists","__inline","__int128","__int16","__int32","__int64","__int8","__interface","__leave","__m128","__m128d","__m128i","__m256","__m256d","__m256i","__m64","__multiple_inheritance","__newslot","__nogc","__noop","__nounwind","__novtordisp","__pascal","__pin","__pragma","__property","__ptr32","__ptr64","__raise","__restrict","__resume","__sealed","__single_inheritance","__stdcall","__super","__thiscall","__try","__try_cast","__typeof","__unaligned","__unhook","__uuidof","__value","__virtual_inheritance","__w64","__wchar_t"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],quickKey:[{label:"ifelse",content:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`)},{label:"include",content:"include<$0>"},{label:"printf",content:"printf($0)"},{label:"system",content:'system("$0")'},{label:"main",content:["int main () {"," $0","}"].join(`
`)},{label:"if",content:["if () {"," $0","}"].join(`
`)},{label:"for",content:["for(int j=0 ; j<10; j++){"," $0","}"].join(`
`)},{label:"trycatch",content:["try{"," $0","}catch(ExceptionName e){","}"].join(`
`)},{label:"using namespace std;",content:["using namespace std;"].join(`
`)},{label:"include <iostream>",content:["#include <iostream>"].join(`
`)},{label:"include <vector>",content:["#include <vector>"].join(`
`)},{label:"include <cstdio>",content:["#include <cstdio>"].join(`
`)},{label:"include <cstring>",content:["#include <cstring>"].join(`
`)},{label:"include <sstream>",content:["#include <sstream>"].join(`
`)},{label:"include <fstream>",content:["#include <fstream>"].join(`
`)},{label:"include <map>",content:["#include <map>"].join(`
`)},{label:"include <string>",content:["#include <string>"].join(`
`)},{label:"include <cmath>",content:["#include <cmath>"].join(`
`)}]},p={keywords:["and","as","assert","break","class","continue","def","del","elif","else","except","exec","finally","for","from","global","if","import","in","is","lambda","None","not","or","pass","raise","return","self","try","while","with","yield","int","float","long","complex","hex","abs","all","any","apply","basestring","bin","bool","buffer","bytearray","callable","chr","classmethod","cmp","coerce","compile","complex","delattr","dict","dir","divmod","enumerate","eval","execfile","file","filter","format","frozenset","getattr","globals","hasattr","hash","help","id","input","intern","isinstance","issubclass","iter","len","locals","list","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","reversed","range","raw_input","reduce","reload","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","unichr","unicode","vars","xrange","zip","True","False","__dict__","__methods__","__members__","__class__","__bases__","__name__","__mro__","__subclasses__","__init__","__import__"],quickKey:[{label:"print",content:["print($0)"].join(`
`)}]},ve={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],quickKey:[{label:"println",content:["println($0)"].join(`
`)}]};var oe=U(53184),l=U.n(oe),Z=(Ze,mt,Ye)=>new Promise((ke,ge)=>{var Ae=Te=>{try{Re(Ye.next(Te))}catch(q){ge(q)}},ee=Te=>{try{Re(Ye.throw(Te))}catch(q){ge(q)}},Re=Te=>Te.done?ke(Te.value):Promise.resolve(Te.value).then(Ae,ee);Re((Ye=Ye.apply(Ze,mt)).next())});const k={languages:["c","abap","apex","azcli","bat","cameligo","clojure","coffee","cpp","csharp","csp","css","dockerfile","fsharp","go","graphql","handlebars","html","ini","java","javascript","json","kotlin","less","lua","markdown","mips","msdax","mysql","objective-c","pascal","pascaligo","perl","pgsql","php","postiats","powerquery","powershell","pug","python","r","razor","redis","redshift","restructuredtext","ruby","rust","sb","scheme","scss","shell","solidity","sophia","sql","st","swift","tcl","twig","vb","xml","yaml'"],tables:{users:["name","id","email","phone","password"],roles:["id","name","order","created_at","updated_at","deleted_at"]}},g=(Ze,mt,Ye,ke)=>{const ge=mt.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:Ye.lineNumber,endColumn:Ye.column});return Array.from(new Set(ge.match(/\b\w{2,}\b/g)||[])).map(ee=>({label:ee,kind:Ze.languages.CompletionItemKind.Text,insertText:ee,range:ke}))},v=(Ze,mt,Ye,ke)=>{Ze.languages.registerCompletionItemProvider(mt,{provideCompletionItems(ge,Ae){const ee=ge.getWordUntilPosition(Ae),Re={startLineNumber:Ae.lineNumber,endLineNumber:Ae.lineNumber,startColumn:ee.startColumn,endColumn:ee.endColumn},Te=ge.getLineContent(Ae.lineNumber).substring(ee.startColumn-2,ee.endColumn);return{suggestions:[...g(Ze,ge,Ae,Re),...Ye.map(W=>({label:W,kind:Ze.languages.CompletionItemKind.Keyword,documentation:W,insertText:W,insertTextRules:Ze.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re})),...ke.map(W=>({label:W.label,kind:Ze.languages.CompletionItemKind.Snippet,documentation:W.content,insertText:Te.startsWith("#")?W.content.replace(/#/,""):W.content,insertTextRules:Ze.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Re}))]}}})};var E=Ze=>{k.languages.forEach(mt=>{Ze.languages.registerDocumentFormattingEditProvider(mt,{provideDocumentFormattingEdits(Ye){return Z(this,null,function*(){const ke=l()(Ye.getValue(),{indent_size:2,indent_char:" ",max_preserve_newlines:2,preserve_newlines:!0,keep_array_indentation:!0,break_chained_methods:!1,indent_scripts:"normal",brace_style:"collapse",space_before_conditional:!0,unescape_strings:!1,jslint_happy:!1,end_with_newline:!0,wrap_line_length:0,indent_inner_html:!1,comma_first:!1,e4x:!1,indent_empty_lines:!1});return[{range:Ye.getFullModelRange(),text:ke}]})}})}),v(Ze,"java",ue.keywords,ue.quickKey),v(Ze,"cpp",G.keywords,G.quickKey),v(Ze,"c",Se.keywords,[]),v(Ze,"python",p.keywords,p.quickKey),v(Ze,"scala",ve.keywords,ve.quickKey)};const A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var M=Object.defineProperty,j=(Ze,mt,Ye)=>mt in Ze?M(Ze,mt,{enumerable:!0,configurable:!0,writable:!0,value:Ye}):Ze[mt]=Ye,V=(Ze,mt,Ye)=>j(Ze,typeof mt!="symbol"?mt+"":mt,Ye);const L=class pl{constructor(mt,Ye,ke){this.placeholder=mt,this.editor=Ye,this.monaco=ke,Ye.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return pl.ID}getDomNode(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.style.width="max-content",this.domNode.textContent=this.placeholder,this.domNode.style.fontStyle="initial",this.domNode.style.color="#D7D7D7",this.domNode.style.pointerEvents="none",this.editor.applyFontInfo(this.domNode)),this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[this.monaco.editor.ContentWidgetPositionPreference.EXACT]}}dispose(){this.editor.removeContentWidget(this)}};V(L,"ID","editor.widget.placeholderHint");var w=L,R=U(96236),Y=U(6767),se=U(25399),ne=U(89392),ye=U(33796),Ie=U(56102),xe=Object.defineProperty,$e=Object.defineProperties,J=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,ae=(Ze,mt,Ye)=>mt in Ze?xe(Ze,mt,{enumerable:!0,configurable:!0,writable:!0,value:Ye}):Ze[mt]=Ye,te=(Ze,mt)=>{for(var Ye in mt||(mt={}))N.call(mt,Ye)&&ae(Ze,Ye,mt[Ye]);if(D)for(var Ye of D(mt))O.call(mt,Ye)&&ae(Ze,Ye,mt[Ye]);return Ze},S=(Ze,mt)=>$e(Ze,J(mt)),b=(Ze,mt)=>{var Ye={};for(var ke in Ze)N.call(Ze,ke)&&mt.indexOf(ke)<0&&(Ye[ke]=Ze[ke]);if(Ze!=null&&D)for(var ke of D(Ze))mt.indexOf(ke)<0&&O.call(Ze,ke)&&(Ye[ke]=Ze[ke]);return Ye},K=(Ze,mt,Ye)=>new Promise((ke,ge)=>{var Ae=Te=>{try{Re(Ye.next(Te))}catch(q){ge(q)}},ee=Te=>{try{Re(Ye.throw(Te))}catch(q){ge(q)}},Re=Te=>Te.done?ke(Te.value):Promise.resolve(Te.value).then(Ae,ee);Re((Ye=Ye.apply(Ze,mt)).next())});function le(Ze){return/^\d+$/.test(Ze)?`${Ze}px`:Ze}function Ee(){}let Ne=!1;const Qe={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python",Scala:"scale",solidity:"sol"};function bt(Ze=[]){let mt=Ze;if(Array.isArray(Ze)){for(let Ye=0;Ye<Ze.length;Ye++){let ke=Qe[Ze[Ye]];if(ke)return ke}return mt[0]}return Qe[mt]||mt}let Lt=null;const ti=()=>K(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(Ze){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",Ze)}});var ze=Ze=>{var mt=Ze,{width:Ye="100%",height:ke="100%",value:ge,language:Ae="javascript",style:ee={},options:Re={},overrideServices:Te={},theme:q="vs-dark",onEditBlur:W,isCopy:z=!1,onSave:re,autoHeight:X=!1,forbidCopy:$=!1,onChange:Q=Ee,editorDidMount:ce=Ee,onFocus:he=Ee,onBreakPoint:we=Ee,breakPointValue:Ke=[],filename:Ve="educoder.txt",errorLine:Je,errorContent:Ge="",highlightLine:Fe,openBreakPoint:pt=!1,placeholder:De="",showMiniMap:it=!0}=mt,Bt=b(mt,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","isCopy","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint","placeholder","showMiniMap"]);const vt=(0,F.useRef)(),dt=(0,F.useRef)({}),Vt=(0,F.useRef)(),ni=(0,F.useRef)(),Qt=(0,F.useRef)([]),Wt=(0,F.useRef)(!1),ri=(0,F.useRef)(),Rt=(0,F.useRef)(),ut=(0,F.useRef)(!1),[st,Nt]=(0,F.useState)(!1);function Ht(){let fe;return vt.current&&(fe=new pe.Z(Ce=>{for(let je of Ce)(je.target.offsetHeight>0||je.target.offsetWidth>0)&&dt.current.instance.layout()}),fe.observe(vt.current)),fe}function wt(){Y.ZP.warning({content:decodeURIComponent(A),key:"monaco-editor-tip"})}const gt=()=>{let fe=dt.current.instance;if(ge!=null&&fe&&st){const Ce=fe.getModel();Ce&&ge!==Ce.getValue()&&(Ne=!0,Ce.setValue(ge),fe.layout(),Ne=!1)}};(0,F.useEffect)(()=>{const fe=ye.Z.subscribe("formatDocument",Ce=>{var je;let at=dt.current.instance;(je=at==null?void 0:at.getAction)==null||je.call(at,"editor.action.formatDocument").run()});return window.updateMonacoValue=Ce=>{Q(Ce)},fe},[]),(0,F.useEffect)(()=>{var fe;let Ce=dt.current.instance;ni.current&&clearTimeout(ni.current),ni.current=setTimeout(()=>{gt()},500),ge&&(ge!=null&&ge.length)&&((fe=Ce==null?void 0:Ce.updateOptions)==null||fe.call(Ce,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(ge.split(/\r\n|\r|\n/g).length))+3,5)}))},[ge,st,dt.current]),(0,F.useEffect)(()=>{if(Je&&dt.current&&dt.current.instance){let Ce=dt.current.instance;Ce.changeViewZones(function(je){var at=document.createElement("div");at.style.padding="10px 20px",at.style.width="calc(100% - 20px)",at.className="my-error-line-wrp",at.innerHTML=Ge,je.addZone({afterLineNumber:Je||11,heightInLines:3,domNode:at})});var fe={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ce.addOverlayWidget(fe),Ce.revealPositionInCenter({lineNumber:20,column:1})}},[Je,dt.current,st]);const St=(fe="",Ce)=>{if(!fe||fe.trim()==="")return!0;const at=dt.current.instance.getModel().getLineTokens(Ce);let kt=!1;for(let Mt=0;Mt<2;Mt++)at.getStandardTokenType(Mt)===1&&(kt=!0);return kt};(0,F.useEffect)(()=>{var fe;const Ce=(fe=dt.current)==null?void 0:fe.instance;if(Ce&&st&&$){const je=Ce.onDidBlurEditorWidget(()=>{ut.current=!1}),at=Ce.onDidFocusEditorText(()=>{ut.current=!0});return()=>{je.dispose(),at.dispose()}}},[dt.current,st,$]),(0,F.useEffect)(()=>{var fe;if((fe=dt.current)!=null&&fe.instance&&st&&pt){let Ce=dt.current.instance,je=Ce.getModel();if(!je)return;(()=>{var Xt;let Yt=[],ht=[];const At=je.getAllDecorations();for(let be of At)be.options.className==="highlighted-line"&&(Yt.push((Xt=be==null?void 0:be.range)==null?void 0:Xt.startLineNumber),ht.push(be==null?void 0:be.id));if(Fe===Yt[0])return;je.deltaDecorations(ht,[]);const Pt=je.getLineCount();Fe&&Fe<=Pt&&(Ce.deltaDecorations([],[{range:new Lt.Range(Fe,1,Fe,je.getLineMaxColumn(Fe)),options:{isWholeLine:!0,className:"highlighted-line"}}]),Ce.revealLineInCenter(Fe))})();const kt=(Xt=!1)=>{var Yt;let ht=[],At=[];const Pt=je.getAllDecorations();for(let be of Pt)be.options.linesDecorationsClassName==="breakpoints-select"&&(ht.push((Yt=be==null?void 0:be.range)==null?void 0:Yt.startLineNumber),At.push(be==null?void 0:be.id));if(Xt)return{lines:ht,ids:At};we(ht)},Mt=Xt=>K(void 0,null,function*(){let Yt={range:new Lt.Range(Xt,1,Xt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield je.deltaDecorations([],[Yt]),kt()}),xt=Xt=>K(void 0,null,function*(){let Yt=[];const ht=Ce.getLineDecorations(Xt);for(let At of ht)At.options.linesDecorationsClassName==="breakpoints-select"&&Yt.push(At.id);yield je.deltaDecorations(Yt,[]),kt()}),Kt=Xt=>{let Yt=Ce.getLineDecorations(Xt);for(let ht of Yt)if(ht.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,ne.isEqual)(Ke,kt(!0).lines)){je.deltaDecorations(kt(!0).ids,[]);const Xt=Ke.map(Yt=>({range:new Lt.Range(Yt,1,Yt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));je.deltaDecorations([],Xt)}const Et=Ce.onDidChangeModelContent(Xt=>{let Yt=Ce.getPosition();if(Yt){let ht=Yt.lineNumber;clearTimeout(Rt.current),Rt.current=setTimeout(()=>{St(je.getLineContent(ht),ht)?xt(ht):Kt(ht)?(xt(ht),Mt(ht)):kt()},100)}}),ct=Ce.onMouseDown(Xt=>{var Yt,ht,At;if(Xt.target.detail&&((At=(ht=(Yt=Xt.target)==null?void 0:Yt.element)==null?void 0:ht.className)!=null&&At.includes("line-numbers"))){let Pt=Xt.target.position.lineNumber;if(St(je.getLineContent(Pt),Pt))return;Kt(Pt)?xt(Pt):Mt(Pt)}}),ot=Xt=>{let Yt={range:new Lt.Range(Xt,1,Xt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};Qt.current=Ce.deltaDecorations(Qt.current,[Yt])},yt=()=>{Qt.current=Ce.deltaDecorations(Qt.current,[])},Tt=Ce.onMouseMove(Xt=>{var Yt,ht,At;if(yt(),Xt.target.detail&&((At=(ht=(Yt=Xt.target)==null?void 0:Yt.element)==null?void 0:ht.className)!=null&&At.includes("line-numbers"))){let Pt=Xt.target.position.lineNumber;if(St(je.getLineContent(Pt),Pt))return;ot(Pt)}}),mi=Ce.onMouseLeave(()=>{yt()});return()=>{Et.dispose(),ct.dispose(),Tt.dispose(),mi.dispose()}}},[dt.current,st,Ke,Fe,pt,Ae]),(0,F.useEffect)(()=>{var fe;(fe=dt.current)!=null&&fe.instance&&pt&&dt.current.instance.setPosition({lineNumber:0,column:0})},[Fe]);function Ei(){let fe=dt.current.instance;if(fe){const Ce=fe.getSelection(),je=dt.current.pastePos||{},at=new Lt.Range(je.startLineNumber||Ce.endLineNumber,je.startColumn||Ce.endColumn,je.endLineNumber||Ce.endLineNumber,je.endColumn||Ce.endColumn);setTimeout(()=>{fe.executeEdits("",[{range:at,text:""}])},300)}}function zt(fe){(window.navigator.platform.match("Mac")?fe.metaKey:fe.ctrlKey)&&fe.keyCode==83&&(fe.preventDefault(),re())}const si=()=>{if(X&&dt.current.instance){const fe=dt.current.instance.getContentHeight();H(fe<ke?ke:fe)}else H(ke)};function It(fe){var Ce=document.createEvent("MouseEvents");Ce.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),fe.dispatchEvent(Ce)}const We=fe=>{if(!ut.current)return;const{keyCode:Ce,ctrlKey:je,metaKey:at,target:kt,type:Mt}=fe;return(Mt==="paste"||(Ce===67||Ce===86)&&(at||je))&&kt.nodeName==="TEXTAREA"&&(wt(),fe.preventDefault()),!1};function h(fe,Ce){var je=window.URL||window.webkitURL||window,at=new Blob([Ce]),kt=document.createElementNS("http://www.w3.org/1999/xhtml","a");kt.href=je.createObjectURL(at),kt.download=fe,It(kt)}(0,F.useEffect)(()=>{si()},[si]),(0,F.useEffect)(()=>{vt.current&&!st&&Promise.all([U.e(8909),U.e(5028)]).then(U.bind(U,71448)).then(fe=>{try{Lt=fe,dt.current.instance=Lt.editor.create(vt.current,{value:ge,language:bt(Ae),theme:q,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:it||!1}},Te);const Ce=dt.current.instance;let kt=[...R.BH._menuItems].find(Et=>Et[0]._debugName=="EditorContext")[1],Mt=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],xt=(Et,ct)=>{var ot,yt;let Tt=Et._first;do ct.includes((yt=(ot=Tt.element)==null?void 0:ot.command)==null?void 0:yt.id)&&Et._remove(Tt);while(Tt=Tt.next)};if(ce(Ce,Lt),setTimeout(()=>{si(),dt.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{h(Ve||"educoder.txt",Ce.getValue())}})},500),dt.current.subscription=Ce.onDidChangeModelContent(Et=>{Wt.current?clearTimeout(ri.current):(si(),Q(Ce.getValue(),Et)),ri.current=setTimeout(()=>{Wt.current=!1},500)}),window.Monaco||E(Lt,bt(Ae)),$&&(xt(kt,Mt),vt.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",We),window.removeEventListener("paste",We),window.addEventListener("keydown",We),window.addEventListener("paste",We)),window.Monaco=Lt,W&&Ce.onDidBlurEditorWidget(()=>{W(Ce.getValue())}),he&&Ce.onDidFocusEditorText(()=>{$&&ti(),he(Ce.getValue())}),$){ti();try{Ce.onDidPaste(Et=>{const ct=Ce.getSelection(),ot=dt.current.pastePos||{},yt=new Lt.Range(ot.startLineNumber||ct.endLineNumber,ot.startColumn||ct.endColumn,ot.endLineNumber||ct.endLineNumber,ot.endColumn||ct.endColumn);Ce.executeEdits("",[{range:Et.range,text:""}])})}catch(Et){}}let Kt=Ht();return De&&typeof De=="string"&&new w(De,Ce,Lt),Nt(!0),()=>{const Et=dt.current.instance;Et.dispose();const ct=Et.getModel();ct&&ct.dispose(),dt.current.subscription&&dt.current.subscription.dispose(),Kt.unobserve(vt.current)}}catch(Ce){}})},[]),(0,F.useEffect)(()=>{if(dt.current.instance&&st)return document.addEventListener("keydown",zt,!1),()=>{document.removeEventListener("keydown",zt)}},[re,st]),(0,F.useEffect)(()=>{let fe=dt.current.instance;if(fe&&st){let Ce=bt(Ae);Lt.editor.setModelLanguage(fe.getModel(),Ce)}},[Ae,st]),(0,F.useEffect)(()=>{dt.current.instance&&st&&Lt.editor.setTheme(q)},[q,st]),(0,F.useEffect)(()=>{let fe=dt.current.instance;Vt.current=Re,fe&&st&&(fe.updateOptions(te({},Re)),setTimeout(()=>{fe.getModel().updateOptions(te({},Re))},200))},[JSON.stringify(Re),st]),(0,F.useEffect)(()=>{let fe=dt.current.instance;fe&&st&&fe.layout()},[Ye,ke,st]);const[m,y]=(0,F.useState)(le(Ye)),[C,H]=(0,F.useState)(le(ke)),me=S(te({},ee),{width:m,height:C,position:"relative"});return F.createElement("div",{className:"my-monaco-editor",ref:vt,style:me},z&&F.createElement(Ie.CopyToClipboard,{text:ge,onCopy:()=>Y.ZP.success("\u590D\u5236\u6210\u529F")},F.createElement(se.Z,{title:"\u590D\u5236\u4EE3\u7801"},F.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},F.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function Ct({width:Ze="100%",height:mt="100%",original:Ye,modified:ke,language:ge,options:Ae={}}){const ee=(0,F.useRef)(),[Re,Te]=(0,F.useState)(null);function q(X){let $;return ee.current&&($=new pe.Z(Q=>{for(let ce of Q)(ce.target.offsetHeight>0||ce.target.offsetWidth>0)&&X.layout()}),$.observe(ee.current)),$}(0,F.useEffect)(()=>(ee.current&&Promise.all([U.e(8909),U.e(9404)]).then(U.bind(U,2550)).then(X=>{Lt=X;const $=Lt.editor.createDiffEditor(ee.current,S(te({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",wordWrap:"off",ignoreTrimWhitespace:!1,"semanticHighlighting.enabled":!0,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},Ae),{wordWrap:!0}));Te($);let Q=q($);return()=>{$.dispose();const ce=$.getModel();ce&&ce.dispose(),Q.unobserve(ee.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,F.useEffect)(()=>{Re&&Re.setModel({original:Lt.editor.createModel(Ye,ge),modified:Lt.editor.createModel(ke,ge)})},[Ye,ke,ge,Re]);const W=le(Ze),z=le(mt),re={width:W,height:z};return F.createElement("div",{className:"my-diff-editor",ref:ee,style:re})}},17904:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return pe}});var F=U(59301);function pe(Se,ue){const G=(0,F.useRef)();(0,F.useEffect)(()=>{G.current=Se}),(0,F.useEffect)(()=>{function p(){G.current()}if(ue!==null){let ve=setInterval(p,ue);return()=>clearInterval(ve)}},[ue])}},45233:function(Zt,nt,U){"use strict";U.r(nt),U.d(nt,{default:function(){return $},formatQuery:function(){return re}});var F=U(59301),pe=U(76560),Se=U(29787),ue={bg:"bg___eq_Aq",container:"container___j770l",widthle:"widthle___ouh1T"},G=U(24334),p=U(93152),ve=U(62957),oe=U(58018),l=U(71411),Z=U(584),k={contentWrap:"contentWrap___xMJQi",title:"title___z4t4P",footer:"footer___CLzrT",footer_left:"footer_left___N2sZZ",footer_bfcs:"footer_bfcs___UmvUE",footer_bfcs_value:"footer_bfcs_value___yiYga",pingfen:"pingfen___aEEMe",fenshu:"fenshu___I6HCo",radioGroup:"radioGroup___RT1dL",wrap:"wrap___QZGSJ",introName:"introName___m17tA",rating:"rating___MXLBr",modalRating:"modalRating___aluwj",zdbf:"zdbf___9PNEF"},g=U(17904),v=U(80541),E=U(49661),A=U(59301),M=Object.defineProperty,j=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,I=(Q,ce,he)=>ce in Q?M(Q,ce,{enumerable:!0,configurable:!0,writable:!0,value:he}):Q[ce]=he,w=(Q,ce)=>{for(var he in ce||(ce={}))V.call(ce,he)&&I(Q,he,ce[he]);if(j)for(var he of j(ce))L.call(ce,he)&&I(Q,he,ce[he]);return Q},R=(Q,ce)=>{var he={};for(var we in Q)V.call(Q,we)&&ce.indexOf(we)<0&&(he[we]=Q[we]);if(Q!=null&&j)for(var we of j(Q))ce.indexOf(we)<0&&L.call(Q,we)&&(he[we]=Q[we]);return he},Y=(Q,ce,he)=>new Promise((we,Ke)=>{var Ve=Fe=>{try{Ge(he.next(Fe))}catch(pt){Ke(pt)}},Je=Fe=>{try{Ge(he.throw(Fe))}catch(pt){Ke(pt)}},Ge=Fe=>Fe.done?we(Fe.value):Promise.resolve(Fe.value).then(Ve,Je);Ge((he=he.apply(Q,ce)).next())});const se=Q=>{var ce=Q,{videoDetail:he,globalSetting:we,loading:Ke,dispatch:Ve}=ce,Je=R(ce,["videoDetail","globalSetting","loading","dispatch"]);const{queryParams:Ge,selectParams:Fe,videoList:pt}=he,{subject_id:De,videoId:it}=Ge,{checkBoxValue:Bt,radioValue:vt}=Fe,dt={videoId:it},Vt={query:Ge},ni=(0,F.useRef)(),Qt=(0,F.useRef)(),Wt=(0,F.useRef)(),ri=(0,F.useRef)(5),{video_item:Rt}=he.detail||{};(0,g.Z)(()=>Y(void 0,null,function*(){Qt.current&&(console.log("videoRef lastUpdatedTime: ",ni.current.getLastUpdatedTime()),console.log(ni.current),yield ut())}),ri.current*1e3);const ut=(zt=!1)=>{const si=zt?{is_f:1}:{};return(0,v.DH)(w(w({},si),{id:dt.videoId,point:ni.current.getLastUpdatedTime(),total:ni.current.getDuration()}))},st=zt=>(zt.ed==="1"&&(Qt.current=!1,ut(!0)),!Qt.current&&!zt.ed&&(Qt.current=!0,ri.current=ni.current.getDuration()<=5?1:5,ut()),Ve({type:"userDetail/logWatchHistory",payload:zt})),Nt=()=>{Qt.current=!1},Ht=()=>{Qt.current=!0},wt=()=>{Wt.current=5,ve.default.confirm({width:600,centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u8BF7\u7ED9\u672C\u89C6\u9891\u8BC4\u5206",content:A.createElement("div",{className:"tc font14"},A.createElement(oe.Z,{defaultValue:Wt.current,onChange:zt=>Wt.current=zt,className:k.modalRating})),onOk:()=>Y(void 0,null,function*(){if((yield(0,v.jK)({id:dt.videoId,star:Wt.current})).status===0){const{course_id:si}=(0,E.oP)();Ve({type:"videoDetail/getVideoDetail",payload:{id:dt.videoId,videoId:dt.videoId,course_id:si,subject_id:De}})}})})},gt=zt=>{const si=window.filterVideoSign,It=si.findIndex(H=>H.id===it);if(It===si.length-1)return;const h=si[It+1].id,m=si[It+1].can_view,y=si[It+1].link,C=si[It+1].is_public;if(window.checkBoxValue){if(y){window.open(y);return}if(!m){ve.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:A.createElement("div",{className:"tc font14"},"\u4E0B\u4E00\u6761\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")});return}if(!C){ve.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:A.createElement("div",{className:"tc font14"},"\u4E0B\u4E00\u6761\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}Ve({type:"videoDetail/handleListItemClick",payload:{videoId:h}}),window.videoTimer=setTimeout(()=>{zt.current.play()},2e3)}},St=(zt,si)=>{if(zt==="checkBox"){const It=si;window.checkBoxValue=It,Ve({type:"videoDetail/setSelectValue",payload:{radioValue:vt,checkBoxValue:It}});return}Ve({type:"videoDetail/setSelectValue",payload:{checkBoxValue:Bt,radioValue:si.target.value}})},Ei=()=>pt.findIndex(It=>It.id===it)===pt.length-1?A.createElement("div",null,"\u5F53\u524D\u5DF2\u662F\u6700\u540E\u4E00\u4E2A\u89C6\u9891"):A.createElement("div",null,A.createElement(l.Z,{onChange:It=>{St("checkBox",It)},defaultChecked:Bt,size:"small"}),A.createElement("span",{className:k.zdbf},"\u81EA\u52A8\u64AD\u653E\u4E0B\u4E00\u4E2A\u89C6\u9891"));return A.createElement("aside",{className:k.contentWrap},A.createElement("aside",{className:k.wrap},A.createElement("header",null),A.createElement("div",{className:k.title},Rt==null?void 0:Rt.name),!(Rt!=null&&Rt.can_edit)&&!(Rt!=null&&Rt.is_public)?A.createElement(Z.Z,{description:"\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85"}):A.createElement(p.Z,{ref:ni,startTime:Rt==null?void 0:Rt.last_point,src:Rt!=null&&Rt.is_link?Rt==null?void 0:Rt.link:(Rt==null?void 0:Rt.play_url)&&G.Base64.decode(Rt==null?void 0:Rt.play_url),videoId:Rt==null?void 0:Rt.video_id,logWatchHistory:st,handlePause:Nt,handlePlay:Ht,allow_skip:Rt==null?void 0:Rt.allow_skip,handlePlayEnded:gt,toLog:()=>{}}),A.createElement("div",{className:k.footer},A.createElement("div",{className:k.footer_left},A.createElement("div",{className:k.pingfen},"\u8BC4\u5206"),A.createElement(oe.Z,{value:Rt==null?void 0:Rt.star,disabled:!0,className:k.rating,style:{color:"#FFA100",fontSize:12,marginLeft:10}}),A.createElement("div",{className:k.fenshu},(Rt==null?void 0:Rt.star)||0,"\u5206")),!(Rt!=null&&Rt.can_edit)&&!(Rt!=null&&Rt.is_public)?null:A.createElement("div",null,A.createElement("div",{className:k.checkBox},Ei()))),A.createElement("div",{className:"mt10"},(Rt==null?void 0:Rt.description)&&A.createElement("span",{className:k.introName},"\u7B80\u4ECB\uFF1A",Rt.description))))};var ne=(0,pe.connect)(({videoDetail:Q,loading:ce,globalSetting:he})=>({videoDetail:Q,globalSetting:he,loading:ce}))(se),ye=U(6767),Ie=U(18287),xe={flex_box_center:"flex_box_center___yWqSL",flex_space_between:"flex_space_between___LgFmv",flex_box_vertical_center:"flex_box_vertical_center____lt6U",flex_box_center_end:"flex_box_center_end___UqkaD",flex_box_column:"flex_box_column___V8XLF",list:"list___8tjfT",tree_style:"tree_style___ZzDvO",title:"title___IVfkQ",gray:"gray___RnyYk",brght:"brght___EWRNa",s1:"s1___dPBQg",s3:"s3___SRBBG",active:"active___hsNCX",tree_line:"tree_line___EGn30",tabs_style:"tabs_style___Nwkiq",tabs_item:"tabs_item___Vzu_U",tabs_item_active:"tabs_item_active___BcIwZ"},$e=U(72664),J=U(67135),D=U(90524),N=U(59301),O=Object.defineProperty,ae=Object.defineProperties,te=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,le=(Q,ce,he)=>ce in Q?O(Q,ce,{enumerable:!0,configurable:!0,writable:!0,value:he}):Q[ce]=he,Ee=(Q,ce)=>{for(var he in ce||(ce={}))b.call(ce,he)&&le(Q,he,ce[he]);if(S)for(var he of S(ce))K.call(ce,he)&&le(Q,he,ce[he]);return Q},Ne=(Q,ce)=>ae(Q,te(ce)),Qe=(Q,ce)=>{var he={};for(var we in Q)b.call(Q,we)&&ce.indexOf(we)<0&&(he[we]=Q[we]);if(Q!=null&&S)for(var we of S(Q))ce.indexOf(we)<0&&K.call(Q,we)&&(he[we]=Q[we]);return he},bt=(Q,ce,he)=>new Promise((we,Ke)=>{var Ve=Fe=>{try{Ge(he.next(Fe))}catch(pt){Ke(pt)}},Je=Fe=>{try{Ge(he.throw(Fe))}catch(pt){Ke(pt)}},Ge=Fe=>Fe.done?we(Fe.value):Promise.resolve(Fe.value).then(Ve,Je);Ge((he=he.apply(Q,ce)).next())});const Lt=[{name:"\u5B9E\u8DF5\u9879\u76EE",type:"Shixun",icon:N.createElement("i",{className:"iconfont icon-shixun2 font20"}),bq:N.createElement("span",{style:{border:"1px solid #FF9D18",color:"#FF9D18"},className:xe.s1},"\u5B9E\u8BAD")},{name:"\u89C6\u9891\u9879\u76EE",type:"VideoItem",icon:N.createElement("i",{className:"iconfont icon-shipin font20"}),bq:N.createElement("span",{style:{border:"1px solid #9B18FF",color:"#9B18FF"},className:xe.s1},"\u89C6\u9891")},{name:"\u6559\u5B66\u8BFE\u4EF6",type:"Attachment",icon:N.createElement("i",{className:"iconfont icon-jiaoxueanli font20"}),bq:N.createElement("span",{style:{border:"1px solid #3061D0",color:"#3061D0"},className:xe.s1},"\u8D44\u6599")},{name:"\u7A7A\u76EE\u5F55",type:"StageCatalog",icon:N.createElement("i",{className:"iconfont icon-kongbai font20"}),bq:N.createElement("span",null)}],ti=Q=>{var ce=Q,{dispatch:he,pathsDetail:we,videoDetail:Ke,user:Ve}=ce,Je=Qe(ce,["dispatch","pathsDetail","videoDetail","user"]);const{queryParams:Ge,stages:Fe,cust_seq:pt,active:De}=Ke,{subject_id:it,course_id:Bt}=Ge,vt=(0,pe.useParams)(),[dt]=(0,pe.useSearchParams)(),[Vt,ni]=(0,F.useState)([]),[Qt,Wt]=(0,F.useState)([(De==null?void 0:De.id)||Number(vt.videoId)]),[ri,Rt]=(0,F.useState)("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"),ut=[".PDF",".DOC",".DOCX",".XLS",".XLSX",".PPT",".PPTX"];(0,F.useEffect)(()=>{he(it?{type:"videoDetail/getStageData",payload:{subject_id:it,page_type:"video"}}:{type:"videoDetail/getCourseStageData",payload:{coursesId:Bt}})},[]),(0,F.useEffect)(()=>{st()},[Ke==null?void 0:Ke.stages]);const st=()=>{let It=Vt;Fe.forEach((We,h)=>{It.push({title:N.createElement("div",{title:We.stage_name,className:xe.title},We.stage_name),value:We==null?void 0:We.stage_id,key:We==null?void 0:We.stage_id,icon:N.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Nt(We.items||[])})}),ni(It)},Nt=It=>{function We(h){var m;const y=h.children,C=Array.isArray(y)&&y.length>0,H=h==null?void 0:h.id,{name:me,item_type:fe,id:Ce}=h,je=(m=Lt.find(Mt=>Mt.type===fe))==null?void 0:m.bq,at=xe.brght,kt=De.id===Ce?`${at} ${xe.active}`:at;return{title:N.createElement("div",{onClick:()=>St(h),className:at,title:me},je,N.createElement("div",{className:xe.s3},me)),value:H,key:H,icon:N.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:C?y==null?void 0:y.map(Mt=>We(Mt)):[]}}return It==null?void 0:It.map(h=>We(h))},Ht=(It,We)=>bt(void 0,null,function*(){he({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF0C\u8BF7\u7A0D\u540E..."}});const h=We?yield(0,J.BK)({id:It}):yield(0,J.Ir)({id:It});if(he({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}}),h!=null&&h.game_identifier||h!=null&&h.identifier){(0,E.xg)(We?`/tasks/${h==null?void 0:h.identifier}/jupyter`:`/tasks/${h.game_identifier}`);return}(h==null?void 0:h.status)===2?gt(h==null?void 0:h.message):(h==null?void 0:h.status)===3&&wt(h==null?void 0:h.message)}),wt=It=>{ve.default.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:N.createElement("div",{className:"tc font16"},"\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E",It,"\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01")})},gt=It=>{It=It!=null&&It.includes(".json")?It:`${It}.json`,ve.default.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:N.createElement("div",{className:"tc font16"},"\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"),onOk:()=>bt(void 0,null,function*(){const We=yield(0,$e.L8)({url:It});if(!We)return;ye.ZP.success("\u91CD\u7F6E\u6210\u529F\uFF0C\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF01");const h=yield(0,J.Ir)({id:We.shixun_identifier});if(h!=null&&h.game_identifier){(0,E.xg)(`/tasks/${h.game_identifier}`);return}(h==null?void 0:h.status)===2?gt(h==null?void 0:h.message):(h==null?void 0:h.status)===3&&wt(h==null?void 0:h.message)})})},St=It=>{var We,h,m,y,C;if((It==null?void 0:It.item_type)==="StageCatalog")return;clearTimeout(window.videoTimer);const{id:H,item_type:me,identifier:fe,is_jupyter:Ce,url:je,link:at}=It;if(me==="VideoItem"&&!at){if(!((We=Ve.userInfo)!=null&&We.admin)&&!((h=Ve.userInfo)!=null&&h.business)&&!It.can_view){ve.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:N.createElement("div",{className:"tc font14"},"\u5F53\u524D\u89C6\u9891\u4E3A\u521B\u5EFA\u8005\u6240\u5C5E\u5355\u4F4D\u5185\u90E8\u6559\u5B66\u8D44\u6599\uFF0C\u5916\u5355\u4F4D\u7528\u6237\u65E0\u89C2\u770B\u6743\u9650")});return}he({type:"videoDetail/handleListItemClick",payload:{videoId:H}}),he({type:"videoDetail/getVideoDetail",payload:Ne(Ee({id:H},Ge),{videoId:H}),callback:kt=>{if(kt&&kt.video_item&&!kt.video_item.can_edit&&!It.is_public){ve.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:N.createElement("div",{className:"tc font14"},"\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}}});return}if(me==="VideoItem"&&at){It.link&&(0,v.DH)({is_f:1,id:It.id,point:0,total:0}),window.open(at);return}if(me==="Shixun"){Ht(fe,Ce);return}if(me==="Attachment"){if(at){(0,E.xg)(at);return}let kt=(y=It==null?void 0:It.name)==null?void 0:y.substr((m=It==null?void 0:It.name)==null?void 0:m.lastIndexOf("."));if(ut.includes(kt.toUpperCase())){he({type:"videoDetail/handleListItemClick",payload:{attachmentId:H}});return}else{if(!((C=we.detail)!=null&&C.allow_download)){ye.ZP.info("\u6559\u5B66\u8BFE\u4EF6\u4E0D\u652F\u6301\u4E0B\u8F7D");return}(0,E.FH)(It.name,D.Z.API_SERVER+It.url);return}}window.open(D.Z.IMG_SERVER+je)},Ei=It=>{let We=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],h=["","\u5341","\u767E","\u5343","\u4E07"];It=parseInt(It);let m=H=>{let me=H.toString().split("").reverse(),fe="";for(var Ce=0;Ce<me.length;Ce++)fe=(Ce==0&&me[Ce]==0||Ce>0&&me[Ce]==0&&me[Ce-1]==0?"":We[me[Ce]]+(me[Ce]==0?h[0]:h[Ce]))+fe;return fe},y=Math.floor(It/1e4),C=It%1e4;return C.toString().length<4&&(C="0"+C),y?m(y)+"\u4E07"+m(C):m(It)},zt=(It,We,h,m)=>{var y;const{name:C,item_type:H,id:me}=It,fe=`${We+1}-${h+1}-${m+1}`,Ce=(y=Lt.find(kt=>kt.type===H))==null?void 0:y.icon,je=xe.brght,at=De.id===me?`${je} ${xe.active}`:je;return N.createElement("div",{key:fe,onClick:()=>St(It),className:at,style:{paddingLeft:52}},N.createElement("span",{className:xe.s1},Ce),!!pt&&N.createElement("span",{className:xe.s2},fe),N.createElement("span",{className:xe.s3},"\u203B ",C))},si=(It,We,h)=>{var m;const{name:y,item_type:C,id:H,children:me}=It,fe=`${We+1}-${h+1}`,Ce=(m=Lt.find(kt=>kt.type===C))==null?void 0:m.icon,je=xe.brght,at=De.id===H?`${je} ${xe.active}`:je;return N.createElement(F.Fragment,{key:fe},N.createElement("div",{onClick:()=>St(It),className:at},N.createElement("span",{className:xe.s1},Ce),!!pt&&N.createElement("span",{className:xe.s2},fe),N.createElement("span",{className:xe.s3},"\u203B ",y)),!!me.length&&me.map((kt,Mt)=>zt(kt,We,h,Mt)))};return N.createElement("aside",{className:xe.list},N.createElement("div",{className:xe.tabs_style},N.createElement("div",{className:xe.tabs_item,onClick:()=>{Rt("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55")}},"\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55",ri=="\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"&&N.createElement("div",{className:xe.tabs_item_active}))),N.createElement("div",{className:xe.tree_style},(Vt==null?void 0:Vt.length)>0&&N.createElement(Ie.default,{selectedKeys:Qt,onSelect:(It,We)=>{Wt([...It])},blockNode:!0,treeData:Vt,defaultExpandAll:!0,className:xe.tree_line})))};var ze=(0,pe.connect)(({user:Q,videoDetail:ce,loading:he,globalSetting:we,pathsDetail:Ke})=>({user:Q,videoDetail:ce,globalSetting:we,loading:he,pathsDetail:Ke}))(ti),Ct=U(41550),Ze=U(59301),mt=Object.defineProperty,Ye=Object.defineProperties,ke=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,Re=(Q,ce,he)=>ce in Q?mt(Q,ce,{enumerable:!0,configurable:!0,writable:!0,value:he}):Q[ce]=he,Te=(Q,ce)=>{for(var he in ce||(ce={}))Ae.call(ce,he)&&Re(Q,he,ce[he]);if(ge)for(var he of ge(ce))ee.call(ce,he)&&Re(Q,he,ce[he]);return Q},q=(Q,ce)=>Ye(Q,ke(ce)),W=(Q,ce)=>{var he={};for(var we in Q)Ae.call(Q,we)&&ce.indexOf(we)<0&&(he[we]=Q[we]);if(Q!=null&&ge)for(var we of ge(Q))ce.indexOf(we)<0&&ee.call(Q,we)&&(he[we]=Q[we]);return he},z=(Q,ce,he)=>new Promise((we,Ke)=>{var Ve=Fe=>{try{Ge(he.next(Fe))}catch(pt){Ke(pt)}},Je=Fe=>{try{Ge(he.throw(Fe))}catch(pt){Ke(pt)}},Ge=Fe=>Fe.done?we(Fe.value):Promise.resolve(Fe.value).then(Ve,Je);Ge((he=he.apply(Q,ce)).next())});const re=Q=>{const{subject_id:ce}=Q;return{subject_id:ce,course_id:ce}},X=Q=>{var ce=Q,{videoDetail:he,globalSetting:we,loading:Ke,pathsDetail:Ve,dispatch:Je}=ce,Ge=W(ce,["videoDetail","globalSetting","loading","pathsDetail","dispatch"]),Fe,pt;const{queryParams:De,videoList:it,attachmentList:Bt,active:vt}=he,{subject_id:dt,videoId:Vt}=De,ni={videoId:Vt};(0,F.useEffect)(()=>{if(vt){const{item_type:ri,id:Rt}=vt;ri==="VideoItem"&&Je({type:"videoDetail/getVideoDetail",payload:q(Te({},De),{id:Rt})})}},[vt.id]),console.log("---",vt),(0,F.useEffect)(()=>{dt&&Qt()},[]);function Qt(){return z(this,null,function*(){const ri=yield Je({type:"pathsDetail/getPathsDetail",payload:{id:dt}})})}(0,F.useEffect)(()=>{var ri,Rt;(0,E.Dk)((Rt=(ri=he.detail)==null?void 0:ri.video_item)==null?void 0:Rt.name)},[he]);let Wt={width:1200};return vt&&vt.item_type==="Attachment"&&vt.content_type==="application/pdf"&&(Wt={width:1250,marginLeft:(document.body.clientWidth-1200)/2}),Ze.createElement(Se.Z,{spinning:!1},Ze.createElement("section",{className:ue.bg},Ze.createElement("div",{className:ue.container,style:Wt},Ze.createElement(ze,null),vt&&vt.item_type==="VideoItem"&&Ze.createElement(ne,null),vt&&vt.item_type==="Attachment"&&vt.content_type==="application/pdf"&&vt.url&&Ze.createElement("div",{className:ue.widthle},Ze.createElement(Ct.Z,{disabledDownload:!((Fe=Ve.detail)!=null&&Fe.allow_download),type:"pdf",filename:vt.name,data:D.Z.API_SERVER+vt.url,style:{position:"absolute",zIndex:1}})),vt&&vt.item_type==="Attachment"&&["application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document"].includes(vt.content_type)&&vt.url&&Ze.createElement("div",{className:ue.widthle},Ze.createElement(Ct.Z,{disabledDownload:!((pt=Ve.detail)!=null&&pt.allow_download),type:"office",data:D.Z.API_SERVER+vt.url,style:{position:"absolute",zIndex:1}})))))};var $=(0,pe.connect)(({videoDetail:Q,loading:ce,globalSetting:he,pathsDetail:we})=>({videoDetail:Q,globalSetting:he,loading:ce,pathsDetail:we}))(X)},2610:function(Zt,nt,U){"use strict";U.d(nt,{BU:function(){return pe},Dj:function(){return F},gH:function(){return Se},vp:function(){return ue}});function F(G){try{G.mozRequestFullScreen?G.mozRequestFullScreen():G.webkitRequestFullScreen&&G.webkitRequestFullScreen()}catch(p){console.log(p,":e")}}function pe(){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 Se=()=>{if(document.webkitExitFullscreen)return"webkitfullscreenchange";if(document.exitFullscreen)return"fullscreenchange";if(document.msExitFullscreen)return"msfullscreenchange";if(document.mozCancelFullScreen)return"mozfullscreenchange"};function ue(){var G=window.top.document.fullscreenElement||window.top.document.mozFullscreenElement||window.top.document.webkitFullscreenElement,p=document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled;return console.log("fullscreenElement",G),window.isFullScreen?window.isFullScreen:G!=null}},60513:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return It}});class F{static install(){Object.setPrototypeOf=Object.setPrototypeOf||function(h,m){return h.__proto__=m,h},Object.assign=Object.assign||function(h){if(h==null)throw new TypeError("Cannot convert undefined or null to object");let m=Object(h);for(let y=1;y<arguments.length;y++){let C=arguments[y];if(C!=null)for(let H in C)C.hasOwnProperty(H)&&(m[H]=C[H])}return m},typeof self.Promise!="function"&&U(3867).polyfill()}}F.install();var pe=F,Se=U(86204),ue=U.n(Se);class G{static e(h,m){(!h||G.FORCE_GLOBAL_TAG)&&(h=G.GLOBAL_TAG);let y=`[${h}] > ${m}`;G.ENABLE_CALLBACK&&G.emitter.emit("log","error",y),G.ENABLE_ERROR&&(console.error?console.error(y):console.warn?console.warn(y):console.log(y))}static i(h,m){(!h||G.FORCE_GLOBAL_TAG)&&(h=G.GLOBAL_TAG);let y=`[${h}] > ${m}`;G.ENABLE_CALLBACK&&G.emitter.emit("log","info",y),G.ENABLE_INFO&&(console.info?console.info(y):console.log(y))}static w(h,m){(!h||G.FORCE_GLOBAL_TAG)&&(h=G.GLOBAL_TAG);let y=`[${h}] > ${m}`;G.ENABLE_CALLBACK&&G.emitter.emit("log","warn",y),G.ENABLE_WARN&&(console.warn?console.warn(y):console.log(y))}static d(h,m){(!h||G.FORCE_GLOBAL_TAG)&&(h=G.GLOBAL_TAG);let y=`[${h}] > ${m}`;G.ENABLE_CALLBACK&&G.emitter.emit("log","debug",y),G.ENABLE_DEBUG&&(console.debug?console.debug(y):console.log(y))}static v(h,m){(!h||G.FORCE_GLOBAL_TAG)&&(h=G.GLOBAL_TAG);let y=`[${h}] > ${m}`;G.ENABLE_CALLBACK&&G.emitter.emit("log","verbose",y),G.ENABLE_VERBOSE&&console.log(y)}}G.GLOBAL_TAG="flv.js",G.FORCE_GLOBAL_TAG=!1,G.ENABLE_ERROR=!0,G.ENABLE_INFO=!0,G.ENABLE_WARN=!0,G.ENABLE_DEBUG=!0,G.ENABLE_VERBOSE=!0,G.ENABLE_CALLBACK=!1,G.emitter=new(ue());var p=G;class ve{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(h){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=h,this._totalBytes+=h):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=h,this._totalBytes+=h):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=h,this._totalBytes+=h,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let h=(this._now()-this._lastCheckpoint)/1e3;return h==0&&(h=1),this._intervalBytes/h/1024}get lastSecondKBps(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}get averageKBps(){let h=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/h/1024}}var oe=ve;class l{constructor(h){this._message=h}get name(){return"RuntimeException"}get message(){return this._message}toString(){return this.name+": "+this.message}}class Z extends l{constructor(h){super(h)}get name(){return"IllegalStateException"}}class k extends l{constructor(h){super(h)}get name(){return"InvalidArgumentException"}}class g extends l{constructor(h){super(h)}get name(){return"NotImplementedException"}}const v={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},E={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"};class A{constructor(h){this._type=h||"undefined",this._status=v.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}destroy(){this._status=v.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}isWorking(){return this._status===v.kConnecting||this._status===v.kBuffering}get type(){return this._type}get status(){return this._status}get needStashBuffer(){return this._needStash}get onContentLengthKnown(){return this._onContentLengthKnown}set onContentLengthKnown(h){this._onContentLengthKnown=h}get onURLRedirect(){return this._onURLRedirect}set onURLRedirect(h){this._onURLRedirect=h}get onDataArrival(){return this._onDataArrival}set onDataArrival(h){this._onDataArrival=h}get onError(){return this._onError}set onError(h){this._onError=h}get onComplete(){return this._onComplete}set onComplete(h){this._onComplete=h}open(h,m){throw new g("Unimplemented abstract function!")}abort(){throw new g("Unimplemented abstract function!")}}let M={};function j(){let We=self.navigator.userAgent.toLowerCase(),h=/(edge)\/([\w.]+)/.exec(We)||/(opr)[\/]([\w.]+)/.exec(We)||/(chrome)[ \/]([\w.]+)/.exec(We)||/(iemobile)[\/]([\w.]+)/.exec(We)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(We)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(We)||/(webkit)[ \/]([\w.]+)/.exec(We)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(We)||/(msie) ([\w.]+)/.exec(We)||We.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(We)||We.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(We)||[],m=/(ipad)/.exec(We)||/(ipod)/.exec(We)||/(windows phone)/.exec(We)||/(iphone)/.exec(We)||/(kindle)/.exec(We)||/(android)/.exec(We)||/(windows)/.exec(We)||/(mac)/.exec(We)||/(linux)/.exec(We)||/(cros)/.exec(We)||[],y={browser:h[5]||h[3]||h[1]||"",version:h[2]||h[4]||"0",majorVersion:h[4]||h[2]||"0",platform:m[0]||""},C={};if(y.browser){C[y.browser]=!0;let H=y.majorVersion.split(".");C.version={major:parseInt(y.majorVersion,10),string:y.version},H.length>1&&(C.version.minor=parseInt(H[1],10)),H.length>2&&(C.version.build=parseInt(H[2],10))}if(y.platform&&(C[y.platform]=!0),(C.chrome||C.opr||C.safari)&&(C.webkit=!0),C.rv||C.iemobile){C.rv&&delete C.rv;let H="msie";y.browser=H,C[H]=!0}if(C.edge){delete C.edge;let H="msedge";y.browser=H,C[H]=!0}if(C.opr){let H="opera";y.browser=H,C[H]=!0}if(C.safari&&C.android){let H="android";y.browser=H,C[H]=!0}C.name=y.browser,C.platform=y.platform;for(let H in M)M.hasOwnProperty(H)&&delete M[H];Object.assign(M,C)}j();var V=M;class L extends A{static isSupported(){try{let h=V.msedge&&V.version.minor>=15048,m=V.msedge?h:!0;return self.fetch&&self.ReadableStream&&m}catch(h){return!1}}constructor(h,m){super("fetch-stream-loader"),this.TAG="FetchStreamLoader",this._seekHandler=h,this._config=m,this._needStash=!0,this._requestAbort=!1,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),super.destroy()}open(h,m){this._dataSource=h,this._range=m;let y=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(y=h.redirectedURL);let C=this._seekHandler.getConfig(y,m),H=new self.Headers;if(typeof C.headers=="object"){let fe=C.headers;for(let Ce in fe)fe.hasOwnProperty(Ce)&&H.append(Ce,fe[Ce])}let me={method:"GET",headers:H,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(let fe in this._config.headers)H.append(fe,this._config.headers[fe]);h.cors===!1&&(me.mode="same-origin"),h.withCredentials&&(me.credentials="include"),h.referrerPolicy&&(me.referrerPolicy=h.referrerPolicy),this._status=v.kConnecting,self.fetch(C.url,me).then(fe=>{if(this._requestAbort){this._requestAbort=!1,this._status=v.kIdle;return}if(fe.ok&&fe.status>=200&&fe.status<=299){if(fe.url!==C.url&&this._onURLRedirect){let je=this._seekHandler.removeURLParameters(fe.url);this._onURLRedirect(je)}let Ce=fe.headers.get("Content-Length");return Ce!=null&&(this._contentLength=parseInt(Ce),this._contentLength!==0&&this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)),this._pump.call(this,fe.body.getReader())}else if(this._status=v.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:fe.status,msg:fe.statusText});else throw new l("FetchStreamLoader: Http code invalid, "+fe.status+" "+fe.statusText)}).catch(fe=>{if(this._status=v.kError,this._onError)this._onError(E.EXCEPTION,{code:-1,msg:fe.message});else throw fe})}abort(){this._requestAbort=!0}_pump(h){return h.read().then(m=>{if(m.done)if(this._contentLength!==null&&this._receivedLength<this._contentLength){this._status=v.kError;let y=E.EARLY_EOF,C={code:-1,msg:"Fetch stream meet Early-EOF"};if(this._onError)this._onError(y,C);else throw new l(C.msg)}else this._status=v.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=v.kComplete,h.cancel();this._status=v.kBuffering;let y=m.value.buffer,C=this._range.from+this._receivedLength;this._receivedLength+=y.byteLength,this._onDataArrival&&this._onDataArrival(y,C,this._receivedLength),this._pump(h)}}).catch(m=>{if(m.code===11&&V.msedge)return;this._status=v.kError;let y=0,C=null;if((m.code===19||m.message==="network error")&&(this._contentLength===null||this._contentLength!==null&&this._receivedLength<this._contentLength)?(y=E.EARLY_EOF,C={code:m.code,msg:"Fetch stream meet Early-EOF"}):(y=E.EXCEPTION,C={code:m.code,msg:m.message}),this._onError)this._onError(y,C);else throw new l(C.msg)})}}var I=L;class w extends A{static isSupported(){try{let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="moz-chunked-arraybuffer",h.responseType==="moz-chunked-arraybuffer"}catch(h){return p.w("MozChunkedLoader",h.message),!1}}constructor(h,m){super("xhr-moz-chunked-loader"),this.TAG="MozChunkedLoader",this._seekHandler=h,this._config=m,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(h,m){this._dataSource=h,this._range=m;let y=h.url;this._config.reuseRedirectedURL&&h.redirectedURL!=null&&(y=h.redirectedURL);let C=this._seekHandler.getConfig(y,m);this._requestURL=C.url;let H=this._xhr=new XMLHttpRequest;if(H.open("GET",C.url,!0),H.responseType="moz-chunked-arraybuffer",H.onreadystatechange=this._onReadyStateChange.bind(this),H.onprogress=this._onProgress.bind(this),H.onloadend=this._onLoadEnd.bind(this),H.onerror=this._onXhrError.bind(this),h.withCredentials&&(H.withCredentials=!0),typeof C.headers=="object"){let me=C.headers;for(let fe in me)me.hasOwnProperty(fe)&&H.setRequestHeader(fe,me[fe])}if(typeof this._config.headers=="object"){let me=this._config.headers;for(let fe in me)me.hasOwnProperty(fe)&&H.setRequestHeader(fe,me[fe])}this._status=v.kConnecting,H.send()}abort(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=v.kComplete}_onReadyStateChange(h){let m=h.target;if(m.readyState===2){if(m.responseURL!=null&&m.responseURL!==this._requestURL&&this._onURLRedirect){let y=this._seekHandler.removeURLParameters(m.responseURL);this._onURLRedirect(y)}if(m.status!==0&&(m.status<200||m.status>299))if(this._status=v.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new l("MozChunkedLoader: Http code invalid, "+m.status+" "+m.statusText);else this._status=v.kBuffering}}_onProgress(h){if(this._status===v.kError)return;this._contentLength===null&&h.total!==null&&h.total!==0&&(this._contentLength=h.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));let m=h.target.response,y=this._range.from+this._receivedLength;this._receivedLength+=m.byteLength,this._onDataArrival&&this._onDataArrival(m,y,this._receivedLength)}_onLoadEnd(h){if(this._requestAbort===!0){this._requestAbort=!1;return}else if(this._status===v.kError)return;this._status=v.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)}_onXhrError(h){this._status=v.kError;let m=0,y=null;if(this._contentLength&&h.loaded<this._contentLength?(m=E.EARLY_EOF,y={code:-1,msg:"Moz-Chunked stream meet Early-Eof"}):(m=E.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new l(y.msg)}}var R=w;class Y extends null{static isSupported(){try{if(typeof self.MSStream=="undefined"||typeof self.MSStreamReader=="undefined")return!1;let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="ms-stream",h.responseType==="ms-stream"}catch(h){return Log.w("MSStreamLoader",h.message),!1}}constructor(h,m){super("xhr-msstream-loader"),this.TAG="MSStreamLoader",this._seekHandler=h,this._config=m,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(h,m){this._internalOpen(h,m,!1)}_internalOpen(h,m,y){this._dataSource=h,y?this._currentRange=m:this._totalRange=m;let C=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?C=this._currentRedirectedURL:h.redirectedURL!=null&&(C=h.redirectedURL));let H=this._seekHandler.getConfig(C,m);this._currentRequestURL=H.url;let me=this._reader=new self.MSStreamReader;me.onprogress=this._msrOnProgress.bind(this),me.onload=this._msrOnLoad.bind(this),me.onerror=this._msrOnError.bind(this);let fe=this._xhr=new XMLHttpRequest;if(fe.open("GET",H.url,!0),fe.responseType="ms-stream",fe.onreadystatechange=this._xhrOnReadyStateChange.bind(this),fe.onerror=this._xhrOnError.bind(this),h.withCredentials&&(fe.withCredentials=!0),typeof H.headers=="object"){let Ce=H.headers;for(let je in Ce)Ce.hasOwnProperty(je)&&fe.setRequestHeader(je,Ce[je])}if(typeof this._config.headers=="object"){let Ce=this._config.headers;for(let je in Ce)Ce.hasOwnProperty(je)&&fe.setRequestHeader(je,Ce[je])}this._isReconnecting?this._isReconnecting=!1:this._status=LoaderStatus.kConnecting,fe.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(h){let m=h.target;if(m.readyState===2)if(m.status>=200&&m.status<=299){if(this._status=LoaderStatus.kBuffering,m.responseURL!=null){let C=this._seekHandler.removeURLParameters(m.responseURL);m.responseURL!==this._currentRequestURL&&C!==this._currentRedirectedURL&&(this._currentRedirectedURL=C,this._onURLRedirect&&this._onURLRedirect(C))}let y=m.getResponseHeader("Content-Length");if(y!=null&&this._contentLength==null){let C=parseInt(y);C>0&&(this._contentLength=C,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength))}}else if(this._status=LoaderStatus.kError,this._onError)this._onError(LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new RuntimeException("MSStreamLoader: Http code invalid, "+m.status+" "+m.statusText);else if(m.readyState===3&&m.status>=200&&m.status<=299){this._status=LoaderStatus.kBuffering;let y=m.response;this._reader.readAsArrayBuffer(y)}}_xhrOnError(h){this._status=LoaderStatus.kError;let m=LoaderErrors.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type};if(this._onError)this._onError(m,y);else throw new RuntimeException(y.msg)}_msrOnProgress(h){let y=h.target.result;if(y==null){this._doReconnectIfNeeded();return}let C=y.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=y.byteLength;let H=this._totalRange.from+this._receivedLength;this._receivedLength+=C.byteLength,this._onDataArrival&&this._onDataArrival(C,H,this._receivedLength),y.byteLength>=this._bufferLimit&&(Log.v(this.TAG,`MSStream buffer exceeded max size near ${H+C.byteLength}, reconnecting...`),this._doReconnectIfNeeded())}_doReconnectIfNeeded(){if(this._contentLength==null||this._receivedLength<this._contentLength){this._isReconnecting=!0,this._lastTimeBufferSize=0,this._internalAbort();let h={from:this._totalRange.from+this._receivedLength,to:-1};this._internalOpen(this._dataSource,h,!0)}}_msrOnLoad(h){this._status=LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._totalRange.from,this._totalRange.from+this._receivedLength-1)}_msrOnError(h){this._status=LoaderStatus.kError;let m=0,y=null;if(this._contentLength&&this._receivedLength<this._contentLength?(m=LoaderErrors.EARLY_EOF,y={code:-1,msg:"MSStream meet Early-Eof"}):(m=LoaderErrors.EARLY_EOF,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new RuntimeException(y.msg)}}var se=null;class ne extends A{static isSupported(){try{let h=new XMLHttpRequest;return h.open("GET","https://example.com",!0),h.responseType="arraybuffer",h.responseType==="arraybuffer"}catch(h){return p.w("RangeLoader",h.message),!1}}constructor(h,m){super("xhr-range-loader"),this.TAG="RangeLoader",this._seekHandler=h,this._config=m,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 oe,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(h,m){this._dataSource=h,this._range=m,this._status=v.kConnecting;let y=!1;this._dataSource.filesize!=null&&this._dataSource.filesize!==0&&(y=!0,this._totalLength=this._dataSource.filesize),!this._totalLengthReceived&&!y?(this._waitForTotalLength=!0,this._internalOpen(this._dataSource,{from:0,to:-1})):this._openSubRange()}_openSubRange(){let h=this._currentChunkSizeKB*1024,m=this._range.from+this._receivedLength,y=m+h;this._contentLength!=null&&y-this._range.from>=this._contentLength&&(y=this._range.from+this._contentLength-1),this._currentRequestRange={from:m,to:y},this._internalOpen(this._dataSource,this._currentRequestRange)}_internalOpen(h,m){this._lastTimeLoaded=0;let y=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?y=this._currentRedirectedURL:h.redirectedURL!=null&&(y=h.redirectedURL));let C=this._seekHandler.getConfig(y,m);this._currentRequestURL=C.url;let H=this._xhr=new XMLHttpRequest;if(H.open("GET",C.url,!0),H.responseType="arraybuffer",H.onreadystatechange=this._onReadyStateChange.bind(this),H.onprogress=this._onProgress.bind(this),H.onload=this._onLoad.bind(this),H.onerror=this._onXhrError.bind(this),h.withCredentials&&(H.withCredentials=!0),typeof C.headers=="object"){let me=C.headers;for(let fe in me)me.hasOwnProperty(fe)&&H.setRequestHeader(fe,me[fe])}if(typeof this._config.headers=="object"){let me=this._config.headers;for(let fe in me)me.hasOwnProperty(fe)&&H.setRequestHeader(fe,me[fe])}H.send()}abort(){this._requestAbort=!0,this._internalAbort(),this._status=v.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(h){let m=h.target;if(m.readyState===2){if(m.responseURL!=null){let y=this._seekHandler.removeURLParameters(m.responseURL);m.responseURL!==this._currentRequestURL&&y!==this._currentRedirectedURL&&(this._currentRedirectedURL=y,this._onURLRedirect&&this._onURLRedirect(y))}if(m.status>=200&&m.status<=299){if(this._waitForTotalLength)return;this._status=v.kBuffering}else if(this._status=v.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:m.status,msg:m.statusText});else throw new l("RangeLoader: Http code invalid, "+m.status+" "+m.statusText)}}_onProgress(h){if(this._status===v.kError)return;if(this._contentLength===null){let y=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,y=!0;let C=h.total;this._internalAbort(),C!=null&C!==0&&(this._totalLength=C)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,y){this._openSubRange();return}this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}let m=h.loaded-this._lastTimeLoaded;this._lastTimeLoaded=h.loaded,this._speedSampler.addBytes(m)}_normalizeSpeed(h){let m=this._chunkSizeKBList,y=m.length-1,C=0,H=0,me=y;if(h<m[0])return m[0];for(;H<=me;){if(C=H+Math.floor((me-H)/2),C===y||h>=m[C]&&h<m[C+1])return m[C];m[C]<h?H=C+1:me=C-1}}_onLoad(h){if(this._status===v.kError)return;if(this._waitForTotalLength){this._waitForTotalLength=!1;return}this._lastTimeLoaded=0;let m=this._speedSampler.lastSecondKBps;if(m===0&&(this._zeroSpeedChunkCount++,this._zeroSpeedChunkCount>=3&&(m=this._speedSampler.currentKBps)),m!==0){let me=this._normalizeSpeed(m);this._currentSpeedNormalized!==me&&(this._currentSpeedNormalized=me,this._currentChunkSizeKB=me)}let y=h.target.response,C=this._range.from+this._receivedLength;this._receivedLength+=y.byteLength;let H=!1;this._contentLength!=null&&this._receivedLength<this._contentLength?this._openSubRange():H=!0,this._onDataArrival&&this._onDataArrival(y,C,this._receivedLength),H&&(this._status=v.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1))}_onXhrError(h){this._status=v.kError;let m=0,y=null;if(this._contentLength&&this._receivedLength>0&&this._receivedLength<this._contentLength?(m=E.EARLY_EOF,y={code:-1,msg:"RangeLoader meet Early-Eof"}):(m=E.EXCEPTION,y={code:-1,msg:h.constructor.name+" "+h.type}),this._onError)this._onError(m,y);else throw new l(y.msg)}}var ye=ne;class Ie extends A{static isSupported(){try{return typeof self.WebSocket!="undefined"}catch(h){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(h){try{let m=this._ws=new self.WebSocket(h.url);m.binaryType="arraybuffer",m.onopen=this._onWebSocketOpen.bind(this),m.onclose=this._onWebSocketClose.bind(this),m.onmessage=this._onWebSocketMessage.bind(this),m.onerror=this._onWebSocketError.bind(this),this._status=v.kConnecting}catch(m){this._status=v.kError;let y={code:m.code,msg:m.message};if(this._onError)this._onError(E.EXCEPTION,y);else throw new l(y.msg)}}abort(){let h=this._ws;h&&(h.readyState===0||h.readyState===1)&&(this._requestAbort=!0,h.close()),this._ws=null,this._status=v.kComplete}_onWebSocketOpen(h){this._status=v.kBuffering}_onWebSocketClose(h){if(this._requestAbort===!0){this._requestAbort=!1;return}this._status=v.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)}_onWebSocketMessage(h){if(h.data instanceof ArrayBuffer)this._dispatchArrayBuffer(h.data);else if(h.data instanceof Blob){let m=new FileReader;m.onload=()=>{this._dispatchArrayBuffer(m.result)},m.readAsArrayBuffer(h.data)}else{this._status=v.kError;let m={code:-1,msg:"Unsupported WebSocket message type: "+h.data.constructor.name};if(this._onError)this._onError(E.EXCEPTION,m);else throw new l(m.msg)}}_dispatchArrayBuffer(h){let m=h,y=this._receivedLength;this._receivedLength+=m.byteLength,this._onDataArrival&&this._onDataArrival(m,y,this._receivedLength)}_onWebSocketError(h){this._status=v.kError;let m={code:h.code,msg:h.message};if(this._onError)this._onError(E.EXCEPTION,m);else throw new l(m.msg)}}var xe=Ie;class $e{constructor(h){this._zeroStart=h||!1}getConfig(h,m){let y={};if(m.from!==0||m.to!==-1){let C;m.to!==-1?C=`bytes=${m.from.toString()}-${m.to.toString()}`:C=`bytes=${m.from.toString()}-`,y.Range=C}else this._zeroStart&&(y.Range="bytes=0-");return{url:h,headers:y}}removeURLParameters(h){return h}}var J=$e;class D{constructor(h,m){this._startName=h,this._endName=m}getConfig(h,m){let y=h;if(m.from!==0||m.to!==-1){let C=!0;y.indexOf("?")===-1&&(y+="?",C=!1),C&&(y+="&"),y+=`${this._startName}=${m.from.toString()}`,m.to!==-1&&(y+=`&${this._endName}=${m.to.toString()}`)}return{url:y,headers:{}}}removeURLParameters(h){let m=h.split("?")[0],y,C=h.indexOf("?");C!==-1&&(y=h.substring(C+1));let H="";if(y!=null&&y.length>0){let me=y.split("&");for(let fe=0;fe<me.length;fe++){let Ce=me[fe].split("="),je=fe>0;Ce[0]!==this._startName&&Ce[0]!==this._endName&&(je&&(H+="&"),H+=me[fe])}}return H.length===0?m:m+"?"+H}}var N=D;class O{constructor(h,m,y){this.TAG="IOController",this._config=m,this._extraData=y,this._stashInitialSize=1024*384,m.stashInitialSize!=null&&m.stashInitialSize>0&&(this._stashInitialSize=m.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,m.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=h,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(h.url),this._refTotalLength=h.filesize?h.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new oe,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(h){this._extraData=h}get onDataArrival(){return this._onDataArrival}set onDataArrival(h){this._onDataArrival=h}get onSeeked(){return this._onSeeked}set onSeeked(h){this._onSeeked=h}get onError(){return this._onError}set onError(h){this._onError=h}get onComplete(){return this._onComplete}set onComplete(h){this._onComplete=h}get onRedirect(){return this._onRedirect}set onRedirect(h){this._onRedirect=h}get onRecoveredEarlyEof(){return this._onRecoveredEarlyEof}set onRecoveredEarlyEof(h){this._onRecoveredEarlyEof=h}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===ye?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}get loaderType(){return this._loader.type}_selectSeekHandler(){let h=this._config;if(h.seekType==="range")this._seekHandler=new J(this._config.rangeLoadZeroStart);else if(h.seekType==="param"){let m=h.seekParamStart||"bstart",y=h.seekParamEnd||"bend";this._seekHandler=new N(m,y)}else if(h.seekType==="custom"){if(typeof h.customSeekHandler!="function")throw new k("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new h.customSeekHandler}else throw new k(`Invalid seekType in config: ${h.seekType}`)}_selectLoader(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=xe;else if(I.isSupported())this._loaderClass=I;else if(R.isSupported())this._loaderClass=R;else if(ye.isSupported())this._loaderClass=ye;else throw new l("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(h){this._currentRange={from:0,to:-1},h&&(this._currentRange.from=h),this._speedSampler.reset(),h||(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 h=this._resumeFrom;this._resumeFrom=0,this._internalSeek(h,!0)}}seek(h){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(h,!0)}_internalSeek(h,m){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(m),this._loader.destroy(),this._loader=null;let y={from:h,to:-1};this._currentRange={from:y.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,y),this._onSeeked&&this._onSeeked()}updateUrl(h){if(!h||typeof h!="string"||h.length===0)throw new k("Url must be a non-empty string!");this._dataSource.url=h}_expandBuffer(h){let m=this._stashSize;for(;m+1024*1024*1<h;)m*=2;if(m+=1024*1024*1,m===this._bufferSize)return;let y=new ArrayBuffer(m);if(this._stashUsed>0){let C=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(y,0,m).set(C,0)}this._stashBuffer=y,this._bufferSize=m}_normalizeSpeed(h){let m=this._speedNormalizeList,y=m.length-1,C=0,H=0,me=y;if(h<m[0])return m[0];for(;H<=me;){if(C=H+Math.floor((me-H)/2),C===y||h>=m[C]&&h<m[C+1])return m[C];m[C]<h?H=C+1:me=C-1}}_adjustStashSize(h){let m=0;this._config.isLive||h<512?m=h:h>=512&&h<=1024?m=Math.floor(h*1.5):m=h*2,m>8192&&(m=8192);let y=m*1024+1024*1024*1;this._bufferSize<y&&this._expandBuffer(y),this._stashSize=m*1024}_dispatchChunks(h,m){return this._currentRange.to=m+h.byteLength-1,this._onDataArrival(h,m)}_onURLRedirect(h){this._redirectedURL=h,this._onRedirect&&this._onRedirect(h)}_onContentLengthKnown(h){h&&this._fullRequestFlag&&(this._totalLength=h,this._fullRequestFlag=!1)}_onLoaderChunkArrival(h,m,y){if(!this._onDataArrival)throw new Z("IOController: No existing consumer (onDataArrival) callback!");if(this._paused)return;this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,this._onRecoveredEarlyEof&&this._onRecoveredEarlyEof()),this._speedSampler.addBytes(h.byteLength);let C=this._speedSampler.lastSecondKBps;if(C!==0){let H=this._normalizeSpeed(C);this._speedNormalized!==H&&(this._speedNormalized=H,this._adjustStashSize(H))}if(this._enableStash)if(this._stashUsed===0&&this._stashByteStart===0&&(this._stashByteStart=m),this._stashUsed+h.byteLength<=this._stashSize)new Uint8Array(this._stashBuffer,0,this._stashSize).set(new Uint8Array(h),this._stashUsed),this._stashUsed+=h.byteLength;else{let H=new Uint8Array(this._stashBuffer,0,this._bufferSize);if(this._stashUsed>0){let me=this._stashBuffer.slice(0,this._stashUsed),fe=this._dispatchChunks(me,this._stashByteStart);if(fe<me.byteLength){if(fe>0){let Ce=new Uint8Array(me,fe);H.set(Ce,0),this._stashUsed=Ce.byteLength,this._stashByteStart+=fe}}else this._stashUsed=0,this._stashByteStart+=fe;this._stashUsed+h.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+h.byteLength),H=new Uint8Array(this._stashBuffer,0,this._bufferSize)),H.set(new Uint8Array(h),this._stashUsed),this._stashUsed+=h.byteLength}else{let me=this._dispatchChunks(h,m);if(me<h.byteLength){let fe=h.byteLength-me;fe>this._bufferSize&&(this._expandBuffer(fe),H=new Uint8Array(this._stashBuffer,0,this._bufferSize)),H.set(new Uint8Array(h,me),0),this._stashUsed+=fe,this._stashByteStart=m+me}}}else if(this._stashUsed===0){let H=this._dispatchChunks(h,m);if(H<h.byteLength){let me=h.byteLength-H;me>this._bufferSize&&this._expandBuffer(me),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(h,H),0),this._stashUsed+=me,this._stashByteStart=m+H}}else{this._stashUsed+h.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+h.byteLength);let H=new Uint8Array(this._stashBuffer,0,this._bufferSize);H.set(new Uint8Array(h),this._stashUsed),this._stashUsed+=h.byteLength;let me=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(me<this._stashUsed&&me>0){let fe=new Uint8Array(this._stashBuffer,me);H.set(fe,0)}this._stashUsed-=me,this._stashByteStart+=me}}_flushStashBuffer(h){if(this._stashUsed>0){let m=this._stashBuffer.slice(0,this._stashUsed),y=this._dispatchChunks(m,this._stashByteStart),C=m.byteLength-y;if(y<m.byteLength)if(h)p.w(this.TAG,`${C} bytes unconsumed data remain when flush buffer, dropped`);else{if(y>0){let H=new Uint8Array(this._stashBuffer,0,this._bufferSize),me=new Uint8Array(m,y);H.set(me,0),this._stashUsed=me.byteLength,this._stashByteStart+=y}return 0}return this._stashUsed=0,this._stashByteStart=0,C}return 0}_onLoaderComplete(h,m){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}_onLoaderError(h,m){switch(p.e(this.TAG,`Loader error, code = ${m.code}, msg = ${m.msg}`),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,h=E.UNRECOVERABLE_EARLY_EOF),h){case E.EARLY_EOF:{if(!this._config.isLive&&this._totalLength){let y=this._currentRange.to+1;y<this._totalLength&&(p.w(this.TAG,"Connection lost, trying reconnect..."),this._isEarlyEofReconnecting=!0,this._internalSeek(y,!1));return}h=E.UNRECOVERABLE_EARLY_EOF;break}case E.UNRECOVERABLE_EARLY_EOF:case E.CONNECTING_TIMEOUT:case E.HTTP_STATUS_CODE_INVALID:case E.EXCEPTION:break}if(this._onError)this._onError(h,m);else throw new l("IOException: "+m.msg)}}var ae=O;const te={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 S(){return Object.assign({},te)}class b{static supportMSEH264Playback(){return window.MediaSource&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}static supportNetworkStreamIO(){let h=new ae({},S()),m=h.loaderType;return h.destroy(),m=="fetch-stream-loader"||m=="xhr-moz-chunked-loader"}static getNetworkLoaderTypeName(){let h=new ae({},S()),m=h.loaderType;return h.destroy(),m}static supportNativeMediaPlayback(h){b.videoElement==null&&(b.videoElement=window.document.createElement("video"));let m=b.videoElement.canPlayType(h);return m==="probably"||m=="maybe"}static getFeatureList(){let h={mseFlvPlayback:!1,mseLiveFlvPlayback:!1,networkStreamIO:!1,networkLoaderName:"",nativeMP4H264Playback:!1,nativeWebmVP8Playback:!1,nativeWebmVP9Playback:!1};return h.mseFlvPlayback=b.supportMSEH264Playback(),h.networkStreamIO=b.supportNetworkStreamIO(),h.networkLoaderName=b.getNetworkLoaderTypeName(),h.mseLiveFlvPlayback=h.mseFlvPlayback&&h.networkStreamIO,h.nativeMP4H264Playback=b.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'),h.nativeWebmVP8Playback=b.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'),h.nativeWebmVP9Playback=b.supportNativeMediaPlayback('video/webm; codecs="vp9"'),h}}var K=b,Ee={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 Ne{static get forceGlobalTag(){return p.FORCE_GLOBAL_TAG}static set forceGlobalTag(h){p.FORCE_GLOBAL_TAG=h,Ne._notifyChange()}static get globalTag(){return p.GLOBAL_TAG}static set globalTag(h){p.GLOBAL_TAG=h,Ne._notifyChange()}static get enableAll(){return p.ENABLE_VERBOSE&&p.ENABLE_DEBUG&&p.ENABLE_INFO&&p.ENABLE_WARN&&p.ENABLE_ERROR}static set enableAll(h){p.ENABLE_VERBOSE=h,p.ENABLE_DEBUG=h,p.ENABLE_INFO=h,p.ENABLE_WARN=h,p.ENABLE_ERROR=h,Ne._notifyChange()}static get enableDebug(){return p.ENABLE_DEBUG}static set enableDebug(h){p.ENABLE_DEBUG=h,Ne._notifyChange()}static get enableVerbose(){return p.ENABLE_VERBOSE}static set enableVerbose(h){p.ENABLE_VERBOSE=h,Ne._notifyChange()}static get enableInfo(){return p.ENABLE_INFO}static set enableInfo(h){p.ENABLE_INFO=h,Ne._notifyChange()}static get enableWarn(){return p.ENABLE_WARN}static set enableWarn(h){p.ENABLE_WARN=h,Ne._notifyChange()}static get enableError(){return p.ENABLE_ERROR}static set enableError(h){p.ENABLE_ERROR=h,Ne._notifyChange()}static getConfig(){return{globalTag:p.GLOBAL_TAG,forceGlobalTag:p.FORCE_GLOBAL_TAG,enableVerbose:p.ENABLE_VERBOSE,enableDebug:p.ENABLE_DEBUG,enableInfo:p.ENABLE_INFO,enableWarn:p.ENABLE_WARN,enableError:p.ENABLE_ERROR,enableCallback:p.ENABLE_CALLBACK}}static applyConfig(h){p.GLOBAL_TAG=h.globalTag,p.FORCE_GLOBAL_TAG=h.forceGlobalTag,p.ENABLE_VERBOSE=h.enableVerbose,p.ENABLE_DEBUG=h.enableDebug,p.ENABLE_INFO=h.enableInfo,p.ENABLE_WARN=h.enableWarn,p.ENABLE_ERROR=h.enableError,p.ENABLE_CALLBACK=h.enableCallback}static _notifyChange(){let h=Ne.emitter;if(h.listenerCount("change")>0){let m=Ne.getConfig();h.emit("change",m)}}static registerListener(h){Ne.emitter.addListener("change",h)}static removeListener(h){Ne.emitter.removeListener("change",h)}static addLogListener(h){p.emitter.addListener("log",h),p.emitter.listenerCount("log")>0&&(p.ENABLE_CALLBACK=!0,Ne._notifyChange())}static removeLogListener(h){p.emitter.removeListener("log",h),p.emitter.listenerCount("log")===0&&(p.ENABLE_CALLBACK=!1,Ne._notifyChange())}}Ne.emitter=new(ue());var Qe=Ne;class bt{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 h=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,m=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&this.duration!=null&&this.metadata!=null&&this.hasKeyframesIndex!=null&&h&&m}isSeekable(){return this.hasKeyframesIndex===!0}getNearestKeyframe(h){if(this.keyframesIndex==null)return null;let m=this.keyframesIndex,y=this._search(m.times,h);return{index:y,milliseconds:m.times[y],fileposition:m.filepositions[y]}}_search(h,m){let y=0,C=h.length-1,H=0,me=0,fe=C;for(m<h[0]&&(y=0,me=fe+1);me<=fe;)if(H=me+Math.floor((fe-me)/2),H===C||m>=h[H]&&m<h[H+1]){y=H;break}else h[H]<m?me=H+1:fe=H-1;return y}}var Lt=bt;function ti(We,h,m){let y=We;if(h+m<y.length){for(;m--;)if((y[++h]&192)!==128)return!1;return!0}else return!1}function ze(We){let h=[],m=We,y=0,C=We.length;for(;y<C;){if(m[y]<128){h.push(String.fromCharCode(m[y])),++y;continue}else if(!(m[y]<192)){if(m[y]<224){if(ti(m,y,1)){let H=(m[y]&31)<<6|m[y+1]&63;if(H>=128){h.push(String.fromCharCode(H&65535)),y+=2;continue}}}else if(m[y]<240){if(ti(m,y,2)){let H=(m[y]&15)<<12|(m[y+1]&63)<<6|m[y+2]&63;if(H>=2048&&(H&63488)!==55296){h.push(String.fromCharCode(H&65535)),y+=3;continue}}}else if(m[y]<248&&ti(m,y,3)){let H=(m[y]&7)<<18|(m[y+1]&63)<<12|(m[y+2]&63)<<6|m[y+3]&63;if(H>65536&&H<1114112){H-=65536,h.push(String.fromCharCode(H>>>10|55296)),h.push(String.fromCharCode(H&1023|56320)),y+=4;continue}}}h.push("\uFFFD"),++y}return h.join("")}var Ct=ze;let Ze=function(){let We=new ArrayBuffer(2);return new DataView(We).setInt16(0,256,!0),new Int16Array(We)[0]===256}();class mt{static parseScriptData(h,m,y){let C={};try{let H=mt.parseValue(h,m,y),me=mt.parseValue(h,m+H.size,y-H.size);C[H.data]=me.data}catch(H){p.e("AMF",H.toString())}return C}static parseObject(h,m,y){if(y<3)throw new Z("Data not enough when parse ScriptDataObject");let C=mt.parseString(h,m,y),H=mt.parseValue(h,m+C.size,y-C.size),me=H.objectEnd;return{data:{name:C.data,value:H.data},size:C.size+H.size,objectEnd:me}}static parseVariable(h,m,y){return mt.parseObject(h,m,y)}static parseString(h,m,y){if(y<2)throw new Z("Data not enough when parse String");let H=new DataView(h,m,y).getUint16(0,!Ze),me;return H>0?me=Ct(new Uint8Array(h,m+2,H)):me="",{data:me,size:2+H}}static parseLongString(h,m,y){if(y<4)throw new Z("Data not enough when parse LongString");let H=new DataView(h,m,y).getUint32(0,!Ze),me;return H>0?me=Ct(new Uint8Array(h,m+4,H)):me="",{data:me,size:4+H}}static parseDate(h,m,y){if(y<10)throw new Z("Data size invalid when parse Date");let C=new DataView(h,m,y),H=C.getFloat64(0,!Ze),me=C.getInt16(8,!Ze);return H+=me*60*1e3,{data:new Date(H),size:10}}static parseValue(h,m,y){if(y<1)throw new Z("Data not enough when parse Value");let C=new DataView(h,m,y),H=1,me=C.getUint8(0),fe,Ce=!1;try{switch(me){case 0:fe=C.getFloat64(1,!Ze),H+=8;break;case 1:{fe=!!C.getUint8(1),H+=1;break}case 2:{let je=mt.parseString(h,m+1,y-1);fe=je.data,H+=je.size;break}case 3:{fe={};let je=0;for((C.getUint32(y-4,!Ze)&16777215)===9&&(je=3);H<y-4;){let at=mt.parseObject(h,m+H,y-H-je);if(at.objectEnd)break;fe[at.data.name]=at.data.value,H+=at.size}H<=y-3&&(C.getUint32(H-1,!Ze)&16777215)===9&&(H+=3);break}case 8:{fe={},H+=4;let je=0;for((C.getUint32(y-4,!Ze)&16777215)===9&&(je=3);H<y-8;){let at=mt.parseVariable(h,m+H,y-H-je);if(at.objectEnd)break;fe[at.data.name]=at.data.value,H+=at.size}H<=y-3&&(C.getUint32(H-1,!Ze)&16777215)===9&&(H+=3);break}case 9:fe=void 0,H=1,Ce=!0;break;case 10:{fe=[];let je=C.getUint32(1,!Ze);H+=4;for(let at=0;at<je;at++){let kt=mt.parseValue(h,m+H,y-H);fe.push(kt.data),H+=kt.size}break}case 11:{let je=mt.parseDate(h,m+1,y-1);fe=je.data,H+=je.size;break}case 12:{let je=mt.parseString(h,m+1,y-1);fe=je.data,H+=je.size;break}default:H=y,p.w("AMF","Unsupported AMF value type "+me)}}catch(je){p.e("AMF",je.toString())}return{data:fe,size:H,objectEnd:Ce}}}var Ye=mt;class ke{constructor(h){this.TAG="ExpGolomb",this._buffer=h,this._buffer_index=0,this._total_bytes=h.byteLength,this._total_bits=h.byteLength*8,this._current_word=0,this._current_word_bits_left=0}destroy(){this._buffer=null}_fillCurrentWord(){let h=this._total_bytes-this._buffer_index;if(h<=0)throw new Z("ExpGolomb: _fillCurrentWord() but no bytes available");let m=Math.min(4,h),y=new Uint8Array(4);y.set(this._buffer.subarray(this._buffer_index,this._buffer_index+m)),this._current_word=new DataView(y.buffer).getUint32(0,!1),this._buffer_index+=m,this._current_word_bits_left=m*8}readBits(h){if(h>32)throw new k("ExpGolomb: readBits() bits exceeded max 32bits!");if(h<=this._current_word_bits_left){let me=this._current_word>>>32-h;return this._current_word<<=h,this._current_word_bits_left-=h,me}let m=this._current_word_bits_left?this._current_word:0;m=m>>>32-this._current_word_bits_left;let y=h-this._current_word_bits_left;this._fillCurrentWord();let C=Math.min(y,this._current_word_bits_left),H=this._current_word>>>32-C;return this._current_word<<=C,this._current_word_bits_left-=C,m=m<<C|H,m}readBool(){return this.readBits(1)===1}readByte(){return this.readBits(8)}_skipLeadingZero(){let h;for(h=0;h<this._current_word_bits_left;h++)if(this._current_word&2147483648>>>h)return this._current_word<<=h,this._current_word_bits_left-=h,h;return this._fillCurrentWord(),h+this._skipLeadingZero()}readUEG(){let h=this._skipLeadingZero();return this.readBits(h+1)-1}readSEG(){let h=this.readUEG();return h&1?h+1>>>1:-1*(h>>>1)}}var ge=ke;class Ae{static _ebsp2rbsp(h){let m=h,y=m.byteLength,C=new Uint8Array(y),H=0;for(let me=0;me<y;me++)me>=2&&m[me]===3&&m[me-1]===0&&m[me-2]===0||(C[H]=m[me],H++);return new Uint8Array(C.buffer,0,H)}static parseSPS(h){let m=Ae._ebsp2rbsp(h),y=new ge(m);y.readByte();let C=y.readByte();y.readByte();let H=y.readByte();y.readUEG();let me=Ae.getProfileString(C),fe=Ae.getLevelString(H),Ce=1,je=420,at=[0,420,422,444],kt=8;if((C===100||C===110||C===122||C===244||C===44||C===83||C===86||C===118||C===128||C===138||C===144)&&(Ce=y.readUEG(),Ce===3&&y.readBits(1),Ce<=3&&(je=at[Ce]),kt=y.readUEG()+8,y.readUEG(),y.readBits(1),y.readBool())){let qt=Ce!==3?8:12;for(let yi=0;yi<qt;yi++)y.readBool()&&(yi<6?Ae._skipScalingList(y,16):Ae._skipScalingList(y,64))}y.readUEG();let Mt=y.readUEG();if(Mt===0)y.readUEG();else if(Mt===1){y.readBits(1),y.readSEG(),y.readSEG();let qt=y.readUEG();for(let yi=0;yi<qt;yi++)y.readSEG()}let xt=y.readUEG();y.readBits(1);let Kt=y.readUEG(),Et=y.readUEG(),ct=y.readBits(1);ct===0&&y.readBits(1),y.readBits(1);let ot=0,yt=0,Tt=0,mi=0;y.readBool()&&(ot=y.readUEG(),yt=y.readUEG(),Tt=y.readUEG(),mi=y.readUEG());let Yt=1,ht=1,At=0,Pt=!0,be=0,Be=0;if(y.readBool()){if(y.readBool()){let qt=y.readByte(),yi=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],ci=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];qt>0&&qt<16?(Yt=yi[qt-1],ht=ci[qt-1]):qt===255&&(Yt=y.readByte()<<8|y.readByte(),ht=y.readByte()<<8|y.readByte())}if(y.readBool()&&y.readBool(),y.readBool()&&(y.readBits(4),y.readBool()&&y.readBits(24)),y.readBool()&&(y.readUEG(),y.readUEG()),y.readBool()){let qt=y.readBits(32),yi=y.readBits(32);Pt=y.readBool(),be=yi,Be=qt*2,At=be/Be}}let qe=1;(Yt!==1||ht!==1)&&(qe=Yt/ht);let rt=0,_t=0;if(Ce===0)rt=1,_t=2-ct;else{let qt=Ce===3?1:2,yi=Ce===1?2:1;rt=qt,_t=yi*(2-ct)}let Ot=(Kt+1)*16,Ut=(2-ct)*((Et+1)*16);Ot-=(ot+yt)*rt,Ut-=(Tt+mi)*_t;let bi=Math.ceil(Ot*qe);return y.destroy(),y=null,{profile_string:me,level_string:fe,bit_depth:kt,ref_frames:xt,chroma_format:je,chroma_format_string:Ae.getChromaFormatString(je),frame_rate:{fixed:Pt,fps:At,fps_den:Be,fps_num:be},sar_ratio:{width:Yt,height:ht},codec_size:{width:Ot,height:Ut},present_size:{width:bi,height:Ut}}}static _skipScalingList(h,m){let y=8,C=8,H=0;for(let me=0;me<m;me++)C!==0&&(H=h.readSEG(),C=(y+H+256)%256),y=C===0?y:C}static getProfileString(h){switch(h){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(h){return(h/10).toFixed(1)}static getChromaFormatString(h){switch(h){case 420:return"4:2:0";case 422:return"4:2:2";case 444:return"4:4:4";default:return"Unknown"}}}var ee=Ae,Te={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};function q(We){return We>>>8&255|(We&255)<<8}function W(We){return(We&4278190080)>>>24|(We&16711680)>>>8|(We&65280)<<8|(We&255)<<24}function z(We,h){return We[h]<<24|We[h+1]<<16|We[h+2]<<8|We[h+3]}class re{constructor(h,m){this.TAG="FLVDemuxer",this._config=m,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=h.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=h.hasAudioTrack,this._hasVideo=h.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new Lt,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 y=new ArrayBuffer(2);return new DataView(y).setInt16(0,256,!0),new Int16Array(y)[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(h){let m=new Uint8Array(h),y={match:!1};if(m[0]!==70||m[1]!==76||m[2]!==86||m[3]!==1)return y;let C=(m[4]&4)>>>2!==0,H=(m[4]&1)!==0,me=z(m,5);return me<9?y:{match:!0,consumed:me,dataOffset:me,hasAudioTrack:C,hasVideoTrack:H}}bindDataSource(h){return h.onDataArrival=this.parseChunks.bind(this),this}get onTrackMetadata(){return this._onTrackMetadata}set onTrackMetadata(h){this._onTrackMetadata=h}get onMediaInfo(){return this._onMediaInfo}set onMediaInfo(h){this._onMediaInfo=h}get onMetaDataArrived(){return this._onMetaDataArrived}set onMetaDataArrived(h){this._onMetaDataArrived=h}get onScriptDataArrived(){return this._onScriptDataArrived}set onScriptDataArrived(h){this._onScriptDataArrived=h}get onError(){return this._onError}set onError(h){this._onError=h}get onDataAvailable(){return this._onDataAvailable}set onDataAvailable(h){this._onDataAvailable=h}get timestampBase(){return this._timestampBase}set timestampBase(h){this._timestampBase=h}get overridedDuration(){return this._duration}set overridedDuration(h){this._durationOverrided=!0,this._duration=h,this._mediaInfo.duration=h}set overridedHasAudio(h){this._hasAudioFlagOverrided=!0,this._hasAudio=h,this._mediaInfo.hasAudio=h}set overridedHasVideo(h){this._hasVideoFlagOverrided=!0,this._hasVideo=h,this._mediaInfo.hasVideo=h}resetMediaInfo(){this._mediaInfo=new Lt}_isInitialMetadataDispatched(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?this._videoInitialMetadataDispatched:!1}parseChunks(h,m){if(!this._onError||!this._onMediaInfo||!this._onTrackMetadata||!this._onDataAvailable)throw new Z("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");let y=0,C=this._littleEndian;if(m===0)if(h.byteLength>13)y=re.probe(h).dataOffset;else return 0;for(this._firstParse&&(this._firstParse=!1,m+y!==this._dataOffset&&p.w(this.TAG,"First time parsing but chunk byteStart invalid!"),new DataView(h,y).getUint32(0,!C)!==0&&p.w(this.TAG,"PrevTagSize0 !== 0 !!!"),y+=4);y<h.byteLength;){this._dispatch=!0;let H=new DataView(h,y);if(y+11+4>h.byteLength)break;let me=H.getUint8(0),fe=H.getUint32(0,!C)&16777215;if(y+11+fe+4>h.byteLength)break;if(me!==8&&me!==9&&me!==18){p.w(this.TAG,`Unsupported tag type ${me}, skipped`),y+=11+fe+4;continue}let Ce=H.getUint8(4),je=H.getUint8(5),at=H.getUint8(6),kt=H.getUint8(7),Mt=at|je<<8|Ce<<16|kt<<24;(H.getUint32(7,!C)&16777215)!==0&&p.w(this.TAG,"Meet tag which has StreamID != 0!");let Kt=y+11;switch(me){case 8:this._parseAudioData(h,Kt,fe,Mt);break;case 9:this._parseVideoData(h,Kt,fe,Mt,m+y);break;case 18:this._parseScriptData(h,Kt,fe);break}let Et=H.getUint32(11+fe,!C);Et!==11+fe&&p.w(this.TAG,`Invalid PrevTagSize ${Et}`),y+=11+fe+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),y}_parseScriptData(h,m,y){let C=Ye.parseScriptData(h,m,y);if(C.hasOwnProperty("onMetaData")){if(C.onMetaData==null||typeof C.onMetaData!="object"){p.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&p.w(this.TAG,"Found another onMetaData tag!"),this._metadata=C;let H=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},H)),typeof H.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=H.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof H.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=H.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof H.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=H.audiodatarate),typeof H.videodatarate=="number"&&(this._mediaInfo.videoDataRate=H.videodatarate),typeof H.width=="number"&&(this._mediaInfo.width=H.width),typeof H.height=="number"&&(this._mediaInfo.height=H.height),typeof H.duration=="number"){if(!this._durationOverrided){let me=Math.floor(H.duration*this._timescale);this._duration=me,this._mediaInfo.duration=me}}else this._mediaInfo.duration=0;if(typeof H.framerate=="number"){let me=Math.floor(H.framerate*1e3);if(me>0){let fe=me/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=fe,this._referenceFrameRate.fps_num=me,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=fe}}if(typeof H.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;let me=H.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(me),H.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=H,p.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(C).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},C))}_parseKeyframesIndex(h){let m=[],y=[];for(let C=1;C<h.times.length;C++){let H=this._timestampBase+Math.floor(h.times[C]*1e3);m.push(H),y.push(h.filepositions[C])}return{times:m,filepositions:y}}_parseAudioData(h,m,y,C){if(y<=1){p.w(this.TAG,"Flv: Invalid audio packet, missing SoundData payload!");return}if(this._hasAudioFlagOverrided===!0&&this._hasAudio===!1)return;let H=this._littleEndian,fe=new DataView(h,m,y).getUint8(0),Ce=fe>>>4;if(Ce!==2&&Ce!==10){this._onError(Te.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+Ce);return}let je=0,at=(fe&12)>>>2;if(at>=0&&at<=4)je=this._flvSoundRateTable[at];else{this._onError(Te.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+at);return}let kt=(fe&2)>>>1,Mt=fe&1,xt=this._audioMetadata,Kt=this._audioTrack;if(xt||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),xt=this._audioMetadata={},xt.type="audio",xt.id=Kt.id,xt.timescale=this._timescale,xt.duration=this._duration,xt.audioSampleRate=je,xt.channelCount=Mt===0?1:2),Ce===10){let Et=this._parseAACAudioData(h,m+1,y-1);if(Et==null)return;if(Et.packetType===0){xt.config&&p.w(this.TAG,"Found another AudioSpecificConfig!");let ct=Et.data;xt.audioSampleRate=ct.samplingRate,xt.channelCount=ct.channelCount,xt.codec=ct.codec,xt.originalCodec=ct.originalCodec,xt.config=ct.config,xt.refSampleDuration=1024/xt.audioSampleRate*xt.timescale,p.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",xt);let ot=this._mediaInfo;ot.audioCodec=xt.originalCodec,ot.audioSampleRate=xt.audioSampleRate,ot.audioChannelCount=xt.channelCount,ot.hasVideo?ot.videoCodec!=null&&(ot.mimeType='video/x-flv; codecs="'+ot.videoCodec+","+ot.audioCodec+'"'):ot.mimeType='video/x-flv; codecs="'+ot.audioCodec+'"',ot.isComplete()&&this._onMediaInfo(ot)}else if(Et.packetType===1){let ct=this._timestampBase+C,ot={unit:Et.data,length:Et.data.byteLength,dts:ct,pts:ct};Kt.samples.push(ot),Kt.length+=Et.data.length}else p.e(this.TAG,`Flv: Unsupported AAC data type ${Et.packetType}`)}else if(Ce===2){if(!xt.codec){let yt=this._parseMP3AudioData(h,m+1,y-1,!0);if(yt==null)return;xt.audioSampleRate=yt.samplingRate,xt.channelCount=yt.channelCount,xt.codec=yt.codec,xt.originalCodec=yt.originalCodec,xt.refSampleDuration=1152/xt.audioSampleRate*xt.timescale,p.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",xt);let Tt=this._mediaInfo;Tt.audioCodec=xt.codec,Tt.audioSampleRate=xt.audioSampleRate,Tt.audioChannelCount=xt.channelCount,Tt.audioDataRate=yt.bitRate,Tt.hasVideo?Tt.videoCodec!=null&&(Tt.mimeType='video/x-flv; codecs="'+Tt.videoCodec+","+Tt.audioCodec+'"'):Tt.mimeType='video/x-flv; codecs="'+Tt.audioCodec+'"',Tt.isComplete()&&this._onMediaInfo(Tt)}let Et=this._parseMP3AudioData(h,m+1,y-1,!1);if(Et==null)return;let ct=this._timestampBase+C,ot={unit:Et,length:Et.byteLength,dts:ct,pts:ct};Kt.samples.push(ot),Kt.length+=Et.length}}_parseAACAudioData(h,m,y){if(y<=1){p.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}let C={},H=new Uint8Array(h,m,y);return C.packetType=H[0],H[0]===0?C.data=this._parseAACAudioSpecificConfig(h,m+1,y-1):C.data=H.subarray(1),C}_parseAACAudioSpecificConfig(h,m,y){let C=new Uint8Array(h,m,y),H=null,me=0,fe=0,Ce=null,je=0,at=null;if(me=fe=C[0]>>>3,je=(C[0]&7)<<1|C[1]>>>7,je<0||je>=this._mpegSamplingRates.length){this._onError(Te.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}let kt=this._mpegSamplingRates[je],Mt=(C[1]&120)>>>3;if(Mt<0||Mt>=8){this._onError(Te.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}me===5&&(at=(C[1]&7)<<1|C[2]>>>7,Ce=(C[2]&124)>>>2);let xt=self.navigator.userAgent.toLowerCase();return xt.indexOf("firefox")!==-1?je>=6?(me=5,H=new Array(4),at=je-3):(me=2,H=new Array(2),at=je):xt.indexOf("android")!==-1?(me=2,H=new Array(2),at=je):(me=5,at=je,H=new Array(4),je>=6?at=je-3:Mt===1&&(me=2,H=new Array(2),at=je)),H[0]=me<<3,H[0]|=(je&15)>>>1,H[1]=(je&15)<<7,H[1]|=(Mt&15)<<3,me===5&&(H[1]|=(at&15)>>>1,H[2]=(at&1)<<7,H[2]|=8,H[3]=0),{config:H,samplingRate:kt,channelCount:Mt,codec:"mp4a.40."+me,originalCodec:"mp4a.40."+fe}}_parseMP3AudioData(h,m,y,C){if(y<4){p.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");return}let H=this._littleEndian,me=new Uint8Array(h,m,y),fe=null;if(C){if(me[0]!==255)return;let Ce=me[1]>>>3&3,je=(me[1]&6)>>1,at=(me[2]&240)>>>4,kt=(me[2]&12)>>>2,xt=(me[3]>>>6&3)!==3?2:1,Kt=0,Et=0,ct=34,ot="mp3";switch(Ce){case 0:Kt=this._mpegAudioV25SampleRateTable[kt];break;case 2:Kt=this._mpegAudioV20SampleRateTable[kt];break;case 3:Kt=this._mpegAudioV10SampleRateTable[kt];break}switch(je){case 1:ct=34,at<this._mpegAudioL3BitRateTable.length&&(Et=this._mpegAudioL3BitRateTable[at]);break;case 2:ct=33,at<this._mpegAudioL2BitRateTable.length&&(Et=this._mpegAudioL2BitRateTable[at]);break;case 3:ct=32,at<this._mpegAudioL1BitRateTable.length&&(Et=this._mpegAudioL1BitRateTable[at]);break}fe={bitRate:Et,samplingRate:Kt,channelCount:xt,codec:ot,originalCodec:ot}}else fe=me;return fe}_parseVideoData(h,m,y,C,H){if(y<=1){p.w(this.TAG,"Flv: Invalid video packet, missing VideoData payload!");return}if(this._hasVideoFlagOverrided===!0&&this._hasVideo===!1)return;let me=new Uint8Array(h,m,y)[0],fe=(me&240)>>>4,Ce=me&15;if(Ce!==7){this._onError(Te.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${Ce}`);return}this._parseAVCVideoPacket(h,m+1,y-1,C,H,fe)}_parseAVCVideoPacket(h,m,y,C,H,me){if(y<4){p.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}let fe=this._littleEndian,Ce=new DataView(h,m,y),je=Ce.getUint8(0),kt=(Ce.getUint32(0,!fe)&16777215)<<8>>8;if(je===0)this._parseAVCDecoderConfigurationRecord(h,m+4,y-4);else if(je===1)this._parseAVCVideoData(h,m+4,y-4,C,H,me,kt);else if(je!==2){this._onError(Te.FORMAT_ERROR,`Flv: Invalid video packet type ${je}`);return}}_parseAVCDecoderConfigurationRecord(h,m,y){if(y<7){p.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}let C=this._videoMetadata,H=this._videoTrack,me=this._littleEndian,fe=new DataView(h,m,y);C?typeof C.avcc!="undefined"&&p.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),C=this._videoMetadata={},C.type="video",C.id=H.id,C.timescale=this._timescale,C.duration=this._duration);let Ce=fe.getUint8(0),je=fe.getUint8(1),at=fe.getUint8(2),kt=fe.getUint8(3);if(Ce!==1||je===0){this._onError(Te.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");return}if(this._naluLengthSize=(fe.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(Te.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`);return}let Mt=fe.getUint8(5)&31;if(Mt===0){this._onError(Te.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else Mt>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${Mt}`);let xt=6;for(let Et=0;Et<Mt;Et++){let ct=fe.getUint16(xt,!me);if(xt+=2,ct===0)continue;let ot=new Uint8Array(h,m+xt,ct);xt+=ct;let yt=ee.parseSPS(ot);if(Et!==0)continue;C.codecWidth=yt.codec_size.width,C.codecHeight=yt.codec_size.height,C.presentWidth=yt.present_size.width,C.presentHeight=yt.present_size.height,C.profile=yt.profile_string,C.level=yt.level_string,C.bitDepth=yt.bit_depth,C.chromaFormat=yt.chroma_format,C.sarRatio=yt.sar_ratio,C.frameRate=yt.frame_rate,(yt.frame_rate.fixed===!1||yt.frame_rate.fps_num===0||yt.frame_rate.fps_den===0)&&(C.frameRate=this._referenceFrameRate);let Tt=C.frameRate.fps_den,mi=C.frameRate.fps_num;C.refSampleDuration=C.timescale*(Tt/mi);let Xt=ot.subarray(1,4),Yt="avc1.";for(let At=0;At<3;At++){let Pt=Xt[At].toString(16);Pt.length<2&&(Pt="0"+Pt),Yt+=Pt}C.codec=Yt;let ht=this._mediaInfo;ht.width=C.codecWidth,ht.height=C.codecHeight,ht.fps=C.frameRate.fps,ht.profile=C.profile,ht.level=C.level,ht.refFrames=yt.ref_frames,ht.chromaFormat=yt.chroma_format_string,ht.sarNum=C.sarRatio.width,ht.sarDen=C.sarRatio.height,ht.videoCodec=Yt,ht.hasAudio?ht.audioCodec!=null&&(ht.mimeType='video/x-flv; codecs="'+ht.videoCodec+","+ht.audioCodec+'"'):ht.mimeType='video/x-flv; codecs="'+ht.videoCodec+'"',ht.isComplete()&&this._onMediaInfo(ht)}let Kt=fe.getUint8(xt);if(Kt===0){this._onError(Te.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS");return}else Kt>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${Kt}`);xt++;for(let Et=0;Et<Kt;Et++){let ct=fe.getUint16(xt,!me);xt+=2,ct!==0&&(xt+=ct)}C.avcc=new Uint8Array(y),C.avcc.set(new Uint8Array(h,m,y),0),p.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",C)}_parseAVCVideoData(h,m,y,C,H,me,fe){let Ce=this._littleEndian,je=new DataView(h,m,y),at=[],kt=0,Mt=0;const xt=this._naluLengthSize;let Kt=this._timestampBase+C,Et=me===1;for(;Mt<y;){if(Mt+4>=y){p.w(this.TAG,`Malformed Nalu near timestamp ${Kt}, offset = ${Mt}, dataSize = ${y}`);break}let ct=je.getUint32(Mt,!Ce);if(xt===3&&(ct>>>=8),ct>y-xt){p.w(this.TAG,`Malformed Nalus near timestamp ${Kt}, NaluSize > DataSize!`);return}let ot=je.getUint8(Mt+xt)&31;ot===5&&(Et=!0);let yt=new Uint8Array(h,m+Mt,xt+ct),Tt={type:ot,data:yt};at.push(Tt),kt+=yt.byteLength,Mt+=xt+ct}if(at.length){let ct=this._videoTrack,ot={units:at,length:kt,isKeyframe:Et,dts:Kt,cts:fe,pts:Kt+fe};Et&&(ot.fileposition=H),ct.samples.push(ot),ct.length+=kt}}}var X=re;class ${static init(){$.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 m in $.types)$.types.hasOwnProperty(m)&&($.types[m]=[m.charCodeAt(0),m.charCodeAt(1),m.charCodeAt(2),m.charCodeAt(3)]);let h=$.constants={};h.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),h.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),h.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),h.STSC=h.STCO=h.STTS,h.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),h.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]),h.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]),h.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),h.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),h.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(h){let m=8,y=null,C=Array.prototype.slice.call(arguments,1),H=C.length;for(let fe=0;fe<H;fe++)m+=C[fe].byteLength;y=new Uint8Array(m),y[0]=m>>>24&255,y[1]=m>>>16&255,y[2]=m>>>8&255,y[3]=m&255,y.set(h,4);let me=8;for(let fe=0;fe<H;fe++)y.set(C[fe],me),me+=C[fe].byteLength;return y}static generateInitSegment(h){let m=$.box($.types.ftyp,$.constants.FTYP),y=$.moov(h),C=new Uint8Array(m.byteLength+y.byteLength);return C.set(m,0),C.set(y,m.byteLength),C}static moov(h){let m=$.mvhd(h.timescale,h.duration),y=$.trak(h),C=$.mvex(h);return $.box($.types.moov,m,y,C)}static mvhd(h,m){return $.box($.types.mvhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,h>>>24&255,h>>>16&255,h>>>8&255,h&255,m>>>24&255,m>>>16&255,m>>>8&255,m&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(h){return $.box($.types.trak,$.tkhd(h),$.mdia(h))}static tkhd(h){let m=h.id,y=h.duration,C=h.presentWidth,H=h.presentHeight;return $.box($.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255,0,0,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&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,C>>>8&255,C&255,0,0,H>>>8&255,H&255,0,0]))}static mdia(h){return $.box($.types.mdia,$.mdhd(h),$.hdlr(h),$.minf(h))}static mdhd(h){let m=h.timescale,y=h.duration;return $.box($.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255,y>>>24&255,y>>>16&255,y>>>8&255,y&255,85,196,0,0]))}static hdlr(h){let m=null;return h.type==="audio"?m=$.constants.HDLR_AUDIO:m=$.constants.HDLR_VIDEO,$.box($.types.hdlr,m)}static minf(h){let m=null;return h.type==="audio"?m=$.box($.types.smhd,$.constants.SMHD):m=$.box($.types.vmhd,$.constants.VMHD),$.box($.types.minf,m,$.dinf(),$.stbl(h))}static dinf(){return $.box($.types.dinf,$.box($.types.dref,$.constants.DREF))}static stbl(h){return $.box($.types.stbl,$.stsd(h),$.box($.types.stts,$.constants.STTS),$.box($.types.stsc,$.constants.STSC),$.box($.types.stsz,$.constants.STSZ),$.box($.types.stco,$.constants.STCO))}static stsd(h){return h.type==="audio"?h.codec==="mp3"?$.box($.types.stsd,$.constants.STSD_PREFIX,$.mp3(h)):$.box($.types.stsd,$.constants.STSD_PREFIX,$.mp4a(h)):$.box($.types.stsd,$.constants.STSD_PREFIX,$.avc1(h))}static mp3(h){let m=h.channelCount,y=h.audioSampleRate,C=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,m,0,16,0,0,0,0,y>>>8&255,y&255,0,0]);return $.box($.types[".mp3"],C)}static mp4a(h){let m=h.channelCount,y=h.audioSampleRate,C=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,m,0,16,0,0,0,0,y>>>8&255,y&255,0,0]);return $.box($.types.mp4a,C,$.esds(h))}static esds(h){let m=h.config||[],y=m.length,C=new Uint8Array([0,0,0,0,3,23+y,0,1,0,4,15+y,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([y]).concat(m).concat([6,1,2]));return $.box($.types.esds,C)}static avc1(h){let m=h.avcc,y=h.codecWidth,C=h.codecHeight,H=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,y>>>8&255,y&255,C>>>8&255,C&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 $.box($.types.avc1,H,$.box($.types.avcC,m))}static mvex(h){return $.box($.types.mvex,$.trex(h))}static trex(h){let m=h.id,y=new Uint8Array([0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return $.box($.types.trex,y)}static moof(h,m){return $.box($.types.moof,$.mfhd(h.sequenceNumber),$.traf(h,m))}static mfhd(h){let m=new Uint8Array([0,0,0,0,h>>>24&255,h>>>16&255,h>>>8&255,h&255]);return $.box($.types.mfhd,m)}static traf(h,m){let y=h.id,C=$.box($.types.tfhd,new Uint8Array([0,0,0,0,y>>>24&255,y>>>16&255,y>>>8&255,y&255])),H=$.box($.types.tfdt,new Uint8Array([0,0,0,0,m>>>24&255,m>>>16&255,m>>>8&255,m&255])),me=$.sdtp(h),fe=$.trun(h,me.byteLength+16+16+8+16+8+8);return $.box($.types.traf,C,H,fe,me)}static sdtp(h){let m=h.samples||[],y=m.length,C=new Uint8Array(4+y);for(let H=0;H<y;H++){let me=m[H].flags;C[H+4]=me.isLeading<<6|me.dependsOn<<4|me.isDependedOn<<2|me.hasRedundancy}return $.box($.types.sdtp,C)}static trun(h,m){let y=h.samples||[],C=y.length,H=12+16*C,me=new Uint8Array(H);m+=8+H,me.set([0,0,15,1,C>>>24&255,C>>>16&255,C>>>8&255,C&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255],0);for(let fe=0;fe<C;fe++){let Ce=y[fe].duration,je=y[fe].size,at=y[fe].flags,kt=y[fe].cts;me.set([Ce>>>24&255,Ce>>>16&255,Ce>>>8&255,Ce&255,je>>>24&255,je>>>16&255,je>>>8&255,je&255,at.isLeading<<2|at.dependsOn,at.isDependedOn<<6|at.hasRedundancy<<4|at.isNonSync,0,0,kt>>>24&255,kt>>>16&255,kt>>>8&255,kt&255],12+16*fe)}return $.box($.types.trun,me)}static mdat(h){return $.box($.types.mdat,h)}}$.init();var Q=$;class ce{static getSilentFrame(h,m){if(h==="mp4a.40.2"){if(m===1)return new Uint8Array([0,200,0,128,35,128]);if(m===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(m===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(m===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(m===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(m===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(m===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(m===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(m===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 he=ce;class we{constructor(h,m,y,C,H){this.dts=h,this.pts=m,this.duration=y,this.originalDts=C,this.isSyncPoint=H,this.fileposition=null}}class Ke{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(h){h.isSyncPoint=!0,this.syncPoints.push(h)}}class Ve{constructor(){this._list=[]}clear(){this._list=[]}appendArray(h){let m=this._list;h.length!==0&&(m.length>0&&h[0].originalDts<m[m.length-1].originalDts&&this.clear(),Array.prototype.push.apply(m,h))}getLastSyncPointBeforeDts(h){if(this._list.length==0)return null;let m=this._list,y=0,C=m.length-1,H=0,me=0,fe=C;for(h<m[0].dts&&(y=0,me=fe+1);me<=fe;)if(H=me+Math.floor((fe-me)/2),H===C||h>=m[H].dts&&h<m[H+1].dts){y=H;break}else m[H].dts<h?me=H+1:fe=H-1;return this._list[y]}}class Je{constructor(h){this._type=h,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(h){let m=this._list;if(m.length===0)return-2;let y=m.length-1,C=0,H=0,me=y,fe=0;if(h<m[0].originalBeginDts)return fe=-1,fe;for(;H<=me;)if(C=H+Math.floor((me-H)/2),C===y||h>m[C].lastSample.originalDts&&h<m[C+1].originalBeginDts){fe=C;break}else m[C].originalBeginDts<h?H=C+1:me=C-1;return fe}_searchNearestSegmentAfter(h){return this._searchNearestSegmentBefore(h)+1}append(h){let m=this._list,y=h,C=this._lastAppendLocation,H=0;C!==-1&&C<m.length&&y.originalBeginDts>=m[C].lastSample.originalDts&&(C===m.length-1||C<m.length-1&&y.originalBeginDts<m[C+1].originalBeginDts)?H=C+1:m.length>0&&(H=this._searchNearestSegmentBefore(y.originalBeginDts)+1),this._lastAppendLocation=H,this._list.splice(H,0,y)}getLastSegmentBefore(h){let m=this._searchNearestSegmentBefore(h);return m>=0?this._list[m]:null}getLastSampleBefore(h){let m=this.getLastSegmentBefore(h);return m!=null?m.lastSample:null}getLastSyncPointBefore(h){let m=this._searchNearestSegmentBefore(h),y=this._list[m].syncPoints;for(;y.length===0&&m>0;)m--,y=this._list[m].syncPoints;return y.length>0?y[y.length-1]:null}}class Ge{constructor(h){this.TAG="MP4Remuxer",this._config=h,this._isLive=h.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 Je("audio"),this._videoSegmentInfoList=new Je("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(V.chrome&&(V.version.major<50||V.version.major===50&&V.version.build<2661)),this._fillSilentAfterSeek=V.msedge||V.msie,this._mp3UseMpegAudio=!V.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(h){return h.onDataAvailable=this.remux.bind(this),h.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this}get onInitSegment(){return this._onInitSegment}set onInitSegment(h){this._onInitSegment=h}get onMediaSegment(){return this._onMediaSegment}set onMediaSegment(h){this._onMediaSegment=h}insertDiscontinuity(){this._audioNextDts=this._videoNextDts=void 0}seek(h){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()}remux(h,m){if(!this._onMediaSegment)throw new Z("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(h,m),this._remuxVideo(m),this._remuxAudio(h)}_onTrackMetadataReceived(h,m){let y=null,C="mp4",H=m.codec;if(h==="audio")this._audioMeta=m,m.codec==="mp3"&&this._mp3UseMpegAudio?(C="mpeg",H="",y=new Uint8Array):y=Q.generateInitSegment(m);else if(h==="video")this._videoMeta=m,y=Q.generateInitSegment(m);else return;if(!this._onInitSegment)throw new Z("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(h,{type:h,data:y.buffer,codec:H,container:`${h}/${C}`,mediaDuration:m.duration})}_calculateDtsBase(h,m){this._dtsBaseInited||(h.samples&&h.samples.length&&(this._audioDtsBase=h.samples[0].dts),m.samples&&m.samples.length&&(this._videoDtsBase=m.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)}flushStashedSamples(){let h=this._videoStashedLastSample,m=this._audioStashedLastSample,y={type:"video",id:1,sequenceNumber:0,samples:[],length:0};h!=null&&(y.samples.push(h),y.length=h.length);let C={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};m!=null&&(C.samples.push(m),C.length=m.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(y,!0),this._remuxAudio(C,!0)}_remuxAudio(h,m){if(this._audioMeta==null)return;let y=h,C=y.samples,H,me=-1,fe=-1,Ce=-1,je=this._audioMeta.refSampleDuration,at=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,kt=this._dtsBaseInited&&this._audioNextDts===void 0,Mt=!1;if(!C||C.length===0||C.length===1&&!m)return;let xt=0,Kt=null,Et=0;at?(xt=0,Et=y.length):(xt=8,Et=8+y.length);let ct=null;if(C.length>1&&(ct=C.pop(),Et-=ct.length),this._audioStashedLastSample!=null){let ht=this._audioStashedLastSample;this._audioStashedLastSample=null,C.unshift(ht),Et+=ht.length}ct!=null&&(this._audioStashedLastSample=ct);let ot=C[0].dts-this._dtsBase;if(this._audioNextDts)H=ot-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())H=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(Mt=!0);else{let ht=this._audioSegmentInfoList.getLastSampleBefore(ot);if(ht!=null){let At=ot-(ht.originalDts+ht.duration);At<=3&&(At=0);let Pt=ht.dts+ht.duration+At;H=ot-Pt}else H=0}if(Mt){let ht=ot-H,At=this._videoSegmentInfoList.getLastSegmentBefore(ot);if(At!=null&&At.beginDts<ht){let Pt=he.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(Pt){let be=At.beginDts,Be=ht-At.beginDts;p.v(this.TAG,`InsertPrefixSilentAudio: dts: ${be}, duration: ${Be}`),C.unshift({unit:Pt,dts:be,pts:be}),Et+=Pt.byteLength}}else Mt=!1}let yt=[];for(let ht=0;ht<C.length;ht++){let At=C[ht],Pt=At.unit,be=At.dts-this._dtsBase,Be=be-H;me===-1&&(me=Be);let et=0;ht!==C.length-1?et=C[ht+1].dts-this._dtsBase-H-Be:ct!=null?et=ct.dts-this._dtsBase-H-Be:yt.length>=1?et=yt[yt.length-1].duration:et=Math.floor(je);let qe=!1,rt=null;if(et>je*1.5&&this._audioMeta.codec!=="mp3"&&this._fillAudioTimestampGap&&!V.safari){qe=!0;let _t=Math.abs(et-je),Ot=Math.ceil(_t/je),Ut=Be+je;p.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
dts: ${Be+et} ms, expected: ${Be+Math.round(je)} ms, delta: ${Math.round(_t)} ms, generate: ${Ot} frames`);let bi=he.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);bi==null&&(p.w(this.TAG,`Unable to generate silent frame for ${this._audioMeta.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),bi=Pt),rt=[];for(let yi=0;yi<Ot;yi++){let ci=Math.round(Ut);if(rt.length>0){let Si=rt[rt.length-1];Si.duration=ci-Si.dts}let di={dts:ci,pts:ci,cts:0,unit:bi,size:bi.byteLength,duration:0,originalDts:be,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};rt.push(di),Et+=di.size,Ut+=je}let qt=rt[rt.length-1];qt.duration=Be+et-qt.dts,et=Math.round(je)}yt.push({dts:Be,pts:Be,cts:0,unit:At.unit,size:At.unit.byteLength,duration:et,originalDts:be,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),qe&&yt.push.apply(yt,rt)}at?Kt=new Uint8Array(Et):(Kt=new Uint8Array(Et),Kt[0]=Et>>>24&255,Kt[1]=Et>>>16&255,Kt[2]=Et>>>8&255,Kt[3]=Et&255,Kt.set(Q.types.mdat,4));for(let ht=0;ht<yt.length;ht++){let At=yt[ht].unit;Kt.set(At,xt),xt+=At.byteLength}let Tt=yt[yt.length-1];fe=Tt.dts+Tt.duration,this._audioNextDts=fe;let mi=new Ke;mi.beginDts=me,mi.endDts=fe,mi.beginPts=me,mi.endPts=fe,mi.originalBeginDts=yt[0].originalDts,mi.originalEndDts=Tt.originalDts+Tt.duration,mi.firstSample=new we(yt[0].dts,yt[0].pts,yt[0].duration,yt[0].originalDts,!1),mi.lastSample=new we(Tt.dts,Tt.pts,Tt.duration,Tt.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(mi),y.samples=yt,y.sequenceNumber++;let Xt=null;at?Xt=new Uint8Array:Xt=Q.moof(y,me),y.samples=[],y.length=0;let Yt={type:"audio",data:this._mergeBoxes(Xt,Kt).buffer,sampleCount:yt.length,info:mi};at&&kt&&(Yt.timestampOffset=me),this._onMediaSegment("audio",Yt)}_remuxVideo(h,m){if(this._videoMeta==null)return;let y=h,C=y.samples,H,me=-1,fe=-1,Ce=-1,je=-1;if(!C||C.length===0||C.length===1&&!m)return;let at=8,kt=null,Mt=8+h.length,xt=null;if(C.length>1&&(xt=C.pop(),Mt-=xt.length),this._videoStashedLastSample!=null){let Tt=this._videoStashedLastSample;this._videoStashedLastSample=null,C.unshift(Tt),Mt+=Tt.length}xt!=null&&(this._videoStashedLastSample=xt);let Kt=C[0].dts-this._dtsBase;if(this._videoNextDts)H=Kt-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())H=0;else{let Tt=this._videoSegmentInfoList.getLastSampleBefore(Kt);if(Tt!=null){let mi=Kt-(Tt.originalDts+Tt.duration);mi<=3&&(mi=0);let Xt=Tt.dts+Tt.duration+mi;H=Kt-Xt}else H=0}let Et=new Ke,ct=[];for(let Tt=0;Tt<C.length;Tt++){let mi=C[Tt],Xt=mi.dts-this._dtsBase,Yt=mi.isKeyframe,ht=Xt-H,At=mi.cts,Pt=ht+At;me===-1&&(me=ht,Ce=Pt);let be=0;if(Tt!==C.length-1?be=C[Tt+1].dts-this._dtsBase-H-ht:xt!=null?be=xt.dts-this._dtsBase-H-ht:ct.length>=1?be=ct[ct.length-1].duration:be=Math.floor(this._videoMeta.refSampleDuration),Yt){let Be=new we(ht,Pt,be,mi.dts,!0);Be.fileposition=mi.fileposition,Et.appendSyncPoint(Be)}ct.push({dts:ht,pts:Pt,cts:At,units:mi.units,size:mi.length,isKeyframe:Yt,duration:be,originalDts:Xt,flags:{isLeading:0,dependsOn:Yt?2:1,isDependedOn:Yt?1:0,hasRedundancy:0,isNonSync:Yt?0:1}})}kt=new Uint8Array(Mt),kt[0]=Mt>>>24&255,kt[1]=Mt>>>16&255,kt[2]=Mt>>>8&255,kt[3]=Mt&255,kt.set(Q.types.mdat,4);for(let Tt=0;Tt<ct.length;Tt++){let mi=ct[Tt].units;for(;mi.length;){let Yt=mi.shift().data;kt.set(Yt,at),at+=Yt.byteLength}}let ot=ct[ct.length-1];if(fe=ot.dts+ot.duration,je=ot.pts+ot.duration,this._videoNextDts=fe,Et.beginDts=me,Et.endDts=fe,Et.beginPts=Ce,Et.endPts=je,Et.originalBeginDts=ct[0].originalDts,Et.originalEndDts=ot.originalDts+ot.duration,Et.firstSample=new we(ct[0].dts,ct[0].pts,ct[0].duration,ct[0].originalDts,ct[0].isKeyframe),Et.lastSample=new we(ot.dts,ot.pts,ot.duration,ot.originalDts,ot.isKeyframe),this._isLive||this._videoSegmentInfoList.append(Et),y.samples=ct,y.sequenceNumber++,this._forceFirstIDR){let Tt=ct[0].flags;Tt.dependsOn=2,Tt.isNonSync=0}let yt=Q.moof(y,me);y.samples=[],y.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(yt,kt).buffer,sampleCount:ct.length,info:Et})}_mergeBoxes(h,m){let y=new Uint8Array(h.byteLength+m.byteLength);return y.set(h,0),y.set(m,h.byteLength),y}}var Fe=Ge,De={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 it{constructor(h,m){this.TAG="TransmuxingController",this._emitter=new(ue()),this._config=m,h.segments||(h.segments=[{duration:h.duration,filesize:h.filesize,url:h.url}]),typeof h.cors!="boolean"&&(h.cors=!0),typeof h.withCredentials!="boolean"&&(h.withCredentials=!1),this._mediaDataSource=h,this._currentSegmentIndex=0;let y=0;this._mediaDataSource.segments.forEach(C=>{C.timestampBase=y,y+=C.duration,C.cors=h.cors,C.withCredentials=h.withCredentials,m.referrerPolicy&&(C.referrerPolicy=m.referrerPolicy)}),!isNaN(y)&&this._mediaDataSource.duration!==y&&(this._mediaDataSource.duration=y),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(h,m){this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}start(){this._loadSegment(0),this._enableStatisticsReporter()}_loadSegment(h,m){this._currentSegmentIndex=h;let y=this._mediaDataSource.segments[h],C=this._ioctl=new ae(y,this._config,h);C.onError=this._onIOException.bind(this),C.onSeeked=this._onIOSeeked.bind(this),C.onComplete=this._onIOComplete.bind(this),C.onRedirect=this._onIORedirect.bind(this),C.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),m?this._demuxer.bindDataSource(this._ioctl):C.onDataArrival=this._onInitChunkArrival.bind(this),C.open(m)}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(h){if(this._mediaInfo==null||!this._mediaInfo.isSeekable())return;let m=this._searchSegmentIndexContains(h);if(m===this._currentSegmentIndex){let y=this._mediaInfo.segments[m];if(y==null)this._pendingSeekTime=h;else{let C=y.getNearestKeyframe(h);this._remuxer.seek(C.milliseconds),this._ioctl.seek(C.fileposition),this._pendingResolveSeekPoint=C.milliseconds}}else{let y=this._mediaInfo.segments[m];if(y==null)this._pendingSeekTime=h,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(m);else{let C=y.getNearestKeyframe(h);this._internalAbort(),this._remuxer.seek(h),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[m].timestampBase,this._loadSegment(m,C.fileposition),this._pendingResolveSeekPoint=C.milliseconds,this._reportSegmentMediaInfo(m)}}this._enableStatisticsReporter()}_searchSegmentIndexContains(h){let m=this._mediaDataSource.segments,y=m.length-1;for(let C=0;C<m.length;C++)if(h<m[C].timestampBase){y=C-1;break}return y}_onInitChunkArrival(h,m){let y=null,C=0;if(m>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,C=this._demuxer.parseChunks(h,m);else if((y=X.probe(h)).match){this._demuxer=new X(y,this._config),this._remuxer||(this._remuxer=new Fe(this._config));let H=this._mediaDataSource;H.duration!=null&&!isNaN(H.duration)&&(this._demuxer.overridedDuration=H.duration),typeof H.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=H.hasAudio),typeof H.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=H.hasVideo),this._demuxer.timestampBase=H.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),C=this._demuxer.parseChunks(h,m)}else y=null,p.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(()=>{this._internalAbort()}),this._emitter.emit(De.DEMUX_ERROR,Te.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),C=0;return C}_onMediaInfo(h){this._mediaInfo==null&&(this._mediaInfo=Object.assign({},h),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,Lt.prototype));let m=Object.assign({},h);Object.setPrototypeOf(m,Lt.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=m,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(()=>{let y=this._pendingSeekTime;this._pendingSeekTime=null,this.seek(y)})}_onMetaDataArrived(h){this._emitter.emit(De.METADATA_ARRIVED,h)}_onScriptDataArrived(h){this._emitter.emit(De.SCRIPTDATA_ARRIVED,h)}_onIOSeeked(){this._remuxer.insertDiscontinuity()}_onIOComplete(h){let y=h+1;y<this._mediaDataSource.segments.length?(this._internalAbort(),this._remuxer.flushStashedSamples(),this._loadSegment(y)):(this._remuxer.flushStashedSamples(),this._emitter.emit(De.LOADING_COMPLETE),this._disableStatisticsReporter())}_onIORedirect(h){let m=this._ioctl.extraData;this._mediaDataSource.segments[m].redirectedURL=h}_onIORecoveredEarlyEof(){this._emitter.emit(De.RECOVERED_EARLY_EOF)}_onIOException(h,m){p.e(this.TAG,`IOException: type = ${h}, code = ${m.code}, msg = ${m.msg}`),this._emitter.emit(De.IO_ERROR,h,m),this._disableStatisticsReporter()}_onDemuxException(h,m){p.e(this.TAG,`DemuxException: type = ${h}, info = ${m}`),this._emitter.emit(De.DEMUX_ERROR,h,m)}_onRemuxerInitSegmentArrival(h,m){this._emitter.emit(De.INIT_SEGMENT,h,m)}_onRemuxerMediaSegmentArrival(h,m){if(this._pendingSeekTime==null&&(this._emitter.emit(De.MEDIA_SEGMENT,h,m),this._pendingResolveSeekPoint!=null&&h==="video")){let y=m.info.syncPoints,C=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,V.safari&&y.length>0&&y[0].originalDts===C&&(C=y[0].pts),this._emitter.emit(De.RECOMMEND_SEEKPOINT,C)}}_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(h){let m=this._mediaInfo.segments[h],y=Object.assign({},m);y.duration=this._mediaInfo.duration,y.segmentCount=this._mediaInfo.segmentCount,delete y.segments,delete y.keyframesIndex,this._emitter.emit(De.MEDIA_INFO,y)}_reportStatisticsInfo(){let h={};h.url=this._ioctl.currentURL,h.hasRedirect=this._ioctl.hasRedirect,h.hasRedirect&&(h.redirectedURL=this._ioctl.currentRedirectedURL),h.speed=this._ioctl.currentSpeed,h.loaderType=this._ioctl.loaderType,h.currentSegmentIndex=this._currentSegmentIndex,h.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(De.STATISTICS_INFO,h)}}var Bt=it,dt=function(We){let h="TransmuxingWorker",m=null,y=Et.bind(this);pe.install(),We.addEventListener("message",function(ct){switch(ct.data.cmd){case"init":m=new Bt(ct.data.param[0],ct.data.param[1]),m.on(De.IO_ERROR,Mt.bind(this)),m.on(De.DEMUX_ERROR,xt.bind(this)),m.on(De.INIT_SEGMENT,C.bind(this)),m.on(De.MEDIA_SEGMENT,H.bind(this)),m.on(De.LOADING_COMPLETE,me.bind(this)),m.on(De.RECOVERED_EARLY_EOF,fe.bind(this)),m.on(De.MEDIA_INFO,Ce.bind(this)),m.on(De.METADATA_ARRIVED,je.bind(this)),m.on(De.SCRIPTDATA_ARRIVED,at.bind(this)),m.on(De.STATISTICS_INFO,kt.bind(this)),m.on(De.RECOMMEND_SEEKPOINT,Kt.bind(this));break;case"destroy":m&&(m.destroy(),m=null),We.postMessage({msg:"destroyed"});break;case"start":m.start();break;case"stop":m.stop();break;case"seek":m.seek(ct.data.param);break;case"pause":m.pause();break;case"resume":m.resume();break;case"logging_config":{let ot=ct.data.param;Qe.applyConfig(ot),ot.enableCallback===!0?Qe.addLogListener(y):Qe.removeLogListener(y);break}}});function C(ct,ot){let yt={msg:De.INIT_SEGMENT,data:{type:ct,data:ot}};We.postMessage(yt,[ot.data])}function H(ct,ot){let yt={msg:De.MEDIA_SEGMENT,data:{type:ct,data:ot}};We.postMessage(yt,[ot.data])}function me(){let ct={msg:De.LOADING_COMPLETE};We.postMessage(ct)}function fe(){let ct={msg:De.RECOVERED_EARLY_EOF};We.postMessage(ct)}function Ce(ct){let ot={msg:De.MEDIA_INFO,data:ct};We.postMessage(ot)}function je(ct){let ot={msg:De.METADATA_ARRIVED,data:ct};We.postMessage(ot)}function at(ct){let ot={msg:De.SCRIPTDATA_ARRIVED,data:ct};We.postMessage(ot)}function kt(ct){let ot={msg:De.STATISTICS_INFO,data:ct};We.postMessage(ot)}function Mt(ct,ot){We.postMessage({msg:De.IO_ERROR,data:{type:ct,info:ot}})}function xt(ct,ot){We.postMessage({msg:De.DEMUX_ERROR,data:{type:ct,info:ot}})}function Kt(ct){We.postMessage({msg:De.RECOMMEND_SEEKPOINT,data:ct})}function Et(ct,ot){We.postMessage({msg:"logcat_callback",data:{type:ct,logcat:ot}})}};class Vt{constructor(h,m){if(this.TAG="Transmuxer",this._emitter=new(ue()),m.enableWorker&&typeof Worker!="undefined")try{let y=U(82059);this._worker=y(dt),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[h,m]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},Qe.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:Qe.getConfig()})}catch(y){p.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new Bt(h,m)}else this._controller=new Bt(h,m);if(this._controller){let y=this._controller;y.on(De.IO_ERROR,this._onIOError.bind(this)),y.on(De.DEMUX_ERROR,this._onDemuxError.bind(this)),y.on(De.INIT_SEGMENT,this._onInitSegment.bind(this)),y.on(De.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),y.on(De.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),y.on(De.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),y.on(De.MEDIA_INFO,this._onMediaInfo.bind(this)),y.on(De.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),y.on(De.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),y.on(De.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),y.on(De.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}destroy(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),Qe.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null}on(h,m){this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}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(h){this._worker?this._worker.postMessage({cmd:"seek",param:h}):this._controller.seek(h)}pause(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()}resume(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()}_onInitSegment(h,m){Promise.resolve().then(()=>{this._emitter.emit(De.INIT_SEGMENT,h,m)})}_onMediaSegment(h,m){Promise.resolve().then(()=>{this._emitter.emit(De.MEDIA_SEGMENT,h,m)})}_onLoadingComplete(){Promise.resolve().then(()=>{this._emitter.emit(De.LOADING_COMPLETE)})}_onRecoveredEarlyEof(){Promise.resolve().then(()=>{this._emitter.emit(De.RECOVERED_EARLY_EOF)})}_onMediaInfo(h){Promise.resolve().then(()=>{this._emitter.emit(De.MEDIA_INFO,h)})}_onMetaDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(De.METADATA_ARRIVED,h)})}_onScriptDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(De.SCRIPTDATA_ARRIVED,h)})}_onStatisticsInfo(h){Promise.resolve().then(()=>{this._emitter.emit(De.STATISTICS_INFO,h)})}_onIOError(h,m){Promise.resolve().then(()=>{this._emitter.emit(De.IO_ERROR,h,m)})}_onDemuxError(h,m){Promise.resolve().then(()=>{this._emitter.emit(De.DEMUX_ERROR,h,m)})}_onRecommendSeekpoint(h){Promise.resolve().then(()=>{this._emitter.emit(De.RECOMMEND_SEEKPOINT,h)})}_onLoggingConfigChanged(h){this._worker&&this._worker.postMessage({cmd:"logging_config",param:h})}_onWorkerMessage(h){let m=h.data,y=m.data;if(m.msg==="destroyed"||this._workerDestroying){this._workerDestroying=!1,this._worker.terminate(),this._worker=null;return}switch(m.msg){case De.INIT_SEGMENT:case De.MEDIA_SEGMENT:this._emitter.emit(m.msg,y.type,y.data);break;case De.LOADING_COMPLETE:case De.RECOVERED_EARLY_EOF:this._emitter.emit(m.msg);break;case De.MEDIA_INFO:Object.setPrototypeOf(y,Lt.prototype),this._emitter.emit(m.msg,y);break;case De.METADATA_ARRIVED:case De.SCRIPTDATA_ARRIVED:case De.STATISTICS_INFO:this._emitter.emit(m.msg,y);break;case De.IO_ERROR:case De.DEMUX_ERROR:this._emitter.emit(m.msg,y.type,y.info);break;case De.RECOMMEND_SEEKPOINT:this._emitter.emit(m.msg,y);break;case"logcat_callback":p.emitter.emit("log",y.type,y.logcat);break;default:break}}}var ni=Vt,Wt={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"};class ri{constructor(h){this.TAG="MSEController",this._config=h,this._emitter=new(ue()),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 Ve}destroy(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null}on(h,m){this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}attachMediaElement(h){if(this._mediaSource)throw new Z("MediaSource has been attached to an HTMLMediaElement!");let m=this._mediaSource=new window.MediaSource;m.addEventListener("sourceopen",this.e.onSourceOpen),m.addEventListener("sourceended",this.e.onSourceEnded),m.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=h,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),h.src=this._mediaSourceObjectURL}detachMediaElement(){if(this._mediaSource){let h=this._mediaSource;for(let m in this._sourceBuffers){let y=this._pendingSegments[m];y.splice(0,y.length),this._pendingSegments[m]=null,this._pendingRemoveRanges[m]=null,this._lastInitSegments[m]=null;let C=this._sourceBuffers[m];if(C){if(h.readyState!=="closed"){try{h.removeSourceBuffer(C)}catch(H){p.e(this.TAG,H.message)}C.removeEventListener("error",this.e.onSourceBufferError),C.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[m]=null,this._sourceBuffers[m]=null}}if(h.readyState==="open")try{h.endOfStream()}catch(m){p.e(this.TAG,m.message)}h.removeEventListener("sourceopen",this.e.onSourceOpen),h.removeEventListener("sourceended",this.e.onSourceEnded),h.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(h,m){if(!this._mediaSource||this._mediaSource.readyState!=="open"){this._pendingSourceBufferInit.push(h),this._pendingSegments[h.type].push(h);return}let y=h,C=`${y.container}`;y.codec&&y.codec.length>0&&(C+=`;codecs=${y.codec}`);let H=!1;if(p.v(this.TAG,"Received Initialization Segment, mimeType: "+C),this._lastInitSegments[y.type]=y,C!==this._mimeTypes[y.type]){if(this._mimeTypes[y.type])p.v(this.TAG,`Notice: ${y.type} mimeType changed, origin: ${this._mimeTypes[y.type]}, target: ${C}`);else{H=!0;try{let me=this._sourceBuffers[y.type]=this._mediaSource.addSourceBuffer(C);me.addEventListener("error",this.e.onSourceBufferError),me.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(me){p.e(this.TAG,me.message),this._emitter.emit(Wt.ERROR,{code:me.code,msg:me.message});return}}this._mimeTypes[y.type]=C}m||this._pendingSegments[y.type].push(y),H||this._sourceBuffers[y.type]&&!this._sourceBuffers[y.type].updating&&this._doAppendSegments(),V.safari&&y.container==="audio/mpeg"&&y.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=y.mediaDuration/1e3,this._updateMediaSourceDuration())}appendMediaSegment(h){let m=h;this._pendingSegments[m.type].push(m),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();let y=this._sourceBuffers[m.type];y&&!y.updating&&!this._hasPendingRemoveRanges()&&this._doAppendSegments()}seek(h){for(let m in this._sourceBuffers){if(!this._sourceBuffers[m])continue;let y=this._sourceBuffers[m];if(this._mediaSource.readyState==="open")try{y.abort()}catch(H){p.e(this.TAG,H.message)}this._idrList.clear();let C=this._pendingSegments[m];if(C.splice(0,C.length),this._mediaSource.readyState!=="closed"){for(let H=0;H<y.buffered.length;H++){let me=y.buffered.start(H),fe=y.buffered.end(H);this._pendingRemoveRanges[m].push({start:me,end:fe})}if(y.updating||this._doRemoveRanges(),V.safari){let H=this._lastInitSegments[m];H&&(this._pendingSegments[m].push(H),y.updating||this._doAppendSegments())}}}}endOfStream(){let h=this._mediaSource,m=this._sourceBuffers;if(!h||h.readyState!=="open"){h&&h.readyState==="closed"&&this._hasPendingSegments()&&(this._hasPendingEos=!0);return}m.video&&m.video.updating||m.audio&&m.audio.updating?this._hasPendingEos=!0:(this._hasPendingEos=!1,h.endOfStream())}getNearestKeyframe(h){return this._idrList.getLastSyncPointBeforeDts(h)}_needCleanupSourceBuffer(){if(!this._config.autoCleanupSourceBuffer)return!1;let h=this._mediaElement.currentTime;for(let m in this._sourceBuffers){let y=this._sourceBuffers[m];if(y){let C=y.buffered;if(C.length>=1&&h-C.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1}_doCleanupSourceBuffer(){let h=this._mediaElement.currentTime;for(let m in this._sourceBuffers){let y=this._sourceBuffers[m];if(y){let C=y.buffered,H=!1;for(let me=0;me<C.length;me++){let fe=C.start(me),Ce=C.end(me);if(fe<=h&&h<Ce+3){if(h-fe>=this._config.autoCleanupMaxBackwardDuration){H=!0;let je=h-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[m].push({start:fe,end:je})}}else Ce<h&&(H=!0,this._pendingRemoveRanges[m].push({start:fe,end:Ce}))}H&&!y.updating&&this._doRemoveRanges()}}}_updateMediaSourceDuration(){let h=this._sourceBuffers;if(this._mediaElement.readyState===0||this._mediaSource.readyState!=="open"||h.video&&h.video.updating||h.audio&&h.audio.updating)return;let m=this._mediaSource.duration,y=this._pendingMediaDuration;y>0&&(isNaN(m)||y>m)&&(p.v(this.TAG,`Update MediaSource duration from ${m} to ${y}`),this._mediaSource.duration=y),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}_doRemoveRanges(){for(let h in this._pendingRemoveRanges){if(!this._sourceBuffers[h]||this._sourceBuffers[h].updating)continue;let m=this._sourceBuffers[h],y=this._pendingRemoveRanges[h];for(;y.length&&!m.updating;){let C=y.shift();m.remove(C.start,C.end)}}}_doAppendSegments(){let h=this._pendingSegments;for(let m in h)if(!(!this._sourceBuffers[m]||this._sourceBuffers[m].updating)&&h[m].length>0){let y=h[m].shift();if(y.timestampOffset){let C=this._sourceBuffers[m].timestampOffset,H=y.timestampOffset/1e3;Math.abs(C-H)>.1&&(p.v(this.TAG,`Update MPEG audio timestampOffset from ${C} to ${H}`),this._sourceBuffers[m].timestampOffset=H),delete y.timestampOffset}if(!y.data||y.data.byteLength===0)continue;try{this._sourceBuffers[m].appendBuffer(y.data),this._isBufferFull=!1,m==="video"&&y.hasOwnProperty("info")&&this._idrList.appendArray(y.info.syncPoints)}catch(C){this._pendingSegments[m].unshift(y),C.code===22?(this._isBufferFull||this._emitter.emit(Wt.BUFFER_FULL),this._isBufferFull=!0):(p.e(this.TAG,C.message),this._emitter.emit(Wt.ERROR,{code:C.code,msg:C.message}))}}}_onSourceOpen(){if(p.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0){let h=this._pendingSourceBufferInit;for(;h.length;){let m=h.shift();this.appendInitSegment(m,!0)}}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(Wt.SOURCE_OPEN)}_onSourceEnded(){p.v(this.TAG,"MediaSource onSourceEnded")}_onSourceClose(){p.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 h=this._pendingSegments;return h.video.length>0||h.audio.length>0}_hasPendingRemoveRanges(){let h=this._pendingRemoveRanges;return h.video.length>0||h.audio.length>0}_onSourceBufferUpdateEnd(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(Wt.UPDATE_END)}_onSourceBufferError(h){p.e(this.TAG,`SourceBuffer Error: ${h}`)}}var Rt=ri;const ut={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},st={NETWORK_EXCEPTION:E.EXCEPTION,NETWORK_STATUS_CODE_INVALID:E.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:E.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:E.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:Te.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:Te.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:Te.CODEC_UNSUPPORTED};class Nt{constructor(h,m){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(ue()),this._config=S(),typeof m=="object"&&Object.assign(this._config,m),h.type.toLowerCase()!=="flv")throw new k("FlvPlayer requires an flv MediaDataSource input!");h.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=h,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 y=V.chrome&&(V.version.major<50||V.version.major===50&&V.version.build<2661);this._alwaysSeekKeyframe=!!(y||V.msedge||V.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(h,m){h===Ee.MEDIA_INFO?this._mediaInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(Ee.MEDIA_INFO,this.mediaInfo)}):h===Ee.STATISTICS_INFO&&this._statisticsInfo!=null&&Promise.resolve().then(()=>{this._emitter.emit(Ee.STATISTICS_INFO,this.statisticsInfo)}),this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}attachMediaElement(h){if(this._mediaElement=h,h.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),h.addEventListener("seeking",this.e.onvSeeking),h.addEventListener("canplay",this.e.onvCanPlay),h.addEventListener("stalled",this.e.onvStalled),h.addEventListener("progress",this.e.onvProgress),this._msectl=new Rt(this._config),this._msectl.on(Wt.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(Wt.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(Wt.SOURCE_OPEN,()=>{this._mseSourceOpened=!0,this._hasPendingLoad&&(this._hasPendingLoad=!1,this.load())}),this._msectl.on(Wt.ERROR,m=>{this._emitter.emit(Ee.ERROR,ut.MEDIA_ERROR,st.MEDIA_MSE_ERROR,m)}),this._msectl.attachMediaElement(h),this._pendingSeekTime!=null)try{h.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(m){}}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 Z("HTMLMediaElement must be attached before load()!");if(this._transmuxer)throw new Z("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 ni(this._mediaDataSource,this._config),this._transmuxer.on(De.INIT_SEGMENT,(h,m)=>{this._msectl.appendInitSegment(m)}),this._transmuxer.on(De.MEDIA_SEGMENT,(h,m)=>{if(this._msectl.appendMediaSegment(m),this._config.lazyLoad&&!this._config.isLive){let y=this._mediaElement.currentTime;m.info.endDts>=(y+this._config.lazyLoadMaxDuration)*1e3&&this._progressChecker==null&&(p.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}}),this._transmuxer.on(De.LOADING_COMPLETE,()=>{this._msectl.endOfStream(),this._emitter.emit(Ee.LOADING_COMPLETE)}),this._transmuxer.on(De.RECOVERED_EARLY_EOF,()=>{this._emitter.emit(Ee.RECOVERED_EARLY_EOF)}),this._transmuxer.on(De.IO_ERROR,(h,m)=>{this._emitter.emit(Ee.ERROR,ut.NETWORK_ERROR,h,m)}),this._transmuxer.on(De.DEMUX_ERROR,(h,m)=>{this._emitter.emit(Ee.ERROR,ut.MEDIA_ERROR,h,{code:-1,msg:m})}),this._transmuxer.on(De.MEDIA_INFO,h=>{this._mediaInfo=h,this._emitter.emit(Ee.MEDIA_INFO,Object.assign({},h))}),this._transmuxer.on(De.METADATA_ARRIVED,h=>{this._emitter.emit(Ee.METADATA_ARRIVED,h)}),this._transmuxer.on(De.SCRIPTDATA_ARRIVED,h=>{this._emitter.emit(Ee.SCRIPTDATA_ARRIVED,h)}),this._transmuxer.on(De.STATISTICS_INFO,h=>{this._statisticsInfo=this._fillStatisticsInfo(h),this._emitter.emit(Ee.STATISTICS_INFO,Object.assign({},this._statisticsInfo))}),this._transmuxer.on(De.RECOMMEND_SEEKPOINT,h=>{this._mediaElement&&!this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h/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(h){this._mediaElement.volume=h}get muted(){return this._mediaElement.muted}set muted(h){this._mediaElement.muted=h}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(h){this._mediaElement?this._internalSeek(h):this._pendingSeekTime=h}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(h){if(h.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return h;let m=!0,y=0,C=0;if(this._mediaElement.getVideoPlaybackQuality){let H=this._mediaElement.getVideoPlaybackQuality();y=H.totalVideoFrames,C=H.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,C=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=C),h}_onmseUpdateEnd(){if(!this._config.lazyLoad||this._config.isLive)return;let h=this._mediaElement.buffered,m=this._mediaElement.currentTime,y=0,C=0;for(let H=0;H<h.length;H++){let me=h.start(H),fe=h.end(H);if(me<=m&&m<fe){y=me,C=fe;break}}C>=m+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&(p.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}_onmseBufferFull(){p.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 h=this._mediaElement.currentTime,m=this._mediaElement.buffered,y=!1;for(let C=0;C<m.length;C++){let H=m.start(C),me=m.end(C);if(h>=H&&h<me){h>=me-this._config.lazyLoadRecoverDuration&&(y=!0);break}}y&&(window.clearInterval(this._progressChecker),this._progressChecker=null,y&&(p.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))}_isTimepointBuffered(h){let m=this._mediaElement.buffered;for(let y=0;y<m.length;y++){let C=m.start(y),H=m.end(y);if(h>=C&&h<H)return!0}return!1}_internalSeek(h){let m=this._isTimepointBuffered(h),y=!1,C=0;if(h<1&&this._mediaElement.buffered.length>0){let H=this._mediaElement.buffered.start(0);(H<1&&h<H||V.safari)&&(y=!0,C=V.safari?.1:H)}if(y)this._requestSetTime=!0,this._mediaElement.currentTime=C;else if(m){if(!this._alwaysSeekKeyframe)this._requestSetTime=!0,this._mediaElement.currentTime=h;else{let H=this._msectl.getNearestKeyframe(Math.floor(h*1e3));this._requestSetTime=!0,H!=null?this._mediaElement.currentTime=H.dts/1e3:this._mediaElement.currentTime=h}this._progressChecker!=null&&this._checkProgressAndResume()}else this._progressChecker!=null&&(window.clearInterval(this._progressChecker),this._progressChecker=null),this._msectl.seek(h),this._transmuxer.seek(Math.floor(h*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h)}_checkAndApplyUnbufferedSeekpoint(){if(this._seekpointRecord)if(this._seekpointRecord.recordTime<=this._now()-100){let h=this._mediaElement.currentTime;this._seekpointRecord=null,this._isTimepointBuffered(h)||(this._progressChecker!=null&&(window.clearTimeout(this._progressChecker),this._progressChecker=null),this._msectl.seek(h),this._transmuxer.seek(Math.floor(h*1e3)),this._config.accurateSeek&&(this._requestSetTime=!0,this._mediaElement.currentTime=h))}else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}_checkAndResumeStuckPlayback(h){let m=this._mediaElement;if(h||!this._receivedCanPlay||m.readyState<2){let y=m.buffered;y.length>0&&m.currentTime<y.start(0)&&(p.w(this.TAG,`Playback seems stuck at ${m.currentTime}, seek to ${y.start(0)}`),this._requestSetTime=!0,this._mediaElement.currentTime=y.start(0),this._mediaElement.removeEventListener("progress",this.e.onvProgress))}else this._mediaElement.removeEventListener("progress",this.e.onvProgress)}_onvLoadedMetadata(h){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null)}_onvSeeking(h){let m=this._mediaElement.currentTime,y=this._mediaElement.buffered;if(this._requestSetTime){this._requestSetTime=!1;return}if(m<1&&y.length>0){let C=y.start(0);if(C<1&&m<C||V.safari){this._requestSetTime=!0,this._mediaElement.currentTime=V.safari?.1:C;return}}if(this._isTimepointBuffered(m)){if(this._alwaysSeekKeyframe){let C=this._msectl.getNearestKeyframe(Math.floor(m*1e3));C!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=C.dts/1e3)}this._progressChecker!=null&&this._checkProgressAndResume();return}this._seekpointRecord={seekPoint:m,recordTime:this._now()},window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this),50)}_onvCanPlay(h){this._receivedCanPlay=!0,this._mediaElement.removeEventListener("canplay",this.e.onvCanPlay)}_onvStalled(h){this._checkAndResumeStuckPlayback(!0)}_onvProgress(h){this._checkAndResumeStuckPlayback()}}var Ht=Nt;class wt{constructor(h,m){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(ue()),this._config=S(),typeof m=="object"&&Object.assign(this._config,m),h.type.toLowerCase()==="flv")throw new k("NativePlayer does't support flv MediaDataSource input!");if(h.hasOwnProperty("segments"))throw new k(`NativePlayer(${h.type}) doesn't support multipart playback!`);this.e={onvLoadedMetadata:this._onvLoadedMetadata.bind(this)},this._pendingSeekTime=null,this._statisticsReporter=null,this._mediaDataSource=h,this._mediaElement=null}destroy(){this._mediaElement&&(this.unload(),this.detachMediaElement()),this.e=null,this._mediaDataSource=null,this._emitter.removeAllListeners(),this._emitter=null}on(h,m){h===Ee.MEDIA_INFO?this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(Ee.MEDIA_INFO,this.mediaInfo)}):h===Ee.STATISTICS_INFO&&this._mediaElement!=null&&this._mediaElement.readyState!==0&&Promise.resolve().then(()=>{this._emitter.emit(Ee.STATISTICS_INFO,this.statisticsInfo)}),this._emitter.addListener(h,m)}off(h,m){this._emitter.removeListener(h,m)}attachMediaElement(h){if(this._mediaElement=h,h.addEventListener("loadedmetadata",this.e.onvLoadedMetadata),this._pendingSeekTime!=null)try{h.currentTime=this._pendingSeekTime,this._pendingSeekTime=null}catch(m){}}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 Z("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(h){this._mediaElement.volume=h}get muted(){return this._mediaElement.muted}set muted(h){this._mediaElement.muted=h}get currentTime(){return this._mediaElement?this._mediaElement.currentTime:0}set currentTime(h){this._mediaElement?this._mediaElement.currentTime=h:this._pendingSeekTime=h}get mediaInfo(){let m={mimeType:(this._mediaElement instanceof HTMLAudioElement?"audio/":"video/")+this._mediaDataSource.type};return this._mediaElement&&(m.duration=Math.floor(this._mediaElement.duration*1e3),this._mediaElement instanceof HTMLVideoElement&&(m.width=this._mediaElement.videoWidth,m.height=this._mediaElement.videoHeight)),m}get statisticsInfo(){let h={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return h;let m=!0,y=0,C=0;if(this._mediaElement.getVideoPlaybackQuality){let H=this._mediaElement.getVideoPlaybackQuality();y=H.totalVideoFrames,C=H.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,C=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=C),h}_onvLoadedMetadata(h){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(Ee.MEDIA_INFO,this.mediaInfo)}_reportStatisticsInfo(){this._emitter.emit(Ee.STATISTICS_INFO,this.statisticsInfo)}}var gt=wt;pe.install();function St(We,h){let m=We;if(m==null||typeof m!="object")throw new k("MediaDataSource must be an javascript object!");if(!m.hasOwnProperty("type"))throw new k("MediaDataSource must has type field to indicate video file type!");switch(m.type){case"flv":return new Ht(m,h);default:return new gt(m,h)}}function Ei(){return K.supportMSEH264Playback()}function zt(){return K.getFeatureList()}let si={};si.createPlayer=St,si.isSupported=Ei,si.getFeatureList=zt,si.BaseLoader=A,si.LoaderStatus=v,si.LoaderErrors=E,si.Events=Ee,si.ErrorTypes=ut,si.ErrorDetails=st,si.FlvPlayer=Ht,si.NativePlayer=gt,si.LoggingControl=Qe,Object.defineProperty(si,"version",{enumerable:!0,get:function(){return"__VERSION__"}});var It=si},25769:function(Zt,nt,U){"use strict";var F=U(98040),pe={"text/plain":"Text","text/html":"Url",default:"Text"},Se="Copy to clipboard: #{key}, Enter";function ue(p){var ve=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,ve)}function G(p,ve){var oe,l,Z,k,g,v,E=!1;ve||(ve={}),oe=ve.debug||!1;try{Z=F(),k=document.createRange(),g=document.getSelection(),v=document.createElement("span"),v.textContent=p,v.ariaHidden="true",v.style.all="unset",v.style.position="fixed",v.style.top=0,v.style.clip="rect(0, 0, 0, 0)",v.style.whiteSpace="pre",v.style.webkitUserSelect="text",v.style.MozUserSelect="text",v.style.msUserSelect="text",v.style.userSelect="text",v.addEventListener("copy",function(M){if(M.stopPropagation(),ve.format)if(M.preventDefault(),typeof M.clipboardData=="undefined"){oe&&console.warn("unable to use e.clipboardData"),oe&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var j=pe[ve.format]||pe.default;window.clipboardData.setData(j,p)}else M.clipboardData.clearData(),M.clipboardData.setData(ve.format,p);ve.onCopy&&(M.preventDefault(),ve.onCopy(M.clipboardData))}),document.body.appendChild(v),k.selectNodeContents(v),g.addRange(k);var A=document.execCommand("copy");if(!A)throw new Error("copy command was unsuccessful");E=!0}catch(M){oe&&console.error("unable to copy using execCommand: ",M),oe&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ve.format||"text",p),ve.onCopy&&ve.onCopy(window.clipboardData),E=!0}catch(j){oe&&console.error("unable to copy using clipboardData: ",j),oe&&console.error("falling back to prompt"),l=ue("message"in ve?ve.message:Se),window.prompt(l,p)}}finally{g&&(typeof g.removeRange=="function"?g.removeRange(k):g.removeAllRanges()),v&&document.body.removeChild(v),Z()}return E}Zt.exports=G},3867:function(Zt,nt,U){var F=U(97671);(function(pe,Se){Zt.exports=Se()})(this,function(){"use strict";function pe(z){var re=typeof z;return z!==null&&(re==="object"||re==="function")}function Se(z){return typeof z=="function"}var ue=void 0;Array.isArray?ue=Array.isArray:ue=function(z){return Object.prototype.toString.call(z)==="[object Array]"};var G=ue,p=0,ve=void 0,oe=void 0,l=function(re,X){R[p]=re,R[p+1]=X,p+=2,p===2&&(oe?oe(Y):ne())};function Z(z){oe=z}function k(z){l=z}var g=typeof window!="undefined"?window:void 0,v=g||{},E=v.MutationObserver||v.WebKitMutationObserver,A=typeof self=="undefined"&&typeof F!="undefined"&&{}.toString.call(F)==="[object process]",M=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function j(){return function(){return F.nextTick(Y)}}function V(){return typeof ve!="undefined"?function(){ve(Y)}:w()}function L(){var z=0,re=new E(Y),X=document.createTextNode("");return re.observe(X,{characterData:!0}),function(){X.data=z=++z%2}}function I(){var z=new MessageChannel;return z.port1.onmessage=Y,function(){return z.port2.postMessage(0)}}function w(){var z=setTimeout;return function(){return z(Y,1)}}var R=new Array(1e3);function Y(){for(var z=0;z<p;z+=2){var re=R[z],X=R[z+1];re(X),R[z]=void 0,R[z+1]=void 0}p=0}function se(){try{var z=Function("return this")().require("vertx");return ve=z.runOnLoop||z.runOnContext,V()}catch(re){return w()}}var ne=void 0;A?ne=j():E?ne=L():M?ne=I():g===void 0?ne=se():ne=w();function ye(z,re){var X=this,$=new this.constructor($e);$[xe]===void 0&&mt($);var Q=X._state;if(Q){var ce=arguments[Q-1];l(function(){return ti(Q,$,ce,X._result)})}else bt(X,$,z,re);return $}function Ie(z){var re=this;if(z&&typeof z=="object"&&z.constructor===re)return z;var X=new re($e);return le(X,z),X}var xe=Math.random().toString(36).substring(2);function $e(){}var J=void 0,D=1,N=2;function O(){return new TypeError("You cannot resolve a promise with itself")}function ae(){return new TypeError("A promises callback cannot return that same promise.")}function te(z,re,X,$){try{z.call(re,X,$)}catch(Q){return Q}}function S(z,re,X){l(function($){var Q=!1,ce=te(X,re,function(he){Q||(Q=!0,re!==he?le($,he):Ne($,he))},function(he){Q||(Q=!0,Qe($,he))},"Settle: "+($._label||" unknown promise"));!Q&&ce&&(Q=!0,Qe($,ce))},z)}function b(z,re){re._state===D?Ne(z,re._result):re._state===N?Qe(z,re._result):bt(re,void 0,function(X){return le(z,X)},function(X){return Qe(z,X)})}function K(z,re,X){re.constructor===z.constructor&&X===ye&&re.constructor.resolve===Ie?b(z,re):X===void 0?Ne(z,re):Se(X)?S(z,re,X):Ne(z,re)}function le(z,re){if(z===re)Qe(z,O());else if(pe(re)){var X=void 0;try{X=re.then}catch($){Qe(z,$);return}K(z,re,X)}else Ne(z,re)}function Ee(z){z._onerror&&z._onerror(z._result),Lt(z)}function Ne(z,re){z._state===J&&(z._result=re,z._state=D,z._subscribers.length!==0&&l(Lt,z))}function Qe(z,re){z._state===J&&(z._state=N,z._result=re,l(Ee,z))}function bt(z,re,X,$){var Q=z._subscribers,ce=Q.length;z._onerror=null,Q[ce]=re,Q[ce+D]=X,Q[ce+N]=$,ce===0&&z._state&&l(Lt,z)}function Lt(z){var re=z._subscribers,X=z._state;if(re.length!==0){for(var $=void 0,Q=void 0,ce=z._result,he=0;he<re.length;he+=3)$=re[he],Q=re[he+X],$?ti(X,$,Q,ce):Q(ce);z._subscribers.length=0}}function ti(z,re,X,$){var Q=Se(X),ce=void 0,he=void 0,we=!0;if(Q){try{ce=X($)}catch(Ke){we=!1,he=Ke}if(re===ce){Qe(re,ae());return}}else ce=$;re._state!==J||(Q&&we?le(re,ce):we===!1?Qe(re,he):z===D?Ne(re,ce):z===N&&Qe(re,ce))}function ze(z,re){try{re(function($){le(z,$)},function($){Qe(z,$)})}catch(X){Qe(z,X)}}var Ct=0;function Ze(){return Ct++}function mt(z){z[xe]=Ct++,z._state=void 0,z._result=void 0,z._subscribers=[]}function Ye(){return new Error("Array Methods must be provided an Array")}var ke=function(){function z(re,X){this._instanceConstructor=re,this.promise=new re($e),this.promise[xe]||mt(this.promise),G(X)?(this.length=X.length,this._remaining=X.length,this._result=new Array(this.length),this.length===0?Ne(this.promise,this._result):(this.length=this.length||0,this._enumerate(X),this._remaining===0&&Ne(this.promise,this._result))):Qe(this.promise,Ye())}return z.prototype._enumerate=function(X){for(var $=0;this._state===J&&$<X.length;$++)this._eachEntry(X[$],$)},z.prototype._eachEntry=function(X,$){var Q=this._instanceConstructor,ce=Q.resolve;if(ce===Ie){var he=void 0,we=void 0,Ke=!1;try{he=X.then}catch(Je){Ke=!0,we=Je}if(he===ye&&X._state!==J)this._settledAt(X._state,$,X._result);else if(typeof he!="function")this._remaining--,this._result[$]=X;else if(Q===q){var Ve=new Q($e);Ke?Qe(Ve,we):K(Ve,X,he),this._willSettleAt(Ve,$)}else this._willSettleAt(new Q(function(Je){return Je(X)}),$)}else this._willSettleAt(ce(X),$)},z.prototype._settledAt=function(X,$,Q){var ce=this.promise;ce._state===J&&(this._remaining--,X===N?Qe(ce,Q):this._result[$]=Q),this._remaining===0&&Ne(ce,this._result)},z.prototype._willSettleAt=function(X,$){var Q=this;bt(X,void 0,function(ce){return Q._settledAt(D,$,ce)},function(ce){return Q._settledAt(N,$,ce)})},z}();function ge(z){return new ke(this,z).promise}function Ae(z){var re=this;return G(z)?new re(function(X,$){for(var Q=z.length,ce=0;ce<Q;ce++)re.resolve(z[ce]).then(X,$)}):new re(function(X,$){return $(new TypeError("You must pass an array to race."))})}function ee(z){var re=this,X=new re($e);return Qe(X,z),X}function Re(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function Te(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var q=function(){function z(re){this[xe]=Ze(),this._result=this._state=void 0,this._subscribers=[],$e!==re&&(typeof re!="function"&&Re(),this instanceof z?ze(this,re):Te())}return z.prototype.catch=function(X){return this.then(null,X)},z.prototype.finally=function(X){var $=this,Q=$.constructor;return Se(X)?$.then(function(ce){return Q.resolve(X()).then(function(){return ce})},function(ce){return Q.resolve(X()).then(function(){throw ce})}):$.then(X,X)},z}();q.prototype.then=ye,q.all=ge,q.race=Ae,q.resolve=Ie,q.reject=ee,q._setScheduler=Z,q._setAsap=k,q._asap=l;function W(){var z=void 0;if(typeof U.g!="undefined")z=U.g;else if(typeof self!="undefined")z=self;else try{z=Function("return this")()}catch($){throw new Error("polyfill failed because global object is unavailable in this environment")}var re=z.Promise;if(re){var X=null;try{X=Object.prototype.toString.call(re.resolve())}catch($){}if(X==="[object Promise]"&&!re.cast)return}z.Promise=q}return q.polyfill=W,q.Promise=q,q})},86204:function(Zt){"use strict";var nt=typeof Reflect=="object"?Reflect:null,U=nt&&typeof nt.apply=="function"?nt.apply:function(I,w,R){return Function.prototype.apply.call(I,w,R)},F;nt&&typeof nt.ownKeys=="function"?F=nt.ownKeys:Object.getOwnPropertySymbols?F=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:F=function(I){return Object.getOwnPropertyNames(I)};function pe(L){console&&console.warn&&console.warn(L)}var Se=Number.isNaN||function(I){return I!==I};function ue(){ue.init.call(this)}Zt.exports=ue,Zt.exports.once=M,ue.EventEmitter=ue,ue.prototype._events=void 0,ue.prototype._eventsCount=0,ue.prototype._maxListeners=void 0;var G=10;function p(L){if(typeof L!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof L)}Object.defineProperty(ue,"defaultMaxListeners",{enumerable:!0,get:function(){return G},set:function(L){if(typeof L!="number"||L<0||Se(L))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+L+".");G=L}}),ue.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},ue.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||Se(I))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+I+".");return this._maxListeners=I,this};function ve(L){return L._maxListeners===void 0?ue.defaultMaxListeners:L._maxListeners}ue.prototype.getMaxListeners=function(){return ve(this)},ue.prototype.emit=function(I){for(var w=[],R=1;R<arguments.length;R++)w.push(arguments[R]);var Y=I==="error",se=this._events;if(se!==void 0)Y=Y&&se.error===void 0;else if(!Y)return!1;if(Y){var ne;if(w.length>0&&(ne=w[0]),ne instanceof Error)throw ne;var ye=new Error("Unhandled error."+(ne?" ("+ne.message+")":""));throw ye.context=ne,ye}var Ie=se[I];if(Ie===void 0)return!1;if(typeof Ie=="function")U(Ie,this,w);else for(var xe=Ie.length,$e=v(Ie,xe),R=0;R<xe;++R)U($e[R],this,w);return!0};function oe(L,I,w,R){var Y,se,ne;if(p(w),se=L._events,se===void 0?(se=L._events=Object.create(null),L._eventsCount=0):(se.newListener!==void 0&&(L.emit("newListener",I,w.listener?w.listener:w),se=L._events),ne=se[I]),ne===void 0)ne=se[I]=w,++L._eventsCount;else if(typeof ne=="function"?ne=se[I]=R?[w,ne]:[ne,w]:R?ne.unshift(w):ne.push(w),Y=ve(L),Y>0&&ne.length>Y&&!ne.warned){ne.warned=!0;var ye=new Error("Possible EventEmitter memory leak detected. "+ne.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");ye.name="MaxListenersExceededWarning",ye.emitter=L,ye.type=I,ye.count=ne.length,pe(ye)}return L}ue.prototype.addListener=function(I,w){return oe(this,I,w,!1)},ue.prototype.on=ue.prototype.addListener,ue.prototype.prependListener=function(I,w){return oe(this,I,w,!0)};function l(){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 Z(L,I,w){var R={fired:!1,wrapFn:void 0,target:L,type:I,listener:w},Y=l.bind(R);return Y.listener=w,R.wrapFn=Y,Y}ue.prototype.once=function(I,w){return p(w),this.on(I,Z(this,I,w)),this},ue.prototype.prependOnceListener=function(I,w){return p(w),this.prependListener(I,Z(this,I,w)),this},ue.prototype.removeListener=function(I,w){var R,Y,se,ne,ye;if(p(w),Y=this._events,Y===void 0)return this;if(R=Y[I],R===void 0)return this;if(R===w||R.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete Y[I],Y.removeListener&&this.emit("removeListener",I,R.listener||w));else if(typeof R!="function"){for(se=-1,ne=R.length-1;ne>=0;ne--)if(R[ne]===w||R[ne].listener===w){ye=R[ne].listener,se=ne;break}if(se<0)return this;se===0?R.shift():E(R,se),R.length===1&&(Y[I]=R[0]),Y.removeListener!==void 0&&this.emit("removeListener",I,ye||w)}return this},ue.prototype.off=ue.prototype.removeListener,ue.prototype.removeAllListeners=function(I){var w,R,Y;if(R=this._events,R===void 0)return this;if(R.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):R[I]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete R[I]),this;if(arguments.length===0){var se=Object.keys(R),ne;for(Y=0;Y<se.length;++Y)ne=se[Y],ne!=="removeListener"&&this.removeAllListeners(ne);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(w=R[I],typeof w=="function")this.removeListener(I,w);else if(w!==void 0)for(Y=w.length-1;Y>=0;Y--)this.removeListener(I,w[Y]);return this};function k(L,I,w){var R=L._events;if(R===void 0)return[];var Y=R[I];return Y===void 0?[]:typeof Y=="function"?w?[Y.listener||Y]:[Y]:w?A(Y):v(Y,Y.length)}ue.prototype.listeners=function(I){return k(this,I,!0)},ue.prototype.rawListeners=function(I){return k(this,I,!1)},ue.listenerCount=function(L,I){return typeof L.listenerCount=="function"?L.listenerCount(I):g.call(L,I)},ue.prototype.listenerCount=g;function g(L){var I=this._events;if(I!==void 0){var w=I[L];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}ue.prototype.eventNames=function(){return this._eventsCount>0?F(this._events):[]};function v(L,I){for(var w=new Array(I),R=0;R<I;++R)w[R]=L[R];return w}function E(L,I){for(;I+1<L.length;I++)L[I]=L[I+1];L.pop()}function A(L){for(var I=new Array(L.length),w=0;w<I.length;++w)I[w]=L[w].listener||L[w];return I}function M(L,I){return new Promise(function(w,R){function Y(ne){L.removeListener(I,se),R(ne)}function se(){typeof L.removeListener=="function"&&L.removeListener("error",Y),w([].slice.call(arguments))}V(L,I,se,{once:!0}),I!=="error"&&j(L,Y,{once:!0})})}function j(L,I,w){typeof L.on=="function"&&V(L,"error",I,w)}function V(L,I,w,R){if(typeof L.on=="function")R.once?L.once(I,w):L.on(I,w);else if(typeof L.addEventListener=="function")L.addEventListener(I,function Y(se){R.once&&L.removeEventListener(I,Y),w(se)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof L)}},24334:function(Zt,nt,U){var F,pe;(function(Se,ue){Zt.exports=ue(Se)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof U.g!="undefined"?U.g:this,function(Se){"use strict";Se=Se||{};var ue=Se.Base64,G="2.6.4",p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ve=function(D){for(var N={},O=0,ae=D.length;O<ae;O++)N[D.charAt(O)]=O;return N}(p),oe=String.fromCharCode,l=function(D){if(D.length<2){var N=D.charCodeAt(0);return N<128?D:N<2048?oe(192|N>>>6)+oe(128|N&63):oe(224|N>>>12&15)+oe(128|N>>>6&63)+oe(128|N&63)}else{var N=65536+(D.charCodeAt(0)-55296)*1024+(D.charCodeAt(1)-56320);return oe(240|N>>>18&7)+oe(128|N>>>12&63)+oe(128|N>>>6&63)+oe(128|N&63)}},Z=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,k=function(D){return D.replace(Z,l)},g=function(D){var N=[0,2,1][D.length%3],O=D.charCodeAt(0)<<16|(D.length>1?D.charCodeAt(1):0)<<8|(D.length>2?D.charCodeAt(2):0),ae=[p.charAt(O>>>18),p.charAt(O>>>12&63),N>=2?"=":p.charAt(O>>>6&63),N>=1?"=":p.charAt(O&63)];return ae.join("")},v=Se.btoa&&typeof Se.btoa=="function"?function(D){return Se.btoa(D)}:function(D){if(D.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return D.replace(/[\s\S]{1,3}/g,g)},E=function(D){return v(k(String(D)))},A=function(D){return D.replace(/[+\/]/g,function(N){return N=="+"?"-":"_"}).replace(/=/g,"")},M=function(D,N){return N?A(E(D)):E(D)},j=function(D){return M(D,!0)},V;Se.Uint8Array&&(V=function(D,N){for(var O="",ae=0,te=D.length;ae<te;ae+=3){var S=D[ae],b=D[ae+1],K=D[ae+2],le=S<<16|b<<8|K;O+=p.charAt(le>>>18)+p.charAt(le>>>12&63)+(typeof b!="undefined"?p.charAt(le>>>6&63):"=")+(typeof K!="undefined"?p.charAt(le&63):"=")}return N?A(O):O});var L=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,I=function(D){switch(D.length){case 4:var N=(7&D.charCodeAt(0))<<18|(63&D.charCodeAt(1))<<12|(63&D.charCodeAt(2))<<6|63&D.charCodeAt(3),O=N-65536;return oe((O>>>10)+55296)+oe((O&1023)+56320);case 3:return oe((15&D.charCodeAt(0))<<12|(63&D.charCodeAt(1))<<6|63&D.charCodeAt(2));default:return oe((31&D.charCodeAt(0))<<6|63&D.charCodeAt(1))}},w=function(D){return D.replace(L,I)},R=function(D){var N=D.length,O=N%4,ae=(N>0?ve[D.charAt(0)]<<18:0)|(N>1?ve[D.charAt(1)]<<12:0)|(N>2?ve[D.charAt(2)]<<6:0)|(N>3?ve[D.charAt(3)]:0),te=[oe(ae>>>16),oe(ae>>>8&255),oe(ae&255)];return te.length-=[0,0,2,1][O],te.join("")},Y=Se.atob&&typeof Se.atob=="function"?function(D){return Se.atob(D)}:function(D){return D.replace(/\S{1,4}/g,R)},se=function(D){return Y(String(D).replace(/[^A-Za-z0-9\+\/]/g,""))},ne=function(D){return w(Y(D))},ye=function(D){return String(D).replace(/[-_]/g,function(N){return N=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},Ie=function(D){return ne(ye(D))},xe;Se.Uint8Array&&(xe=function(D){return Uint8Array.from(se(ye(D)),function(N){return N.charCodeAt(0)})});var $e=function(){var D=Se.Base64;return Se.Base64=ue,D};if(Se.Base64={VERSION:G,atob:se,btoa:v,fromBase64:Ie,toBase64:M,utob:k,encode:M,encodeURI:j,btou:w,decode:Ie,noConflict:$e,fromUint8Array:V,toUint8Array:xe},typeof Object.defineProperty=="function"){var J=function(D){return{value:D,enumerable:!1,writable:!0,configurable:!0}};Se.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",J(function(){return Ie(this)})),Object.defineProperty(String.prototype,"toBase64",J(function(D){return M(this,D)})),Object.defineProperty(String.prototype,"toBase64URI",J(function(){return M(this,!0)}))}}return Se.Meteor&&(Base64=Se.Base64),Zt.exports?Zt.exports.Base64=Se.Base64:(F=[],pe=function(){return Se.Base64}.apply(nt,F),pe!==void 0&&(Zt.exports=pe)),{Base64:Se.Base64}})},53184:function(Zt,nt,U){"use strict";var F,pe;function Se(ue,G,p){var ve=function(oe,l){return ue.js_beautify(oe,l)};return ve.js=ue.js_beautify,ve.css=G.css_beautify,ve.html=p.html_beautify,ve.js_beautify=ue.js_beautify,ve.css_beautify=G.css_beautify,ve.html_beautify=p.html_beautify,ve}F=[U(58553),U(87804),U(40998)],pe=function(ue,G,p){return Se(ue,G,p)}.apply(nt,F),pe!==void 0&&(Zt.exports=pe)},87804:function(Zt,nt){var U,F;(function(){var pe;(function(){"use strict";var ue=[,,function(oe){function l(g){this.__parent=g,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var v=this.__items.length-1;v>=0;v--)if(this.__items[v].match(g))return!0;return!1},l.prototype.set_indent=function(g,v){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=v||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},l.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(g){this.__items.push(g);var v=g.lastIndexOf(`
`);v!==-1?this.__character_count=g.length-v:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function Z(g,v){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),v=v||"",g.indent_level>0&&(v=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=v,this.__base_string_length=v.length}Z.prototype.get_indent_size=function(g,v){var E=this.__base_string_length;return v=v||0,g<0&&(E=0),E+=g*this.__indent_size,E+=v,E},Z.prototype.get_indent_string=function(g,v){var E=this.__base_string;return v=v||0,g<0&&(g=0,E=""),v+=g*this.__indent_size,this.__ensure_cache(v),E+=this.__cache[v],E},Z.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},Z.prototype.__add_column=function(){var g=this.__cache.length,v=0,E="";this.__indent_size&&g>=this.__indent_size&&(v=Math.floor(g/this.__indent_size),g-=v*this.__indent_size,E=new Array(v+1).join(this.__indent_string)),g&&(E+=new Array(g+1).join(" ")),this.__cache.push(E)};function k(g,v){this.__indent_cache=new Z(g,v),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}k.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},k.prototype.get_line_number=function(){return this.__lines.length},k.prototype.get_indent_string=function(g,v){return this.__indent_cache.get_indent_string(g,v)},k.prototype.get_indent_size=function(g,v){return this.__indent_cache.get_indent_size(g,v)},k.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},k.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},k.prototype.get_code=function(g){this.trim(!0);var v=this.current_line.pop();v&&(v[v.length-1]===`
`&&(v=v.replace(/\n+$/g,"")),this.current_line.push(v)),this._end_with_newline&&this.__add_outputline();var E=this.__lines.join(`
`);return g!==`
`&&(E=E.replace(/[\n]/g,g)),E},k.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},k.prototype.set_indent=function(g,v){return g=g||0,v=v||0,this.next_line.set_indent(g,v),this.__lines.length>1?(this.current_line.set_indent(g,v),!0):(this.current_line.set_indent(),!1)},k.prototype.add_raw_token=function(g){for(var v=0;v<g.newlines;v++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},k.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},k.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},k.prototype.remove_indent=function(g){for(var v=this.__lines.length;g<v;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},k.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},k.prototype.just_added_newline=function(){return this.current_line.is_empty()},k.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},k.prototype.ensure_empty_line_above=function(g,v){for(var E=this.__lines.length-2;E>=0;){var A=this.__lines[E];if(A.is_empty())break;if(A.item(0).indexOf(g)!==0&&A.item(-1)!==v){this.__lines.splice(E+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}E--}},oe.exports.Output=k},,,,function(oe){function l(g,v){this.raw_options=Z(g,v),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(g,v){var E=this.raw_options[g],A=v||[];return typeof E=="object"?E!==null&&typeof E.concat=="function"&&(A=E.concat()):typeof E=="string"&&(A=E.split(/[^a-zA-Z0-9_\/\-]+/)),A},l.prototype._get_boolean=function(g,v){var E=this.raw_options[g],A=E===void 0?!!v:!!E;return A},l.prototype._get_characters=function(g,v){var E=this.raw_options[g],A=v||"";return typeof E=="string"&&(A=E.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),A},l.prototype._get_number=function(g,v){var E=this.raw_options[g];v=parseInt(v,10),isNaN(v)&&(v=0);var A=parseInt(E,10);return isNaN(A)&&(A=v),A},l.prototype._get_selection=function(g,v,E){var A=this._get_selection_list(g,v,E);if(A.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+v+`
You passed in: '`+this.raw_options[g]+"'");return A[0]},l.prototype._get_selection_list=function(g,v,E){if(!v||v.length===0)throw new Error("Selection list cannot be empty.");if(E=E||[v[0]],!this._is_valid_selection(E,v))throw new Error("Invalid Default Value!");var A=this._get_array(g,E);if(!this._is_valid_selection(A,v))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+v+`
You passed in: '`+this.raw_options[g]+"'");return A},l.prototype._is_valid_selection=function(g,v){return g.length&&v.length&&!g.some(function(E){return v.indexOf(E)===-1})};function Z(g,v){var E={};g=k(g);var A;for(A in g)A!==v&&(E[A]=g[A]);if(v&&g[v])for(A in g[v])E[A]=g[v][A];return E}function k(g){var v={},E;for(E in g){var A=E.replace(/-/g,"_");v[A]=g[E]}return v}oe.exports.Options=l,oe.exports.normalizeOpts=k,oe.exports.mergeOpts=Z},,function(oe){var l=RegExp.prototype.hasOwnProperty("sticky");function Z(k){this.__input=k||"",this.__input_length=this.__input.length,this.__position=0}Z.prototype.restart=function(){this.__position=0},Z.prototype.back=function(){this.__position>0&&(this.__position-=1)},Z.prototype.hasNext=function(){return this.__position<this.__input_length},Z.prototype.next=function(){var k=null;return this.hasNext()&&(k=this.__input.charAt(this.__position),this.__position+=1),k},Z.prototype.peek=function(k){var g=null;return k=k||0,k+=this.__position,k>=0&&k<this.__input_length&&(g=this.__input.charAt(k)),g},Z.prototype.__match=function(k,g){k.lastIndex=g;var v=k.exec(this.__input);return v&&!(l&&k.sticky)&&v.index!==g&&(v=null),v},Z.prototype.test=function(k,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(k,g):!1},Z.prototype.testChar=function(k,g){var v=this.peek(g);return k.lastIndex=0,v!==null&&k.test(v)},Z.prototype.match=function(k){var g=this.__match(k,this.__position);return g?this.__position+=g[0].length:g=null,g},Z.prototype.read=function(k,g,v){var E="",A;return k&&(A=this.match(k),A&&(E+=A[0])),g&&(A||!k)&&(E+=this.readUntil(g,v)),E},Z.prototype.readUntil=function(k,g){var v="",E=this.__position;k.lastIndex=this.__position;var A=k.exec(this.__input);return A?(E=A.index,g&&(E+=A[0].length)):E=this.__input_length,v=this.__input.substring(this.__position,E),this.__position=E,v},Z.prototype.readUntilAfter=function(k){return this.readUntil(k,!0)},Z.prototype.get_regexp=function(k,g){var v=null,E="g";return g&&l&&(E="y"),typeof k=="string"&&k!==""?v=new RegExp(k,E):k&&(v=new RegExp(k.source,E)),v},Z.prototype.get_literal_regexp=function(k){return RegExp(k.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},Z.prototype.peekUntilAfter=function(k){var g=this.__position,v=this.readUntilAfter(k);return this.__position=g,v},Z.prototype.lookBack=function(k){var g=this.__position-1;return g>=k.length&&this.__input.substring(g-k.length,g).toLowerCase()===k},oe.exports.InputScanner=Z},,,,,function(oe){function l(Z,k){Z=typeof Z=="string"?Z:Z.source,k=typeof k=="string"?k:k.source,this.__directives_block_pattern=new RegExp(Z+/ beautify( \w+[:]\w+)+ /.source+k,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(Z+/\sbeautify\signore:end\s/.source+k,"g")}l.prototype.get_directives=function(Z){if(!Z.match(this.__directives_block_pattern))return null;var k={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(Z);g;)k[g[1]]=g[2],g=this.__directive_pattern.exec(Z);return k},l.prototype.readIgnored=function(Z){return Z.readUntilAfter(this.__directives_end_ignore_pattern)},oe.exports.Directives=l},,function(oe,l,Z){var k=Z(16).Beautifier,g=Z(17).Options;function v(E,A){var M=new k(E,A);return M.beautify()}oe.exports=v,oe.exports.defaultOptions=function(){return new g}},function(oe,l,Z){var k=Z(17).Options,g=Z(2).Output,v=Z(8).InputScanner,E=Z(13).Directives,A=new E(/\/\*/,/\*\//),M=/\r\n|[\r\n]/,j=/\r\n|[\r\n]/g,V=/\s/,L=/(?:\s|\n)+/g,I=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,w=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function R(Y,se){this._source_text=Y||"",this._options=new k(se),this._ch=null,this._input=null,this.NESTED_AT_RULE={page:!0,"font-face":!0,keyframes:!0,media:!0,supports:!0,document:!0},this.CONDITIONAL_GROUP_RULE={media:!0,supports:!0,document:!0},this.NON_SEMICOLON_NEWLINE_PROPERTY=["grid-template-areas","grid-template"]}R.prototype.eatString=function(Y){var se="";for(this._ch=this._input.next();this._ch;){if(se+=this._ch,this._ch==="\\")se+=this._input.next();else if(Y.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return se},R.prototype.eatWhitespace=function(Y){for(var se=V.test(this._input.peek()),ne=0;V.test(this._input.peek());)this._ch=this._input.next(),Y&&this._ch===`
`&&(ne===0||ne<this._options.max_preserve_newlines)&&(ne++,this._output.add_new_line(!0));return se},R.prototype.foundNestedPseudoClass=function(){for(var Y=0,se=1,ne=this._input.peek(se);ne;){if(ne==="{")return!0;if(ne==="(")Y+=1;else if(ne===")"){if(Y===0)return!1;Y-=1}else if(ne===";"||ne==="}")return!1;se++,ne=this._input.peek(se)}return!1},R.prototype.print_string=function(Y){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(Y)},R.prototype.preserveSingleSpace=function(Y){Y&&(this._output.space_before_token=!0)},R.prototype.indent=function(){this._indentLevel++},R.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},R.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var Y=this._source_text,se=this._options.eol;se==="auto"&&(se=`
`,Y&&M.test(Y||"")&&(se=Y.match(M)[0])),Y=Y.replace(j,`
`);var ne=Y.match(/^[\t ]*/)[0];this._output=new g(this._options,ne),this._input=new v(Y),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ye=0,Ie=!1,xe=!1,$e=!1,J=!1,D=!1,N=this._ch,O=!1,ae,te,S;ae=this._input.read(L),te=ae!=="",S=N,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),N=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var b=this._input.read(I),K=A.get_directives(b);K&&K.ignore==="start"&&(b+=A.readIgnored(this._input)),this.print_string(b),this.eatWhitespace(!0),this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/")this._output.space_before_token=!0,this._input.back(),this.print_string(this._input.read(w)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(te),this.print_string(this._ch);var le=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);le.match(/[ :]$/)&&(le=this.eatString(": ").replace(/\s+$/,""),this.print_string(le),this._output.space_before_token=!0),ye===0&&le.indexOf(":")!==-1&&(xe=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(te),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var Ee=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Ee.match(/[ :]$/)&&(Ee=this.eatString(": ").replace(/\s+$/,""),this.print_string(Ee),this._output.space_before_token=!0),ye===0&&Ee.indexOf(":")!==-1?(xe=!0,this.indent()):Ee in this.NESTED_AT_RULE?(this._nestedLevel+=1,Ee in this.CONDITIONAL_GROUP_RULE&&($e=!0)):ye===0&&!xe&&(J=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(te),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")xe&&(xe=!1,this.outdent()),J=!1,$e?($e=!1,Ie=this._indentLevel>=this._nestedLevel):Ie=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&Ie&&this._output.previous_line&&this._output.previous_line.item(-1)!=="{"&&this._output.ensure_empty_line_above("/",","),this._output.space_before_token=!0,this._options.brace_style==="expand"?(this._output.add_new_line(),this.print_string(this._ch),this.indent(),this._output.set_indent(this._indentLevel)):(S==="("?this._output.space_before_token=!1:S!==","&&this.indent(),this.print_string(this._ch)),this.eatWhitespace(!0),this._output.add_new_line();else if(this._ch==="}")this.outdent(),this._output.add_new_line(),S==="{"&&this._output.trim(!0),xe&&(this.outdent(),xe=!1),this.print_string(this._ch),Ie=!1,this._nestedLevel&&this._nestedLevel--,this.eatWhitespace(!0),this._output.add_new_line(),this._options.newline_between_rules&&!this._output.just_added_blankline()&&this._input.peek()!=="}"&&this._output.add_new_line(!0),this._input.peek()===")"&&(this._output.trim(!0),this._options.brace_style==="expand"&&this._output.add_new_line(!0));else if(this._ch===":"){for(var Ne=0;Ne<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Ne++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Ne])){O=!0;break}(Ie||$e)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!J&&ye===0?(this.print_string(":"),xe||(xe=!0,this._output.space_before_token=!0,this.eatWhitespace(!0),this.indent())):(this._input.lookBack(" ")&&(this._output.space_before_token=!0),this._input.peek()===":"?(this._ch=this._input.next(),this.print_string("::")):this.print_string(":"))}else if(this._ch==='"'||this._ch==="'"){var Qe=S==='"'||S==="'";this.preserveSingleSpace(Qe||te),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")O=!1,ye===0?(xe&&(this.outdent(),xe=!1),J=!1,this.print_string(this._ch),this.eatWhitespace(!0),this._input.peek()!=="/"&&this._output.add_new_line()):(this.print_string(this._ch),this.eatWhitespace(!0),this._output.space_before_token=!0);else if(this._ch==="(")if(this._input.lookBack("url"))this.print_string(this._ch),this.eatWhitespace(),ye++,this.indent(),this._ch=this._input.next(),this._ch===")"||this._ch==='"'||this._ch==="'"?this._input.back():this._ch&&(this.print_string(this._ch+this.eatString(")")),ye&&(ye--,this.outdent()));else{var bt=!1;this._input.lookBack("with")&&(bt=!0),this.preserveSingleSpace(te||bt),this.print_string(this._ch),xe&&S==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),D=!0):(this.eatWhitespace(),ye++,this.indent())}else if(this._ch===")")ye&&(ye--,this.outdent()),D&&this._input.peek()===";"&&this._options.selector_separator_newline&&(D=!1,this.outdent(),this._output.add_new_line()),this.print_string(this._ch);else if(this._ch===",")this.print_string(this._ch),this.eatWhitespace(!0),this._options.selector_separator_newline&&(!xe||D)&&ye===0&&!J?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!xe&&ye===0)this._options.space_around_combinator?(this._output.space_before_token=!0,this.print_string(this._ch),this._output.space_before_token=!0):(this.print_string(this._ch),this.eatWhitespace(),this._ch&&V.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(te),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),V.test(this._ch)&&(this._ch="");else if(this._ch==="!"&&!this._input.lookBack("\\"))this._output.space_before_token=!0,this.print_string(this._ch);else{var Lt=S==='"'||S==="'";this.preserveSingleSpace(Lt||te),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&O&&this._output.add_new_line()}var ti=this._output.get_code(se);return ti},oe.exports.Beautifier=R},function(oe,l,Z){var k=Z(6).Options;function g(v){k.call(this,v,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var E=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||E;var A=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var M=0;M<A.length;M++)A[M]!=="expand"?this.brace_style="collapse":this.brace_style=A[M]}g.prototype=new k,oe.exports.Options=g}],G={};function p(oe){var l=G[oe];if(l!==void 0)return l.exports;var Z=G[oe]={exports:{}};return ue[oe](Z,Z.exports,p),Z.exports}var ve=p(15);pe=ve})();var Se=pe;U=[],F=function(){return{css_beautify:Se}}.apply(nt,U),F!==void 0&&(Zt.exports=F)})()},40998:function(Zt,nt,U){var F,pe;(function(){var Se;(function(){"use strict";var ve=[,,function(k){function g(A){this.__parent=A,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}g.prototype.clone_empty=function(){var A=new g(this.__parent);return A.set_indent(this.__indent_count,this.__alignment_count),A},g.prototype.item=function(A){return A<0?this.__items[this.__items.length+A]:this.__items[A]},g.prototype.has_match=function(A){for(var M=this.__items.length-1;M>=0;M--)if(this.__items[M].match(A))return!0;return!1},g.prototype.set_indent=function(A,M){this.is_empty()&&(this.__indent_count=A||0,this.__alignment_count=M||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},g.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},g.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},g.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var A=this.__parent.current_line;return A.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),A.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),A.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,A.__items[0]===" "&&(A.__items.splice(0,1),A.__character_count-=1),!0}return!1},g.prototype.is_empty=function(){return this.__items.length===0},g.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},g.prototype.push=function(A){this.__items.push(A);var M=A.lastIndexOf(`
`);M!==-1?this.__character_count=A.length-M:this.__character_count+=A.length},g.prototype.pop=function(){var A=null;return this.is_empty()||(A=this.__items.pop(),this.__character_count-=A.length),A},g.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},g.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},g.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},g.prototype.toString=function(){var A="";return this.is_empty()?this.__parent.indent_empty_lines&&(A=this.__parent.get_indent_string(this.__indent_count)):(A=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),A+=this.__items.join("")),A};function v(A,M){this.__cache=[""],this.__indent_size=A.indent_size,this.__indent_string=A.indent_char,A.indent_with_tabs||(this.__indent_string=new Array(A.indent_size+1).join(A.indent_char)),M=M||"",A.indent_level>0&&(M=new Array(A.indent_level+1).join(this.__indent_string)),this.__base_string=M,this.__base_string_length=M.length}v.prototype.get_indent_size=function(A,M){var j=this.__base_string_length;return M=M||0,A<0&&(j=0),j+=A*this.__indent_size,j+=M,j},v.prototype.get_indent_string=function(A,M){var j=this.__base_string;return M=M||0,A<0&&(A=0,j=""),M+=A*this.__indent_size,this.__ensure_cache(M),j+=this.__cache[M],j},v.prototype.__ensure_cache=function(A){for(;A>=this.__cache.length;)this.__add_column()},v.prototype.__add_column=function(){var A=this.__cache.length,M=0,j="";this.__indent_size&&A>=this.__indent_size&&(M=Math.floor(A/this.__indent_size),A-=M*this.__indent_size,j=new Array(M+1).join(this.__indent_string)),A&&(j+=new Array(A+1).join(" ")),this.__cache.push(j)};function E(A,M){this.__indent_cache=new v(A,M),this.raw=!1,this._end_with_newline=A.end_with_newline,this.indent_size=A.indent_size,this.wrap_line_length=A.wrap_line_length,this.indent_empty_lines=A.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new g(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}E.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},E.prototype.get_line_number=function(){return this.__lines.length},E.prototype.get_indent_string=function(A,M){return this.__indent_cache.get_indent_string(A,M)},E.prototype.get_indent_size=function(A,M){return this.__indent_cache.get_indent_size(A,M)},E.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},E.prototype.add_new_line=function(A){return this.is_empty()||!A&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},E.prototype.get_code=function(A){this.trim(!0);var M=this.current_line.pop();M&&(M[M.length-1]===`
`&&(M=M.replace(/\n+$/g,"")),this.current_line.push(M)),this._end_with_newline&&this.__add_outputline();var j=this.__lines.join(`
`);return A!==`
`&&(j=j.replace(/[\n]/g,A)),j},E.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},E.prototype.set_indent=function(A,M){return A=A||0,M=M||0,this.next_line.set_indent(A,M),this.__lines.length>1?(this.current_line.set_indent(A,M),!0):(this.current_line.set_indent(),!1)},E.prototype.add_raw_token=function(A){for(var M=0;M<A.newlines;M++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(A.whitespace_before),this.current_line.push(A.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},E.prototype.add_token=function(A){this.__add_space_before_token(),this.current_line.push(A),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},E.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},E.prototype.remove_indent=function(A){for(var M=this.__lines.length;A<M;)this.__lines[A]._remove_indent(),A++;this.current_line._remove_wrap_indent()},E.prototype.trim=function(A){for(A=A===void 0?!1:A,this.current_line.trim();A&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},E.prototype.just_added_newline=function(){return this.current_line.is_empty()},E.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},E.prototype.ensure_empty_line_above=function(A,M){for(var j=this.__lines.length-2;j>=0;){var V=this.__lines[j];if(V.is_empty())break;if(V.item(0).indexOf(A)!==0&&V.item(-1)!==M){this.__lines.splice(j+1,0,new g(this)),this.previous_line=this.__lines[this.__lines.length-2];break}j--}},k.exports.Output=E},function(k){function g(v,E,A,M){this.type=v,this.text=E,this.comments_before=null,this.newlines=A||0,this.whitespace_before=M||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}k.exports.Token=g},,,function(k){function g(A,M){this.raw_options=v(A,M),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}g.prototype._get_array=function(A,M){var j=this.raw_options[A],V=M||[];return typeof j=="object"?j!==null&&typeof j.concat=="function"&&(V=j.concat()):typeof j=="string"&&(V=j.split(/[^a-zA-Z0-9_\/\-]+/)),V},g.prototype._get_boolean=function(A,M){var j=this.raw_options[A],V=j===void 0?!!M:!!j;return V},g.prototype._get_characters=function(A,M){var j=this.raw_options[A],V=M||"";return typeof j=="string"&&(V=j.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),V},g.prototype._get_number=function(A,M){var j=this.raw_options[A];M=parseInt(M,10),isNaN(M)&&(M=0);var V=parseInt(j,10);return isNaN(V)&&(V=M),V},g.prototype._get_selection=function(A,M,j){var V=this._get_selection_list(A,M,j);if(V.length!==1)throw new Error("Invalid Option Value: The option '"+A+`' can only be one of the following values:
`+M+`
You passed in: '`+this.raw_options[A]+"'");return V[0]},g.prototype._get_selection_list=function(A,M,j){if(!M||M.length===0)throw new Error("Selection list cannot be empty.");if(j=j||[M[0]],!this._is_valid_selection(j,M))throw new Error("Invalid Default Value!");var V=this._get_array(A,j);if(!this._is_valid_selection(V,M))throw new Error("Invalid Option Value: The option '"+A+`' can contain only the following values:
`+M+`
You passed in: '`+this.raw_options[A]+"'");return V},g.prototype._is_valid_selection=function(A,M){return A.length&&M.length&&!A.some(function(j){return M.indexOf(j)===-1})};function v(A,M){var j={};A=E(A);var V;for(V in A)V!==M&&(j[V]=A[V]);if(M&&A[M])for(V in A[M])j[V]=A[M][V];return j}function E(A){var M={},j;for(j in A){var V=j.replace(/-/g,"_");M[V]=A[j]}return M}k.exports.Options=g,k.exports.normalizeOpts=E,k.exports.mergeOpts=v},,function(k){var g=RegExp.prototype.hasOwnProperty("sticky");function v(E){this.__input=E||"",this.__input_length=this.__input.length,this.__position=0}v.prototype.restart=function(){this.__position=0},v.prototype.back=function(){this.__position>0&&(this.__position-=1)},v.prototype.hasNext=function(){return this.__position<this.__input_length},v.prototype.next=function(){var E=null;return this.hasNext()&&(E=this.__input.charAt(this.__position),this.__position+=1),E},v.prototype.peek=function(E){var A=null;return E=E||0,E+=this.__position,E>=0&&E<this.__input_length&&(A=this.__input.charAt(E)),A},v.prototype.__match=function(E,A){E.lastIndex=A;var M=E.exec(this.__input);return M&&!(g&&E.sticky)&&M.index!==A&&(M=null),M},v.prototype.test=function(E,A){return A=A||0,A+=this.__position,A>=0&&A<this.__input_length?!!this.__match(E,A):!1},v.prototype.testChar=function(E,A){var M=this.peek(A);return E.lastIndex=0,M!==null&&E.test(M)},v.prototype.match=function(E){var A=this.__match(E,this.__position);return A?this.__position+=A[0].length:A=null,A},v.prototype.read=function(E,A,M){var j="",V;return E&&(V=this.match(E),V&&(j+=V[0])),A&&(V||!E)&&(j+=this.readUntil(A,M)),j},v.prototype.readUntil=function(E,A){var M="",j=this.__position;E.lastIndex=this.__position;var V=E.exec(this.__input);return V?(j=V.index,A&&(j+=V[0].length)):j=this.__input_length,M=this.__input.substring(this.__position,j),this.__position=j,M},v.prototype.readUntilAfter=function(E){return this.readUntil(E,!0)},v.prototype.get_regexp=function(E,A){var M=null,j="g";return A&&g&&(j="y"),typeof E=="string"&&E!==""?M=new RegExp(E,j):E&&(M=new RegExp(E.source,j)),M},v.prototype.get_literal_regexp=function(E){return RegExp(E.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(E){var A=this.__position,M=this.readUntilAfter(E);return this.__position=A,M},v.prototype.lookBack=function(E){var A=this.__position-1;return A>=E.length&&this.__input.substring(A-E.length,A).toLowerCase()===E},k.exports.InputScanner=v},function(k,g,v){var E=v(8).InputScanner,A=v(3).Token,M=v(10).TokenStream,j=v(11).WhitespacePattern,V={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},L=function(I,w){this._input=new E(I),this._options=w||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new j(this._input)};L.prototype.tokenize=function(){this._input.restart(),this.__tokens=new M,this._reset();for(var I,w=new A(V.START,""),R=null,Y=[],se=new M;w.type!==V.EOF;){for(I=this._get_next_token(w,R);this._is_comment(I);)se.add(I),I=this._get_next_token(w,R);se.isEmpty()||(I.comments_before=se,se=new M),I.parent=R,this._is_opening(I)?(Y.push(R),R=I):R&&this._is_closing(I,R)&&(I.opened=R,R.closed=I,R=Y.pop(),I.parent=R),I.previous=w,w.next=I,this.__tokens.add(I),w=I}return this.__tokens},L.prototype._is_first_token=function(){return this.__tokens.isEmpty()},L.prototype._reset=function(){},L.prototype._get_next_token=function(I,w){this._readWhitespace();var R=this._input.read(/.+/g);return R?this._create_token(V.RAW,R):this._create_token(V.EOF,"")},L.prototype._is_comment=function(I){return!1},L.prototype._is_opening=function(I){return!1},L.prototype._is_closing=function(I,w){return!1},L.prototype._create_token=function(I,w){var R=new A(I,w,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return R},L.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},k.exports.Tokenizer=L,k.exports.TOKEN=V},function(k){function g(v){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=v}g.prototype.restart=function(){this.__position=0},g.prototype.isEmpty=function(){return this.__tokens_length===0},g.prototype.hasNext=function(){return this.__position<this.__tokens_length},g.prototype.next=function(){var v=null;return this.hasNext()&&(v=this.__tokens[this.__position],this.__position+=1),v},g.prototype.peek=function(v){var E=null;return v=v||0,v+=this.__position,v>=0&&v<this.__tokens_length&&(E=this.__tokens[v]),E},g.prototype.add=function(v){this.__parent_token&&(v.parent=this.__parent_token),this.__tokens.push(v),this.__tokens_length+=1},k.exports.TokenStream=g},function(k,g,v){var E=v(12).Pattern;function A(M,j){E.call(this,M,j),j?this._line_regexp=this._input.get_regexp(j._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}A.prototype=new E,A.prototype.__set_whitespace_patterns=function(M,j){M+="\\t ",j+="\\n\\r",this._match_pattern=this._input.get_regexp("["+M+j+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+j+"]")},A.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var M=this._input.read(this._match_pattern);if(M===" ")this.whitespace_before_token=" ";else if(M){var j=this.__split(this._newline_regexp,M);this.newline_count=j.length-1,this.whitespace_before_token=j[this.newline_count]}return M},A.prototype.matching=function(M,j){var V=this._create();return V.__set_whitespace_patterns(M,j),V._update(),V},A.prototype._create=function(){return new A(this._input,this)},A.prototype.__split=function(M,j){M.lastIndex=0;for(var V=0,L=[],I=M.exec(j);I;)L.push(j.substring(V,I.index)),V=I.index+I[0].length,I=M.exec(j);return V<j.length?L.push(j.substring(V,j.length)):L.push(""),L},k.exports.WhitespacePattern=A},function(k){function g(v,E){this._input=v,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,E&&(this._starting_pattern=this._input.get_regexp(E._starting_pattern,!0),this._match_pattern=this._input.get_regexp(E._match_pattern,!0),this._until_pattern=this._input.get_regexp(E._until_pattern),this._until_after=E._until_after)}g.prototype.read=function(){var v=this._input.read(this._starting_pattern);return(!this._starting_pattern||v)&&(v+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),v},g.prototype.read_match=function(){return this._input.match(this._match_pattern)},g.prototype.until_after=function(v){var E=this._create();return E._until_after=!0,E._until_pattern=this._input.get_regexp(v),E._update(),E},g.prototype.until=function(v){var E=this._create();return E._until_after=!1,E._until_pattern=this._input.get_regexp(v),E._update(),E},g.prototype.starting_with=function(v){var E=this._create();return E._starting_pattern=this._input.get_regexp(v,!0),E._update(),E},g.prototype.matching=function(v){var E=this._create();return E._match_pattern=this._input.get_regexp(v,!0),E._update(),E},g.prototype._create=function(){return new g(this._input,this)},g.prototype._update=function(){},k.exports.Pattern=g},function(k){function g(v,E){v=typeof v=="string"?v:v.source,E=typeof E=="string"?E:E.source,this.__directives_block_pattern=new RegExp(v+/ beautify( \w+[:]\w+)+ /.source+E,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(v+/\sbeautify\signore:end\s/.source+E,"g")}g.prototype.get_directives=function(v){if(!v.match(this.__directives_block_pattern))return null;var E={};this.__directive_pattern.lastIndex=0;for(var A=this.__directive_pattern.exec(v);A;)E[A[1]]=A[2],A=this.__directive_pattern.exec(v);return E},g.prototype.readIgnored=function(v){return v.readUntilAfter(this.__directives_end_ignore_pattern)},k.exports.Directives=g},function(k,g,v){var E=v(12).Pattern,A={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function M(j,V){E.call(this,j,V),this.__template_pattern=null,this._disabled=Object.assign({},A),this._excluded=Object.assign({},A),V&&(this.__template_pattern=this._input.get_regexp(V.__template_pattern),this._excluded=Object.assign(this._excluded,V._excluded),this._disabled=Object.assign(this._disabled,V._disabled));var L=new E(j);this.__patterns={handlebars_comment:L.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:L.starting_with(/{{{/).until_after(/}}}/),handlebars:L.starting_with(/{{/).until_after(/}}/),php:L.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:L.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:L.starting_with(/{%/).until_after(/%}/),django_value:L.starting_with(/{{/).until_after(/}}/),django_comment:L.starting_with(/{#/).until_after(/#}/),smarty:L.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:L.starting_with(/{\*/).until_after(/\*}/),smarty_literal:L.starting_with(/{literal}/).until_after(/{\/literal}/)}}M.prototype=new E,M.prototype._create=function(){return new M(this._input,this)},M.prototype._update=function(){this.__set_templated_pattern()},M.prototype.disable=function(j){var V=this._create();return V._disabled[j]=!0,V._update(),V},M.prototype.read_options=function(j){var V=this._create();for(var L in A)V._disabled[L]=j.templating.indexOf(L)===-1;return V._update(),V},M.prototype.exclude=function(j){var V=this._create();return V._excluded[j]=!0,V._update(),V},M.prototype.read=function(){var j="";this._match_pattern?j=this._input.read(this._starting_pattern):j=this._input.read(this._starting_pattern,this.__template_pattern);for(var V=this._read_template();V;)this._match_pattern?V+=this._input.read(this._match_pattern):V+=this._input.readUntil(this.__template_pattern),j+=V,V=this._read_template();return this._until_after&&(j+=this._input.readUntilAfter(this._until_pattern)),j},M.prototype.__set_templated_pattern=function(){var j=[];this._disabled.php||j.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||j.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||j.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||j.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(j.push(this.__patterns.django._starting_pattern.source),j.push(this.__patterns.django_value._starting_pattern.source),j.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||j.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&j.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+j.join("|")+")")},M.prototype._read_template=function(){var j="",V=this._input.peek();if(V==="<"){var L=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&L==="?"&&(j=j||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&L==="%"&&(j=j||this.__patterns.erb.read())}else V==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(j=j||this.__patterns.handlebars_comment.read(),j=j||this.__patterns.handlebars_unescaped.read(),j=j||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(j=j||this.__patterns.django_value.read()),this._excluded.django||(j=j||this.__patterns.django_comment.read(),j=j||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(j=j||this.__patterns.smarty_comment.read(),j=j||this.__patterns.smarty_literal.read(),j=j||this.__patterns.smarty.read()));return j},k.exports.TemplatablePattern=M},,,,function(k,g,v){var E=v(19).Beautifier,A=v(20).Options;function M(j,V,L,I){var w=new E(j,V,L,I);return w.beautify()}k.exports=M,k.exports.defaultOptions=function(){return new A}},function(k,g,v){var E=v(20).Options,A=v(2).Output,M=v(21).Tokenizer,j=v(21).TOKEN,V=/\r\n|[\r\n]/,L=/\r\n|[\r\n]/g,I=function(J,D){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=J.max_preserve_newlines,this.preserve_newlines=J.preserve_newlines,this._output=new A(J,D)};I.prototype.current_line_has_match=function(J){return this._output.current_line.has_match(J)},I.prototype.set_space_before_token=function(J,D){this._output.space_before_token=J,this._output.non_breaking_space=D},I.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},I.prototype.add_raw_token=function(J){this._output.add_raw_token(J)},I.prototype.print_preserved_newlines=function(J){var D=0;J.type!==j.TEXT&&J.previous.type!==j.TEXT&&(D=J.newlines?1:0),this.preserve_newlines&&(D=J.newlines<this.max_preserve_newlines+1?J.newlines:this.max_preserve_newlines+1);for(var N=0;N<D;N++)this.print_newline(N>0);return D!==0},I.prototype.traverse_whitespace=function(J){return J.whitespace_before||J.newlines?(this.print_preserved_newlines(J)||(this._output.space_before_token=!0),!0):!1},I.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},I.prototype.print_newline=function(J){this._output.add_new_line(J)},I.prototype.print_token=function(J){J.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(J.text))},I.prototype.indent=function(){this.indent_level++},I.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},I.prototype.get_full_indent=function(J){return J=this.indent_level+(J||0),J<1?"":this._output.get_indent_string(J)};var w=function(J){for(var D=null,N=J.next;N.type!==j.EOF&&J.closed!==N;){if(N.type===j.ATTRIBUTE&&N.text==="type"){N.next&&N.next.type===j.EQUALS&&N.next.next&&N.next.next.type===j.VALUE&&(D=N.next.next.text);break}N=N.next}return D},R=function(J,D){var N=null,O=null;return D.closed?(J==="script"?N="text/javascript":J==="style"&&(N="text/css"),N=w(D)||N,N.search("text/css")>-1?O="css":N.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?O="javascript":N.search(/(text|application|dojo)\/(x-)?(html)/)>-1?O="html":N.search(/test\/null/)>-1&&(O="null"),O):null};function Y(J,D){return D.indexOf(J)!==-1}function se(J,D,N){this.parent=J||null,this.tag=D?D.tag_name:"",this.indent_level=N||0,this.parser_token=D||null}function ne(J){this._printer=J,this._current_frame=null}ne.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},ne.prototype.record_tag=function(J){var D=new se(this._current_frame,J,this._printer.indent_level);this._current_frame=D},ne.prototype._try_pop_frame=function(J){var D=null;return J&&(D=J.parser_token,this._printer.indent_level=J.indent_level,this._current_frame=J.parent),D},ne.prototype._get_frame=function(J,D){for(var N=this._current_frame;N&&J.indexOf(N.tag)===-1;){if(D&&D.indexOf(N.tag)!==-1){N=null;break}N=N.parent}return N},ne.prototype.try_pop=function(J,D){var N=this._get_frame([J],D);return this._try_pop_frame(N)},ne.prototype.indent_to_tag=function(J){var D=this._get_frame(J);D&&(this._printer.indent_level=D.indent_level)};function ye(J,D,N,O){this._source_text=J||"",D=D||{},this._js_beautify=N,this._css_beautify=O,this._tag_stack=null;var ae=new E(D,"html");this._options=ae,this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,5)==="force",this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline",this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned",this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple",this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,8)==="preserve",this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}ye.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var J=this._source_text,D=this._options.eol;this._options.eol==="auto"&&(D=`
`,J&&V.test(J)&&(D=J.match(V)[0])),J=J.replace(L,`
`);var N=J.match(/^[\t ]*/)[0],O={text:"",type:""},ae=new Ie(this._options),te=new I(this._options,N),S=new M(J,this._options).tokenize();this._tag_stack=new ne(te);for(var b=null,K=S.next();K.type!==j.EOF;)K.type===j.TAG_OPEN||K.type===j.COMMENT?(b=this._handle_tag_open(te,K,ae,O,S),ae=b):K.type===j.ATTRIBUTE||K.type===j.EQUALS||K.type===j.VALUE||K.type===j.TEXT&&!ae.tag_complete?b=this._handle_inside_tag(te,K,ae,O):K.type===j.TAG_CLOSE?b=this._handle_tag_close(te,K,ae):K.type===j.TEXT?b=this._handle_text(te,K,ae):K.type===j.CONTROL_FLOW_OPEN?b=this._handle_control_flow_open(te,K):K.type===j.CONTROL_FLOW_CLOSE?b=this._handle_control_flow_close(te,K):te.add_raw_token(K),O=b,K=S.next();var le=te._output.get_code(D);return le},ye.prototype._handle_control_flow_open=function(J,D){var N={text:D.text,type:D.type};return J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),D.newlines?J.print_preserved_newlines(D):J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),J.print_token(D),J.indent(),N},ye.prototype._handle_control_flow_close=function(J,D){var N={text:D.text,type:D.type};return J.deindent(),D.newlines?J.print_preserved_newlines(D):J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),J.print_token(D),N},ye.prototype._handle_tag_close=function(J,D,N){var O={text:D.text,type:D.type};return J.alignment_size=0,N.tag_complete=!0,J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),N.is_unformatted?J.add_raw_token(D):(N.tag_start_char==="<"&&(J.set_space_before_token(D.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&N.has_wrapped_attrs&&J.print_newline(!1)),J.print_token(D)),N.indent_content&&!(N.is_unformatted||N.is_content_unformatted)&&(J.indent(),N.indent_content=!1),!N.is_inline_element&&!(N.is_unformatted||N.is_content_unformatted)&&J.set_wrap_point(),O},ye.prototype._handle_inside_tag=function(J,D,N,O){var ae=N.has_wrapped_attrs,te={text:D.text,type:D.type};return J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),N.is_unformatted?J.add_raw_token(D):N.tag_start_char==="{"&&D.type===j.TEXT?J.print_preserved_newlines(D)?(D.newlines=0,J.add_raw_token(D)):J.print_token(D):(D.type===j.ATTRIBUTE?J.set_space_before_token(!0):(D.type===j.EQUALS||D.type===j.VALUE&&D.previous.type===j.EQUALS)&&J.set_space_before_token(!1),D.type===j.ATTRIBUTE&&N.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(J.traverse_whitespace(D),ae=ae||D.newlines!==0),this._is_wrap_attributes_force&&N.attr_count>=this._options.wrap_attributes_min_attrs&&(O.type!==j.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(J.print_newline(!1),ae=!0)),J.print_token(D),ae=ae||J.previous_token_wrapped(),N.has_wrapped_attrs=ae),te},ye.prototype._handle_text=function(J,D,N){var O={text:D.text,type:"TK_CONTENT"};return N.custom_beautifier_name?this._print_custom_beatifier_text(J,D,N):N.is_unformatted||N.is_content_unformatted?J.add_raw_token(D):(J.traverse_whitespace(D),J.print_token(D)),O},ye.prototype._print_custom_beatifier_text=function(J,D,N){var O=this;if(D.text!==""){var ae=D.text,te,S=1,b="",K="";N.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?te=this._js_beautify:N.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?te=this._css_beautify:N.custom_beautifier_name==="html"&&(te=function(Lt,ti){var ze=new ye(Lt,ti,O._js_beautify,O._css_beautify);return ze.beautify()}),this._options.indent_scripts==="keep"?S=0:this._options.indent_scripts==="separate"&&(S=-J.indent_level);var le=J.get_full_indent(S);if(ae=ae.replace(/\n[ \t]*$/,""),N.custom_beautifier_name!=="html"&&ae[0]==="<"&&ae.match(/^(<!--|<!\[CDATA\[)/)){var Ee=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(ae);if(!Ee){J.add_raw_token(D);return}b=le+Ee[1]+`
`,ae=Ee[4],Ee[5]&&(K=le+Ee[5]),ae=ae.replace(/\n[ \t]*$/,""),(Ee[2]||Ee[3].indexOf(`
`)!==-1)&&(Ee=Ee[3].match(/[ \t]+$/),Ee&&(D.whitespace_before=Ee[0]))}if(ae)if(te){var Ne=function(){this.eol=`
`};Ne.prototype=this._options.raw_options;var Qe=new Ne;ae=te(le+ae,Qe)}else{var bt=D.whitespace_before;bt&&(ae=ae.replace(new RegExp(`
(`+bt+")?","g"),`
`)),ae=le+ae.replace(/\n/g,`
`+le)}b&&(ae?ae=b+ae+`
`+K:ae=b+K),J.print_newline(!1),ae&&(D.text=ae,D.whitespace_before="",D.newlines=0,J.add_raw_token(D),J.print_newline(!0))}},ye.prototype._handle_tag_open=function(J,D,N,O,ae){var te=this._get_tag_open_token(D);if((N.is_unformatted||N.is_content_unformatted)&&!N.is_empty_element&&D.type===j.TAG_OPEN&&!te.is_start_tag?(J.add_raw_token(D),te.start_tag_token=this._tag_stack.try_pop(te.tag_name)):(J.traverse_whitespace(D),this._set_tag_position(J,D,te,N,O),te.is_inline_element||J.set_wrap_point(),J.print_token(D)),te.is_start_tag&&this._is_wrap_attributes_force){var S=0,b;do b=ae.peek(S),b.type===j.ATTRIBUTE&&(te.attr_count+=1),S+=1;while(b.type!==j.EOF&&b.type!==j.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(te.alignment_size=D.text.length+1),!te.tag_complete&&!te.is_unformatted&&(J.alignment_size=te.alignment_size),te};var Ie=function(J,D,N){if(this.parent=D||null,this.text="",this.type="TK_TAG_OPEN",this.tag_name="",this.is_inline_element=!1,this.is_unformatted=!1,this.is_content_unformatted=!1,this.is_empty_element=!1,this.is_start_tag=!1,this.is_end_tag=!1,this.indent_content=!1,this.multiline_content=!1,this.custom_beautifier_name=null,this.start_tag_token=null,this.attr_count=0,this.has_wrapped_attrs=!1,this.alignment_size=0,this.tag_complete=!1,this.tag_start_char="",this.tag_check="",!N)this.tag_complete=!0;else{var O;this.tag_start_char=N.text[0],this.text=N.text,this.tag_start_char==="<"?(O=N.text.match(/^<([^\s>]*)/),this.tag_check=O?O[1]:""):(O=N.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=O?O[1]:"",(N.text.startsWith("{{#>")||N.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&N.next!==null?this.tag_check=N.next.text.split(" ")[0]:this.tag_check=N.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),N.type===j.COMMENT&&(this.tag_complete=!0),this.is_start_tag=this.tag_check.charAt(0)!=="/",this.tag_name=this.is_start_tag?this.tag_check:this.tag_check.substr(1),this.is_end_tag=!this.is_start_tag||N.closed&&N.closed.text==="/>";var ae=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(ae=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!J.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(ae)))}};ye.prototype._get_tag_open_token=function(J){var D=new Ie(this._options,this._tag_stack.get_parser_token(),J);return D.alignment_size=this._options.wrap_attributes_indent_size,D.is_end_tag=D.is_end_tag||Y(D.tag_check,this._options.void_elements),D.is_empty_element=D.tag_complete||D.is_start_tag&&D.is_end_tag,D.is_unformatted=!D.tag_complete&&Y(D.tag_check,this._options.unformatted),D.is_content_unformatted=!D.is_empty_element&&Y(D.tag_check,this._options.content_unformatted),D.is_inline_element=Y(D.tag_name,this._options.inline)||this._options.inline_custom_elements&&D.tag_name.includes("-")||D.tag_start_char==="{",D},ye.prototype._set_tag_position=function(J,D,N,O,ae){if(N.is_empty_element||(N.is_end_tag?N.start_tag_token=this._tag_stack.try_pop(N.tag_name):(this._do_optional_end_element(N)&&(N.is_inline_element||J.print_newline(!1)),this._tag_stack.record_tag(N),(N.tag_name==="script"||N.tag_name==="style")&&!(N.is_unformatted||N.is_content_unformatted)&&(N.custom_beautifier_name=R(N.tag_check,D)))),Y(N.tag_check,this._options.extra_liners)&&(J.print_newline(!1),J._output.just_added_blankline()||J.print_newline(!0)),N.is_empty_element){if(N.tag_start_char==="{"&&N.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),N.indent_content=!0;var te=J.current_line_has_match(/{{#if/);te||J.print_newline(!1)}N.tag_name==="!--"&&ae.type===j.TAG_CLOSE&&O.is_end_tag&&N.text.indexOf(`
`)===-1||(N.is_inline_element||N.is_unformatted||J.print_newline(!1),this._calcluate_parent_multiline(J,N))}else if(N.is_end_tag){var S=!1;S=N.start_tag_token&&N.start_tag_token.multiline_content,S=S||!N.is_inline_element&&!(O.is_inline_element||O.is_unformatted)&&!(ae.type===j.TAG_CLOSE&&N.start_tag_token===O)&&ae.type!=="TK_CONTENT",(N.is_content_unformatted||N.is_unformatted)&&(S=!1),S&&J.print_newline(!1)}else N.indent_content=!N.custom_beautifier_name,N.tag_start_char==="<"&&(N.tag_name==="html"?N.indent_content=this._options.indent_inner_html:N.tag_name==="head"?N.indent_content=this._options.indent_head_inner_html:N.tag_name==="body"&&(N.indent_content=this._options.indent_body_inner_html)),!(N.is_inline_element||N.is_unformatted)&&(ae.type!=="TK_CONTENT"||N.is_content_unformatted)&&J.print_newline(!1),this._calcluate_parent_multiline(J,N)},ye.prototype._calcluate_parent_multiline=function(J,D){D.parent&&J._output.just_added_newline()&&!((D.is_inline_element||D.is_unformatted)&&D.parent.is_inline_element)&&(D.parent.multiline_content=!0)};var xe=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","menu","nav","ol","p","pre","section","table","ul"],$e=["a","audio","del","ins","map","noscript","video"];ye.prototype._do_optional_end_element=function(J){var D=null;if(!(J.is_empty_element||!J.is_start_tag||!J.parent)){if(J.tag_name==="body")D=D||this._tag_stack.try_pop("head");else if(J.tag_name==="li")D=D||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(J.tag_name==="dd"||J.tag_name==="dt")D=D||this._tag_stack.try_pop("dt",["dl"]),D=D||this._tag_stack.try_pop("dd",["dl"]);else if(J.parent.tag_name==="p"&&xe.indexOf(J.tag_name)!==-1){var N=J.parent.parent;(!N||$e.indexOf(N.tag_name)===-1)&&(D=D||this._tag_stack.try_pop("p"))}else J.tag_name==="rp"||J.tag_name==="rt"?(D=D||this._tag_stack.try_pop("rt",["ruby","rtc"]),D=D||this._tag_stack.try_pop("rp",["ruby","rtc"])):J.tag_name==="optgroup"?D=D||this._tag_stack.try_pop("optgroup",["select"]):J.tag_name==="option"?D=D||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):J.tag_name==="colgroup"?D=D||this._tag_stack.try_pop("caption",["table"]):J.tag_name==="thead"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"])):J.tag_name==="tbody"||J.tag_name==="tfoot"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"]),D=D||this._tag_stack.try_pop("thead",["table"]),D=D||this._tag_stack.try_pop("tbody",["table"])):J.tag_name==="tr"?(D=D||this._tag_stack.try_pop("caption",["table"]),D=D||this._tag_stack.try_pop("colgroup",["table"]),D=D||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(J.tag_name==="th"||J.tag_name==="td")&&(D=D||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),D=D||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return J.parent=this._tag_stack.get_parser_token(),D}},k.exports.Beautifier=ye},function(k,g,v){var E=v(6).Options;function A(M){E.call(this,M,"html"),this.templating.length===1&&this.templating[0]==="auto"&&(this.templating=["django","erb","handlebars","php"]),this.indent_inner_html=this._get_boolean("indent_inner_html"),this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",!0),this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",!0),this.indent_handlebars=this._get_boolean("indent_handlebars",!0),this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]),this.wrap_attributes_min_attrs=this._get_number("wrap_attributes_min_attrs",2),this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size),this.extra_liners=this._get_array("extra_liners",["head","body","/html"]),this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]),this.inline_custom_elements=this._get_boolean("inline_custom_elements",!0),this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]),this.unformatted=this._get_array("unformatted",[]),this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]),this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter"),this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}A.prototype=new E,k.exports.Options=A},function(k,g,v){var E=v(9).Tokenizer,A=v(9).TOKEN,M=v(13).Directives,j=v(14).TemplatablePattern,V=v(12).Pattern,L={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",CONTROL_FLOW_OPEN:"TK_CONTROL_FLOW_OPEN",CONTROL_FLOW_CLOSE:"TK_CONTROL_FLOW_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:A.START,RAW:A.RAW,EOF:A.EOF},I=new M(/<\!--/,/-->/),w=function(R,Y){E.call(this,R,Y),this._current_tag_name="";var se=new j(this._input).read_options(this._options),ne=new V(this._input);if(this.__patterns={word:se.until(/[\n\r\t <]/),word_control_flow_close_excluded:se.until(/[\n\r\t <}]/),single_quote:se.until_after(/'/),double_quote:se.until_after(/"/),attribute:se.until(/[\n\r\t =>]|\/>/),element_name:se.until(/[\n\r\t >\/]/),angular_control_flow_start:ne.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:ne.starting_with(/{{!--/).until_after(/--}}/),handlebars:ne.starting_with(/{{/).until_after(/}}/),handlebars_open:ne.until(/[\n\r\t }]/),handlebars_raw_close:ne.until(/}}/),comment:ne.starting_with(/<!--/).until_after(/-->/),cdata:ne.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:ne.starting_with(/<!\[/).until_after(/]>/),processing:ne.starting_with(/<\?/).until_after(/\?>/)},this._options.indent_handlebars&&(this.__patterns.word=this.__patterns.word.exclude("handlebars"),this.__patterns.word_control_flow_close_excluded=this.__patterns.word_control_flow_close_excluded.exclude("handlebars")),this._unformatted_content_delimiter=null,this._options.unformatted_content_delimiter){var ye=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=ne.matching(ye).until_after(ye)}};w.prototype=new E,w.prototype._is_comment=function(R){return!1},w.prototype._is_opening=function(R){return R.type===L.TAG_OPEN||R.type===L.CONTROL_FLOW_OPEN},w.prototype._is_closing=function(R,Y){return R.type===L.TAG_CLOSE&&Y&&((R.text===">"||R.text==="/>")&&Y.text[0]==="<"||R.text==="}}"&&Y.text[0]==="{"&&Y.text[1]==="{")||R.type===L.CONTROL_FLOW_CLOSE&&R.text==="}"&&Y.text.endsWith("{")},w.prototype._reset=function(){this._current_tag_name=""},w.prototype._get_next_token=function(R,Y){var se=null;this._readWhitespace();var ne=this._input.peek();return ne===null?this._create_token(L.EOF,""):(se=se||this._read_open_handlebars(ne,Y),se=se||this._read_attribute(ne,R,Y),se=se||this._read_close(ne,Y),se=se||this._read_script_and_style(ne,R),se=se||this._read_control_flows(ne,Y),se=se||this._read_raw_content(ne,R,Y),se=se||this._read_content_word(ne,Y),se=se||this._read_comment_or_cdata(ne),se=se||this._read_processing(ne),se=se||this._read_open(ne,Y),se=se||this._create_token(L.UNKNOWN,this._input.next()),se)},w.prototype._read_comment_or_cdata=function(R){var Y=null,se=null,ne=null;if(R==="<"){var ye=this._input.peek(1);ye==="!"&&(se=this.__patterns.comment.read(),se?(ne=I.get_directives(se),ne&&ne.ignore==="start"&&(se+=I.readIgnored(this._input))):se=this.__patterns.cdata.read()),se&&(Y=this._create_token(L.COMMENT,se),Y.directives=ne)}return Y},w.prototype._read_processing=function(R){var Y=null,se=null,ne=null;if(R==="<"){var ye=this._input.peek(1);(ye==="!"||ye==="?")&&(se=this.__patterns.conditional_comment.read(),se=se||this.__patterns.processing.read()),se&&(Y=this._create_token(L.COMMENT,se),Y.directives=ne)}return Y},w.prototype._read_open=function(R,Y){var se=null,ne=null;return(!Y||Y.type===L.CONTROL_FLOW_OPEN)&&R==="<"&&(se=this._input.next(),this._input.peek()==="/"&&(se+=this._input.next()),se+=this.__patterns.element_name.read(),ne=this._create_token(L.TAG_OPEN,se)),ne},w.prototype._read_open_handlebars=function(R,Y){var se=null,ne=null;return(!Y||Y.type===L.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&R==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(se=this.__patterns.handlebars_comment.read(),se=se||this.__patterns.handlebars.read(),ne=this._create_token(L.COMMENT,se)):(se=this.__patterns.handlebars_open.read(),ne=this._create_token(L.TAG_OPEN,se))),ne},w.prototype._read_control_flows=function(R,Y){var se="",ne=null;if(!this._options.templating.includes("angular"))return ne;if(R==="@"){if(se=this.__patterns.angular_control_flow_start.read(),se==="")return ne;for(var ye=se.endsWith("(")?1:0,Ie=0;!(se.endsWith("{")&&ye===Ie);){var xe=this._input.next();if(xe===null)break;xe==="("?ye++:xe===")"&&Ie++,se+=xe}ne=this._create_token(L.CONTROL_FLOW_OPEN,se)}else R==="}"&&Y&&Y.type===L.CONTROL_FLOW_OPEN&&(se=this._input.next(),ne=this._create_token(L.CONTROL_FLOW_CLOSE,se));return ne},w.prototype._read_close=function(R,Y){var se=null,ne=null;return Y&&Y.type===L.TAG_OPEN&&(Y.text[0]==="<"&&(R===">"||R==="/"&&this._input.peek(1)===">")?(se=this._input.next(),R==="/"&&(se+=this._input.next()),ne=this._create_token(L.TAG_CLOSE,se)):Y.text[0]==="{"&&R==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),ne=this._create_token(L.TAG_CLOSE,"}}"))),ne},w.prototype._read_attribute=function(R,Y,se){var ne=null,ye="";if(se&&se.text[0]==="<")if(R==="=")ne=this._create_token(L.EQUALS,this._input.next());else if(R==='"'||R==="'"){var Ie=this._input.next();R==='"'?Ie+=this.__patterns.double_quote.read():Ie+=this.__patterns.single_quote.read(),ne=this._create_token(L.VALUE,Ie)}else ye=this.__patterns.attribute.read(),ye&&(Y.type===L.EQUALS?ne=this._create_token(L.VALUE,ye):ne=this._create_token(L.ATTRIBUTE,ye));return ne},w.prototype._is_content_unformatted=function(R){return this._options.void_elements.indexOf(R)===-1&&(this._options.content_unformatted.indexOf(R)!==-1||this._options.unformatted.indexOf(R)!==-1)},w.prototype._read_raw_content=function(R,Y,se){var ne="";if(se&&se.text[0]==="{")ne=this.__patterns.handlebars_raw_close.read();else if(Y.type===L.TAG_CLOSE&&Y.opened.text[0]==="<"&&Y.text[0]!=="/"){var ye=Y.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ye)&&(ne=this._input.readUntil(new RegExp("</"+ye+"[\\n\\r\\t ]*?>","ig")))}return ne?this._create_token(L.TEXT,ne):null},w.prototype._read_script_and_style=function(R,Y){if(Y.type===L.TAG_CLOSE&&Y.opened.text[0]==="<"&&Y.text[0]!=="/"){var se=Y.opened.text.substr(1).toLowerCase();if(se==="script"||se==="style"){var ne=this._read_comment_or_cdata(R);if(ne)return ne.type=L.TEXT,ne;var ye=this._input.readUntil(new RegExp("</"+se+"[\\n\\r\\t ]*?>","ig"));if(ye)return this._create_token(L.TEXT,ye)}}return null},w.prototype._read_content_word=function(R,Y){var se="";return this._options.unformatted_content_delimiter&&R===this._options.unformatted_content_delimiter[0]&&(se=this.__patterns.unformatted_content_delimiter.read()),se||(se=Y&&Y.type===L.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),se?this._create_token(L.TEXT,se):null},k.exports.Tokenizer=w,k.exports.TOKEN=L}],oe={};function l(k){var g=oe[k];if(g!==void 0)return g.exports;var v=oe[k]={exports:{}};return ve[k](v,v.exports,l),v.exports}var Z=l(18);Se=Z})();var ue=Se;if(1)F=[U,U(58553),U(87804)],pe=function(ve){var oe=U(58553),l=U(87804);return{html_beautify:function(Z,k){return ue(Z,k,oe.js_beautify,l.css_beautify)}}}.apply(nt,F),pe!==void 0&&(Zt.exports=pe);else var G,p})()},58553:function(Zt,nt){var U,F;(function(){var pe;(function(){"use strict";var ue=[function(oe,l,Z){var k=Z(1).Beautifier,g=Z(5).Options;function v(E,A){var M=new k(E,A);return M.beautify()}oe.exports=v,oe.exports.defaultOptions=function(){return new g}},function(oe,l,Z){var k=Z(2).Output,g=Z(3).Token,v=Z(4),E=Z(5).Options,A=Z(7).Tokenizer,M=Z(7).line_starters,j=Z(7).positionable_operators,V=Z(7).TOKEN;function L(b,K){return K.indexOf(b)!==-1}function I(b){return b.replace(/^\s+/g,"")}function w(b){for(var K={},le=0;le<b.length;le++)K[b[le].replace(/-/g,"_")]=b[le];return K}function R(b,K){return b&&b.type===V.RESERVED&&b.text===K}function Y(b,K){return b&&b.type===V.RESERVED&&L(b.text,K)}var se=["case","return","do","if","throw","else","await","break","continue","async"],ne=["before-newline","after-newline","preserve-newline"],ye=w(ne),Ie=[ye.before_newline,ye.preserve_newline],xe={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function $e(b,K){K.multiline_frame||K.mode===xe.ForInitializer||K.mode===xe.Conditional||b.remove_indent(K.start_line_index)}function J(b){b=b.replace(v.allLineBreaks,`
`);for(var K=[],le=b.indexOf(`
`);le!==-1;)K.push(b.substring(0,le)),b=b.substring(le+1),le=b.indexOf(`
`);return b.length&&K.push(b),K}function D(b){return b===xe.ArrayLiteral}function N(b){return L(b,[xe.Expression,xe.ForInitializer,xe.Conditional])}function O(b,K){for(var le=0;le<b.length;le++){var Ee=b[le].trim();if(Ee.charAt(0)!==K)return!1}return!0}function ae(b,K){for(var le=0,Ee=b.length,Ne;le<Ee;le++)if(Ne=b[le],Ne&&Ne.indexOf(K)!==0)return!1;return!0}function te(b,K){K=K||{},this._source_text=b||"",this._output=null,this._tokens=null,this._last_last_text=null,this._flags=null,this._previous_flags=null,this._flag_store=null,this._options=new E(K)}te.prototype.create_flags=function(b,K){var le=0;b&&(le=b.indentation_level,!this._output.just_added_newline()&&b.line_indent_level>le&&(le=b.line_indent_level));var Ee={mode:K,parent:b,last_token:b?b.last_token:new g(V.START_BLOCK,""),last_word:b?b.last_word:"",declaration_statement:!1,declaration_assignment:!1,multiline_frame:!1,inline_frame:!1,if_block:!1,else_block:!1,class_start_block:!1,do_block:!1,do_while:!1,import_block:!1,in_case_statement:!1,in_case:!1,case_body:!1,case_block:!1,indentation_level:le,alignment:0,line_indent_level:b?b.line_indent_level:le,start_line_index:this._output.get_line_number(),ternary_depth:0};return Ee},te.prototype._reset=function(b){var K=b.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new k(this._options,K),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(xe.BlockStatement);var le=new A(b,this._options);return this._tokens=le.tokenize(),b},te.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var b,K=this._reset(this._source_text),le=this._options.eol;this._options.eol==="auto"&&(le=`
`,K&&v.lineBreak.test(K||"")&&(le=K.match(v.lineBreak)[0]));for(var Ee=this._tokens.next();Ee;)this.handle_token(Ee),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Ee,Ee=this._tokens.next();return b=this._output.get_code(le),b},te.prototype.handle_token=function(b,K){b.type===V.START_EXPR?this.handle_start_expr(b):b.type===V.END_EXPR?this.handle_end_expr(b):b.type===V.START_BLOCK?this.handle_start_block(b):b.type===V.END_BLOCK?this.handle_end_block(b):b.type===V.WORD?this.handle_word(b):b.type===V.RESERVED?this.handle_word(b):b.type===V.SEMICOLON?this.handle_semicolon(b):b.type===V.STRING?this.handle_string(b):b.type===V.EQUALS?this.handle_equals(b):b.type===V.OPERATOR?this.handle_operator(b):b.type===V.COMMA?this.handle_comma(b):b.type===V.BLOCK_COMMENT?this.handle_block_comment(b,K):b.type===V.COMMENT?this.handle_comment(b,K):b.type===V.DOT?this.handle_dot(b):b.type===V.EOF?this.handle_eof(b):b.type===V.UNKNOWN?this.handle_unknown(b,K):this.handle_unknown(b,K)},te.prototype.handle_whitespace_and_comments=function(b,K){var le=b.newlines,Ee=this._options.keep_array_indentation&&D(this._flags.mode);if(b.comments_before)for(var Ne=b.comments_before.next();Ne;)this.handle_whitespace_and_comments(Ne,K),this.handle_token(Ne,K),Ne=b.comments_before.next();if(Ee)for(var Qe=0;Qe<le;Qe+=1)this.print_newline(Qe>0,K);else if(this._options.max_preserve_newlines&&le>this._options.max_preserve_newlines&&(le=this._options.max_preserve_newlines),this._options.preserve_newlines&&le>1){this.print_newline(!1,K);for(var bt=1;bt<le;bt+=1)this.print_newline(!0,K)}};var S=["async","break","continue","return","throw","yield"];te.prototype.allow_wrap_or_preserved_newline=function(b,K){if(K=K===void 0?!1:K,!this._output.just_added_newline()){var le=this._options.preserve_newlines&&b.newlines||K,Ee=L(this._flags.last_token.text,j)||L(b.text,j);if(Ee){var Ne=L(this._flags.last_token.text,j)&&L(this._options.operator_position,Ie)||L(b.text,j);le=le&&Ne}if(le)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(Y(this._flags.last_token,S))return;this._output.set_wrap_point()}}},te.prototype.print_newline=function(b,K){if(!K&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==V.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var le=this._tokens.peek();this._flags.mode===xe.Statement&&!(this._flags.if_block&&R(le,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(b)&&(this._flags.multiline_frame=!0)},te.prototype.print_token_line_indentation=function(b){this._output.just_added_newline()&&(this._options.keep_array_indentation&&b.newlines&&(b.text==="["||D(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(b.whitespace_before),this._output.space_before_token=!1):this._output.set_indent(this._flags.indentation_level,this._flags.alignment)&&(this._flags.line_indent_level=this._flags.indentation_level))},te.prototype.print_token=function(b){if(this._output.raw){this._output.add_raw_token(b);return}if(this._options.comma_first&&b.previous&&b.previous.type===V.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var K=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(K),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(b),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(b),this._output.non_breaking_space=!0,this._output.add_token(b.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},te.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},te.prototype.deindent=function(){this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)&&(this._flags.indentation_level-=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},te.prototype.set_mode=function(b){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,b),this._flags=this.create_flags(this._previous_flags,b),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},te.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===xe.Statement&&$e(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},te.prototype.start_of_object_property=function(){return this._flags.parent.mode===xe.ObjectLiteral&&this._flags.mode===xe.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||Y(this._flags.last_token,["get","set"]))},te.prototype.start_of_statement=function(b){var K=!1;return K=K||Y(this._flags.last_token,["var","let","const"])&&b.type===V.WORD,K=K||R(this._flags.last_token,"do"),K=K||!(this._flags.parent.mode===xe.ObjectLiteral&&this._flags.mode===xe.Statement)&&Y(this._flags.last_token,S)&&!b.newlines,K=K||R(this._flags.last_token,"else")&&!(R(b,"if")&&!b.comments_before),K=K||this._flags.last_token.type===V.END_EXPR&&(this._previous_flags.mode===xe.ForInitializer||this._previous_flags.mode===xe.Conditional),K=K||this._flags.last_token.type===V.WORD&&this._flags.mode===xe.BlockStatement&&!this._flags.in_case&&!(b.text==="--"||b.text==="++")&&this._last_last_text!=="function"&&b.type!==V.WORD&&b.type!==V.RESERVED,K=K||this._flags.mode===xe.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||Y(this._flags.last_token,["get","set"])),K?(this.set_mode(xe.Statement),this.indent(),this.handle_whitespace_and_comments(b,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b,Y(b,["do","for","if","while"])),!0):!1},te.prototype.handle_start_expr=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b);var K=xe.Expression;if(b.text==="["){if(this._flags.last_token.type===V.WORD||this._flags.last_token.text===")"){Y(this._flags.last_token,M)&&(this._output.space_before_token=!0),this.print_token(b),this.set_mode(K),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}K=xe.ArrayLiteral,D(this._flags.mode)&&(this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}"))&&(this._options.keep_array_indentation||this.print_newline()),L(this._flags.last_token.type,[V.START_EXPR,V.END_EXPR,V.WORD,V.OPERATOR,V.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===V.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,K=xe.ForInitializer):L(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,K=xe.Conditional):L(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&b.whitespace_before===""?this._output.space_before_token=!1:(L(this._flags.last_token.text,M)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b);else if(this._flags.last_token.type===V.WORD){this._output.space_before_token=!1;var le=this._tokens.peek(-3);if(this._options.space_after_named_function&&le){var Ee=this._tokens.peek(-4);Y(le,["async","function"])||le.text==="*"&&Y(Ee,["async","function"])?this._output.space_before_token=!0:this._flags.mode===xe.ObjectLiteral?(le.text==="{"||le.text===","||le.text==="*"&&(Ee.text==="{"||Ee.text===","))&&(this._output.space_before_token=!0):this._flags.parent&&this._flags.parent.class_start_block&&(this._output.space_before_token=!0)}}else this.allow_wrap_or_preserved_newline(b);(this._flags.last_token.type===V.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(L(this._last_last_text,["function","yield"])||this._flags.mode===xe.ObjectLiteral&&L(this._last_last_text,["{",","])))&&(this._output.space_before_token=this._options.space_after_anon_function)}this._flags.last_token.text===";"||this._flags.last_token.type===V.START_BLOCK?this.print_newline():(this._flags.last_token.type===V.END_EXPR||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===V.COMMA)&&this.allow_wrap_or_preserved_newline(b,b.newlines),this.print_token(b),this.set_mode(K),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},te.prototype.handle_end_expr=function(b){for(;this._flags.mode===xe.Statement;)this.restore_mode();this.handle_whitespace_and_comments(b),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(b,b.text==="]"&&D(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===V.START_EXPR&&!this._options.space_in_empty_paren?(this._output.trim(),this._output.space_before_token=!1):this._output.space_before_token=!0),this.deindent(),this.print_token(b),this.restore_mode(),$e(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===xe.Conditional&&(this._previous_flags.mode=xe.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},te.prototype.handle_start_block=function(b){this.handle_whitespace_and_comments(b);var K=this._tokens.peek(),le=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===V.END_EXPR?(this.set_mode(xe.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(xe.BlockStatement):le&&(L(le.text,[":",","])&&L(K.type,[V.STRING,V.WORD,V.RESERVED])||L(K.text,["get","set","..."])&&L(le.type,[V.WORD,V.RESERVED]))?L(this._last_last_text,["class","interface"])&&!L(le.text,[":",","])?this.set_mode(xe.BlockStatement):this.set_mode(xe.ObjectLiteral):this._flags.last_token.type===V.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(xe.BlockStatement):L(this._flags.last_token.type,[V.EQUALS,V.START_EXPR,V.COMMA,V.OPERATOR])||Y(this._flags.last_token,["return","throw","import","default"])?this.set_mode(xe.ObjectLiteral):this.set_mode(xe.BlockStatement),this._flags.last_token&&Y(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Ee=!K.comments_before&&K.text==="}",Ne=Ee&&this._flags.last_word==="function"&&this._flags.last_token.type===V.END_EXPR;if(this._options.brace_preserve_inline){var Qe=0,bt=null;this._flags.inline_frame=!0;do if(Qe+=1,bt=this._tokens.peek(Qe-1),bt.newlines){this._flags.inline_frame=!1;break}while(bt.type!==V.EOF&&!(bt.type===V.END_BLOCK&&bt.opened===b))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&b.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==V.OPERATOR&&(Ne||this._flags.last_token.type===V.EQUALS||Y(this._flags.last_token,se)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(D(this._previous_flags.mode)&&(this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.COMMA)&&((this._flags.last_token.type===V.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(b),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==V.OPERATOR&&this._flags.last_token.type!==V.START_EXPR&&(L(this._flags.last_token.type,[V.START_BLOCK,V.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(b),this.indent(),!Ee&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},te.prototype.handle_end_block=function(b){for(this.handle_whitespace_and_comments(b);this._flags.mode===xe.Statement;)this.restore_mode();var K=this._flags.last_token.type===V.START_BLOCK;this._flags.inline_frame&&!K?this._output.space_before_token=!0:this._options.brace_style==="expand"?K||this.print_newline():K||(D(this._flags.mode)&&this._options.keep_array_indentation?(this._options.keep_array_indentation=!1,this.print_newline(),this._options.keep_array_indentation=!0):this.print_newline()),this.restore_mode(),this.print_token(b)},te.prototype.handle_word=function(b){if(b.type===V.RESERVED){if(L(b.text,["set","get"])&&this._flags.mode!==xe.ObjectLiteral)b.type=V.WORD;else if(b.text==="import"&&L(this._tokens.peek().text,["(","."]))b.type=V.WORD;else if(L(b.text,["as","from"])&&!this._flags.import_block)b.type=V.WORD;else if(this._flags.mode===xe.ObjectLiteral){var K=this._tokens.peek();K.text===":"&&(b.type=V.WORD)}}if(this.start_of_statement(b)?Y(this._flags.last_token,["var","let","const"])&&b.type===V.WORD&&(this._flags.declaration_statement=!0):b.newlines&&!N(this._flags.mode)&&(this._flags.last_token.type!==V.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==V.EQUALS&&(this._options.preserve_newlines||!Y(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(b),this.print_newline()):this.handle_whitespace_and_comments(b),this._flags.do_block&&!this._flags.do_while)if(R(b,"while")){this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0,this._flags.do_while=!0;return}else this.print_newline(),this._flags.do_block=!1;if(this._flags.if_block)if(!this._flags.else_block&&R(b,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===xe.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&Y(b,["case","default"])){this.print_newline(),!this._flags.case_block&&(this._flags.case_body||this._options.jslint_happy)&&this.deindent(),this._flags.case_body=!1,this.print_token(b),this._flags.in_case=!0;return}if((this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR)&&!this.start_of_object_property()&&!(L(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===xe.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(b),R(b,"function")){(L(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(L(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===V.OPERATOR))&&!this._output.just_added_blankline()&&!b.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD?Y(this._flags.last_token,["get","set","new","export"])||Y(this._flags.last_token,S)?this._output.space_before_token=!0:R(this._flags.last_token,"default")&&this._last_last_text==="export"?this._output.space_before_token=!0:this._flags.last_token.text==="declare"?this._output.space_before_token=!0:this.print_newline():this._flags.last_token.type===V.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(N(this._flags.mode)||D(this._flags.mode))||this.print_newline(),this.print_token(b),this._flags.last_word=b.text;return}var le="NONE";if(this._flags.last_token.type===V.END_BLOCK?this._previous_flags.inline_frame?le="SPACE":Y(b,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&b.newlines?le="NEWLINE":(le="SPACE",this._output.space_before_token=!0):le="NEWLINE":this._flags.last_token.type===V.SEMICOLON&&this._flags.mode===xe.BlockStatement?le="NEWLINE":this._flags.last_token.type===V.SEMICOLON&&N(this._flags.mode)?le="SPACE":this._flags.last_token.type===V.STRING?le="NEWLINE":this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD||this._flags.last_token.text==="*"&&(L(this._last_last_text,["function","yield"])||this._flags.mode===xe.ObjectLiteral&&L(this._last_last_text,["{",","]))?le="SPACE":this._flags.last_token.type===V.START_BLOCK?this._flags.inline_frame?le="SPACE":le="NEWLINE":this._flags.last_token.type===V.END_EXPR&&(this._output.space_before_token=!0,le="NEWLINE"),Y(b,M)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?le="SPACE":le="NEWLINE"),Y(b,["else","catch","finally"]))if((!(this._flags.last_token.type===V.END_BLOCK&&this._previous_flags.mode===xe.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&b.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var Ee=this._output.current_line;Ee.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else le==="NEWLINE"?Y(this._flags.last_token,se)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&Y(b,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==V.END_EXPR?(this._flags.last_token.type!==V.START_EXPR||!Y(b,["var","let","const"]))&&this._flags.last_token.text!==":"&&(R(b,"if")&&R(b.previous,"else")?this._output.space_before_token=!0:this.print_newline()):Y(b,M)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&D(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():le==="SPACE"&&(this._output.space_before_token=!0);b.previous&&(b.previous.type===V.WORD||b.previous.type===V.RESERVED)&&(this._output.space_before_token=!0),this.print_token(b),this._flags.last_word=b.text,b.type===V.RESERVED&&(b.text==="do"?this._flags.do_block=!0:b.text==="if"?this._flags.if_block=!0:b.text==="import"?this._flags.import_block=!0:this._flags.import_block&&R(b,"from")&&(this._flags.import_block=!1))},te.prototype.handle_semicolon=function(b){this.start_of_statement(b)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(b);for(var K=this._tokens.peek();this._flags.mode===xe.Statement&&!(this._flags.if_block&&R(K,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(b)},te.prototype.handle_string=function(b){b.text.startsWith("`")&&b.newlines===0&&b.whitespace_before===""&&(b.previous.text===")"||this._flags.last_token.type===V.WORD)||(this.start_of_statement(b)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(b),this._flags.last_token.type===V.RESERVED||this._flags.last_token.type===V.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR||this._flags.last_token.type===V.EQUALS||this._flags.last_token.type===V.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(b):b.text.startsWith("`")&&this._flags.last_token.type===V.END_EXPR&&(b.previous.text==="]"||b.previous.text===")")&&b.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(b)},te.prototype.handle_equals=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0},te.prototype.handle_comma=function(b){this.handle_whitespace_and_comments(b,!0),this.print_token(b),this._output.space_before_token=!0,this._flags.declaration_statement?(N(this._flags.parent.mode)&&(this._flags.declaration_assignment=!1),this._flags.declaration_assignment?(this._flags.declaration_assignment=!1,this.print_newline(!1,!0)):this._options.comma_first&&this.allow_wrap_or_preserved_newline(b)):this._flags.mode===xe.ObjectLiteral||this._flags.mode===xe.Statement&&this._flags.parent.mode===xe.ObjectLiteral?(this._flags.mode===xe.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(b)},te.prototype.handle_operator=function(b){var K=b.text==="*"&&(Y(this._flags.last_token,["function","yield"])||L(this._flags.last_token.type,[V.START_BLOCK,V.COMMA,V.END_BLOCK,V.SEMICOLON])),le=L(b.text,["-","+"])&&(L(this._flags.last_token.type,[V.START_BLOCK,V.START_EXPR,V.EQUALS,V.OPERATOR])||L(this._flags.last_token.text,M)||this._flags.last_token.text===",");if(!this.start_of_statement(b)){var Ee=!K;this.handle_whitespace_and_comments(b,Ee)}if(b.text==="*"&&this._flags.last_token.type===V.DOT){this.print_token(b);return}if(b.text==="::"){this.print_token(b);return}if(L(b.text,["-","+"])&&this.start_of_object_property()){this.print_token(b);return}if(this._flags.last_token.type===V.OPERATOR&&L(this._options.operator_position,Ie)&&this.allow_wrap_or_preserved_newline(b),b.text===":"&&this._flags.in_case){this.print_token(b),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==V.START_BLOCK?(this.indent(),this.print_newline(),this._flags.case_block=!1):(this._flags.case_block=!0,this._output.space_before_token=!0);return}var Ne=!0,Qe=!0,bt=!1;if(b.text===":"?this._flags.ternary_depth===0?Ne=!1:(this._flags.ternary_depth-=1,bt=!0):b.text==="?"&&(this._flags.ternary_depth+=1),!le&&!K&&this._options.preserve_newlines&&L(b.text,j)){var Lt=b.text===":",ti=Lt&&bt,ze=Lt&&!bt;switch(this._options.operator_position){case ye.before_newline:this._output.space_before_token=!ze,this.print_token(b),(!Lt||ti)&&this.allow_wrap_or_preserved_newline(b),this._output.space_before_token=!0;return;case ye.after_newline:this._output.space_before_token=!0,!Lt||ti?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(b):this._output.space_before_token=!1,this.print_token(b),this._output.space_before_token=!0;return;case ye.preserve_newline:ze||this.allow_wrap_or_preserved_newline(b),Ne=!(this._output.just_added_newline()||ze),this._output.space_before_token=Ne,this.print_token(b),this._output.space_before_token=!0;return}}if(K){this.allow_wrap_or_preserved_newline(b),Ne=!1;var Ct=this._tokens.peek();Qe=Ct&&L(Ct.type,[V.WORD,V.RESERVED])}else if(b.text==="...")this.allow_wrap_or_preserved_newline(b),Ne=this._flags.last_token.type===V.START_BLOCK,Qe=!1;else if(L(b.text,["--","++","!","~"])||le){if((this._flags.last_token.type===V.COMMA||this._flags.last_token.type===V.START_EXPR)&&this.allow_wrap_or_preserved_newline(b),Ne=!1,Qe=!1,b.newlines&&(b.text==="--"||b.text==="++"||b.text==="~")){var Ze=Y(this._flags.last_token,se)&&b.newlines;Ze&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(Ze,!0)}this._flags.last_token.text===";"&&N(this._flags.mode)&&(Ne=!0),this._flags.last_token.type===V.RESERVED?Ne=!0:this._flags.last_token.type===V.END_EXPR?Ne=!(this._flags.last_token.text==="]"&&(b.text==="--"||b.text==="++")):this._flags.last_token.type===V.OPERATOR&&(Ne=L(b.text,["--","-","++","+"])&&L(this._flags.last_token.text,["--","-","++","+"]),L(b.text,["+","-"])&&L(this._flags.last_token.text,["--","++"])&&(Qe=!0)),(this._flags.mode===xe.BlockStatement&&!this._flags.inline_frame||this._flags.mode===xe.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Ne,this.print_token(b),this._output.space_before_token=Qe},te.prototype.handle_block_comment=function(b,K){if(this._output.raw){this._output.add_raw_token(b),b.directives&&b.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(b.directives){this.print_newline(!1,K),this.print_token(b),b.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!v.newline.test(b.text)&&!b.newlines){this._output.space_before_token=!0,this.print_token(b),this._output.space_before_token=!0;return}else this.print_block_commment(b,K)},te.prototype.print_block_commment=function(b,K){var le=J(b.text),Ee,Ne=!1,Qe=!1,bt=b.whitespace_before,Lt=bt.length;if(this.print_newline(!1,K),this.print_token_line_indentation(b),this._output.add_token(le[0]),this.print_newline(!1,K),le.length>1){for(le=le.slice(1),Ne=O(le,"*"),Qe=ae(le,bt),Ne&&(this._flags.alignment=1),Ee=0;Ee<le.length;Ee++)Ne?(this.print_token_line_indentation(b),this._output.add_token(I(le[Ee]))):Qe&&le[Ee]?(this.print_token_line_indentation(b),this._output.add_token(le[Ee].substring(Lt))):(this._output.current_line.set_indent(-1),this._output.add_token(le[Ee])),this.print_newline(!1,K);this._flags.alignment=0}},te.prototype.handle_comment=function(b,K){b.newlines?this.print_newline(!1,K):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(b),this.print_newline(!1,K)},te.prototype.handle_dot=function(b){this.start_of_statement(b)||this.handle_whitespace_and_comments(b,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),Y(this._flags.last_token,se)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(b,this._flags.last_token.text===")"&&this._options.break_chained_methods),this._options.unindent_chained_methods&&this._output.just_added_newline()&&this.deindent(),this.print_token(b)},te.prototype.handle_unknown=function(b,K){this.print_token(b),b.text[b.text.length-1]===`
`&&this.print_newline(!1,K)},te.prototype.handle_eof=function(b){for(;this._flags.mode===xe.Statement;)this.restore_mode();this.handle_whitespace_and_comments(b)},oe.exports.Beautifier=te},function(oe){function l(g){this.__parent=g,this.__character_count=0,this.__indent_count=-1,this.__alignment_count=0,this.__wrap_point_index=0,this.__wrap_point_character_count=0,this.__wrap_point_indent_count=-1,this.__wrap_point_alignment_count=0,this.__items=[]}l.prototype.clone_empty=function(){var g=new l(this.__parent);return g.set_indent(this.__indent_count,this.__alignment_count),g},l.prototype.item=function(g){return g<0?this.__items[this.__items.length+g]:this.__items[g]},l.prototype.has_match=function(g){for(var v=this.__items.length-1;v>=0;v--)if(this.__items[v].match(g))return!0;return!1},l.prototype.set_indent=function(g,v){this.is_empty()&&(this.__indent_count=g||0,this.__alignment_count=v||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},l.prototype._set_wrap_point=function(){this.__parent.wrap_line_length&&(this.__wrap_point_index=this.__items.length,this.__wrap_point_character_count=this.__character_count,this.__wrap_point_indent_count=this.__parent.next_line.__indent_count,this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count)},l.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count},l.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var g=this.__parent.current_line;return g.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),g.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),g.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,g.__items[0]===" "&&(g.__items.splice(0,1),g.__character_count-=1),!0}return!1},l.prototype.is_empty=function(){return this.__items.length===0},l.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},l.prototype.push=function(g){this.__items.push(g);var v=g.lastIndexOf(`
`);v!==-1?this.__character_count=g.length-v:this.__character_count+=g.length},l.prototype.pop=function(){var g=null;return this.is_empty()||(g=this.__items.pop(),this.__character_count-=g.length),g},l.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},l.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},l.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},l.prototype.toString=function(){var g="";return this.is_empty()?this.__parent.indent_empty_lines&&(g=this.__parent.get_indent_string(this.__indent_count)):(g=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),g+=this.__items.join("")),g};function Z(g,v){this.__cache=[""],this.__indent_size=g.indent_size,this.__indent_string=g.indent_char,g.indent_with_tabs||(this.__indent_string=new Array(g.indent_size+1).join(g.indent_char)),v=v||"",g.indent_level>0&&(v=new Array(g.indent_level+1).join(this.__indent_string)),this.__base_string=v,this.__base_string_length=v.length}Z.prototype.get_indent_size=function(g,v){var E=this.__base_string_length;return v=v||0,g<0&&(E=0),E+=g*this.__indent_size,E+=v,E},Z.prototype.get_indent_string=function(g,v){var E=this.__base_string;return v=v||0,g<0&&(g=0,E=""),v+=g*this.__indent_size,this.__ensure_cache(v),E+=this.__cache[v],E},Z.prototype.__ensure_cache=function(g){for(;g>=this.__cache.length;)this.__add_column()},Z.prototype.__add_column=function(){var g=this.__cache.length,v=0,E="";this.__indent_size&&g>=this.__indent_size&&(v=Math.floor(g/this.__indent_size),g-=v*this.__indent_size,E=new Array(v+1).join(this.__indent_string)),g&&(E+=new Array(g+1).join(" ")),this.__cache.push(E)};function k(g,v){this.__indent_cache=new Z(g,v),this.raw=!1,this._end_with_newline=g.end_with_newline,this.indent_size=g.indent_size,this.wrap_line_length=g.wrap_line_length,this.indent_empty_lines=g.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new l(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}k.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},k.prototype.get_line_number=function(){return this.__lines.length},k.prototype.get_indent_string=function(g,v){return this.__indent_cache.get_indent_string(g,v)},k.prototype.get_indent_size=function(g,v){return this.__indent_cache.get_indent_size(g,v)},k.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},k.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},k.prototype.get_code=function(g){this.trim(!0);var v=this.current_line.pop();v&&(v[v.length-1]===`
`&&(v=v.replace(/\n+$/g,"")),this.current_line.push(v)),this._end_with_newline&&this.__add_outputline();var E=this.__lines.join(`
`);return g!==`
`&&(E=E.replace(/[\n]/g,g)),E},k.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},k.prototype.set_indent=function(g,v){return g=g||0,v=v||0,this.next_line.set_indent(g,v),this.__lines.length>1?(this.current_line.set_indent(g,v),!0):(this.current_line.set_indent(),!1)},k.prototype.add_raw_token=function(g){for(var v=0;v<g.newlines;v++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(g.whitespace_before),this.current_line.push(g.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},k.prototype.add_token=function(g){this.__add_space_before_token(),this.current_line.push(g),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},k.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},k.prototype.remove_indent=function(g){for(var v=this.__lines.length;g<v;)this.__lines[g]._remove_indent(),g++;this.current_line._remove_wrap_indent()},k.prototype.trim=function(g){for(g=g===void 0?!1:g,this.current_line.trim();g&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},k.prototype.just_added_newline=function(){return this.current_line.is_empty()},k.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},k.prototype.ensure_empty_line_above=function(g,v){for(var E=this.__lines.length-2;E>=0;){var A=this.__lines[E];if(A.is_empty())break;if(A.item(0).indexOf(g)!==0&&A.item(-1)!==v){this.__lines.splice(E+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}E--}},oe.exports.Output=k},function(oe){function l(Z,k,g,v){this.type=Z,this.text=k,this.comments_before=null,this.newlines=g||0,this.whitespace_before=v||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}oe.exports.Token=l},function(oe,l){var Z="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",k="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",g="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc",v="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f",E="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",A="(?:"+E+"|["+Z+g+"])",M="(?:"+E+"|["+k+g+v+"])*";l.identifier=new RegExp(A+M,"g"),l.identifierStart=new RegExp(A),l.identifierMatch=new RegExp("(?:"+E+"|["+k+g+v+"])+");var j=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;l.newline=/[\n\r\u2028\u2029]/,l.lineBreak=new RegExp(`\r
|`+l.newline.source),l.allLineBreaks=new RegExp(l.lineBreak.source,"g")},function(oe,l,Z){var k=Z(6).Options,g=["before-newline","after-newline","preserve-newline"];function v(E){k.call(this,E,"js");var A=this.raw_options.brace_style||null;A==="expand-strict"?this.raw_options.brace_style="expand":A==="collapse-preserve-inline"?this.raw_options.brace_style="collapse,preserve-inline":this.raw_options.braces_on_own_line!==void 0&&(this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse");var M=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var j=0;j<M.length;j++)M[j]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=M[j];this.unindent_chained_methods=this._get_boolean("unindent_chained_methods"),this.break_chained_methods=this._get_boolean("break_chained_methods"),this.space_in_paren=this._get_boolean("space_in_paren"),this.space_in_empty_paren=this._get_boolean("space_in_empty_paren"),this.jslint_happy=this._get_boolean("jslint_happy"),this.space_after_anon_function=this._get_boolean("space_after_anon_function"),this.space_after_named_function=this._get_boolean("space_after_named_function"),this.keep_array_indentation=this._get_boolean("keep_array_indentation"),this.space_before_conditional=this._get_boolean("space_before_conditional",!0),this.unescape_strings=this._get_boolean("unescape_strings"),this.e4x=this._get_boolean("e4x"),this.comma_first=this._get_boolean("comma_first"),this.operator_position=this._get_selection("operator_position",g),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}v.prototype=new k,oe.exports.Options=v},function(oe){function l(g,v){this.raw_options=Z(g,v),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(g,v){var E=this.raw_options[g],A=v||[];return typeof E=="object"?E!==null&&typeof E.concat=="function"&&(A=E.concat()):typeof E=="string"&&(A=E.split(/[^a-zA-Z0-9_\/\-]+/)),A},l.prototype._get_boolean=function(g,v){var E=this.raw_options[g],A=E===void 0?!!v:!!E;return A},l.prototype._get_characters=function(g,v){var E=this.raw_options[g],A=v||"";return typeof E=="string"&&(A=E.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),A},l.prototype._get_number=function(g,v){var E=this.raw_options[g];v=parseInt(v,10),isNaN(v)&&(v=0);var A=parseInt(E,10);return isNaN(A)&&(A=v),A},l.prototype._get_selection=function(g,v,E){var A=this._get_selection_list(g,v,E);if(A.length!==1)throw new Error("Invalid Option Value: The option '"+g+`' can only be one of the following values:
`+v+`
You passed in: '`+this.raw_options[g]+"'");return A[0]},l.prototype._get_selection_list=function(g,v,E){if(!v||v.length===0)throw new Error("Selection list cannot be empty.");if(E=E||[v[0]],!this._is_valid_selection(E,v))throw new Error("Invalid Default Value!");var A=this._get_array(g,E);if(!this._is_valid_selection(A,v))throw new Error("Invalid Option Value: The option '"+g+`' can contain only the following values:
`+v+`
You passed in: '`+this.raw_options[g]+"'");return A},l.prototype._is_valid_selection=function(g,v){return g.length&&v.length&&!g.some(function(E){return v.indexOf(E)===-1})};function Z(g,v){var E={};g=k(g);var A;for(A in g)A!==v&&(E[A]=g[A]);if(v&&g[v])for(A in g[v])E[A]=g[v][A];return E}function k(g){var v={},E;for(E in g){var A=E.replace(/-/g,"_");v[A]=g[E]}return v}oe.exports.Options=l,oe.exports.normalizeOpts=k,oe.exports.mergeOpts=Z},function(oe,l,Z){var k=Z(8).InputScanner,g=Z(9).Tokenizer,v=Z(9).TOKEN,E=Z(13).Directives,A=Z(4),M=Z(12).Pattern,j=Z(14).TemplatablePattern;function V(O,ae){return ae.indexOf(O)!==-1}var L={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:v.START,RAW:v.RAW,EOF:v.EOF},I=new E(/\/\*/,/\*\//),w=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,R=/[0-9]/,Y=/[^\d\.]/,se=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),ne=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";ne=ne.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),ne="\\?\\.(?!\\d) "+ne,ne=ne.replace(/ /g,"|");var ye=new RegExp(ne),Ie="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),xe=Ie.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),$e=new RegExp("^(?:"+xe.join("|")+")$"),J,D=function(O,ae){g.call(this,O,ae),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var te=new M(this._input),S=new j(this._input).read_options(this._options);this.__patterns={template:S,identifier:S.starting_with(A.identifier).matching(A.identifierMatch),number:te.matching(w),punct:te.matching(ye),comment:te.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:te.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:te.matching(/<!--/),html_comment_end:te.matching(/-->/),include:te.starting_with(/#include/).until_after(A.lineBreak),shebang:te.starting_with(/#!/).until_after(A.lineBreak),xml:te.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[^}]+?}|!\[CDATA\[[^\]]*?\]\]|)(\s*{[^}]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{([^{}]|{[^}]+?})+?}))*\s*(\/?)\s*>/),single_quote:S.until(/['\\\n\r\u2028\u2029]/),double_quote:S.until(/["\\\n\r\u2028\u2029]/),template_text:S.until(/[`\\$]/),template_expression:S.until(/[`}\\]/)}};D.prototype=new g,D.prototype._is_comment=function(O){return O.type===L.COMMENT||O.type===L.BLOCK_COMMENT||O.type===L.UNKNOWN},D.prototype._is_opening=function(O){return O.type===L.START_BLOCK||O.type===L.START_EXPR},D.prototype._is_closing=function(O,ae){return(O.type===L.END_BLOCK||O.type===L.END_EXPR)&&ae&&(O.text==="]"&&ae.text==="["||O.text===")"&&ae.text==="("||O.text==="}"&&ae.text==="{")},D.prototype._reset=function(){J=!1},D.prototype._get_next_token=function(O,ae){var te=null;this._readWhitespace();var S=this._input.peek();return S===null?this._create_token(L.EOF,""):(te=te||this._read_non_javascript(S),te=te||this._read_string(S),te=te||this._read_pair(S,this._input.peek(1)),te=te||this._read_word(O),te=te||this._read_singles(S),te=te||this._read_comment(S),te=te||this._read_regexp(S,O),te=te||this._read_xml(S,O),te=te||this._read_punctuation(),te=te||this._create_token(L.UNKNOWN,this._input.next()),te)},D.prototype._read_word=function(O){var ae;if(ae=this.__patterns.identifier.read(),ae!=="")return ae=ae.replace(A.allLineBreaks,`
`),!(O.type===L.DOT||O.type===L.RESERVED&&(O.text==="set"||O.text==="get"))&&$e.test(ae)?(ae==="in"||ae==="of")&&(O.type===L.WORD||O.type===L.STRING)?this._create_token(L.OPERATOR,ae):this._create_token(L.RESERVED,ae):this._create_token(L.WORD,ae);if(ae=this.__patterns.number.read(),ae!=="")return this._create_token(L.WORD,ae)},D.prototype._read_singles=function(O){var ae=null;return O==="("||O==="["?ae=this._create_token(L.START_EXPR,O):O===")"||O==="]"?ae=this._create_token(L.END_EXPR,O):O==="{"?ae=this._create_token(L.START_BLOCK,O):O==="}"?ae=this._create_token(L.END_BLOCK,O):O===";"?ae=this._create_token(L.SEMICOLON,O):O==="."&&Y.test(this._input.peek(1))?ae=this._create_token(L.DOT,O):O===","&&(ae=this._create_token(L.COMMA,O)),ae&&this._input.next(),ae},D.prototype._read_pair=function(O,ae){var te=null;return O==="#"&&ae==="{"&&(te=this._create_token(L.START_BLOCK,O+ae)),te&&(this._input.next(),this._input.next()),te},D.prototype._read_punctuation=function(){var O=this.__patterns.punct.read();if(O!=="")return O==="="?this._create_token(L.EQUALS,O):O==="?."?this._create_token(L.DOT,O):this._create_token(L.OPERATOR,O)},D.prototype._read_non_javascript=function(O){var ae="";if(O==="#"){if(this._is_first_token()&&(ae=this.__patterns.shebang.read(),ae))return this._create_token(L.UNKNOWN,ae.trim()+`
`);if(ae=this.__patterns.include.read(),ae)return this._create_token(L.UNKNOWN,ae.trim()+`
`);O=this._input.next();var te="#";if(this._input.hasNext()&&this._input.testChar(R)){do O=this._input.next(),te+=O;while(this._input.hasNext()&&O!=="#"&&O!=="=");return O==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(te+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(te+="{}",this._input.next(),this._input.next())),this._create_token(L.WORD,te)}this._input.back()}else if(O==="<"&&this._is_first_token()){if(ae=this.__patterns.html_comment_start.read(),ae){for(;this._input.hasNext()&&!this._input.testChar(A.newline);)ae+=this._input.next();return J=!0,this._create_token(L.COMMENT,ae)}}else if(J&&O==="-"&&(ae=this.__patterns.html_comment_end.read(),ae))return J=!1,this._create_token(L.COMMENT,ae);return null},D.prototype._read_comment=function(O){var ae=null;if(O==="/"){var te="";if(this._input.peek(1)==="*"){te=this.__patterns.block_comment.read();var S=I.get_directives(te);S&&S.ignore==="start"&&(te+=I.readIgnored(this._input)),te=te.replace(A.allLineBreaks,`
`),ae=this._create_token(L.BLOCK_COMMENT,te),ae.directives=S}else this._input.peek(1)==="/"&&(te=this.__patterns.comment.read(),ae=this._create_token(L.COMMENT,te))}return ae},D.prototype._read_string=function(O){if(O==="`"||O==="'"||O==='"'){var ae=this._input.next();return this.has_char_escapes=!1,O==="`"?ae+=this._read_string_recursive("`",!0,"${"):ae+=this._read_string_recursive(O),this.has_char_escapes&&this._options.unescape_strings&&(ae=N(ae)),this._input.peek()===O&&(ae+=this._input.next()),ae=ae.replace(A.allLineBreaks,`
`),this._create_token(L.STRING,ae)}return null},D.prototype._allow_regexp_or_xml=function(O){return O.type===L.RESERVED&&V(O.text,["return","case","throw","else","do","typeof","yield"])||O.type===L.END_EXPR&&O.text===")"&&O.opened.previous.type===L.RESERVED&&V(O.opened.previous.text,["if","while","for"])||V(O.type,[L.COMMENT,L.START_EXPR,L.START_BLOCK,L.START,L.END_BLOCK,L.OPERATOR,L.EQUALS,L.EOF,L.SEMICOLON,L.COMMA])},D.prototype._read_regexp=function(O,ae){if(O==="/"&&this._allow_regexp_or_xml(ae)){for(var te=this._input.next(),S=!1,b=!1;this._input.hasNext()&&(S||b||this._input.peek()!==O)&&!this._input.testChar(A.newline);)te+=this._input.peek(),S?S=!1:(S=this._input.peek()==="\\",this._input.peek()==="["?b=!0:this._input.peek()==="]"&&(b=!1)),this._input.next();return this._input.peek()===O&&(te+=this._input.next(),te+=this._input.read(A.identifier)),this._create_token(L.STRING,te)}return null},D.prototype._read_xml=function(O,ae){if(this._options.e4x&&O==="<"&&this._allow_regexp_or_xml(ae)){var te="",S=this.__patterns.xml.read_match();if(S){for(var b=S[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),K=b.indexOf("{")===0,le=0;S;){var Ee=!!S[1],Ne=S[2],Qe=!!S[S.length-1]||Ne.slice(0,8)==="![CDATA[";if(!Qe&&(Ne===b||K&&Ne.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Ee?--le:++le),te+=S[0],le<=0)break;S=this.__patterns.xml.read_match()}return S||(te+=this._input.match(/[\s\S]*/g)[0]),te=te.replace(A.allLineBreaks,`
`),this._create_token(L.STRING,te)}}return null};function N(O){for(var ae="",te=0,S=new k(O),b=null;S.hasNext();)if(b=S.match(/([\s]|[^\\]|\\\\)+/g),b&&(ae+=b[0]),S.peek()==="\\"){if(S.next(),S.peek()==="x")b=S.match(/x([0-9A-Fa-f]{2})/g);else if(S.peek()==="u")b=S.match(/u([0-9A-Fa-f]{4})/g),b||(b=S.match(/u\{([0-9A-Fa-f]+)\}/g));else{ae+="\\",S.hasNext()&&(ae+=S.next());continue}if(!b||(te=parseInt(b[1],16),te>126&&te<=255&&b[0].indexOf("x")===0))return O;te>=0&&te<32||te>1114111?ae+="\\"+b[0]:te===34||te===39||te===92?ae+="\\"+String.fromCharCode(te):ae+=String.fromCharCode(te)}return ae}D.prototype._read_string_recursive=function(O,ae,te){var S,b;O==="'"?b=this.__patterns.single_quote:O==='"'?b=this.__patterns.double_quote:O==="`"?b=this.__patterns.template_text:O==="}"&&(b=this.__patterns.template_expression);for(var K=b.read(),le="";this._input.hasNext();){if(le=this._input.next(),le===O||!ae&&A.newline.test(le)){this._input.back();break}else le==="\\"&&this._input.hasNext()?(S=this._input.peek(),S==="x"||S==="u"?this.has_char_escapes=!0:S==="\r"&&this._input.peek(1)===`
`&&this._input.next(),le+=this._input.next()):te&&(te==="${"&&le==="$"&&this._input.peek()==="{"&&(le+=this._input.next()),te===le&&(O==="`"?le+=this._read_string_recursive("}",ae,"`"):le+=this._read_string_recursive("`",ae,"${"),this._input.hasNext()&&(le+=this._input.next())));le+=b.read(),K+=le}return K},oe.exports.Tokenizer=D,oe.exports.TOKEN=L,oe.exports.positionable_operators=se.slice(),oe.exports.line_starters=Ie.slice()},function(oe){var l=RegExp.prototype.hasOwnProperty("sticky");function Z(k){this.__input=k||"",this.__input_length=this.__input.length,this.__position=0}Z.prototype.restart=function(){this.__position=0},Z.prototype.back=function(){this.__position>0&&(this.__position-=1)},Z.prototype.hasNext=function(){return this.__position<this.__input_length},Z.prototype.next=function(){var k=null;return this.hasNext()&&(k=this.__input.charAt(this.__position),this.__position+=1),k},Z.prototype.peek=function(k){var g=null;return k=k||0,k+=this.__position,k>=0&&k<this.__input_length&&(g=this.__input.charAt(k)),g},Z.prototype.__match=function(k,g){k.lastIndex=g;var v=k.exec(this.__input);return v&&!(l&&k.sticky)&&v.index!==g&&(v=null),v},Z.prototype.test=function(k,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(k,g):!1},Z.prototype.testChar=function(k,g){var v=this.peek(g);return k.lastIndex=0,v!==null&&k.test(v)},Z.prototype.match=function(k){var g=this.__match(k,this.__position);return g?this.__position+=g[0].length:g=null,g},Z.prototype.read=function(k,g,v){var E="",A;return k&&(A=this.match(k),A&&(E+=A[0])),g&&(A||!k)&&(E+=this.readUntil(g,v)),E},Z.prototype.readUntil=function(k,g){var v="",E=this.__position;k.lastIndex=this.__position;var A=k.exec(this.__input);return A?(E=A.index,g&&(E+=A[0].length)):E=this.__input_length,v=this.__input.substring(this.__position,E),this.__position=E,v},Z.prototype.readUntilAfter=function(k){return this.readUntil(k,!0)},Z.prototype.get_regexp=function(k,g){var v=null,E="g";return g&&l&&(E="y"),typeof k=="string"&&k!==""?v=new RegExp(k,E):k&&(v=new RegExp(k.source,E)),v},Z.prototype.get_literal_regexp=function(k){return RegExp(k.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},Z.prototype.peekUntilAfter=function(k){var g=this.__position,v=this.readUntilAfter(k);return this.__position=g,v},Z.prototype.lookBack=function(k){var g=this.__position-1;return g>=k.length&&this.__input.substring(g-k.length,g).toLowerCase()===k},oe.exports.InputScanner=Z},function(oe,l,Z){var k=Z(8).InputScanner,g=Z(3).Token,v=Z(10).TokenStream,E=Z(11).WhitespacePattern,A={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},M=function(j,V){this._input=new k(j),this._options=V||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new E(this._input)};M.prototype.tokenize=function(){this._input.restart(),this.__tokens=new v,this._reset();for(var j,V=new g(A.START,""),L=null,I=[],w=new v;V.type!==A.EOF;){for(j=this._get_next_token(V,L);this._is_comment(j);)w.add(j),j=this._get_next_token(V,L);w.isEmpty()||(j.comments_before=w,w=new v),j.parent=L,this._is_opening(j)?(I.push(L),L=j):L&&this._is_closing(j,L)&&(j.opened=L,L.closed=j,L=I.pop(),j.parent=L),j.previous=V,V.next=j,this.__tokens.add(j),V=j}return this.__tokens},M.prototype._is_first_token=function(){return this.__tokens.isEmpty()},M.prototype._reset=function(){},M.prototype._get_next_token=function(j,V){this._readWhitespace();var L=this._input.read(/.+/g);return L?this._create_token(A.RAW,L):this._create_token(A.EOF,"")},M.prototype._is_comment=function(j){return!1},M.prototype._is_opening=function(j){return!1},M.prototype._is_closing=function(j,V){return!1},M.prototype._create_token=function(j,V){var L=new g(j,V,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return L},M.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},oe.exports.Tokenizer=M,oe.exports.TOKEN=A},function(oe){function l(Z){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=Z}l.prototype.restart=function(){this.__position=0},l.prototype.isEmpty=function(){return this.__tokens_length===0},l.prototype.hasNext=function(){return this.__position<this.__tokens_length},l.prototype.next=function(){var Z=null;return this.hasNext()&&(Z=this.__tokens[this.__position],this.__position+=1),Z},l.prototype.peek=function(Z){var k=null;return Z=Z||0,Z+=this.__position,Z>=0&&Z<this.__tokens_length&&(k=this.__tokens[Z]),k},l.prototype.add=function(Z){this.__parent_token&&(Z.parent=this.__parent_token),this.__tokens.push(Z),this.__tokens_length+=1},oe.exports.TokenStream=l},function(oe,l,Z){var k=Z(12).Pattern;function g(v,E){k.call(this,v,E),E?this._line_regexp=this._input.get_regexp(E._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}g.prototype=new k,g.prototype.__set_whitespace_patterns=function(v,E){v+="\\t ",E+="\\n\\r",this._match_pattern=this._input.get_regexp("["+v+E+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+E+"]")},g.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var v=this._input.read(this._match_pattern);if(v===" ")this.whitespace_before_token=" ";else if(v){var E=this.__split(this._newline_regexp,v);this.newline_count=E.length-1,this.whitespace_before_token=E[this.newline_count]}return v},g.prototype.matching=function(v,E){var A=this._create();return A.__set_whitespace_patterns(v,E),A._update(),A},g.prototype._create=function(){return new g(this._input,this)},g.prototype.__split=function(v,E){v.lastIndex=0;for(var A=0,M=[],j=v.exec(E);j;)M.push(E.substring(A,j.index)),A=j.index+j[0].length,j=v.exec(E);return A<E.length?M.push(E.substring(A,E.length)):M.push(""),M},oe.exports.WhitespacePattern=g},function(oe){function l(Z,k){this._input=Z,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,k&&(this._starting_pattern=this._input.get_regexp(k._starting_pattern,!0),this._match_pattern=this._input.get_regexp(k._match_pattern,!0),this._until_pattern=this._input.get_regexp(k._until_pattern),this._until_after=k._until_after)}l.prototype.read=function(){var Z=this._input.read(this._starting_pattern);return(!this._starting_pattern||Z)&&(Z+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),Z},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function(Z){var k=this._create();return k._until_after=!0,k._until_pattern=this._input.get_regexp(Z),k._update(),k},l.prototype.until=function(Z){var k=this._create();return k._until_after=!1,k._until_pattern=this._input.get_regexp(Z),k._update(),k},l.prototype.starting_with=function(Z){var k=this._create();return k._starting_pattern=this._input.get_regexp(Z,!0),k._update(),k},l.prototype.matching=function(Z){var k=this._create();return k._match_pattern=this._input.get_regexp(Z,!0),k._update(),k},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},oe.exports.Pattern=l},function(oe){function l(Z,k){Z=typeof Z=="string"?Z:Z.source,k=typeof k=="string"?k:k.source,this.__directives_block_pattern=new RegExp(Z+/ beautify( \w+[:]\w+)+ /.source+k,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(Z+/\sbeautify\signore:end\s/.source+k,"g")}l.prototype.get_directives=function(Z){if(!Z.match(this.__directives_block_pattern))return null;var k={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(Z);g;)k[g[1]]=g[2],g=this.__directive_pattern.exec(Z);return k},l.prototype.readIgnored=function(Z){return Z.readUntilAfter(this.__directives_end_ignore_pattern)},oe.exports.Directives=l},function(oe,l,Z){var k=Z(12).Pattern,g={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function v(E,A){k.call(this,E,A),this.__template_pattern=null,this._disabled=Object.assign({},g),this._excluded=Object.assign({},g),A&&(this.__template_pattern=this._input.get_regexp(A.__template_pattern),this._excluded=Object.assign(this._excluded,A._excluded),this._disabled=Object.assign(this._disabled,A._disabled));var M=new k(E);this.__patterns={handlebars_comment:M.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:M.starting_with(/{{{/).until_after(/}}}/),handlebars:M.starting_with(/{{/).until_after(/}}/),php:M.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:M.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:M.starting_with(/{%/).until_after(/%}/),django_value:M.starting_with(/{{/).until_after(/}}/),django_comment:M.starting_with(/{#/).until_after(/#}/),smarty:M.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:M.starting_with(/{\*/).until_after(/\*}/),smarty_literal:M.starting_with(/{literal}/).until_after(/{\/literal}/)}}v.prototype=new k,v.prototype._create=function(){return new v(this._input,this)},v.prototype._update=function(){this.__set_templated_pattern()},v.prototype.disable=function(E){var A=this._create();return A._disabled[E]=!0,A._update(),A},v.prototype.read_options=function(E){var A=this._create();for(var M in g)A._disabled[M]=E.templating.indexOf(M)===-1;return A._update(),A},v.prototype.exclude=function(E){var A=this._create();return A._excluded[E]=!0,A._update(),A},v.prototype.read=function(){var E="";this._match_pattern?E=this._input.read(this._starting_pattern):E=this._input.read(this._starting_pattern,this.__template_pattern);for(var A=this._read_template();A;)this._match_pattern?A+=this._input.read(this._match_pattern):A+=this._input.readUntil(this.__template_pattern),E+=A,A=this._read_template();return this._until_after&&(E+=this._input.readUntilAfter(this._until_pattern)),E},v.prototype.__set_templated_pattern=function(){var E=[];this._disabled.php||E.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||E.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||E.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||E.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(E.push(this.__patterns.django._starting_pattern.source),E.push(this.__patterns.django_value._starting_pattern.source),E.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||E.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&E.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+E.join("|")+")")},v.prototype._read_template=function(){var E="",A=this._input.peek();if(A==="<"){var M=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&M==="?"&&(E=E||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&M==="%"&&(E=E||this.__patterns.erb.read())}else A==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(E=E||this.__patterns.handlebars_comment.read(),E=E||this.__patterns.handlebars_unescaped.read(),E=E||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(E=E||this.__patterns.django_value.read()),this._excluded.django||(E=E||this.__patterns.django_comment.read(),E=E||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(E=E||this.__patterns.smarty_comment.read(),E=E||this.__patterns.smarty_literal.read(),E=E||this.__patterns.smarty.read()));return E},oe.exports.TemplatablePattern=v}],G={};function p(oe){var l=G[oe];if(l!==void 0)return l.exports;var Z=G[oe]={exports:{}};return ue[oe](Z,Z.exports,p),Z.exports}var ve=p(0);pe=ve})();var Se=pe;U=[],F=function(){return{js_beautify:Se}}.apply(nt,U),F!==void 0&&(Zt.exports=F)})()},75918:function(Zt,nt,U){"use strict";U.d(nt,{Wi:function(){return p},Z0:function(){return ve},aU:function(){return G},eZ:function(){return l},wY:function(){return oe}});var F=U(4348),pe=U(69323),Se=U(13268),ue=function(Z,k,g,v){function E(A){return A instanceof g?A:new g(function(M){M(A)})}return new(g||(g=Promise))(function(A,M){function j(I){try{L(v.next(I))}catch(w){M(w)}}function V(I){try{L(v.throw(I))}catch(w){M(w)}}function L(I){I.done?A(I.value):E(I.value).then(j,V)}L((v=v.apply(Z,k||[])).next())})};class G extends pe.JT{constructor(k,g="",v="",E=!0,A){super(),this._onDidChange=this._register(new F.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=k,this._label=g,this._cssClass=v,this._enabled=E,this._actionCallback=A}get id(){return this._id}get label(){return this._label}set label(k){this._setLabel(k)}_setLabel(k){this._label!==k&&(this._label=k,this._onDidChange.fire({label:k}))}get tooltip(){return this._tooltip||""}set tooltip(k){this._setTooltip(k)}_setTooltip(k){this._tooltip!==k&&(this._tooltip=k,this._onDidChange.fire({tooltip:k}))}get class(){return this._cssClass}set class(k){this._setClass(k)}_setClass(k){this._cssClass!==k&&(this._cssClass=k,this._onDidChange.fire({class:k}))}get enabled(){return this._enabled}set enabled(k){this._setEnabled(k)}_setEnabled(k){this._enabled!==k&&(this._enabled=k,this._onDidChange.fire({enabled:k}))}get checked(){return this._checked}set checked(k){this._setChecked(k)}_setChecked(k){this._checked!==k&&(this._checked=k,this._onDidChange.fire({checked:k}))}run(k,g){return ue(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(k))})}}class p extends pe.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new F.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new F.Q5),this.onDidRun=this._onDidRun.event}run(k,g){return ue(this,void 0,void 0,function*(){if(!k.enabled)return;this._onBeforeRun.fire({action:k});let v;try{yield this.runAction(k,g)}catch(E){v=E}this._onDidRun.fire({action:k,error:v})})}runAction(k,g){return ue(this,void 0,void 0,function*(){yield k.run(g)})}}class ve extends G{constructor(k){super(ve.ID,k,k?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ve.ID="vs.actions.separator";class oe{constructor(k,g,v,E){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=k,this.label=g,this.class=E,this._actions=v}get actions(){return this._actions}dispose(){}run(){return ue(this,void 0,void 0,function*(){})}}class l extends G{constructor(){super(l.ID,Se.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Zt,nt,U){"use strict";U.d(nt,{ok:function(){return F}});function F(pe,Se){if(!pe)throw new Error(Se?`Assertion failed (${Se})`:"Assertion Failed")}},52615:function(Zt,nt,U){"use strict";U.d(nt,{CM:function(){return G},JL:function(){return p},dT:function(){return oe},fK:function(){return ue},lA:function(){return ve}});var F=U(4348);class pe{constructor(){this._icons=new Map,this._onDidRegister=new F.Q5}add(Z){const k=this._icons.get(Z.id);k?Z.description?k.description=Z.description:console.error(`Duplicate registration of codicon ${Z.id}`):(this._icons.set(Z.id,Z),this._onDidRegister.fire(Z))}get(Z){return this._icons.get(Z)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Se=new pe,ue=Se;function G(l,Z){return new ve(l,Z)}function p(l){return l?l.replace(/\$\((.*?)\)/g,(Z,k)=>` ${k} `).trim():""}class ve{constructor(Z,k,g){this.id=Z,this.definition=k,this.description=g,Se.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var oe;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const Z=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function k(E){if(E instanceof ve)return["codicon","codicon-"+E.id];const A=Z.exec(E.id);if(!A)return k(ve.error);let[,M,j]=A;const V=["codicon","codicon-"+M];return j&&V.push("codicon-modifier-"+j.substr(1)),V}l.asClassNameArray=k;function g(E){return k(E).join(" ")}l.asClassName=g;function v(E){return"."+k(E).join(".")}l.asCSSSelector=v})(oe||(oe={})),function(l){l.add=new l("add",{fontCharacter:"\\ea60"}),l.plus=new l("plus",l.add.definition),l.gistNew=new l("gist-new",l.add.definition),l.repoCreate=new l("repo-create",l.add.definition),l.lightbulb=new l("lightbulb",{fontCharacter:"\\ea61"}),l.lightBulb=new l("light-bulb",{fontCharacter:"\\ea61"}),l.repo=new l("repo",{fontCharacter:"\\ea62"}),l.repoDelete=new l("repo-delete",{fontCharacter:"\\ea62"}),l.gistFork=new l("gist-fork",{fontCharacter:"\\ea63"}),l.repoForked=new l("repo-forked",{fontCharacter:"\\ea63"}),l.gitPullRequest=new l("git-pull-request",{fontCharacter:"\\ea64"}),l.gitPullRequestAbandoned=new l("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),l.recordKeys=new l("record-keys",{fontCharacter:"\\ea65"}),l.keyboard=new l("keyboard",{fontCharacter:"\\ea65"}),l.tag=new l("tag",{fontCharacter:"\\ea66"}),l.tagAdd=new l("tag-add",{fontCharacter:"\\ea66"}),l.tagRemove=new l("tag-remove",{fontCharacter:"\\ea66"}),l.person=new l("person",{fontCharacter:"\\ea67"}),l.personFollow=new l("person-follow",{fontCharacter:"\\ea67"}),l.personOutline=new l("person-outline",{fontCharacter:"\\ea67"}),l.personFilled=new l("person-filled",{fontCharacter:"\\ea67"}),l.gitBranch=new l("git-branch",{fontCharacter:"\\ea68"}),l.gitBranchCreate=new l("git-branch-create",{fontCharacter:"\\ea68"}),l.gitBranchDelete=new l("git-branch-delete",{fontCharacter:"\\ea68"}),l.sourceControl=new l("source-control",{fontCharacter:"\\ea68"}),l.mirror=new l("mirror",{fontCharacter:"\\ea69"}),l.mirrorPublic=new l("mirror-public",{fontCharacter:"\\ea69"}),l.star=new l("star",{fontCharacter:"\\ea6a"}),l.starAdd=new l("star-add",{fontCharacter:"\\ea6a"}),l.starDelete=new l("star-delete",{fontCharacter:"\\ea6a"}),l.starEmpty=new l("star-empty",{fontCharacter:"\\ea6a"}),l.comment=new l("comment",{fontCharacter:"\\ea6b"}),l.commentAdd=new l("comment-add",{fontCharacter:"\\ea6b"}),l.alert=new l("alert",{fontCharacter:"\\ea6c"}),l.warning=new l("warning",{fontCharacter:"\\ea6c"}),l.search=new l("search",{fontCharacter:"\\ea6d"}),l.searchSave=new l("search-save",{fontCharacter:"\\ea6d"}),l.logOut=new l("log-out",{fontCharacter:"\\ea6e"}),l.signOut=new l("sign-out",{fontCharacter:"\\ea6e"}),l.logIn=new l("log-in",{fontCharacter:"\\ea6f"}),l.signIn=new l("sign-in",{fontCharacter:"\\ea6f"}),l.eye=new l("eye",{fontCharacter:"\\ea70"}),l.eyeUnwatch=new l("eye-unwatch",{fontCharacter:"\\ea70"}),l.eyeWatch=new l("eye-watch",{fontCharacter:"\\ea70"}),l.circleFilled=new l("circle-filled",{fontCharacter:"\\ea71"}),l.primitiveDot=new l("primitive-dot",{fontCharacter:"\\ea71"}),l.closeDirty=new l("close-dirty",{fontCharacter:"\\ea71"}),l.debugBreakpoint=new l("debug-breakpoint",{fontCharacter:"\\ea71"}),l.debugBreakpointDisabled=new l("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),l.debugHint=new l("debug-hint",{fontCharacter:"\\ea71"}),l.primitiveSquare=new l("primitive-square",{fontCharacter:"\\ea72"}),l.edit=new l("edit",{fontCharacter:"\\ea73"}),l.pencil=new l("pencil",{fontCharacter:"\\ea73"}),l.info=new l("info",{fontCharacter:"\\ea74"}),l.issueOpened=new l("issue-opened",{fontCharacter:"\\ea74"}),l.gistPrivate=new l("gist-private",{fontCharacter:"\\ea75"}),l.gitForkPrivate=new l("git-fork-private",{fontCharacter:"\\ea75"}),l.lock=new l("lock",{fontCharacter:"\\ea75"}),l.mirrorPrivate=new l("mirror-private",{fontCharacter:"\\ea75"}),l.close=new l("close",{fontCharacter:"\\ea76"}),l.removeClose=new l("remove-close",{fontCharacter:"\\ea76"}),l.x=new l("x",{fontCharacter:"\\ea76"}),l.repoSync=new l("repo-sync",{fontCharacter:"\\ea77"}),l.sync=new l("sync",{fontCharacter:"\\ea77"}),l.clone=new l("clone",{fontCharacter:"\\ea78"}),l.desktopDownload=new l("desktop-download",{fontCharacter:"\\ea78"}),l.beaker=new l("beaker",{fontCharacter:"\\ea79"}),l.microscope=new l("microscope",{fontCharacter:"\\ea79"}),l.vm=new l("vm",{fontCharacter:"\\ea7a"}),l.deviceDesktop=new l("device-desktop",{fontCharacter:"\\ea7a"}),l.file=new l("file",{fontCharacter:"\\ea7b"}),l.fileText=new l("file-text",{fontCharacter:"\\ea7b"}),l.more=new l("more",{fontCharacter:"\\ea7c"}),l.ellipsis=new l("ellipsis",{fontCharacter:"\\ea7c"}),l.kebabHorizontal=new l("kebab-horizontal",{fontCharacter:"\\ea7c"}),l.mailReply=new l("mail-reply",{fontCharacter:"\\ea7d"}),l.reply=new l("reply",{fontCharacter:"\\ea7d"}),l.organization=new l("organization",{fontCharacter:"\\ea7e"}),l.organizationFilled=new l("organization-filled",{fontCharacter:"\\ea7e"}),l.organizationOutline=new l("organization-outline",{fontCharacter:"\\ea7e"}),l.newFile=new l("new-file",{fontCharacter:"\\ea7f"}),l.fileAdd=new l("file-add",{fontCharacter:"\\ea7f"}),l.newFolder=new l("new-folder",{fontCharacter:"\\ea80"}),l.fileDirectoryCreate=new l("file-directory-create",{fontCharacter:"\\ea80"}),l.trash=new l("trash",{fontCharacter:"\\ea81"}),l.trashcan=new l("trashcan",{fontCharacter:"\\ea81"}),l.history=new l("history",{fontCharacter:"\\ea82"}),l.clock=new l("clock",{fontCharacter:"\\ea82"}),l.folder=new l("folder",{fontCharacter:"\\ea83"}),l.fileDirectory=new l("file-directory",{fontCharacter:"\\ea83"}),l.symbolFolder=new l("symbol-folder",{fontCharacter:"\\ea83"}),l.logoGithub=new l("logo-github",{fontCharacter:"\\ea84"}),l.markGithub=new l("mark-github",{fontCharacter:"\\ea84"}),l.github=new l("github",{fontCharacter:"\\ea84"}),l.terminal=new l("terminal",{fontCharacter:"\\ea85"}),l.console=new l("console",{fontCharacter:"\\ea85"}),l.repl=new l("repl",{fontCharacter:"\\ea85"}),l.zap=new l("zap",{fontCharacter:"\\ea86"}),l.symbolEvent=new l("symbol-event",{fontCharacter:"\\ea86"}),l.error=new l("error",{fontCharacter:"\\ea87"}),l.stop=new l("stop",{fontCharacter:"\\ea87"}),l.variable=new l("variable",{fontCharacter:"\\ea88"}),l.symbolVariable=new l("symbol-variable",{fontCharacter:"\\ea88"}),l.array=new l("array",{fontCharacter:"\\ea8a"}),l.symbolArray=new l("symbol-array",{fontCharacter:"\\ea8a"}),l.symbolModule=new l("symbol-module",{fontCharacter:"\\ea8b"}),l.symbolPackage=new l("symbol-package",{fontCharacter:"\\ea8b"}),l.symbolNamespace=new l("symbol-namespace",{fontCharacter:"\\ea8b"}),l.symbolObject=new l("symbol-object",{fontCharacter:"\\ea8b"}),l.symbolMethod=new l("symbol-method",{fontCharacter:"\\ea8c"}),l.symbolFunction=new l("symbol-function",{fontCharacter:"\\ea8c"}),l.symbolConstructor=new l("symbol-constructor",{fontCharacter:"\\ea8c"}),l.symbolBoolean=new l("symbol-boolean",{fontCharacter:"\\ea8f"}),l.symbolNull=new l("symbol-null",{fontCharacter:"\\ea8f"}),l.symbolNumeric=new l("symbol-numeric",{fontCharacter:"\\ea90"}),l.symbolNumber=new l("symbol-number",{fontCharacter:"\\ea90"}),l.symbolStructure=new l("symbol-structure",{fontCharacter:"\\ea91"}),l.symbolStruct=new l("symbol-struct",{fontCharacter:"\\ea91"}),l.symbolParameter=new l("symbol-parameter",{fontCharacter:"\\ea92"}),l.symbolTypeParameter=new l("symbol-type-parameter",{fontCharacter:"\\ea92"}),l.symbolKey=new l("symbol-key",{fontCharacter:"\\ea93"}),l.symbolText=new l("symbol-text",{fontCharacter:"\\ea93"}),l.symbolReference=new l("symbol-reference",{fontCharacter:"\\ea94"}),l.goToFile=new l("go-to-file",{fontCharacter:"\\ea94"}),l.symbolEnum=new l("symbol-enum",{fontCharacter:"\\ea95"}),l.symbolValue=new l("symbol-value",{fontCharacter:"\\ea95"}),l.symbolRuler=new l("symbol-ruler",{fontCharacter:"\\ea96"}),l.symbolUnit=new l("symbol-unit",{fontCharacter:"\\ea96"}),l.activateBreakpoints=new l("activate-breakpoints",{fontCharacter:"\\ea97"}),l.archive=new l("archive",{fontCharacter:"\\ea98"}),l.arrowBoth=new l("arrow-both",{fontCharacter:"\\ea99"}),l.arrowDown=new l("arrow-down",{fontCharacter:"\\ea9a"}),l.arrowLeft=new l("arrow-left",{fontCharacter:"\\ea9b"}),l.arrowRight=new l("arrow-right",{fontCharacter:"\\ea9c"}),l.arrowSmallDown=new l("arrow-small-down",{fontCharacter:"\\ea9d"}),l.arrowSmallLeft=new l("arrow-small-left",{fontCharacter:"\\ea9e"}),l.arrowSmallRight=new l("arrow-small-right",{fontCharacter:"\\ea9f"}),l.arrowSmallUp=new l("arrow-small-up",{fontCharacter:"\\eaa0"}),l.arrowUp=new l("arrow-up",{fontCharacter:"\\eaa1"}),l.bell=new l("bell",{fontCharacter:"\\eaa2"}),l.bold=new l("bold",{fontCharacter:"\\eaa3"}),l.book=new l("book",{fontCharacter:"\\eaa4"}),l.bookmark=new l("bookmark",{fontCharacter:"\\eaa5"}),l.debugBreakpointConditionalUnverified=new l("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),l.debugBreakpointConditional=new l("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),l.debugBreakpointConditionalDisabled=new l("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),l.debugBreakpointDataUnverified=new l("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),l.debugBreakpointData=new l("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),l.debugBreakpointDataDisabled=new l("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),l.debugBreakpointLogUnverified=new l("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),l.debugBreakpointLog=new l("debug-breakpoint-log",{fontCharacter:"\\eaab"}),l.debugBreakpointLogDisabled=new l("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),l.briefcase=new l("briefcase",{fontCharacter:"\\eaac"}),l.broadcast=new l("broadcast",{fontCharacter:"\\eaad"}),l.browser=new l("browser",{fontCharacter:"\\eaae"}),l.bug=new l("bug",{fontCharacter:"\\eaaf"}),l.calendar=new l("calendar",{fontCharacter:"\\eab0"}),l.caseSensitive=new l("case-sensitive",{fontCharacter:"\\eab1"}),l.check=new l("check",{fontCharacter:"\\eab2"}),l.checklist=new l("checklist",{fontCharacter:"\\eab3"}),l.chevronDown=new l("chevron-down",{fontCharacter:"\\eab4"}),l.dropDownButton=new l("drop-down-button",l.chevronDown.definition),l.chevronLeft=new l("chevron-left",{fontCharacter:"\\eab5"}),l.chevronRight=new l("chevron-right",{fontCharacter:"\\eab6"}),l.chevronUp=new l("chevron-up",{fontCharacter:"\\eab7"}),l.chromeClose=new l("chrome-close",{fontCharacter:"\\eab8"}),l.chromeMaximize=new l("chrome-maximize",{fontCharacter:"\\eab9"}),l.chromeMinimize=new l("chrome-minimize",{fontCharacter:"\\eaba"}),l.chromeRestore=new l("chrome-restore",{fontCharacter:"\\eabb"}),l.circleOutline=new l("circle-outline",{fontCharacter:"\\eabc"}),l.debugBreakpointUnverified=new l("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),l.circleSlash=new l("circle-slash",{fontCharacter:"\\eabd"}),l.circuitBoard=new l("circuit-board",{fontCharacter:"\\eabe"}),l.clearAll=new l("clear-all",{fontCharacter:"\\eabf"}),l.clippy=new l("clippy",{fontCharacter:"\\eac0"}),l.closeAll=new l("close-all",{fontCharacter:"\\eac1"}),l.cloudDownload=new l("cloud-download",{fontCharacter:"\\eac2"}),l.cloudUpload=new l("cloud-upload",{fontCharacter:"\\eac3"}),l.code=new l("code",{fontCharacter:"\\eac4"}),l.collapseAll=new l("collapse-all",{fontCharacter:"\\eac5"}),l.colorMode=new l("color-mode",{fontCharacter:"\\eac6"}),l.commentDiscussion=new l("comment-discussion",{fontCharacter:"\\eac7"}),l.compareChanges=new l("compare-changes",{fontCharacter:"\\eafd"}),l.creditCard=new l("credit-card",{fontCharacter:"\\eac9"}),l.dash=new l("dash",{fontCharacter:"\\eacc"}),l.dashboard=new l("dashboard",{fontCharacter:"\\eacd"}),l.database=new l("database",{fontCharacter:"\\eace"}),l.debugContinue=new l("debug-continue",{fontCharacter:"\\eacf"}),l.debugDisconnect=new l("debug-disconnect",{fontCharacter:"\\ead0"}),l.debugPause=new l("debug-pause",{fontCharacter:"\\ead1"}),l.debugRestart=new l("debug-restart",{fontCharacter:"\\ead2"}),l.debugStart=new l("debug-start",{fontCharacter:"\\ead3"}),l.debugStepInto=new l("debug-step-into",{fontCharacter:"\\ead4"}),l.debugStepOut=new l("debug-step-out",{fontCharacter:"\\ead5"}),l.debugStepOver=new l("debug-step-over",{fontCharacter:"\\ead6"}),l.debugStop=new l("debug-stop",{fontCharacter:"\\ead7"}),l.debug=new l("debug",{fontCharacter:"\\ead8"}),l.deviceCameraVideo=new l("device-camera-video",{fontCharacter:"\\ead9"}),l.deviceCamera=new l("device-camera",{fontCharacter:"\\eada"}),l.deviceMobile=new l("device-mobile",{fontCharacter:"\\eadb"}),l.diffAdded=new l("diff-added",{fontCharacter:"\\eadc"}),l.diffIgnored=new l("diff-ignored",{fontCharacter:"\\eadd"}),l.diffModified=new l("diff-modified",{fontCharacter:"\\eade"}),l.diffRemoved=new l("diff-removed",{fontCharacter:"\\eadf"}),l.diffRenamed=new l("diff-renamed",{fontCharacter:"\\eae0"}),l.diff=new l("diff",{fontCharacter:"\\eae1"}),l.discard=new l("discard",{fontCharacter:"\\eae2"}),l.editorLayout=new l("editor-layout",{fontCharacter:"\\eae3"}),l.emptyWindow=new l("empty-window",{fontCharacter:"\\eae4"}),l.exclude=new l("exclude",{fontCharacter:"\\eae5"}),l.extensions=new l("extensions",{fontCharacter:"\\eae6"}),l.eyeClosed=new l("eye-closed",{fontCharacter:"\\eae7"}),l.fileBinary=new l("file-binary",{fontCharacter:"\\eae8"}),l.fileCode=new l("file-code",{fontCharacter:"\\eae9"}),l.fileMedia=new l("file-media",{fontCharacter:"\\eaea"}),l.filePdf=new l("file-pdf",{fontCharacter:"\\eaeb"}),l.fileSubmodule=new l("file-submodule",{fontCharacter:"\\eaec"}),l.fileSymlinkDirectory=new l("file-symlink-directory",{fontCharacter:"\\eaed"}),l.fileSymlinkFile=new l("file-symlink-file",{fontCharacter:"\\eaee"}),l.fileZip=new l("file-zip",{fontCharacter:"\\eaef"}),l.files=new l("files",{fontCharacter:"\\eaf0"}),l.filter=new l("filter",{fontCharacter:"\\eaf1"}),l.flame=new l("flame",{fontCharacter:"\\eaf2"}),l.foldDown=new l("fold-down",{fontCharacter:"\\eaf3"}),l.foldUp=new l("fold-up",{fontCharacter:"\\eaf4"}),l.fold=new l("fold",{fontCharacter:"\\eaf5"}),l.folderActive=new l("folder-active",{fontCharacter:"\\eaf6"}),l.folderOpened=new l("folder-opened",{fontCharacter:"\\eaf7"}),l.gear=new l("gear",{fontCharacter:"\\eaf8"}),l.gift=new l("gift",{fontCharacter:"\\eaf9"}),l.gistSecret=new l("gist-secret",{fontCharacter:"\\eafa"}),l.gist=new l("gist",{fontCharacter:"\\eafb"}),l.gitCommit=new l("git-commit",{fontCharacter:"\\eafc"}),l.gitCompare=new l("git-compare",{fontCharacter:"\\eafd"}),l.gitMerge=new l("git-merge",{fontCharacter:"\\eafe"}),l.githubAction=new l("github-action",{fontCharacter:"\\eaff"}),l.githubAlt=new l("github-alt",{fontCharacter:"\\eb00"}),l.globe=new l("globe",{fontCharacter:"\\eb01"}),l.grabber=new l("grabber",{fontCharacter:"\\eb02"}),l.graph=new l("graph",{fontCharacter:"\\eb03"}),l.gripper=new l("gripper",{fontCharacter:"\\eb04"}),l.heart=new l("heart",{fontCharacter:"\\eb05"}),l.home=new l("home",{fontCharacter:"\\eb06"}),l.horizontalRule=new l("horizontal-rule",{fontCharacter:"\\eb07"}),l.hubot=new l("hubot",{fontCharacter:"\\eb08"}),l.inbox=new l("inbox",{fontCharacter:"\\eb09"}),l.issueClosed=new l("issue-closed",{fontCharacter:"\\eba4"}),l.issueReopened=new l("issue-reopened",{fontCharacter:"\\eb0b"}),l.issues=new l("issues",{fontCharacter:"\\eb0c"}),l.italic=new l("italic",{fontCharacter:"\\eb0d"}),l.jersey=new l("jersey",{fontCharacter:"\\eb0e"}),l.json=new l("json",{fontCharacter:"\\eb0f"}),l.kebabVertical=new l("kebab-vertical",{fontCharacter:"\\eb10"}),l.key=new l("key",{fontCharacter:"\\eb11"}),l.law=new l("law",{fontCharacter:"\\eb12"}),l.lightbulbAutofix=new l("lightbulb-autofix",{fontCharacter:"\\eb13"}),l.linkExternal=new l("link-external",{fontCharacter:"\\eb14"}),l.link=new l("link",{fontCharacter:"\\eb15"}),l.listOrdered=new l("list-ordered",{fontCharacter:"\\eb16"}),l.listUnordered=new l("list-unordered",{fontCharacter:"\\eb17"}),l.liveShare=new l("live-share",{fontCharacter:"\\eb18"}),l.loading=new l("loading",{fontCharacter:"\\eb19"}),l.location=new l("location",{fontCharacter:"\\eb1a"}),l.mailRead=new l("mail-read",{fontCharacter:"\\eb1b"}),l.mail=new l("mail",{fontCharacter:"\\eb1c"}),l.markdown=new l("markdown",{fontCharacter:"\\eb1d"}),l.megaphone=new l("megaphone",{fontCharacter:"\\eb1e"}),l.mention=new l("mention",{fontCharacter:"\\eb1f"}),l.milestone=new l("milestone",{fontCharacter:"\\eb20"}),l.mortarBoard=new l("mortar-board",{fontCharacter:"\\eb21"}),l.move=new l("move",{fontCharacter:"\\eb22"}),l.multipleWindows=new l("multiple-windows",{fontCharacter:"\\eb23"}),l.mute=new l("mute",{fontCharacter:"\\eb24"}),l.noNewline=new l("no-newline",{fontCharacter:"\\eb25"}),l.note=new l("note",{fontCharacter:"\\eb26"}),l.octoface=new l("octoface",{fontCharacter:"\\eb27"}),l.openPreview=new l("open-preview",{fontCharacter:"\\eb28"}),l.package_=new l("package",{fontCharacter:"\\eb29"}),l.paintcan=new l("paintcan",{fontCharacter:"\\eb2a"}),l.pin=new l("pin",{fontCharacter:"\\eb2b"}),l.play=new l("play",{fontCharacter:"\\eb2c"}),l.run=new l("run",{fontCharacter:"\\eb2c"}),l.plug=new l("plug",{fontCharacter:"\\eb2d"}),l.preserveCase=new l("preserve-case",{fontCharacter:"\\eb2e"}),l.preview=new l("preview",{fontCharacter:"\\eb2f"}),l.project=new l("project",{fontCharacter:"\\eb30"}),l.pulse=new l("pulse",{fontCharacter:"\\eb31"}),l.question=new l("question",{fontCharacter:"\\eb32"}),l.quote=new l("quote",{fontCharacter:"\\eb33"}),l.radioTower=new l("radio-tower",{fontCharacter:"\\eb34"}),l.reactions=new l("reactions",{fontCharacter:"\\eb35"}),l.references=new l("references",{fontCharacter:"\\eb36"}),l.refresh=new l("refresh",{fontCharacter:"\\eb37"}),l.regex=new l("regex",{fontCharacter:"\\eb38"}),l.remoteExplorer=new l("remote-explorer",{fontCharacter:"\\eb39"}),l.remote=new l("remote",{fontCharacter:"\\eb3a"}),l.remove=new l("remove",{fontCharacter:"\\eb3b"}),l.replaceAll=new l("replace-all",{fontCharacter:"\\eb3c"}),l.replace=new l("replace",{fontCharacter:"\\eb3d"}),l.repoClone=new l("repo-clone",{fontCharacter:"\\eb3e"}),l.repoForcePush=new l("repo-force-push",{fontCharacter:"\\eb3f"}),l.repoPull=new l("repo-pull",{fontCharacter:"\\eb40"}),l.repoPush=new l("repo-push",{fontCharacter:"\\eb41"}),l.report=new l("report",{fontCharacter:"\\eb42"}),l.requestChanges=new l("request-changes",{fontCharacter:"\\eb43"}),l.rocket=new l("rocket",{fontCharacter:"\\eb44"}),l.rootFolderOpened=new l("root-folder-opened",{fontCharacter:"\\eb45"}),l.rootFolder=new l("root-folder",{fontCharacter:"\\eb46"}),l.rss=new l("rss",{fontCharacter:"\\eb47"}),l.ruby=new l("ruby",{fontCharacter:"\\eb48"}),l.saveAll=new l("save-all",{fontCharacter:"\\eb49"}),l.saveAs=new l("save-as",{fontCharacter:"\\eb4a"}),l.save=new l("save",{fontCharacter:"\\eb4b"}),l.screenFull=new l("screen-full",{fontCharacter:"\\eb4c"}),l.screenNormal=new l("screen-normal",{fontCharacter:"\\eb4d"}),l.searchStop=new l("search-stop",{fontCharacter:"\\eb4e"}),l.server=new l("server",{fontCharacter:"\\eb50"}),l.settingsGear=new l("settings-gear",{fontCharacter:"\\eb51"}),l.settings=new l("settings",{fontCharacter:"\\eb52"}),l.shield=new l("shield",{fontCharacter:"\\eb53"}),l.smiley=new l("smiley",{fontCharacter:"\\eb54"}),l.sortPrecedence=new l("sort-precedence",{fontCharacter:"\\eb55"}),l.splitHorizontal=new l("split-horizontal",{fontCharacter:"\\eb56"}),l.splitVertical=new l("split-vertical",{fontCharacter:"\\eb57"}),l.squirrel=new l("squirrel",{fontCharacter:"\\eb58"}),l.starFull=new l("star-full",{fontCharacter:"\\eb59"}),l.starHalf=new l("star-half",{fontCharacter:"\\eb5a"}),l.symbolClass=new l("symbol-class",{fontCharacter:"\\eb5b"}),l.symbolColor=new l("symbol-color",{fontCharacter:"\\eb5c"}),l.symbolConstant=new l("symbol-constant",{fontCharacter:"\\eb5d"}),l.symbolEnumMember=new l("symbol-enum-member",{fontCharacter:"\\eb5e"}),l.symbolField=new l("symbol-field",{fontCharacter:"\\eb5f"}),l.symbolFile=new l("symbol-file",{fontCharacter:"\\eb60"}),l.symbolInterface=new l("symbol-interface",{fontCharacter:"\\eb61"}),l.symbolKeyword=new l("symbol-keyword",{fontCharacter:"\\eb62"}),l.symbolMisc=new l("symbol-misc",{fontCharacter:"\\eb63"}),l.symbolOperator=new l("symbol-operator",{fontCharacter:"\\eb64"}),l.symbolProperty=new l("symbol-property",{fontCharacter:"\\eb65"}),l.wrench=new l("wrench",{fontCharacter:"\\eb65"}),l.wrenchSubaction=new l("wrench-subaction",{fontCharacter:"\\eb65"}),l.symbolSnippet=new l("symbol-snippet",{fontCharacter:"\\eb66"}),l.tasklist=new l("tasklist",{fontCharacter:"\\eb67"}),l.telescope=new l("telescope",{fontCharacter:"\\eb68"}),l.textSize=new l("text-size",{fontCharacter:"\\eb69"}),l.threeBars=new l("three-bars",{fontCharacter:"\\eb6a"}),l.thumbsdown=new l("thumbsdown",{fontCharacter:"\\eb6b"}),l.thumbsup=new l("thumbsup",{fontCharacter:"\\eb6c"}),l.tools=new l("tools",{fontCharacter:"\\eb6d"}),l.triangleDown=new l("triangle-down",{fontCharacter:"\\eb6e"}),l.triangleLeft=new l("triangle-left",{fontCharacter:"\\eb6f"}),l.triangleRight=new l("triangle-right",{fontCharacter:"\\eb70"}),l.triangleUp=new l("triangle-up",{fontCharacter:"\\eb71"}),l.twitter=new l("twitter",{fontCharacter:"\\eb72"}),l.unfold=new l("unfold",{fontCharacter:"\\eb73"}),l.unlock=new l("unlock",{fontCharacter:"\\eb74"}),l.unmute=new l("unmute",{fontCharacter:"\\eb75"}),l.unverified=new l("unverified",{fontCharacter:"\\eb76"}),l.verified=new l("verified",{fontCharacter:"\\eb77"}),l.versions=new l("versions",{fontCharacter:"\\eb78"}),l.vmActive=new l("vm-active",{fontCharacter:"\\eb79"}),l.vmOutline=new l("vm-outline",{fontCharacter:"\\eb7a"}),l.vmRunning=new l("vm-running",{fontCharacter:"\\eb7b"}),l.watch=new l("watch",{fontCharacter:"\\eb7c"}),l.whitespace=new l("whitespace",{fontCharacter:"\\eb7d"}),l.wholeWord=new l("whole-word",{fontCharacter:"\\eb7e"}),l.window=new l("window",{fontCharacter:"\\eb7f"}),l.wordWrap=new l("word-wrap",{fontCharacter:"\\eb80"}),l.zoomIn=new l("zoom-in",{fontCharacter:"\\eb81"}),l.zoomOut=new l("zoom-out",{fontCharacter:"\\eb82"}),l.listFilter=new l("list-filter",{fontCharacter:"\\eb83"}),l.listFlat=new l("list-flat",{fontCharacter:"\\eb84"}),l.listSelection=new l("list-selection",{fontCharacter:"\\eb85"}),l.selection=new l("selection",{fontCharacter:"\\eb85"}),l.listTree=new l("list-tree",{fontCharacter:"\\eb86"}),l.debugBreakpointFunctionUnverified=new l("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),l.debugBreakpointFunction=new l("debug-breakpoint-function",{fontCharacter:"\\eb88"}),l.debugBreakpointFunctionDisabled=new l("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),l.debugStackframeActive=new l("debug-stackframe-active",{fontCharacter:"\\eb89"}),l.debugStackframeDot=new l("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),l.debugStackframe=new l("debug-stackframe",{fontCharacter:"\\eb8b"}),l.debugStackframeFocused=new l("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),l.debugBreakpointUnsupported=new l("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),l.symbolString=new l("symbol-string",{fontCharacter:"\\eb8d"}),l.debugReverseContinue=new l("debug-reverse-continue",{fontCharacter:"\\eb8e"}),l.debugStepBack=new l("debug-step-back",{fontCharacter:"\\eb8f"}),l.debugRestartFrame=new l("debug-restart-frame",{fontCharacter:"\\eb90"}),l.callIncoming=new l("call-incoming",{fontCharacter:"\\eb92"}),l.callOutgoing=new l("call-outgoing",{fontCharacter:"\\eb93"}),l.menu=new l("menu",{fontCharacter:"\\eb94"}),l.expandAll=new l("expand-all",{fontCharacter:"\\eb95"}),l.feedback=new l("feedback",{fontCharacter:"\\eb96"}),l.groupByRefType=new l("group-by-ref-type",{fontCharacter:"\\eb97"}),l.ungroupByRefType=new l("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),l.account=new l("account",{fontCharacter:"\\eb99"}),l.bellDot=new l("bell-dot",{fontCharacter:"\\eb9a"}),l.debugConsole=new l("debug-console",{fontCharacter:"\\eb9b"}),l.library=new l("library",{fontCharacter:"\\eb9c"}),l.output=new l("output",{fontCharacter:"\\eb9d"}),l.runAll=new l("run-all",{fontCharacter:"\\eb9e"}),l.syncIgnored=new l("sync-ignored",{fontCharacter:"\\eb9f"}),l.pinned=new l("pinned",{fontCharacter:"\\eba0"}),l.githubInverted=new l("github-inverted",{fontCharacter:"\\eba1"}),l.debugAlt=new l("debug-alt",{fontCharacter:"\\eb91"}),l.serverProcess=new l("server-process",{fontCharacter:"\\eba2"}),l.serverEnvironment=new l("server-environment",{fontCharacter:"\\eba3"}),l.pass=new l("pass",{fontCharacter:"\\eba4"}),l.stopCircle=new l("stop-circle",{fontCharacter:"\\eba5"}),l.playCircle=new l("play-circle",{fontCharacter:"\\eba6"}),l.record=new l("record",{fontCharacter:"\\eba7"}),l.debugAltSmall=new l("debug-alt-small",{fontCharacter:"\\eba8"}),l.vmConnect=new l("vm-connect",{fontCharacter:"\\eba9"}),l.cloud=new l("cloud",{fontCharacter:"\\ebaa"}),l.merge=new l("merge",{fontCharacter:"\\ebab"}),l.exportIcon=new l("export",{fontCharacter:"\\ebac"}),l.graphLeft=new l("graph-left",{fontCharacter:"\\ebad"}),l.magnet=new l("magnet",{fontCharacter:"\\ebae"}),l.notebook=new l("notebook",{fontCharacter:"\\ebaf"}),l.redo=new l("redo",{fontCharacter:"\\ebb0"}),l.checkAll=new l("check-all",{fontCharacter:"\\ebb1"}),l.pinnedDirty=new l("pinned-dirty",{fontCharacter:"\\ebb2"}),l.passFilled=new l("pass-filled",{fontCharacter:"\\ebb3"}),l.circleLargeFilled=new l("circle-large-filled",{fontCharacter:"\\ebb4"}),l.circleLargeOutline=new l("circle-large-outline",{fontCharacter:"\\ebb5"}),l.combine=new l("combine",{fontCharacter:"\\ebb6"}),l.gather=new l("gather",{fontCharacter:"\\ebb6"}),l.table=new l("table",{fontCharacter:"\\ebb7"}),l.variableGroup=new l("variable-group",{fontCharacter:"\\ebb8"}),l.typeHierarchy=new l("type-hierarchy",{fontCharacter:"\\ebb9"}),l.typeHierarchySub=new l("type-hierarchy-sub",{fontCharacter:"\\ebba"}),l.typeHierarchySuper=new l("type-hierarchy-super",{fontCharacter:"\\ebbb"}),l.gitPullRequestCreate=new l("git-pull-request-create",{fontCharacter:"\\ebbc"}),l.runAbove=new l("run-above",{fontCharacter:"\\ebbd"}),l.runBelow=new l("run-below",{fontCharacter:"\\ebbe"}),l.notebookTemplate=new l("notebook-template",{fontCharacter:"\\ebbf"}),l.debugRerun=new l("debug-rerun",{fontCharacter:"\\ebc0"}),l.workspaceTrusted=new l("workspace-trusted",{fontCharacter:"\\ebc1"}),l.workspaceUntrusted=new l("workspace-untrusted",{fontCharacter:"\\ebc2"}),l.workspaceUnspecified=new l("workspace-unspecified",{fontCharacter:"\\ebc3"}),l.terminalCmd=new l("terminal-cmd",{fontCharacter:"\\ebc4"}),l.terminalDebian=new l("terminal-debian",{fontCharacter:"\\ebc5"}),l.terminalLinux=new l("terminal-linux",{fontCharacter:"\\ebc6"}),l.terminalPowershell=new l("terminal-powershell",{fontCharacter:"\\ebc7"}),l.terminalTmux=new l("terminal-tmux",{fontCharacter:"\\ebc8"}),l.terminalUbuntu=new l("terminal-ubuntu",{fontCharacter:"\\ebc9"}),l.terminalBash=new l("terminal-bash",{fontCharacter:"\\ebca"}),l.arrowSwap=new l("arrow-swap",{fontCharacter:"\\ebcb"}),l.copy=new l("copy",{fontCharacter:"\\ebcc"}),l.personAdd=new l("person-add",{fontCharacter:"\\ebcd"}),l.filterFilled=new l("filter-filled",{fontCharacter:"\\ebce"}),l.wand=new l("wand",{fontCharacter:"\\ebcf"}),l.debugLineByLine=new l("debug-line-by-line",{fontCharacter:"\\ebd0"}),l.inspect=new l("inspect",{fontCharacter:"\\ebd1"}),l.layers=new l("layers",{fontCharacter:"\\ebd2"}),l.layersDot=new l("layers-dot",{fontCharacter:"\\ebd3"}),l.layersActive=new l("layers-active",{fontCharacter:"\\ebd4"}),l.compass=new l("compass",{fontCharacter:"\\ebd5"}),l.compassDot=new l("compass-dot",{fontCharacter:"\\ebd6"}),l.compassActive=new l("compass-active",{fontCharacter:"\\ebd7"}),l.azure=new l("azure",{fontCharacter:"\\ebd8"}),l.issueDraft=new l("issue-draft",{fontCharacter:"\\ebd9"}),l.gitPullRequestClosed=new l("git-pull-request-closed",{fontCharacter:"\\ebda"}),l.gitPullRequestDraft=new l("git-pull-request-draft",{fontCharacter:"\\ebdb"}),l.debugAll=new l("debug-all",{fontCharacter:"\\ebdc"}),l.debugCoverage=new l("debug-coverage",{fontCharacter:"\\ebdd"}),l.runErrors=new l("run-errors",{fontCharacter:"\\ebde"}),l.folderLibrary=new l("folder-library",{fontCharacter:"\\ebdf"}),l.debugContinueSmall=new l("debug-continue-small",{fontCharacter:"\\ebe0"}),l.beakerStop=new l("beaker-stop",{fontCharacter:"\\ebe1"}),l.graphLine=new l("graph-line",{fontCharacter:"\\ebe2"}),l.graphScatter=new l("graph-scatter",{fontCharacter:"\\ebe3"}),l.pieChart=new l("pie-chart",{fontCharacter:"\\ebe4"}),l.bracket=new l("bracket",l.json.definition),l.bracketDot=new l("bracket-dot",{fontCharacter:"\\ebe5"}),l.bracketError=new l("bracket-error",{fontCharacter:"\\ebe6"}),l.lockSmall=new l("lock-small",{fontCharacter:"\\ebe7"}),l.azureDevops=new l("azure-devops",{fontCharacter:"\\ebe8"}),l.verifiedFilled=new l("verified-filled",{fontCharacter:"\\ebe9"})}(ve||(ve={}))},79881:function(Zt,nt,U){"use strict";U.d(nt,{B8:function(){return k},Cp:function(){return ue},F0:function(){return oe},L6:function(){return Z},VV:function(){return ve},b1:function(){return l},dL:function(){return Se},ri:function(){return G}});class F{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(v){setTimeout(()=>{throw v.stack?new Error(v.message+`
`+v.stack):v},0)}}emit(v){this.listeners.forEach(E=>{E(v)})}onUnexpectedError(v){this.unexpectedErrorHandler(v),this.emit(v)}onUnexpectedExternalError(v){this.unexpectedErrorHandler(v)}}const pe=new F;function Se(g){ve(g)||pe.onUnexpectedError(g)}function ue(g){ve(g)||pe.onUnexpectedExternalError(g)}function G(g){if(g instanceof Error){let{name:v,message:E}=g;const A=g.stacktrace||g.stack;return{$isError:!0,name:v,message:E,stack:A}}return g}const p="Canceled";function ve(g){return g instanceof Error&&g.name===p&&g.message===p}function oe(){const g=new Error(p);return g.name=g.message,g}function l(g){return g?new Error(`Illegal argument: ${g}`):new Error("Illegal argument")}function Z(g){return g?new Error(`Illegal state: ${g}`):new Error("Illegal state")}class k extends Error{constructor(v){super("NotSupported"),v&&(this.message=v)}}},4348:function(Zt,nt,U){"use strict";U.d(nt,{D0:function(){return k},E7:function(){return g},K3:function(){return Z},Q5:function(){return l},ZD:function(){return v},ju:function(){return G}});var F=U(79881),pe=U(69323),Se=U(34502),ue=U(95830),G;(function(E){E.None=()=>pe.JT.None;function A(N){return(O,ae=null,te)=>{let S=!1,b;return b=N(K=>{if(!S)return b?b.dispose():S=!0,O.call(ae,K)},null,te),S&&b.dispose(),b}}E.once=A;function M(N,O){return R((ae,te=null,S)=>N(b=>ae.call(te,O(b)),null,S))}E.map=M;function j(N,O){return R((ae,te=null,S)=>N(b=>{O(b),ae.call(te,b)},null,S))}E.forEach=j;function V(N,O){return R((ae,te=null,S)=>N(b=>O(b)&&ae.call(te,b),null,S))}E.filter=V;function L(N){return N}E.signal=L;function I(...N){return(O,ae=null,te)=>(0,pe.F8)(...N.map(S=>S(b=>O.call(ae,b),null,te)))}E.any=I;function w(N,O,ae){let te=ae;return M(N,S=>(te=O(te,S),te))}E.reduce=w;function R(N){let O;const ae=new l({onFirstListenerAdd(){O=N(ae.fire,ae)},onLastListenerRemove(){O.dispose()}});return ae.event}function Y(N,O,ae=100,te=!1,S){let b,K,le,Ee=0;const Ne=new l({leakWarningThreshold:S,onFirstListenerAdd(){b=N(Qe=>{Ee++,K=O(K,Qe),te&&!le&&(Ne.fire(K),K=void 0),clearTimeout(le),le=setTimeout(()=>{const bt=K;K=void 0,le=void 0,(!te||Ee>1)&&Ne.fire(bt),Ee=0},ae)})},onLastListenerRemove(){b.dispose()}});return Ne.event}E.debounce=Y;function se(N,O=(ae,te)=>ae===te){let ae=!0,te;return V(N,S=>{const b=ae||!O(S,te);return ae=!1,te=S,b})}E.latch=se;function ne(N,O){return[E.filter(N,O),E.filter(N,ae=>!O(ae))]}E.split=ne;function ye(N,O=!1,ae=[]){let te=ae.slice(),S=N(le=>{te?te.push(le):K.fire(le)});const b=()=>{te&&te.forEach(le=>K.fire(le)),te=null},K=new l({onFirstListenerAdd(){S||(S=N(le=>K.fire(le)))},onFirstListenerDidAdd(){te&&(O?setTimeout(b):b())},onLastListenerRemove(){S&&S.dispose(),S=null}});return K.event}E.buffer=ye;class Ie{constructor(O){this.event=O}map(O){return new Ie(M(this.event,O))}forEach(O){return new Ie(j(this.event,O))}filter(O){return new Ie(V(this.event,O))}reduce(O,ae){return new Ie(w(this.event,O,ae))}latch(){return new Ie(se(this.event))}debounce(O,ae=100,te=!1,S){return new Ie(Y(this.event,O,ae,te,S))}on(O,ae,te){return this.event(O,ae,te)}once(O,ae,te){return A(this.event)(O,ae,te)}}function xe(N){return new Ie(N)}E.chain=xe;function $e(N,O,ae=te=>te){const te=(...le)=>K.fire(ae(...le)),S=()=>N.on(O,te),b=()=>N.removeListener(O,te),K=new l({onFirstListenerAdd:S,onLastListenerRemove:b});return K.event}E.fromNodeEventEmitter=$e;function J(N,O,ae=te=>te){const te=(...le)=>K.fire(ae(...le)),S=()=>N.addEventListener(O,te),b=()=>N.removeEventListener(O,te),K=new l({onFirstListenerAdd:S,onLastListenerRemove:b});return K.event}E.fromDOMEventEmitter=J;function D(N){return new Promise(O=>A(N)(O))}E.toPromise=D})(G||(G={}));class p{constructor(A){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${A}_${p._idPool++}`}start(A){this._stopWatch=new ue.G(!0),this._listenerCount=A}stop(){if(this._stopWatch){const A=this._stopWatch.elapsed();this._elapsedOverall+=A,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${A.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let ve=-1;class oe{constructor(A,M=Math.random().toString(18).slice(2,5)){this.customThreshold=A,this.name=M,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(A){let M=ve;if(typeof this.customThreshold=="number"&&(M=this.customThreshold),M<=0||A<M)return;this._stacks||(this._stacks=new Map);const j=new Error().stack.split(`
`).slice(3).join(`
`),V=this._stacks.get(j)||0;if(this._stacks.set(j,V+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=M*.5;let L,I=0;for(const[w,R]of this._stacks)(!L||I<R)&&(L=w,I=R);console.warn(`[${this.name}] potential listener LEAK detected, having ${A} listeners already. MOST frequent listener (${I}):`),console.warn(L)}return()=>{const L=this._stacks.get(j)||0;this._stacks.set(j,L-1)}}}class l{constructor(A){var M;this._disposed=!1,this._options=A,this._leakageMon=ve>0?new oe(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((M=this._options)===null||M===void 0)&&M._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(A,M,j)=>{var V;this._listeners||(this._listeners=new Se.S);const L=this._listeners.isEmpty();L&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const I=this._listeners.push(M?[A,M]:A);L&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,A,M);const w=(V=this._leakageMon)===null||V===void 0?void 0:V.check(this._listeners.size),R=(0,pe.OF)(()=>{w&&w(),this._disposed||(I(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return j instanceof pe.SL?j.add(R):Array.isArray(j)&&j.push(R),R}),this._event}fire(A){var M,j;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Se.S);for(let V of this._listeners)this._deliveryQueue.push([V,A]);for((M=this._perfMon)===null||M===void 0||M.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[V,L]=this._deliveryQueue.shift();try{typeof V=="function"?V.call(void 0,L):V[0].call(V[1],L)}catch(I){(0,F.dL)(I)}}(j=this._perfMon)===null||j===void 0||j.stop()}}dispose(){var A,M,j,V,L;this._disposed||(this._disposed=!0,(A=this._listeners)===null||A===void 0||A.clear(),(M=this._deliveryQueue)===null||M===void 0||M.clear(),(V=(j=this._options)===null||j===void 0?void 0:j.onLastListenerRemove)===null||V===void 0||V.call(j),(L=this._leakageMon)===null||L===void 0||L.dispose())}}class Z extends l{constructor(A){super(A),this._isPaused=0,this._eventQueue=new Se.S,this._mergeFn=A==null?void 0:A.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const A=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(A))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(A){this._listeners&&(this._isPaused!==0?this._eventQueue.push(A):super.fire(A))}}class k extends Z{constructor(A){var M;super(A),this._delay=(M=A.delay)!==null&&M!==void 0?M:100}fire(A){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(A)}}class g{constructor(){this.buffers=[]}wrapEvent(A){return(M,j,V)=>A(L=>{const I=this.buffers[this.buffers.length-1];I?I.push(()=>M.call(j,L)):M.call(j,L)},void 0,V)}bufferEvents(A){const M=[];this.buffers.push(M);const j=A();return this.buffers.pop(),M.forEach(V=>V()),j}}class v{constructor(){this.listening=!1,this.inputEvent=G.None,this.inputEventListener=pe.JT.None,this.emitter=new l({onFirstListenerDidAdd:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onLastListenerRemove:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(A){this.inputEvent=A,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=A(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Zt,nt,U){"use strict";U.d(nt,{I:function(){return F}});function F(pe){const Se=this;let ue=!1,G;return function(){return ue||(ue=!0,G=pe.apply(Se,arguments)),G}}},88226:function(Zt,nt,U){"use strict";U.d(nt,{$:function(){return F}});var F;(function(pe){function Se(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}pe.is=Se;const ue=Object.freeze([]);function G(){return ue}pe.empty=G;function*p(I){yield I}pe.single=p;function ve(I){return I||ue}pe.from=ve;function oe(I){return!I||I[Symbol.iterator]().next().done===!0}pe.isEmpty=oe;function l(I){return I[Symbol.iterator]().next().value}pe.first=l;function Z(I,w){for(const R of I)if(w(R))return!0;return!1}pe.some=Z;function k(I,w){for(const R of I)if(w(R))return R}pe.find=k;function*g(I,w){for(const R of I)w(R)&&(yield R)}pe.filter=g;function*v(I,w){let R=0;for(const Y of I)yield w(Y,R++)}pe.map=v;function*E(...I){for(const w of I)for(const R of w)yield R}pe.concat=E;function*A(I){for(const w of I)for(const R of w)yield R}pe.concatNested=A;function M(I,w,R){let Y=R;for(const se of I)Y=w(Y,se);return Y}pe.reduce=M;function*j(I,w,R=I.length){for(w<0&&(w+=I.length),R<0?R+=I.length:R>I.length&&(R=I.length);w<R;w++)yield I[w]}pe.slice=j;function V(I,w=Number.POSITIVE_INFINITY){const R=[];if(w===0)return[R,I];const Y=I[Symbol.iterator]();for(let se=0;se<w;se++){const ne=Y.next();if(ne.done)return[R,pe.empty()];R.push(ne.value)}return[R,{[Symbol.iterator](){return Y}}]}pe.consume=V;function L(I,w,R=(Y,se)=>Y===se){const Y=I[Symbol.iterator](),se=w[Symbol.iterator]();for(;;){const ne=Y.next(),ye=se.next();if(ne.done!==ye.done)return!1;if(ne.done)return!0;if(!R(ne.value,ye.value))return!1}}pe.equals=L})(F||(F={}))},69323:function(Zt,nt,U){"use strict";U.d(nt,{B9:function(){return v},F8:function(){return E},JT:function(){return j},Jz:function(){return L},OF:function(){return A},SL:function(){return M},Wf:function(){return g},XK:function(){return V},dk:function(){return Z}});var F=U(17845),pe=U(88226);const Se=!1;let ue=null;function G(I){ue=I}if(Se){const I="__is_disposable_tracked__";G(new class{trackDisposable(w){const R=new Error("Potentially leaked disposable").stack;setTimeout(()=>{w[I]||console.log(R)},3e3)}setParent(w,R){if(w&&w!==j.None)try{w[I]=!0}catch(Y){}}markAsDisposed(w){if(w&&w!==j.None)try{w[I]=!0}catch(R){}}markAsSingleton(w){}})}function p(I){return ue==null||ue.trackDisposable(I),I}function ve(I){ue==null||ue.markAsDisposed(I)}function oe(I,w){ue==null||ue.setParent(I,w)}function l(I,w){if(ue)for(const R of I)ue.setParent(R,w)}function Z(I){return ue==null||ue.markAsSingleton(I),I}class k extends Error{constructor(w){super(`Encountered errors while disposing of store. Errors: [${w.join(", ")}]`),this.errors=w}}function g(I){return typeof I.dispose=="function"&&I.dispose.length===0}function v(I){if(pe.$.is(I)){let w=[];for(const R of I)if(R)try{R.dispose()}catch(Y){w.push(Y)}if(w.length===1)throw w[0];if(w.length>1)throw new k(w);return Array.isArray(I)?[]:I}else if(I)return I.dispose(),I}function E(...I){const w=A(()=>v(I));return l(I,w),w}function A(I){const w=p({dispose:(0,F.I)(()=>{ve(w),I()})});return w}class M{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(ve(this),this._isDisposed=!0,this.clear())}clear(){try{v(this._toDispose.values())}finally{this._toDispose.clear()}}add(w){if(!w)return w;if(w===this)throw new Error("Cannot register a disposable on itself!");return oe(w,this),this._isDisposed?M.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(w),w}}M.DISABLE_DISPOSED_WARNING=!1;class j{constructor(){this._store=new M,p(this),oe(this._store,this)}dispose(){ve(this),this._store.dispose()}_register(w){if(w===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(w)}}j.None=Object.freeze({dispose(){}});class V{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(w){var R;this._isDisposed||w===this._value||((R=this._value)===null||R===void 0||R.dispose(),w&&oe(w,this),this._value=w)}clear(){this.value=void 0}dispose(){var w;this._isDisposed=!0,ve(this),(w=this._value)===null||w===void 0||w.dispose(),this._value=void 0}clearAndLeak(){const w=this._value;return this._value=void 0,w&&oe(w,null),w}}class L{constructor(w){this.object=w}dispose(){}}},34502:function(Zt,nt,U){"use strict";U.d(nt,{S:function(){return pe}});class F{constructor(ue){this.element=ue,this.next=F.Undefined,this.prev=F.Undefined}}F.Undefined=new F(void 0);class pe{constructor(){this._first=F.Undefined,this._last=F.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===F.Undefined}clear(){let ue=this._first;for(;ue!==F.Undefined;){const G=ue.next;ue.prev=F.Undefined,ue.next=F.Undefined,ue=G}this._first=F.Undefined,this._last=F.Undefined,this._size=0}unshift(ue){return this._insert(ue,!1)}push(ue){return this._insert(ue,!0)}_insert(ue,G){const p=new F(ue);if(this._first===F.Undefined)this._first=p,this._last=p;else if(G){const oe=this._last;this._last=p,p.prev=oe,oe.next=p}else{const oe=this._first;this._first=p,p.next=oe,oe.prev=p}this._size+=1;let ve=!1;return()=>{ve||(ve=!0,this._remove(p))}}shift(){if(this._first!==F.Undefined){const ue=this._first.element;return this._remove(this._first),ue}}pop(){if(this._last!==F.Undefined){const ue=this._last.element;return this._remove(this._last),ue}}_remove(ue){if(ue.prev!==F.Undefined&&ue.next!==F.Undefined){const G=ue.prev;G.next=ue.next,ue.next.prev=G}else ue.prev===F.Undefined&&ue.next===F.Undefined?(this._first=F.Undefined,this._last=F.Undefined):ue.next===F.Undefined?(this._last=this._last.prev,this._last.next=F.Undefined):ue.prev===F.Undefined&&(this._first=this._first.next,this._first.prev=F.Undefined);this._size-=1}*[Symbol.iterator](){let ue=this._first;for(;ue!==F.Undefined;)yield ue.element,ue=ue.next}}},23345:function(Zt,nt,U){"use strict";U.d(nt,{$L:function(){return Y},ED:function(){return L},IJ:function(){return w},OS:function(){return Ie},WE:function(){return ne},dz:function(){return I},gn:function(){return se},li:function(){return A},r:function(){return J},tY:function(){return R},xS:function(){return ye}});var F=U(97671),pe;const Se="en";let ue=!1,G=!1,p=!1,ve=!1,oe=!1,l=!1,Z=!1,k,g=null,v=null,E;const A=typeof self=="object"?self:typeof U.g=="object"?U.g:{};let M;typeof A.vscode!="undefined"&&typeof A.vscode.process!="undefined"?M=A.vscode.process:typeof F!="undefined"&&(M=F);const j=typeof((pe=M==null?void 0:M.versions)===null||pe===void 0?void 0:pe.electron)=="string"&&M.type==="renderer";if(typeof navigator=="object"&&!j)E=navigator.userAgent,ue=E.indexOf("Windows")>=0,G=E.indexOf("Macintosh")>=0,Z=(E.indexOf("Macintosh")>=0||E.indexOf("iPad")>=0||E.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=E.indexOf("Linux")>=0,l=!0,k=navigator.language,g=k;else if(typeof M=="object"){ue=M.platform==="win32",G=M.platform==="darwin",p=M.platform==="linux",ve=p&&!!M.env.SNAP&&!!M.env.SNAP_REVISION,k=Se,g=Se;const D=M.env.VSCODE_NLS_CONFIG;if(D)try{const N=JSON.parse(D),O=N.availableLanguages["*"];k=N.locale,g=O||Se,v=N._translationsConfigFile}catch(N){}oe=!0}else console.error("Unable to resolve platform.");let V=0;G?V=1:ue?V=3:p&&(V=2);const L=ue,I=G,w=p,R=oe,Y=l,se=Z,ne=E,ye=function(){if(A.setImmediate)return A.setImmediate.bind(A);if(typeof A.postMessage=="function"&&!A.importScripts){let O=[];A.addEventListener("message",te=>{if(te.data&&te.data.vscodeSetImmediateId)for(let S=0,b=O.length;S<b;S++){const K=O[S];if(K.id===te.data.vscodeSetImmediateId){O.splice(S,1),K.callback();return}}});let ae=0;return te=>{const S=++ae;O.push({id:S,callback:te}),A.postMessage({vscodeSetImmediateId:S},"*")}}if(typeof(M==null?void 0:M.nextTick)=="function")return M.nextTick.bind(M);const N=Promise.resolve();return O=>N.then(O)}(),Ie=G||Z?2:ue?1:3;let xe=!0,$e=!1;function J(){if(!$e){$e=!0;const D=new Uint8Array(2);D[0]=1,D[1]=2,xe=new Uint16Array(D.buffer)[0]===513}return xe}},95830:function(Zt,nt,U){"use strict";U.d(nt,{G:function(){return Se}});var F=U(23345);const pe=F.li.performance&&typeof F.li.performance.now=="function";class Se{constructor(G){this._highResolution=pe&&G,this._startTime=this._now(),this._stopTime=-1}static create(G=!0){return new Se(G)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?F.li.performance.now():Date.now()}}},82983:function(Zt,nt,U){"use strict";U.d(nt,{$i:function(){return Ee},C8:function(){return ti},GF:function(){return k},HO:function(){return ae},IO:function(){return g},K7:function(){return Lt},Kw:function(){return Ze},LC:function(){return A},Mh:function(){return ye},P1:function(){return Ie},PJ:function(){return mt},Qe:function(){return Ne},R1:function(){return Z},RP:function(){return K},S6:function(){return Ye},TT:function(){return L},Ut:function(){return S},V8:function(){return M},WU:function(){return Se},YK:function(){return $e},YU:function(){return ue},ZG:function(){return xe},ZH:function(){return D},ab:function(){return Qe},c1:function(){return ze},df:function(){return Y},ec:function(){return G},fi:function(){return ke},fy:function(){return p},j3:function(){return ve},j_:function(){return w},m5:function(){return F},mK:function(){return R},mr:function(){return v},oH:function(){return ee},oL:function(){return oe},ok:function(){return ne},ow:function(){return j},qq:function(){return se},qu:function(){return V},rL:function(){return J},uS:function(){return Ct},un:function(){return l},uq:function(){return E},vH:function(){return O},xe:function(){return bt},zY:function(){return I}});function F(W){return!W||typeof W!="string"?!0:W.trim().length===0}const pe=/{(\d+)}/g;function Se(W,...z){return z.length===0?W:W.replace(pe,function(re,X){const $=parseInt(X,10);return isNaN($)||$<0||$>=z.length?re:z[$]})}function ue(W){return W.replace(/[<>&]/g,function(z){switch(z){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return z}})}function G(W){return W.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(W,z=" "){const re=ve(W,z);return oe(re,z)}function ve(W,z){if(!W||!z)return W;const re=z.length;if(re===0||W.length===0)return W;let X=0;for(;W.indexOf(z,X)===X;)X=X+re;return W.substring(X)}function oe(W,z){if(!W||!z)return W;const re=z.length,X=W.length;if(re===0||X===0)return W;let $=X,Q=-1;for(;Q=W.lastIndexOf(z,$-1),!(Q===-1||Q+re!==$);){if(Q===0)return"";$=Q}return W.substring(0,$)}function l(W){return W.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function Z(W){return W.replace(/\*/g,"")}function k(W,z,re={}){if(!W)throw new Error("Cannot create regex from empty string");z||(W=G(W)),re.wholeWord&&(/\B/.test(W.charAt(0))||(W="\\b"+W),/\B/.test(W.charAt(W.length-1))||(W=W+"\\b"));let X="";return re.global&&(X+="g"),re.matchCase||(X+="i"),re.multiline&&(X+="m"),re.unicode&&(X+="u"),new RegExp(W,X)}function g(W){return W.source==="^"||W.source==="^$"||W.source==="$"||W.source==="^\\s*$"?!1:!!(W.exec("")&&W.lastIndex===0)}function v(W){return(W.global?"g":"")+(W.ignoreCase?"i":"")+(W.multiline?"m":"")+(W.unicode?"u":"")}function E(W){return W.split(/\r\n|\r|\n/)}function A(W){for(let z=0,re=W.length;z<re;z++){const X=W.charCodeAt(z);if(X!==32&&X!==9)return z}return-1}function M(W,z=0,re=W.length){for(let X=z;X<re;X++){const $=W.charCodeAt(X);if($!==32&&$!==9)return W.substring(z,X)}return W.substring(z,re)}function j(W,z=W.length-1){for(let re=z;re>=0;re--){const X=W.charCodeAt(re);if(X!==32&&X!==9)return re}return-1}function V(W,z){return W<z?-1:W>z?1:0}function L(W,z,re=0,X=W.length,$=0,Q=z.length){for(;re<X&&$<Q;re++,$++){let we=W.charCodeAt(re),Ke=z.charCodeAt($);if(we<Ke)return-1;if(we>Ke)return 1}const ce=X-re,he=Q-$;return ce<he?-1:ce>he?1:0}function I(W,z){return w(W,z,0,W.length,0,z.length)}function w(W,z,re=0,X=W.length,$=0,Q=z.length){for(;re<X&&$<Q;re++,$++){let we=W.charCodeAt(re),Ke=z.charCodeAt($);if(we===Ke)continue;if(we>=128||Ke>=128)return L(W.toLowerCase(),z.toLowerCase(),re,X,$,Q);R(we)&&(we-=32),R(Ke)&&(Ke-=32);const Ve=we-Ke;if(Ve!==0)return Ve}const ce=X-re,he=Q-$;return ce<he?-1:ce>he?1:0}function R(W){return W>=97&&W<=122}function Y(W){return W>=65&&W<=90}function se(W,z){return W.length===z.length&&w(W,z)===0}function ne(W,z){const re=z.length;return z.length>W.length?!1:w(W,z,0,re)===0}function ye(W,z){let re,X=Math.min(W.length,z.length);for(re=0;re<X;re++)if(W.charCodeAt(re)!==z.charCodeAt(re))return re;return X}function Ie(W,z){let re,X=Math.min(W.length,z.length);const $=W.length-1,Q=z.length-1;for(re=0;re<X;re++)if(W.charCodeAt($-re)!==z.charCodeAt(Q-re))return re;return X}function xe(W){return 55296<=W&&W<=56319}function $e(W){return 56320<=W&&W<=57343}function J(W,z){return(W-55296<<10)+(z-56320)+65536}function D(W,z,re){const X=W.charCodeAt(re);if(xe(X)&&re+1<z){const $=W.charCodeAt(re+1);if($e($))return J(X,$)}return X}function N(W,z){const re=W.charCodeAt(z-1);if($e(re)&&z>1){const X=W.charCodeAt(z-2);if(xe(X))return J(X,re)}return re}function O(W,z){const re=ge.getInstance(),X=z,$=W.length,Q=D(W,$,z);z+=Q>=65536?2:1;let ce=re.getGraphemeBreakType(Q);for(;z<$;){const he=D(W,$,z),we=re.getGraphemeBreakType(he);if(ke(ce,we))break;z+=he>=65536?2:1,ce=we}return z-X}function ae(W,z){const re=ge.getInstance(),X=z,$=N(W,z);z-=$>=65536?2:1;let Q=re.getGraphemeBreakType($);for(;z>0;){const ce=N(W,z),he=re.getGraphemeBreakType(ce);if(ke(he,Q))break;z-=ce>=65536?2:1,Q=he}return X-z}const te=/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u08BD\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE33\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDCFF]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD50-\uDFFF]|\uD83B[\uDC00-\uDEBB])/;function S(W){return te.test(W)}const b=/(?:[\u231A\u231B\u23F0\u23F3\u2600-\u27BF\u2B50\u2B55]|\uD83C[\uDDE6-\uDDFF\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F\uDE80-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD00-\uDDFF\uDE70-\uDED6])/;function K(W){return b.test(W)}const le=/^[\t\n\r\x20-\x7E]*$/;function Ee(W){return le.test(W)}const Ne=/[\u2028\u2029]/;function Qe(W){return Ne.test(W)}function bt(W){for(let z=0,re=W.length;z<re;z++)if(Lt(W.charCodeAt(z)))return!0;return!1}function Lt(W){return W=+W,W>=11904&&W<=55215||W>=63744&&W<=64255||W>=65281&&W<=65374}function ti(W){return W>=127462&&W<=127487||W===8986||W===8987||W===9200||W===9203||W>=9728&&W<=10175||W===11088||W===11093||W>=127744&&W<=128591||W>=128640&&W<=128764||W>=128992&&W<=129003||W>=129280&&W<=129535||W>=129648&&W<=129750}const ze="\uFEFF";function Ct(W){return!!(W&&W.length>0&&W.charCodeAt(0)===65279)}function Ze(W,z=!1){return W?(z&&(W=W.replace(/\\./g,"")),W.toLowerCase()!==W):!1}function mt(W){return W=W%(2*26),W<26?String.fromCharCode(97+W):String.fromCharCode(65+W-26)}function Ye(W){return ge.getInstance().getGraphemeBreakType(W)}function ke(W,z){return W===0?z!==5&&z!==7:W===2&&z===3?!1:W===4||W===2||W===3||z===4||z===2||z===3?!0:!(W===8&&(z===8||z===9||z===11||z===12)||(W===11||W===9)&&(z===9||z===10)||(W===12||W===10)&&z===10||z===5||z===13||z===7||W===1||W===13&&z===14||W===6&&z===6)}class ge{constructor(){this._data=Ae()}static getInstance(){return ge._INSTANCE||(ge._INSTANCE=new ge),ge._INSTANCE}getGraphemeBreakType(z){if(z<32)return z===10?3:z===13?2:4;if(z<127)return 0;const re=this._data,X=re.length/3;let $=1;for(;$<=X;)if(z<re[3*$])$=2*$;else if(z>re[3*$+1])$=2*$+1;else return re[3*$+2];return 0}}ge._INSTANCE=null;function Ae(){return JSON.parse("[0,0,0,51592,51592,11,44424,44424,11,72251,72254,5,7150,7150,7,48008,48008,11,55176,55176,11,128420,128420,14,3276,3277,5,9979,9980,14,46216,46216,11,49800,49800,11,53384,53384,11,70726,70726,5,122915,122916,5,129320,129327,14,2558,2558,5,5906,5908,5,9762,9763,14,43360,43388,8,45320,45320,11,47112,47112,11,48904,48904,11,50696,50696,11,52488,52488,11,54280,54280,11,70082,70083,1,71350,71350,7,73111,73111,5,127892,127893,14,128726,128727,14,129473,129474,14,2027,2035,5,2901,2902,5,3784,3789,5,6754,6754,5,8418,8420,5,9877,9877,14,11088,11088,14,44008,44008,5,44872,44872,11,45768,45768,11,46664,46664,11,47560,47560,11,48456,48456,11,49352,49352,11,50248,50248,11,51144,51144,11,52040,52040,11,52936,52936,11,53832,53832,11,54728,54728,11,69811,69814,5,70459,70460,5,71096,71099,7,71998,71998,5,72874,72880,5,119149,119149,7,127374,127374,14,128335,128335,14,128482,128482,14,128765,128767,14,129399,129400,14,129680,129685,14,1476,1477,5,2377,2380,7,2759,2760,5,3137,3140,7,3458,3459,7,4153,4154,5,6432,6434,5,6978,6978,5,7675,7679,5,9723,9726,14,9823,9823,14,9919,9923,14,10035,10036,14,42736,42737,5,43596,43596,5,44200,44200,11,44648,44648,11,45096,45096,11,45544,45544,11,45992,45992,11,46440,46440,11,46888,46888,11,47336,47336,11,47784,47784,11,48232,48232,11,48680,48680,11,49128,49128,11,49576,49576,11,50024,50024,11,50472,50472,11,50920,50920,11,51368,51368,11,51816,51816,11,52264,52264,11,52712,52712,11,53160,53160,11,53608,53608,11,54056,54056,11,54504,54504,11,54952,54952,11,68108,68111,5,69933,69940,5,70197,70197,7,70498,70499,7,70845,70845,5,71229,71229,5,71727,71735,5,72154,72155,5,72344,72345,5,73023,73029,5,94095,94098,5,121403,121452,5,126981,127182,14,127538,127546,14,127990,127990,14,128391,128391,14,128445,128449,14,128500,128505,14,128752,128752,14,129160,129167,14,129356,129356,14,129432,129442,14,129648,129651,14,129751,131069,14,173,173,4,1757,1757,1,2274,2274,1,2494,2494,5,2641,2641,5,2876,2876,5,3014,3016,7,3262,3262,7,3393,3396,5,3570,3571,7,3968,3972,5,4228,4228,7,6086,6086,5,6679,6680,5,6912,6915,5,7080,7081,5,7380,7392,5,8252,8252,14,9096,9096,14,9748,9749,14,9784,9786,14,9833,9850,14,9890,9894,14,9938,9938,14,9999,9999,14,10085,10087,14,12349,12349,14,43136,43137,7,43454,43456,7,43755,43755,7,44088,44088,11,44312,44312,11,44536,44536,11,44760,44760,11,44984,44984,11,45208,45208,11,45432,45432,11,45656,45656,11,45880,45880,11,46104,46104,11,46328,46328,11,46552,46552,11,46776,46776,11,47000,47000,11,47224,47224,11,47448,47448,11,47672,47672,11,47896,47896,11,48120,48120,11,48344,48344,11,48568,48568,11,48792,48792,11,49016,49016,11,49240,49240,11,49464,49464,11,49688,49688,11,49912,49912,11,50136,50136,11,50360,50360,11,50584,50584,11,50808,50808,11,51032,51032,11,51256,51256,11,51480,51480,11,51704,51704,11,51928,51928,11,52152,52152,11,52376,52376,11,52600,52600,11,52824,52824,11,53048,53048,11,53272,53272,11,53496,53496,11,53720,53720,11,53944,53944,11,54168,54168,11,54392,54392,11,54616,54616,11,54840,54840,11,55064,55064,11,65438,65439,5,69633,69633,5,69837,69837,1,70018,70018,7,70188,70190,7,70368,70370,7,70465,70468,7,70712,70719,5,70835,70840,5,70850,70851,5,71132,71133,5,71340,71340,7,71458,71461,5,71985,71989,7,72002,72002,7,72193,72202,5,72281,72283,5,72766,72766,7,72885,72886,5,73104,73105,5,92912,92916,5,113824,113827,4,119173,119179,5,121505,121519,5,125136,125142,5,127279,127279,14,127489,127490,14,127570,127743,14,127900,127901,14,128254,128254,14,128369,128370,14,128400,128400,14,128425,128432,14,128468,128475,14,128489,128494,14,128715,128720,14,128745,128745,14,128759,128760,14,129004,129023,14,129296,129304,14,129340,129342,14,129388,129392,14,129404,129407,14,129454,129455,14,129485,129487,14,129659,129663,14,129719,129727,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2363,2363,7,2402,2403,5,2507,2508,7,2622,2624,7,2691,2691,7,2786,2787,5,2881,2884,5,3006,3006,5,3072,3072,5,3170,3171,5,3267,3268,7,3330,3331,7,3406,3406,1,3538,3540,5,3655,3662,5,3897,3897,5,4038,4038,5,4184,4185,5,4352,4447,8,6068,6069,5,6155,6157,5,6448,6449,7,6742,6742,5,6783,6783,5,6966,6970,5,7042,7042,7,7143,7143,7,7212,7219,5,7412,7412,5,8206,8207,4,8294,8303,4,8596,8601,14,9410,9410,14,9742,9742,14,9757,9757,14,9770,9770,14,9794,9794,14,9828,9828,14,9855,9855,14,9882,9882,14,9900,9903,14,9929,9933,14,9963,9967,14,9987,9988,14,10006,10006,14,10062,10062,14,10175,10175,14,11744,11775,5,42607,42607,5,43043,43044,7,43263,43263,5,43444,43445,7,43569,43570,5,43698,43700,5,43766,43766,5,44032,44032,11,44144,44144,11,44256,44256,11,44368,44368,11,44480,44480,11,44592,44592,11,44704,44704,11,44816,44816,11,44928,44928,11,45040,45040,11,45152,45152,11,45264,45264,11,45376,45376,11,45488,45488,11,45600,45600,11,45712,45712,11,45824,45824,11,45936,45936,11,46048,46048,11,46160,46160,11,46272,46272,11,46384,46384,11,46496,46496,11,46608,46608,11,46720,46720,11,46832,46832,11,46944,46944,11,47056,47056,11,47168,47168,11,47280,47280,11,47392,47392,11,47504,47504,11,47616,47616,11,47728,47728,11,47840,47840,11,47952,47952,11,48064,48064,11,48176,48176,11,48288,48288,11,48400,48400,11,48512,48512,11,48624,48624,11,48736,48736,11,48848,48848,11,48960,48960,11,49072,49072,11,49184,49184,11,49296,49296,11,49408,49408,11,49520,49520,11,49632,49632,11,49744,49744,11,49856,49856,11,49968,49968,11,50080,50080,11,50192,50192,11,50304,50304,11,50416,50416,11,50528,50528,11,50640,50640,11,50752,50752,11,50864,50864,11,50976,50976,11,51088,51088,11,51200,51200,11,51312,51312,11,51424,51424,11,51536,51536,11,51648,51648,11,51760,51760,11,51872,51872,11,51984,51984,11,52096,52096,11,52208,52208,11,52320,52320,11,52432,52432,11,52544,52544,11,52656,52656,11,52768,52768,11,52880,52880,11,52992,52992,11,53104,53104,11,53216,53216,11,53328,53328,11,53440,53440,11,53552,53552,11,53664,53664,11,53776,53776,11,53888,53888,11,54000,54000,11,54112,54112,11,54224,54224,11,54336,54336,11,54448,54448,11,54560,54560,11,54672,54672,11,54784,54784,11,54896,54896,11,55008,55008,11,55120,55120,11,64286,64286,5,66272,66272,5,68900,68903,5,69762,69762,7,69817,69818,5,69927,69931,5,70003,70003,5,70070,70078,5,70094,70094,7,70194,70195,7,70206,70206,5,70400,70401,5,70463,70463,7,70475,70477,7,70512,70516,5,70722,70724,5,70832,70832,5,70842,70842,5,70847,70848,5,71088,71089,7,71102,71102,7,71219,71226,5,71231,71232,5,71342,71343,7,71453,71455,5,71463,71467,5,71737,71738,5,71995,71996,5,72000,72000,7,72145,72147,7,72160,72160,5,72249,72249,7,72273,72278,5,72330,72342,5,72752,72758,5,72850,72871,5,72882,72883,5,73018,73018,5,73031,73031,5,73109,73109,5,73461,73462,7,94031,94031,5,94192,94193,7,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,126976,126979,14,127184,127231,14,127344,127345,14,127405,127461,14,127514,127514,14,127561,127567,14,127778,127779,14,127896,127896,14,127985,127986,14,127995,127999,5,128326,128328,14,128360,128366,14,128378,128378,14,128394,128397,14,128405,128406,14,128422,128423,14,128435,128443,14,128453,128464,14,128479,128480,14,128484,128487,14,128496,128498,14,128640,128709,14,128723,128724,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129096,129103,14,129292,129292,14,129311,129311,14,129329,129330,14,129344,129349,14,129360,129374,14,129394,129394,14,129402,129402,14,129413,129425,14,129445,129450,14,129466,129471,14,129483,129483,14,129511,129535,14,129653,129655,14,129667,129670,14,129705,129711,14,129731,129743,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2307,2307,7,2366,2368,7,2382,2383,7,2434,2435,7,2497,2500,5,2519,2519,5,2563,2563,7,2631,2632,5,2677,2677,5,2750,2752,7,2763,2764,7,2817,2817,5,2879,2879,5,2891,2892,7,2914,2915,5,3008,3008,5,3021,3021,5,3076,3076,5,3146,3149,5,3202,3203,7,3264,3265,7,3271,3272,7,3298,3299,5,3390,3390,5,3402,3404,7,3426,3427,5,3535,3535,5,3544,3550,7,3635,3635,7,3763,3763,7,3893,3893,5,3953,3966,5,3981,3991,5,4145,4145,7,4157,4158,5,4209,4212,5,4237,4237,5,4520,4607,10,5970,5971,5,6071,6077,5,6089,6099,5,6277,6278,5,6439,6440,5,6451,6456,7,6683,6683,5,6744,6750,5,6765,6770,7,6846,6846,5,6964,6964,5,6972,6972,5,7019,7027,5,7074,7077,5,7083,7085,5,7146,7148,7,7154,7155,7,7222,7223,5,7394,7400,5,7416,7417,5,8204,8204,5,8233,8233,4,8288,8292,4,8413,8416,5,8482,8482,14,8986,8987,14,9193,9203,14,9654,9654,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9775,14,9792,9792,14,9800,9811,14,9825,9826,14,9831,9831,14,9852,9853,14,9872,9873,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9936,9936,14,9941,9960,14,9974,9974,14,9982,9985,14,9992,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10145,10145,14,11013,11015,14,11503,11505,5,12334,12335,5,12951,12951,14,42612,42621,5,43014,43014,5,43047,43047,7,43204,43205,5,43335,43345,5,43395,43395,7,43450,43451,7,43561,43566,5,43573,43574,5,43644,43644,5,43710,43711,5,43758,43759,7,44005,44005,5,44012,44012,7,44060,44060,11,44116,44116,11,44172,44172,11,44228,44228,11,44284,44284,11,44340,44340,11,44396,44396,11,44452,44452,11,44508,44508,11,44564,44564,11,44620,44620,11,44676,44676,11,44732,44732,11,44788,44788,11,44844,44844,11,44900,44900,11,44956,44956,11,45012,45012,11,45068,45068,11,45124,45124,11,45180,45180,11,45236,45236,11,45292,45292,11,45348,45348,11,45404,45404,11,45460,45460,11,45516,45516,11,45572,45572,11,45628,45628,11,45684,45684,11,45740,45740,11,45796,45796,11,45852,45852,11,45908,45908,11,45964,45964,11,46020,46020,11,46076,46076,11,46132,46132,11,46188,46188,11,46244,46244,11,46300,46300,11,46356,46356,11,46412,46412,11,46468,46468,11,46524,46524,11,46580,46580,11,46636,46636,11,46692,46692,11,46748,46748,11,46804,46804,11,46860,46860,11,46916,46916,11,46972,46972,11,47028,47028,11,47084,47084,11,47140,47140,11,47196,47196,11,47252,47252,11,47308,47308,11,47364,47364,11,47420,47420,11,47476,47476,11,47532,47532,11,47588,47588,11,47644,47644,11,47700,47700,11,47756,47756,11,47812,47812,11,47868,47868,11,47924,47924,11,47980,47980,11,48036,48036,11,48092,48092,11,48148,48148,11,48204,48204,11,48260,48260,11,48316,48316,11,48372,48372,11,48428,48428,11,48484,48484,11,48540,48540,11,48596,48596,11,48652,48652,11,48708,48708,11,48764,48764,11,48820,48820,11,48876,48876,11,48932,48932,11,48988,48988,11,49044,49044,11,49100,49100,11,49156,49156,11,49212,49212,11,49268,49268,11,49324,49324,11,49380,49380,11,49436,49436,11,49492,49492,11,49548,49548,11,49604,49604,11,49660,49660,11,49716,49716,11,49772,49772,11,49828,49828,11,49884,49884,11,49940,49940,11,49996,49996,11,50052,50052,11,50108,50108,11,50164,50164,11,50220,50220,11,50276,50276,11,50332,50332,11,50388,50388,11,50444,50444,11,50500,50500,11,50556,50556,11,50612,50612,11,50668,50668,11,50724,50724,11,50780,50780,11,50836,50836,11,50892,50892,11,50948,50948,11,51004,51004,11,51060,51060,11,51116,51116,11,51172,51172,11,51228,51228,11,51284,51284,11,51340,51340,11,51396,51396,11,51452,51452,11,51508,51508,11,51564,51564,11,51620,51620,11,51676,51676,11,51732,51732,11,51788,51788,11,51844,51844,11,51900,51900,11,51956,51956,11,52012,52012,11,52068,52068,11,52124,52124,11,52180,52180,11,52236,52236,11,52292,52292,11,52348,52348,11,52404,52404,11,52460,52460,11,52516,52516,11,52572,52572,11,52628,52628,11,52684,52684,11,52740,52740,11,52796,52796,11,52852,52852,11,52908,52908,11,52964,52964,11,53020,53020,11,53076,53076,11,53132,53132,11,53188,53188,11,53244,53244,11,53300,53300,11,53356,53356,11,53412,53412,11,53468,53468,11,53524,53524,11,53580,53580,11,53636,53636,11,53692,53692,11,53748,53748,11,53804,53804,11,53860,53860,11,53916,53916,11,53972,53972,11,54028,54028,11,54084,54084,11,54140,54140,11,54196,54196,11,54252,54252,11,54308,54308,11,54364,54364,11,54420,54420,11,54476,54476,11,54532,54532,11,54588,54588,11,54644,54644,11,54700,54700,11,54756,54756,11,54812,54812,11,54868,54868,11,54924,54924,11,54980,54980,11,55036,55036,11,55092,55092,11,55148,55148,11,55216,55238,9,65056,65071,5,65529,65531,4,68097,68099,5,68159,68159,5,69446,69456,5,69688,69702,5,69808,69810,7,69815,69816,7,69821,69821,1,69888,69890,5,69932,69932,7,69957,69958,7,70016,70017,5,70067,70069,7,70079,70080,7,70089,70092,5,70095,70095,5,70191,70193,5,70196,70196,5,70198,70199,5,70367,70367,5,70371,70378,5,70402,70403,7,70462,70462,5,70464,70464,5,70471,70472,7,70487,70487,5,70502,70508,5,70709,70711,7,70720,70721,7,70725,70725,7,70750,70750,5,70833,70834,7,70841,70841,7,70843,70844,7,70846,70846,7,70849,70849,7,71087,71087,5,71090,71093,5,71100,71101,5,71103,71104,5,71216,71218,7,71227,71228,7,71230,71230,7,71339,71339,5,71341,71341,5,71344,71349,5,71351,71351,5,71456,71457,7,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123628,123631,5,125252,125258,5,126980,126980,14,127183,127183,14,127245,127247,14,127340,127343,14,127358,127359,14,127377,127386,14,127462,127487,6,127491,127503,14,127535,127535,14,127548,127551,14,127568,127569,14,127744,127777,14,127780,127891,14,127894,127895,14,127897,127899,14,127902,127984,14,127987,127989,14,127991,127994,14,128000,128253,14,128255,128317,14,128329,128334,14,128336,128359,14,128367,128368,14,128371,128377,14,128379,128390,14,128392,128393,14,128398,128399,14,128401,128404,14,128407,128419,14,128421,128421,14,128424,128424,14,128433,128434,14,128444,128444,14,128450,128452,14,128465,128467,14,128476,128478,14,128481,128481,14,128483,128483,14,128488,128488,14,128495,128495,14,128499,128499,14,128506,128591,14,128710,128714,14,128721,128722,14,128725,128725,14,128728,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129664,129666,14,129671,129679,14,129686,129704,14,129712,129718,14,129728,129730,14,129744,129750,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2259,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3134,3136,5,3142,3144,5,3157,3158,5,3201,3201,5,3260,3260,5,3263,3263,5,3266,3266,5,3270,3270,5,3274,3275,7,3285,3286,5,3328,3329,5,3387,3388,5,3391,3392,7,3398,3400,7,3405,3405,5,3415,3415,5,3457,3457,5,3530,3530,5,3536,3537,7,3542,3542,5,3551,3551,5,3633,3633,5,3636,3642,5,3761,3761,5,3764,3772,5,3864,3865,5,3895,3895,5,3902,3903,7,3967,3967,7,3974,3975,5,3993,4028,5,4141,4144,5,4146,4151,5,4155,4156,7,4182,4183,7,4190,4192,5,4226,4226,5,4229,4230,5,4253,4253,5,4448,4519,9,4957,4959,5,5938,5940,5,6002,6003,5,6070,6070,7,6078,6085,7,6087,6088,7,6109,6109,5,6158,6158,4,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6848,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7673,5,8203,8203,4,8205,8205,13,8232,8232,4,8234,8238,4,8265,8265,14,8293,8293,4,8400,8412,5,8417,8417,5,8421,8432,5,8505,8505,14,8617,8618,14,9000,9000,14,9167,9167,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9776,9783,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9935,14,9937,9937,14,9939,9940,14,9961,9962,14,9968,9973,14,9975,9978,14,9981,9981,14,9986,9986,14,9989,9989,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10084,14,10133,10135,14,10160,10160,14,10548,10549,14,11035,11036,14,11093,11093,14,11647,11647,5,12330,12333,5,12336,12336,14,12441,12442,5,12953,12953,14,42608,42610,5,42654,42655,5,43010,43010,5,43019,43019,5,43045,43046,5,43052,43052,5,43188,43203,7,43232,43249,5,43302,43309,5,43346,43347,7,43392,43394,5,43443,43443,5,43446,43449,5,43452,43453,5,43493,43493,5,43567,43568,7,43571,43572,7,43587,43587,5,43597,43597,7,43696,43696,5,43703,43704,5,43713,43713,5,43756,43757,5,43765,43765,7,44003,44004,7,44006,44007,7,44009,44010,7,44013,44013,5,44033,44059,12,44061,44087,12,44089,44115,12,44117,44143,12,44145,44171,12,44173,44199,12,44201,44227,12,44229,44255,12,44257,44283,12,44285,44311,12,44313,44339,12,44341,44367,12,44369,44395,12,44397,44423,12,44425,44451,12,44453,44479,12,44481,44507,12,44509,44535,12,44537,44563,12,44565,44591,12,44593,44619,12,44621,44647,12,44649,44675,12,44677,44703,12,44705,44731,12,44733,44759,12,44761,44787,12,44789,44815,12,44817,44843,12,44845,44871,12,44873,44899,12,44901,44927,12,44929,44955,12,44957,44983,12,44985,45011,12,45013,45039,12,45041,45067,12,45069,45095,12,45097,45123,12,45125,45151,12,45153,45179,12,45181,45207,12,45209,45235,12,45237,45263,12,45265,45291,12,45293,45319,12,45321,45347,12,45349,45375,12,45377,45403,12,45405,45431,12,45433,45459,12,45461,45487,12,45489,45515,12,45517,45543,12,45545,45571,12,45573,45599,12,45601,45627,12,45629,45655,12,45657,45683,12,45685,45711,12,45713,45739,12,45741,45767,12,45769,45795,12,45797,45823,12,45825,45851,12,45853,45879,12,45881,45907,12,45909,45935,12,45937,45963,12,45965,45991,12,45993,46019,12,46021,46047,12,46049,46075,12,46077,46103,12,46105,46131,12,46133,46159,12,46161,46187,12,46189,46215,12,46217,46243,12,46245,46271,12,46273,46299,12,46301,46327,12,46329,46355,12,46357,46383,12,46385,46411,12,46413,46439,12,46441,46467,12,46469,46495,12,46497,46523,12,46525,46551,12,46553,46579,12,46581,46607,12,46609,46635,12,46637,46663,12,46665,46691,12,46693,46719,12,46721,46747,12,46749,46775,12,46777,46803,12,46805,46831,12,46833,46859,12,46861,46887,12,46889,46915,12,46917,46943,12,46945,46971,12,46973,46999,12,47001,47027,12,47029,47055,12,47057,47083,12,47085,47111,12,47113,47139,12,47141,47167,12,47169,47195,12,47197,47223,12,47225,47251,12,47253,47279,12,47281,47307,12,47309,47335,12,47337,47363,12,47365,47391,12,47393,47419,12,47421,47447,12,47449,47475,12,47477,47503,12,47505,47531,12,47533,47559,12,47561,47587,12,47589,47615,12,47617,47643,12,47645,47671,12,47673,47699,12,47701,47727,12,47729,47755,12,47757,47783,12,47785,47811,12,47813,47839,12,47841,47867,12,47869,47895,12,47897,47923,12,47925,47951,12,47953,47979,12,47981,48007,12,48009,48035,12,48037,48063,12,48065,48091,12,48093,48119,12,48121,48147,12,48149,48175,12,48177,48203,12,48205,48231,12,48233,48259,12,48261,48287,12,48289,48315,12,48317,48343,12,48345,48371,12,48373,48399,12,48401,48427,12,48429,48455,12,48457,48483,12,48485,48511,12,48513,48539,12,48541,48567,12,48569,48595,12,48597,48623,12,48625,48651,12,48653,48679,12,48681,48707,12,48709,48735,12,48737,48763,12,48765,48791,12,48793,48819,12,48821,48847,12,48849,48875,12,48877,48903,12,48905,48931,12,48933,48959,12,48961,48987,12,48989,49015,12,49017,49043,12,49045,49071,12,49073,49099,12,49101,49127,12,49129,49155,12,49157,49183,12,49185,49211,12,49213,49239,12,49241,49267,12,49269,49295,12,49297,49323,12,49325,49351,12,49353,49379,12,49381,49407,12,49409,49435,12,49437,49463,12,49465,49491,12,49493,49519,12,49521,49547,12,49549,49575,12,49577,49603,12,49605,49631,12,49633,49659,12,49661,49687,12,49689,49715,12,49717,49743,12,49745,49771,12,49773,49799,12,49801,49827,12,49829,49855,12,49857,49883,12,49885,49911,12,49913,49939,12,49941,49967,12,49969,49995,12,49997,50023,12,50025,50051,12,50053,50079,12,50081,50107,12,50109,50135,12,50137,50163,12,50165,50191,12,50193,50219,12,50221,50247,12,50249,50275,12,50277,50303,12,50305,50331,12,50333,50359,12,50361,50387,12,50389,50415,12,50417,50443,12,50445,50471,12,50473,50499,12,50501,50527,12,50529,50555,12,50557,50583,12,50585,50611,12,50613,50639,12,50641,50667,12,50669,50695,12,50697,50723,12,50725,50751,12,50753,50779,12,50781,50807,12,50809,50835,12,50837,50863,12,50865,50891,12,50893,50919,12,50921,50947,12,50949,50975,12,50977,51003,12,51005,51031,12,51033,51059,12,51061,51087,12,51089,51115,12,51117,51143,12,51145,51171,12,51173,51199,12,51201,51227,12,51229,51255,12,51257,51283,12,51285,51311,12,51313,51339,12,51341,51367,12,51369,51395,12,51397,51423,12,51425,51451,12,51453,51479,12,51481,51507,12,51509,51535,12,51537,51563,12,51565,51591,12,51593,51619,12,51621,51647,12,51649,51675,12,51677,51703,12,51705,51731,12,51733,51759,12,51761,51787,12,51789,51815,12,51817,51843,12,51845,51871,12,51873,51899,12,51901,51927,12,51929,51955,12,51957,51983,12,51985,52011,12,52013,52039,12,52041,52067,12,52069,52095,12,52097,52123,12,52125,52151,12,52153,52179,12,52181,52207,12,52209,52235,12,52237,52263,12,52265,52291,12,52293,52319,12,52321,52347,12,52349,52375,12,52377,52403,12,52405,52431,12,52433,52459,12,52461,52487,12,52489,52515,12,52517,52543,12,52545,52571,12,52573,52599,12,52601,52627,12,52629,52655,12,52657,52683,12,52685,52711,12,52713,52739,12,52741,52767,12,52769,52795,12,52797,52823,12,52825,52851,12,52853,52879,12,52881,52907,12,52909,52935,12,52937,52963,12,52965,52991,12,52993,53019,12,53021,53047,12,53049,53075,12,53077,53103,12,53105,53131,12,53133,53159,12,53161,53187,12,53189,53215,12,53217,53243,12,53245,53271,12,53273,53299,12,53301,53327,12,53329,53355,12,53357,53383,12,53385,53411,12,53413,53439,12,53441,53467,12,53469,53495,12,53497,53523,12,53525,53551,12,53553,53579,12,53581,53607,12,53609,53635,12,53637,53663,12,53665,53691,12,53693,53719,12,53721,53747,12,53749,53775,12,53777,53803,12,53805,53831,12,53833,53859,12,53861,53887,12,53889,53915,12,53917,53943,12,53945,53971,12,53973,53999,12,54001,54027,12,54029,54055,12,54057,54083,12,54085,54111,12,54113,54139,12,54141,54167,12,54169,54195,12,54197,54223,12,54225,54251,12,54253,54279,12,54281,54307,12,54309,54335,12,54337,54363,12,54365,54391,12,54393,54419,12,54421,54447,12,54449,54475,12,54477,54503,12,54505,54531,12,54533,54559,12,54561,54587,12,54589,54615,12,54617,54643,12,54645,54671,12,54673,54699,12,54701,54727,12,54729,54755,12,54757,54783,12,54785,54811,12,54813,54839,12,54841,54867,12,54869,54895,12,54897,54923,12,54925,54951,12,54953,54979,12,54981,55007,12,55009,55035,12,55037,55063,12,55065,55091,12,55093,55119,12,55121,55147,12,55149,55175,12,55177,55203,12,55243,55291,10,65024,65039,5,65279,65279,4,65520,65528,4,66045,66045,5,66422,66426,5,68101,68102,5,68152,68154,5,68325,68326,5,69291,69292,5,69632,69632,7,69634,69634,7,69759,69761,5]")}function ee(W,z){if(W===0)return 0;const re=Re(W,z);if(re!==void 0)return re;const X=N(z,W);return W-=Te(X),W}function Re(W,z){let re=N(z,W);for(W-=Te(re);q(re)||re===65039||re===8419;){if(W===0)return;re=N(z,W),W-=Te(re)}if(ti(re)){if(W>=0){const X=N(z,W);X===8205&&(W-=Te(X))}return W}}function Te(W){return W>=65536?2:1}function q(W){return 127995<=W&&W<=127999}},72999:function(Zt,nt,U){"use strict";U.d(nt,{$E:function(){return A},$K:function(){return ve},D8:function(){return g},HD:function(){return pe},IU:function(){return M},Jp:function(){return oe},Kn:function(){return Se},cW:function(){return Z},f6:function(){return j},hj:function(){return ue},jn:function(){return G},kJ:function(){return F},mf:function(){return k},o8:function(){return p},p_:function(){return l},vE:function(){return V}});function F(L){return Array.isArray(L)}function pe(L){return typeof L=="string"}function Se(L){return typeof L=="object"&&L!==null&&!Array.isArray(L)&&!(L instanceof RegExp)&&!(L instanceof Date)}function ue(L){return typeof L=="number"&&!isNaN(L)}function G(L){return L===!0||L===!1}function p(L){return typeof L=="undefined"}function ve(L){return!oe(L)}function oe(L){return p(L)||L===null}function l(L,I){if(!L)throw new Error(I?`Unexpected type, expected '${I}'`:"Unexpected type")}function Z(L){if(oe(L))throw new Error("Assertion Failed: argument is undefined or null");return L}function k(L){return typeof L=="function"}function g(L,I){const w=Math.min(L.length,I.length);for(let R=0;R<w;R++)v(L[R],I[R])}function v(L,I){if(pe(I)){if(typeof L!==I)throw new Error(`argument does not match constraint: typeof ${I}`)}else if(k(I)){try{if(L instanceof I)return}catch(w){}if(!oe(L)&&L.constructor===I||I.length===1&&I.call(void 0,L)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function E(L){let I=[],w=Object.getPrototypeOf(L);for(;Object.prototype!==w;)I=I.concat(Object.getOwnPropertyNames(w)),w=Object.getPrototypeOf(w);return I}function A(L){const I=[];for(const w of E(L))typeof L[w]=="function"&&I.push(w);return I}function M(L,I){const w=Y=>function(){const se=Array.prototype.slice.call(arguments,0);return I(Y,se)};let R={};for(const Y of L)R[Y]=w(Y);return R}function j(L){return L===null?void 0:L}function V(L,I="Unreachable"){throw new Error(I)}},13268:function(Zt,nt,U){"use strict";U.d(nt,{N:function(){return pe}});function F(Se,ue){let G;return ue.length===0?G=Se:G=Se.replace(/\{(\d+)\}/g,function(p,ve){const oe=ve[0];return typeof ue[oe]!="undefined"?ue[oe]:p}),G}function pe(Se,ue,...G){return F(ue,G)}},96236:function(Zt,nt,U){"use strict";U.d(nt,{BH:function(){return M},NZ:function(){return j},U8:function(){return V},co:function(){return A},eH:function(){return E},vr:function(){return v}});var F=U(75918),pe=U(52615),Se=U(4348),ue=U(88226),G=U(69323),p=U(34502),ve=U(35884),oe=U(90689),l=U(16925),Z=U(49055),k=function(L,I,w,R){var Y=arguments.length,se=Y<3?I:R===null?R=Object.getOwnPropertyDescriptor(I,w):R,ne;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")se=Reflect.decorate(L,I,w,R);else for(var ye=L.length-1;ye>=0;ye--)(ne=L[ye])&&(se=(Y<3?ne(se):Y>3?ne(I,w,se):ne(I,w))||se);return Y>3&&se&&Object.defineProperty(I,w,se),se},g=function(L,I){return function(w,R){I(w,R,L)}};function v(L){return L.command!==void 0}class E{constructor(I){this.id=E._idPool++,this._debugName=I}}E._idPool=0,E.CommandPalette=new E("CommandPalette"),E.EditorContext=new E("EditorContext"),E.SimpleEditorContext=new E("SimpleEditorContext"),E.EditorContextCopy=new E("EditorContextCopy"),E.EditorContextPeek=new E("EditorContextPeek"),E.MenubarEditMenu=new E("MenubarEditMenu"),E.MenubarCopy=new E("MenubarCopy"),E.MenubarGoMenu=new E("MenubarGoMenu"),E.MenubarSelectionMenu=new E("MenubarSelectionMenu"),E.InlineCompletionsActions=new E("InlineCompletionsActions");const A=(0,l.yh)("menuService"),M=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Se.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:L=>L===E.CommandPalette}}addCommand(L){return this.addCommands(ue.$.single(L))}addCommands(L){for(const I of L)this._commands.set(I.id,I);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,G.OF)(()=>{let I=!1;for(const w of L)I=this._commands.delete(w.id)||I;I&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(L){return this._commands.get(L)}getCommands(){const L=new Map;return this._commands.forEach((I,w)=>L.set(w,I)),L}appendMenuItem(L,I){return this.appendMenuItems(ue.$.single({id:L,item:I}))}appendMenuItems(L){const I=new Set,w=new p.S;for(const{id:R,item:Y}of L){let se=this._menuItems.get(R);se||(se=new p.S,this._menuItems.set(R,se)),w.push(se.push(Y)),I.add(R)}return this._onDidChangeMenu.fire(I),(0,G.OF)(()=>{if(w.size>0){for(let R of w)R();this._onDidChangeMenu.fire(I),w.clear()}})}getMenuItems(L){let I;return this._menuItems.has(L)?I=[...this._menuItems.get(L)]:I=[],L===E.CommandPalette&&this._appendImplicitItems(I),I}_appendImplicitItems(L){const I=new Set;for(const w of L)v(w)&&(I.add(w.command.id),w.alt&&I.add(w.alt.id));this._commands.forEach((w,R)=>{I.has(R)||L.push({command:w})})}};class j extends F.wY{constructor(I,w,R,Y){super(`submenuitem.${I.submenu.id}`,typeof I.title=="string"?I.title:I.title.value,[],"submenu"),this.item=I,this._menuService=w,this._contextKeyService=R,this._options=Y}get actions(){const I=[],w=this._menuService.createMenu(this.item.submenu,this._contextKeyService),R=w.getActions(this._options);w.dispose();for(const[,Y]of R)Y.length>0&&(I.push(...Y),I.push(new F.Z0));return I.length&&I.pop(),I}}let V=class ml{constructor(I,w,R,Y,se){var ne,ye;if(this._commandService=se,this.id=I.id,this.label=R!=null&&R.renderShortTitle&&I.shortTitle?typeof I.shortTitle=="string"?I.shortTitle:I.shortTitle.value:typeof I.title=="string"?I.title:I.title.value,this.tooltip=(ye=typeof I.tooltip=="string"?I.tooltip:(ne=I.tooltip)===null||ne===void 0?void 0:ne.value)!==null&&ye!==void 0?ye:"",this.enabled=!I.precondition||Y.contextMatchesRules(I.precondition),this.checked=void 0,I.toggled){const Ie=I.toggled.condition?I.toggled:{condition:I.toggled};this.checked=Y.contextMatchesRules(Ie.condition),this.checked&&Ie.tooltip&&(this.tooltip=typeof Ie.tooltip=="string"?Ie.tooltip:Ie.tooltip.value),Ie.title&&(this.label=typeof Ie.title=="string"?Ie.title:Ie.title.value)}this.item=I,this.alt=w?new ml(w,void 0,R,Y,se):void 0,this._options=R,Z.kS.isThemeIcon(I.icon)&&(this.class=pe.dT.asClassName(I.icon))}dispose(){}run(...I){var w,R;let Y=[];return!((w=this._options)===null||w===void 0)&&w.arg&&(Y=[...Y,this._options.arg]),!((R=this._options)===null||R===void 0)&&R.shouldForwardArgs&&(Y=[...Y,...I]),this._commandService.executeCommand(this.id,...Y)}};V=k([g(3,oe.i6),g(4,ve.H)],V)},35884:function(Zt,nt,U){"use strict";U.d(nt,{H:function(){return ve},P:function(){return oe}});var F=U(4348),pe=U(88226),Se=U(69323),ue=U(34502),G=U(72999),p=U(16925);const ve=(0,p.yh)("commandService"),oe=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new F.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,Z){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!Z)throw new Error("invalid command");return this.registerCommand({id:l,handler:Z})}if(l.description){const A=[];for(let j of l.description.args)A.push(j.constraint);const M=l.handler;l.handler=function(j,...V){return(0,G.D8)(V,A),M(j,...V)}}const{id:k}=l;let g=this._commands.get(k);g||(g=new ue.S,this._commands.set(k,g));let v=g.unshift(l),E=(0,Se.OF)(()=>{v();const A=this._commands.get(k);A!=null&&A.isEmpty()&&this._commands.delete(k)});return this._onDidRegisterCommand.fire(k),E}registerCommandAlias(l,Z){return oe.registerCommand(l,(k,...g)=>k.get(ve).executeCommand(Z,...g))}getCommand(l){const Z=this._commands.get(l);if(!(!Z||Z.isEmpty()))return pe.$.first(Z)}getCommands(){const l=new Map;for(const Z of this._commands.keys()){const k=this.getCommand(Z);k&&l.set(Z,k)}return l}};oe.registerCommand("noop",()=>{})},90689:function(Zt,nt,U){"use strict";U.d(nt,{Ao:function(){return ve},Eq:function(){return J},Fb:function(){return oe},K8:function(){return O},i6:function(){return $e},uy:function(){return xe}});var F=U(23345),pe=U(82983),Se=U(16925);let ue=F.WE||"";const G=new Map;G.set("false",!1),G.set("true",!0),G.set("isMac",F.dz),G.set("isLinux",F.IJ),G.set("isWindows",F.ED),G.set("isWeb",F.$L),G.set("isMacNative",F.dz&&!F.$L),G.set("isEdge",ue.indexOf("Edg/")>=0),G.set("isFirefox",ue.indexOf("Firefox")>=0),G.set("isChrome",ue.indexOf("Chrome")>=0),G.set("isSafari",ue.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class ve{static has(S){return g.create(S)}static equals(S,b){return v.create(S,b)}static regex(S,b){return Y.create(S,b)}static not(S){return j.create(S)}static and(...S){return ye.create(S,null)}static or(...S){return Ie.create(S,null,!0)}static deserialize(S,b=!1){if(S)return this._deserializeOrExpression(S,b)}static _deserializeOrExpression(S,b){let K=S.split("||");return Ie.create(K.map(le=>this._deserializeAndExpression(le,b)),null,!0)}static _deserializeAndExpression(S,b){let K=S.split("&&");return ye.create(K.map(le=>this._deserializeOne(le,b)),null)}static _deserializeOne(S,b){if(S=S.trim(),S.indexOf("!=")>=0){let K=S.split("!=");return M.create(K[0].trim(),this._deserializeValue(K[1],b))}if(S.indexOf("==")>=0){let K=S.split("==");return v.create(K[0].trim(),this._deserializeValue(K[1],b))}if(S.indexOf("=~")>=0){let K=S.split("=~");return Y.create(K[0].trim(),this._deserializeRegexValue(K[1],b))}if(S.indexOf(" in ")>=0){let K=S.split(" in ");return E.create(K[0].trim(),K[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(S)){const K=S.split(">=");return I.create(K[0].trim(),K[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(S)){const K=S.split(">");return L.create(K[0].trim(),K[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(S)){const K=S.split("<=");return R.create(K[0].trim(),K[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(S)){const K=S.split("<");return w.create(K[0].trim(),K[1].trim())}return/^\!\s*/.test(S)?j.create(S.substr(1).trim()):g.create(S)}static _deserializeValue(S,b){if(S=S.trim(),S==="true")return!0;if(S==="false")return!1;let K=/^'([^']*)'$/.exec(S);return K?K[1].trim():S}static _deserializeRegexValue(S,b){if((0,pe.m5)(S)){if(b)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let K=S.indexOf("/"),le=S.lastIndexOf("/");if(K===le||K<0){if(b)throw new Error(`bad regexp-value '${S}', missing /-enclosure`);return console.warn(`bad regexp-value '${S}', missing /-enclosure`),null}let Ee=S.slice(K+1,le),Ne=S[le+1]==="i"?"i":"";try{return new RegExp(Ee,Ne)}catch(Qe){if(b)throw new Error(`bad regexp-value '${S}', parse error: ${Qe}`);return console.warn(`bad regexp-value '${S}', parse error: ${Qe}`),null}}}function oe(te,S){const b=te?te.substituteConstants():void 0,K=S?S.substituteConstants():void 0;return!b&&!K?!0:!b||!K?!1:b.equals(K)}function l(te,S){return te.cmp(S)}class Z{constructor(){this.type=0}cmp(S){return this.type-S.type}equals(S){return S.type===this.type}substituteConstants(){return this}evaluate(S){return!1}serialize(){return"false"}keys(){return[]}negate(){return k.INSTANCE}}Z.INSTANCE=new Z;class k{constructor(){this.type=1}cmp(S){return this.type-S.type}equals(S){return S.type===this.type}substituteConstants(){return this}evaluate(S){return!0}serialize(){return"true"}keys(){return[]}negate(){return Z.INSTANCE}}k.INSTANCE=new k;class g{constructor(S,b){this.key=S,this.negated=b,this.type=2}static create(S,b=null){const K=G.get(S);return typeof K=="boolean"?K?k.INSTANCE:Z.INSTANCE:new g(S,b)}cmp(S){return S.type!==this.type?this.type-S.type:D(this.key,S.key)}equals(S){return S.type===this.type?this.key===S.key:!1}substituteConstants(){const S=G.get(this.key);return typeof S=="boolean"?S?k.INSTANCE:Z.INSTANCE:this}evaluate(S){return!!S.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=j.create(this.key,this)),this.negated}}class v{constructor(S,b,K){this.key=S,this.value=b,this.negated=K,this.type=4}static create(S,b,K=null){if(typeof b=="boolean")return b?g.create(S,K):j.create(S,K);const le=G.get(S);return typeof le=="boolean"?b===(le?"true":"false")?k.INSTANCE:Z.INSTANCE:new v(S,b,K)}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){const S=G.get(this.key);if(typeof S=="boolean"){const b=S?"true":"false";return this.value===b?k.INSTANCE:Z.INSTANCE}return this}evaluate(S){return S.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=M.create(this.key,this.value,this)),this.negated}}class E{constructor(S,b){this.key=S,this.valueKey=b,this.type=10,this.negated=null}static create(S,b){return new E(S,b)}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.valueKey,S.key,S.valueKey)}equals(S){return S.type===this.type?this.key===S.key&&this.valueKey===S.valueKey:!1}substituteConstants(){return this}evaluate(S){const b=S.getValue(this.valueKey),K=S.getValue(this.key);return Array.isArray(b)?b.indexOf(K)>=0:typeof K=="string"&&typeof b=="object"&&b!==null?p.call(b,K):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=A.create(this)),this.negated}}class A{constructor(S){this._actual=S,this.type=11}static create(S){return new A(S)}cmp(S){return S.type!==this.type?this.type-S.type:this._actual.cmp(S._actual)}equals(S){return S.type===this.type?this._actual.equals(S._actual):!1}substituteConstants(){return this}evaluate(S){return!this._actual.evaluate(S)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class M{constructor(S,b,K){this.key=S,this.value=b,this.negated=K,this.type=5}static create(S,b,K=null){if(typeof b=="boolean")return b?j.create(S,K):g.create(S,K);const le=G.get(S);return typeof le=="boolean"?b===(le?"true":"false")?Z.INSTANCE:k.INSTANCE:new M(S,b,K)}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){const S=G.get(this.key);if(typeof S=="boolean"){const b=S?"true":"false";return this.value===b?Z.INSTANCE:k.INSTANCE}return this}evaluate(S){return S.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=v.create(this.key,this.value,this)),this.negated}}class j{constructor(S,b){this.key=S,this.negated=b,this.type=3}static create(S,b=null){const K=G.get(S);return typeof K=="boolean"?K?Z.INSTANCE:k.INSTANCE:new j(S,b)}cmp(S){return S.type!==this.type?this.type-S.type:D(this.key,S.key)}equals(S){return S.type===this.type?this.key===S.key:!1}substituteConstants(){const S=G.get(this.key);return typeof S=="boolean"?S?Z.INSTANCE:k.INSTANCE:this}evaluate(S){return!S.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=g.create(this.key,this)),this.negated}}function V(te,S){if(typeof te=="string"){const b=parseFloat(te);isNaN(b)||(te=b)}return typeof te=="string"||typeof te=="number"?S(te):Z.INSTANCE}class L{constructor(S,b,K){this.key=S,this.value=b,this.negated=K,this.type=12}static create(S,b,K=null){return V(b,le=>new L(S,le,K))}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){return this}evaluate(S){return typeof this.value=="string"?!1:parseFloat(S.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=R.create(this.key,this.value,this)),this.negated}}class I{constructor(S,b,K){this.key=S,this.value=b,this.negated=K,this.type=13}static create(S,b,K=null){return V(b,le=>new I(S,le,K))}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){return this}evaluate(S){return typeof this.value=="string"?!1:parseFloat(S.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=w.create(this.key,this.value,this)),this.negated}}class w{constructor(S,b,K){this.key=S,this.value=b,this.negated=K,this.type=14}static create(S,b,K=null){return V(b,le=>new w(S,le,K))}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){return this}evaluate(S){return typeof this.value=="string"?!1:parseFloat(S.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=I.create(this.key,this.value,this)),this.negated}}class R{constructor(S,b,K){this.key=S,this.value=b,this.negated=K,this.type=15}static create(S,b,K=null){return V(b,le=>new R(S,le,K))}cmp(S){return S.type!==this.type?this.type-S.type:N(this.key,this.value,S.key,S.value)}equals(S){return S.type===this.type?this.key===S.key&&this.value===S.value:!1}substituteConstants(){return this}evaluate(S){return typeof this.value=="string"?!1:parseFloat(S.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=L.create(this.key,this.value,this)),this.negated}}class Y{constructor(S,b){this.key=S,this.regexp=b,this.type=7,this.negated=null}static create(S,b){return new Y(S,b)}cmp(S){if(S.type!==this.type)return this.type-S.type;if(this.key<S.key)return-1;if(this.key>S.key)return 1;const b=this.regexp?this.regexp.source:"",K=S.regexp?S.regexp.source:"";return b<K?-1:b>K?1:0}equals(S){if(S.type===this.type){const b=this.regexp?this.regexp.source:"",K=S.regexp?S.regexp.source:"";return this.key===S.key&&b===K}return!1}substituteConstants(){return this}evaluate(S){let b=S.getValue(this.key);return this.regexp?this.regexp.test(b):!1}serialize(){const S=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${S}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=se.create(this)),this.negated}}class se{constructor(S){this._actual=S,this.type=8}static create(S){return new se(S)}cmp(S){return S.type!==this.type?this.type-S.type:this._actual.cmp(S._actual)}equals(S){return S.type===this.type?this._actual.equals(S._actual):!1}substituteConstants(){return this}evaluate(S){return!this._actual.evaluate(S)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function ne(te){let S=null;for(let b=0,K=te.length;b<K;b++){const le=te[b].substituteConstants();if(te[b]!==le&&S===null){S=[];for(let Ee=0;Ee<b;Ee++)S[Ee]=te[Ee]}S!==null&&(S[b]=le)}return S===null?te:S}class ye{constructor(S,b){this.expr=S,this.negated=b,this.type=6}static create(S,b){return ye._normalizeArr(S,b)}cmp(S){if(S.type!==this.type)return this.type-S.type;if(this.expr.length<S.expr.length)return-1;if(this.expr.length>S.expr.length)return 1;for(let b=0,K=this.expr.length;b<K;b++){const le=l(this.expr[b],S.expr[b]);if(le!==0)return le}return 0}equals(S){if(S.type===this.type){if(this.expr.length!==S.expr.length)return!1;for(let b=0,K=this.expr.length;b<K;b++)if(!this.expr[b].equals(S.expr[b]))return!1;return!0}return!1}substituteConstants(){const S=ne(this.expr);return S===this.expr?this:ye.create(S,this.negated)}evaluate(S){for(let b=0,K=this.expr.length;b<K;b++)if(!this.expr[b].evaluate(S))return!1;return!0}static _normalizeArr(S,b){const K=[];let le=!1;for(const Ee of S)if(Ee){if(Ee.type===1){le=!0;continue}if(Ee.type===0)return Z.INSTANCE;if(Ee.type===6){K.push(...Ee.expr);continue}K.push(Ee)}if(K.length===0&&le)return k.INSTANCE;if(K.length!==0){if(K.length===1)return K[0];K.sort(l);for(let Ee=1;Ee<K.length;Ee++)K[Ee-1].equals(K[Ee])&&(K.splice(Ee,1),Ee--);if(K.length===1)return K[0];for(;K.length>1;){const Ee=K[K.length-1];if(Ee.type!==9)break;K.pop();const Ne=K.pop(),Qe=K.length===0,bt=Ie.create(Ee.expr.map(Lt=>ye.create([Lt,Ne],null)),null,Qe);bt&&(K.push(bt),K.sort(l))}return K.length===1?K[0]:new ye(K,b)}}serialize(){return this.expr.map(S=>S.serialize()).join(" && ")}keys(){const S=[];for(let b of this.expr)S.push(...b.keys());return S}negate(){if(!this.negated){const S=[];for(let b of this.expr)S.push(b.negate());this.negated=Ie.create(S,this,!0)}return this.negated}}class Ie{constructor(S,b){this.expr=S,this.negated=b,this.type=9}static create(S,b,K){return Ie._normalizeArr(S,b,K)}cmp(S){if(S.type!==this.type)return this.type-S.type;if(this.expr.length<S.expr.length)return-1;if(this.expr.length>S.expr.length)return 1;for(let b=0,K=this.expr.length;b<K;b++){const le=l(this.expr[b],S.expr[b]);if(le!==0)return le}return 0}equals(S){if(S.type===this.type){if(this.expr.length!==S.expr.length)return!1;for(let b=0,K=this.expr.length;b<K;b++)if(!this.expr[b].equals(S.expr[b]))return!1;return!0}return!1}substituteConstants(){const S=ne(this.expr);return S===this.expr?this:Ie.create(S,this.negated,!1)}evaluate(S){for(let b=0,K=this.expr.length;b<K;b++)if(this.expr[b].evaluate(S))return!0;return!1}static _normalizeArr(S,b,K){let le=[],Ee=!1;if(S){for(let Ne=0,Qe=S.length;Ne<Qe;Ne++){const bt=S[Ne];if(bt){if(bt.type===0){Ee=!0;continue}if(bt.type===1)return k.INSTANCE;if(bt.type===9){le=le.concat(bt.expr);continue}le.push(bt)}}if(le.length===0&&Ee)return Z.INSTANCE;le.sort(l)}if(le.length!==0){if(le.length===1)return le[0];for(let Ne=1;Ne<le.length;Ne++)le[Ne-1].equals(le[Ne])&&(le.splice(Ne,1),Ne--);if(le.length===1)return le[0];if(K){for(let Ne=0;Ne<le.length;Ne++)for(let Qe=Ne+1;Qe<le.length;Qe++)O(le[Ne],le[Qe])&&(le.splice(Qe,1),Qe--);if(le.length===1)return le[0]}return new Ie(le,b)}}serialize(){return this.expr.map(S=>S.serialize()).join(" || ")}keys(){const S=[];for(let b of this.expr)S.push(...b.keys());return S}negate(){if(!this.negated){let S=[];for(let b of this.expr)S.push(b.negate());for(;S.length>1;){const b=S.shift(),K=S.shift(),le=[];for(const Ne of ae(b))for(const Qe of ae(K))le.push(ye.create([Ne,Qe],null));const Ee=S.length===0;S.unshift(Ie.create(le,null,Ee))}this.negated=S[0]}return this.negated}}class xe extends g{constructor(S,b,K){super(S,null),this._defaultValue=b,typeof K=="object"?xe._info.push(Object.assign(Object.assign({},K),{key:S})):K!==!0&&xe._info.push({key:S,description:K,type:b!=null?typeof b:void 0})}static all(){return xe._info.values()}bindTo(S){return S.createKey(this.key,this._defaultValue)}getValue(S){return S.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(S){return v.create(this.key,S)}}xe._info=[];const $e=(0,Se.yh)("contextKeyService"),J="setContext";function D(te,S){return te<S?-1:te>S?1:0}function N(te,S,b,K){return te<b?-1:te>b?1:S<K?-1:S>K?1:0}function O(te,S){if(S.type===6&&te.type!==9&&te.type!==6){for(const le of S.expr)if(te.equals(le))return!0}const b=te.negate(),K=ae(b).concat(ae(S));K.sort(l);for(let le=0;le<K.length;le++){const Ne=K[le].negate();for(let Qe=le+1;Qe<K.length;Qe++){const bt=K[Qe];if(Ne.equals(bt))return!0}}return!1}function ae(te){return te.type===9?te.expr:[te]}},16925:function(Zt,nt,U){"use strict";U.d(nt,{I8:function(){return F},TG:function(){return pe},jt:function(){return G},yh:function(){return ue}});var F;(function(p){p.serviceIds=new Map,p.DI_TARGET="$di$target",p.DI_DEPENDENCIES="$di$dependencies";function ve(oe){return oe[p.DI_DEPENDENCIES]||[]}p.getServiceDependencies=ve})(F||(F={}));const pe=ue("instantiationService");function Se(p,ve,oe,l){ve[F.DI_TARGET]===ve?ve[F.DI_DEPENDENCIES].push({id:p,index:oe,optional:l}):(ve[F.DI_DEPENDENCIES]=[{id:p,index:oe,optional:l}],ve[F.DI_TARGET]=ve)}function ue(p){if(F.serviceIds.has(p))return F.serviceIds.get(p);const ve=function(oe,l,Z){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Se(ve,oe,Z,!1)};return ve.toString=()=>p,F.serviceIds.set(p,ve),ve}function G(p){return function(ve,oe,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Se(p,ve,l,!0)}}},44650:function(Zt,nt,U){"use strict";U.d(nt,{B:function(){return ue}});var F=U(76068),pe=U(72999);class Se{constructor(){this.data=new Map}add(p,ve){F.ok(pe.HD(p)),F.ok(pe.Kn(ve)),F.ok(!this.data.has(p),"There is already an extension with this id"),this.data.set(p,ve)}as(p){return this.data.get(p)||null}}const ue=new Se},66213:function(Zt,nt,U){"use strict";U.d(nt,{e:function(){return F}});var F;(function(pe){pe.DARK="dark",pe.LIGHT="light",pe.HIGH_CONTRAST="hc"})(F||(F={}))},49055:function(Zt,nt,U){"use strict";U.d(nt,{EN:function(){return l},IP:function(){return g},Ic:function(){return A},XE:function(){return ve},bB:function(){return M},kS:function(){return Z},m6:function(){return k}});var F=U(52615),pe=U(4348),Se=U(69323),ue=U(16925),G=U(44650),p=U(66213);const ve=(0,ue.yh)("themeService");var oe;(function(j){function V(L){return L&&typeof L=="object"&&typeof L.id=="string"}j.isThemeColor=V})(oe||(oe={}));function l(j){return{id:j}}var Z;(function(j){function V(se){return se&&typeof se=="object"&&typeof se.id=="string"&&(typeof se.color=="undefined"||oe.isThemeColor(se.color))}j.isThemeIcon=V;const L=new RegExp(`^\\$\\((${F.dT.iconNameExpression}(?:${F.dT.iconModifierExpression})?)\\)$`);function I(se){const ne=L.exec(se);if(!ne)return;let[,ye]=ne;return{id:ye}}j.fromString=I;function w(se,ne){let ye=se.id;const Ie=ye.lastIndexOf("~");return Ie!==-1&&(ye=ye.substring(0,Ie)),ne&&(ye=`${ye}~${ne}`),{id:ye}}j.modify=w;function R(se,ne){var ye,Ie;return se.id===ne.id&&((ye=se.color)===null||ye===void 0?void 0:ye.id)===((Ie=ne.color)===null||Ie===void 0?void 0:Ie.id)}j.isEqual=R;function Y(se,ne){return{id:se.id,color:ne?l(ne):void 0}}j.asThemeIcon=Y,j.asClassNameArray=F.dT.asClassNameArray,j.asClassName=F.dT.asClassName,j.asCSSSelector=F.dT.asCSSSelector})(Z||(Z={}));function k(j){switch(j){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const g={ThemingContribution:"base.contributions.theming"};class v{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new pe.Q5}onColorThemeChange(V){return this.themingParticipants.push(V),this.onThemingParticipantAddedEmitter.fire(V),(0,Se.OF)(()=>{const L=this.themingParticipants.indexOf(V);this.themingParticipants.splice(L,1)})}getThemingParticipants(){return this.themingParticipants}}let E=new v;G.B.add(g.ThemingContribution,E);function A(j){return E.onColorThemeChange(j)}class M extends Se.JT{constructor(V){super(),this.themeService=V,this.theme=V.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(L=>this.onThemeChange(L)))}onThemeChange(V){this.theme=V,this.updateStyles()}updateStyles(){}}},96478:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return se}});var F=U(32855),pe=U(74430),Se=U(11913),ue=U(43079),G=U(65030),p=U(92310),ve=U.n(p),oe=U(8654),l=U(59301),Z=U(10228),k=U(16089),g=Z.Z.ESC,v=Z.Z.TAB;function E(ne){var ye=ne.visible,Ie=ne.triggerRef,xe=ne.onVisibleChange,$e=ne.autoFocus,J=ne.overlayRef,D=l.useRef(!1),N=function(){if(ye){var S,b;(S=Ie.current)===null||S===void 0||(b=S.focus)===null||b===void 0||b.call(S),xe==null||xe(!1)}},O=function(){var S;return(S=J.current)!==null&&S!==void 0&&S.focus?(J.current.focus(),D.current=!0,!0):!1},ae=function(S){switch(S.keyCode){case g:N();break;case v:{var b=!1;D.current||(b=O()),b?S.preventDefault():N();break}}};l.useEffect(function(){return ye?(window.addEventListener("keydown",ae),$e&&(0,k.Z)(O,3),function(){window.removeEventListener("keydown",ae),D.current=!1}):function(){D.current=!1}},[ye])}var A=(0,l.forwardRef)(function(ne,ye){var Ie=ne.overlay,xe=ne.arrow,$e=ne.prefixCls,J=(0,l.useMemo)(function(){var N;return typeof Ie=="function"?N=Ie():N=Ie,N},[Ie]),D=(0,oe.sQ)(ye,(0,oe.C4)(J));return l.createElement(l.Fragment,null,xe&&l.createElement("div",{className:"".concat($e,"-arrow")}),l.cloneElement(J,{ref:(0,oe.Yr)(J)?D:void 0}))}),M=A,j={adjustX:1,adjustY:1},V=[0,0],L={topLeft:{points:["bl","tl"],overflow:j,offset:[0,-4],targetOffset:V},top:{points:["bc","tc"],overflow:j,offset:[0,-4],targetOffset:V},topRight:{points:["br","tr"],overflow:j,offset:[0,-4],targetOffset:V},bottomLeft:{points:["tl","bl"],overflow:j,offset:[0,4],targetOffset:V},bottom:{points:["tc","bc"],overflow:j,offset:[0,4],targetOffset:V},bottomRight:{points:["tr","br"],overflow:j,offset:[0,4],targetOffset:V}},I=L,w=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function R(ne,ye){var Ie,xe=ne.arrow,$e=xe===void 0?!1:xe,J=ne.prefixCls,D=J===void 0?"rc-dropdown":J,N=ne.transitionName,O=ne.animation,ae=ne.align,te=ne.placement,S=te===void 0?"bottomLeft":te,b=ne.placements,K=b===void 0?I:b,le=ne.getPopupContainer,Ee=ne.showAction,Ne=ne.hideAction,Qe=ne.overlayClassName,bt=ne.overlayStyle,Lt=ne.visible,ti=ne.trigger,ze=ti===void 0?["hover"]:ti,Ct=ne.autoFocus,Ze=ne.overlay,mt=ne.children,Ye=ne.onVisibleChange,ke=(0,ue.Z)(ne,w),ge=l.useState(),Ae=(0,Se.Z)(ge,2),ee=Ae[0],Re=Ae[1],Te="visible"in ne?Lt:ee,q=l.useRef(null),W=l.useRef(null),z=l.useRef(null);l.useImperativeHandle(ye,function(){return q.current});var re=function(Je){Re(Je),Ye==null||Ye(Je)};E({visible:Te,triggerRef:z,onVisibleChange:re,autoFocus:Ct,overlayRef:W});var X=function(Je){var Ge=ne.onOverlayClick;Re(!1),Ge&&Ge(Je)},$=function(){return l.createElement(M,{ref:W,overlay:Ze,prefixCls:D,arrow:$e})},Q=function(){return typeof Ze=="function"?$:$()},ce=function(){var Je=ne.minOverlayWidthMatchTrigger,Ge=ne.alignPoint;return"minOverlayWidthMatchTrigger"in ne?Je:!Ge},he=function(){var Je=ne.openClassName;return Je!==void 0?Je:"".concat(D,"-open")},we=l.cloneElement(mt,{className:ve()((Ie=mt.props)===null||Ie===void 0?void 0:Ie.className,Te&&he()),ref:(0,oe.Yr)(mt)?(0,oe.sQ)(z,(0,oe.C4)(mt)):void 0}),Ke=Ne;return!Ke&&ze.indexOf("contextMenu")!==-1&&(Ke=["click"]),l.createElement(G.Z,(0,F.Z)({builtinPlacements:K},ke,{prefixCls:D,ref:q,popupClassName:ve()(Qe,(0,pe.Z)({},"".concat(D,"-show-arrow"),$e)),popupStyle:bt,action:ze,showAction:Ee,hideAction:Ke,popupPlacement:S,popupAlign:ae,popupTransitionName:N,popupAnimation:O,popupVisible:Te,stretch:ce()?"minWidth":"",popup:Q(),onPopupVisibleChange:re,onPopupClick:X,getPopupContainer:le}),we)}var Y=l.forwardRef(R),se=Y},28321:function(Zt,nt,U){"use strict";U.d(nt,{iz:function(){return Mt},ck:function(){return ut},BW:function(){return ct},sN:function(){return ut},Wd:function(){return at},ZP:function(){return Pt},Xl:function(){return Ie}});var F=U(32855),pe=U(74430),Se=U(27247),ue=U(3300),G=U(11913),p=U(43079),ve=U(92310),oe=U.n(ve),l=U(11780),Z=U(18929),k=U(13697),g=U(48736),v=U(59301),E=U(4676),A=v.createContext(null);function M(be,Be){return be===void 0?null:"".concat(be,"-").concat(Be)}function j(be){var Be=v.useContext(A);return M(Be,be)}var V=U(80547),L=["children","locked"],I=v.createContext(null);function w(be,Be){var et=(0,Se.Z)({},be);return Object.keys(Be).forEach(function(qe){var rt=Be[qe];rt!==void 0&&(et[qe]=rt)}),et}function R(be){var Be=be.children,et=be.locked,qe=(0,p.Z)(be,L),rt=v.useContext(I),_t=(0,V.Z)(function(){return w(rt,qe)},[rt,qe],function(Ot,Ut){return!et&&(Ot[0]!==Ut[0]||!(0,k.Z)(Ot[1],Ut[1],!0))});return v.createElement(I.Provider,{value:_t},Be)}var Y=[],se=v.createContext(null);function ne(){return v.useContext(se)}var ye=v.createContext(Y);function Ie(be){var Be=v.useContext(ye);return v.useMemo(function(){return be!==void 0?[].concat((0,ue.Z)(Be),[be]):Be},[Be,be])}var xe=v.createContext(null),$e=v.createContext({}),J=$e,D=U(29194);function N(be){var Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,D.Z)(be)){var et=be.nodeName.toLowerCase(),qe=["input","select","textarea","button"].includes(et)||be.isContentEditable||et==="a"&&!!be.getAttribute("href"),rt=be.getAttribute("tabindex"),_t=Number(rt),Ot=null;return rt&&!Number.isNaN(_t)?Ot=_t:qe&&Ot===null&&(Ot=0),qe&&be.disabled&&(Ot=null),Ot!==null&&(Ot>=0||Be&&Ot<0)}return!1}function O(be){var Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,et=(0,ue.Z)(be.querySelectorAll("*")).filter(function(qe){return N(qe,Be)});return N(be,Be)&&et.unshift(be),et}var ae=null;function te(){ae=document.activeElement}function S(){ae=null}function b(){if(ae)try{ae.focus()}catch(be){}}function K(be,Be){if(Be.keyCode===9){var et=O(be),qe=et[Be.shiftKey?0:et.length-1],rt=qe===document.activeElement||be===document.activeElement;if(rt){var _t=et[Be.shiftKey?et.length-1:0];_t.focus(),Be.preventDefault()}}}var le=U(10228),Ee=U(16089),Ne=le.Z.LEFT,Qe=le.Z.RIGHT,bt=le.Z.UP,Lt=le.Z.DOWN,ti=le.Z.ENTER,ze=le.Z.ESC,Ct=le.Z.HOME,Ze=le.Z.END,mt=[bt,Lt,Ne,Qe];function Ye(be,Be,et,qe){var rt,_t="prev",Ot="next",Ut="children",bi="parent";if(be==="inline"&&qe===ti)return{inlineTrigger:!0};var qt=(0,pe.Z)((0,pe.Z)({},bt,_t),Lt,Ot),yi=(0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)({},Ne,et?Ot:_t),Qe,et?_t:Ot),Lt,Ut),ti,Ut),ci=(0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)({},bt,_t),Lt,Ot),ti,Ut),ze,bi),Ne,et?Ut:bi),Qe,et?bi:Ut),di={inline:qt,horizontal:yi,vertical:ci,inlineSub:qt,horizontalSub:ci,verticalSub:ci},Si=(rt=di["".concat(be).concat(Be?"":"Sub")])===null||rt===void 0?void 0:rt[qe];switch(Si){case _t:return{offset:-1,sibling:!0};case Ot:return{offset:1,sibling:!0};case bi:return{offset:-1,sibling:!1};case Ut:return{offset:1,sibling:!1};default:return null}}function ke(be){for(var Be=be;Be;){if(Be.getAttribute("data-menu-list"))return Be;Be=Be.parentElement}return null}function ge(be,Be){for(var et=be||document.activeElement;et;){if(Be.has(et))return et;et=et.parentElement}return null}function Ae(be,Be){var et=O(be,!0);return et.filter(function(qe){return Be.has(qe)})}function ee(be,Be,et){var qe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!be)return null;var rt=Ae(be,Be),_t=rt.length,Ot=rt.findIndex(function(Ut){return et===Ut});return qe<0?Ot===-1?Ot=_t-1:Ot-=1:qe>0&&(Ot+=1),Ot=(Ot+_t)%_t,rt[Ot]}var Re=function(Be,et){var qe=new Set,rt=new Map,_t=new Map;return Be.forEach(function(Ot){var Ut=document.querySelector("[data-menu-id='".concat(M(et,Ot),"']"));Ut&&(qe.add(Ut),_t.set(Ut,Ot),rt.set(Ot,Ut))}),{elements:qe,key2element:rt,element2key:_t}};function Te(be,Be,et,qe,rt,_t,Ot,Ut,bi,qt){var yi=v.useRef(),ci=v.useRef();ci.current=Be;var di=function(){Ee.Z.cancel(yi.current)};return v.useEffect(function(){return function(){di()}},[]),function(Si){var wi=Si.which;if([].concat(mt,[ti,ze,Ct,Ze]).includes(wi)){var Ii=_t(),hi=Re(Ii,qe),vi=hi,Di=vi.elements,Ti=vi.key2element,Ai=vi.element2key,Fi=Ti.get(Be),Li=ge(Fi,Di),Oi=Ai.get(Li),Xi=Ye(be,Ot(Oi,!0).length===1,et,wi);if(!Xi&&wi!==Ct&&wi!==Ze)return;(mt.includes(wi)||[Ct,Ze].includes(wi))&&Si.preventDefault();var Ui=function($i){if($i){var ei=$i,Dt=$i.querySelector("a");Dt!=null&&Dt.getAttribute("href")&&(ei=Dt);var gi=Ai.get($i);Ut(gi),di(),yi.current=(0,Ee.Z)(function(){ci.current===gi&&ei.focus()})}};if([Ct,Ze].includes(wi)||Xi.sibling||!Li){var Ci;!Li||be==="inline"?Ci=rt.current:Ci=ke(Li);var ki,qi=Ae(Ci,Di);wi===Ct?ki=qi[0]:wi===Ze?ki=qi[qi.length-1]:ki=ee(Ci,Di,Li,Xi.offset),Ui(ki)}else if(Xi.inlineTrigger)bi(Oi);else if(Xi.offset>0)bi(Oi,!0),di(),yi.current=(0,Ee.Z)(function(){hi=Re(Ii,qe);var Zi=Li.getAttribute("aria-controls"),$i=document.getElementById(Zi),ei=ee($i,hi.elements);Ui(ei)},5);else if(Xi.offset<0){var Qi=Ot(Oi,!0),Ri=Qi[Qi.length-2],rn=Ti.get(Ri);bi(Ri,!1),Ui(rn)}}qt==null||qt(Si)}}function q(be){Promise.resolve().then(be)}var W="__RC_UTIL_PATH_SPLIT__",z=function(Be){return Be.join(W)},re=function(Be){return Be.split(W)},X="rc-menu-more";function $(){var be=v.useState({}),Be=(0,G.Z)(be,2),et=Be[1],qe=(0,v.useRef)(new Map),rt=(0,v.useRef)(new Map),_t=v.useState([]),Ot=(0,G.Z)(_t,2),Ut=Ot[0],bi=Ot[1],qt=(0,v.useRef)(0),yi=(0,v.useRef)(!1),ci=function(){yi.current||et({})},di=(0,v.useCallback)(function(Ti,Ai){var Fi=z(Ai);rt.current.set(Fi,Ti),qe.current.set(Ti,Fi),qt.current+=1;var Li=qt.current;q(function(){Li===qt.current&&ci()})},[]),Si=(0,v.useCallback)(function(Ti,Ai){var Fi=z(Ai);rt.current.delete(Fi),qe.current.delete(Ti)},[]),wi=(0,v.useCallback)(function(Ti){bi(Ti)},[]),Ii=(0,v.useCallback)(function(Ti,Ai){var Fi=qe.current.get(Ti)||"",Li=re(Fi);return Ai&&Ut.includes(Li[0])&&Li.unshift(X),Li},[Ut]),hi=(0,v.useCallback)(function(Ti,Ai){return Ti.filter(function(Fi){return Fi!==void 0}).some(function(Fi){var Li=Ii(Fi,!0);return Li.includes(Ai)})},[Ii]),vi=function(){var Ai=(0,ue.Z)(qe.current.keys());return Ut.length&&Ai.push(X),Ai},Di=(0,v.useCallback)(function(Ti){var Ai="".concat(qe.current.get(Ti)).concat(W),Fi=new Set;return(0,ue.Z)(rt.current.keys()).forEach(function(Li){Li.startsWith(Ai)&&Fi.add(rt.current.get(Li))}),Fi},[]);return v.useEffect(function(){return function(){yi.current=!0}},[]),{registerPath:di,unregisterPath:Si,refreshOverflowKeys:wi,isSubPathKey:hi,getKeyPath:Ii,getKeys:vi,getSubPathKeys:Di}}function Q(be){var Be=v.useRef(be);Be.current=be;var et=v.useCallback(function(){for(var qe,rt=arguments.length,_t=new Array(rt),Ot=0;Ot<rt;Ot++)_t[Ot]=arguments[Ot];return(qe=Be.current)===null||qe===void 0?void 0:qe.call.apply(qe,[Be].concat(_t))},[]);return be?et:void 0}var ce=Math.random().toFixed(5).toString().slice(2),he=0;function we(be){var Be=(0,Z.Z)(be,{value:be}),et=(0,G.Z)(Be,2),qe=et[0],rt=et[1];return v.useEffect(function(){he+=1;var _t="".concat(ce,"-").concat(he);rt("rc-menu-uuid-".concat(_t))},[]),qe}var Ke=U(33377),Ve=U(93912),Je=U(18881),Ge=U(85461),Fe=U(2738),pt=U(8654);function De(be,Be,et,qe){var rt=v.useContext(I),_t=rt.activeKey,Ot=rt.onActive,Ut=rt.onInactive,bi={active:_t===be};return Be||(bi.onMouseEnter=function(qt){et==null||et({key:be,domEvent:qt}),Ot(be)},bi.onMouseLeave=function(qt){qe==null||qe({key:be,domEvent:qt}),Ut(be)}),bi}function it(be){var Be=v.useContext(I),et=Be.mode,qe=Be.rtl,rt=Be.inlineIndent;if(et!=="inline")return null;var _t=be;return qe?{paddingRight:_t*rt}:{paddingLeft:_t*rt}}function Bt(be){var Be=be.icon,et=be.props,qe=be.children,rt;return Be===null||Be===!1?null:(typeof Be=="function"?rt=v.createElement(Be,(0,Se.Z)({},et)):typeof Be!="boolean"&&(rt=Be),rt||qe||null)}var vt=["item"];function dt(be){var Be=be.item,et=(0,p.Z)(be,vt);return Object.defineProperty(et,"item",{get:function(){return(0,g.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),Be}}),et}var Vt=["title","attribute","elementRef"],ni=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],Qt=["active"],Wt=function(be){(0,Je.Z)(et,be);var Be=(0,Ge.Z)(et);function et(){return(0,Ke.Z)(this,et),Be.apply(this,arguments)}return(0,Ve.Z)(et,[{key:"render",value:function(){var rt=this.props,_t=rt.title,Ot=rt.attribute,Ut=rt.elementRef,bi=(0,p.Z)(rt,Vt),qt=(0,Fe.Z)(bi,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,g.ZP)(!Ot,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),v.createElement(l.Z.Item,(0,F.Z)({},Ot,{title:typeof _t=="string"?_t:void 0},qt,{ref:Ut}))}}]),et}(v.Component),ri=v.forwardRef(function(be,Be){var et=be.style,qe=be.className,rt=be.eventKey,_t=be.warnKey,Ot=be.disabled,Ut=be.itemIcon,bi=be.children,qt=be.role,yi=be.onMouseEnter,ci=be.onMouseLeave,di=be.onClick,Si=be.onKeyDown,wi=be.onFocus,Ii=(0,p.Z)(be,ni),hi=j(rt),vi=v.useContext(I),Di=vi.prefixCls,Ti=vi.onItemClick,Ai=vi.disabled,Fi=vi.overflowDisabled,Li=vi.itemIcon,Oi=vi.selectedKeys,Xi=vi.onActive,Ui=v.useContext(J),Ci=Ui._internalRenderMenuItem,ki="".concat(Di,"-item"),qi=v.useRef(),Qi=v.useRef(),Ri=Ai||Ot,rn=(0,pt.x1)(Be,Qi),Zi=Ie(rt),$i=function(nn){return{key:rt,keyPath:(0,ue.Z)(Zi).reverse(),item:qi.current,domEvent:nn}},ei=Ut||Li,Dt=De(rt,Ri,yi,ci),gi=Dt.active,Mi=(0,p.Z)(Dt,Qt),Gi=Oi.includes(rt),cn=it(Zi.length),hn=function(nn){if(!Ri){var yn=$i(nn);di==null||di(dt(yn)),Ti(yn)}},tn=function(nn){if(Si==null||Si(nn),nn.which===le.Z.ENTER){var yn=$i(nn);di==null||di(dt(yn)),Ti(yn)}},ln=function(nn){Xi(rt),wi==null||wi(nn)},xn={};be.role==="option"&&(xn["aria-selected"]=Gi);var gn=v.createElement(Wt,(0,F.Z)({ref:qi,elementRef:rn,role:qt===null?"none":qt||"menuitem",tabIndex:Ot?null:-1,"data-menu-id":Fi&&hi?null:hi},(0,Fe.Z)(Ii,["extra"]),Mi,xn,{component:"li","aria-disabled":Ot,style:(0,Se.Z)((0,Se.Z)({},cn),et),className:oe()(ki,(0,pe.Z)((0,pe.Z)((0,pe.Z)({},"".concat(ki,"-active"),gi),"".concat(ki,"-selected"),Gi),"".concat(ki,"-disabled"),Ri),qe),onClick:hn,onKeyDown:tn,onFocus:ln}),bi,v.createElement(Bt,{props:(0,Se.Z)((0,Se.Z)({},be),{},{isSelected:Gi}),icon:ei}));return Ci&&(gn=Ci(gn,be,{selected:Gi})),gn});function Rt(be,Be){var et=be.eventKey,qe=ne(),rt=Ie(et);return v.useEffect(function(){if(qe)return qe.registerPath(et,rt),function(){qe.unregisterPath(et,rt)}},[rt]),qe?null:v.createElement(ri,(0,F.Z)({},be,{ref:Be}))}var ut=v.forwardRef(Rt),st=["className","children"],Nt=function(Be,et){var qe=Be.className,rt=Be.children,_t=(0,p.Z)(Be,st),Ot=v.useContext(I),Ut=Ot.prefixCls,bi=Ot.mode,qt=Ot.rtl;return v.createElement("ul",(0,F.Z)({className:oe()(Ut,qt&&"".concat(Ut,"-rtl"),"".concat(Ut,"-sub"),"".concat(Ut,"-").concat(bi==="inline"?"inline":"vertical"),qe),role:"menu"},_t,{"data-menu-list":!0,ref:et}),rt)},Ht=v.forwardRef(Nt);Ht.displayName="SubMenuList";var wt=Ht,gt=U(11592);function St(be,Be){return(0,gt.Z)(be).map(function(et,qe){if(v.isValidElement(et)){var rt,_t,Ot=et.key,Ut=(rt=(_t=et.props)===null||_t===void 0?void 0:_t.eventKey)!==null&&rt!==void 0?rt:Ot,bi=Ut==null;bi&&(Ut="tmp_key-".concat([].concat((0,ue.Z)(Be),[qe]).join("-")));var qt={key:Ut,eventKey:Ut};return v.cloneElement(et,qt)}return et})}var Ei=U(65030),zt={adjustX:1,adjustY:1},si={topLeft:{points:["bl","tl"],overflow:zt},topRight:{points:["br","tr"],overflow:zt},bottomLeft:{points:["tl","bl"],overflow:zt},bottomRight:{points:["tr","br"],overflow:zt},leftTop:{points:["tr","tl"],overflow:zt},leftBottom:{points:["br","bl"],overflow:zt},rightTop:{points:["tl","tr"],overflow:zt},rightBottom:{points:["bl","br"],overflow:zt}},It={topLeft:{points:["bl","tl"],overflow:zt},topRight:{points:["br","tr"],overflow:zt},bottomLeft:{points:["tl","bl"],overflow:zt},bottomRight:{points:["tr","br"],overflow:zt},rightTop:{points:["tr","tl"],overflow:zt},rightBottom:{points:["br","bl"],overflow:zt},leftTop:{points:["tl","tr"],overflow:zt},leftBottom:{points:["bl","br"],overflow:zt}},We=null;function h(be,Be,et){if(Be)return Be;if(et)return et[be]||et.other}var m={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function y(be){var Be=be.prefixCls,et=be.visible,qe=be.children,rt=be.popup,_t=be.popupStyle,Ot=be.popupClassName,Ut=be.popupOffset,bi=be.disabled,qt=be.mode,yi=be.onVisibleChange,ci=v.useContext(I),di=ci.getPopupContainer,Si=ci.rtl,wi=ci.subMenuOpenDelay,Ii=ci.subMenuCloseDelay,hi=ci.builtinPlacements,vi=ci.triggerSubMenuAction,Di=ci.forceSubMenuRender,Ti=ci.rootClassName,Ai=ci.motion,Fi=ci.defaultMotions,Li=v.useState(!1),Oi=(0,G.Z)(Li,2),Xi=Oi[0],Ui=Oi[1],Ci=Si?(0,Se.Z)((0,Se.Z)({},It),hi):(0,Se.Z)((0,Se.Z)({},si),hi),ki=m[qt],qi=h(qt,Ai,Fi),Qi=v.useRef(qi);qt!=="inline"&&(Qi.current=qi);var Ri=(0,Se.Z)((0,Se.Z)({},Qi.current),{},{leavedClassName:"".concat(Be,"-hidden"),removeOnLeave:!1,motionAppear:!0}),rn=v.useRef();return v.useEffect(function(){return rn.current=(0,Ee.Z)(function(){Ui(et)}),function(){Ee.Z.cancel(rn.current)}},[et]),v.createElement(Ei.Z,{prefixCls:Be,popupClassName:oe()("".concat(Be,"-popup"),(0,pe.Z)({},"".concat(Be,"-rtl"),Si),Ot,Ti),stretch:qt==="horizontal"?"minWidth":null,getPopupContainer:di,builtinPlacements:Ci,popupPlacement:ki,popupVisible:Xi,popup:rt,popupStyle:_t,popupAlign:Ut&&{offset:Ut},action:bi?[]:[vi],mouseEnterDelay:wi,mouseLeaveDelay:Ii,onPopupVisibleChange:yi,forceRender:Di,popupMotion:Ri,fresh:!0},qe)}var C=U(77900);function H(be){var Be=be.id,et=be.open,qe=be.keyPath,rt=be.children,_t="inline",Ot=v.useContext(I),Ut=Ot.prefixCls,bi=Ot.forceSubMenuRender,qt=Ot.motion,yi=Ot.defaultMotions,ci=Ot.mode,di=v.useRef(!1);di.current=ci===_t;var Si=v.useState(!di.current),wi=(0,G.Z)(Si,2),Ii=wi[0],hi=wi[1],vi=di.current?et:!1;v.useEffect(function(){di.current&&hi(!1)},[ci]);var Di=(0,Se.Z)({},h(_t,qt,yi));qe.length>1&&(Di.motionAppear=!1);var Ti=Di.onVisibleChanged;return Di.onVisibleChanged=function(Ai){return!di.current&&!Ai&&hi(!0),Ti==null?void 0:Ti(Ai)},Ii?null:v.createElement(R,{mode:_t,locked:!di.current},v.createElement(C.default,(0,F.Z)({visible:vi},Di,{forceRender:bi,removeOnLeave:!1,leavedClassName:"".concat(Ut,"-hidden")}),function(Ai){var Fi=Ai.className,Li=Ai.style;return v.createElement(wt,{id:Be,className:Fi,style:Li},rt)}))}var me=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],fe=["active"],Ce=v.forwardRef(function(be,Be){var et=be.style,qe=be.className,rt=be.title,_t=be.eventKey,Ot=be.warnKey,Ut=be.disabled,bi=be.internalPopupClose,qt=be.children,yi=be.itemIcon,ci=be.expandIcon,di=be.popupClassName,Si=be.popupOffset,wi=be.popupStyle,Ii=be.onClick,hi=be.onMouseEnter,vi=be.onMouseLeave,Di=be.onTitleClick,Ti=be.onTitleMouseEnter,Ai=be.onTitleMouseLeave,Fi=(0,p.Z)(be,me),Li=j(_t),Oi=v.useContext(I),Xi=Oi.prefixCls,Ui=Oi.mode,Ci=Oi.openKeys,ki=Oi.disabled,qi=Oi.overflowDisabled,Qi=Oi.activeKey,Ri=Oi.selectedKeys,rn=Oi.itemIcon,Zi=Oi.expandIcon,$i=Oi.onItemClick,ei=Oi.onOpenChange,Dt=Oi.onActive,gi=v.useContext(J),Mi=gi._internalRenderSubMenuItem,Gi=v.useContext(xe),cn=Gi.isSubPathKey,hn=Ie(),tn="".concat(Xi,"-submenu"),ln=ki||Ut,xn=v.useRef(),gn=v.useRef(),bn=yi!=null?yi:rn,nn=ci!=null?ci:Zi,yn=Ci.includes(_t),sn=!qi&&yn,On=cn(Ri,_t),fn=De(_t,ln,Ti,Ai),_n=fn.active,Cn=(0,p.Z)(fn,fe),_i=v.useState(!1),Kn=(0,G.Z)(_i,2),$n=Kn[0],Fn=Kn[1],Bn=function(dn){ln||Fn(dn)},rs=function(dn){Bn(!0),hi==null||hi({key:_t,domEvent:dn})},ds=function(dn){Bn(!1),vi==null||vi({key:_t,domEvent:dn})},Gn=v.useMemo(function(){return _n||(Ui!=="inline"?$n||cn([Qi],_t):!1)},[Ui,_n,Qi,$n,_t,cn]),Bi=it(hn.length),ps=function(dn){ln||(Di==null||Di({key:_t,domEvent:dn}),Ui==="inline"&&ei(_t,!yn))},ms=Q(function(zi){Ii==null||Ii(dt(zi)),$i(zi)}),Yn=function(dn){Ui!=="inline"&&ei(_t,dn)},Xn=function(){Dt(_t)},qn=Li&&"".concat(Li,"-popup"),Vn=v.useMemo(function(){return v.createElement(Bt,{icon:Ui!=="horizontal"?nn:void 0,props:(0,Se.Z)((0,Se.Z)({},be),{},{isOpen:sn,isSubMenu:!0})},v.createElement("i",{className:"".concat(tn,"-arrow")}))},[Ui,nn,be,sn,tn]),vn=v.createElement("div",(0,F.Z)({role:"menuitem",style:Bi,className:"".concat(tn,"-title"),tabIndex:ln?null:-1,ref:xn,title:typeof rt=="string"?rt:null,"data-menu-id":qi&&Li?null:Li,"aria-expanded":sn,"aria-haspopup":!0,"aria-controls":qn,"aria-disabled":ln,onClick:ps,onFocus:Xn},Cn),rt,Vn),An=v.useRef(Ui);if(Ui!=="inline"&&hn.length>1?An.current="vertical":An.current=Ui,!qi){var wn=An.current;vn=v.createElement(y,{mode:wn,prefixCls:tn,visible:!bi&&sn&&Ui!=="inline",popupClassName:di,popupOffset:Si,popupStyle:wi,popup:v.createElement(R,{mode:wn==="horizontal"?"vertical":wn},v.createElement(wt,{id:qn,ref:gn},qt)),disabled:ln,onVisibleChange:Yn},vn)}var un=v.createElement(l.Z.Item,(0,F.Z)({ref:Be,role:"none"},Fi,{component:"li",style:et,className:oe()(tn,"".concat(tn,"-").concat(Ui),qe,(0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)({},"".concat(tn,"-open"),sn),"".concat(tn,"-active"),Gn),"".concat(tn,"-selected"),On),"".concat(tn,"-disabled"),ln)),onMouseEnter:rs,onMouseLeave:ds}),vn,!qi&&v.createElement(H,{id:qn,open:sn,keyPath:hn},qt));return Mi&&(un=Mi(un,be,{selected:On,active:Gn,open:sn,disabled:ln})),v.createElement(R,{onItemClick:ms,mode:Ui==="horizontal"?"vertical":Ui,itemIcon:bn,expandIcon:nn},un)}),je=v.forwardRef(function(be,Be){var et=be.eventKey,qe=be.children,rt=Ie(et),_t=St(qe,rt),Ot=ne();v.useEffect(function(){if(Ot)return Ot.registerPath(et,rt),function(){Ot.unregisterPath(et,rt)}},[rt]);var Ut;return Ot?Ut=_t:Ut=v.createElement(Ce,(0,F.Z)({ref:Be},be),_t),v.createElement(ye.Provider,{value:rt},Ut)}),at=je,kt=U(34666);function Mt(be){var Be=be.className,et=be.style,qe=v.useContext(I),rt=qe.prefixCls,_t=ne();return _t?null:v.createElement("li",{role:"separator",className:oe()("".concat(rt,"-item-divider"),Be),style:et})}var xt=["className","title","eventKey","children"],Kt=v.forwardRef(function(be,Be){var et=be.className,qe=be.title,rt=be.eventKey,_t=be.children,Ot=(0,p.Z)(be,xt),Ut=v.useContext(I),bi=Ut.prefixCls,qt="".concat(bi,"-item-group");return v.createElement("li",(0,F.Z)({ref:Be,role:"presentation"},Ot,{onClick:function(ci){return ci.stopPropagation()},className:oe()(qt,et)}),v.createElement("div",{role:"presentation",className:"".concat(qt,"-title"),title:typeof qe=="string"?qe:void 0},qe),v.createElement("ul",{role:"group",className:"".concat(qt,"-list")},_t))}),Et=v.forwardRef(function(be,Be){var et=be.eventKey,qe=be.children,rt=Ie(et),_t=St(qe,rt),Ot=ne();return Ot?_t:v.createElement(Kt,(0,F.Z)({ref:Be},(0,Fe.Z)(be,["warnKey"])),_t)}),ct=Et,ot=["label","children","key","type","extra"];function yt(be,Be,et){var qe=Be.item,rt=Be.group,_t=Be.submenu,Ot=Be.divider;return(be||[]).map(function(Ut,bi){if(Ut&&(0,kt.Z)(Ut)==="object"){var qt=Ut,yi=qt.label,ci=qt.children,di=qt.key,Si=qt.type,wi=qt.extra,Ii=(0,p.Z)(qt,ot),hi=di!=null?di:"tmp-".concat(bi);return ci||Si==="group"?Si==="group"?v.createElement(rt,(0,F.Z)({key:hi},Ii,{title:yi}),yt(ci,Be,et)):v.createElement(_t,(0,F.Z)({key:hi},Ii,{title:yi}),yt(ci,Be,et)):Si==="divider"?v.createElement(Ot,(0,F.Z)({key:hi},Ii)):v.createElement(qe,(0,F.Z)({key:hi},Ii,{extra:wi}),yi,(!!wi||wi===0)&&v.createElement("span",{className:"".concat(et,"-item-extra")},wi))}return null}).filter(function(Ut){return Ut})}function Tt(be,Be,et,qe,rt){var _t=be,Ot=(0,Se.Z)({divider:Mt,item:ut,group:ct,submenu:at},qe);return Be&&(_t=yt(Be,Ot,rt)),St(_t,et)}var mi=["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","_internalComponents"],Xt=[],Yt=v.forwardRef(function(be,Be){var et,qe=be,rt=qe.prefixCls,_t=rt===void 0?"rc-menu":rt,Ot=qe.rootClassName,Ut=qe.style,bi=qe.className,qt=qe.tabIndex,yi=qt===void 0?0:qt,ci=qe.items,di=qe.children,Si=qe.direction,wi=qe.id,Ii=qe.mode,hi=Ii===void 0?"vertical":Ii,vi=qe.inlineCollapsed,Di=qe.disabled,Ti=qe.disabledOverflow,Ai=qe.subMenuOpenDelay,Fi=Ai===void 0?.1:Ai,Li=qe.subMenuCloseDelay,Oi=Li===void 0?.1:Li,Xi=qe.forceSubMenuRender,Ui=qe.defaultOpenKeys,Ci=qe.openKeys,ki=qe.activeKey,qi=qe.defaultActiveFirst,Qi=qe.selectable,Ri=Qi===void 0?!0:Qi,rn=qe.multiple,Zi=rn===void 0?!1:rn,$i=qe.defaultSelectedKeys,ei=qe.selectedKeys,Dt=qe.onSelect,gi=qe.onDeselect,Mi=qe.inlineIndent,Gi=Mi===void 0?24:Mi,cn=qe.motion,hn=qe.defaultMotions,tn=qe.triggerSubMenuAction,ln=tn===void 0?"hover":tn,xn=qe.builtinPlacements,gn=qe.itemIcon,bn=qe.expandIcon,nn=qe.overflowedIndicator,yn=nn===void 0?"...":nn,sn=qe.overflowedIndicatorPopupClassName,On=qe.getPopupContainer,fn=qe.onClick,_n=qe.onOpenChange,Cn=qe.onKeyDown,_i=qe.openAnimation,Kn=qe.openTransitionName,$n=qe._internalRenderMenuItem,Fn=qe._internalRenderSubMenuItem,Bn=qe._internalComponents,rs=(0,p.Z)(qe,mi),ds=v.useMemo(function(){return[Tt(di,ci,Xt,Bn,_t),Tt(di,ci,Xt,{},_t)]},[di,ci,Bn]),Gn=(0,G.Z)(ds,2),Bi=Gn[0],ps=Gn[1],ms=v.useState(!1),Yn=(0,G.Z)(ms,2),Xn=Yn[0],qn=Yn[1],Vn=v.useRef(),vn=we(wi),An=Si==="rtl",wn=(0,Z.Z)(Ui,{value:Ci,postState:function(Hi){return Hi||Xt}}),un=(0,G.Z)(wn,2),zi=un[0],dn=un[1],kn=function(Hi){var Ji=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function Pn(){dn(Hi),_n==null||_n(Hi)}Ji?(0,E.flushSync)(Pn):Pn()},jn=v.useState(zi),as=(0,G.Z)(jn,2),Qn=as[0],Yi=as[1],pn=v.useRef(!1),os=v.useMemo(function(){return(hi==="inline"||hi==="vertical")&&vi?["vertical",vi]:[hi,!1]},[hi,vi]),ii=(0,G.Z)(os,2),pi=ii[0],ji=ii[1],an=pi==="inline",en=v.useState(pi),gs=(0,G.Z)(en,2),Mn=gs[0],_s=gs[1],Jn=v.useState(ji),hr=(0,G.Z)(Jn,2),fr=hr[0],dr=hr[1];v.useEffect(function(){_s(pi),dr(ji),pn.current&&(an?dn(Qn):kn(Xt))},[pi,ji]);var Hr=v.useState(0),Ms=(0,G.Z)(Hr,2),Ns=Ms[0],Hn=Ms[1],Fs=Ns>=Bi.length-1||Mn!=="horizontal"||Ti;v.useEffect(function(){an&&Yi(zi)},[zi]),v.useEffect(function(){return pn.current=!0,function(){pn.current=!1}},[]);var vs=$(),Ys=vs.registerPath,Xs=vs.unregisterPath,pr=vs.refreshOverflowKeys,qs=vs.isSubPathKey,Wr=vs.getKeyPath,Bs=vs.getKeys,mr=vs.getSubPathKeys,gr=v.useMemo(function(){return{registerPath:Ys,unregisterPath:Xs}},[Ys,Xs]),es=v.useMemo(function(){return{isSubPathKey:qs}},[qs]);v.useEffect(function(){pr(Fs?Xt:Bi.slice(Ns+1).map(function(on){return on.key}))},[Ns,Fs]);var _r=(0,Z.Z)(ki||qi&&((et=Bi[0])===null||et===void 0?void 0:et.key),{value:ki}),Us=(0,G.Z)(_r,2),xs=Us[0],Qs=Us[1],Zr=Q(function(on){Qs(on)}),zr=Q(function(){Qs(void 0)});(0,v.useImperativeHandle)(Be,function(){return{list:Vn.current,focus:function(Hi){var Ji,Pn=Bs(),Rn=Re(Pn,vn),ys=Rn.elements,En=Rn.key2element,Ln=Rn.element2key,xr=Ae(Vn.current,ys),lt=xs!=null?xs:xr[0]?Ln.get(xr[0]):(Ji=Bi.find(function(Tr){return!Tr.props.disabled}))===null||Ji===void 0?void 0:Ji.key,Es=En.get(lt);if(lt&&Es){var Ks;Es==null||(Ks=Es.focus)===null||Ks===void 0||Ks.call(Es,Hi)}}}});var Yr=(0,Z.Z)($i||[],{value:ei,postState:function(Hi){return Array.isArray(Hi)?Hi:Hi==null?Xt:[Hi]}}),Js=(0,G.Z)(Yr,2),Ls=Js[0],er=Js[1],vr=function(Hi){if(Ri){var Ji=Hi.key,Pn=Ls.includes(Ji),Rn;Zi?Pn?Rn=Ls.filter(function(En){return En!==Ji}):Rn=[].concat((0,ue.Z)(Ls),[Ji]):Rn=[Ji],er(Rn);var ys=(0,Se.Z)((0,Se.Z)({},Hi),{},{selectedKeys:Rn});Pn?gi==null||gi(ys):Dt==null||Dt(ys)}!Zi&&zi.length&&Mn!=="inline"&&kn(Xt)},yr=Q(function(on){fn==null||fn(dt(on)),vr(on)}),tr=Q(function(on,Hi){var Ji=zi.filter(function(Rn){return Rn!==on});if(Hi)Ji.push(on);else if(Mn!=="inline"){var Pn=mr(on);Ji=Ji.filter(function(Rn){return!Pn.has(Rn)})}(0,k.Z)(zi,Ji,!0)||kn(Ji,!0)}),Er=function(Hi,Ji){var Pn=Ji!=null?Ji:!zi.includes(Hi);tr(Hi,Pn)},br=Te(Mn,xs,An,vn,Vn,Bs,Wr,Qs,Er,Cn);v.useEffect(function(){qn(!0)},[]);var Xr=v.useMemo(function(){return{_internalRenderMenuItem:$n,_internalRenderSubMenuItem:Fn}},[$n,Fn]),Sr=Mn!=="horizontal"||Ti?Bi:Bi.map(function(on,Hi){return v.createElement(R,{key:on.key,overflowDisabled:Hi>Ns},on)}),Is=v.createElement(l.Z,(0,F.Z)({id:wi,ref:Vn,prefixCls:"".concat(_t,"-overflow"),component:"ul",itemComponent:ut,className:oe()(_t,"".concat(_t,"-root"),"".concat(_t,"-").concat(Mn),bi,(0,pe.Z)((0,pe.Z)({},"".concat(_t,"-inline-collapsed"),fr),"".concat(_t,"-rtl"),An),Ot),dir:Si,style:Ut,role:"menu",tabIndex:yi,data:Sr,renderRawItem:function(Hi){return Hi},renderRawRest:function(Hi){var Ji=Hi.length,Pn=Ji?Bi.slice(-Ji):null;return v.createElement(at,{eventKey:X,title:yn,disabled:Fs,internalPopupClose:Ji===0,popupClassName:sn},Pn)},maxCount:Mn!=="horizontal"||Ti?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Hi){Hn(Hi)},onKeyDown:br},rs));return v.createElement(J.Provider,{value:Xr},v.createElement(A.Provider,{value:vn},v.createElement(R,{prefixCls:_t,rootClassName:Ot,mode:Mn,openKeys:zi,rtl:An,disabled:Di,motion:Xn?cn:null,defaultMotions:Xn?hn:null,activeKey:xs,onActive:Zr,onInactive:zr,selectedKeys:Ls,inlineIndent:Gi,subMenuOpenDelay:Fi,subMenuCloseDelay:Oi,forceSubMenuRender:Xi,builtinPlacements:xn,triggerSubMenuAction:ln,getPopupContainer:On,itemIcon:gn,expandIcon:bn,onItemClick:yr,onOpenChange:tr},v.createElement(xe.Provider,{value:es},Is),v.createElement("div",{style:{display:"none"},"aria-hidden":!0},v.createElement(se.Provider,{value:gr},ps)))))}),ht=Yt,At=ht;At.Item=ut,At.SubMenu=at,At.ItemGroup=ct,At.Divider=Mt;var Pt=At},11780:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return te}});var F=U(32855),pe=U(27247),Se=U(11913),ue=U(43079),G=U(59301),p=U(92310),ve=U.n(p),oe=U(29301),l=U(34280),Z=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],k=void 0;function g(S,b){var K=S.prefixCls,le=S.invalidate,Ee=S.item,Ne=S.renderItem,Qe=S.responsive,bt=S.responsiveDisabled,Lt=S.registerSize,ti=S.itemKey,ze=S.className,Ct=S.style,Ze=S.children,mt=S.display,Ye=S.order,ke=S.component,ge=ke===void 0?"div":ke,Ae=(0,ue.Z)(S,Z),ee=Qe&&!mt;function Re(re){Lt(ti,re)}G.useEffect(function(){return function(){Re(null)}},[]);var Te=Ne&&Ee!==k?Ne(Ee,{index:Ye}):Ze,q;le||(q={opacity:ee?0:1,height:ee?0:k,overflowY:ee?"hidden":k,order:Qe?Ye:k,pointerEvents:ee?"none":k,position:ee?"absolute":k});var W={};ee&&(W["aria-hidden"]=!0);var z=G.createElement(ge,(0,F.Z)({className:ve()(!le&&K,ze),style:(0,pe.Z)((0,pe.Z)({},q),Ct)},W,Ae,{ref:b}),Te);return Qe&&(z=G.createElement(oe.Z,{onResize:function(X){var $=X.offsetWidth;Re($)},disabled:bt},z)),z}var v=G.forwardRef(g);v.displayName="Item";var E=v,A=U(6089),M=U(4676),j=U(16089);function V(S){if(typeof MessageChannel=="undefined")(0,j.Z)(S);else{var b=new MessageChannel;b.port1.onmessage=function(){return S()},b.port2.postMessage(void 0)}}function L(){var S=G.useRef(null),b=function(le){S.current||(S.current=[],V(function(){(0,M.unstable_batchedUpdates)(function(){S.current.forEach(function(Ee){Ee()}),S.current=null})})),S.current.push(le)};return b}function I(S,b){var K=G.useState(b),le=(0,Se.Z)(K,2),Ee=le[0],Ne=le[1],Qe=(0,A.Z)(function(bt){S(function(){Ne(bt)})});return[Ee,Qe]}var w=G.createContext(null),R=["component"],Y=["className"],se=["className"],ne=function(b,K){var le=G.useContext(w);if(!le){var Ee=b.component,Ne=Ee===void 0?"div":Ee,Qe=(0,ue.Z)(b,R);return G.createElement(Ne,(0,F.Z)({},Qe,{ref:K}))}var bt=le.className,Lt=(0,ue.Z)(le,Y),ti=b.className,ze=(0,ue.Z)(b,se);return G.createElement(w.Provider,{value:null},G.createElement(E,(0,F.Z)({ref:K,className:ve()(bt,ti)},Lt,ze)))},ye=G.forwardRef(ne);ye.displayName="RawItem";var Ie=ye,xe=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],$e="responsive",J="invalidate";function D(S){return"+ ".concat(S.length," ...")}function N(S,b){var K=S.prefixCls,le=K===void 0?"rc-overflow":K,Ee=S.data,Ne=Ee===void 0?[]:Ee,Qe=S.renderItem,bt=S.renderRawItem,Lt=S.itemKey,ti=S.itemWidth,ze=ti===void 0?10:ti,Ct=S.ssr,Ze=S.style,mt=S.className,Ye=S.maxCount,ke=S.renderRest,ge=S.renderRawRest,Ae=S.suffix,ee=S.component,Re=ee===void 0?"div":ee,Te=S.itemComponent,q=S.onVisibleChange,W=(0,ue.Z)(S,xe),z=Ct==="full",re=L(),X=I(re,null),$=(0,Se.Z)(X,2),Q=$[0],ce=$[1],he=Q||0,we=I(re,new Map),Ke=(0,Se.Z)(we,2),Ve=Ke[0],Je=Ke[1],Ge=I(re,0),Fe=(0,Se.Z)(Ge,2),pt=Fe[0],De=Fe[1],it=I(re,0),Bt=(0,Se.Z)(it,2),vt=Bt[0],dt=Bt[1],Vt=I(re,0),ni=(0,Se.Z)(Vt,2),Qt=ni[0],Wt=ni[1],ri=(0,G.useState)(null),Rt=(0,Se.Z)(ri,2),ut=Rt[0],st=Rt[1],Nt=(0,G.useState)(null),Ht=(0,Se.Z)(Nt,2),wt=Ht[0],gt=Ht[1],St=G.useMemo(function(){return wt===null&&z?Number.MAX_SAFE_INTEGER:wt||0},[wt,Q]),Ei=(0,G.useState)(!1),zt=(0,Se.Z)(Ei,2),si=zt[0],It=zt[1],We="".concat(le,"-item"),h=Math.max(pt,vt),m=Ye===$e,y=Ne.length&&m,C=Ye===J,H=y||typeof Ye=="number"&&Ne.length>Ye,me=(0,G.useMemo)(function(){var At=Ne;return y?Q===null&&z?At=Ne:At=Ne.slice(0,Math.min(Ne.length,he/ze)):typeof Ye=="number"&&(At=Ne.slice(0,Ye)),At},[Ne,ze,Q,Ye,y]),fe=(0,G.useMemo)(function(){return y?Ne.slice(St+1):Ne.slice(me.length)},[Ne,me,y,St]),Ce=(0,G.useCallback)(function(At,Pt){var be;return typeof Lt=="function"?Lt(At):(be=Lt&&(At==null?void 0:At[Lt]))!==null&&be!==void 0?be:Pt},[Lt]),je=(0,G.useCallback)(Qe||function(At){return At},[Qe]);function at(At,Pt,be){wt===At&&(Pt===void 0||Pt===ut)||(gt(At),be||(It(At<Ne.length-1),q==null||q(At)),Pt!==void 0&&st(Pt))}function kt(At,Pt){ce(Pt.clientWidth)}function Mt(At,Pt){Je(function(be){var Be=new Map(be);return Pt===null?Be.delete(At):Be.set(At,Pt),Be})}function xt(At,Pt){dt(Pt),De(vt)}function Kt(At,Pt){Wt(Pt)}function Et(At){return Ve.get(Ce(me[At],At))}(0,l.Z)(function(){if(he&&typeof h=="number"&&me){var At=Qt,Pt=me.length,be=Pt-1;if(!Pt){at(0,null);return}for(var Be=0;Be<Pt;Be+=1){var et=Et(Be);if(z&&(et=et||0),et===void 0){at(Be-1,void 0,!0);break}if(At+=et,be===0&&At<=he||Be===be-1&&At+Et(be)<=he){at(be,null);break}else if(At+h>he){at(Be-1,At-et-Qt+vt);break}}Ae&&Et(0)+Qt>he&&st(null)}},[he,Ve,vt,Qt,Ce,me]);var ct=si&&!!fe.length,ot={};ut!==null&&y&&(ot={position:"absolute",left:ut,top:0});var yt={prefixCls:We,responsive:y,component:Te,invalidate:C},Tt=bt?function(At,Pt){var be=Ce(At,Pt);return G.createElement(w.Provider,{key:be,value:(0,pe.Z)((0,pe.Z)({},yt),{},{order:Pt,item:At,itemKey:be,registerSize:Mt,display:Pt<=St})},bt(At,Pt))}:function(At,Pt){var be=Ce(At,Pt);return G.createElement(E,(0,F.Z)({},yt,{order:Pt,key:be,item:At,renderItem:je,itemKey:be,registerSize:Mt,display:Pt<=St}))},mi={order:ct?St:Number.MAX_SAFE_INTEGER,className:"".concat(We,"-rest"),registerSize:xt,display:ct},Xt=ke||D,Yt=ge?G.createElement(w.Provider,{value:(0,pe.Z)((0,pe.Z)({},yt),mi)},ge(fe)):G.createElement(E,(0,F.Z)({},yt,mi),typeof Xt=="function"?Xt(fe):Xt),ht=G.createElement(Re,(0,F.Z)({className:ve()(!C&&le,mt),style:Ze,ref:b},W),me.map(Tt),H?Yt:null,Ae&&G.createElement(E,(0,F.Z)({},yt,{responsive:m,responsiveDisabled:!y,order:St,className:"".concat(We,"-suffix"),registerSize:Kt,display:!0,style:ot}),Ae));return m?G.createElement(oe.Z,{onResize:kt,disabled:!y},ht):ht}var O=G.forwardRef(N);O.displayName="Overflow",O.Item=Ie,O.RESPONSIVE=$e,O.INVALIDATE=J;var ae=O,te=ae},738:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return I}});var F=U(32855),pe=U(74430),Se=U(11913),ue=U(43079),G=U(92310),p=U.n(G),ve=U(18929),oe=U(10228),l=U(26112),Z=U(59301);function k(w,R){var Y=w.disabled,se=w.prefixCls,ne=w.character,ye=w.characterRender,Ie=w.index,xe=w.count,$e=w.value,J=w.allowHalf,D=w.focused,N=w.onHover,O=w.onClick,ae=function(Qe){N(Qe,Ie)},te=function(Qe){O(Qe,Ie)},S=function(Qe){Qe.keyCode===oe.Z.ENTER&&O(Qe,Ie)},b=Ie+1,K=new Set([se]);$e===0&&Ie===0&&D?K.add("".concat(se,"-focused")):J&&$e+.5>=b&&$e<b?(K.add("".concat(se,"-half")),K.add("".concat(se,"-active")),D&&K.add("".concat(se,"-focused"))):(b<=$e?K.add("".concat(se,"-full")):K.add("".concat(se,"-zero")),b===$e&&D&&K.add("".concat(se,"-focused")));var le=typeof ne=="function"?ne(w):ne,Ee=Z.createElement("li",{className:p()(Array.from(K)),ref:R},Z.createElement("div",{onClick:Y?null:te,onKeyDown:Y?null:S,onMouseMove:Y?null:ae,role:"radio","aria-checked":$e>Ie?"true":"false","aria-posinset":Ie+1,"aria-setsize":xe,tabIndex:Y?-1:0},Z.createElement("div",{className:"".concat(se,"-first")},le),Z.createElement("div",{className:"".concat(se,"-second")},le)));return ye&&(Ee=ye(Ee,w)),Ee}var g=Z.forwardRef(k);function v(){var w=Z.useRef({});function R(se){return w.current[se]}function Y(se){return function(ne){w.current[se]=ne}}return[R,Y]}function E(w){var R=w.pageXOffset,Y="scrollLeft";if(typeof R!="number"){var se=w.document;R=se.documentElement[Y],typeof R!="number"&&(R=se.body[Y])}return R}function A(w){var R,Y,se=w.ownerDocument,ne=se.body,ye=se&&se.documentElement,Ie=w.getBoundingClientRect();return R=Ie.left,Y=Ie.top,R-=ye.clientLeft||ne.clientLeft||0,Y-=ye.clientTop||ne.clientTop||0,{left:R,top:Y}}function M(w){var R=A(w),Y=w.ownerDocument,se=Y.defaultView||Y.parentWindow;return R.left+=E(se),R.left}var j=["prefixCls","className","defaultValue","value","count","allowHalf","allowClear","keyboard","character","characterRender","disabled","direction","tabIndex","autoFocus","onHoverChange","onChange","onFocus","onBlur","onKeyDown","onMouseLeave"];function V(w,R){var Y=w.prefixCls,se=Y===void 0?"rc-rate":Y,ne=w.className,ye=w.defaultValue,Ie=w.value,xe=w.count,$e=xe===void 0?5:xe,J=w.allowHalf,D=J===void 0?!1:J,N=w.allowClear,O=N===void 0?!0:N,ae=w.keyboard,te=ae===void 0?!0:ae,S=w.character,b=S===void 0?"\u2605":S,K=w.characterRender,le=w.disabled,Ee=w.direction,Ne=Ee===void 0?"ltr":Ee,Qe=w.tabIndex,bt=Qe===void 0?0:Qe,Lt=w.autoFocus,ti=w.onHoverChange,ze=w.onChange,Ct=w.onFocus,Ze=w.onBlur,mt=w.onKeyDown,Ye=w.onMouseLeave,ke=(0,ue.Z)(w,j),ge=v(),Ae=(0,Se.Z)(ge,2),ee=Ae[0],Re=Ae[1],Te=Z.useRef(null),q=function(){if(!le){var st;(st=Te.current)===null||st===void 0||st.focus()}};Z.useImperativeHandle(R,function(){return{focus:q,blur:function(){if(!le){var st;(st=Te.current)===null||st===void 0||st.blur()}}}});var W=(0,ve.Z)(ye||0,{value:Ie}),z=(0,Se.Z)(W,2),re=z[0],X=z[1],$=(0,ve.Z)(null),Q=(0,Se.Z)($,2),ce=Q[0],he=Q[1],we=function(st,Nt){var Ht=Ne==="rtl",wt=st+1;if(D){var gt=ee(st),St=M(gt),Ei=gt.clientWidth;(Ht&&Nt-St>Ei/2||!Ht&&Nt-St<Ei/2)&&(wt-=.5)}return wt},Ke=function(st){X(st),ze==null||ze(st)},Ve=Z.useState(!1),Je=(0,Se.Z)(Ve,2),Ge=Je[0],Fe=Je[1],pt=function(){Fe(!0),Ct==null||Ct()},De=function(){Fe(!1),Ze==null||Ze()},it=Z.useState(null),Bt=(0,Se.Z)(it,2),vt=Bt[0],dt=Bt[1],Vt=function(st,Nt){var Ht=we(Nt,st.pageX);Ht!==ce&&(dt(Ht),he(null)),ti==null||ti(Ht)},ni=function(st){le||(dt(null),he(null),ti==null||ti(void 0)),st&&(Ye==null||Ye(st))},Qt=function(st,Nt){var Ht=we(Nt,st.pageX),wt=!1;O&&(wt=Ht===re),ni(),Ke(wt?0:Ht),he(wt?Ht:null)},Wt=function(st){var Nt=st.keyCode,Ht=Ne==="rtl",wt=D?.5:1;te&&(Nt===oe.Z.RIGHT&&re<$e&&!Ht?(Ke(re+wt),st.preventDefault()):Nt===oe.Z.LEFT&&re>0&&!Ht||Nt===oe.Z.RIGHT&&re>0&&Ht?(Ke(re-wt),st.preventDefault()):Nt===oe.Z.LEFT&&re<$e&&Ht&&(Ke(re+wt),st.preventDefault())),mt==null||mt(st)};Z.useEffect(function(){Lt&&!le&&q()},[]);var ri=new Array($e).fill(0).map(function(ut,st){return Z.createElement(g,{ref:Re(st),index:st,count:$e,disabled:le,prefixCls:"".concat(se,"-star"),allowHalf:D,value:vt===null?re:vt,onClick:Qt,onHover:Vt,key:ut||st,character:b,characterRender:K,focused:Ge})}),Rt=p()(se,ne,(0,pe.Z)((0,pe.Z)({},"".concat(se,"-disabled"),le),"".concat(se,"-rtl"),Ne==="rtl"));return Z.createElement("ul",(0,F.Z)({className:Rt,onMouseLeave:ni,tabIndex:le?-1:bt,onFocus:le?null:pt,onBlur:le?null:De,onKeyDown:le?null:Wt,ref:Te},(0,l.Z)(ke,{aria:!0,data:!0,attr:!0})),ri)}var L=Z.forwardRef(V),I=L},29301:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return J}});var F=U(32855),pe=U(59301),Se=U(11592),ue=U(48736),G=U(27247),p=U(34666),ve=U(76846),oe=U(8654),l=pe.createContext(null);function Z(D){var N=D.children,O=D.onBatchResize,ae=pe.useRef(0),te=pe.useRef([]),S=pe.useContext(l),b=pe.useCallback(function(K,le,Ee){ae.current+=1;var Ne=ae.current;te.current.push({size:K,element:le,data:Ee}),Promise.resolve().then(function(){Ne===ae.current&&(O==null||O(te.current),te.current=[])}),S==null||S(K,le,Ee)},[O,S]);return pe.createElement(l.Provider,{value:b},N)}var k=U(76374),g=new Map;function v(D){D.forEach(function(N){var O,ae=N.target;(O=g.get(ae))===null||O===void 0||O.forEach(function(te){return te(ae)})})}var E=new k.Z(v),A=null,M=null;function j(D,N){g.has(D)||(g.set(D,new Set),E.observe(D)),g.get(D).add(N)}function V(D,N){g.has(D)&&(g.get(D).delete(N),g.get(D).size||(E.unobserve(D),g.delete(D)))}var L=U(33377),I=U(93912),w=U(18881),R=U(85461),Y=function(D){(0,w.Z)(O,D);var N=(0,R.Z)(O);function O(){return(0,L.Z)(this,O),N.apply(this,arguments)}return(0,I.Z)(O,[{key:"render",value:function(){return this.props.children}}]),O}(pe.Component);function se(D,N){var O=D.children,ae=D.disabled,te=pe.useRef(null),S=pe.useRef(null),b=pe.useContext(l),K=typeof O=="function",le=K?O(te):O,Ee=pe.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ne=!K&&pe.isValidElement(le)&&(0,oe.Yr)(le),Qe=Ne?(0,oe.C4)(le):null,bt=(0,oe.x1)(Qe,te),Lt=function(){var Ze;return(0,ve.ZP)(te.current)||(te.current&&(0,p.Z)(te.current)==="object"?(0,ve.ZP)((Ze=te.current)===null||Ze===void 0?void 0:Ze.nativeElement):null)||(0,ve.ZP)(S.current)};pe.useImperativeHandle(N,function(){return Lt()});var ti=pe.useRef(D);ti.current=D;var ze=pe.useCallback(function(Ct){var Ze=ti.current,mt=Ze.onResize,Ye=Ze.data,ke=Ct.getBoundingClientRect(),ge=ke.width,Ae=ke.height,ee=Ct.offsetWidth,Re=Ct.offsetHeight,Te=Math.floor(ge),q=Math.floor(Ae);if(Ee.current.width!==Te||Ee.current.height!==q||Ee.current.offsetWidth!==ee||Ee.current.offsetHeight!==Re){var W={width:Te,height:q,offsetWidth:ee,offsetHeight:Re};Ee.current=W;var z=ee===Math.round(ge)?ge:ee,re=Re===Math.round(Ae)?Ae:Re,X=(0,G.Z)((0,G.Z)({},W),{},{offsetWidth:z,offsetHeight:re});b==null||b(X,Ct,Ye),mt&&Promise.resolve().then(function(){mt(X,Ct)})}},[]);return pe.useEffect(function(){var Ct=Lt();return Ct&&!ae&&j(Ct,ze),function(){return V(Ct,ze)}},[te.current,ae]),pe.createElement(Y,{ref:S},Ne?pe.cloneElement(le,{ref:bt}):le)}var ne=pe.forwardRef(se),ye=ne,Ie="rc-observer-key";function xe(D,N){var O=D.children,ae=typeof O=="function"?[O]:(0,Se.Z)(O);return ae.map(function(te,S){var b=(te==null?void 0:te.key)||"".concat(Ie,"-").concat(S);return pe.createElement(ye,(0,F.Z)({},D,{key:b,ref:S===0?N:void 0}),te)})}var $e=pe.forwardRef(xe);$e.Collection=Z;var J=$e},63158:function(Zt,nt,U){"use strict";var F=U(32855),pe=U(74430),Se=U(11913),ue=U(43079),G=U(59301),p=U(92310),ve=U.n(p),oe=U(18929),l=U(10228),Z=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],k=G.forwardRef(function(g,v){var E,A=g.prefixCls,M=A===void 0?"rc-switch":A,j=g.className,V=g.checked,L=g.defaultChecked,I=g.disabled,w=g.loadingIcon,R=g.checkedChildren,Y=g.unCheckedChildren,se=g.onClick,ne=g.onChange,ye=g.onKeyDown,Ie=(0,ue.Z)(g,Z),xe=(0,oe.Z)(!1,{value:V,defaultValue:L}),$e=(0,Se.Z)(xe,2),J=$e[0],D=$e[1];function N(S,b){var K=J;return I||(K=S,D(K),ne==null||ne(K,b)),K}function O(S){S.which===l.Z.LEFT?N(!1,S):S.which===l.Z.RIGHT&&N(!0,S),ye==null||ye(S)}function ae(S){var b=N(!J,S);se==null||se(b,S)}var te=ve()(M,j,(E={},(0,pe.Z)(E,"".concat(M,"-checked"),J),(0,pe.Z)(E,"".concat(M,"-disabled"),I),E));return G.createElement("button",(0,F.Z)({},Ie,{type:"button",role:"switch","aria-checked":J,disabled:I,className:te,ref:v,onKeyDown:O,onClick:ae}),w,G.createElement("span",{className:"".concat(M,"-inner")},G.createElement("span",{className:"".concat(M,"-inner-checked")},R),G.createElement("span",{className:"".concat(M,"-inner-unchecked")},Y)))});k.displayName="Switch",nt.Z=k},29125:function(Zt,nt,U){"use strict";U.d(nt,{G:function(){return ue},Z:function(){return V}});var F=U(92310),pe=U.n(F),Se=U(59301);function ue(L){var I=L.children,w=L.prefixCls,R=L.id,Y=L.overlayInnerStyle,se=L.bodyClassName,ne=L.className,ye=L.style;return Se.createElement("div",{className:pe()("".concat(w,"-content"),ne),style:ye},Se.createElement("div",{className:pe()("".concat(w,"-inner"),se),id:R,role:"tooltip",style:Y},typeof I=="function"?I():I))}var G=U(32855),p=U(27247),ve=U(43079),oe=U(65030),l={shiftX:64,adjustY:1},Z={adjustX:1,shiftY:!0},k=[0,0],g={left:{points:["cr","cl"],overflow:Z,offset:[-4,0],targetOffset:k},right:{points:["cl","cr"],overflow:Z,offset:[4,0],targetOffset:k},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:k},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:k},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:k},leftTop:{points:["tr","tl"],overflow:Z,offset:[-4,0],targetOffset:k},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:k},rightTop:{points:["tl","tr"],overflow:Z,offset:[4,0],targetOffset:k},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:k},rightBottom:{points:["bl","br"],overflow:Z,offset:[4,0],targetOffset:k},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:k},leftBottom:{points:["br","bl"],overflow:Z,offset:[-4,0],targetOffset:k}},v=null,E=U(80402),A=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],M=function(I,w){var R=I.overlayClassName,Y=I.trigger,se=Y===void 0?["hover"]:Y,ne=I.mouseEnterDelay,ye=ne===void 0?0:ne,Ie=I.mouseLeaveDelay,xe=Ie===void 0?.1:Ie,$e=I.overlayStyle,J=I.prefixCls,D=J===void 0?"rc-tooltip":J,N=I.children,O=I.onVisibleChange,ae=I.afterVisibleChange,te=I.transitionName,S=I.animation,b=I.motion,K=I.placement,le=K===void 0?"right":K,Ee=I.align,Ne=Ee===void 0?{}:Ee,Qe=I.destroyTooltipOnHide,bt=Qe===void 0?!1:Qe,Lt=I.defaultVisible,ti=I.getTooltipContainer,ze=I.overlayInnerStyle,Ct=I.arrowContent,Ze=I.overlay,mt=I.id,Ye=I.showArrow,ke=Ye===void 0?!0:Ye,ge=I.classNames,Ae=I.styles,ee=(0,ve.Z)(I,A),Re=(0,E.Z)(mt),Te=(0,Se.useRef)(null);(0,Se.useImperativeHandle)(w,function(){return Te.current});var q=(0,p.Z)({},ee);"visible"in I&&(q.popupVisible=I.visible);var W=function(){return Se.createElement(ue,{key:"content",prefixCls:D,id:Re,bodyClassName:ge==null?void 0:ge.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},ze),Ae==null?void 0:Ae.body)},Ze)},z=function(){var X=Se.Children.only(N),$=(X==null?void 0:X.props)||{},Q=(0,p.Z)((0,p.Z)({},$),{},{"aria-describedby":Ze?Re:null});return Se.cloneElement(N,Q)};return Se.createElement(oe.Z,(0,G.Z)({popupClassName:pe()(R,ge==null?void 0:ge.root),prefixCls:D,popup:W,action:se,builtinPlacements:g,popupPlacement:le,ref:Te,popupAlign:Ne,getPopupContainer:ti,onPopupVisibleChange:O,afterPopupVisibleChange:ae,popupTransitionName:te,popupAnimation:S,popupMotion:b,defaultPopupVisible:Lt,autoDestroy:bt,mouseLeaveDelay:xe,popupStyle:(0,p.Z)((0,p.Z)({},$e),Ae==null?void 0:Ae.root),mouseEnterDelay:ye,arrow:ke},q),z())},j=(0,Se.forwardRef)(M),V=j},639:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return I}});var F=U(32855),pe=U(74430),Se=U(27247),ue=U(11913),G=U(43079),p=U(59301),ve=U(92310),oe=U.n(ve),l=U(26112),Z=U(30699),k=function(R){for(var Y=R.prefixCls,se=R.level,ne=R.isStart,ye=R.isEnd,Ie="".concat(Y,"-indent-unit"),xe=[],$e=0;$e<se;$e+=1)xe.push(p.createElement("span",{key:$e,className:oe()(Ie,(0,pe.Z)((0,pe.Z)({},"".concat(Ie,"-start"),ne[$e]),"".concat(Ie,"-end"),ye[$e]))}));return p.createElement("span",{"aria-hidden":"true",className:"".concat(Y,"-indent")},xe)},g=p.memo(k),v=U(65065),E=U(34061),A=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],M="open",j="close",V="---",L=function(R){var Y,se,ne,ye=R.eventKey,Ie=R.className,xe=R.style,$e=R.dragOver,J=R.dragOverGapTop,D=R.dragOverGapBottom,N=R.isLeaf,O=R.isStart,ae=R.isEnd,te=R.expanded,S=R.selected,b=R.checked,K=R.halfChecked,le=R.loading,Ee=R.domRef,Ne=R.active,Qe=R.data,bt=R.onMouseMove,Lt=R.selectable,ti=(0,G.Z)(R,A),ze=p.useContext(Z.k),Ct=p.useContext(Z.y),Ze=p.useRef(null),mt=p.useState(!1),Ye=(0,ue.Z)(mt,2),ke=Ye[0],ge=Ye[1],Ae=!!(ze.disabled||R.disabled||(Y=Ct.nodeDisabled)!==null&&Y!==void 0&&Y.call(Ct,Qe)),ee=p.useMemo(function(){return!ze.checkable||R.checkable===!1?!1:ze.checkable},[ze.checkable,R.checkable]),Re=function(gt){Ae||ze.onNodeSelect(gt,(0,E.F)(R))},Te=function(gt){Ae||!ee||R.disableCheckbox||ze.onNodeCheck(gt,(0,E.F)(R),!b)},q=p.useMemo(function(){return typeof Lt=="boolean"?Lt:ze.selectable},[Lt,ze.selectable]),W=function(gt){ze.onNodeClick(gt,(0,E.F)(R)),q?Re(gt):Te(gt)},z=function(gt){ze.onNodeDoubleClick(gt,(0,E.F)(R))},re=function(gt){ze.onNodeMouseEnter(gt,(0,E.F)(R))},X=function(gt){ze.onNodeMouseLeave(gt,(0,E.F)(R))},$=function(gt){ze.onNodeContextMenu(gt,(0,E.F)(R))},Q=p.useMemo(function(){return!!(ze.draggable&&(!ze.draggable.nodeDraggable||ze.draggable.nodeDraggable(Qe)))},[ze.draggable,Qe]),ce=function(gt){gt.stopPropagation(),ge(!0),ze.onNodeDragStart(gt,R);try{gt.dataTransfer.setData("text/plain","")}catch(St){}},he=function(gt){gt.preventDefault(),gt.stopPropagation(),ze.onNodeDragEnter(gt,R)},we=function(gt){gt.preventDefault(),gt.stopPropagation(),ze.onNodeDragOver(gt,R)},Ke=function(gt){gt.stopPropagation(),ze.onNodeDragLeave(gt,R)},Ve=function(gt){gt.stopPropagation(),ge(!1),ze.onNodeDragEnd(gt,R)},Je=function(gt){gt.preventDefault(),gt.stopPropagation(),ge(!1),ze.onNodeDrop(gt,R)},Ge=function(gt){le||ze.onNodeExpand(gt,(0,E.F)(R))},Fe=p.useMemo(function(){var wt=(0,v.Z)(ze.keyEntities,ye)||{},gt=wt.children;return!!(gt||[]).length},[ze.keyEntities,ye]),pt=p.useMemo(function(){return N===!1?!1:N||!ze.loadData&&!Fe||ze.loadData&&R.loaded&&!Fe},[N,ze.loadData,Fe,R.loaded]);p.useEffect(function(){le||typeof ze.loadData=="function"&&te&&!pt&&!R.loaded&&ze.onNodeLoad((0,E.F)(R))},[le,ze.loadData,ze.onNodeLoad,te,pt,R]);var De=p.useMemo(function(){var wt;return(wt=ze.draggable)!==null&&wt!==void 0&&wt.icon?p.createElement("span",{className:"".concat(ze.prefixCls,"-draggable-icon")},ze.draggable.icon):null},[ze.draggable]),it=function(gt){var St=R.switcherIcon||ze.switcherIcon;return typeof St=="function"?St((0,Se.Z)((0,Se.Z)({},R),{},{isLeaf:gt})):St},Bt=function(){if(pt){var gt=it(!0);return gt!==!1?p.createElement("span",{className:oe()("".concat(ze.prefixCls,"-switcher"),"".concat(ze.prefixCls,"-switcher-noop"))},gt):null}var St=it(!1);return St!==!1?p.createElement("span",{onClick:Ge,className:oe()("".concat(ze.prefixCls,"-switcher"),"".concat(ze.prefixCls,"-switcher_").concat(te?M:j))},St):null},vt=p.useMemo(function(){if(!ee)return null;var wt=typeof ee!="boolean"?ee:null;return p.createElement("span",{className:oe()("".concat(ze.prefixCls,"-checkbox"),(0,pe.Z)((0,pe.Z)((0,pe.Z)({},"".concat(ze.prefixCls,"-checkbox-checked"),b),"".concat(ze.prefixCls,"-checkbox-indeterminate"),!b&&K),"".concat(ze.prefixCls,"-checkbox-disabled"),Ae||R.disableCheckbox)),onClick:Te,role:"checkbox","aria-checked":K?"mixed":b,"aria-disabled":Ae||R.disableCheckbox,"aria-label":"Select ".concat(typeof R.title=="string"?R.title:"tree node")},wt)},[ee,b,K,Ae,R.disableCheckbox,R.title]),dt=p.useMemo(function(){return pt?null:te?M:j},[pt,te]),Vt=p.useMemo(function(){return p.createElement("span",{className:oe()("".concat(ze.prefixCls,"-iconEle"),"".concat(ze.prefixCls,"-icon__").concat(dt||"docu"),(0,pe.Z)({},"".concat(ze.prefixCls,"-icon_loading"),le))})},[ze.prefixCls,dt,le]),ni=p.useMemo(function(){var wt=!!ze.draggable,gt=!R.disabled&&wt&&ze.dragOverNodeKey===ye;return gt?ze.dropIndicatorRender({dropPosition:ze.dropPosition,dropLevelOffset:ze.dropLevelOffset,indent:ze.indent,prefixCls:ze.prefixCls,direction:ze.direction}):null},[ze.dropPosition,ze.dropLevelOffset,ze.indent,ze.prefixCls,ze.direction,ze.draggable,ze.dragOverNodeKey,ze.dropIndicatorRender]),Qt=p.useMemo(function(){var wt=R.title,gt=wt===void 0?V:wt,St="".concat(ze.prefixCls,"-node-content-wrapper"),Ei;if(ze.showIcon){var zt=R.icon||ze.icon;Ei=zt?p.createElement("span",{className:oe()("".concat(ze.prefixCls,"-iconEle"),"".concat(ze.prefixCls,"-icon__customize"))},typeof zt=="function"?zt(R):zt):Vt}else ze.loadData&&le&&(Ei=Vt);var si;return typeof gt=="function"?si=gt(Qe):ze.titleRender?si=ze.titleRender(Qe):si=gt,p.createElement("span",{ref:Ze,title:typeof gt=="string"?gt:"",className:oe()(St,"".concat(St,"-").concat(dt||"normal"),(0,pe.Z)({},"".concat(ze.prefixCls,"-node-selected"),!Ae&&(S||ke))),onMouseEnter:re,onMouseLeave:X,onContextMenu:$,onClick:W,onDoubleClick:z},Ei,p.createElement("span",{className:"".concat(ze.prefixCls,"-title")},si),ni)},[ze.prefixCls,ze.showIcon,R,ze.icon,Vt,ze.titleRender,Qe,dt,re,X,$,W,z]),Wt=(0,l.Z)(ti,{aria:!0,data:!0}),ri=(0,v.Z)(ze.keyEntities,ye)||{},Rt=ri.level,ut=ae[ae.length-1],st=!Ae&&Q,Nt=ze.draggingNodeKey===ye,Ht=Lt!==void 0?{"aria-selected":!!Lt}:void 0;return p.createElement("div",(0,F.Z)({ref:Ee,role:"treeitem","aria-expanded":N?void 0:te,className:oe()(Ie,"".concat(ze.prefixCls,"-treenode"),(ne={},(0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)(ne,"".concat(ze.prefixCls,"-treenode-disabled"),Ae),"".concat(ze.prefixCls,"-treenode-switcher-").concat(te?"open":"close"),!N),"".concat(ze.prefixCls,"-treenode-checkbox-checked"),b),"".concat(ze.prefixCls,"-treenode-checkbox-indeterminate"),K),"".concat(ze.prefixCls,"-treenode-selected"),S),"".concat(ze.prefixCls,"-treenode-loading"),le),"".concat(ze.prefixCls,"-treenode-active"),Ne),"".concat(ze.prefixCls,"-treenode-leaf-last"),ut),"".concat(ze.prefixCls,"-treenode-draggable"),Q),"dragging",Nt),(0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)((0,pe.Z)(ne,"drop-target",ze.dropTargetKey===ye),"drop-container",ze.dropContainerKey===ye),"drag-over",!Ae&&$e),"drag-over-gap-top",!Ae&&J),"drag-over-gap-bottom",!Ae&&D),"filter-node",(se=ze.filterTreeNode)===null||se===void 0?void 0:se.call(ze,(0,E.F)(R))),"".concat(ze.prefixCls,"-treenode-leaf"),pt))),style:xe,draggable:st,onDragStart:st?ce:void 0,onDragEnter:Q?he:void 0,onDragOver:Q?we:void 0,onDragLeave:Q?Ke:void 0,onDrop:Q?Je:void 0,onDragEnd:Q?Ve:void 0,onMouseMove:bt},Ht,Wt),p.createElement(g,{prefixCls:ze.prefixCls,level:Rt,isStart:O,isEnd:ae}),De,Bt(),vt,Qt)};L.isTreeNode=1;var I=L},30699:function(Zt,nt,U){"use strict";U.d(nt,{k:function(){return pe},y:function(){return Se}});var F=U(59301),pe=F.createContext(null),Se=F.createContext({})},89149:function(Zt,nt,U){"use strict";U.d(nt,{OF:function(){return ye.Z},y6:function(){return j.y},ZP:function(){return Ae}});var F=U(32855),pe=U(34666),Se=U(27247),ue=U(3300),G=U(33377),p=U(93912),ve=U(83383),oe=U(18881),l=U(85461),Z=U(74430),k=U(92310),g=U.n(k),v=U(10228),E=U(26112),A=U(48736),M=U(59301),j=U(30699),V=function(Re){var Te=Re.dropPosition,q=Re.dropLevelOffset,W=Re.indent,z={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(Te){case-1:z.top=0,z.left=-q*W;break;case 1:z.bottom=0,z.left=-q*W;break;case 0:z.bottom=0,z.left=W;break}return M.createElement("div",{style:z})},L=V;function I(ee){if(ee==null)throw new TypeError("Cannot destructure "+ee)}var w=U(11913),R=U(43079),Y=U(34280),se=U(6790),ne=U(77900),ye=U(639);function Ie(ee,Re){var Te=M.useState(!1),q=(0,w.Z)(Te,2),W=q[0],z=q[1];(0,Y.Z)(function(){if(W)return ee(),function(){Re()}},[W]),(0,Y.Z)(function(){return z(!0),function(){z(!1)}},[])}var xe=Ie,$e=U(34061),J=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],D=M.forwardRef(function(ee,Re){var Te=ee.className,q=ee.style,W=ee.motion,z=ee.motionNodes,re=ee.motionType,X=ee.onMotionStart,$=ee.onMotionEnd,Q=ee.active,ce=ee.treeNodeRequiredProps,he=(0,R.Z)(ee,J),we=M.useState(!0),Ke=(0,w.Z)(we,2),Ve=Ke[0],Je=Ke[1],Ge=M.useContext(j.k),Fe=Ge.prefixCls,pt=z&&re!=="hide";(0,Y.Z)(function(){z&&pt!==Ve&&Je(pt)},[z]);var De=function(){z&&X()},it=M.useRef(!1),Bt=function(){z&&!it.current&&(it.current=!0,$())};xe(De,Bt);var vt=function(Vt){pt===Vt&&Bt()};return z?M.createElement(ne.default,(0,F.Z)({ref:Re,visible:Ve},W,{motionAppear:re==="show",onVisibleChanged:vt}),function(dt,Vt){var ni=dt.className,Qt=dt.style;return M.createElement("div",{ref:Vt,className:g()("".concat(Fe,"-treenode-motion"),ni),style:Qt},z.map(function(Wt){var ri=Object.assign({},(I(Wt.data),Wt.data)),Rt=Wt.title,ut=Wt.key,st=Wt.isStart,Nt=Wt.isEnd;delete ri.children;var Ht=(0,$e.H8)(ut,ce);return M.createElement(ye.Z,(0,F.Z)({},ri,Ht,{title:Rt,active:Q,data:Wt.data,key:ut,isStart:st,isEnd:Nt}))}))}):M.createElement(ye.Z,(0,F.Z)({domRef:Re,className:Te,style:q},he,{active:Q}))}),N=D;function O(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Te=ee.length,q=Re.length;if(Math.abs(Te-q)!==1)return{add:!1,key:null};function W(z,re){var X=new Map;z.forEach(function(Q){X.set(Q,!0)});var $=re.filter(function(Q){return!X.has(Q)});return $.length===1?$[0]:null}return Te<q?{add:!0,key:W(ee,Re)}:{add:!1,key:W(Re,ee)}}function ae(ee,Re,Te){var q=ee.findIndex(function(X){return X.key===Te}),W=ee[q+1],z=Re.findIndex(function(X){return X.key===Te});if(W){var re=Re.findIndex(function(X){return X.key===W.key});return Re.slice(z+1,re)}return Re.slice(z+1)}var te=["prefixCls","data","selectable","checkable","expandedKeys","selectedKeys","checkedKeys","loadedKeys","loadingKeys","halfCheckedKeys","keyEntities","disabled","dragging","dragOverNodeKey","dropPosition","motion","height","itemHeight","virtual","scrollWidth","focusable","activeItem","focused","tabIndex","onKeyDown","onFocus","onBlur","onActiveChange","onListChangeStart","onListChangeEnd"],S={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},b=function(){},K="RC_TREE_MOTION_".concat(Math.random()),le={key:K},Ee={key:K,level:0,index:0,pos:"0",node:le,nodes:[le]},Ne={parent:null,children:[],pos:Ee.pos,data:le,title:null,key:K,isStart:[],isEnd:[]};function Qe(ee,Re,Te,q){return Re===!1||!Te?ee:ee.slice(0,Math.ceil(Te/q)+1)}function bt(ee){var Re=ee.key,Te=ee.pos;return(0,$e.km)(Re,Te)}function Lt(ee){for(var Re=String(ee.data.key),Te=ee;Te.parent;)Te=Te.parent,Re="".concat(Te.data.key," > ").concat(Re);return Re}var ti=M.forwardRef(function(ee,Re){var Te=ee.prefixCls,q=ee.data,W=ee.selectable,z=ee.checkable,re=ee.expandedKeys,X=ee.selectedKeys,$=ee.checkedKeys,Q=ee.loadedKeys,ce=ee.loadingKeys,he=ee.halfCheckedKeys,we=ee.keyEntities,Ke=ee.disabled,Ve=ee.dragging,Je=ee.dragOverNodeKey,Ge=ee.dropPosition,Fe=ee.motion,pt=ee.height,De=ee.itemHeight,it=ee.virtual,Bt=ee.scrollWidth,vt=ee.focusable,dt=ee.activeItem,Vt=ee.focused,ni=ee.tabIndex,Qt=ee.onKeyDown,Wt=ee.onFocus,ri=ee.onBlur,Rt=ee.onActiveChange,ut=ee.onListChangeStart,st=ee.onListChangeEnd,Nt=(0,R.Z)(ee,te),Ht=M.useRef(null),wt=M.useRef(null);M.useImperativeHandle(Re,function(){return{scrollTo:function(Tt){Ht.current.scrollTo(Tt)},getIndentWidth:function(){return wt.current.offsetWidth}}});var gt=M.useState(re),St=(0,w.Z)(gt,2),Ei=St[0],zt=St[1],si=M.useState(q),It=(0,w.Z)(si,2),We=It[0],h=It[1],m=M.useState(q),y=(0,w.Z)(m,2),C=y[0],H=y[1],me=M.useState([]),fe=(0,w.Z)(me,2),Ce=fe[0],je=fe[1],at=M.useState(null),kt=(0,w.Z)(at,2),Mt=kt[0],xt=kt[1],Kt=M.useRef(q);Kt.current=q;function Et(){var yt=Kt.current;h(yt),H(yt),je([]),xt(null),st()}(0,Y.Z)(function(){zt(re);var yt=O(Ei,re);if(yt.key!==null)if(yt.add){var Tt=We.findIndex(function(Pt){var be=Pt.key;return be===yt.key}),mi=Qe(ae(We,q,yt.key),it,pt,De),Xt=We.slice();Xt.splice(Tt+1,0,Ne),H(Xt),je(mi),xt("show")}else{var Yt=q.findIndex(function(Pt){var be=Pt.key;return be===yt.key}),ht=Qe(ae(q,We,yt.key),it,pt,De),At=q.slice();At.splice(Yt+1,0,Ne),H(At),je(ht),xt("hide")}else We!==q&&(h(q),H(q))},[re,q]),M.useEffect(function(){Ve||Et()},[Ve]);var ct=Fe?C:q,ot={expandedKeys:re,selectedKeys:X,loadedKeys:Q,loadingKeys:ce,checkedKeys:$,halfCheckedKeys:he,dragOverNodeKey:Je,dropPosition:Ge,keyEntities:we};return M.createElement(M.Fragment,null,Vt&&dt&&M.createElement("span",{style:S,"aria-live":"assertive"},Lt(dt)),M.createElement("div",null,M.createElement("input",{style:S,disabled:vt===!1||Ke,tabIndex:vt!==!1?ni:null,onKeyDown:Qt,onFocus:Wt,onBlur:ri,value:"",onChange:b,"aria-label":"for screen reader"})),M.createElement("div",{className:"".concat(Te,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},M.createElement("div",{className:"".concat(Te,"-indent")},M.createElement("div",{ref:wt,className:"".concat(Te,"-indent-unit")}))),M.createElement(se.Z,(0,F.Z)({},Nt,{data:ct,itemKey:bt,height:pt,fullHeight:!1,virtual:it,itemHeight:De,scrollWidth:Bt,prefixCls:"".concat(Te,"-list"),ref:Ht,role:"tree",onVisibleChange:function(Tt){Tt.every(function(mi){return bt(mi)!==K})&&Et()}}),function(yt){var Tt=yt.pos,mi=Object.assign({},(I(yt.data),yt.data)),Xt=yt.title,Yt=yt.key,ht=yt.isStart,At=yt.isEnd,Pt=(0,$e.km)(Yt,Tt);delete mi.key,delete mi.children;var be=(0,$e.H8)(Pt,ot);return M.createElement(N,(0,F.Z)({},mi,be,{title:Xt,active:!!dt&&Yt===dt.key,pos:Tt,data:yt.data,isStart:ht,isEnd:At,motion:Fe,motionNodes:Yt===K?Ce:null,motionType:Mt,onMotionStart:ut,onMotionEnd:Et,treeNodeRequiredProps:ot,onMouseMove:function(){Rt(null)}}))}))}),ze=ti,Ct=U(82661),Ze=U(34643),mt=U(65065),Ye=10,ke=function(ee){(0,oe.Z)(Te,ee);var Re=(0,l.Z)(Te);function Te(){var q;(0,G.Z)(this,Te);for(var W=arguments.length,z=new Array(W),re=0;re<W;re++)z[re]=arguments[re];return q=Re.call.apply(Re,[this].concat(z)),(0,Z.Z)((0,ve.Z)(q),"destroyed",!1),(0,Z.Z)((0,ve.Z)(q),"delayedDragEnterLogic",void 0),(0,Z.Z)((0,ve.Z)(q),"loadingRetryTimes",{}),(0,Z.Z)((0,ve.Z)(q),"state",{keyEntities:{},indent:null,selectedKeys:[],checkedKeys:[],halfCheckedKeys:[],loadedKeys:[],loadingKeys:[],expandedKeys:[],draggingNodeKey:null,dragChildrenKeys:[],dropTargetKey:null,dropPosition:null,dropContainerKey:null,dropLevelOffset:null,dropTargetPos:null,dropAllowed:!0,dragOverNodeKey:null,treeData:[],flattenNodes:[],focused:!1,activeKey:null,listChanging:!1,prevProps:null,fieldNames:(0,$e.w$)()}),(0,Z.Z)((0,ve.Z)(q),"dragStartMousePosition",null),(0,Z.Z)((0,ve.Z)(q),"dragNodeProps",null),(0,Z.Z)((0,ve.Z)(q),"currentMouseOverDroppableNodeKey",null),(0,Z.Z)((0,ve.Z)(q),"listRef",M.createRef()),(0,Z.Z)((0,ve.Z)(q),"onNodeDragStart",function(X,$){var Q=q.state,ce=Q.expandedKeys,he=Q.keyEntities,we=q.props.onDragStart,Ke=$.eventKey;q.dragNodeProps=$,q.dragStartMousePosition={x:X.clientX,y:X.clientY};var Ve=(0,Ct._5)(ce,Ke);q.setState({draggingNodeKey:Ke,dragChildrenKeys:(0,Ct.wA)(Ke,he),indent:q.listRef.current.getIndentWidth()}),q.setExpandedKeys(Ve),window.addEventListener("dragend",q.onWindowDragEnd),we==null||we({event:X,node:(0,$e.F)($)})}),(0,Z.Z)((0,ve.Z)(q),"onNodeDragEnter",function(X,$){var Q=q.state,ce=Q.expandedKeys,he=Q.keyEntities,we=Q.dragChildrenKeys,Ke=Q.flattenNodes,Ve=Q.indent,Je=q.props,Ge=Je.onDragEnter,Fe=Je.onExpand,pt=Je.allowDrop,De=Je.direction,it=$.pos,Bt=$.eventKey;if(q.currentMouseOverDroppableNodeKey!==Bt&&(q.currentMouseOverDroppableNodeKey=Bt),!q.dragNodeProps){q.resetDragState();return}var vt=(0,Ct.OM)(X,q.dragNodeProps,$,Ve,q.dragStartMousePosition,pt,Ke,he,ce,De),dt=vt.dropPosition,Vt=vt.dropLevelOffset,ni=vt.dropTargetKey,Qt=vt.dropContainerKey,Wt=vt.dropTargetPos,ri=vt.dropAllowed,Rt=vt.dragOverNodeKey;if(we.includes(ni)||!ri){q.resetDragState();return}if(q.delayedDragEnterLogic||(q.delayedDragEnterLogic={}),Object.keys(q.delayedDragEnterLogic).forEach(function(ut){clearTimeout(q.delayedDragEnterLogic[ut])}),q.dragNodeProps.eventKey!==$.eventKey&&(X.persist(),q.delayedDragEnterLogic[it]=window.setTimeout(function(){if(q.state.draggingNodeKey!==null){var ut=(0,ue.Z)(ce),st=(0,mt.Z)(he,$.eventKey);st&&(st.children||[]).length&&(ut=(0,Ct.L0)(ce,$.eventKey)),q.props.hasOwnProperty("expandedKeys")||q.setExpandedKeys(ut),Fe==null||Fe(ut,{node:(0,$e.F)($),expanded:!0,nativeEvent:X.nativeEvent})}},800)),q.dragNodeProps.eventKey===ni&&Vt===0){q.resetDragState();return}q.setState({dragOverNodeKey:Rt,dropPosition:dt,dropLevelOffset:Vt,dropTargetKey:ni,dropContainerKey:Qt,dropTargetPos:Wt,dropAllowed:ri}),Ge==null||Ge({event:X,node:(0,$e.F)($),expandedKeys:ce})}),(0,Z.Z)((0,ve.Z)(q),"onNodeDragOver",function(X,$){var Q=q.state,ce=Q.dragChildrenKeys,he=Q.flattenNodes,we=Q.keyEntities,Ke=Q.expandedKeys,Ve=Q.indent,Je=q.props,Ge=Je.onDragOver,Fe=Je.allowDrop,pt=Je.direction;if(q.dragNodeProps){var De=(0,Ct.OM)(X,q.dragNodeProps,$,Ve,q.dragStartMousePosition,Fe,he,we,Ke,pt),it=De.dropPosition,Bt=De.dropLevelOffset,vt=De.dropTargetKey,dt=De.dropContainerKey,Vt=De.dropTargetPos,ni=De.dropAllowed,Qt=De.dragOverNodeKey;ce.includes(vt)||!ni||(q.dragNodeProps.eventKey===vt&&Bt===0?q.state.dropPosition===null&&q.state.dropLevelOffset===null&&q.state.dropTargetKey===null&&q.state.dropContainerKey===null&&q.state.dropTargetPos===null&&q.state.dropAllowed===!1&&q.state.dragOverNodeKey===null||q.resetDragState():it===q.state.dropPosition&&Bt===q.state.dropLevelOffset&&vt===q.state.dropTargetKey&&dt===q.state.dropContainerKey&&Vt===q.state.dropTargetPos&&ni===q.state.dropAllowed&&Qt===q.state.dragOverNodeKey||q.setState({dropPosition:it,dropLevelOffset:Bt,dropTargetKey:vt,dropContainerKey:dt,dropTargetPos:Vt,dropAllowed:ni,dragOverNodeKey:Qt}),Ge==null||Ge({event:X,node:(0,$e.F)($)}))}}),(0,Z.Z)((0,ve.Z)(q),"onNodeDragLeave",function(X,$){q.currentMouseOverDroppableNodeKey===$.eventKey&&!X.currentTarget.contains(X.relatedTarget)&&(q.resetDragState(),q.currentMouseOverDroppableNodeKey=null);var Q=q.props.onDragLeave;Q==null||Q({event:X,node:(0,$e.F)($)})}),(0,Z.Z)((0,ve.Z)(q),"onWindowDragEnd",function(X){q.onNodeDragEnd(X,null,!0),window.removeEventListener("dragend",q.onWindowDragEnd)}),(0,Z.Z)((0,ve.Z)(q),"onNodeDragEnd",function(X,$){var Q=q.props.onDragEnd;q.setState({dragOverNodeKey:null}),q.cleanDragState(),Q==null||Q({event:X,node:(0,$e.F)($)}),q.dragNodeProps=null,window.removeEventListener("dragend",q.onWindowDragEnd)}),(0,Z.Z)((0,ve.Z)(q),"onNodeDrop",function(X,$){var Q,ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,he=q.state,we=he.dragChildrenKeys,Ke=he.dropPosition,Ve=he.dropTargetKey,Je=he.dropTargetPos,Ge=he.dropAllowed;if(Ge){var Fe=q.props.onDrop;if(q.setState({dragOverNodeKey:null}),q.cleanDragState(),Ve!==null){var pt=(0,Se.Z)((0,Se.Z)({},(0,$e.H8)(Ve,q.getTreeNodeRequiredProps())),{},{active:((Q=q.getActiveItem())===null||Q===void 0?void 0:Q.key)===Ve,data:(0,mt.Z)(q.state.keyEntities,Ve).node}),De=we.includes(Ve);(0,A.ZP)(!De,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var it=(0,Ct.yx)(Je),Bt={event:X,node:(0,$e.F)(pt),dragNode:q.dragNodeProps?(0,$e.F)(q.dragNodeProps):null,dragNodesKeys:[q.dragNodeProps.eventKey].concat(we),dropToGap:Ke!==0,dropPosition:Ke+Number(it[it.length-1])};ce||Fe==null||Fe(Bt),q.dragNodeProps=null}}}),(0,Z.Z)((0,ve.Z)(q),"cleanDragState",function(){var X=q.state.draggingNodeKey;X!==null&&q.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),q.dragStartMousePosition=null,q.currentMouseOverDroppableNodeKey=null}),(0,Z.Z)((0,ve.Z)(q),"triggerExpandActionExpand",function(X,$){var Q=q.state,ce=Q.expandedKeys,he=Q.flattenNodes,we=$.expanded,Ke=$.key,Ve=$.isLeaf;if(!(Ve||X.shiftKey||X.metaKey||X.ctrlKey)){var Je=he.filter(function(Fe){return Fe.key===Ke})[0],Ge=(0,$e.F)((0,Se.Z)((0,Se.Z)({},(0,$e.H8)(Ke,q.getTreeNodeRequiredProps())),{},{data:Je.data}));q.setExpandedKeys(we?(0,Ct._5)(ce,Ke):(0,Ct.L0)(ce,Ke)),q.onNodeExpand(X,Ge)}}),(0,Z.Z)((0,ve.Z)(q),"onNodeClick",function(X,$){var Q=q.props,ce=Q.onClick,he=Q.expandAction;he==="click"&&q.triggerExpandActionExpand(X,$),ce==null||ce(X,$)}),(0,Z.Z)((0,ve.Z)(q),"onNodeDoubleClick",function(X,$){var Q=q.props,ce=Q.onDoubleClick,he=Q.expandAction;he==="doubleClick"&&q.triggerExpandActionExpand(X,$),ce==null||ce(X,$)}),(0,Z.Z)((0,ve.Z)(q),"onNodeSelect",function(X,$){var Q=q.state.selectedKeys,ce=q.state,he=ce.keyEntities,we=ce.fieldNames,Ke=q.props,Ve=Ke.onSelect,Je=Ke.multiple,Ge=$.selected,Fe=$[we.key],pt=!Ge;pt?Je?Q=(0,Ct.L0)(Q,Fe):Q=[Fe]:Q=(0,Ct._5)(Q,Fe);var De=Q.map(function(it){var Bt=(0,mt.Z)(he,it);return Bt?Bt.node:null}).filter(Boolean);q.setUncontrolledState({selectedKeys:Q}),Ve==null||Ve(Q,{event:"select",selected:pt,node:$,selectedNodes:De,nativeEvent:X.nativeEvent})}),(0,Z.Z)((0,ve.Z)(q),"onNodeCheck",function(X,$,Q){var ce=q.state,he=ce.keyEntities,we=ce.checkedKeys,Ke=ce.halfCheckedKeys,Ve=q.props,Je=Ve.checkStrictly,Ge=Ve.onCheck,Fe=$.key,pt,De={event:"check",node:$,checked:Q,nativeEvent:X.nativeEvent};if(Je){var it=Q?(0,Ct.L0)(we,Fe):(0,Ct._5)(we,Fe),Bt=(0,Ct._5)(Ke,Fe);pt={checked:it,halfChecked:Bt},De.checkedNodes=it.map(function(Wt){return(0,mt.Z)(he,Wt)}).filter(Boolean).map(function(Wt){return Wt.node}),q.setUncontrolledState({checkedKeys:it})}else{var vt=(0,Ze.S)([].concat((0,ue.Z)(we),[Fe]),!0,he),dt=vt.checkedKeys,Vt=vt.halfCheckedKeys;if(!Q){var ni=new Set(dt);ni.delete(Fe);var Qt=(0,Ze.S)(Array.from(ni),{checked:!1,halfCheckedKeys:Vt},he);dt=Qt.checkedKeys,Vt=Qt.halfCheckedKeys}pt=dt,De.checkedNodes=[],De.checkedNodesPositions=[],De.halfCheckedKeys=Vt,dt.forEach(function(Wt){var ri=(0,mt.Z)(he,Wt);if(ri){var Rt=ri.node,ut=ri.pos;De.checkedNodes.push(Rt),De.checkedNodesPositions.push({node:Rt,pos:ut})}}),q.setUncontrolledState({checkedKeys:dt},!1,{halfCheckedKeys:Vt})}Ge==null||Ge(pt,De)}),(0,Z.Z)((0,ve.Z)(q),"onNodeLoad",function(X){var $,Q=X.key,ce=q.state.keyEntities,he=(0,mt.Z)(ce,Q);if(!(he!=null&&($=he.children)!==null&&$!==void 0&&$.length)){var we=new Promise(function(Ke,Ve){q.setState(function(Je){var Ge=Je.loadedKeys,Fe=Ge===void 0?[]:Ge,pt=Je.loadingKeys,De=pt===void 0?[]:pt,it=q.props,Bt=it.loadData,vt=it.onLoad;if(!Bt||Fe.includes(Q)||De.includes(Q))return null;var dt=Bt(X);return dt.then(function(){var Vt=q.state.loadedKeys,ni=(0,Ct.L0)(Vt,Q);vt==null||vt(ni,{event:"load",node:X}),q.setUncontrolledState({loadedKeys:ni}),q.setState(function(Qt){return{loadingKeys:(0,Ct._5)(Qt.loadingKeys,Q)}}),Ke()}).catch(function(Vt){if(q.setState(function(Qt){return{loadingKeys:(0,Ct._5)(Qt.loadingKeys,Q)}}),q.loadingRetryTimes[Q]=(q.loadingRetryTimes[Q]||0)+1,q.loadingRetryTimes[Q]>=Ye){var ni=q.state.loadedKeys;(0,A.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),q.setUncontrolledState({loadedKeys:(0,Ct.L0)(ni,Q)}),Ke()}Ve(Vt)}),{loadingKeys:(0,Ct.L0)(De,Q)}})});return we.catch(function(){}),we}}),(0,Z.Z)((0,ve.Z)(q),"onNodeMouseEnter",function(X,$){var Q=q.props.onMouseEnter;Q==null||Q({event:X,node:$})}),(0,Z.Z)((0,ve.Z)(q),"onNodeMouseLeave",function(X,$){var Q=q.props.onMouseLeave;Q==null||Q({event:X,node:$})}),(0,Z.Z)((0,ve.Z)(q),"onNodeContextMenu",function(X,$){var Q=q.props.onRightClick;Q&&(X.preventDefault(),Q({event:X,node:$}))}),(0,Z.Z)((0,ve.Z)(q),"onFocus",function(){var X=q.props.onFocus;q.setState({focused:!0});for(var $=arguments.length,Q=new Array($),ce=0;ce<$;ce++)Q[ce]=arguments[ce];X==null||X.apply(void 0,Q)}),(0,Z.Z)((0,ve.Z)(q),"onBlur",function(){var X=q.props.onBlur;q.setState({focused:!1}),q.onActiveChange(null);for(var $=arguments.length,Q=new Array($),ce=0;ce<$;ce++)Q[ce]=arguments[ce];X==null||X.apply(void 0,Q)}),(0,Z.Z)((0,ve.Z)(q),"getTreeNodeRequiredProps",function(){var X=q.state,$=X.expandedKeys,Q=X.selectedKeys,ce=X.loadedKeys,he=X.loadingKeys,we=X.checkedKeys,Ke=X.halfCheckedKeys,Ve=X.dragOverNodeKey,Je=X.dropPosition,Ge=X.keyEntities;return{expandedKeys:$||[],selectedKeys:Q||[],loadedKeys:ce||[],loadingKeys:he||[],checkedKeys:we||[],halfCheckedKeys:Ke||[],dragOverNodeKey:Ve,dropPosition:Je,keyEntities:Ge}}),(0,Z.Z)((0,ve.Z)(q),"setExpandedKeys",function(X){var $=q.state,Q=$.treeData,ce=$.fieldNames,he=(0,$e.oH)(Q,X,ce);q.setUncontrolledState({expandedKeys:X,flattenNodes:he},!0)}),(0,Z.Z)((0,ve.Z)(q),"onNodeExpand",function(X,$){var Q=q.state.expandedKeys,ce=q.state,he=ce.listChanging,we=ce.fieldNames,Ke=q.props,Ve=Ke.onExpand,Je=Ke.loadData,Ge=$.expanded,Fe=$[we.key];if(!he){var pt=Q.includes(Fe),De=!Ge;if((0,A.ZP)(Ge&&pt||!Ge&&!pt,"Expand state not sync with index check"),Q=De?(0,Ct.L0)(Q,Fe):(0,Ct._5)(Q,Fe),q.setExpandedKeys(Q),Ve==null||Ve(Q,{node:$,expanded:De,nativeEvent:X.nativeEvent}),De&&Je){var it=q.onNodeLoad($);it&&it.then(function(){var Bt=(0,$e.oH)(q.state.treeData,Q,we);q.setUncontrolledState({flattenNodes:Bt})}).catch(function(){var Bt=q.state.expandedKeys,vt=(0,Ct._5)(Bt,Fe);q.setExpandedKeys(vt)})}}}),(0,Z.Z)((0,ve.Z)(q),"onListChangeStart",function(){q.setUncontrolledState({listChanging:!0})}),(0,Z.Z)((0,ve.Z)(q),"onListChangeEnd",function(){setTimeout(function(){q.setUncontrolledState({listChanging:!1})})}),(0,Z.Z)((0,ve.Z)(q),"onActiveChange",function(X){var $=q.state.activeKey,Q=q.props,ce=Q.onActiveChange,he=Q.itemScrollOffset,we=he===void 0?0:he;$!==X&&(q.setState({activeKey:X}),X!==null&&q.scrollTo({key:X,offset:we}),ce==null||ce(X))}),(0,Z.Z)((0,ve.Z)(q),"getActiveItem",function(){var X=q.state,$=X.activeKey,Q=X.flattenNodes;return $===null?null:Q.find(function(ce){var he=ce.key;return he===$})||null}),(0,Z.Z)((0,ve.Z)(q),"offsetActiveKey",function(X){var $=q.state,Q=$.flattenNodes,ce=$.activeKey,he=Q.findIndex(function(Ve){var Je=Ve.key;return Je===ce});he===-1&&X<0&&(he=Q.length),he=(he+X+Q.length)%Q.length;var we=Q[he];if(we){var Ke=we.key;q.onActiveChange(Ke)}else q.onActiveChange(null)}),(0,Z.Z)((0,ve.Z)(q),"onKeyDown",function(X){var $=q.state,Q=$.activeKey,ce=$.expandedKeys,he=$.checkedKeys,we=$.fieldNames,Ke=q.props,Ve=Ke.onKeyDown,Je=Ke.checkable,Ge=Ke.selectable;switch(X.which){case v.Z.UP:{q.offsetActiveKey(-1),X.preventDefault();break}case v.Z.DOWN:{q.offsetActiveKey(1),X.preventDefault();break}}var Fe=q.getActiveItem();if(Fe&&Fe.data){var pt=q.getTreeNodeRequiredProps(),De=Fe.data.isLeaf===!1||!!(Fe.data[we.children]||[]).length,it=(0,$e.F)((0,Se.Z)((0,Se.Z)({},(0,$e.H8)(Q,pt)),{},{data:Fe.data,active:!0}));switch(X.which){case v.Z.LEFT:{De&&ce.includes(Q)?q.onNodeExpand({},it):Fe.parent&&q.onActiveChange(Fe.parent.key),X.preventDefault();break}case v.Z.RIGHT:{De&&!ce.includes(Q)?q.onNodeExpand({},it):Fe.children&&Fe.children.length&&q.onActiveChange(Fe.children[0].key),X.preventDefault();break}case v.Z.ENTER:case v.Z.SPACE:{Je&&!it.disabled&&it.checkable!==!1&&!it.disableCheckbox?q.onNodeCheck({},it,!he.includes(Q)):!Je&&Ge&&!it.disabled&&it.selectable!==!1&&q.onNodeSelect({},it);break}}}Ve==null||Ve(X)}),(0,Z.Z)((0,ve.Z)(q),"setUncontrolledState",function(X){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!q.destroyed){var ce=!1,he=!0,we={};Object.keys(X).forEach(function(Ke){if(q.props.hasOwnProperty(Ke)){he=!1;return}ce=!0,we[Ke]=X[Ke]}),ce&&(!$||he)&&q.setState((0,Se.Z)((0,Se.Z)({},we),Q))}}),(0,Z.Z)((0,ve.Z)(q),"scrollTo",function(X){q.listRef.current.scrollTo(X)}),q}return(0,p.Z)(Te,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var W=this.props,z=W.activeKey,re=W.itemScrollOffset,X=re===void 0?0:re;z!==void 0&&z!==this.state.activeKey&&(this.setState({activeKey:z}),z!==null&&this.scrollTo({key:z,offset:X}))}},{key:"componentWillUnmount",value:function(){window.removeEventListener("dragend",this.onWindowDragEnd),this.destroyed=!0}},{key:"resetDragState",value:function(){this.setState({dragOverNodeKey:null,dropPosition:null,dropLevelOffset:null,dropTargetKey:null,dropContainerKey:null,dropTargetPos:null,dropAllowed:!1})}},{key:"render",value:function(){var W=this.state,z=W.focused,re=W.flattenNodes,X=W.keyEntities,$=W.draggingNodeKey,Q=W.activeKey,ce=W.dropLevelOffset,he=W.dropContainerKey,we=W.dropTargetKey,Ke=W.dropPosition,Ve=W.dragOverNodeKey,Je=W.indent,Ge=this.props,Fe=Ge.prefixCls,pt=Ge.className,De=Ge.style,it=Ge.showLine,Bt=Ge.focusable,vt=Ge.tabIndex,dt=vt===void 0?0:vt,Vt=Ge.selectable,ni=Ge.showIcon,Qt=Ge.icon,Wt=Ge.switcherIcon,ri=Ge.draggable,Rt=Ge.checkable,ut=Ge.checkStrictly,st=Ge.disabled,Nt=Ge.motion,Ht=Ge.loadData,wt=Ge.filterTreeNode,gt=Ge.height,St=Ge.itemHeight,Ei=Ge.scrollWidth,zt=Ge.virtual,si=Ge.titleRender,It=Ge.dropIndicatorRender,We=Ge.onContextMenu,h=Ge.onScroll,m=Ge.direction,y=Ge.rootClassName,C=Ge.rootStyle,H=(0,E.Z)(this.props,{aria:!0,data:!0}),me;ri&&((0,pe.Z)(ri)==="object"?me=ri:typeof ri=="function"?me={nodeDraggable:ri}:me={});var fe={prefixCls:Fe,selectable:Vt,showIcon:ni,icon:Qt,switcherIcon:Wt,draggable:me,draggingNodeKey:$,checkable:Rt,checkStrictly:ut,disabled:st,keyEntities:X,dropLevelOffset:ce,dropContainerKey:he,dropTargetKey:we,dropPosition:Ke,dragOverNodeKey:Ve,indent:Je,direction:m,dropIndicatorRender:It,loadData:Ht,filterTreeNode:wt,titleRender:si,onNodeClick:this.onNodeClick,onNodeDoubleClick:this.onNodeDoubleClick,onNodeExpand:this.onNodeExpand,onNodeSelect:this.onNodeSelect,onNodeCheck:this.onNodeCheck,onNodeLoad:this.onNodeLoad,onNodeMouseEnter:this.onNodeMouseEnter,onNodeMouseLeave:this.onNodeMouseLeave,onNodeContextMenu:this.onNodeContextMenu,onNodeDragStart:this.onNodeDragStart,onNodeDragEnter:this.onNodeDragEnter,onNodeDragOver:this.onNodeDragOver,onNodeDragLeave:this.onNodeDragLeave,onNodeDragEnd:this.onNodeDragEnd,onNodeDrop:this.onNodeDrop};return M.createElement(j.k.Provider,{value:fe},M.createElement("div",{className:g()(Fe,pt,y,(0,Z.Z)((0,Z.Z)((0,Z.Z)({},"".concat(Fe,"-show-line"),it),"".concat(Fe,"-focused"),z),"".concat(Fe,"-active-focused"),Q!==null)),style:C},M.createElement(ze,(0,F.Z)({ref:this.listRef,prefixCls:Fe,style:De,data:re,disabled:st,selectable:Vt,checkable:!!Rt,motion:Nt,dragging:$!==null,height:gt,itemHeight:St,virtual:zt,focusable:Bt,focused:z,tabIndex:dt,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:We,onScroll:h,scrollWidth:Ei},this.getTreeNodeRequiredProps(),H))))}}],[{key:"getDerivedStateFromProps",value:function(W,z){var re=z.prevProps,X={prevProps:W};function $(dt){return!re&&W.hasOwnProperty(dt)||re&&re[dt]!==W[dt]}var Q,ce=z.fieldNames;if($("fieldNames")&&(ce=(0,$e.w$)(W.fieldNames),X.fieldNames=ce),$("treeData")?Q=W.treeData:$("children")&&((0,A.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),Q=(0,$e.zn)(W.children)),Q){X.treeData=Q;var he=(0,$e.I8)(Q,{fieldNames:ce});X.keyEntities=(0,Se.Z)((0,Z.Z)({},K,Ee),he.keyEntities)}var we=X.keyEntities||z.keyEntities;if($("expandedKeys")||re&&$("autoExpandParent"))X.expandedKeys=W.autoExpandParent||!re&&W.defaultExpandParent?(0,Ct.r7)(W.expandedKeys,we):W.expandedKeys;else if(!re&&W.defaultExpandAll){var Ke=(0,Se.Z)({},we);delete Ke[K];var Ve=[];Object.keys(Ke).forEach(function(dt){var Vt=Ke[dt];Vt.children&&Vt.children.length&&Ve.push(Vt.key)}),X.expandedKeys=Ve}else!re&&W.defaultExpandedKeys&&(X.expandedKeys=W.autoExpandParent||W.defaultExpandParent?(0,Ct.r7)(W.defaultExpandedKeys,we):W.defaultExpandedKeys);if(X.expandedKeys||delete X.expandedKeys,Q||X.expandedKeys){var Je=(0,$e.oH)(Q||z.treeData,X.expandedKeys||z.expandedKeys,ce);X.flattenNodes=Je}if(W.selectable&&($("selectedKeys")?X.selectedKeys=(0,Ct.BT)(W.selectedKeys,W):!re&&W.defaultSelectedKeys&&(X.selectedKeys=(0,Ct.BT)(W.defaultSelectedKeys,W))),W.checkable){var Ge;if($("checkedKeys")?Ge=(0,Ct.E6)(W.checkedKeys)||{}:!re&&W.defaultCheckedKeys?Ge=(0,Ct.E6)(W.defaultCheckedKeys)||{}:Q&&(Ge=(0,Ct.E6)(W.checkedKeys)||{checkedKeys:z.checkedKeys,halfCheckedKeys:z.halfCheckedKeys}),Ge){var Fe=Ge,pt=Fe.checkedKeys,De=pt===void 0?[]:pt,it=Fe.halfCheckedKeys,Bt=it===void 0?[]:it;if(!W.checkStrictly){var vt=(0,Ze.S)(De,!0,we);De=vt.checkedKeys,Bt=vt.halfCheckedKeys}X.checkedKeys=De,X.halfCheckedKeys=Bt}}return $("loadedKeys")&&(X.loadedKeys=W.loadedKeys),X}}]),Te}(M.Component);(0,Z.Z)(ke,"defaultProps",{prefixCls:"rc-tree",showLine:!1,showIcon:!0,selectable:!0,multiple:!1,checkable:!1,disabled:!1,checkStrictly:!1,draggable:!1,defaultExpandParent:!0,autoExpandParent:!1,defaultExpandAll:!1,defaultExpandedKeys:[],defaultCheckedKeys:[],defaultSelectedKeys:[],dropIndicatorRender:L,allowDrop:function(){return!0},expandAction:!1}),(0,Z.Z)(ke,"TreeNode",ye.Z);var ge=ke,Ae=ge},82661:function(Zt,nt,U){"use strict";U.d(nt,{BT:function(){return M},E6:function(){return L},L0:function(){return Z},OM:function(){return A},_5:function(){return l},r7:function(){return I},wA:function(){return g},yx:function(){return k}});var F=U(3300),pe=U(34666),Se=U(48736),ue=U(59301),G=U(639),p=U(65065),ve=U(34061),oe=null;function l(w,R){if(!w)return[];var Y=w.slice(),se=Y.indexOf(R);return se>=0&&Y.splice(se,1),Y}function Z(w,R){var Y=(w||[]).slice();return Y.indexOf(R)===-1&&Y.push(R),Y}function k(w){return w.split("-")}function g(w,R){var Y=[],se=(0,p.Z)(R,w);function ne(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];ye.forEach(function(Ie){var xe=Ie.key,$e=Ie.children;Y.push(xe),ne($e)})}return ne(se.children),Y}function v(w){if(w.parent){var R=k(w.pos);return Number(R[R.length-1])===w.parent.children.length-1}return!1}function E(w){var R=k(w.pos);return Number(R[R.length-1])===0}function A(w,R,Y,se,ne,ye,Ie,xe,$e,J){var D,N=w.clientX,O=w.clientY,ae=w.target.getBoundingClientRect(),te=ae.top,S=ae.height,b=(J==="rtl"?-1:1)*(((ne==null?void 0:ne.x)||0)-N),K=(b-12)/se,le=$e.filter(function(Ae){var ee;return(ee=xe[Ae])===null||ee===void 0||(ee=ee.children)===null||ee===void 0?void 0:ee.length}),Ee=(0,p.Z)(xe,Y.eventKey);if(O<te+S/2){var Ne=Ie.findIndex(function(Ae){return Ae.key===Ee.key}),Qe=Ne<=0?0:Ne-1,bt=Ie[Qe].key;Ee=(0,p.Z)(xe,bt)}var Lt=Ee.key,ti=Ee,ze=Ee.key,Ct=0,Ze=0;if(!le.includes(Lt))for(var mt=0;mt<K&&v(Ee);mt+=1)Ee=Ee.parent,Ze+=1;var Ye=R.data,ke=Ee.node,ge=!0;return E(Ee)&&Ee.level===0&&O<te+S/2&&ye({dragNode:Ye,dropNode:ke,dropPosition:-1})&&Ee.key===Y.eventKey?Ct=-1:(ti.children||[]).length&&le.includes(ze)?ye({dragNode:Ye,dropNode:ke,dropPosition:0})?Ct=0:ge=!1:Ze===0?K>-1.5?ye({dragNode:Ye,dropNode:ke,dropPosition:1})?Ct=1:ge=!1:ye({dragNode:Ye,dropNode:ke,dropPosition:0})?Ct=0:ye({dragNode:Ye,dropNode:ke,dropPosition:1})?Ct=1:ge=!1:ye({dragNode:Ye,dropNode:ke,dropPosition:1})?Ct=1:ge=!1,{dropPosition:Ct,dropLevelOffset:Ze,dropTargetKey:Ee.key,dropTargetPos:Ee.pos,dragOverNodeKey:ze,dropContainerKey:Ct===0?null:((D=Ee.parent)===null||D===void 0?void 0:D.key)||null,dropAllowed:ge}}function M(w,R){if(w){var Y=R.multiple;return Y?w.slice():w.length?[w[0]]:w}}var j=function(R){return R};function V(w,R){if(!w)return[];var Y=R||{},se=Y.processProps,ne=se===void 0?j:se,ye=Array.isArray(w)?w:[w];return ye.map(function(Ie){var xe=Ie.children,$e=_objectWithoutProperties(Ie,oe),J=V(xe,R);return React.createElement(TreeNode,_extends({key:$e.key},ne($e)),J)})}function L(w){if(!w)return null;var R;if(Array.isArray(w))R={checkedKeys:w,halfCheckedKeys:void 0};else if((0,pe.Z)(w)==="object")R={checkedKeys:w.checked||void 0,halfCheckedKeys:w.halfChecked||void 0};else return(0,Se.ZP)(!1,"`checkedKeys` is not an array or an object"),null;return R}function I(w,R){var Y=new Set;function se(ne){if(!Y.has(ne)){var ye=(0,p.Z)(R,ne);if(ye){Y.add(ne);var Ie=ye.parent,xe=ye.node;xe.disabled||Ie&&se(Ie.key)}}}return(w||[]).forEach(function(ne){se(ne)}),(0,F.Z)(Y)}},34643:function(Zt,nt,U){"use strict";U.d(nt,{S:function(){return ve}});var F=U(48736),pe=U(65065);function Se(oe,l){var Z=new Set;return oe.forEach(function(k){l.has(k)||Z.add(k)}),Z}function ue(oe){var l=oe||{},Z=l.disabled,k=l.disableCheckbox,g=l.checkable;return!!(Z||k)||g===!1}function G(oe,l,Z,k){for(var g=new Set(oe),v=new Set,E=0;E<=Z;E+=1){var A=l.get(E)||new Set;A.forEach(function(L){var I=L.key,w=L.node,R=L.children,Y=R===void 0?[]:R;g.has(I)&&!k(w)&&Y.filter(function(se){return!k(se.node)}).forEach(function(se){g.add(se.key)})})}for(var M=new Set,j=Z;j>=0;j-=1){var V=l.get(j)||new Set;V.forEach(function(L){var I=L.parent,w=L.node;if(!(k(w)||!L.parent||M.has(L.parent.key))){if(k(L.parent.node)){M.add(I.key);return}var R=!0,Y=!1;(I.children||[]).filter(function(se){return!k(se.node)}).forEach(function(se){var ne=se.key,ye=g.has(ne);R&&!ye&&(R=!1),!Y&&(ye||v.has(ne))&&(Y=!0)}),R&&g.add(I.key),Y&&v.add(I.key),M.add(I.key)}})}return{checkedKeys:Array.from(g),halfCheckedKeys:Array.from(Se(v,g))}}function p(oe,l,Z,k,g){for(var v=new Set(oe),E=new Set(l),A=0;A<=k;A+=1){var M=Z.get(A)||new Set;M.forEach(function(I){var w=I.key,R=I.node,Y=I.children,se=Y===void 0?[]:Y;!v.has(w)&&!E.has(w)&&!g(R)&&se.filter(function(ne){return!g(ne.node)}).forEach(function(ne){v.delete(ne.key)})})}E=new Set;for(var j=new Set,V=k;V>=0;V-=1){var L=Z.get(V)||new Set;L.forEach(function(I){var w=I.parent,R=I.node;if(!(g(R)||!I.parent||j.has(I.parent.key))){if(g(I.parent.node)){j.add(w.key);return}var Y=!0,se=!1;(w.children||[]).filter(function(ne){return!g(ne.node)}).forEach(function(ne){var ye=ne.key,Ie=v.has(ye);Y&&!Ie&&(Y=!1),!se&&(Ie||E.has(ye))&&(se=!0)}),Y||v.delete(w.key),se&&E.add(w.key),j.add(w.key)}})}return{checkedKeys:Array.from(v),halfCheckedKeys:Array.from(Se(E,v))}}function ve(oe,l,Z,k){var g=[],v;k?v=k:v=ue;var E=new Set(oe.filter(function(V){var L=!!(0,pe.Z)(Z,V);return L||g.push(V),L})),A=new Map,M=0;Object.keys(Z).forEach(function(V){var L=Z[V],I=L.level,w=A.get(I);w||(w=new Set,A.set(I,w)),w.add(L),M=Math.max(M,I)}),(0,F.ZP)(!g.length,"Tree missing follow keys: ".concat(g.slice(0,100).map(function(V){return"'".concat(V,"'")}).join(", ")));var j;return l===!0?j=G(E,A,M,v):j=p(E,l.halfCheckedKeys,A,M,v),j}},65065:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return F}});function F(pe,Se){return pe[Se]}},34061:function(Zt,nt,U){"use strict";U.d(nt,{F:function(){return I},H8:function(){return L},I8:function(){return V},km:function(){return g},oH:function(){return M},w$:function(){return v},zn:function(){return A}});var F=U(34666),pe=U(3300),Se=U(27247),ue=U(43079),G=U(11592),p=U(2738),ve=U(48736),oe=U(65065),l=["children"];function Z(w,R){return"".concat(w,"-").concat(R)}function k(w){return w&&w.type&&w.type.isTreeNode}function g(w,R){return w!=null?w:R}function v(w){var R=w||{},Y=R.title,se=R._title,ne=R.key,ye=R.children,Ie=Y||"title";return{title:Ie,_title:se||[Ie],key:ne||"key",children:ye||"children"}}function E(w,R){var Y=new Map;function se(ne){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(ne||[]).forEach(function(Ie){var xe=Ie[R.key],$e=Ie[R.children];warning(xe!=null,"Tree node must have a certain key: [".concat(ye).concat(xe,"]"));var J=String(xe);warning(!Y.has(J)||xe===null||xe===void 0,"Same 'key' exist in the Tree: ".concat(J)),Y.set(J,!0),se($e,"".concat(ye).concat(J," > "))})}se(w)}function A(w){function R(Y){var se=(0,G.Z)(Y);return se.map(function(ne){if(!k(ne))return(0,ve.ZP)(!ne,"Tree/TreeNode can only accept TreeNode as children."),null;var ye=ne.key,Ie=ne.props,xe=Ie.children,$e=(0,ue.Z)(Ie,l),J=(0,Se.Z)({key:ye},$e),D=R(xe);return D.length&&(J.children=D),J}).filter(function(ne){return ne})}return R(w)}function M(w,R,Y){var se=v(Y),ne=se._title,ye=se.key,Ie=se.children,xe=new Set(R===!0?[]:R),$e=[];function J(D){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return D.map(function(O,ae){for(var te=Z(N?N.pos:"0",ae),S=g(O[ye],te),b,K=0;K<ne.length;K+=1){var le=ne[K];if(O[le]!==void 0){b=O[le];break}}var Ee=Object.assign((0,p.Z)(O,[].concat((0,pe.Z)(ne),[ye,Ie])),{title:b,key:S,parent:N,pos:te,children:null,data:O,isStart:[].concat((0,pe.Z)(N?N.isStart:[]),[ae===0]),isEnd:[].concat((0,pe.Z)(N?N.isEnd:[]),[ae===D.length-1])});return $e.push(Ee),R===!0||xe.has(S)?Ee.children=J(O[Ie]||[],Ee):Ee.children=[],Ee})}return J(w),$e}function j(w,R,Y){var se={};(0,F.Z)(Y)==="object"?se=Y:se={externalGetKey:Y},se=se||{};var ne=se,ye=ne.childrenPropName,Ie=ne.externalGetKey,xe=ne.fieldNames,$e=v(xe),J=$e.key,D=$e.children,N=ye||D,O;Ie?typeof Ie=="string"?O=function(S){return S[Ie]}:typeof Ie=="function"&&(O=function(S){return Ie(S)}):O=function(S,b){return g(S[J],b)};function ae(te,S,b,K){var le=te?te[N]:w,Ee=te?Z(b.pos,S):"0",Ne=te?[].concat((0,pe.Z)(K),[te]):[];if(te){var Qe=O(te,Ee),bt={node:te,index:S,pos:Ee,key:Qe,parentPos:b.node?b.pos:null,level:b.level+1,nodes:Ne};R(bt)}le&&le.forEach(function(Lt,ti){ae(Lt,ti,{node:te,pos:Ee,level:b?b.level+1:-1},Ne)})}ae(null)}function V(w){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Y=R.initWrapper,se=R.processEntity,ne=R.onProcessFinished,ye=R.externalGetKey,Ie=R.childrenPropName,xe=R.fieldNames,$e=arguments.length>2?arguments[2]:void 0,J=ye||$e,D={},N={},O={posEntities:D,keyEntities:N};return Y&&(O=Y(O)||O),j(w,function(ae){var te=ae.node,S=ae.index,b=ae.pos,K=ae.key,le=ae.parentPos,Ee=ae.level,Ne=ae.nodes,Qe={node:te,nodes:Ne,index:S,key:K,pos:b,level:Ee},bt=g(K,b);D[b]=Qe,N[bt]=Qe,Qe.parent=D[le],Qe.parent&&(Qe.parent.children=Qe.parent.children||[],Qe.parent.children.push(Qe)),se&&se(Qe,O)},{externalGetKey:J,childrenPropName:Ie,fieldNames:xe}),ne&&ne(O),O}function L(w,R){var Y=R.expandedKeys,se=R.selectedKeys,ne=R.loadedKeys,ye=R.loadingKeys,Ie=R.checkedKeys,xe=R.halfCheckedKeys,$e=R.dragOverNodeKey,J=R.dropPosition,D=R.keyEntities,N=(0,oe.Z)(D,w),O={eventKey:w,expanded:Y.indexOf(w)!==-1,selected:se.indexOf(w)!==-1,loaded:ne.indexOf(w)!==-1,loading:ye.indexOf(w)!==-1,checked:Ie.indexOf(w)!==-1,halfChecked:xe.indexOf(w)!==-1,pos:String(N?N.pos:""),dragOver:$e===w&&J===0,dragOverGapTop:$e===w&&J===-1,dragOverGapBottom:$e===w&&J===1};return O}function I(w){var R=w.data,Y=w.expanded,se=w.selected,ne=w.checked,ye=w.loaded,Ie=w.loading,xe=w.halfChecked,$e=w.dragOver,J=w.dragOverGapTop,D=w.dragOverGapBottom,N=w.pos,O=w.active,ae=w.eventKey,te=(0,Se.Z)((0,Se.Z)({},R),{},{expanded:Y,selected:se,checked:ne,loaded:ye,loading:Ie,halfChecked:xe,dragOver:$e,dragOverGapTop:J,dragOverGapBottom:D,pos:N,active:O,key:ae});return"props"in te||Object.defineProperty(te,"props",{get:function(){return(0,ve.ZP)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),w}}),te}},49658:function(Zt,nt){"use strict";nt.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var U=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(U)||/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(U==null?void 0:U.substr(0,4))}},6790:function(Zt,nt,U){"use strict";U.d(nt,{Z:function(){return Ye}});var F=U(32855),pe=U(34666),Se=U(27247),ue=U(74430),G=U(11913),p=U(43079),ve=U(92310),oe=U.n(ve),l=U(29301),Z=U(70425),k=U(34280),g=U(59301),v=U(4676),E=g.forwardRef(function(ke,ge){var Ae=ke.height,ee=ke.offsetY,Re=ke.offsetX,Te=ke.children,q=ke.prefixCls,W=ke.onInnerResize,z=ke.innerProps,re=ke.rtl,X=ke.extra,$={},Q={display:"flex",flexDirection:"column"};return ee!==void 0&&($={height:Ae,position:"relative",overflow:"hidden"},Q=(0,Se.Z)((0,Se.Z)({},Q),{},(0,ue.Z)((0,ue.Z)((0,ue.Z)((0,ue.Z)((0,ue.Z)({transform:"translateY(".concat(ee,"px)")},re?"marginRight":"marginLeft",-Re),"position","absolute"),"left",0),"right",0),"top",0))),g.createElement("div",{style:$},g.createElement(l.Z,{onResize:function(he){var we=he.offsetHeight;we&&W&&W()}},g.createElement("div",(0,F.Z)({style:Q,className:oe()((0,ue.Z)({},"".concat(q,"-holder-inner"),q)),ref:ge},z),Te,X)))});E.displayName="Filler";var A=E;function M(ke){var ge=ke.children,Ae=ke.setRef,ee=g.useCallback(function(Re){Ae(Re)},[]);return g.cloneElement(ge,{ref:ee})}function j(ke,ge,Ae,ee,Re,Te,q,W){var z=W.getKey;return ke.slice(ge,Ae+1).map(function(re,X){var $=ge+X,Q=q(re,$,{style:{width:ee},offsetX:Re}),ce=z(re);return g.createElement(M,{key:ce,setRef:function(we){return Te(re,we)}},Q)})}function V(ke,ge,Ae,ee){var Re=Ae-ke,Te=ge-Ae,q=Math.min(Re,Te)*2;if(ee<=q){var W=Math.floor(ee/2);return ee%2?Ae+W+1:Ae-W}return Re>Te?Ae-(ee-Te):Ae+(ee-Re)}function L(ke,ge,Ae){var ee=ke.length,Re=ge.length,Te,q;if(ee===0&&Re===0)return null;ee<Re?(Te=ke,q=ge):(Te=ge,q=ke);var W={__EMPTY_ITEM__:!0};function z(he){return he!==void 0?Ae(he):W}for(var re=null,X=Math.abs(ee-Re)!==1,$=0;$<q.length;$+=1){var Q=z(Te[$]),ce=z(q[$]);if(Q!==ce){re=$,X=X||Q!==z(q[$+1]);break}}return re===null?null:{index:re,multiple:X}}function I(ke,ge,Ae){var ee=g.useState(ke),Re=(0,G.Z)(ee,2),Te=Re[0],q=Re[1],W=g.useState(null),z=(0,G.Z)(W,2),re=z[0],X=z[1];return g.useEffect(function(){var $=L(Te||[],ke||[],ge);($==null?void 0:$.index)!==void 0&&(Ae==null||Ae($.index),X(ke[$.index])),q(ke)},[ke]),[re]}var w=U(16089),R=(typeof navigator=="undefined"?"undefined":(0,pe.Z)(navigator))==="object"&&/Firefox/i.test(navigator.userAgent),Y=R,se=function(ke,ge,Ae,ee){var Re=(0,g.useRef)(!1),Te=(0,g.useRef)(null);function q(){clearTimeout(Te.current),Re.current=!0,Te.current=setTimeout(function(){Re.current=!1},50)}var W=(0,g.useRef)({top:ke,bottom:ge,left:Ae,right:ee});return W.current.top=ke,W.current.bottom=ge,W.current.left=Ae,W.current.right=ee,function(z,re){var X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,$=z?re<0&&W.current.left||re>0&&W.current.right:re<0&&W.current.top||re>0&&W.current.bottom;return X&&$?(clearTimeout(Te.current),Re.current=!1):(!$||Re.current)&&q(),!Re.current&&$}};function ne(ke,ge,Ae,ee,Re,Te,q){var W=(0,g.useRef)(0),z=(0,g.useRef)(null),re=(0,g.useRef)(null),X=(0,g.useRef)(!1),$=se(ge,Ae,ee,Re);function Q(Je,Ge){if(w.Z.cancel(z.current),!$(!1,Ge)){var Fe=Je;if(!Fe._virtualHandled)Fe._virtualHandled=!0;else return;W.current+=Ge,re.current=Ge,Y||Fe.preventDefault(),z.current=(0,w.Z)(function(){var pt=X.current?10:1;q(W.current*pt,!1),W.current=0})}}function ce(Je,Ge){q(Ge,!0),Y||Je.preventDefault()}var he=(0,g.useRef)(null),we=(0,g.useRef)(null);function Ke(Je){if(ke){w.Z.cancel(we.current),we.current=(0,w.Z)(function(){he.current=null},2);var Ge=Je.deltaX,Fe=Je.deltaY,pt=Je.shiftKey,De=Ge,it=Fe;(he.current==="sx"||!he.current&&pt&&Fe&&!Ge)&&(De=Fe,it=0,he.current="sx");var Bt=Math.abs(De),vt=Math.abs(it);he.current===null&&(he.current=Te&&Bt>vt?"x":"y"),he.current==="y"?Q(Je,it):ce(Je,De)}}function Ve(Je){ke&&(X.current=Je.detail===re.current)}return[Ke,Ve]}function ye(ke,ge,Ae,ee){var Re=g.useMemo(function(){return[new Map,[]]},[ke,Ae.id,ee]),Te=(0,G.Z)(Re,2),q=Te[0],W=Te[1],z=function(X){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:X,Q=q.get(X),ce=q.get($);if(Q===void 0||ce===void 0)for(var he=ke.length,we=W.length;we<he;we+=1){var Ke,Ve=ke[we],Je=ge(Ve);q.set(Je,we);var Ge=(Ke=Ae.get(Je))!==null&&Ke!==void 0?Ke:ee;if(W[we]=(W[we-1]||0)+Ge,Je===X&&(Q=we),Je===$&&(ce=we),Q!==void 0&&ce!==void 0)break}return{top:W[Q-1]||0,bottom:W[ce]}};return z}var Ie=U(33377),xe=U(93912),$e=function(){function ke(){(0,Ie.Z)(this,ke),(0,ue.Z)(this,"maps",void 0),(0,ue.Z)(this,"id",0),(0,ue.Z)(this,"diffRecords",new Map),this.maps=Object.create(null)}return(0,xe.Z)(ke,[{key:"set",value:function(Ae,ee){this.diffRecords.set(Ae,this.maps[Ae]),this.maps[Ae]=ee,this.id+=1}},{key:"get",value:function(Ae){return this.maps[Ae]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),ke}(),J=$e;function D(ke){var ge=parseFloat(ke);return isNaN(ge)?0:ge}function N(ke,ge,Ae){var ee=g.useState(0),Re=(0,G.Z)(ee,2),Te=Re[0],q=Re[1],W=(0,g.useRef)(new Map),z=(0,g.useRef)(new J),re=(0,g.useRef)(0);function X(){re.current+=1}function $(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;X();var he=function(){var Ve=!1;W.current.forEach(function(Je,Ge){if(Je&&Je.offsetParent){var Fe=Je.offsetHeight,pt=getComputedStyle(Je),De=pt.marginTop,it=pt.marginBottom,Bt=D(De),vt=D(it),dt=Fe+Bt+vt;z.current.get(Ge)!==dt&&(z.current.set(Ge,dt),Ve=!0)}}),Ve&&q(function(Je){return Je+1})};if(ce)he();else{re.current+=1;var we=re.current;Promise.resolve().then(function(){we===re.current&&he()})}}function Q(ce,he){var we=ke(ce),Ke=W.current.get(we);he?(W.current.set(we,he),$()):W.current.delete(we),!Ke!=!he&&(he?ge==null||ge(ce):Ae==null||Ae(ce))}return(0,g.useEffect)(function(){return X},[]),[Q,$,z.current,Te]}var O=14/15;function ae(ke,ge,Ae){var ee=(0,g.useRef)(!1),Re=(0,g.useRef)(0),Te=(0,g.useRef)(0),q=(0,g.useRef)(null),W=(0,g.useRef)(null),z,re=function(ce){if(ee.current){var he=Math.ceil(ce.touches[0].pageX),we=Math.ceil(ce.touches[0].pageY),Ke=Re.current-he,Ve=Te.current-we,Je=Math.abs(Ke)>Math.abs(Ve);Je?Re.current=he:Te.current=we;var Ge=Ae(Je,Je?Ke:Ve,!1,ce);Ge&&ce.preventDefault(),clearInterval(W.current),Ge&&(W.current=setInterval(function(){Je?Ke*=O:Ve*=O;var Fe=Math.floor(Je?Ke:Ve);(!Ae(Je,Fe,!0)||Math.abs(Fe)<=.1)&&clearInterval(W.current)},16))}},X=function(){ee.current=!1,z()},$=function(ce){z(),ce.touches.length===1&&!ee.current&&(ee.current=!0,Re.current=Math.ceil(ce.touches[0].pageX),Te.current=Math.ceil(ce.touches[0].pageY),q.current=ce.target,q.current.addEventListener("touchmove",re,{passive:!1}),q.current.addEventListener("touchend",X,{passive:!0}))};z=function(){q.current&&(q.current.removeEventListener("touchmove",re),q.current.removeEventListener("touchend",X))},(0,k.Z)(function(){return ke&&ge.current.addEventListener("touchstart",$,{passive:!0}),function(){var Q;(Q=ge.current)===null||Q===void 0||Q.removeEventListener("touchstart",$),z(),clearInterval(W.current)}},[ke])}function te(ke){return Math.floor(Math.pow(ke,.5))}function S(ke,ge){var Ae="touches"in ke?ke.touches[0]:ke;return Ae[ge?"pageX":"pageY"]-window[ge?"scrollX":"scrollY"]}function b(ke,ge,Ae){g.useEffect(function(){var ee=ge.current;if(ke&&ee){var Re=!1,Te,q,W=function(){w.Z.cancel(Te)},z=function Q(){W(),Te=(0,w.Z)(function(){Ae(q),Q()})},re=function(ce){if(!(ce.target.draggable||ce.button!==0)){var he=ce;he._virtualHandled||(he._virtualHandled=!0,Re=!0)}},X=function(){Re=!1,W()},$=function(ce){if(Re){var he=S(ce,!1),we=ee.getBoundingClientRect(),Ke=we.top,Ve=we.bottom;if(he<=Ke){var Je=Ke-he;q=-te(Je),z()}else if(he>=Ve){var Ge=he-Ve;q=te(Ge),z()}else W()}};return ee.addEventListener("mousedown",re),ee.ownerDocument.addEventListener("mouseup",X),ee.ownerDocument.addEventListener("mousemove",$),function(){ee.removeEventListener("mousedown",re),ee.ownerDocument.removeEventListener("mouseup",X),ee.ownerDocument.removeEventListener("mousemove",$),W()}}},[ke])}var K=10;function le(ke,ge,Ae,ee,Re,Te,q,W){var z=g.useRef(),re=g.useState(null),X=(0,G.Z)(re,2),$=X[0],Q=X[1];return(0,k.Z)(function(){if($&&$.times<K){if(!ke.current){Q(function(Nt){return(0,Se.Z)({},Nt)});return}Te();var ce=$.targetAlign,he=$.originAlign,we=$.index,Ke=$.offset,Ve=ke.current.clientHeight,Je=!1,Ge=ce,Fe=null;if(Ve){for(var pt=ce||he,De=0,it=0,Bt=0,vt=Math.min(ge.length-1,we),dt=0;dt<=vt;dt+=1){var Vt=Re(ge[dt]);it=De;var ni=Ae.get(Vt);Bt=it+(ni===void 0?ee:ni),De=Bt}for(var Qt=pt==="top"?Ke:Ve-Ke,Wt=vt;Wt>=0;Wt-=1){var ri=Re(ge[Wt]),Rt=Ae.get(ri);if(Rt===void 0){Je=!0;break}if(Qt-=Rt,Qt<=0)break}switch(pt){case"top":Fe=it-Ke;break;case"bottom":Fe=Bt-Ve+Ke;break;default:{var ut=ke.current.scrollTop,st=ut+Ve;it<ut?Ge="top":Bt>st&&(Ge="bottom")}}Fe!==null&&q(Fe),Fe!==$.lastTop&&(Je=!0)}Je&&Q((0,Se.Z)((0,Se.Z)({},$),{},{times:$.times+1,targetAlign:Ge,lastTop:Fe}))}},[$,ke.current]),function(ce){if(ce==null){W();return}if(w.Z.cancel(z.current),typeof ce=="number")q(ce);else if(ce&&(0,pe.Z)(ce)==="object"){var he,we=ce.align;"index"in ce?he=ce.index:he=ge.findIndex(function(Je){return Re(Je)===ce.key});var Ke=ce.offset,Ve=Ke===void 0?0:Ke;Q({times:0,index:he,offset:Ve,originAlign:we})}}}var Ee=g.forwardRef(function(ke,ge){var Ae=ke.prefixCls,ee=ke.rtl,Re=ke.scrollOffset,Te=ke.scrollRange,q=ke.onStartMove,W=ke.onStopMove,z=ke.onScroll,re=ke.horizontal,X=ke.spinSize,$=ke.containerSize,Q=ke.style,ce=ke.thumbStyle,he=ke.showScrollBar,we=g.useState(!1),Ke=(0,G.Z)(we,2),Ve=Ke[0],Je=Ke[1],Ge=g.useState(null),Fe=(0,G.Z)(Ge,2),pt=Fe[0],De=Fe[1],it=g.useState(null),Bt=(0,G.Z)(it,2),vt=Bt[0],dt=Bt[1],Vt=!ee,ni=g.useRef(),Qt=g.useRef(),Wt=g.useState(he),ri=(0,G.Z)(Wt,2),Rt=ri[0],ut=ri[1],st=g.useRef(),Nt=function(){he===!0||he===!1||(clearTimeout(st.current),ut(!0),st.current=setTimeout(function(){ut(!1)},3e3))},Ht=Te-$||0,wt=$-X||0,gt=g.useMemo(function(){if(Re===0||Ht===0)return 0;var y=Re/Ht;return y*wt},[Re,Ht,wt]),St=function(C){C.stopPropagation(),C.preventDefault()},Ei=g.useRef({top:gt,dragging:Ve,pageY:pt,startTop:vt});Ei.current={top:gt,dragging:Ve,pageY:pt,startTop:vt};var zt=function(C){Je(!0),De(S(C,re)),dt(Ei.current.top),q(),C.stopPropagation(),C.preventDefault()};g.useEffect(function(){var y=function(fe){fe.preventDefault()},C=ni.current,H=Qt.current;return C.addEventListener("touchstart",y,{passive:!1}),H.addEventListener("touchstart",zt,{passive:!1}),function(){C.removeEventListener("touchstart",y),H.removeEventListener("touchstart",zt)}},[]);var si=g.useRef();si.current=Ht;var It=g.useRef();It.current=wt,g.useEffect(function(){if(Ve){var y,C=function(fe){var Ce=Ei.current,je=Ce.dragging,at=Ce.pageY,kt=Ce.startTop;w.Z.cancel(y);var Mt=ni.current.getBoundingClientRect(),xt=$/(re?Mt.width:Mt.height);if(je){var Kt=(S(fe,re)-at)*xt,Et=kt;!Vt&&re?Et-=Kt:Et+=Kt;var ct=si.current,ot=It.current,yt=ot?Et/ot:0,Tt=Math.ceil(yt*ct);Tt=Math.max(Tt,0),Tt=Math.min(Tt,ct),y=(0,w.Z)(function(){z(Tt,re)})}},H=function(){Je(!1),W()};return window.addEventListener("mousemove",C,{passive:!0}),window.addEventListener("touchmove",C,{passive:!0}),window.addEventListener("mouseup",H,{passive:!0}),window.addEventListener("touchend",H,{passive:!0}),function(){window.removeEventListener("mousemove",C),window.removeEventListener("touchmove",C),window.removeEventListener("mouseup",H),window.removeEventListener("touchend",H),w.Z.cancel(y)}}},[Ve]),g.useEffect(function(){return Nt(),function(){clearTimeout(st.current)}},[Re]),g.useImperativeHandle(ge,function(){return{delayHidden:Nt}});var We="".concat(Ae,"-scrollbar"),h={position:"absolute",visibility:Rt?null:"hidden"},m={position:"absolute",borderRadius:99,background:"var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",cursor:"pointer",userSelect:"none"};return re?(Object.assign(h,{height:8,left:0,right:0,bottom:0}),Object.assign(m,(0,ue.Z)({height:"100%",width:X},Vt?"left":"right",gt))):(Object.assign(h,(0,ue.Z)({width:8,top:0,bottom:0},Vt?"right":"left",0)),Object.assign(m,{width:"100%",height:X,top:gt})),g.createElement("div",{ref:ni,className:oe()(We,(0,ue.Z)((0,ue.Z)((0,ue.Z)({},"".concat(We,"-horizontal"),re),"".concat(We,"-vertical"),!re),"".concat(We,"-visible"),Rt)),style:(0,Se.Z)((0,Se.Z)({},h),Q),onMouseDown:St,onMouseMove:Nt},g.createElement("div",{ref:Qt,className:oe()("".concat(We,"-thumb"),(0,ue.Z)({},"".concat(We,"-thumb-moving"),Ve)),style:(0,Se.Z)((0,Se.Z)({},m),ce),onMouseDown:zt}))}),Ne=Ee,Qe=20;function bt(){var ke=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Ae=ke/ge*ke;return isNaN(Ae)&&(Ae=0),Ae=Math.max(Ae,Qe),Math.floor(Ae)}var Lt=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],ti=[],ze={overflowY:"auto",overflowAnchor:"none"};function Ct(ke,ge){var Ae=ke.prefixCls,ee=Ae===void 0?"rc-virtual-list":Ae,Re=ke.className,Te=ke.height,q=ke.itemHeight,W=ke.fullHeight,z=W===void 0?!0:W,re=ke.style,X=ke.data,$=ke.children,Q=ke.itemKey,ce=ke.virtual,he=ke.direction,we=ke.scrollWidth,Ke=ke.component,Ve=Ke===void 0?"div":Ke,Je=ke.onScroll,Ge=ke.onVirtualScroll,Fe=ke.onVisibleChange,pt=ke.innerProps,De=ke.extraRender,it=ke.styles,Bt=ke.showScrollBar,vt=Bt===void 0?"optional":Bt,dt=(0,p.Z)(ke,Lt),Vt=g.useCallback(function(ei){return typeof Q=="function"?Q(ei):ei==null?void 0:ei[Q]},[Q]),ni=N(Vt,null,null),Qt=(0,G.Z)(ni,4),Wt=Qt[0],ri=Qt[1],Rt=Qt[2],ut=Qt[3],st=!!(ce!==!1&&Te&&q),Nt=g.useMemo(function(){return Object.values(Rt.maps).reduce(function(ei,Dt){return ei+Dt},0)},[Rt.id,Rt.maps]),Ht=st&&X&&(Math.max(q*X.length,Nt)>Te||!!we),wt=he==="rtl",gt=oe()(ee,(0,ue.Z)({},"".concat(ee,"-rtl"),wt),Re),St=X||ti,Ei=(0,g.useRef)(),zt=(0,g.useRef)(),si=(0,g.useRef)(),It=(0,g.useState)(0),We=(0,G.Z)(It,2),h=We[0],m=We[1],y=(0,g.useState)(0),C=(0,G.Z)(y,2),H=C[0],me=C[1],fe=(0,g.useState)(!1),Ce=(0,G.Z)(fe,2),je=Ce[0],at=Ce[1],kt=function(){at(!0)},Mt=function(){at(!1)},xt={getKey:Vt};function Kt(ei){m(function(Dt){var gi;typeof ei=="function"?gi=ei(Dt):gi=ei;var Mi=yi(gi);return Ei.current.scrollTop=Mi,Mi})}var Et=(0,g.useRef)({start:0,end:St.length}),ct=(0,g.useRef)(),ot=I(St,Vt),yt=(0,G.Z)(ot,1),Tt=yt[0];ct.current=Tt;var mi=g.useMemo(function(){if(!st)return{scrollHeight:void 0,start:0,end:St.length-1,offset:void 0};if(!Ht){var ei;return{scrollHeight:((ei=zt.current)===null||ei===void 0?void 0:ei.offsetHeight)||0,start:0,end:St.length-1,offset:void 0}}for(var Dt=0,gi,Mi,Gi,cn=St.length,hn=0;hn<cn;hn+=1){var tn=St[hn],ln=Vt(tn),xn=Rt.get(ln),gn=Dt+(xn===void 0?q:xn);gn>=h&&gi===void 0&&(gi=hn,Mi=Dt),gn>h+Te&&Gi===void 0&&(Gi=hn),Dt=gn}return gi===void 0&&(gi=0,Mi=0,Gi=Math.ceil(Te/q)),Gi===void 0&&(Gi=St.length-1),Gi=Math.min(Gi+1,St.length-1),{scrollHeight:Dt,start:gi,end:Gi,offset:Mi}},[Ht,st,h,St,ut,Te]),Xt=mi.scrollHeight,Yt=mi.start,ht=mi.end,At=mi.offset;Et.current.start=Yt,Et.current.end=ht,g.useLayoutEffect(function(){var ei=Rt.getRecord();if(ei.size===1){var Dt=Array.from(ei.keys())[0],gi=ei.get(Dt),Mi=St[Yt];if(Mi&&gi===void 0){var Gi=Vt(Mi);if(Gi===Dt){var cn=Rt.get(Dt),hn=cn-q;Kt(function(tn){return tn+hn})}}}Rt.resetRecord()},[Xt]);var Pt=g.useState({width:0,height:Te}),be=(0,G.Z)(Pt,2),Be=be[0],et=be[1],qe=function(Dt){et({width:Dt.offsetWidth,height:Dt.offsetHeight})},rt=(0,g.useRef)(),_t=(0,g.useRef)(),Ot=g.useMemo(function(){return bt(Be.width,we)},[Be.width,we]),Ut=g.useMemo(function(){return bt(Be.height,Xt)},[Be.height,Xt]),bi=Xt-Te,qt=(0,g.useRef)(bi);qt.current=bi;function yi(ei){var Dt=ei;return Number.isNaN(qt.current)||(Dt=Math.min(Dt,qt.current)),Dt=Math.max(Dt,0),Dt}var ci=h<=0,di=h>=bi,Si=H<=0,wi=H>=we,Ii=se(ci,di,Si,wi),hi=function(){return{x:wt?-H:H,y:h}},vi=(0,g.useRef)(hi()),Di=(0,Z.zX)(function(ei){if(Ge){var Dt=(0,Se.Z)((0,Se.Z)({},hi()),ei);(vi.current.x!==Dt.x||vi.current.y!==Dt.y)&&(Ge(Dt),vi.current=Dt)}});function Ti(ei,Dt){var gi=ei;Dt?((0,v.flushSync)(function(){me(gi)}),Di()):Kt(gi)}function Ai(ei){var Dt=ei.currentTarget.scrollTop;Dt!==h&&Kt(Dt),Je==null||Je(ei),Di()}var Fi=function(Dt){var gi=Dt,Mi=we?we-Be.width:0;return gi=Math.max(gi,0),gi=Math.min(gi,Mi),gi},Li=(0,Z.zX)(function(ei,Dt){Dt?((0,v.flushSync)(function(){me(function(gi){var Mi=gi+(wt?-ei:ei);return Fi(Mi)})}),Di()):Kt(function(gi){var Mi=gi+ei;return Mi})}),Oi=ne(st,ci,di,Si,wi,!!we,Li),Xi=(0,G.Z)(Oi,2),Ui=Xi[0],Ci=Xi[1];ae(st,Ei,function(ei,Dt,gi,Mi){var Gi=Mi;return Ii(ei,Dt,gi)?!1:!Gi||!Gi._virtualHandled?(Gi&&(Gi._virtualHandled=!0),Ui({preventDefault:function(){},deltaX:ei?Dt:0,deltaY:ei?0:Dt}),!0):!1}),b(Ht,Ei,function(ei){Kt(function(Dt){return Dt+ei})}),(0,k.Z)(function(){function ei(gi){var Mi=ci&&gi.detail<0,Gi=di&&gi.detail>0;st&&!Mi&&!Gi&&gi.preventDefault()}var Dt=Ei.current;return Dt.addEventListener("wheel",Ui,{passive:!1}),Dt.addEventListener("DOMMouseScroll",Ci,{passive:!0}),Dt.addEventListener("MozMousePixelScroll",ei,{passive:!1}),function(){Dt.removeEventListener("wheel",Ui),Dt.removeEventListener("DOMMouseScroll",Ci),Dt.removeEventListener("MozMousePixelScroll",ei)}},[st,ci,di]),(0,k.Z)(function(){if(we){var ei=Fi(H);me(ei),Di({x:ei})}},[Be.width,we]);var ki=function(){var Dt,gi;(Dt=rt.current)===null||Dt===void 0||Dt.delayHidden(),(gi=_t.current)===null||gi===void 0||gi.delayHidden()},qi=le(Ei,St,Rt,q,Vt,function(){return ri(!0)},Kt,ki);g.useImperativeHandle(ge,function(){return{nativeElement:si.current,getScrollInfo:hi,scrollTo:function(Dt){function gi(Mi){return Mi&&(0,pe.Z)(Mi)==="object"&&("left"in Mi||"top"in Mi)}gi(Dt)?(Dt.left!==void 0&&me(Fi(Dt.left)),qi(Dt.top)):qi(Dt)}}}),(0,k.Z)(function(){if(Fe){var ei=St.slice(Yt,ht+1);Fe(ei,St)}},[Yt,ht,St]);var Qi=ye(St,Vt,Rt,q),Ri=De==null?void 0:De({start:Yt,end:ht,virtual:Ht,offsetX:H,offsetY:At,rtl:wt,getSize:Qi}),rn=j(St,Yt,ht,we,H,Wt,$,xt),Zi=null;Te&&(Zi=(0,Se.Z)((0,ue.Z)({},z?"height":"maxHeight",Te),ze),st&&(Zi.overflowY="hidden",we&&(Zi.overflowX="hidden"),je&&(Zi.pointerEvents="none")));var $i={};return wt&&($i.dir="rtl"),g.createElement("div",(0,F.Z)({ref:si,style:(0,Se.Z)((0,Se.Z)({},re),{},{position:"relative"}),className:gt},$i,dt),g.createElement(l.Z,{onResize:qe},g.createElement(Ve,{className:"".concat(ee,"-holder"),style:Zi,ref:Ei,onScroll:Ai,onMouseEnter:ki},g.createElement(A,{prefixCls:ee,height:Xt,offsetX:H,offsetY:At,scrollWidth:we,onInnerResize:ri,ref:zt,innerProps:pt,rtl:wt,extra:Ri},rn))),Ht&&Xt>Te&&g.createElement(Ne,{ref:rt,prefixCls:ee,scrollOffset:h,scrollRange:Xt,rtl:wt,onScroll:Ti,onStartMove:kt,onStopMove:Mt,spinSize:Ut,containerSize:Be.height,style:it==null?void 0:it.verticalScrollBar,thumbStyle:it==null?void 0:it.verticalScrollBarThumb,showScrollBar:vt}),Ht&&we>Be.width&&g.createElement(Ne,{ref:_t,prefixCls:ee,scrollOffset:H,scrollRange:we,rtl:wt,onScroll:Ti,onStartMove:kt,onStopMove:Mt,spinSize:Ot,containerSize:Be.width,horizontal:!0,style:it==null?void 0:it.horizontalScrollBar,thumbStyle:it==null?void 0:it.horizontalScrollBarThumb,showScrollBar:vt}))}var Ze=g.forwardRef(Ct);Ze.displayName="List";var mt=Ze,Ye=mt},83145:function(Zt,nt,U){"use strict";Object.defineProperty(nt,"__esModule",{value:!0}),nt.CopyToClipboard=void 0;var F=Se(U(59301)),pe=Se(U(25769));function Se(L){return L&&L.__esModule?L:{default:L}}function ue(L){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ue=function(w){return typeof w}:ue=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},ue(L)}function G(L,I){var w=Object.keys(L);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(L);I&&(R=R.filter(function(Y){return Object.getOwnPropertyDescriptor(L,Y).enumerable})),w.push.apply(w,R)}return w}function p(L){for(var I=1;I<arguments.length;I++){var w=arguments[I]!=null?arguments[I]:{};I%2?G(w,!0).forEach(function(R){j(L,R,w[R])}):Object.getOwnPropertyDescriptors?Object.defineProperties(L,Object.getOwnPropertyDescriptors(w)):G(w).forEach(function(R){Object.defineProperty(L,R,Object.getOwnPropertyDescriptor(w,R))})}return L}function ve(L,I){if(L==null)return{};var w=oe(L,I),R,Y;if(Object.getOwnPropertySymbols){var se=Object.getOwnPropertySymbols(L);for(Y=0;Y<se.length;Y++)R=se[Y],!(I.indexOf(R)>=0)&&Object.prototype.propertyIsEnumerable.call(L,R)&&(w[R]=L[R])}return w}function oe(L,I){if(L==null)return{};var w={},R=Object.keys(L),Y,se;for(se=0;se<R.length;se++)Y=R[se],!(I.indexOf(Y)>=0)&&(w[Y]=L[Y]);return w}function l(L,I){if(!(L instanceof I))throw new TypeError("Cannot call a class as a function")}function Z(L,I){for(var w=0;w<I.length;w++){var R=I[w];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(L,R.key,R)}}function k(L,I,w){return I&&Z(L.prototype,I),w&&Z(L,w),L}function g(L,I){return I&&(ue(I)==="object"||typeof I=="function")?I:E(L)}function v(L){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(w){return w.__proto__||Object.getPrototypeOf(w)},v(L)}function E(L){if(L===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return L}function A(L,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function");L.prototype=Object.create(I&&I.prototype,{constructor:{value:L,writable:!0,configurable:!0}}),I&&M(L,I)}function M(L,I){return M=Object.setPrototypeOf||function(R,Y){return R.__proto__=Y,R},M(L,I)}function j(L,I,w){return I in L?Object.defineProperty(L,I,{value:w,enumerable:!0,configurable:!0,writable:!0}):L[I]=w,L}var V=function(L){A(I,L);function I(){var w,R;l(this,I);for(var Y=arguments.length,se=new Array(Y),ne=0;ne<Y;ne++)se[ne]=arguments[ne];return R=g(this,(w=v(I)).call.apply(w,[this].concat(se))),j(E(R),"onClick",function(ye){var Ie=R.props,xe=Ie.text,$e=Ie.onCopy,J=Ie.children,D=Ie.options,N=F.default.Children.only(J),O=(0,pe.default)(xe,D);$e&&$e(xe,O),N&&N.props&&typeof N.props.onClick=="function"&&N.props.onClick(ye)}),R}return k(I,[{key:"render",value:function(){var R=this.props,Y=R.text,se=R.onCopy,ne=R.options,ye=R.children,Ie=ve(R,["text","onCopy","options","children"]),xe=F.default.Children.only(ye);return F.default.cloneElement(xe,p({},Ie,{onClick:this.onClick}))}}]),I}(F.default.PureComponent);nt.CopyToClipboard=V,j(V,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Zt,nt,U){"use strict";var F=U(83145),pe=F.CopyToClipboard;pe.CopyToClipboard=pe,Zt.exports=pe},76374:function(Zt,nt,U){"use strict";var F=function(){if(typeof Map!="undefined")return Map;function J(D,N){var O=-1;return D.some(function(ae,te){return ae[0]===N?(O=te,!0):!1}),O}return function(){function D(){this.__entries__=[]}return Object.defineProperty(D.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),D.prototype.get=function(N){var O=J(this.__entries__,N),ae=this.__entries__[O];return ae&&ae[1]},D.prototype.set=function(N,O){var ae=J(this.__entries__,N);~ae?this.__entries__[ae][1]=O:this.__entries__.push([N,O])},D.prototype.delete=function(N){var O=this.__entries__,ae=J(O,N);~ae&&O.splice(ae,1)},D.prototype.has=function(N){return!!~J(this.__entries__,N)},D.prototype.clear=function(){this.__entries__.splice(0)},D.prototype.forEach=function(N,O){O===void 0&&(O=null);for(var ae=0,te=this.__entries__;ae<te.length;ae++){var S=te[ae];N.call(O,S[1],S[0])}},D}()}(),pe=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Se=function(){return typeof U.g!="undefined"&&U.g.Math===Math?U.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),ue=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Se):function(J){return setTimeout(function(){return J(Date.now())},1e3/60)}}(),G=2;function p(J,D){var N=!1,O=!1,ae=0;function te(){N&&(N=!1,J()),O&&b()}function S(){ue(te)}function b(){var K=Date.now();if(N){if(K-ae<G)return;O=!0}else N=!0,O=!1,setTimeout(S,D);ae=K}return b}var ve=20,oe=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",Z=function(){function J(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=p(this.refresh.bind(this),ve)}return J.prototype.addObserver=function(D){~this.observers_.indexOf(D)||this.observers_.push(D),this.connected_||this.connect_()},J.prototype.removeObserver=function(D){var N=this.observers_,O=N.indexOf(D);~O&&N.splice(O,1),!N.length&&this.connected_&&this.disconnect_()},J.prototype.refresh=function(){var D=this.updateObservers_();D&&this.refresh()},J.prototype.updateObservers_=function(){var D=this.observers_.filter(function(N){return N.gatherActive(),N.hasActive()});return D.forEach(function(N){return N.broadcastActive()}),D.length>0},J.prototype.connect_=function(){!pe||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),l?(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(){!pe||!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(D){var N=D.propertyName,O=N===void 0?"":N,ae=oe.some(function(te){return!!~O.indexOf(te)});ae&&this.refresh()},J.getInstance=function(){return this.instance_||(this.instance_=new J),this.instance_},J.instance_=null,J}(),k=function(J,D){for(var N=0,O=Object.keys(D);N<O.length;N++){var ae=O[N];Object.defineProperty(J,ae,{value:D[ae],enumerable:!1,writable:!1,configurable:!0})}return J},g=function(J){var D=J&&J.ownerDocument&&J.ownerDocument.defaultView;return D||Se},v=Y(0,0,0,0);function E(J){return parseFloat(J)||0}function A(J){for(var D=[],N=1;N<arguments.length;N++)D[N-1]=arguments[N];return D.reduce(function(O,ae){var te=J["border-"+ae+"-width"];return O+E(te)},0)}function M(J){for(var D=["top","right","bottom","left"],N={},O=0,ae=D;O<ae.length;O++){var te=ae[O],S=J["padding-"+te];N[te]=E(S)}return N}function j(J){var D=J.getBBox();return Y(0,0,D.width,D.height)}function V(J){var D=J.clientWidth,N=J.clientHeight;if(!D&&!N)return v;var O=g(J).getComputedStyle(J),ae=M(O),te=ae.left+ae.right,S=ae.top+ae.bottom,b=E(O.width),K=E(O.height);if(O.boxSizing==="border-box"&&(Math.round(b+te)!==D&&(b-=A(O,"left","right")+te),Math.round(K+S)!==N&&(K-=A(O,"top","bottom")+S)),!I(J)){var le=Math.round(b+te)-D,Ee=Math.round(K+S)-N;Math.abs(le)!==1&&(b-=le),Math.abs(Ee)!==1&&(K-=Ee)}return Y(ae.left,ae.top,b,K)}var L=function(){return typeof SVGGraphicsElement!="undefined"?function(J){return J instanceof g(J).SVGGraphicsElement}:function(J){return J instanceof g(J).SVGElement&&typeof J.getBBox=="function"}}();function I(J){return J===g(J).document.documentElement}function w(J){return pe?L(J)?j(J):V(J):v}function R(J){var D=J.x,N=J.y,O=J.width,ae=J.height,te=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,S=Object.create(te.prototype);return k(S,{x:D,y:N,width:O,height:ae,top:N,right:D+O,bottom:ae+N,left:D}),S}function Y(J,D,N,O){return{x:J,y:D,width:N,height:O}}var se=function(){function J(D){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=Y(0,0,0,0),this.target=D}return J.prototype.isActive=function(){var D=w(this.target);return this.contentRect_=D,D.width!==this.broadcastWidth||D.height!==this.broadcastHeight},J.prototype.broadcastRect=function(){var D=this.contentRect_;return this.broadcastWidth=D.width,this.broadcastHeight=D.height,D},J}(),ne=function(){function J(D,N){var O=R(N);k(this,{target:D,contentRect:O})}return J}(),ye=function(){function J(D,N,O){if(this.activeObservations_=[],this.observations_=new F,typeof D!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=D,this.controller_=N,this.callbackCtx_=O}return J.prototype.observe=function(D){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(D instanceof g(D).Element))throw new TypeError('parameter 1 is not of type "Element".');var N=this.observations_;N.has(D)||(N.set(D,new se(D)),this.controller_.addObserver(this),this.controller_.refresh())}},J.prototype.unobserve=function(D){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(D instanceof g(D).Element))throw new TypeError('parameter 1 is not of type "Element".');var N=this.observations_;N.has(D)&&(N.delete(D),N.size||this.controller_.removeObserver(this))}},J.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},J.prototype.gatherActive=function(){var D=this;this.clearActive(),this.observations_.forEach(function(N){N.isActive()&&D.activeObservations_.push(N)})},J.prototype.broadcastActive=function(){if(this.hasActive()){var D=this.callbackCtx_,N=this.activeObservations_.map(function(O){return new ne(O.target,O.broadcastRect())});this.callback_.call(D,N,D),this.clearActive()}},J.prototype.clearActive=function(){this.activeObservations_.splice(0)},J.prototype.hasActive=function(){return this.activeObservations_.length>0},J}(),Ie=typeof WeakMap!="undefined"?new WeakMap:new F,xe=function(){function J(D){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 N=Z.getInstance(),O=new ye(D,N,this);Ie.set(this,O)}return J}();["observe","unobserve","disconnect"].forEach(function(J){xe.prototype[J]=function(){var D;return(D=Ie.get(this))[J].apply(D,arguments)}});var $e=function(){return typeof Se.ResizeObserver!="undefined"?Se.ResizeObserver:xe}();nt.Z=$e},98040:function(Zt){Zt.exports=function(){var nt=document.getSelection();if(!nt.rangeCount)return function(){};for(var U=document.activeElement,F=[],pe=0;pe<nt.rangeCount;pe++)F.push(nt.getRangeAt(pe));switch(U.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":U.blur();break;default:U=null;break}return nt.removeAllRanges(),function(){nt.type==="Caret"&&nt.removeAllRanges(),nt.rangeCount||F.forEach(function(Se){nt.addRange(Se)}),U&&U.focus()}}},82059:function(Zt){var nt=arguments[3],U=arguments[4],F=arguments[5],pe=JSON.stringify;Zt.exports=function(Se,ue){for(var G,p=Object.keys(F),ve=0,oe=p.length;ve<oe;ve++){var l=p[ve],Z=F[l].exports;if(Z===Se||Z&&Z.default===Se){G=l;break}}if(!G){G=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var k={},ve=0,oe=p.length;ve<oe;ve++){var l=p[ve];k[l]=l}U[G]=["function(require,module,exports){"+Se+"(self); }",k]}var g=Math.floor(Math.pow(16,8)*Math.random()).toString(16),v={};v[G]=G,U[g]=["function(require,module,exports){var f = require("+pe(G)+");(f.default ? f.default : f)(self);}",v];var E={};A(g);function A(w){E[w]=!0;for(var R in U[w][1]){var Y=U[w][1][R];E[Y]||A(Y)}}var M="("+nt+")({"+Object.keys(E).map(function(w){return pe(w)+":["+U[w][0]+","+pe(U[w][1])+"]"}).join(",")+"},{},["+pe(g)+"])",j=window.URL||window.webkitURL||window.mozURL||window.msURL,V=new Blob([M],{type:"text/javascript"});if(ue&&ue.bare)return V;var L=j.createObjectURL(V),I=new Worker(L);return I.objectURL=L,I}},93314:function(Zt){"use strict";Zt.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAACaCAYAAADl9acYAAAAAXNSR0IArs4c6QAAIABJREFUeF7tXQd4U1Ubfs/NaJtO9kzLahFQEJkiUBBFUFFkCCjiAAVFERT5FREQQQXBBcpysWRP2RtkKRsEOphNodCZdDfjnv85CU2TZt2bhABNDw9PmtzvrO+c957xLQIP0pkz1yrQIEmwwcDzHhTj91klEo7jpcG5zetWUJdmRjmPvTM9GI9JgSGvadOoLE9KJJ5kPp2YXLtZdO1kT8ooz2vigCNelvPYezPEG7z0CDAn4pJqPvJA5A3vdcl/S3LEy3Iee29OeIOX5YDx3nh4VFI5YDxin6DM5YARxKb7g6gcMHd+nMoBc+d57LKGhCQ1ZURBCoVL2nKCO8sBZWW50x1TOWDuLP8FlV4OGEFs8glROWB8wmbPKikHjGf882bucsB4k5t3qKxywNwhxrpRbJkGTOx0ehlA3d9e5VEtzA3ulGe55zmg1QOfrCVo34BgQGvr5rLDRl4RRZG+5NjBESBc4FHw1LlrCAuPsCo0JjKi7J5hYqfTXADBq4byCJLf82Nf3kA3OfD9LgKdgeCzZ4CUTJ1VKQFyKQgpmeMSjiKvQC+oplspN/wOMDcBVFv0Bo+KwYJ4VE50H3Jg7j6CWzkEX74A3MrSgTfeKZpSaBCHcAVn/JunBHlFPDR5BkG9LMjPt7mZLOtbskQADea9wqOW9coqiGHlRPcHBxYcJriQQvB9P+v2cqCwWFxgoOJk6JeTNX4HmJMAHv6xP4/6VXw/+OxNx/bM/pIohdUE9VW/VxwjOHiJYO5A6xolpGSpYW3jIW4w/A8wM+h+UHSY2pvHgzV9NXymeor0wPc7Cf7XzWJ/4Nsm+Ly2LzZx+OwZ3yuVbzhNsPEMwcI3rM8wMikHiURi5gNbbQoKrc84zpjkj2eYzQC6f96DomUd305ctrp8tp5gSk/f1utzlFhUOHYthy9f8D1gdpwnWHiEYOVQ6zNM6QM/AY+CImHnF9YtfwTMCgB9P+5G0SHa9xP3bk2gT9cBU3r6Hjp95nBYNcz3gDlwkRhX843vlfS59PmFHfjFzgC/2pJ1nEEnEIpIAG+834Wia2Ox7PJ8wt0twLz7J8Gsl3zf316zCVYPsz5oe85F1yUcu0YwcQPBjlElZyjL8wsrQeyBn+XxK8DETqefgyACFCPe6kjxfDPfT6C7BpilBLMG+L6/A34h+P1VikCZ60nuTYpzN4AxqznjCqPOMZ1RSp9f2OVLYZH1lbOrNvjVlswIGEAKYOyrj1K82NL3E+huAWbEMnbFSn1+Qzd4AcE3fajPZV6X04D3lnHGM4xOawKFJwLLYiD5H2AoCkHwJQMLA42v090CzJjVBBN7UCh8rN3AgDrqCYq6lX3L6RQ1MGQRhwWvA7UrALbnFzCJjOhG+d2WjFCkUYKZPZpSDIv1PWDGrycY34NCahI0+yxN/Ivg3c4UlUN8VqWxok/XEfRrSdG0tm/rzcoHBv7KYc5AILqqLWDcOb/45RmGEFyhFL8/0Yga33y+Tl9uJhjxOEVIoG9rnrqVKSJSRFb0fb3tG1A81sC39TLRSu85HL57Eaii0Bm3oqEKqZXSJaUURUxTU0Tyuy0ZAc5SYCUbxE+6+x4w3+0kGNiWooqP3/Qz9xB0bUTRsLqI2eEFUlbvA9WBJxv5ltdMit9jFocpLwB1InQIkBEQTmLUHStOBoMBOr24K2+/AwwPHOKArS2iKCY9VzKIg34jyMgTv6f1wpwqL8JLHKgUTLHwjZIxZTKg0V2Bzg2tLzvYBYA75xe/25J1mkEnGAzYyXE40KQmMK23uLeLN8b1j0ME7epTxFTzRmnCy/jzXyCqIny+NVryDzFeKfd+xLcrDOMMO8MMfgx45iFrOZA7AstiTvvVoZ91usM3tClHcLpeZWDmAN8DZtlRgkY1KJr5+BC87hQQLAeebCwcZN6gXH6MgG2P+rfyDmD+WLoV8xZugkIRiNh2TTHghcfRoF4tFBZpkXgpGQ81rmdu9puLOLzwMPBYPR1Cgzw/v7CC/WpLxjrc/jtaT2LApRrhwC+DfA+Y9aeI0dKzbT3vTCChk3r7eaBABzzfTGgO79CtPUmM9b7U2jv9bf3kOyjSlihLcoSg93MdkZ2Th227j2Hoq8/inTeeNzZ+xFIOsTHAsw/pAeL5+cUvAdPuG1pVRnArQgEsGex7wGw7RxAgBTo19M4EEjqtD1wEkrPYm15oDu/QbfkPSM0hHsu8du0/gSnfLkFGVrbThjFLynULJ6FOZHUw2RNbyd/qUJLFHZV+ywr9aksWO4Ou0BK8KueRz/bVq++CUuD+RGbhB3R/0LeAOZEEnFIRvPGYb+vdGw+cvU7w3uOe1dv+mfeRk5svCMUfvz8AA3o9jgkbCJQVgPe7lGTz5MDvj4f+VXs/JH1ip1PmAkHy17u8z42bjl4lxjf9C809m0CCZo4FUVwKsDPOJLz0ZTp6Fdh6jtnWe1bvuCm/4q/tRwQ1/b03e2LIwGfw1RaCkADg425AOvPkYCHZd0cG43dbsk4zaDFgWHiHcG85wjBQoEhnMhAzf5r/Jihkf9/+fjXDtDXqGA108+Eqcy0DYAfwMU95NnEFzVgLovibwK8HCab19qze61s24Pf5K7A5KwB5vHM1CblMij9m/Q87rtc1jsek54CMPIBayGD0BgP0ImUw/gwYFiqjllhHGAcvAkuPcijU8cgv0KGgSGv8LNJqweu1MOh14A3ss+S78W+Dzuo3RsPoTy0YgIjQALFz0C36tBzg570EE3p4NnHFVn5TA0zaSPDzy57Vu2bIS6jF67BDHYBHgnVI0kow+6ZjLyZNm9RD+35jkZINfNO7ZIVhEn+e16NQ6157/OqWjJ1h9n1IXoydTi8AeGD+KzxqinCEsfkswfBJC2HQacXOG7v0B+e9CGXVUK+U5aoQdm5iE3eqh296R/XoDEBu0e3/hcz3FzF+Z292trI91Zgav7N2tKrDrrfFTdgTI4dAl61BipZDDXYINRCMvBrusNvBikAMHT8LTM3/pwElK4xMAuQV6uBuKK4yA5hEVfY8SvmmHCETGyjDtzqbQLHf0KMgaCnWEcaW/whGT1mAHHZP6oW09bueaFy3khdKcl0EO+y+v4xgphs2MWxbs+K46bLCDIoi6+9iVLKY4PbTp8UB5t8h/UB53qimz1aJA9lyLExz7H1vyMCnUa15L/x9EfhtkIk/nh74y9ShPz5JnUGA26qFZIdcTofWqR5xxd5Uip1O9wDoJNYRxs4LBB9PXYxUdaHrGSqAYuWUp9GmSQ0BlN4h8cTq8qVfOGgKStpBeAoJb4DEYPrPsU89b/5e/LvEYPubLCIQX06NEtWpfwa/yA4h0FEgqVCK71OCUeTARdLLfbpg9PAXsfGsBBtOA0uHmKpyV0PZsqFl5lo5QaXWgRqNw4pTHiEYGa2M+KX0yMROpxsA9BDrCGNvAsG4GcuQdMt45eJx+nXsk3iyNbOY9k161wOry8/GqZCr1t4GBA/O3T0Nm7gSDl/89IBRHiU0nRk3CgU3knEmT4pZN51rrjI5TN2oGmCOMP44BKx7B8jINemP8ZRCK2Y5LNXAMrMlS0hSpwKw9TRGME+XHf5ekybEfPCInU7/BDBArCOMw5cIPvt+JRJUGqHj7JRu2rsd0P+JGBuanELTTVpwwO3/cnjFxNcTwMz95hquxud5pd+skIEfR6NJA+F2y6o1S3Fj4xpj/X9lBmK7OsDuChMUKMf+v36AXC4Fc4QxYwew/X0gM8/k5VKvN0BvcF9gfc8CJuGWuh4twgoQnJSBzK+nDP+3eLTsBahJSNL8DdD29kaUAFsDSU4vpVJp3FTETqdzAbwl1hHGySSCCTPX41RimlcmzthBrTCsV1Obss5cJ2hWXQupTIoiHUW+1nRYZkcn5kRbTzlIOQq5hBmimfRu2RwoeU4gl5rAFiI3Odpmb/NRK0zXu+zgKzZtWZWK/VvTxWZzSP/EK5HoEivcxsFQWIBzk8caVxmWmMT+g6thNlfMg/p1xYfv9DXSMEcYEzYAu247wnBXQ9myE/fslixRpf6FUgw2N5bgDChmk6Lw33MMqkqlg8JeVKmn8hRjHI0QIdgbiJynGWhiZ9AZoPhgaEeK50Q4wmDCvwmzt+HwGe8EcH67V1N8MshWV4UBpnlNLQID3Lcn5nkKrZ6iUEex4azEqC08di0BW1XDgsTP+2NHsrH6F+/0m9Xetns1PN9b3IWHPi8XyetXIOPoEeg1WbhYKMGK9CCoiiSoWq0SnuvWzqhLVuyoz+wI411mmi3epZI9Lt2zgElIUht9INtpdDJPMUsSGf59NCFFxc8TknI6AoZ9LqbCmj+V4X33zMAEAOMHtaXoJ0KLVpUJjJuzD3v+vSh+xtnJ0ffxaMwY0dHuCtO8pg6BAcK3LI4axCTai/4hRsBM3kww5DGK6o5vYx32S52pw9QxbEi8k6o2DMeoj2q5VVhqNnB29JsI0TP5M6Dj5Gg7dwmkpVZOsyOMtyg4joDyBhRq3d+Osbru3S2ZSp0LCmf+9ZM5CUY3qBWx3LREUy5RpbkKQOl0FAimvrksPAME08Q6wmD74DGz/8H2A/+5NdClM8U2r4VFE7rZBcwjtXQIkHsOGLbSLP7XBJhvdxD0fJiinhs+pVk5n41IBM/UFryQSHggvpxRooovpsgdFwjoD8MQri3ZIso/XYzm9a2FwDfUAFPxX/AaRYSCeCR/KW7fvQuYJE0RQF3vSQh2UQn3bsOaYXEJSZrPADrJBfP5BceCVx+4LO0r1hGG3gC8//Np/LXrmJjxdUhbv1YE9vzU22eAmbOPBRmieNCNFzvP8/jhaxVSL3vn4M9zBJN/bgSZgJsyplZ0KQ24oSZgq8vmE4V4+9hrkNIS8O5uPhbNOz+CprWpWRhd7Ahj9svMYM871rT38pbM/q2XvelHoeU4bpxBgt+Jjr8MAqfi80NXZEW/H1UEuOMIY/zCRPyxZr9XABMSJMP5pbelahYlsjNMi1p6402Pp8lyhWEhIBpVp2hdV1yp6nwgPAhYvzQF/+zOEpfZCfXgz6LRIMrxKsq0B5YcKsL6UxRFvBygelBdLjhZGMCx/RfTKWMCUGZzbAClvJEmtiGH97oEGLdhzBHGjL4UDyvLOmBUmn9AaamAay7GimAXgdErzG1RlX36k9el+PlgsPFtK9YRxtwtNzBl7havTZoLywYhuJRbSCNgauvBlAg9TQYDjyVHOeOWbOVxoEoo0Mn2JttpNZvOcmhfn0KTXoTr8TlITSnCrRSt8TMvV7gj79KVPDskCo+1tb/rZkLScavzcTlTARBrZUu+MB1coHNHZ8rQXEzvH4T+8yWY9DzQrj6QptFDzzRlPUj37JbM5pZMeCfZK5CNgsPt3PlbEny3LwSlHWEIqWLzcTWGfbFaCKkgml0zeyNaaa3QdqcAs+msSa2k+4OCmmYm2nyWQ98W9idabo4eqSla3EopMn6m3mRgKkJ6KlM6dV5Plz418ES3CjZE7Ar9w2X5UGXbv3bmC1NBAiqBEOf34zFhKlzLq40PuxK0i8qFutBzRdd7FjDx1zSDCKELxA2tmZoyyztqqc9tUdDlDAm+2hUCdxxhHIwrwOAJy5EvIkSCsz78Nq4rnmhpfU/BANOytgEydwQmpSpjQro/b68we+JNArzej4jjKouz0q+luDwGAzWCxnI1Kr0qPfpEZTzXv6pVwUzf6+MVBTiX6vi+hxoKQfUF4AJswWZZGF+UCUN2IsYMaINnbcVd4jp0m/qePcNcvJlTldcaUm5vVN3qnKNM1zUcJm4LhTuOMP65qMWYGWtxJcU76jGT3nwUrz1j7ZnCCBilAbLS96RucIFJtv88ZpLD/HMZSEgFXmkrrqANp2yjEYsroYRar6f44I3zxh9qNwnH8FHWNxBLj2ix6F85SKltmGV9lBrAF6RConCuh8fotCn7MSC2Fob3ELkPddDBexYwrL2JSZqtFPQpdwfHUT7mf+zjTWFwxxHG8St6zPhtCw6cZXcSnqdhLzTF2FethZcMMK2UBki9DBgmbz18mYAJbMUk5shiYBsxORzT5ucZ8PHbcUaC4OpBGDe55AbiShqP9/40gHLOt058UZbxXMPJnQuUKK+DLi8DEs0R/PJBLIIVwjULHPXgnt2SsQbHq7JeIJSYFIi8mNgeeeT6cFRQAItFOsL4L5li0do9WLrLriK06FZ2e7QO5v3PwugcgDcBo9MbsPT2CnMxFcYwdiNFuMhlKjcs/J23AMMEoONHJhj5JA2T44tvS2TTo5cX4kKqY5X9YuYacq9CEhzlMngmr8uGQasFLUpDPcUV/DCiKwrcNBwrrvueBsyKFVTSvG32aQraRPRMdJKBWaa+vSrcqNAo1hEGsyD8Y/1R/LzmjFea1EBZAbtn9rIqywiYSB5Siecey3U6A5YeN23JmCCPORIcK8IWhV0ps1Wpj8hzjyPmsDPN5P+ZNCWInMOXPz9g/PtgohZfbpEZ3SE5TxSGXBUkIa61vPnCDLCzFEuGrOMY1q02Xunq2VS6p7dkrKOJ17N7UAPP1PG9moatCoOBJ9go0hEGe+P+vC4e3yw84JX2VAoLxMmFL9sApnUkD4kXAKPV6bHsuNQIGDb5p28nmCwixmZSJnA5jeCZh1x3NzfpKi7M/xlFGRmo0qoNqnfohPAG1mcH1dUCfDP+sqkwjuCreY2Mf478swiJGa6V3Az518EFVgHhXMu0DYUZ4G8Dhuqy0Sg0EfM+8myHf88DhjEzIUmzAaA9XA+ZcIqR60KRp+XgjiOM3Sdu4s0vtyAkSIrgQCmCg6QIYZ+BMuPf7Dfzs9vP2bPi34ICZTh2szJ6NM41HuyrV7f2G8tWmNZRPCSc5yuMJWCYGcjHawm+7Sv8DPPfdSBfS9C5oWveHhg+GFqNyfRBEhgIeWgY2kz7AZysRDh5KT4fP0y5vZ0lwBdzGoO9FwbOK4S6KMDpCkP1eaD6fCNghCSDNhe8zmTsVznrMD59XIGa7Wx194SUVUxzT2/JihuZmJJThWoNZ0HgNY/EH28MRUY+B7GOMFibcrJzkJuXB3Z1zXHc7U9ivNlh0mX2aXpm/7ekLA57E6R44zHm5slWAs0A0ybKpDDoaWLhHJafMK0wLIm1ujx0iYD56WgrQO3ryuplSN6xzajkqM83+RCr1aUrol95A5zUJIT971QO5n2bZPybXYRNntsYvx4guLJrL1qkbsD2moOQHP6wlUskRkt5PfiCm5AEC/exa9DmgNcVoVL2KQy59RsqhAQg6tPvwAU5U1F0zvH7AjCsC4mqnE6UGpitvsfSJ0IIHb8lmNzIlkCsIwxPJzDLf10NrDtJMNyBjzDvAkaH5SdkbgOGOf5oVAN4sKawnl+YOwspf+81EzPIh9VvgCbvfoDAKlVx9JAai+ZcNz4PVBBE9W+M07uPo9/laeBgknSeC22ObbVeQ06QCRzselivuQhZBNveCX+JGAoyEZEThyE3fkIYNa00yh69UPdF6y2wsJ6ZqO6LLZl5pUlW9wHFMkrh6mTokgdf7QzG5UwpxDrCcFmwAAImPPztIMHorva3RkbA1GEhGoRPDkfVMj/EVoARaabM2vliCxj9QQtJ1GDAtU3rcGPXDmjVWWDfWWJbtHp9BiCwRScU6KQICJRg4VEp4g8ex4tXvrFSpGT0JxXNsKraIEgVFaHLuQ5ZSE1wAeLsEioRFZ5PnAVlTok5hiQwCG1+mAupwr1V5r4CDGNkgkrzEij93Znqi5CB/XafAhduySDWEYaQsl3RFGiB6Tsce4NkgGlbx+WtqatqjM9ZlOAVJ0tWmPeWEvzYX3gYcOY9cuKzsLE1EVK5oagQJ7/4DDlXS67gZTVqI6dlXxwNaIXrJ06j75UZkFhoHbNyK7Zqh2E3usHAlCupDgFhtSAJEmdsxsqJqZSHevmJaHPoC6vm1nvpNdTu7t6R+L4DjAk06t7M+tKuDb+QkQTw00EFTl2XQawjDIHFOyVj6h+frSeY4uC2it1MRVXgIeUIpBLTWcjdxMJArDgpN2/JPlpF8PlzwoPDjl9v0vZ1N2k1apz+ehJyVaZzS3HimUMKIoWUWrusqtDqUTR46308/bUKekghU1QBkbq+PbPXPkNuEog8DAOS5+ABzVEzSWj9GDSf+JVbXbovAcNs+oODFYSjsp8oqCm2gcj06z9BOHJNbjTZ7RDt/oQQWa2ZXEw0ZWY1yYzYGdCYuj5L7AJNwgBlvHRgj3mjnfvtx0YlS/Zcp9dj6wU5nmpiysccdLMYm5UECr3HruHwQ3/P+KPLzcWZ6VOQfdG5xWbVzl0R9fJgEI7DjO0Eu85rQSTuH1lbV45HbmYSzl1OR+2im4g0ZEJpyETdAC26zpnv1tDdt4AptulPNJ1rplMKUY6uFh8PxL5LARDrCMMtLtvJJAYw3qqTlcOCw7JYLUoBwWHZWWvBIYJxz3jeAiZxv7R0AZJ3bIetdT1B7T4voebTPc0VMbe2G08Wur26sII+6JyD5x4JQU6+FkfOp+DA2es4fO4GsvO1qFk5BE3qVEaTupWNn9G1K0AmILT1fQ8YxhhKqfTi9ewBoPQjSiFAxAasOh2AbfGBRr0qMY4wPJ86phLuFmBm7ibo2oSioYAL+uPXgKvpBIMe9VavgctnE5C7fyuyz58Bc2oRVKMWaj7XBxVbWGuELjxMsOxIAYjUtaqMo9Z90CkHz7WwXkoNPMXZy2k4ePYGDvx3HVdSTHIjBqCVn7verJQJwBQzjKnzJyRlPcZJuJ6UxwsAHEoP/joXgA3nAiHWEYa3ps7dAgyTeTwSRdHcuecDYzdXHCN4oBrwaH3v9Fqr55GWmY2ICNe3XWtOEvyy17MVZmRsLnq2dH4bdv5qBt6Ytg3d29TDOAFvhjIFmNLDGp+c1UxCycs8xTu3jcrMJDvi5VhxOghiHWF4Z+rcvRXGGBy2EvCYABB8sZHggycpqoa6f+lgya/MXC20RUUIDXV9gGJueb/d5tkZ5r0OOejd2nldm/+5gkkLDuOzQe3QrY1r2+0yDZjiwbp4PUNJeelKSqlZSX3/ZRkWHVNArCMMbwFm/AaC8c9Qt65rPWkDCw7Lggw9YVLhcprWnCCoH5qKGmHUaC4tl8sgl0kgl7FPqWhdt6upuQiWc1AoXN96MSd849ez62/31YPeeSwHL7Z1DpixvxzA7hNJWP9lL1RmjgtcJL8ADOOBSkWDCqiGaQoYlYn+TZJh/hEF3HGE4YqpQp7/sC0PrzRPhYxPg9yQjmCkoTA/HUV5aZDq0wBZBQQ0my6kKFE028/BGODpOYHBYfPy8qDT6aDT6Y2flolpUxeDhznscAWkfxKzEFNDAbncteIk8xIzYinxSBj1VrtcvPSo4y0Zs0Z96qPVqFpBgcXjnhXEx/saMCZfZNmTQCjTmZCAEC0oUglPU3iOnDEYtCcb16nCrDaN6ZxKU1HK0xOEIOrMDSlmHnDPEYZLzhoKAW0aivLSQXRpCKRp4HTpKMxNAy1KN36XE+cRAHjKIb/pckhk7h967bXz70STao47wWHZ9bZebwJOMYDY38Zrb4vEtKwZeAKMq5IJSDKZFOuPpqFr8yqCNBjYDd3AXwwgnPu+2Qa3zccrjzleNY7G3cR7P+7G8+2jMWaAMH8r9zVg4pKynudA1jmawExnjKf8fwRkAwF+j46MuJSoyupEKdkdnyoh0/e65wjDUX1c3MdA3hUEEO+YL6fU+BwRNUQa07tAM7v5OpNM8LoXg8PqDXrotHrojUDSQafXgXmrKZ3i0uV4vKkwiT2TJ/WcqYWBBLp8PzkieK1NIV5r71iO8/2qE1i2O8542GeHfiHpvgbMRVX2RzzlpwnpKCGEOa76i5dynxCeTriaTvpP2RnqliMMhwC9MBaBBaeFNEcQTU7FvpDWeU0QrVCiCynA7jjHip9Cy3FFxxz/mVYi0//sPD2u5wWgXUOBSmkAXvtVj7R819s3R215ta0Orz/m2FVVnwkbkJyWa7xOZtfKQtJ9DZiEpKzXAfKbkI6W0JAiQrDyZjZ5adyWUM4dRxiO6qOqRVCkLRPXHCfUt2gjhLXw7jmGBYdl18Uf+Tg47K4LBCz0uZh6P1oJnL/p/qH/5dYGvNnBfv5rN7PRb9JGVAoLwoavrC1enQ3gfQ2YC1ey6kil3CV2lhE7S7MKuMIxf4UGuuMIw1FdhszjCLk6XmxTHNLrqRT5TVdAJnNfPaR04cbgsPsIJjzrmbqL2E4evgxsPy+uXubM7+Vfmbss9661X2lDMdhuABRgyc4LmLnmJGKbKfHlW8KNyu5rwLBBS0zSbKBuWGOyWCoj1rrnCMPRZNEX5SLk3ACmVih2PjmkV9WYiso1RHrec1I7i1HJ5Ct3Kjiso6rPXgeY9P6bPsKB2uSRWKSlZbjNy3FjhuOTD5kIzja9891OnEhMxVs9muHVbsL5e98DJu5ydkNOxh934enfhmPsUDl0ZRgCZUS0IwyHWzJmqPPfcATorrk9yKUzZld5DTKlKUCQNxLr98jlJhV/X6ZrmcBXmwnmDBReb2R0CxQWmiOaiG5uj+5dsOyPH23yMd2ybmNWg6nJfDv8cbRpLDzO6H0PGMaN2zYyi8Q6/Ru+Ogw6A8FfIh1hOBs5evE7KLJ3ih5cRxluSR5FWLNxXiuPFeRJ6D53G5KWC3y4gmDhG8IAw7Ssa9Vlpsrup8jaNXHh+A6bAnYcu4bPfjto/H3z1D4IZ5JcgalMAIb1NVGlHkwpmQ1QwRf3H6wPRU6Re44wHPHXcGMTQm7+LJD9rsnU+soIaO2ux1z75Yu163fdStcUuYXA6wsIVg4VBpjMLDUeaOrgAOK6OjNFcvwhVCiluzbh90PYdvQqqlcMxuovSjSkhRRbZgDDOnsxOaczpYaFlEKQp4Sxm0KQlidxyxGGI+Zqs+IRfuUDIbwXTJMWsxghIc79CAsu7C6Ndg0lAAAdVklEQVStMEws88Jsgg3DhQEmSXUdLdt55hLJuIKs/g2x7UvcdrJtWPcxq40q/h2bKfGViAM/K69MAYZ16NKlzHCDlHwBwr0FUKdr7efbQpCs8a4jjMKCfITHDQRH3d97l578qmqTUblWczGYcErLzjDT+/hej63HLA5r32YOCl135dyFeHTuahtsynVOa4qvPv8II4aVyLJOXUzFsG9NW+bXuz+EISK9lJc5wBSz69KNzEheLxlFQVnEIrvmUlN3B+NiuncdYWi1OsjjP0KQznvxIDVVh0Bem1kreCcZg8N2pwhzX4juVkN6zebwx+u8oHr/OXoCPXrZBpsSW/GAvj3wy6yvzdl+WnsKi3aYnKFPHtIBnZu79qBpWWeZBUxxJ69coYE6ae4zlOqfIyBPM59uxc++36/AuZvedYTBJNz6+OkIL3AVn1b40N8K6oawRu8Jz+CCcvImgiEdKKoLF7p7pe4B8zl8148XVO+uPQcwYNAwj+tt0iga/+4t0Z4a8MUms9HY0vE9ECnUHc7tlpR5wFhyfA+l0lqq7L4A/QlAhTmHgnA8We51Rxh5FxejcvZSjwe7uIAk/cOo0nqK18qbsYPghebUGO7Dl+n1Pzh89iwvqN71G7fhzbc/9Lh5LALCzr+PQVMkR2w0Na4u566m49J1tVElRqyDEb8CTDH3LyblPMhTw67fjwZVPXTV+44wspP2oVq6IBU3QRPiprYWwtvOE0QrhGj2PoKO0dSoR+fL9O5SDm/H8oLq/XP5Gowc7R2tic9/XIlNyU2wY5RH1gJGVvklYFjHL6k0Ty85EbhxV6KceNsRRuatS6h1fYTX5mK+IQR5TZcbDb+8kVhw2MY1KFrV8UZpwsv4ZC3BCw8LC0o7/7fF+HRCydnDWS1FOSmQh1S363aX5XtlxGTEBfbCxveAIMFCB/s1+i1gGDsGL9Cvvpgm6eVtRxgZGZmomTQYHNUKn01OKHlIcEG5AfWE+eB2WefKY0DVMCDWO0G5XNZXTMDOTu3qUzxuinDhNH0/cx6+nGYrpS+diflxLkhPgFRRGfIQ+wzq9OxA5DUei5VDgYruObw0V+vXgOn8LR3L85jibUcY6iw1KiV9CLnhpqt5Ieg5DxkOV16PRyKFyTBcFbrxDPNZJj44rKtyXT1nvsYaVqeC4k1OmfoDfpjl2ncYb9CiMOOS0edyUOVoEGM4cuvUuGkrBHdbgIVvALWs4++6arLNc78GTOx0yq6efvS2I4zs7ByEJY1HkNYUactZ4kkg9FwE9JIKMEgijH8bjN/Z36bftCQcudLaeKC6q9KEPd8dB2Tliw8OK6x0x1Q/7SWoGkrRt4XrksZN/Brzfl3skpB59S9IN13hy0KrQxZkK+ANCQ1Do7ePYO5AoIF1DFqX5Zcm8G/AfENfB8Fv3naEkZubi6CkbxCou2yc9CZARJgBwcCRVlgZV3KC0aSmAhwnQYBcYowHI5FIwIN9MjPfkt/shcUQPdq3Mxy5DLDwfQNFBod1t77ifMyxuVxCBdX7wZgJWLzUdXh3Zh7NtmSgPCQBIQgIt+8/qtmw3fj5zep4yDoGregu+TVgOk2nTNl8pbcdYeTnFyA9U2MMDhQYIIFcwoGTSGCgnHHLECTnIJVIMG2H1BjywtcCRBYc9shlgrdEBocVPbtKZVjyDwGLLyqk3mHvjsGa9ZtdV0k4FGZdBa/NM/JbUcX+wSy692z8PDoWAjwpOa3TvwEzjXajHLa0b0DxSXfvnA9cj3AJxfe7TG5bq4aKyeU5bWIqsOkswcguvu3zyuPE6IBDSL2DBr+Hrdv3uOxshVqNkZqwH7q8NCNtYKUG4CS2V2G1OozE7ClvoZOHFx3+DZjptD0F/m4RRTHpOd9OHja4c/cRdHuQGh3r+TKxScuMuXz9kmDRmM/dgKB6+wwYgv0HjrhkS6+Bb2PlbzNQpDbZILEtGdualU4VH3gaX0/92ii89HZSVpY7NQllzvOLfYG7W7d7Nqe3a/NGA1hR7WfQZhKKU0yAN62396wkhTKFyUPa1qVo6KXDvNB62YH/2x0EXzzv/cnjrA07zhPsT4SgepkeGdMnc5V++nE6Phz/PTITmEIlhSykOmQK24M/W3mmzV2Lpxp7f5z9BjCPT6P1DRwuetMRhqsBtnzOnFHEVAMeVvp24hbpmata4lHcFzH9LKZl8TJXn4Cgep98+kWcPmtSknSWVi/7BZNmrsc/G2eC1xVAqqgEeYjtVRjhpPji1wN49qE7x+uYyAi7C4E3XvA+XWFU6Vo1ABsP2MzJwvDlMnjTEYarAbZ8zrYoVUKBR+vduUF01J67YUR2OhmYs49g9suu+9uhy/OIT2DyFedpz/bVWLXtFL77/F3o8zMhCQxHQJh9nZ/RU5diYJc7p95QZgCTnKHLppTaHK3Zm3bwYhkqKIDFg72/VLsabLZFYbYhnRu6nkCuyhL7/G4AJuEWwKT9QsyUWz3WDdeSkl1268zR3ThwLgtDBzyFIo0KnDwYgRH2VfYrP/jCzKTdX3pPZ8ll60wE990Kk5yhi6OU2kSaZx5OBy2UIkDqPUcYAnloJDtwkSC7AHj6Dm4THK4wIoPDiumXI1pVJjBqBcGqYa5fEA+16IxbqaabL2cp+dJJ3MqRoGXL1si7cRKcNAiBFe2vIopqDZemn133kqsyvf38fgTMJkops4WxSUOWSFGoI9joRUcYQhl+SgUkZZK7EtBp3DpgsjhzdqHdckiXlQcMWcReTq4Bw+z5mV2/sxQcrMCVuH+NoQof7DwESf/+aTz4B1WyH8tDHl7zhDpxlwA9A4+7alXAfQcYVYb2V1C8YY8N7y6XQl1AsGoojyD3vZK6zWHm9siDmK9u13u3Mgrtb71GbZCbm+e0mbVq1cDJIyavMK99OAvrfp0IfVEOFJWj7earUKUG9mxZ45WuOzqv2Cv8vgNMcqZuCuXpWHudGb1GipvZxKuOMLwyIn5eSGSDR8AiQDtLDzZ+ALu3rTKSzPrzAMa//xK0OSlQVLHZfd8uhuDQ/p1QKDyPiFCmAaNK17KD3g/2mP/ZXxJcyeAw/xUeNT3UZPXzOe7V7tes2wx6vcFpme3btcaa5SbX2gfP56Dnk62NipiKqo7tB1at+BMPPdjE47a6kr1YVnD/rTAZ+r6U8ivscWnyVgnibnL4sT+P+l6yN/F4NMoLQLXIh2zizpRmy9PduuCP+ab3YE4h8OCjzyMzfrvDMwyjm/rVZPR8vofHHC7TgLmRpetoMFC7Ximm75TgVDJn1G96srHrw6jHnC4vQBAHqipd+zvu/2JP/Dhjsrm8zv0n4sSWHx3KYRjh0DcH44NRnt8sl2nApGTROnqD7oq9kZq1T4IjV0Q7/xc06OVE7nPg6DS2bXL+AqvW4hVEdvnEXEna2bW4uGY4pEGO99ZPPv4YZs3y3DNpmQYM42hyujaBAjbXJxvOcFhxggHGI+UD92dGeU67HDg6/SGAd36GqfHoMNTuULJaFGZexem5T4CTOL7ufCCmAf7dv0EQ11MyrWN6WmYq84C5lqEdyVF8J4hTlkQc+URZUSbMG4PowsVlSEhSO3zlBtm5+alR0UOPD+KaZ5fa0aQryM+3oi/d/ocfaYOCQudxQCeOHYUPRrxpLocZk8U0i8Wt1HSHLQ+Qy3Hj0jFjzE1Xya8Bw4IuJWfoFgJ42RWjip8TQlbVqijtbwz3dw8kfwJM23YdkaXWOOX6tMljMWzIQCuawW9/hJVrNznNt37Fr+jc8VGXI+rXgCnmjipT353w/Es80IIALDAIM56QMFBQSpmkLAUEJzmeX1qrSuBfLrnqQwJ/AkyXJ7sh+bo5ALZdLs+cPgmvDuxj9ezPFesxbETJucZexrfeeAnTv3QdQqTMAyY5TdeZEspcjdjXjfDm5Ka4REDerF1F5tos0Ev1+hNger7QGxfiLzrl3PyfpqJfb+sr4vSMTDR4qCOYy15HSVmrJs4ddx3Dp8wDRpWhvQQKYfGjvTGJCS4rK8nvPDhvt9WfADPwlUE4etx5ROpFv/6A55950mYkn+zxMv45etLpCB/esw5NGjm3Vy77gEnX+lyQIua2xFOM+hNghg8fjp17Djhl2aolc9C1i21A1x9//h3jJn3jNO+EsaPwocWFgT3isg+Y8hXGatzv51uyTz75GGvWb3E66Teu+h0dLYIlFRNfuapCs7bOgzG1a9MCW9ezKI+OU5kHTPkZxnrw72fAfP3VFPy+yK42k7mTOzf+idYt7cfB7PBkH6cmzsz/29ULhxAe5thlT5kHjOV0SUzKfp6CLwkMAnIjJjLcyo3bRZV6Kk8xxpyPIjsmqiQgYkKS5jpAzfauBFzP6Miw9Z5urdzN709bsjmzZ+K7mb84ZdWBnavR9MFGdmm+/XE+Jn7pXOy2cP536NnD8UrkX4BRaSZQSieauUnIphhl+LNWoFJpFlFKSy7yCYmLUYabRyBBpdkISp8pzkMImRitDP/c3QnvaT5/AsyyJQswYcq3Tll29O+NaBht/45HyLZs0Et9MOvbSQ7r8DfArKOUPm/BjSkxkRFWl++JKvUuSvF4CSCwO1oZ0aX4e0KSmmn2fWoBmPXRynAf2ymW9MCfALNt8zqMGD3BKWDOHt2BKKVj36+du/XD8VNnHZZRu2YNnD+xqxwwjAOJKvU1SlHiDYGgT4wywspZb8I19QUQlBhPULokJqqCecVJUKl7g8JkocS0zQiSopURUZ6uFO7m9yfA/HtoL14Z8r5TViWe2Y9qVR2HUftp7kJ84iLGjLNVqsysMKcTk2s3i67t0KXIheTsSlJK0yilJRqVFPVjoiIuW59z1Ew5q8T9EsE3McoI85km4Zq6HgjMvn4IIVRPSJVGtcMy3J30nuTzJ8AkXjiJZ3uXRD+2xzdV/BGEhzsO1JlyMxWNHnncqRDzmymfYuhg+9pS3gKMq/kqZE54pBp85sy1CjRIEmww2BfnKoKC23NEsrzk/IKc/PycRjzTzrudQoLCAi3BwH6mlH6eV5Bjjo3HEUIUitALoDBfpfDU0C+/IM+5gEAIB9ygCVGEXXeUrawpX2bcvIx2jzuPHJ167SQCA5yHZevR9w3s+9uxy9mnn+qMZQtYyFPb5Awwaek3BcUBkEg4jhQY8po2jcpyY8gtprAnuV3kTVCpPwKFOcgkIdgbrYzobJntokrTgKfUKjY4B/RvEBlRAjTT1m4Ppehk0fIxMcoI51KxO9Q3f1phaFEmHmhuNWQ2XNWknHMYpq+YePGytXhnpPkYalNGSEgwkuIOQyq11V721grjjeng0QrjqgGJKs0SSqmF/ynyfUxk+CjLfAlJWR0BYmWFKZVyHevVDPvbmk7zHUBHFv9GCPkzWhkuWOPZVVvFPPcnwFQI5lE1qrlD9jA1/bSkUy7Zl52TiwYPdkBhUZFD2u0blqBta9u6/AcwSZrzFNR8PcxR8mqDqHCm2m9O8Uma/gTUKjY4R0h0A2W4lcbfxWuaQTyhC8yAAbkQHRne2OVI3QECfwIME7pWr9sC+QUFdjkZFhqK5MR/BHH5taEfOtUa+GT0u/hk9Ds2ZfkFYG7coIo8gyabUpiDHUqItGl9ZYjV/WJikmYUBbW66A+RhgfXrEmsLJsuqXIfMlD9mZIVBoZgSXhYaTpBI+chkb8BpknLJ6BKvmGXa1WrVMbFs/sFcXT7rv3o8/Iwh7SO1GT8AjCJydmPUp4/ZMGdwmhleCghRG+11VKpp4HiI4vfNDGRETbG4JRSaaJKk8Ni9ZhBw3HtomuHHRY0Wl4kEgsYL1bt9aJcWVyyCnv1HYBz5+x78K9Zswb27NwqqF16gwGxnZ9Eerr9y01mffnv4QNQKIIElceIfKl0y+q7Y2eY+CTNOwS05NqDkKMxyvDWpTmRqNIsppRanEXIhRgHW60ElYb5I21VXAYFGd4wMtxzTwqCh8dE6G+AGfzW2zhwwPLdV8KwunXqYOtm4VpKX0+bjt//cKxs+cu8n9Gh/WOCR6TMACZRlT2PUr7E0Jtw82KUYUNLcyL+mno3ISi5hiFkV4wy/Al7HEtQZc8F5d8q2ZZx86OVYebvgrnsIaG/Aeaj/43Fhr/smxs3bBiDDWtXCubohbg49OzVzyH9kMGv46MPzXc7LsstO4BJ0hyloC3Nkxt4JzoyYnZpDiRcU8eBwOxTlFK6uGFUhVfscSoxSf02BcwrCgE5Fh0Zbl5xXHLXSwRiAXM/ayuztn88/mv8PM/qrsbMyRbNH8KeLVYSAJdcZnKd/87H26Vr3uxB7NtmrR1d5s8w7LxxUZWdQ0Etzhvk0eja4TaSq4Qko4cFs5iYI9y0Bsqw/9kFTLKmLeWp+cxCQAobKMNszkUuR8xDAn8DzLTv5mDy1B/tcq1d25bYus4+mByxedacBRg7cardxxzH4VrcYSt1/zIPmMuqzKZ6ylnatRpCpPlhNWvWtLr5unmTBmdrNbmWnCOUjIqOCv/eHjdv3LihyNUrspmzjOLnUsI3q6esaL498xALgrL7G2B+W7gcI8fYVw5/PPYxrFvO3DcIT2npGWj4cGfo9Vb3P+YCmMSfSf6LU5kHTPy17FcJ4f8o2Y6R89GR4Taepy+pNNEGShOsAYN+0VERDi2WEpM05yioWf5CKfdaw6gws3xG+LC5T+lvgNmwaQcGDravgNm9a2csX2hfpcUZh/u/+i42b9ttl2T40Ffx1eclm4wyD5jEJM131FoqvyRaGW7tuMqo7pIVSynZa8k1Cr5jw8iKVlJ+y+elb9UIyPfRpbQH3IeCsJz+BphDR46jW0+7x0qj4RczABObNm7ZhZdef89uNmaMxozS/GaFSVSp91KKWAtufBQTGTG9NHcuXtf05w3WUn4CNIiOjHAYhTQhST0agFmHjBDsi1ZGlOiYiR05N+j9DTDxiZfRqoOVzZ+Za/369MD8WfbPI85Yq9Pp0fDhTmDumEondo5hZssRtzWgy/QKw1T5L6o0WZbq+pTiiYZRETYWQolJ2R9Q8DMsGRakDFcoCbGvhwEg/pq6CyEwO7MigKaBMrwCU/l3Y+67lcXfAMNC9tVp1M4ur159uQ9mznBsLemMwWMnTMOsueaduxXp0j9m4ZluJpvCMg2YxCR1fQqY9cDYRA4MC6usDCc2r5KEJDVbKdiKUZzUMZERFZwxWaXSVCwE0i1tbFytSm6hwkkmR4Cxp9rPirnfr5WZM75KymYwGGw99Qr1XmmPnefjEtG2k6UxbgmV5TmmbAMmWd2H8jBLsgjBtWhlhN1wuglJmiWAlTbz+Rg7lwOlmZ2oUl+lFGaLS8Khb3TtCLNFprcBUro8fwMM6z/zYpmaZutc/L23X8eUCZaaTeK437l7Pxw/aWu+3Oyhxvh7h2lIyzZgktRTKGCOY0kI1kUrI+xaICUkqZl715LzB8WumKgIu1J+y2FIVKnXUgqzTT8BvoyOjHBsbCFuDF1SiwWMywLvIoEQXTLWvB49+yAhwcpsydjqYUOHYNT79g/vQrq1bPkqTPj8CxtSdo759/DfCA1lLrcdp/te0p+g0myCRWhx5jGmYVQFu5f4CSpNHCg1S/kJIYuileGDXDE6/lrWBOY5xkxHyOYYZbjZq4yr/J4+90fAvPbGWzh8xFaNf8S772D4OzYaT4JZnJubi/Ydu9gNqTF39kx0irX1qGlZuM8Bc+PGZa86k8jVVzwGwOwRQQLD4CCpxq5LkFxDxXOgCC5mAOEwO5jLdHnlUqAP72KA5FcLxqWHSDPNajiCR8tNwlx9xav2sjo6w9ymTeCobjTR3bpjQlaDvLbddjnrptAV5oPRH2PTZlsPmLVrVv1q7+bf57rJSmO2Zu36TM3LLzArmAVWqo+qD/dD96c6Y1T3CiASx/F1JNpku9t9T9rjLO8d01a+Uw0uL/fucCCoSqPvCYGN9JJS8n5B2nn7ejMCmxpUpUl7TsL9HRHdBVWbD0CYspXRNZA+Lz394IQq91SI4HLACBxUfydTVGs8FpROseUDHZafGufRCtNxOh1nyM+YKFVUMqs86fLSaW7y0U1n5j/teahlLw5eOWC8yMyyXJSiWqMhoLBRGiOUvpaXFueRalLsdPongAGMfwUZl6G4sARtcw4e/XrXNhv7qbvN43sCMGcSUyy1Asw8aRpdw+gcw9FzMcwrLktMnnLaEg4oqjV8DpSzsRSjPAYUpF9Y5gmvOs2gbXke069tm8A9l7enaYNQWXCAhKMNK4ZFdl6yxqHfO0/qdDfvPQEYdxtfns93HIj9xpBm0BVUpgYteH0ReL0W1FAEWXDl/w5+VvEhIS1JSbli98VYnLdGjbr7furWZVGYXDawYlAAgmTSMY8vXn1XXGk56k+ZBYw3ViV7TLvXVipXk1DIRHZGwyYxex47nf4LwJ6xXuK+0cR5CDERjdjzWs8IXsvdvJRTGDDt7HXt9QLtmIJbF34QUcQdJS2zgLmjXPPHwmu2UCj0+SxYr1XiCN8l91a8fT19kXwqBv9Xg975fuHZaw9reZN6YLWqlfYe2rGoRO4motxiwIvI4pS0HDDe4qSflDPrqS5aA6UyAtAR23dz3u52gyffH3vj9HYWrcE0Nyl0lCOjC255dnXtrXaWA8ZbnPSTcna/3PsyBa0LILPLkjWVvN3tyk2emp+fljTEVC5N43j0zU2Ps/KM6u06xZRXDhgx3Cqnxe6Xe12gYKFJSF6XJaudK3qJ5xdRVG3ETNvZJcI5nqPPFt6ME629IL5a4TnKNGAopfLkbIRIDAgBj2BQnUJPiUIqQRD7JNSgAIgCBIGUkkCOIIAHH0gIFwBKAkH5QEogJwRyUCKn4OWEcDJCIQeBnFLIACoFAfOgLQX7TnH7O5UCHAdQCQjhQKkEIKbvAGf8m4DAFAqEEGIcCnLbbMH4m3FDAtDbtj70dtADCmb7w/6B8gB4gBiMfxNiAGW/se8sogLRg0IPYvyvA2D6DqIn7DuFlhJoKeV1BJwWhGophZZQaEG4QhBaSClfxIEr/HbR1mZrli2unp/8X6tcHW92bhJdv/6cLRvW/AIiyweHPIMEubXDkEsI0QqfhibK4KqNXqEA86hxOF9X1B1Zl5mDlHsq3dOASU2lIQYZKuv0usrgSCUJIRUBvgLlSQVKEMGBhPOgEaB8OEDCKBBGYAyJEUKBEAI2ocuTOxw4dfoMzp0/j/j4RJw5+x/i4uJZGBKbotq0boWFf9jGwKSAjgDMwUkuBXIIkA3QbBBOw4GoeVANoVATjmYBXJaB0syWrR79SSaX33rhuef7zpr2P/u+ad3pjBfz3BXAUEq5lCzUNhj0dQmhUQBRArQWBalBCGoAtBqlqAZAuM9QLzKlvCjgzaHDceCgydslc+Eqk8nNoSiYIRn7r9PpUCEiAn/vMxvAepN1BYTgFkBuUYoUApoCEBYcWEUpuSaRSK/UqIBkQghbZX2W7jhgKKWylCx9WwOPdoTQhylIE0IRbemzzGe9La+oTHGA+aWjBIkE9Byl5JSEw6EaFaRHCCFs+3lH0h0FTHK6bjIFhoNtm8pTOQd8wgGiJsBPtSvLrAIPe6vqOw8YguGg5YDx1oCVl+OCA4SoCb1PAcO6Zt6SAe0IpQ9TigcBRANwHhSxfGaUc8A1B1g4s0RC8B8l5JQE9/mWzFF/iw/9hOjrGkCiYKDmQz9AaxKCqpSSagAtP/S7njRllIIUEELZgT+VgqZwIDeMh34JUUlAr1FaRg/9noxm8bUy1esq6+1cK5vORiS8/FrZEy7fmbzOrpUBqgGImhCoCUqulaU8zSBSWbpEh/SqVYmVz+0700rxpd7RM4z45ng3hz3BJSREoadQSDkSZKBQgPIKUAeCS8IHMiElE16aBZeAnICTWQouCYHUJMQ0Ci9vCy6JlIJKOJOAkqNMcGkrwCTMFJdYCCwtBZilBZbsO5NWwiQPoaUFlsQouGQSS8oTkzCzRHAJGIWVtLTgEryOAtpiwSUTWjJhJqi14JKnKCKEFoKgEITLlxDk63laICXIh4Hme0Nw6d3RvzOl/R8AdGoXzom1qQAAAABJRU5ErkJggg=="},68535:function(Zt,nt,U){"use strict";U.d(nt,{ZP:function(){return Rs}});const F=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},pe=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Se},Se=Number.MAX_SAFE_INTEGER||9007199254740991;let ue=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}({}),G=function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a}({}),p=function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a}({});var ve={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},oe={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class l{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 Z{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 l(e),this.fast_=new l(t),this.defaultTTFB_=n,this.ttfb_=new l(e)}update(e,t){const{slow_:i,fast_:n,ttfb_:s}=this;i.halfLife!==e&&(this.slow_=new l(e,i.getEstimate(),i.getTotalWeight())),n.halfLife!==t&&(this.fast_=new l(t,n.getEstimate(),n.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new l(e,s.getEstimate(),s.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const i=8*t,n=e/1e3,s=i/n;this.fast_.sample(n,s),this.slow_.sample(n,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function k(a,e,t){return(e=M(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function g(){return g=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(a[i]=t[i])}return a},g.apply(null,arguments)}function v(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 E(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?v(Object(t),!0).forEach(function(i){k(a,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach(function(i){Object.defineProperty(a,i,Object.getOwnPropertyDescriptor(t,i))})}return a}function A(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var i=t.call(a,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function M(a){var e=A(a,"string");return typeof e=="symbol"?e:e+""}class j{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const i=`[${e}]:`;this.trace=V,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}const V=function(){},L={trace:V,debug:V,log:V,warn:V,info:V,error:V};function I(){return g({},L)}function w(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):V}function R(a,e,t){return e[a]?e[a].bind(e):w(a,t)}const Y=I();function se(a,e,t){const i=I();if(typeof console=="object"&&a===!0||typeof a=="object"){const n=["debug","log","info","warn","error"];n.forEach(s=>{i[s]=R(s,a,t)});try{i.log(`Debug logs enabled for "${e}" in hls.js version 1.6.11`)}catch(s){return I()}n.forEach(s=>{Y[s]=R(s,a)})}else g(Y,i);return i}const ne=Y;function ye(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Ie(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function xe(a,e){const t=Object.keys(a),i=Object.keys(e),n=t.length,s=i.length;return!n||!s||n===s&&!t.some(r=>i.indexOf(r)===-1)}function $e(a,e=!1){if(typeof TextDecoder!="undefined"){const u=new TextDecoder("utf-8").decode(a);if(e){const f=u.indexOf("\0");return f!==-1?u.substring(0,f):u}return u.replace(/\0/g,"")}const t=a.length;let i,n,s,r="",o=0;for(;o<t;){if(i=a[o++],i===0&&e)return r;if(i===0||i===3)continue;switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(i);break;case 12:case 13:n=a[o++],r+=String.fromCharCode((i&31)<<6|n&63);break;case 14:n=a[o++],s=a[o++],r+=String.fromCharCode((i&15)<<12|(n&63)<<6|(s&63)<<0);break}}return r}function J(a){let e="";for(let t=0;t<a.length;t++){let i=a[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}function D(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function N(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var O={exports:{}},ae;function te(){return ae||(ae=1,function(a,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(c,u,f){if(f=f||{},c=c.trim(),u=u.trim(),!u){if(!f.alwaysNormalize)return c;var d=o.parseURL(c);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var _=o.parseURL(u);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return f.alwaysNormalize?(_.path=o.normalizePath(_.path),o.buildURLFromParts(_)):u;var x=o.parseURL(c);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var T=n.exec(x.path);x.netLoc=T[1],x.path=T[2]}x.netLoc&&!x.path&&(x.path="/");var B={scheme:x.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(B.netLoc=x.netLoc,_.path[0]!=="/"))if(!_.path)B.path=x.path,_.params||(B.params=x.params,_.query||(B.query=x.query));else{var P=x.path,ie=P.substring(0,P.lastIndexOf("/")+1)+_.path;B.path=o.normalizePath(ie)}return B.path===null&&(B.path=f.alwaysNormalize?o.normalizePath(_.path):_.path),o.buildURLFromParts(B)},parseURL:function(c){var u=i.exec(c);return u?{scheme:u[1]||"",netLoc:u[2]||"",path:u[3]||"",params:u[4]||"",query:u[5]||"",fragment:u[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(s,"");c.length!==(c=c.replace(r,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};a.exports=o})()}(O)),O.exports}var S=te();class b{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 K={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class le{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,Lt(this,"stats")}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 baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[K.AUDIO]:null,[K.VIDEO]:null,[K.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new b),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=S.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[K.AUDIO]=null,e[K.VIDEO]=null,e[K.AUDIOVIDEO]=null}}function Ee(a){return a.sn!=="initSegment"}class Ne extends le{constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],t=this.byteRange[1];if(F(e)&&F(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){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){const n=this._decryptdata=this.levelkeys[i[0]]||null;if(n)return n.getDecryptData(this.sn)}}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=F(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var t;const i=Object.keys(this.levelkeys),n=i.length;if(n>1||n===1&&(t=this.levelkeys[i[0]])!=null&&t.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!F(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return Ee(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){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,s,r=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:i,startDTS:n,endDTS:s,partial:r};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,i),c.startDTS=Math.min(c.startDTS,n),c.endDTS=Math.max(c.endDTS,s)}}class Qe extends le{constructor(e,t,i,n,s){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=n;const r=e.enumeratedString("BYTERANGE");r&&this.setByteRange(r,s),s&&(this.fragOffset=s.fragOffset+s.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}function bt(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||bt(t,e)}}function Lt(a,e){const t=bt(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const ti=Math.pow(2,32)-1,ze=[].push,Ct={video:1,audio:2,id3:3,text:4};function Ze(a){return String.fromCharCode.apply(null,a)}function mt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function Ye(a,e){const t=ge(a,e);return t<0?4294967296+t:t}function ke(a,e){let t=Ye(a,e);return t*=Math.pow(2,32),t+=Ye(a,e+4),t}function ge(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function Ae(a){const e=a.byteLength;for(let t=0;t<e;){const i=Ye(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 ee(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=Ye(a,n),r=Ze(a.subarray(n+4,n+8)),o=s>1?n+s:i;if(r===e[0])if(e.length===1)t.push(a.subarray(n+8,o));else{const c=ee(a.subarray(n+8,o),e.slice(1));c.length&&ze.apply(t,c)}n=o}return t}function Re(a){const e=[],t=a[0];let i=8;const n=Ye(a,i);i+=4;let s=0,r=0;t===0?(s=Ye(a,i),r=Ye(a,i+4),i+=8):(s=ke(a,i),r=ke(a,i+8),i+=16),i+=2;let o=a.length+r;const c=mt(a,i);i+=2;for(let u=0;u<c;u++){let f=i;const d=Ye(a,f);f+=4;const _=d&2147483647;if((d&2147483648)>>>31===1)return ne.warn("SIDX has hierarchical references (not supported)"),null;const T=Ye(a,f);f+=4,e.push({referenceSize:_,subsegmentDuration:T,info:{duration:T/n,start:o,end:o+_-1}}),o+=_,f+=4,i=f}return{earliestPresentationTime:s,timescale:n,version:t,referencesCount:c,references:e}}function Te(a){const e=[],t=ee(a,["moov","trak"]);for(let n=0;n<t.length;n++){const s=t[n],r=ee(s,["tkhd"])[0];if(r){let o=r[0];const c=Ye(r,o===0?12:20),u=ee(s,["mdia","mdhd"])[0];if(u){o=u[0];const f=Ye(u,o===0?12:20),d=ee(s,["mdia","hdlr"])[0];if(d){const _=Ze(d.subarray(8,12)),x={soun:K.AUDIO,vide:K.VIDEO}[_],T=ee(s,["mdia","minf","stbl","stsd"])[0],B=q(T);x?(e[c]={timescale:f,type:x,stsd:B},e[x]=E({timescale:f,id:c},B)):e[c]={timescale:f,type:_,stsd:B}}}}}return ee(a,["moov","mvex","trex"]).forEach(n=>{const s=Ye(n,4),r=e[s];r&&(r.default={duration:Ye(n,12),flags:Ye(n,20)})}),e}function q(a){const e=a.subarray(8),t=e.subarray(86),i=Ze(e.subarray(4,8));let n=i,s;const r=i==="enca"||i==="encv";if(r){const u=ee(e,[i])[0].subarray(i==="enca"?28:78);ee(u,["sinf"]).forEach(d=>{const _=ee(d,["schm"])[0];if(_){const x=Ze(_.subarray(4,8));if(x==="cbcs"||x==="cenc"){const T=ee(d,["frma"])[0];T&&(n=Ze(T))}}})}const o=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":{const c=ee(t,["avcC"])[0];c&&c.length>3&&(n+="."+X(c[1])+X(c[2])+X(c[3]),s=W(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=ee(e,[i])[0],u=ee(c.subarray(28),["esds"])[0];if(u&&u.length>7){let f=4;if(u[f++]!==3)break;f=re(u,f),f+=2;const d=u[f++];if(d&128&&(f+=2),d&64&&(f+=u[f++]),u[f++]!==4)break;f=re(u,f);const _=u[f++];if(_===64)n+="."+X(_);else break;if(f+=12,u[f++]!==5)break;f=re(u,f);const x=u[f++];let T=(x&248)>>3;T===31&&(T+=1+((x&7)<<3)+((u[f]&224)>>5)),n+="."+T}break}case"hvc1":case"hev1":{const c=ee(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],f=["","A","B","C"][u>>6],d=u&31,_=Ye(c,2),x=(u&32)>>5?"H":"L",T=c[12],B=c.subarray(6,12);n+="."+f+d,n+="."+z(_).toString(16).toUpperCase(),n+="."+x+T;let P="";for(let ie=B.length;ie--;){const _e=B[ie];(_e||P)&&(P="."+_e.toString(16).toUpperCase()+P)}n+=P}s=W(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{n=W(n,t)||n;break}case"vp09":{const c=ee(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],f=c[5],d=c[6]>>4&15;n+="."+$(u)+"."+$(f)+"."+$(d)}break}case"av01":{const c=ee(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,f=c[1]&31,d=c[2]>>>7?"H":"M",_=(c[2]&64)>>6,x=(c[2]&32)>>5,T=u===2&&_?x?12:10:_?10:8,B=(c[2]&16)>>4,P=(c[2]&8)>>3,ie=(c[2]&4)>>2,_e=c[2]&3;n+="."+u+"."+$(f)+d+"."+$(T)+"."+B+"."+P+ie+_e+"."+$(1)+"."+$(1)+"."+$(1)+"."+0,s=W("dav1",t)}break}}return{codec:n,encrypted:r,supplemental:s}}function W(a,e){const t=ee(e,["dvvC"]),i=t.length?t[0]:ee(e,["dvcC"])[0];if(i){const n=i[2]>>1&127,s=i[2]<<5&32|i[3]>>3&31;return a+"."+$(n)+"."+$(s)}}function z(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function re(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function X(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function $(a){return(a<10?"0":"")+a}function Q(a,e){if(!a||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&ee(a,["moov","trak"]).forEach(n=>{const r=ee(n,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=ee(r,["enca"]);const c=o.length>0;c||(o=ee(r,["encv"])),o.forEach(u=>{const f=c?u.subarray(28):u.subarray(78);ee(f,["sinf"]).forEach(_=>{const x=ce(_);if(x){const T=x.subarray(8,24);T.some(B=>B!==0)||(ne.log(`[eme] Patching keyId in 'enc${c?"a":"v"}>sinf>>tenc' box: ${J(T)} -> ${J(t)}`),x.set(t,8))}})})})}function ce(a){const e=ee(a,["schm"])[0];if(e){const t=Ze(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return ee(a,["schi","tenc"])[0]}return null}function he(a,e,t){const i={},n=ee(a,["moof","traf"]);for(let s=0;s<n.length;s++){const r=n[s],o=ee(r,["tfhd"])[0],c=Ye(o,4),u=e[c];if(!u)continue;i[c]||(i[c]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const f=i[c],d=ee(r,["tfdt"])[0];if(d){const de=d[0];let Le=Ye(d,4);de===1&&(Le===ti?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Le*=ti+1,Le+=Ye(d,8))),F(Le)&&(!F(f.start)||Le<f.start)&&(f.start=Le)}const _=u.default,x=Ye(o,0)|(_==null?void 0:_.flags);let T=(_==null?void 0:_.duration)||0;x&8&&(x&2?T=Ye(o,12):T=Ye(o,8));const B=ee(r,["trun"]);let P=f.start||0,ie=0,_e=T;for(let de=0;de<B.length;de++){const Le=B[de],Me=Ye(Le,4),tt=f.sampleCount;f.sampleCount+=Me;const Pe=Le[3]&1,He=Le[3]&4,Xe=Le[2]&1,Oe=Le[2]&2,ft=Le[2]&4,jt=Le[2]&8;let ai=8,fi=Me;for(Pe&&(ai+=4),He&&Me&&(!(Le[ai+1]&1)&&f.keyFrameIndex===void 0&&(f.keyFrameIndex=tt),ai+=4,Xe?(_e=Ye(Le,ai),ai+=4):_e=T,Oe&&(ai+=4),jt&&(ai+=4),P+=_e,ie+=_e,fi--);fi--;)Xe?(_e=Ye(Le,ai),ai+=4):_e=T,Oe&&(ai+=4),ft&&(Le[ai+1]&1||f.keyFrameIndex===void 0&&(f.keyFrameIndex=f.sampleCount-(fi+1),f.keyFrameStart=P),ai+=4),jt&&(ai+=4),P+=_e,ie+=_e;!ie&&T&&(ie+=T*Me)}f.duration+=ie}if(!Object.keys(i).some(s=>i[s].duration)){let s=1/0,r=0;const o=ee(a,["sidx"]);for(let c=0;c<o.length;c++){const u=Re(o[c]);if(u!=null&&u.references){s=Math.min(s,u.earliestPresentationTime/u.timescale);const f=u.references.reduce((d,_)=>d+_.info.duration||0,0);r=Math.max(r,f+u.earliestPresentationTime/u.timescale)}}r&&F(r)&&Object.keys(i).forEach(c=>{i[c].duration||(i[c].duration=r*i[c].timescale-i[c].start)})}return i}function we(a){const e={valid:null,remainder:null},t=ee(a,["moof"]);if(t.length<2)return e.remainder=a,e;const i=t[t.length-1];return e.valid=a.slice(0,i.byteOffset-8),e.remainder=a.slice(i.byteOffset-8),e}function Ke(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Ve(a,e){const t=[],i=e.samples,n=e.timescale,s=e.id;let r=!1;return ee(i,["moof"]).map(c=>{const u=c.byteOffset-8;ee(c,["traf"]).map(d=>{const _=ee(d,["tfdt"]).map(x=>{const T=x[0];let B=Ye(x,4);return T===1&&(B*=Math.pow(2,32),B+=Ye(x,8)),B/n})[0];return _!==void 0&&(a=_),ee(d,["tfhd"]).map(x=>{const T=Ye(x,4),B=Ye(x,0)&16777215,P=(B&1)!==0,ie=(B&2)!==0,_e=(B&8)!==0;let de=0;const Le=(B&16)!==0;let Me=0;const tt=(B&32)!==0;let Pe=8;T===s&&(P&&(Pe+=8),ie&&(Pe+=4),_e&&(de=Ye(x,Pe),Pe+=4),Le&&(Me=Ye(x,Pe),Pe+=4),tt&&(Pe+=4),e.type==="video"&&(r=Je(e.codec)),ee(d,["trun"]).map(He=>{const Xe=He[0],Oe=Ye(He,0)&16777215,ft=(Oe&1)!==0;let jt=0;const ai=(Oe&4)!==0,fi=(Oe&256)!==0;let oi=0;const Ft=(Oe&512)!==0;let li=0;const Jt=(Oe&1024)!==0,ui=(Oe&2048)!==0;let xi=0;const $t=Ye(He,4);let Gt=8;ft&&(jt=Ye(He,Gt),Gt+=4),ai&&(Gt+=4);let Pi=jt+u;for(let Wi=0;Wi<$t;Wi++){if(fi?(oi=Ye(He,Gt),Gt+=4):oi=de,Ft?(li=Ye(He,Gt),Gt+=4):li=Me,Jt&&(Gt+=4),ui&&(Xe===0?xi=Ye(He,Gt):xi=ge(He,Gt),Gt+=4),e.type===K.VIDEO){let Ni=0;for(;Ni<li;){const Ki=Ye(i,Pi);if(Pi+=4,Ge(r,i[Pi])){const In=i.subarray(Pi,Pi+Ki);Fe(In,r?2:1,a+xi/n,t)}Pi+=Ki,Ni+=Ki+4}}a+=oi/n}}))})})}),t}function Je(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Ge(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Fe(a,e,t,i){const n=pt(a);let s=0;s+=e;let r=0,o=0,c=0;for(;s<n.length;){r=0;do{if(s>=n.length)break;c=n[s++],r+=c}while(c===255);o=0;do{if(s>=n.length)break;c=n[s++],o+=c}while(c===255);const u=n.length-s;let f=s;if(o<u)s+=o;else if(o>u){ne.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[f++]===181){const _=mt(n,f);if(f+=2,_===49){const x=Ye(n,f);if(f+=4,x===1195456820){const T=n[f++];if(T===3){const B=n[f++],P=31&B,ie=64&B,_e=ie?2+P*3:0,de=new Uint8Array(_e);if(ie){de[0]=B;for(let Le=1;Le<_e;Le++)de[Le]=n[f++]}i.push({type:T,payloadType:r,pts:t,bytes:de})}}}}}else if(r===5&&o>16){const d=[];for(let T=0;T<16;T++){const B=n[f++].toString(16);d.push(B.length==1?"0"+B:B),(T===3||T===5||T===7||T===9)&&d.push("-")}const _=o-16,x=new Uint8Array(_);for(let T=0;T<_;T++)x[T]=n[f++];i.push({payloadType:r,pts:t,uuid:d.join(""),userData:$e(x),userDataBytes:x})}}}function pt(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,s=new Uint8Array(n);let r=0;for(i=0;i<n;r++,i++)r===t[0]&&(r++,t.shift()),s[i]=a[r];return s}function De(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;Ze(a.subarray(u,u+1))!=="\0";)t+=Ze(a.subarray(u,u+1)),u+=1;for(t+=Ze(a.subarray(u,u+1)),u+=1;Ze(a.subarray(u,u+1))!=="\0";)i+=Ze(a.subarray(u,u+1)),u+=1;i+=Ze(a.subarray(u,u+1)),u+=1,n=Ye(a,12),s=Ye(a,16),o=Ye(a,20),c=Ye(a,24),u=28}else if(e===1){u+=4,n=Ye(a,u),u+=4;const d=Ye(a,u);u+=4;const _=Ye(a,u);for(u+=4,r=dl(2,32)*d+_,pe(r)||(r=Number.MAX_SAFE_INTEGER,ne.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ye(a,u),u+=4,c=Ye(a,u),u+=4;Ze(a.subarray(u,u+1))!=="\0";)t+=Ze(a.subarray(u,u+1)),u+=1;for(t+=Ze(a.subarray(u,u+1)),u+=1;Ze(a.subarray(u,u+1))!=="\0";)i+=Ze(a.subarray(u,u+1)),u+=1;i+=Ze(a.subarray(u,u+1)),u+=1}const f=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:i,timeScale:n,presentationTime:r,presentationTimeDelta:s,eventDuration:o,id:c,payload:f}}function it(a,...e){const t=e.length;let i=8,n=t;for(;n--;)i+=e[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(a,4),n=0,i=8;n<t;n++)s.set(e[n],i),i+=e[n].byteLength;return s}function Bt(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let i,n;i=0,n=new Uint8Array;let s;i>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const r=new Uint8Array(4);return t.byteLength>0&&new DataView(r.buffer).setUint32(0,t.byteLength,!1),it([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t)}const vt=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),dt={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Vt(a,e){const t=dt[e];return!!t&&!!t[a.slice(0,4)]}function ni(a,e,t=!0){return!a.split(",").some(i=>!Qt(i,e,t))}function Qt(a,e,t=!0){var i;const n=ye(t);return(i=n==null?void 0:n.isTypeSupported(Wt(a,e)))!=null?i:!1}function Wt(a,e){return`${e}/mp4;codecs=${a}`}function ri(a){if(a){const e=a.substring(0,4);return dt.video[e]}return 2}function Rt(a){const e=vt();return a.split(",").reduce((t,i)=>{const s=e&&Je(i)?9:dt.video[i];return s?(s*2+t)/(t?3:2):(dt.audio[i]+t)/(t?2:1)},0)}const ut={};function st(a,e=!0){if(ut[a])return ut[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let n=0;n<t.length;n++){var i;if(Qt(t[n],"audio",e))return ut[a]=t[n],t[n];if(t[n]==="mp3"&&(i=ye(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const Nt=/flac|opus|mp4a\.40\.34/i;function Ht(a,e=!0){return a.replace(Nt,t=>st(t.toLowerCase(),e))}function wt(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)Vt(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function gt(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(St(a,"audio")||St(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let i=t.length;i--;)if(t[i].substring(0,4)===a.substring(0,4))return t[i]}return t[0]}}return e||a}function St(a,e){return Vt(a,e)&&Qt(a,e)}function Ei(a){const e=a.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");i.length>2&&i[0]==="avc1"&&(e[t]=`avc1.${parseInt(i[1]).toString(16)}${("000"+parseInt(i[2]).toString(16)).slice(-4)}`)}return e.join(",")}function zt(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let i=e.length;i>4&&i<10;i++)e[i]=t[i-4];return e.join(".")}return a}function si(a){const e=ye(a)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function It(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const We={supported:!0,powerEfficient:!0,smooth:!0},h={supported:!1,smooth:!1,powerEfficient:!1},m={supported:!0,configurations:[],decodingInfoResults:[We]};function y(a,e){return{supported:!1,configurations:e,decodingInfoResults:[h],error:a}}function C(a,e,t,i,n,s){const r=a.videoCodec,o=a.audioCodec?a.audioGroups:null,c=s==null?void 0:s.audioCodec,u=s==null?void 0:s.channels,f=u?parseInt(u):c?1/0:2;let d=null;if(o!=null&&o.length)try{o.length===1&&o[0]?d=e.groups[o[0]].channels:d=o.reduce((_,x)=>{if(x){const T=e.groups[x];if(!T)throw new Error(`Audio track group ${x} not found`);Object.keys(T.channels).forEach(B=>{_[B]=(_[B]||0)+T.channels[B]})}return _},{2:0})}catch(_){return!0}return r!==void 0&&(r.split(",").some(_=>Je(_))||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))||!!d&&F(f)&&Object.keys(d).some(_=>parseInt(_)>f)}function H(a,e,t,i={}){const n=a.videoCodec;if(!n&&!a.audioCodec||!t)return Promise.resolve(m);const s=[],r=me(a),o=r.length,c=fe(a,e,o>0),u=c.length;for(let f=o||1*u||1;f--;){const d={type:"media-source"};if(o&&(d.video=r[f%o]),u){d.audio=c[f%u];const _=d.audio.bitrate;d.video&&_&&(d.video.bitrate-=_)}s.push(d)}if(n){const f=navigator.userAgent;if(n.split(",").some(d=>Je(d))&&vt())return Promise.resolve(y(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${f})`),s))}return Promise.all(s.map(f=>{const d=at(f);return i[d]||(i[d]=t.decodingInfo(f))})).then(f=>({supported:!f.some(d=>!d.supported),configurations:s,decodingInfoResults:f})).catch(f=>({supported:!1,configurations:s,decodingInfoResults:[],error:f}))}function me(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),i=je(a),n=a.width||640,s=a.height||480,r=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(c=>{const u={contentType:Wt(zt(c),"video"),width:n,height:s,bitrate:i,framerate:r};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function fe(a,e,t){var i;const n=(i=a.audioCodec)==null?void 0:i.split(","),s=je(a);return n&&a.audioGroups?a.audioGroups.reduce((r,o)=>{var c;const u=o?(c=e.groups[o])==null?void 0:c.tracks:null;return u?u.reduce((f,d)=>{if(d.groupId===o){const _=parseFloat(d.channels||"");n.forEach(x=>{const T={contentType:Wt(x,"audio"),bitrate:t?Ce(x,s):s};_&&(T.channels=""+_),f.push(T)})}return f},r):r},[]):[]}function Ce(a,e){if(e<=1)return 1;let t=128e3;return a==="ec-3"?t=768e3:a==="ac-3"&&(t=64e4),Math.min(e/2,t)}function je(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function at(a){let e="";const{audio:t,video:i}=a;if(i){const n=It(i.contentType);e+=`${n}_r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${Math.ceil(i.bitrate/1e5)}`}if(t){const n=It(t.contentType);e+=`${i?"_":""}${n}_c${t.channels}`}return e}const kt=["NONE","TYPE-0","TYPE-1",null];function Mt(a){return kt.indexOf(a)>-1}const xt=["SDR","PQ","HLG"];function Kt(a){return!!a&&xt.indexOf(a)>-1}var Et={No:"",Yes:"YES",v2:"v2"};function ct(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?Et.v2:Et.Yes:Et.No}class ot{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 yt{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(i=>!!i).map(i=>i.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const i=(t=e.supplemental)==null?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=`,${i.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Tt(this._audioGroups,e)}hasSubtitleGroup(e){return Tt(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 Tt(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function mi(){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 Xt(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||xt.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&mi(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Yt=a=>{const e=new WeakSet;return(t,i)=>{if(a&&(i=a(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},ht=(a,e)=>JSON.stringify(a,Yt(e));function At(a,e,t,i,n){const s=Object.keys(a),r=i==null?void 0:i.channels,o=i==null?void 0:i.audioCodec,c=n==null?void 0:n.videoCodec,u=r&&parseInt(r)===2;let f=!1,d=!1,_=1/0,x=1/0,T=1/0,B=1/0,P=0,ie=[];const{preferHDR:_e,allowedVideoRanges:de}=Xt(e,n);for(let He=s.length;He--;){const Xe=a[s[He]];f||(f=Xe.channels[2]>0),_=Math.min(_,Xe.minHeight),x=Math.min(x,Xe.minFramerate),T=Math.min(T,Xe.minBitrate),de.filter(ft=>Xe.videoRanges[ft]>0).length>0&&(d=!0)}_=F(_)?_:0,x=F(x)?x:0;const Le=Math.max(1080,_),Me=Math.max(30,x);T=F(T)?T:t,t=Math.max(T,t),d||(e=void 0);const tt=s.length>1;return{codecSet:s.reduce((He,Xe)=>{const Oe=a[Xe];if(Xe===He)return He;if(ie=d?de.filter(ft=>Oe.videoRanges[ft]>0):[],tt){if(Oe.minBitrate>t)return Pt(Xe,`min bitrate of ${Oe.minBitrate} > current estimate of ${t}`),He;if(!Oe.hasDefaultAudio)return Pt(Xe,"no renditions with default or auto-select sound found"),He;if(o&&Xe.indexOf(o.substring(0,4))%5!==0)return Pt(Xe,`audio codec preference "${o}" not found`),He;if(r&&!u){if(!Oe.channels[r])return Pt(Xe,`no renditions with ${r} channel sound found (channels options: ${Object.keys(Oe.channels)})`),He}else if((!o||u)&&f&&Oe.channels[2]===0)return Pt(Xe,"no renditions with stereo sound found"),He;if(Oe.minHeight>Le)return Pt(Xe,`min resolution of ${Oe.minHeight} > maximum of ${Le}`),He;if(Oe.minFramerate>Me)return Pt(Xe,`min framerate of ${Oe.minFramerate} > maximum of ${Me}`),He;if(!ie.some(ft=>Oe.videoRanges[ft]>0))return Pt(Xe,`no variants with VIDEO-RANGE of ${ht(ie)} found`),He;if(c&&Xe.indexOf(c.substring(0,4))%5!==0)return Pt(Xe,`video codec preference "${c}" not found`),He;if(Oe.maxScore<P)return Pt(Xe,`max score of ${Oe.maxScore} < selected max of ${P}`),He}return He&&(Rt(Xe)>=Rt(He)||Oe.fragmentError>a[He].fragmentError)?He:(B=Oe.minIndex,P=Oe.maxScore,Xe)},void 0),videoRanges:ie,preferHDR:_e,minFramerate:x,minBitrate:T,minIndex:B}}function Pt(a,e){ne.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function be(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 Be(a,e,t,i){return a.slice(t,i+1).reduce((n,s,r)=>{if(!s.codecSet)return n;const o=s.audioGroups;let c=n[s.codecSet];c||(n[s.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:r,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,s.bitrate);const u=Math.min(s.height,s.width);return c.minHeight=Math.min(c.minHeight,u),c.minFramerate=Math.min(c.minFramerate,s.frameRate),c.minIndex=Math.min(c.minIndex,r),c.maxScore=Math.max(c.maxScore,s.score),c.fragmentError+=s.fragmentError,c.videoRanges[s.videoRange]=(c.videoRanges[s.videoRange]||0)+1,o&&o.forEach(f=>{if(!f)return;const d=e.groups[f];d&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?d.hasDefault:d.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(d.channels).forEach(_=>{c.channels[_]=(c.channels[_]||0)+d.channels[_]}))}),n},{})}function et(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:s}=a;return{lang:e,assocLang:t,characteristics:i,channels:n,audioCodec:s}}function qe(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(rt(a,n,t))return i}return-1}function rt(a,e,t){const{groupId:i,name:n,lang:s,assocLang:r,default:o}=a,c=a.forced;return(i===void 0||e.groupId===i)&&(n===void 0||e.name===n)&&(s===void 0||_t(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||Ot(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function _t(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function Ot(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function Ut(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 bi(a,e,t,i,n){const s=e[i],o=e.reduce((_,x,T)=>{const B=x.uri;return(_[B]||(_[B]=[])).push(T),_},{})[s.uri];o.length>1&&(i=Math.max.apply(Math,o));const c=s.videoRange,u=s.frameRate,f=s.codecSet.substring(0,4),d=qt(e,i,_=>{if(_.videoRange!==c||_.frameRate!==u||_.codecSet.substring(0,4)!==f)return!1;const x=_.audioGroups,T=t.filter(B=>!x||x.indexOf(B.groupId)!==-1);return qe(a,T,n)>-1});return d>-1?d:qt(e,i,_=>{const x=_.audioGroups,T=t.filter(B=>!x||x.indexOf(B.groupId)!==-1);return qe(a,T,n)>-1})}function qt(a,e,t){for(let i=e;i>-1;i--)if(t(a[i]))return i;for(let i=e+1;i<a.length;i++)if(t(a[i]))return i;return-1}function yi(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class ci extends j{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=t=>{var i;const{fragCurrent:n,partCurrent:s,hls:r}=this,{autoLevelEnabled:o,media:c}=r;if(!n||!c)return;const u=performance.now(),f=s?s.stats:n.stats,d=s?s.duration:n.duration,_=u-f.loading.start,x=r.minAutoLevel,T=n.level,B=this._nextAutoLevel;if(f.aborted||f.loaded&&f.loaded===f.total||T<=x){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const P=B>-1&&B!==T,ie=!!t||P;if(!ie&&(c.paused||!c.playbackRate||!c.readyState))return;const _e=r.mainForwardBufferInfo;if(!ie&&_e===null)return;const de=this.bwEstimator.getEstimateTTFB(),Le=Math.abs(c.playbackRate);if(_<=Math.max(de,1e3*(d/(Le*2))))return;const Me=_e?_e.len/Le:0,tt=f.loading.first?f.loading.first-f.loading.start:-1,Pe=f.loaded&&tt>-1,He=this.getBwEstimate(),Xe=r.levels,Oe=Xe[T],ft=Math.max(f.loaded,Math.round(d*(n.bitrate||Oe.averageBitrate)/8));let jt=Pe?_-tt:_;jt<1&&Pe&&(jt=Math.min(_,f.loaded*8/He));const ai=Pe?f.loaded*1e3/jt:0,fi=de/1e3,oi=ai?(ft-f.loaded)/ai:ft*8/He+fi;if(oi<=Me)return;const Ft=ai?ai*8:He,li=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,Jt=this.hls.config.abrBandWidthUpFactor;let ui=Number.POSITIVE_INFINITY,xi;for(xi=T-1;xi>x;xi--){const Wi=Xe[xi].maxBitrate,Ni=!Xe[xi].details||li;if(ui=this.getTimeToLoadFrag(fi,Ft,d*Wi,Ni),ui<Math.min(Me,d+fi))break}if(ui>=oi||ui>d*10)return;Pe?this.bwEstimator.sample(_-Math.min(de,tt),f.loaded):this.bwEstimator.sampleTTFB(_);const $t=Xe[xi].maxBitrate;this.getBwEstimate()*Jt>$t&&this.resetEstimator($t);const Gt=this.findBestLevel($t,x,xi,0,Me,1,1);Gt>-1&&(xi=Gt),this.warn(`Fragment ${n.sn}${s?" part "+s.index:""} of level ${T} is loading too slowly;
Fragment duration: ${n.duration.toFixed(3)}
Time to underbuffer: ${Me.toFixed(3)} s
Estimated load time for current fragment: ${oi.toFixed(3)} s
Estimated load time for down switch fragment: ${ui.toFixed(3)} s
TTFB estimate: ${tt|0} ms
Current BW estimate: ${F(He)?He|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${xi} @ ${$t|0} bps`),r.nextLoadLevel=r.nextAutoLevel=xi,this.clearTimer();const Pi=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===xi&&xi>0){const Wi=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${xi>0?"and switching down":""}
Fragment duration: ${n.duration.toFixed(3)} s
Time to underbuffer: ${Wi.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,xi>x){let Ni=this.findBestLevel(this.hls.levels[x].bitrate,x,xi,0,Wi,1,1);Ni===-1&&(Ni=x),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Ni,this.resetEstimator(this.hls.levels[Ni].bitrate)}}};P||oi>ui*2?Pi():this.timer=self.setInterval(Pi,ui*1e3),r.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,part:s,stats:f})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.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 Z(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(p.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},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 G.BUFFER_ADD_CODEC_ERROR:case G.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case G.FRAG_LOAD_TIMEOUT:{const i=t.frag,{fragCurrent:n,partCurrent:s}=this;if(i&&n&&i.sn===n.sn&&i.level===n.level){const r=performance.now(),o=s?s.stats:i.stats,c=r-o.loading.start,u=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&u>-1){const d=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(d,u),o.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,t,i,n){const s=e+i/t,r=n?e+this.lastLevelLoadSec:0;return s+r}onLevelLoaded(e,t){const i=this.hls.config,{loading:n}=t.stats,s=n.end-n.first;F(s)&&(this.lastLevelLoadSec=s/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:i}){const n=i?i.stats:t.stats;if(t.type===oe.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 s=i?i.duration:t.duration,r=this.hls.levels[t.level],o=(r.loaded?r.loaded.bytes:0)+n.loaded,c=(r.loaded?r.loaded.duration:0)+s;r.loaded={bytes:o,duration:c},r.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const s={stats:n,frag:t,part:i,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,s),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:n}=t,s=n!=null&&n.stats.loaded?n.stats:i.stats;if(s.aborted||this.ignoreFragment(i))return;const r=s.parsing.end-s.loading.start-Math.min(s.loading.first-s.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(r,s.loaded),s.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==oe.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,s=this.findBestLevel(i,t,e,0,n,1,1);if(s>-1)return s;const r=this.hls.firstLevel,o=Math.min(Math.max(r,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${r} 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 s=i&&n?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const r=this.hls.levels;if(r.length>Math.max(e,s)&&r[e].loadError<=r[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this;if(i.levels.length<=1)return i.loadLevel;const{maxAutoLevel:n,config:s,minAutoLevel:r}=i,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let f=s.abrBandWidthFactor,d=s.abrBandWidthUpFactor;if(u){const P=this.findBestLevel(c,r,n,u,0,f,d);if(P>=0)return this.rebufferNotice=-1,P}let _=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const P=this.bitrateTestDelay;P&&(_=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-P,this.info(`bitrate test took ${Math.round(1e3*P)}ms, set first fragment max fetchDuration to ${Math.round(1e3*_)} ms`),f=d=1)}const x=this.findBestLevel(c,r,n,u,_,f,d);if(this.rebufferNotice!==x&&(this.rebufferNotice=x,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${x}`)),x>-1)return x;const T=i.levels[r],B=i.loadLevelObj;return B&&(T==null?void 0:T.bitrate)<B.bitrate?r: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,s,r,o){var c;const u=n+s,f=this.lastLoadedFragLevel,d=f===-1?this.hls.firstLevel:f,{fragCurrent:_,partCurrent:x}=this,{levels:T,allAudioTracks:B,loadLevel:P,config:ie}=this.hls;if(T.length===1)return 0;const _e=T[d],de=!!((c=this.hls.latestLevelDetails)!=null&&c.live),Le=P===-1||f===-1;let Me,tt="SDR",Pe=(_e==null?void 0:_e.frameRate)||0;const{audioPreference:He,videoPreference:Xe}=ie,Oe=this.audioTracksByGroup||(this.audioTracksByGroup=be(B));let ft=-1;if(Le){if(this.firstSelection!==-1)return this.firstSelection;const Ft=this.codecTiers||(this.codecTiers=Be(T,Oe,t,i)),li=At(Ft,tt,e,He,Xe),{codecSet:Jt,videoRanges:ui,minFramerate:xi,minBitrate:$t,minIndex:Gt,preferHDR:Pi}=li;ft=Gt,Me=Jt,tt=Pi?ui[ui.length-1]:ui[0],Pe=xi,e=Math.max(e,$t),this.log(`picked start tier ${ht(li)}`)}else Me=_e==null?void 0:_e.codecSet,tt=_e==null?void 0:_e.videoRange;const jt=x?x.duration:_?_.duration:0,ai=this.bwEstimator.getEstimateTTFB()/1e3,fi=[];for(let Ft=i;Ft>=t;Ft--){var oi;const li=T[Ft],Jt=Ft>d;if(!li)continue;if(ie.useMediaCapabilities&&!li.supportedResult&&!li.supportedPromise){const Ni=navigator.mediaCapabilities;typeof(Ni==null?void 0:Ni.decodingInfo)=="function"&&C(li,Oe,tt,Pe,e,He)?(li.supportedPromise=H(li,Oe,Ni,this.supportedCache),li.supportedPromise.then(Ki=>{if(!this.hls)return;li.supportedResult=Ki;const In=this.hls.levels,Tn=In.indexOf(li);Ki.error?this.warn(`MediaCapabilities decodingInfo error: "${Ki.error}" for level ${Tn} ${ht(Ki)}`):Ki.supported?Ki.decodingInfoResults.some(Zn=>Zn.smooth===!1||Zn.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Tn} not smooth or powerEfficient: ${ht(Ki)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Tn} ${ht(Ki)}`),Tn>-1&&In.length>1&&(this.log(`Removing unsupported level ${Tn}`),this.hls.removeLevel(Tn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Ki=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Ki}`)})):li.supportedResult=m}if((Me&&li.codecSet!==Me||tt&&li.videoRange!==tt||Jt&&Pe>li.frameRate||!Jt&&Pe>0&&Pe<li.frameRate||(oi=li.supportedResult)!=null&&(oi=oi.decodingInfoResults)!=null&&oi.some(Ni=>Ni.smooth===!1))&&(!Le||Ft!==ft)){fi.push(Ft);continue}const ui=li.details,xi=(x?ui==null?void 0:ui.partTarget:ui==null?void 0:ui.averagetargetduration)||jt;let $t;Jt?$t=o*e:$t=r*e;const Gt=jt&&n>=jt*2&&s===0?li.averageBitrate:li.maxBitrate,Pi=this.getTimeToLoadFrag(ai,$t,Gt*xi,ui===void 0);if($t>=Gt&&(Ft===f||li.loadError===0&&li.fragmentError===0)&&(Pi<=ai||!F(Pi)||de&&!this.bitrateTestDelay||Pi<u)){const Ni=this.forcedAutoLevel;return Ft!==P&&(Ni===-1||Ni!==P)&&(fi.length&&this.trace(`Skipped level(s) ${fi.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${T[fi[0]].codecs}" ${T[fi[0]].videoRange}; not compatible with "${Me}" ${tt}`),this.info(`switch candidate:${d}->${Ft} adjustedbw(${Math.round($t)})-bitrate=${Math.round($t-Gt)} ttfb:${ai.toFixed(1)} avgDuration:${xi.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${Pi.toFixed(1)} firstSelection:${Le} codecSet:${li.codecSet} videoRange:${li.videoRange} hls.loadLevel:${P}`)),Le&&(this.firstSelection=Ft),Ft}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}}const di={search:function(a,e){let t=0,i=a.length-1,n=null,s=null;for(;t<=i;){n=(t+i)/2|0,s=a[n];const r=e(s);if(r>0)t=n+1;else if(r<0)i=n-1;else return s}return null}};function Si(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!F(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;for(let s=0;s<a.length;++s){const r=a[s];if(vi(e,t,r))return r}return null}function wi(a,e,t=0,i=0,n=.005){let s=null;if(a){s=e[1+a.sn-e[0].sn]||null;const o=a.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),s&&a.level!==s.level&&s.end<=a.end&&(s=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(s=e[0]);if(s&&((!a||a.level===s.level)&&hi(t,i,s)===0||Ii(s,a,Math.min(n,i))))return s;const r=di.search(e,hi.bind(null,t,i));return r&&(r!==a||!s)?r:s}function Ii(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const i=e.tagList.reduce((n,s)=>(s[0]==="INF"&&(n+=parseFloat(s[1])),n),t);return a.start<=i}return!1}function hi(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 vi(a,e,t){const i=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-i>a}function Di(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let i=a.fragments;const{fragmentHint:n}=a;n&&(i=i.concat(n));let s;return di.search(i,r=>r.cc<e?1:r.cc>e?-1:(s=r,r.end<=t?1:r.start>t?-1:0)),s||null}return null}function Ti(a){switch(a.details){case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_TIMEOUT:case G.LEVEL_LOAD_TIMEOUT:case G.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ai(a,e){const t=Ti(e);return a.default[`${t?"timeout":"error"}Retry`]}function Fi(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function Li(a){return E(E({},a),{errorRetry:null,timeoutRetry:null})}function Oi(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(Xi(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function Xi(a){return Ui(a)||!!a&&(a<400||a>499)}function Ui(a){return a===0&&navigator.onLine===!1}var Ci={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},ki={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class qi extends j{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(p.ERROR,this.onError,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.ERROR,this.onError,this),e.off(p.ERROR,this.onErrorOut,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===oe.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,i=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||i===-1?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if((i=e.details)!=null&&i.hasKey(t))return!0;const n=e.audioGroups;if(n)return this.hls.allAudioTracks.filter(r=>n.indexOf(r.groupId)>=0).some(r=>{var o;return(o=r.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i;if(t.fatal)return;const n=this.hls,s=t.context;switch(t.details){case G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case G.FRAG_PARSING_ERROR:if((i=t.frag)!=null&&i.gap){t.errorAction=Qi();return}case G.FRAG_GAP:case G.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ci.SendAlternateToPenaltyBox;return}case G.LEVEL_EMPTY_ERROR:case G.LEVEL_PARSING_ERROR:{var r;const c=t.parent===oe.MAIN?t.level:n.loadLevel;t.details===G.LEVEL_EMPTY_ERROR&&((r=t.context)!=null&&(r=r.levelDetails)!=null&&r.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case G.LEVEL_LOAD_ERROR:case G.LEVEL_LOAD_TIMEOUT:typeof(s==null?void 0:s.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.level));return;case G.AUDIO_TRACK_LOAD_ERROR:case G.AUDIO_TRACK_LOAD_TIMEOUT:case G.SUBTITLE_LOAD_ERROR:case G.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const c=n.loadLevelObj;if(c&&(s.type===ve.AUDIO_TRACK&&c.hasAudioGroup(s.groupId)||s.type===ve.SUBTITLE_TRACK&&c.hasSubtitleGroup(s.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=Ci.SendAlternateToPenaltyBox,t.errorAction.flags=ki.MoveAllAlternatesMatchingHost;return}}return;case G.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:Ci.SendAlternateToPenaltyBox,flags:ki.MoveAllAlternatesMatchingHDCP};return;case G.KEY_SYSTEM_SESSION_UPDATE_FAILED:case G.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case G.KEY_SYSTEM_NO_SESSION:t.errorAction={action:Ci.SendAlternateToPenaltyBox,flags:ki.MoveAllAlternatesMatchingKey};return;case G.BUFFER_ADD_CODEC_ERROR:case G.REMUX_ALLOC_ERROR:case G.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:n.loadLevel)}return;case G.INTERNAL_EXCEPTION:case G.BUFFER_APPENDING_ERROR:case G.BUFFER_FULL_ERROR:case G.LEVEL_SWITCH_ERROR:case G.BUFFER_STALLED_ERROR:case G.BUFFER_SEEK_OVER_HOLE:case G.BUFFER_NUDGE_ON_STALL:t.errorAction=Qi();return}t.type===ue.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Qi())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=Ai(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(Oi(n,s,Ti(e),e.response))return{action:Ci.RetryRequest,flags:ki.None,retryConfig:n,retryCount:s};const o=this.getLevelSwitchAction(e,t);return n&&(o.retryConfig=n,o.retryCount=s),o}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),n=t.levels[i],{fragLoadPolicy:s,keyLoadPolicy:r}=t.config,o=Ai(e.details.startsWith("key")?r:s,e),c=t.levels.reduce((f,d)=>f+d.fragmentError,0);if(n&&(e.details!==G.FRAG_GAP&&n.fragmentError++,Oi(o,c,Ti(e),e.response)))return{action:Ci.RetryRequest,flags:ki.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,i);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const i=this.hls;t==null&&(t=i.loadLevel);const n=this.hls.levels[t];if(n){var s,r;const u=e.details;n.loadError++,u===G.BUFFER_APPEND_ERROR&&n.fragmentError++;let f=-1;const{levels:d,loadLevel:_,minAutoLevel:x,maxAutoLevel:T}=i;!i.autoLevelEnabled&&!i.config.preserveManualLevelOnError&&(i.loadLevel=-1);const B=(s=e.frag)==null?void 0:s.type,ie=(B===oe.AUDIO&&u===G.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===G.BUFFER_ADD_CODEC_ERROR||u===G.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:tt})=>n.audioCodec!==tt),de=e.sourceBufferName==="video"&&(u===G.BUFFER_ADD_CODEC_ERROR||u===G.BUFFER_APPEND_ERROR)&&d.some(({codecSet:tt,audioCodec:Pe})=>n.codecSet!==tt&&n.audioCodec===Pe),{type:Le,groupId:Me}=(r=e.context)!=null?r:{};for(let tt=d.length;tt--;){const Pe=(tt+_)%d.length;if(Pe!==_&&Pe>=x&&Pe<=T&&d[Pe].loadError===0){var o,c;const He=d[Pe];if(u===G.FRAG_GAP&&B===oe.MAIN&&e.frag){const Xe=d[Pe].details;if(Xe){const Oe=wi(e.frag,Xe.fragments,e.frag.start);if(Oe!=null&&Oe.gap)continue}}else{if(Le===ve.AUDIO_TRACK&&He.hasAudioGroup(Me)||Le===ve.SUBTITLE_TRACK&&He.hasSubtitleGroup(Me))continue;if(B===oe.AUDIO&&(o=n.audioGroups)!=null&&o.some(Xe=>He.hasAudioGroup(Xe))||B===oe.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(Xe=>He.hasSubtitleGroup(Xe))||ie&&n.audioCodec===He.audioCodec||de&&n.codecSet===He.codecSet||!ie&&n.codecSet!==He.codecSet)continue}f=Pe;break}}if(f>-1&&i.loadLevel!==f)return e.levelRetry=!0,this.playlistError=0,{action:Ci.SendAlternateToPenaltyBox,flags:ki.None,nextAutoLevel:f}}return{action:Ci.SendAlternateToPenaltyBox,flags:ki.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case Ci.DoNothing:break;case Ci.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==G.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 Ci.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:n}=i,s=i.nextAutoLevel;switch(n){case ki.None:this.switchLevel(e,s);break;case ki.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),u=t.levels[c],f=u==null?void 0:u.attrs["HDCP-LEVEL"];if(i.hdcpLevel=f,f){t.maxHdcpLevel=kt[kt.indexOf(f)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case ki.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const u=this.hls.levels;for(let f=u.length;f--;)if(this.variantHasKey(u[f],c)){var r,o;this.log(`Banned key found in level ${f} (${u[f].bitrate}bps) or audio group "${(r=u[f].audioGroups)==null?void 0:r.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${J(c.keyId||[])}`),u[f].fragmentError++,u[f].loadError++,this.log(`Removing level ${f} with key error (${e.error})`),this.hls.removeLevel(f)}u.length&&(i.resolved=!0)}break}}i.resolved||this.switchLevel(e,s)}switchLevel(e,t){if(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,e.details===G.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const i=It(e.mimeType),n=this.hls.levels;for(let s=n.length;s--;)n[s][`${e.sourceBufferName}Codec`]===i&&(this.log(`Removing level ${s} for ${e.details} ("${i}" not supported)`),this.hls.removeLevel(s))}}}function Qi(a){const e={action:Ci.DoNothing,flags:ki.None};return a&&(e.resolved=!0),e}var Ri={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class rn{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&&(e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=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 s=i[n];if(!s)break;if(s.start<=e&&e<=s.end&&s.loaded)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){const{fragments:n}=this,s=Object.keys(n);for(let r=s.length;r--;){const o=n[s[r]];if((o==null?void 0:o.body.type)===t&&(!i||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,i,n,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(n==null?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const c=this.fragments[o];if(!c||r>=c.body.sn)return;if(!c.buffered&&(!c.loaded||s)){c.body.type===i&&this.removeFragment(c.body);return}const u=c.range[e];if(u){if(u.time.length===0){this.removeFragment(c.body);return}u.time.some(f=>{const d=!this.isTimeBuffered(f.startPTS,f.endPTS,t);return d&&this.removeFragment(c.body),d})}})}detectPartialFragments(e){const t=this.timeRanges;if(!t||e.frag.sn==="initSegment")return;const i=e.frag,n=$i(i),s=this.fragments[n];if(!s||s.buffered&&i.gap)return;const r=!i.relurl;Object.keys(t).forEach(o=>{const c=i.elementaryStreams[o];if(!c)return;const u=t[o],f=r||c.partial===!0;s.range[o]=this.getBufferedTimes(i,e.part,f,u)}),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),Zi(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=ei(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=$i(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 s={time:[],partial:i},r=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||r;for(let f=0;f<n.length;f++){const d=n.start(f)-this.bufferPadding,_=n.end(f)+this.bufferPadding;if(u>=d&&c<=_){s.time.push({startPTS:Math.max(r,n.start(f)),endPTS:Math.min(o,n.end(f))});break}else if(r<_&&o>d){const x=Math.max(r,n.start(f)),T=Math.min(o,n.end(f));T>x&&(s.partial=!0,s.time.push({startPTS:x,endPTS:T}))}else if(o<=d)break}return s}getPartialFragment(e){let t=null,i,n,s,r=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const f=c[u];f&&Zi(f)&&(n=f.body.start-o,s=f.body.end+o,e>=n&&e<=s&&(i=Math.min(e-n,s-e),r<=i&&(t=f.body,r=i)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||Zi(t))}getState(e){const t=$i(e),i=this.fragments[t];return i?i.buffered?Zi(i)?Ri.PARTIAL:Ri.OK:Ri.APPENDING:Ri.NOT_LOADED}isTimeBuffered(e,t,i){let n,s;for(let r=0;r<i.length;r++){if(n=i.start(r)-this.bufferPadding,s=i.end(r)+this.bufferPadding,e>=n&&t<=s)return!0;if(t<=n)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const i=t.frag,n=t.part?null:t,s=$i(i);this.fragments[s]={body:i,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:n,timeRanges:s,type:r}=t;if(i.sn==="initSegment")return;const o=i.type;if(n){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(n)}this.timeRanges=s;const c=s[r];this.detectEvictedFragments(r,c,o,n)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=$i(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let n=i.length;n--;){const s=t[i[n]];if((s==null?void 0:s.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,i,n,s){n&&!this.hasGaps||Object.keys(this.fragments).forEach(r=>{const o=this.fragments[r];if(!o)return;const c=o.body;c.type!==i||n&&!c.gap||c.start<t&&c.end>e&&(o.buffered||s)&&this.removeFragment(c)})}removeFragment(e){const t=$i(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=ei(i,s=>s.fragment.sn!==n)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const t=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;t&&t.forEach(i=>i.clearElementaryStreamInfo())}}function Zi(a){var e,t,i;return a.buffered&&!!(a.body.gap||(e=a.range.video)!=null&&e.partial||(t=a.range.audio)!=null&&t.partial||(i=a.range.audiovideo)!=null&&i.partial)}function $i(a){return`${a.type}_${a.level}_${a.sn}`}function ei(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var Dt={cbc:0,ctr:1};class gi{constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}decrypt(e,t){switch(this.aesMode){case Dt.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Dt.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function Mi(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class Gi{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],s=i[1],r=i[2],o=i[3],c=this.invSubMix,u=c[0],f=c[1],d=c[2],_=c[3],x=new Uint32Array(256);let T=0,B=0,P=0;for(P=0;P<256;P++)P<128?x[P]=P<<1:x[P]=P<<1^283;for(P=0;P<256;P++){let ie=B^B<<1^B<<2^B<<3^B<<4;ie=ie>>>8^ie&255^99,e[T]=ie,t[ie]=T;const _e=x[T],de=x[_e],Le=x[de];let Me=x[ie]*257^ie*16843008;n[T]=Me<<24|Me>>>8,s[T]=Me<<16|Me>>>16,r[T]=Me<<8|Me>>>24,o[T]=Me,Me=Le*16843009^de*65537^_e*257^T*16843008,u[ie]=Me<<24|Me>>>8,f[ie]=Me<<16|Me>>>16,d[ie]=Me<<8|Me>>>24,_[ie]=Me,T?(T=_e^x[x[x[Le^_e]]],B^=x[x[B]]):T=B=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 s=this.keySize=t.length;if(s!==4&&s!==6&&s!==8)throw new Error("Invalid aes key size="+s);const r=this.ksRows=(s+6+1)*4;let o,c;const u=this.keySchedule=new Uint32Array(r),f=this.invKeySchedule=new Uint32Array(r),d=this.sBox,_=this.rcon,x=this.invSubMix,T=x[0],B=x[1],P=x[2],ie=x[3];let _e,de;for(o=0;o<r;o++){if(o<s){_e=u[o]=t[o];continue}de=_e,o%s===0?(de=de<<8|de>>>24,de=d[de>>>24]<<24|d[de>>>16&255]<<16|d[de>>>8&255]<<8|d[de&255],de^=_[o/s|0]<<24):s>6&&o%s===4&&(de=d[de>>>24]<<24|d[de>>>16&255]<<16|d[de>>>8&255]<<8|d[de&255]),u[o]=_e=(u[o-s]^de)>>>0}for(c=0;c<r;c++)o=r-c,c&3?de=u[o]:de=u[o-4],c<4||o<=4?f[c]=de:f[c]=T[d[de>>>24]]^B[d[de>>>16&255]]^P[d[de>>>8&255]]^ie[d[de&255]],f[c]=f[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,i){const n=this.keySize+6,s=this.invKeySchedule,r=this.invSBox,o=this.invSubMix,c=o[0],u=o[1],f=o[2],d=o[3],_=this.uint8ArrayToUint32Array_(i);let x=_[0],T=_[1],B=_[2],P=_[3];const ie=new Int32Array(e),_e=new Int32Array(ie.length);let de,Le,Me,tt,Pe,He,Xe,Oe,ft,jt,ai,fi,oi,Ft;const li=this.networkToHostOrderSwap;for(;t<ie.length;){for(ft=li(ie[t]),jt=li(ie[t+1]),ai=li(ie[t+2]),fi=li(ie[t+3]),Pe=ft^s[0],He=fi^s[1],Xe=ai^s[2],Oe=jt^s[3],oi=4,Ft=1;Ft<n;Ft++)de=c[Pe>>>24]^u[He>>16&255]^f[Xe>>8&255]^d[Oe&255]^s[oi],Le=c[He>>>24]^u[Xe>>16&255]^f[Oe>>8&255]^d[Pe&255]^s[oi+1],Me=c[Xe>>>24]^u[Oe>>16&255]^f[Pe>>8&255]^d[He&255]^s[oi+2],tt=c[Oe>>>24]^u[Pe>>16&255]^f[He>>8&255]^d[Xe&255]^s[oi+3],Pe=de,He=Le,Xe=Me,Oe=tt,oi=oi+4;de=r[Pe>>>24]<<24^r[He>>16&255]<<16^r[Xe>>8&255]<<8^r[Oe&255]^s[oi],Le=r[He>>>24]<<24^r[Xe>>16&255]<<16^r[Oe>>8&255]<<8^r[Pe&255]^s[oi+1],Me=r[Xe>>>24]<<24^r[Oe>>16&255]<<16^r[Pe>>8&255]<<8^r[He&255]^s[oi+2],tt=r[Oe>>>24]<<24^r[Pe>>16&255]<<16^r[He>>8&255]<<8^r[Xe&255]^s[oi+3],_e[t]=li(de^x),_e[t+1]=li(tt^T),_e[t+2]=li(Me^B),_e[t+3]=li(Le^P),x=ft,T=jt,B=ai,P=fi,t=t+4}return _e.buffer}}class cn{constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}expandKey(){const e=hn(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function hn(a){switch(a){case Dt.cbc:return"AES-CBC";case Dt.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const tn=16;class ln{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.enableSoftwareAES=void 0,this.enableSoftwareAES=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?Mi(i):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,n){return this.useSoftware?new Promise((s,r)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,i,n);const c=this.flush();c?s(c.buffer):r(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,i,n)}softwareDecrypt(e,t,i,n){const{currentIV:s,currentResult:r,remainderData:o}=this;if(n!==Dt.cbc||t.byteLength!==16)return ne.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Ke(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;s&&(i=s);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new Gi),u.expandKey(t);const f=r;return this.currentResult=u.decrypt(c.buffer,0,i),this.currentIV=c.slice(-16).buffer,f||null}webCryptoDecrypt(e,t,i,n){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,n));this.key=t,this.fastAesKey=new cn(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new gi(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(ne.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i,n)))}onWebCryptoError(e,t,i,n){const s=this.enableSoftwareAES;if(s){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,n);const r=this.flush();if(r)return r.buffer}throw new Error("WebCrypto"+(s?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%tn;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(ne.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const xn=Math.pow(2,17);class gn{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 sn({type:ue.NETWORK_ERROR,details:G.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,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(T=>T[0]==="GAP")){c(nn(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),f=bn(e);e.loader=u;const d=Li(n.fragLoadPolicy.default),_={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:xn};e.stats=u.stats;const x={onSuccess:(T,B,P,ie)=>{this.resetLoader(e,u);let _e=T.data;P.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(_e.slice(0,16)),_e=_e.slice(16)),o({frag:e,part:null,payload:_e,networkDetails:ie})},onError:(T,B,P,ie)=>{this.resetLoader(e,u),c(new sn({type:ue.NETWORK_ERROR,details:G.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:E({url:i,data:void 0},T),error:new Error(`HTTP Error ${T.code} ${T.text}`),networkDetails:P,stats:ie}))},onAbort:(T,B,P)=>{this.resetLoader(e,u),c(new sn({type:ue.NETWORK_ERROR,details:G.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:P,stats:T}))},onTimeout:(T,B,P)=>{this.resetLoader(e,u),c(new sn({type:ue.NETWORK_ERROR,details:G.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${_.timeout}ms`),networkDetails:P,stats:T}))}};t&&(x.onProgress=(T,B,P,ie)=>t({frag:e,part:null,payload:P,networkDetails:ie})),u.load(f,_,x)})}loadPart(e,t,i){this.abort();const n=this.config,s=n.fLoader,r=n.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(nn(e,t));return}const u=this.loader=s?new s(n):new r(n),f=bn(e,t);e.loader=u;const d=Li(n.fragLoadPolicy.default),_={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:xn};t.stats=u.stats,u.load(f,_,{onSuccess:(x,T,B,P)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const ie={frag:e,part:t,payload:x.data,networkDetails:P};i(ie),o(ie)},onError:(x,T,B,P)=>{this.resetLoader(e,u),c(new sn({type:ue.NETWORK_ERROR,details:G.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:E({url:f.url,data:void 0},x),error:new Error(`HTTP Error ${x.code} ${x.text}`),networkDetails:B,stats:P}))},onAbort:(x,T,B)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new sn({type:ue.NETWORK_ERROR,details:G.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:B,stats:x}))},onTimeout:(x,T,B)=>{this.resetLoader(e,u),c(new sn({type:ue.NETWORK_ERROR,details:G.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${_.timeout}ms`),networkDetails:B,stats:x}))}})})}updateStatsFromPart(e,t){const i=e.stats,n=t.stats,s=n.total;if(i.loaded+=n.loaded,s){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(i.loaded/s),c),d=(c-u)*Math.round(i.loaded/u);i.total=i.loaded+d}else i.total=Math.max(i.loaded,i.total);const r=i.loading,o=n.loading;r.start?r.first+=o.first-o.start:(r.start=o.start,r.first=o.first),r.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function bn(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,s=t.byteRangeEndOffset;if(F(n)&&F(s)){var r;let o=n,c=s;if(a.sn==="initSegment"&&yn((r=a.decryptdata)==null?void 0:r.method)){const u=s-n;u%16&&(c=s+(16-u%16)),n!==0&&(i.resetIV=!0,o=n-16)}i.rangeStart=o,i.rangeEnd=c}return i}function nn(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:ue.MEDIA_ERROR,details:G.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(i.part=e),(e||a).stats.aborted=!0,new sn(i)}function yn(a){return a==="AES-128"||a==="AES-256"}class sn extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class On extends j{constructor(e,t){super(e,t),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(){}}class fn{constructor(e,t,i,n=0,s=-1,r=!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=_n(),this.buffering={audio:_n(),video:_n(),audiovideo:_n()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function _n(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Cn={length:0,start:()=>0,end:()=>0};class _i{static isBuffered(e,t){if(e){const i=_i.getBuffered(e);for(let n=i.length;n--;)if(t>=i.start(n)&&t<=i.end(n))return!0}return!1}static bufferedRanges(e){if(e){const t=_i.getBuffered(e);return _i.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){const n=_i.bufferedRanges(e);if(n.length)return _i.bufferedInfo(n,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){t=Math.max(0,t),e.length>1&&e.sort((f,d)=>f.start-d.start||d.end-f.end);let n=-1,s=[];if(i)for(let f=0;f<e.length;f++){t>=e[f].start&&t<=e[f].end&&(n=f);const d=s.length;if(d){const _=s[d-1].end;e[f].start-_<i?e[f].end>_&&(s[d-1].end=e[f].end):s.push(e[f])}else s.push(e[f])}else s=e;let r=0,o,c=t,u=t;for(let f=0;f<s.length;f++){const d=s[f].start,_=s[f].end;if(n===-1&&t>=d&&t<=_&&(n=f),t+i>=d&&t<_)c=d,u=_,r=u-t;else if(t+i<d){o=d;break}}return{len:r,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||Cn}catch(t){return ne.log("failed to get media.buffered",t),Cn}}}const Kn=/\{\$([a-zA-Z0-9-_]+)\}/g;function $n(a){return Kn.test(a)}function Fn(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(Kn,i=>{const n=i.substring(2,i.length-1),s=t==null?void 0:t[n];return s===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),i):s})}return e}function Bn(a,e,t){let i=a.variableList;i||(a.variableList=i={});let n,s;if("QUERYPARAM"in e){n=e.QUERYPARAM;try{const r=new self.URL(t).searchParams;if(r.has(n))s=r.get(n);else throw new Error(`"${n}" does not match any query parameter in URI: "${t}"`)}catch(r){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${r.message}`))}}else n=e.NAME,s=e.VALUE;n in i?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):i[n]=s||""}function rs(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}"`))}const ds=/^(\d+)x(\d+)$/,Gn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Bi{constructor(e,t){typeof e=="string"&&(e=Bi.parseAttrList(e,t)),g(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}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]}enumeratedStringList(e,t){const i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((n,s)=>(n[s.toLowerCase()]=!0,n),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=ds.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i;const n={},s='"';for(Gn.lastIndex=0;(i=Gn.exec(e))!==null;){const r=i[1].trim();let o=i[2];const c=o.indexOf(s)===0&&o.lastIndexOf(s)===o.length-1;let u=!1;if(c)o=o.slice(1,-1);else switch(r){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(c||u))o=Fn(t,o);else if(!u&&!c)switch(r){case"CLOSED-CAPTIONS":if(o==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":ne.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const ps="com.apple.hls.interstitial";function ms(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Yn(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class Xn{constructor(e,t,i=0){var n;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(t==null?void 0:t.tagAnchor)||null,this.tagOrder=(n=t==null?void 0:t.tagOrder)!=null?n:i,t){const s=t.attr;for(const r in s)if(Object.prototype.hasOwnProperty.call(e,r)&&e[r]!==s[r]){ne.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=g(new Bi({}),s,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const s=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);F(s.getTime())&&(this._endDate=s)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(ne.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const t=this.duration;return t!==null?this._dateAtEnd=new Date(this._startDate.getTime()+t*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(F(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 isInterstitial(){return this.class===ps}get isValid(){return!!this.id&&!this._badValueForSameId&&F(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}const qn=10;class Vn{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.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=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}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return this.fragments.length?F(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||qn}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(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const t=this.lastPartIndex;if(t!==-1){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function vn(a,e){return a.length===e.length?!a.some((t,i)=>t!==e[i]):!1}function An(a,e){return!a&&!e?!0:!a||!e?!1:vn(a,e)}function wn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function un(a){switch(a){case"AES-128":case"AES-256":return Dt.cbc;case"AES-256-CTR":return Dt.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function zi(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function dn(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function kn(a){const e=dn(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function jn(a){const e=function(i,n,s){const r=i[n];i[n]=i[s],i[s]=r};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function as(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 s=n[0]==="base64",r=n[1];s?(i.splice(-1,1),t=zi(r)):t=kn(r)}}return t}const Qn=typeof self!="undefined"?self:void 0;var Yi={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},pn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function os(a){switch(a){case pn.FAIRPLAY:return Yi.FAIRPLAY;case pn.PLAYREADY:return Yi.PLAYREADY;case pn.WIDEVINE:return Yi.WIDEVINE;case pn.CLEARKEY:return Yi.CLEARKEY}}function ii(a){switch(a){case Yi.FAIRPLAY:return pn.FAIRPLAY;case Yi.PLAYREADY:return pn.PLAYREADY;case Yi.WIDEVINE:return pn.WIDEVINE;case Yi.CLEARKEY:return pn.CLEARKEY}}function pi(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[Yi.FAIRPLAY,Yi.WIDEVINE,Yi.PLAYREADY,Yi.CLEARKEY].filter(n=>!!e[n]):[];return!i[Yi.WIDEVINE]&&t&&i.push(Yi.WIDEVINE),i}const ji=function(a){return Qn!=null&&(a=Qn.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function an(a,e,t,i){let n;switch(a){case Yi.FAIRPLAY:n=["cenc","sinf"];break;case Yi.WIDEVINE:case Yi.PLAYREADY:n=["cenc"];break;case Yi.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return en(n,e,t,i)}function en(a,e,t,i){return[{initDataTypes:a,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(s=>({contentType:`audio/mp4; codecs=${s}`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(s=>({contentType:`video/mp4; codecs=${s}`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function gs(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function Mn(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),r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){const o=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(o){const c=zi(o).subarray(0,16);return jn(c),c}}return null}let _s={};class Jn{static clearKeyUriToKeyIdMap(){_s={}}constructor(e,t,i,n=[1],s=null,r){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=s,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!wn(e),r!=null&&r.startsWith("0x")&&(this.keyId=new Uint8Array(D(r)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&vn(e.keyFormatVersions,this.keyFormatVersions)&&An(e.iv,this.iv)&&An(e.keyId,this.keyId)}isSupported(){if(this.method){if(wn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case pn.FAIRPLAY:case pn.WIDEVINE:case pn.PLAYREADY:case pn.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(wn(this.method)&&this.uri&&!this.iv){typeof e!="number"&&(ne.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=hr(e);return new Jn(this.method,this.uri,"identity",this.keyFormatVersions,i)}if(this.pssh&&this.keyId)return this;const t=as(this.uri);if(t)switch(this.keyFormat){case pn.WIDEVINE:if(this.pssh=t,!this.keyId&&t.length>=22){const i=t.length-22;this.keyId=t.subarray(i,i+16)}break;case pn.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Bt(i,null,t),this.keyId=Mn(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=_s[this.uri];if(!i){const n=Object.keys(_s).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,n),_s[this.uri]=i}this.keyId=i}return this}}function hr(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const fr=/#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,dr=/#EXT-X-MEDIA:(.*)/g,Hr=/^#EXT(?:INF|-X-TARGETDURATION):/m,Ms=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),Ns=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Hn{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 S.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return Hr.test(e)}static parseMasterPlaylist(e,t){const i=$n(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];fr.lastIndex=0;let r;for(;(r=fr.exec(e))!=null;)if(r[1]){var o;const u=new Bi(r[1],n),f=Fn(n,r[2]),d={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:Hn.resolve(f,t)},_=u.decimalResolution("RESOLUTION");_&&(d.width=_.width,d.height=_.height),pr(u.CODECS,d);const x=u["SUPPLEMENTAL-CODECS"];x&&(d.supplemental={},pr(x,d.supplemental)),(o=d.unknownCodecs)!=null&&o.length||s.push(d),n.levels.push(d)}else if(r[3]){const u=r[3],f=r[4];switch(u){case"SESSION-DATA":{const d=new Bi(f,n),_=d["DATA-ID"];_&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[_]=d);break}case"SESSION-KEY":{const d=Ys(f,t,n);d.encrypted&&d.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(d)):ne.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${f}"`);break}case"DEFINE":{{const d=new Bi(f,n);Bn(n,d,t)}break}case"CONTENT-STEERING":{const d=new Bi(f,n);n.contentSteering={uri:Hn.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=Xs(f);break}}}const c=s.length>0&&s.length<n.levels.length;return n.levels=c?s:n.levels,n.levels.length===0&&(n.playlistParsingError=new Error("no levels found in manifest")),n}static parseMasterPlaylistMedia(e,t,i){let n;const s={},r=i.levels,o={AUDIO:r.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:r.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(dr.lastIndex=0;(n=dr.exec(e))!==null;){const u=new Bi(n[1],i),f=u.TYPE;if(f){const d=o[f],_=s[f]||[];s[f]=_;const x=u.LANGUAGE,T=u["ASSOC-LANGUAGE"],B=u.CHANNELS,P=u.CHARACTERISTICS,ie=u["INSTREAM-ID"],_e={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||x||"",type:f,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:x,url:u.URI?Hn.resolve(u.URI,t):""};if(T&&(_e.assocLang=T),B&&(_e.channels=B),P&&(_e.characteristics=P),ie&&(_e.instreamId=ie),d!=null&&d.length){const de=Hn.findGroup(d,_e.groupId)||d[0];qs(_e,de,"audioCodec"),qs(_e,de,"textCodec")}_.push(_e)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new Vn(t),f=u.fragments,d=[];let _=null,x=0,T=0,B=0,P=0,ie=0,_e=null,de=new Ne(n,c),Le,Me,tt,Pe=-1,He=!1,Xe=null,Oe;if(Ms.lastIndex=0,u.m3u8=e,u.hasVariableRefs=$n(e),((o=Ms.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(Le=Ms.exec(e))!==null;){He&&(He=!1,de=new Ne(n,c),de.playlistOffset=B,de.setStart(B),de.sn=x,de.cc=P,ie&&(de.bitrate=ie),de.level=i,_&&(de.initSegment=_,_.rawProgramDateTime&&(de.rawProgramDateTime=_.rawProgramDateTime,_.rawProgramDateTime=null),Xe&&(de.setByteRange(Xe),Xe=null)));const fi=Le[1];if(fi){de.duration=parseFloat(fi);const oi=(" "+Le[2]).slice(1);de.title=oi||null,de.tagList.push(oi?["INF",fi,oi]:["INF",fi])}else if(Le[3]){if(F(de.duration)){de.playlistOffset=B,de.setStart(B),tt&&gr(de,tt,u),de.sn=x,de.level=i,de.cc=P,f.push(de);const oi=(" "+Le[3]).slice(1);de.relurl=Fn(u,oi),Bs(de,_e,d),_e=de,B+=de.duration,x++,T=0,He=!0}}else{if(Le=Le[0].match(Ns),!Le){ne.warn("No matches on slow regex match for level playlist!");continue}for(Me=1;Me<Le.length&&Le[Me]===void 0;Me++);const oi=(" "+Le[Me]).slice(1),Ft=(" "+Le[Me+1]).slice(1),li=Le[Me+2]?(" "+Le[Me+2]).slice(1):null;switch(oi){case"BYTERANGE":_e?de.setByteRange(Ft,_e):de.setByteRange(Ft);break;case"PROGRAM-DATE-TIME":de.rawProgramDateTime=Ft,de.tagList.push(["PROGRAM-DATE-TIME",Ft]),Pe===-1&&(Pe=f.length);break;case"PLAYLIST-TYPE":u.type&&es(u,oi,Le),u.type=Ft.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?es(u,oi,Le):f.length>0&&_r(u,oi,Le),x=u.startSN=parseInt(Ft);break;case"SKIP":{u.skippedSegments&&es(u,oi,Le);const Jt=new Bi(Ft,u),ui=Jt.decimalInteger("SKIPPED-SEGMENTS");if(F(ui)){u.skippedSegments+=ui;for(let $t=ui;$t--;)f.push(null);x+=ui}const xi=Jt.enumeratedString("RECENTLY-REMOVED-DATERANGES");xi&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(xi.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&es(u,oi,Le),u.targetduration=Math.max(parseInt(Ft),1);break;case"VERSION":u.version!==null&&es(u,oi,Le),u.version=parseInt(Ft);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||es(u,oi,Le),u.live=!1;break;case"#":(Ft||li)&&de.tagList.push(li?[Ft,li]:[Ft]);break;case"DISCONTINUITY":P++,de.tagList.push(["DIS"]);break;case"GAP":de.gap=!0,de.tagList.push([oi]);break;case"BITRATE":de.tagList.push([oi,Ft]),ie=parseInt(Ft)*1e3,F(ie)?de.bitrate=ie:ie=0;break;case"DATERANGE":{const Jt=new Bi(Ft,u),ui=new Xn(Jt,u.dateRanges[Jt.ID],u.dateRangeTagCount);u.dateRangeTagCount++,ui.isValid||u.skippedSegments?u.dateRanges[ui.id]=ui:ne.warn(`Ignoring invalid DATERANGE tag: "${Ft}"`),de.tagList.push(["EXT-X-DATERANGE",Ft]);break}case"DEFINE":{{const Jt=new Bi(Ft,u);"IMPORT"in Jt?rs(u,Jt,r):Bn(u,Jt,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?es(u,oi,Le):f.length>0&&_r(u,oi,Le),u.startCC=P=parseInt(Ft);break;case"KEY":{const Jt=Ys(Ft,t,u);if(Jt.isSupported()){if(Jt.method==="NONE"){tt=void 0;break}tt||(tt={});const ui=tt[Jt.keyFormat];ui!=null&&ui.matches(Jt)||(ui&&(tt=g({},tt)),tt[Jt.keyFormat]=Jt)}else ne.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${Ft}"`);break}case"START":u.startTimeOffset=Xs(Ft);break;case"MAP":{const Jt=new Bi(Ft,u);if(de.duration){const ui=new Ne(n,c);mr(ui,Jt,i,tt),_=ui,de.initSegment=_,_.rawProgramDateTime&&!de.rawProgramDateTime&&(de.rawProgramDateTime=_.rawProgramDateTime)}else{const ui=de.byteRangeEndOffset;if(ui){const xi=de.byteRangeStartOffset;Xe=`${ui-xi}@${xi}`}else Xe=null;mr(de,Jt,i,tt),_=de,He=!0}_.cc=P;break}case"SERVER-CONTROL":{Oe&&es(u,oi,Le),Oe=new Bi(Ft),u.canBlockReload=Oe.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Oe.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Oe.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Oe.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Oe.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&es(u,oi,Le);const Jt=new Bi(Ft);u.partTarget=Jt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Jt=u.partList;Jt||(Jt=u.partList=[]);const ui=T>0?Jt[Jt.length-1]:void 0,xi=T++,$t=new Bi(Ft,u),Gt=new Qe($t,de,c,xi,ui);Jt.push(Gt),de.duration+=Gt.duration;break}case"PRELOAD-HINT":{const Jt=new Bi(Ft,u);u.preloadHint=Jt;break}case"RENDITION-REPORT":{const Jt=new Bi(Ft,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(Jt);break}default:ne.warn(`line parsed but not handled: ${Le}`);break}}}_e&&!_e.relurl?(f.pop(),B-=_e.duration,u.partList&&(u.fragmentHint=_e)):u.partList&&(Bs(de,_e,d),de.cc=P,u.fragmentHint=de,tt&&gr(de,tt,u)),u.targetduration||(u.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const ft=f.length,jt=f[0],ai=f[ft-1];if(B+=u.skippedSegments*u.targetduration,B>0&&ft&&ai){u.averagetargetduration=B/ft;const fi=ai.sn;u.endSN=fi!=="initSegment"?fi:0,u.live||(ai.endList=!0),Pe>0&&(Wr(f,Pe),jt&&d.unshift(jt))}return u.fragmentHint&&(B+=u.fragmentHint.duration),u.totalduration=B,d.length&&u.dateRangeTagCount&&jt&&Fs(d,u),u.endCC=P,u}}function Fs(a,e){let t=a.length;if(!t)if(e.hasProgramDateTime){const o=e.fragments[e.fragments.length-1];a.push(o),t++}else return;const i=a[t-1],n=e.live?1/0:e.totalduration,s=Object.keys(e.dateRanges);for(let o=s.length;o--;){const c=e.dateRanges[s[o]],u=c.startDate.getTime();c.tagAnchor=i.ref;for(let f=t;f--;){var r;if(((r=a[f])==null?void 0:r.sn)<e.startSN)break;const d=vs(e,u,a,f,n);if(d!==-1){c.tagAnchor=e.fragments[d].ref;break}}}}function vs(a,e,t,i,n){const s=t[i];if(s){const o=s.programDateTime;if(e>=o||i===0){var r;const c=(((r=t[i+1])==null?void 0:r.start)||n)-s.start;if(e<=o+c*1e3){const u=t[i].sn-a.startSN;if(u<0)return-1;const f=a.fragments;if(f.length>t.length){const _=(t[i+1]||f[f.length-1]).sn-a.startSN;for(let x=_;x>u;x--){const T=f[x].programDateTime;if(e>=T&&e<T+f[x].duration*1e3)return x}}return u}}}return-1}function Ys(a,e,t){var i,n;const s=new Bi(a,t),r=(i=s.METHOD)!=null?i:"",o=s.URI,c=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,f=(n=s.KEYFORMAT)!=null?n:"identity";o&&s.IV&&!c&&ne.error(`Invalid IV: ${s.IV}`);const d=o?Hn.resolve(o,e):"",_=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Jn(r,d,f,_,c,s.KEYID)}function Xs(a){const t=new Bi(a).decimalFloatingPoint("TIME-OFFSET");return F(t)?t:null}function pr(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>Vt(s,i));n.length&&(e[`${i}Codec`]=n.map(s=>s.split("/")[0]).join(","),t=t.filter(s=>n.indexOf(s)===-1))}),e.unknownCodecs=t}function qs(a,e,t){const i=e[t];i&&(a[t]=i)}function Wr(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 Bs(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function mr(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 gr(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)}function es(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function _r(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Us(a,e){const t=e.startPTS;if(F(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.setDuration(i)}else e.sn>a.sn?a.cc===e.cc&&a.minEndPTS?e.setStart(a.start+(a.minEndPTS-a.start)):e.setStart(a.start+a.duration):e.setStart(Math.max(a.start-e.duration,0))}function xs(a,e,t,i,n,s,r){i-t<=0&&(r.warn("Fragment should have a positive duration",e),i=t+e.duration,s=n+e.duration);let c=t,u=i;const f=e.startPTS,d=e.endPTS;if(F(f)){const ie=Math.abs(f-t);a&&ie>a.totalduration?r.warn(`media timestamps and playlist times differ by ${ie}s for level ${e.level} ${a.url}`):F(e.deltaPTS)?e.deltaPTS=Math.max(ie,e.deltaPTS):e.deltaPTS=ie,c=Math.max(t,f),t=Math.min(t,f),n=e.startDTS!==void 0?Math.min(n,e.startDTS):n,u=Math.min(i,d),i=Math.max(i,d),s=e.endDTS!==void 0?Math.max(s,e.endDTS):s}const _=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(i-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=n,e.endPTS=i,e.minEndPTS=u,e.endDTS=s;const x=e.sn;if(!a||x<a.startSN||x>a.endSN)return 0;let T;const B=x-a.startSN,P=a.fragments;for(P[B]=e,T=B;T>0;T--)Us(P[T],P[T-1]);for(T=B;T<P.length-1;T++)Us(P[T],P[T+1]);return a.fragmentHint&&Us(P[P.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,_}function Qs(a,e,t){if(a===e)return;let i=null;const n=a.fragments;for(let f=n.length-1;f>=0;f--){const d=n[f].initSegment;if(d){i=d;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let s;Yr(a,e,(f,d,_,x)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==f.cc){const T=f.cc-d.cc;for(let B=_;B<x.length;B++)x[B].cc+=T;e.endCC=x[x.length-1].cc}F(f.startPTS)&&F(f.endPTS)&&(d.setStart(d.startPTS=f.startPTS),d.startDTS=f.startDTS,d.maxStartPTS=f.maxStartPTS,d.endPTS=f.endPTS,d.endDTS=f.endDTS,d.minEndPTS=f.minEndPTS,d.setDuration(f.endPTS-f.startPTS),d.duration&&(s=d),e.PTSKnown=e.alignedSliding=!0),f.hasStreams&&(d.elementaryStreams=f.elementaryStreams),d.loader=f.loader,f.hasStats&&(d.stats=f.stats),f.initSegment&&(d.initSegment=f.initSegment,i=f.initSegment)});const r=e.fragments,o=e.fragmentHint?r.concat(e.fragmentHint):r;if(i&&o.forEach(f=>{var d;f&&(!f.initSegment||f.initSegment.relurl===((d=i)==null?void 0:d.relurl))&&(f.initSegment=i)}),e.skippedSegments){if(e.deltaUpdateFailed=r.some(f=>!f),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let f=e.skippedSegments;f--;)r.shift();e.startSN=r[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=Zr(a.dateRanges,e,t));const f=a.fragments.filter(d=>d.rawProgramDateTime);if(a.hasProgramDateTime&&!e.hasProgramDateTime)for(let d=1;d<o.length;d++)o[d].programDateTime===null&&Bs(o[d],o[d-1],f);Fs(f,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var c;const f=yr(a,e.startSN-1);e.startCC=(c=f==null?void 0:f.cc)!=null?c:r[0].cc}zr(a.partList,e.partList,(f,d)=>{d.elementaryStreams=f.elementaryStreams,d.stats=f.stats}),s?xs(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,t):Ls(a,e),r.length&&(e.totalduration=e.edge-r[0].start),e.driftStartTime=a.driftStartTime,e.driftStart=a.driftStart;const u=e.advancedDateTime;if(e.advanced&&u){const f=e.edge;e.driftStart||(e.driftStartTime=u,e.driftStart=f),e.driftEndTime=u,e.driftEnd=f}else e.driftEndTime=a.driftEndTime,e.driftEnd=a.driftEnd,e.advancedDateTime=a.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=a.requestScheduled)}function Zr(a,e,t){const{dateRanges:i,recentlyRemovedDateranges:n}=e,s=g({},a);n&&n.forEach(c=>{delete s[c]});const o=Object.keys(s).length;return o?(Object.keys(i).forEach(c=>{const u=s[c],f=new Xn(i[c].attr,u);f.isValid?(s[c]=f,u||(f.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${ht(i[c].attr)}"`)}),s):i}function zr(a,e,t){if(a&&e){let i=0;for(let n=0,s=a.length;n<=s;n++){const r=a[n],o=e[n+i];r&&o&&r.index===o.index&&r.fragment.sn===o.fragment.sn?t(r,o):i--}}}function Yr(a,e,t){const i=e.skippedSegments,n=Math.max(a.startSN,e.startSN)-e.startSN,s=(a.fragmentHint?1:0)+(i?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,r=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let u=n;u<=s;u++){const f=c[r+u];let d=o[u];if(i&&!d&&f&&(d=e.fragments[u]=f),f&&d){t(f,d,u,o);const _=f.relurl,x=d.relurl;if(_&&Xr(_,x)){e.playlistParsingError=Js(`media sequence mismatch ${d.sn}:`,a,e,f,d);return}else if(f.cc!==d.cc){e.playlistParsingError=Js(`discontinuity sequence mismatch (${f.cc}!=${d.cc})`,a,e,f,d);return}}}}function Js(a,e,t,i,n){return new Error(`${a} ${n.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function Ls(a,e,t=!0){const i=e.startSN+e.skippedSegments-a.startSN,n=a.fragments,s=i>=0;let r=0;if(s&&i<n.length)r=n[i].start;else if(s&&e.startSN===a.endSN+1)r=a.fragmentEnd;else if(s&&t)r=a.fragmentStart+i*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)r=a.fragmentStart;else return;er(e,r)}function er(a,e){if(e){const t=a.fragments;for(let i=a.skippedSegments;i<t.length;i++)t[i].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function vr(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const i=a.fragments;if(i.length&&t*4>e){const s=i[i.length-1].duration*1e3;s<t&&(t=s)}}else t/=2;return Math.round(t)}function yr(a,e,t){if(!a)return null;let i=a.fragments[e-a.startSN];return i||(i=a.fragmentHint,i&&i.sn===e)?i:e<a.startSN&&t&&t.sn===e?t:null}function tr(a,e,t){return a?Er(a.partList,e,t):null}function Er(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 br(a){a.forEach((e,t)=>{var i;(i=e.details)==null||i.fragments.forEach(n=>{n.level=t,n.initSegment&&(n.initSegment.level=t)})})}function Xr(a,e){return a!==e&&e?Sr(a)!==Sr(e):!1}function Sr(a){return a.replace(/\?[^?]*$/,"")}function Is(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 on(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function Hi(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function Ji(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)Hi(t[i],a);e.fragmentHint&&Hi(e.fragmentHint,a),e.alignedSliding=!0}function Pn(a,e){a&&(Rn(e,a),e.alignedSliding||ys(e,a),!e.alignedSliding&&!e.skippedSegments&&Ls(a,e,!1))}function Rn(a,e){if(!on(e,a))return;const t=Math.min(e.endCC,a.endCC),i=Is(e.fragments,t),n=Is(a.fragments,t);if(!i||!n)return;ne.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;Ji(s,a)}function ys(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,i=e.fragments;if(!t.length||!i.length)return;let n,s;const r=Math.min(e.endCC,a.endCC);e.startCC<r&&a.startCC<r&&(n=Is(i,r),s=Is(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=Is(t,n.cc)||t[Math.floor(t.length/2)]);const o=n.programDateTime,c=s.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(s.start-n.start);Ji(u,a)}function En(a,e,t){Ln(a,e,t),a.addEventListener(e,t)}function Ln(a,e,t){a.removeEventListener(e,t)}const xr={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}},lt={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 Es extends On{constructor(e,t,i,n,s){super(n,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=lt.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.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:r,fragCurrent:o,media:c,mediaBuffer:u,state:f}=this,d=c?c.currentTime:0,_=_i.bufferInfo(u||c,d,r.maxBufferHole),x=!_.len;if(this.log(`Media seeking to ${F(d)?d.toFixed(3):d}, state: ${f}, ${x?"out of":"in"} buffer`),this.state===lt.ENDED)this.resetLoadingState();else if(o){const T=r.maxFragLookUpTolerance,B=o.start-T,P=o.start+o.duration+T;if(x||P<_.start||B>_.end){const ie=d>P;(d<B||ie)&&(ie&&o.loader&&(this.log(`Cancelling fragment load for seek (sn: ${o.sn})`),o.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(d,1/0,this.playlistType,!0);const T=this.lastCurrentTime;if(d>T&&(this.lastCurrentTime=d),!this.loadingParts){const B=Math.max(_.end,d),P=this.shouldLoadParts(this.getLevelDetails(),B);P&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${B.toFixed(2)}`),this.loadingParts=P)}}this.hls.hasEnoughToStart||(this.log(`Setting ${x?"startPosition":"nextLoadPosition"} to ${d} for seek without enough to start`),this.nextLoadPosition=d,x&&(this.startPosition=d)),x&&this.state===lt.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=s,this.hls=e,this.fragmentLoader=new gn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new ln(e.config)}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===lt.STOPPED)return;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=lt.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:t}=this;return t===-1&&e?e:t}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;const i=e.end||0,n=this.config.timelineOffset||0;if(i<=n)return!1;const s=e.buffered;this.config.maxBufferHole&&s&&s.length>1&&(e=_i.bufferedInfo(s,e.start,0));const r=e.nextStart;if(r&&r>n&&r<t.edge||this.media.currentTime<e.start)return!1;const c=t.partList;if(c!=null&&c.length){const f=c[c.length-1];return _i.isBuffered(this.media,f.start+f.duration/2)}const u=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(u)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var t;return((t=this.getLevelDetails())==null?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){const i=this.media=this.mediaBuffer=t.media;En(i,"seeking",this.onMediaSeeking),En(i,"ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===lt.STOPPED&&this.startLoad(n.startPosition)}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(n!==null){if(n.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Ln(n,"seeking",this.onMediaSeeking),Ln(n,"ended",this.onMediaEnded),this.keyLoader&&!i&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=lt.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.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){const n=s=>{const r=s.frag;if(this.fragContextChanged(r)){this.warn(`${r.type} sn: ${r.sn}${s.part?" part: "+s.part.index:""} of ${this.fragInfo(r,!1,s.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(r);return}r.stats.chunkCount++,this._handleFragmentLoadProgress(s)};this._doFragLoad(e,t,i,n).then(s=>{if(!s)return;const r=this.state,o=s.frag;if(this.fragContextChanged(o)){(r===lt.FRAG_LOADING||!this.fragCurrent&&r===lt.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=lt.IDLE);return}"payload"in s&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(p.FRAG_LOADED,s)),this._handleFragmentLoadComplete(s)}).catch(s=>{this.state===lt.STOPPED||this.state===lt.ERROR||(this.warn(`Frag error: ${(s==null?void 0:s.message)||s}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Ri.APPENDING){const s=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,s),o=Math.max(e.duration,r?r.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.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)===Ri.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)}waitForLive(e){const t=e.details;return(t==null?void 0:t.live)&&t.type!=="EVENT"&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const n={startOffset:e,endOffset:t,type:i};this.hls.trigger(p.BUFFER_FLUSHING,n)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(i=>{const n=i==null?void 0:i.frag;if(!n||this.fragContextChanged(n)||!this.levels)throw new Error("init load aborted");return i}).then(i=>{const{hls:n}=this,{frag:s,payload:r}=i,o=s.decryptdata;if(r&&r.byteLength>0&&o!=null&&o.key&&o.iv&&wn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,un(o.method)).catch(u=>{throw n.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:s}),u}).then(u=>{const f=self.performance.now();return n.trigger(p.FRAG_DECRYPTED,{frag:s,payload:u,stats:{tstart:c,tdecrypt:f}}),i.payload=u,this.completeInitSegmentLoad(i)})}return this.completeInitSegmentLoad(i)}).catch(i=>{this.state===lt.STOPPED||this.state===lt.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!==lt.STOPPED&&(this.state=lt.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()}unhandledEncryptionError(e,t){var i,n;const s=e.tracks;if(s&&!t.encrypted&&((i=s.audio)!=null&&i.encrypted||(n=s.video)!=null&&n.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const r=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${r?"attached mediaKeys: "+r.mediaKeys:"detached"})`);return this.warn(o.message),!r||r.mediaKeys?!1:(this.hls.trigger(p.ERROR,{type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_KEYS,fatal:!1,error:o,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){const i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)} > buffer:${i?xr.toString(_i.getBuffered(i)):"(detached)"})`),Ee(e)){var n;if(e.type!==oe.SUBTITLE){const r=e.elementaryStreams;if(!Object.keys(r).some(o=>!!r[o])){this.state=lt.IDLE;return}}const s=(n=this.levels)==null?void 0:n[e.level];s!=null&&s.fragmentError&&(this.log(`Resetting level fragment error count of ${s.fragmentError} on frag buffered`),s.fragmentError=0)}this.state=lt.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:n,partsLoaded:s}=e,r=!s||s.length===0||s.some(c=>!c),o=new fn(i.level,i.sn,i.stats.chunkCount+1,0,n?n.index:-1,!r);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,n){var s;this.fragCurrent=e;const r=t.details;if(!this.levels||!r)throw new Error(`frag load aborted, missing level${r?"":" detail"}s`);let o=null;if(e.encrypted&&!((s=e.decryptdata)!=null&&s.key)){if(this.log(`Loading key for ${e.sn} of [${r.startSN}-${r.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=lt.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(_=>{if(!this.fragContextChanged(_.frag))return this.hls.trigger(p.KEY_LOADED,_),this.state===lt.KEY_LOADING&&(this.state=lt.IDLE),_}),this.hls.trigger(p.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(o=this.keyLoader.loadClear(e,r.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(Ee(e)&&(!c||e.sn!==c.sn)){const _=this.shouldLoadParts(t.details,e.end);_!==this.loadingParts&&(this.log(`LL-Part loading ${_?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=_)}if(i=Math.max(e.start,i||0),this.loadingParts&&Ee(e)){const _=r.partList;if(_&&n){i>r.fragmentEnd&&r.fragmentHint&&(e=r.fragmentHint);const x=this.getNextPart(_,e,i);if(x>-1){const T=_[x];e=this.fragCurrent=T.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${T.index} (${x}/${_.length-1}) of ${this.fragInfo(e,!1,T)}) cc: ${e.cc} [${r.startSN}-${r.endSN}], target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=T.start+T.duration,this.state=lt.FRAG_LOADING;let B;return o?B=o.then(P=>!P||this.fragContextChanged(P.frag)?null:this.doFragPartsLoad(e,T,t,n)).catch(P=>this.handleFragLoadError(P)):B=this.doFragPartsLoad(e,T,t,n).catch(P=>this.handleFragLoadError(P)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:T,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):B}else if(!e.url||this.loadedEndOfParts(_,i))return Promise.resolve(null)}}if(Ee(e)&&this.loadingParts){var u;this.log(`LL-Part loading OFF after next part miss @${i.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(u=r.partList)==null?void 0:u.filter(_=>_.loaded).map(_=>`[${_.start}-${_.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+r.startSN+"-"+r.endSN+"]"}, target: ${parseFloat(i.toFixed(3))}`),F(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=lt.FRAG_LOADING;const f=this.config.progressive;let d;return f&&o?d=o.then(_=>!_||this.fragContextChanged(_.frag)?null:this.fragmentLoader.load(e,n)).catch(_=>this.handleFragLoadError(_)):d=Promise.all([this.fragmentLoader.load(e,f?n:void 0),o]).then(([_])=>(!f&&n&&n(_),_)).catch(_=>this.handleFragLoadError(_)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:i}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,i,n){return new Promise((s,r)=>{var o;const c=[],u=(o=i.details)==null?void 0:o.partList,f=d=>{this.fragmentLoader.loadPart(e,d,n).then(_=>{c[d.index]=_;const x=_.part;this.hls.trigger(p.FRAG_LOADED,_);const T=tr(i.details,e.sn,d.index+1)||Er(u,e.sn,d.index+1);if(T)f(T);else return s({frag:e,part:x,partsLoaded:c})}).catch(r)};f(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===G.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===ue.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetFragmentLoading(t.frag)):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==lt.PARSING){!this.fragCurrent&&this.state!==lt.STOPPED&&this.state!==lt.ERROR&&(this.state=lt.IDLE);return}const{frag:i,part:n,level:s}=t,r=self.performance.now();i.stats.parsing.end=r,n&&(n.stats.parsing.end=r);const o=this.getLevelDetails(),u=o&&i.sn>o.endSN||this.shouldLoadParts(o,i.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${i.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(i,n,s,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var i;const s=e.partList[0];if(s.fragment.type===oe.SUBTITLE)return!1;const r=s.end+(((i=e.fragmentHint)==null?void 0:i.duration)||0);if(t>=r){var n;if((this.hls.hasEnoughToStart?((n=this.media)==null?void 0:n.currentTime)||this.lastCurrentTime:this.getLoadPosition())>s.start-s.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:n,sn:s,part:r}=e;if(!(t!=null&&t[n]))return this.warn(`Levels object was unset while buffering fragment ${s} of ${this.playlistLabel()} ${n}. The current chunk will not be buffered.`),null;const o=t[n],c=o.details,u=r>-1?tr(c,s,r):null,f=u?u.fragment:yr(c,s,i);return f?(i&&i!==f&&(f.stats=i.stats),{frag:f,part:u,level:o}):null}bufferFragmentData(e,t,i,n,s){if(this.state!==lt.PARSING)return;const{data1:r,data2:o}=e;let c=r;if(o&&(c=Ke(r,o)),!c.length)return;const u=this.initPTS[t.cc],f=u?-u.baseTime/u.timescale:void 0,d={type:e.type,frag:t,part:i,chunkMeta:n,offset:f,parent:t.type,data:c};if(this.hls.trigger(p.BUFFER_APPENDING,d),e.dropped&&e.independent&&!i){if(s)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!_i.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=_i.bufferInfo(t,i,0),s=e.duration,r=Math.min(this.config.maxFragLookUpTolerance*2,s*.25),o=Math.max(Math.min(e.start-r,n.end-r),i+r);e.start-o>r&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var i;const n=this.getLoadPosition();if(!F(n))return null;const r=this.lastCurrentTime>n||(i=this.media)!=null&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,n,t,r)}getFwdBufferInfoAtPos(e,t,i,n){const s=_i.bufferInfo(e,t,n);if(s.len===0&&s.nextStart!==void 0){const r=this.fragmentTracker.getBufferedFrag(t,i);if(r&&(s.nextStart<=r.end||r.gap)){const o=Math.max(Math.min(s.nextStart,r.end)-t,n);return _i.bufferInfo(e,t,o)}}return s}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),s=Math.max(e-t*3,i.maxMaxBufferLength/2,n);return s>=n?(i.maxMaxBufferLength=s,this.warn(`Reduce max buffer length to ${s}s`),!0):!1}getAppendedFrag(e,t=oe.MAIN){const i=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,n=i.length;if(!n)return null;const{config:s}=this,r=i[0].start,o=s.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const d=s.initialLiveManifestSize;if(n<d)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${d})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<r){var u;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t);const _=this.hls.startPosition,x=this.hls.liveSyncPosition,T=c?(_!==-1&&_>=r?_:x)||c.start:e;this.log(`Setting startPosition to ${T} to match start frag at live edge. mainStart: ${_} liveSyncPosition: ${x} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=T}}else e<=r&&(c=i[0]);if(!c){const d=this.loadingParts?t.partEnd:t.fragmentEnd;c=this.getFragmentAtPosition(e,d,t)}let f=this.filterReplacedPrimary(c,t);if(!f&&c){const d=c.sn-t.startSN;f=this.filterReplacedPrimary(i[d+1]||null,t)}return this.mapToInitFragWhenRequired(f)}isLoopLoading(e,t){const i=this.fragmentTracker.getState(e);return(i===Ri.OK||i===Ri.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,i,n,s){let r=null;if(e.gap&&(r=this.getNextFragment(this.nextLoadPosition,t),r&&!r.gap&&i.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,n,0);if(o!==null&&i.len+o.len>=s){const c=r.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,r}get primaryPrefetch(){if(Ks(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(Ks(this.config)&&e.type!==oe.SUBTITLE){const i=this.hls.interstitialsManager,n=i==null?void 0:i.bufferingItem;if(n){const r=n.event;if(r){if(r.appendInPlace||Math.abs(e.start-n.start)>1||n.start===0)return null}else if(e.end<=n.start&&(t==null?void 0:t.live)===!1||e.start>n.end&&n.nextEvent&&(n.nextEvent.appendInPlace||e.start-n.end>1))return null}const s=i==null?void 0:i.playerQueue;if(s)for(let r=s.length;r--;){const o=s[r].interstitial;if(o.appendInPlace&&e.start>=o.startTime&&e.end<=o.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,i){let n=-1,s=!1,r=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(r=r&&!u.independent,n>-1&&i<u.start)break;const f=u.loaded;f?n=-1:(s||(u.independent||r)&&u.fragment===t)&&(u.fragment!==t&&this.warn(`Need buffer at ${i} but next unloaded part starts at ${u.start}`),n=o),s=f}return n}loadedEndOfParts(e,t){let i;for(let n=e.length;n--;){if(i=e[n],!i.loaded)return!1;if(t>i.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,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=Si(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const s=i.sn+1;if(s>=e.startSN&&s<=e.endSN){const r=t[s-e.startSN];i.cc===r.cc&&(n=r,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=Di(e,i.cc,i.end),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const s=this.hls.liveSyncPosition;s!==null&&(n=this.getFragmentAtPosition(s,this.bitrateTest?e.fragmentEnd:e.edge,e))}return n}getFragmentAtPosition(e,t,i){const{config:n}=this;let{fragPrevious:s}=this,{fragments:r,endSN:o}=i;const{fragmentHint:c}=i,{maxFragLookUpTolerance:u}=n,f=i.partList,d=!!(this.loadingParts&&f!=null&&f.length&&c);d&&!this.bitrateTest&&f[f.length-1].fragment.sn===c.sn&&(r=r.concat(c),o=c.sn);let _;if(e<t){var x;const B=e<this.lastCurrentTime||e>t-u||(x=this.media)!=null&&x.paused||!this.startFragRequested?0:u;_=wi(s,r,e,B)}else _=r[r.length-1];if(_){const T=_.sn-i.startSN,B=this.fragmentTracker.getState(_);if((B===Ri.OK||B===Ri.PARTIAL&&_.gap)&&(s=_),s&&_.sn===s.sn&&(!d||f[0].fragment.sn>_.sn||!i.live)&&_.level===s.level){const ie=r[T+1];_.sn<o&&this.fragmentTracker.getState(ie)!==Ri.OK?_=ie:_=null}}return _}alignPlaylists(e,t,i){const n=e.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const s=e.fragmentStart,r=!t,o=e.alignedSliding&&F(s);if(r||!o&&!s){Pn(i,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${n}`),c}return s}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;i<t&&(i=-1);const n=this.timelineOffset;if(i===-1){const s=this.startTimeOffset!==null,r=s?this.startTimeOffset:e.startTimeOffset;r!==null&&F(r)?(i=t+r,r<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log(`Setting startPosition to ${i} for start time offset ${r} found in ${s?"multivariant":"media"} playlist`),this.startPosition=i):e.live?(i=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${i}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=i=0),this.lastCurrentTime=i+n}this.nextLoadPosition=i+n}getLoadPosition(){var e;const{media:t}=this;let i=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&Ee(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${t?" part "+t.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==lt.FRAG_LOADING_WAITING_RETRY)&&(this.state=lt.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const ie=this.getCurrentContext(t.chunkMeta);ie&&(t.frag=ie.frag)}const n=t.frag;if(!n||n.type!==e||!this.levels)return;if(this.fragContextChanged(n)){var s;this.warn(`Frag load error must match current frag to retry ${n.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const r=t.details===G.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(n,!0);const o=t.errorAction;if(!o){this.state=lt.ERROR;return}const{action:c,flags:u,retryCount:f=0,retryConfig:d}=o,_=!!d,x=_&&c===Ci.RetryRequest,T=_&&!o.resolved&&u===ki.MoveAllAlternatesMatchingHost,B=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!x&&T&&Ee(n)&&!n.endList&&B)this.resetFragmentErrors(e),this.treatAsGap(n),o.resolved=!0;else if((x||T)&&f<d.maxNumRetry){var P;const ie=Ui((P=t.response)==null?void 0:P.code),_e=Fi(d,f);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+_e,this.state=lt.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,ie){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${n.sn} of ${e} ${n.level} errored with ${t.details}, retrying loading ${f+1}/${d.maxNumRetry} in ${_e}ms`)}else if(d)if(this.resetFragmentErrors(e),f<d.maxNumRetry)!r&&c!==Ci.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${f})`);return}else c===Ci.SendAlternateToPenaltyBox?this.state=lt.WAITING_LEVEL:this.state=lt.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!Ui(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=lt.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===lt.PARSING||this.state===lt.PARSED){const t=e.frag,i=e.parent,n=this.getFwdBufferInfo(this.mediaBuffer,i),s=n&&n.len>.5;s&&this.reduceMaxBufferLength(n.len,(t==null?void 0:t.duration)||10);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${i} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===oe.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==lt.STOPPED&&(this.state=lt.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=_i.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===lt.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==lt.STOPPED&&(this.state=lt.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,t=e?e.details:null;t!=null&&t.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(t,t.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,n){const s=i.details;if(!s){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,u)=>{const f=e.elementaryStreams[u];if(f){const d=f.endPTS-f.startPTS;if(d<=0)return this.warn(`Could not parse fragment ${e.sn} ${u} duration reliably (${d})`),c||!1;const _=n?0:xs(s,e,f.startPTS,f.endPTS,f.startDTS,f.endDTS,this);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:s,level:i,drift:_,type:u,frag:e,start:f.startPTS,end:f.endPTS}),!0}return c},!1)){var o;if(i.fragmentError===0&&this.treatAsGap(e,i),((o=this.transmuxer)==null?void 0:o.error)===null){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=lt.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.fragInfo(e,!1,t)})`),this.hls.trigger(p.FRAG_PARSED,{frag:e,part:t})}playlistLabel(){return this.playlistType===oe.MAIN?"level":"track"}fragInfo(e,t=!0,i){var n,s;return`${this.playlistLabel()} ${e.level} (${i?"part":"frag"}:[${((n=t&&!i?e.startPTS:(i||e).start)!=null?n:NaN).toFixed(3)}-${((s=t&&!i?e.endPTS:(i||e).end)!=null?s:NaN).toFixed(3)}]${i&&e.type==="main"?"INDEPENDENT="+(i.independent?"YES":"NO"):""}`}treatAsGap(e,t){t&&t.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}function Ks(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Tr{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=gl(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function gl(a,e){const t=new Uint8Array(e);let i=0;for(let n=0;n<a.length;n++){const s=a[n];t.set(s,i),i+=s.length}return t}var qr={exports:{}},Ua;function _l(){return Ua||(Ua=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function n(c,u,f){this.fn=c,this.context=u,this.once=f||!1}function s(c,u,f,d,_){if(typeof f!="function")throw new TypeError("The listener must be a function");var x=new n(f,d||c,_),T=t?t+u:u;return c._events[T]?c._events[T].fn?c._events[T]=[c._events[T],x]:c._events[T].push(x):(c._events[T]=x,c._eventsCount++),c}function r(c,u){--c._eventsCount===0?c._events=new i:delete c._events[u]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],f,d;if(this._eventsCount===0)return u;for(d in f=this._events)e.call(f,d)&&u.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},o.prototype.listeners=function(u){var f=t?t+u:u,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var _=0,x=d.length,T=new Array(x);_<x;_++)T[_]=d[_].fn;return T},o.prototype.listenerCount=function(u){var f=t?t+u:u,d=this._events[f];return d?d.fn?1:d.length:0},o.prototype.emit=function(u,f,d,_,x,T){var B=t?t+u:u;if(!this._events[B])return!1;var P=this._events[B],ie=arguments.length,_e,de;if(P.fn){switch(P.once&&this.removeListener(u,P.fn,void 0,!0),ie){case 1:return P.fn.call(P.context),!0;case 2:return P.fn.call(P.context,f),!0;case 3:return P.fn.call(P.context,f,d),!0;case 4:return P.fn.call(P.context,f,d,_),!0;case 5:return P.fn.call(P.context,f,d,_,x),!0;case 6:return P.fn.call(P.context,f,d,_,x,T),!0}for(de=1,_e=new Array(ie-1);de<ie;de++)_e[de-1]=arguments[de];P.fn.apply(P.context,_e)}else{var Le=P.length,Me;for(de=0;de<Le;de++)switch(P[de].once&&this.removeListener(u,P[de].fn,void 0,!0),ie){case 1:P[de].fn.call(P[de].context);break;case 2:P[de].fn.call(P[de].context,f);break;case 3:P[de].fn.call(P[de].context,f,d);break;case 4:P[de].fn.call(P[de].context,f,d,_);break;default:if(!_e)for(Me=1,_e=new Array(ie-1);Me<ie;Me++)_e[Me-1]=arguments[Me];P[de].fn.apply(P[de].context,_e)}}return!0},o.prototype.on=function(u,f,d){return s(this,u,f,d,!1)},o.prototype.once=function(u,f,d){return s(this,u,f,d,!0)},o.prototype.removeListener=function(u,f,d,_){var x=t?t+u:u;if(!this._events[x])return this;if(!f)return r(this,x),this;var T=this._events[x];if(T.fn)T.fn===f&&(!_||T.once)&&(!d||T.context===d)&&r(this,x);else{for(var B=0,P=[],ie=T.length;B<ie;B++)(T[B].fn!==f||_&&!T[B].once||d&&T[B].context!==d)&&P.push(T[B]);P.length?this._events[x]=P.length===1?P[0]:P:r(this,x)}return this},o.prototype.removeAllListeners=function(u){var f;return u?(f=t?t+u:u,this._events[f]&&r(this,f)):(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}(qr)),qr.exports}var vl=_l(),Qr=N(vl);const ir="1.6.11",$s={};function yl(){return typeof __HLS_WORKER_BUNDLE__=="function"}function El(){const a=$s[ir];if(a)return a.clientCount++,a;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e),n={worker:new self.Worker(t),objectURL:t,clientCount:1};return $s[ir]=n,n}function bl(a){const e=$s[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,n={worker:new self.Worker(t),scriptURL:t,clientCount:1};return $s[a]=n,n}function Sl(a){const e=$s[a||ir];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete $s[a||ir],n&&self.URL.revokeObjectURL(n),i.terminate()}}function Ka(a,e){return 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}function Jr(a,e){return 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}function Ar(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}function nr(a,e){const t=e;let i=0;for(;Jr(a,e);){i+=10;const n=Ar(a,e+6);i+=n,Ka(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function xl(a,e,t,i){const n=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],s=e[t+2],r=s>>2&15;if(r>12){const x=new Error(`invalid ADTS sampling index:${r}`);a.emit(p.ERROR,p.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!0,error:x,reason:x.message});return}const o=(s>>6&3)+1,c=e[t+3]>>6&3|(s&1)<<2,u="mp4a.40."+o,f=n[r];let d=r;(o===5||o===29)&&(d-=3);const _=[o<<3|(d&14)>>1,(d&1)<<7|c<<3];return ne.log(`manifest codec:${i}, parsed codec:${u}, channels:${c}, rate:${f} (ADTS object type:${o} sampling index:${r})`),{config:_,samplerate:f,channelCount:c,codec:u,parsedCodec:u,manifestCodec:i}}function $a(a,e){return a[e]===255&&(a[e+1]&246)===240}function Ga(a,e){return a[e+1]&1?7:9}function ea(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function Tl(a,e){return e+5<a.length}function wr(a,e){return e+1<a.length&&$a(a,e)}function Al(a,e){return Tl(a,e)&&$a(a,e)&&ea(a,e)<=a.length-e}function wl(a,e){if(wr(a,e)){const t=Ga(a,e);if(e+t>=a.length)return!1;const i=ea(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||wr(a,n)}return!1}function Va(a,e,t,i,n){if(!a.samplerate){const s=xl(e,t,i,n);if(!s)return;g(a,s)}}function ja(a){return 1024*9e4/a}function Rl(a,e){const t=Ga(a,e);if(e+t<=a.length){const i=ea(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ha(a,e,t,i,n){const s=ja(a.samplerate),r=i+n*s,o=Rl(e,t);let c;if(o){const{frameLength:d,headerLength:_}=o,x=_+d,T=Math.max(0,t+x-e.length);T?(c=new Uint8Array(x-_),c.set(e.subarray(t+_,e.length),0)):c=e.subarray(t+_,t+x);const B={unit:c,pts:r};return T||a.samples.push(B),{sample:B,length:x,missing:T}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:r},length:u,missing:-1}}function Ll(a,e){return Jr(a,e)&&Ar(a,e+6)+10<=a.length-e}function Il(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function ta(a,e=0,t=1/0){return Dl(a,e,t,Uint8Array)}function Dl(a,e,t,i){const n=Cl(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=kl(a)?a.byteOffset:0,o=(r+a.byteLength)/s,c=(r+e)/s,u=Math.floor(Math.max(0,Math.min(c,o))),f=Math.floor(Math.min(u+Math.max(t,0),o));return new i(n,u,f-u)}function Cl(a){return a instanceof ArrayBuffer?a:a.buffer}function kl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function Pl(a){const e={key:a.type,description:"",data:"",mimeType:null,pictureType:null},t=3;if(a.size<2)return;if(a.data[0]!==t){console.log("Ignore frame with unrecognized character encoding");return}const i=a.data.subarray(1).indexOf(0);if(i===-1)return;const n=$e(ta(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=$e(ta(a.data,3+i,r));let c;return n==="-->"?c=$e(ta(a.data,4+i+r)):c=Il(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function Ol(a){if(a.size<2)return;const e=$e(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function Ml(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const i=$e(a.data.subarray(t),!0);t+=i.length+1;const n=$e(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=$e(a.data.subarray(1));return{key:a.type,info:"",data:e}}function Nl(a){if(a.type==="WXXX"){if(a.size<2)return;let t=1;const i=$e(a.data.subarray(t),!0);t+=i.length+1;const n=$e(a.data.subarray(t));return{key:a.type,info:i,data:n}}const e=$e(a.data);return{key:a.type,info:"",data:e}}function Fl(a){return a.type==="PRIV"?Ol(a):a.type[0]==="W"?Nl(a):a.type==="APIC"?Pl(a):Ml(a)}function Bl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=Ar(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const Rr=10,Ul=10;function Wa(a){let e=0;const t=[];for(;Jr(a,e);){const i=Ar(a,e+6);a[e+5]>>6&1&&(e+=Rr),e+=Rr;const n=e+i;for(;e+Ul<n;){const s=Bl(a.subarray(e)),r=Fl(s);r&&t.push(r),e+=s.size+Rr}Ka(a,e)&&(e+=Rr)}return t}function Za(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function Kl(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)}}function ia(a){const e=Wa(a);for(let t=0;t<e.length;t++){const i=e[t];if(Za(i))return Kl(i)}}let Un=function(a){return a.audioId3="org.id3",a.dateRange="com.apple.quicktime.HLS",a.emsg="https://aomedia.org/emsg/ID3",a.misbklv="urn:misb:KLV:bin:1910.1",a}({});function ls(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class na{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=Ke(this.cachedData,e),this.cachedData=null);let i=nr(e,0),n=i?i.length:0,s;const r=this._audioTrack,o=this._id3Track,c=i?ia(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&F(c))&&(this.basePTS=$l(c,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:Un.audioId3,duration:Number.POSITIVE_INFINITY});n<u;){if(this.canParse(e,n)){const f=this.appendFrame(r,e,n);f?(this.frameIndex++,this.lastPTS=f.sample.pts,n+=f.length,s=n):n=u}else Ll(e,n)?(i=nr(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Un.audioId3,duration:Number.POSITIVE_INFINITY}),n+=i.length,s=n):n++;if(n===u&&s!==u){const f=e.slice(s);this.cachedData?this.cachedData=Ke(this.cachedData,f):this.cachedData=f}}return{audioTrack:r,videoTrack:ls(),id3Track:o,textTrack:ls()}}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:ls(),id3Track:this._id3Track,textTrack:ls()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const $l=(a,e,t)=>{if(F(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Lr=null;const Gl=[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],Vl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],jl=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Hl=[0,1,1,4];function za(a,e,t,i,n){if(t+24>e.length)return;const s=Ya(e,t);if(s&&t+s.frameLength<=e.length){const r=s.samplesPerFrame*9e4/s.sampleRate,o=i+n*r,c={unit:e.subarray(t,t+s.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=s.channelCount,a.samplerate=s.sampleRate,a.samples.push(c),{sample:c,length:s.frameLength,missing:0}}}function Ya(a,e){const t=a[e+1]>>3&3,i=a[e+1]>>1&3,n=a[e+2]>>4&15,s=a[e+2]>>2&3;if(t!==1&&n!==0&&n!==15&&s!==3){const r=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-i:i===3?3:4,u=Gl[c*14+n-1]*1e3,d=Vl[(t===3?0:t===2?1:2)*3+s],_=o===3?1:2,x=jl[t][i],T=Hl[i],B=x*8*T,P=Math.floor(x*u/d+r)*T;if(Lr===null){const de=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Lr=de?parseInt(de[1]):0}return!!Lr&&Lr<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:d,channelCount:_,frameLength:P,samplesPerFrame:B}}}function sa(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function Xa(a,e){return e+1<a.length&&sa(a,e)}function Wl(a,e){return sa(a,e)&&4<=a.length-e}function qa(a,e){if(e+1<a.length&&sa(a,e)){const i=Ya(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||Xa(a,s)}return!1}class Zl extends na{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,t){if(!e)return!1;const i=nr(e,0);let n=(i==null?void 0:i.length)||0;if(qa(e,n))return!1;for(let s=e.length;n<s;n++)if(wl(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Al(e,t)}appendFrame(e,t,i){Va(e,this.observer,t,i,e.manifestCodec);const n=Ha(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const Qa=(a,e)=>{let t=0,i=5;e+=i;const n=new Uint32Array(1),s=new Uint32Array(1),r=new Uint8Array(1);for(;i>0;){r[0]=a[e];const o=Math.min(i,8),c=8-o;s[0]=4278190080>>>24+c<<c,n[0]=(r[0]&s[0])>>c,t=t?t<<o|n[0]:n[0],e+=1,i-=o}return t};class zl extends na{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=Ja(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=nr(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&ia(t)!==void 0&&Qa(e,i)<16}}function Ja(a,e,t,i,n){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const s=e[t+4]>>6;if(s>=3)return-1;const o=[48e3,44100,32e3][s],c=e[t+4]&63,f=[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][c*3+s]*2;if(t+f>e.length)return-1;const d=e[t+6]>>5;let _=0;d===2?_+=2:(d&1&&d!==1&&(_+=2),d&4&&(_+=2));const x=(e[t+6]<<8|e[t+7])>>12-_&1,B=[2,1,2,3,3,4,4,5][d]+x,P=e[t+5]>>3,ie=e[t+5]&7,_e=new Uint8Array([s<<6|P<<1|ie>>2,(ie&3)<<6|d<<3|x<<2|c>>4,c<<4&224]),de=1536/o*9e4,Le=i+n*de,Me=e.subarray(t,t+f);return a.config=_e,a.channelCount=B,a.samplerate=o,a.samples.push({unit:Me,pts:Le}),f}class Yl extends na{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=nr(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&ia(t)!==void 0&&Qa(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(qa(e,i))return ne.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return Wl(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return za(e,t,i,this.basePTS,this.frameIndex)}}const Xl=/\/emsg[-/]ID3/i;class ql{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 s=this.videoTrack=ls("video",1),r=this.audioTrack=ls("audio",1),o=this.txtTrack=ls("text",1);if(this.id3Track=ls("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=Te(e);if(c.video){const{id:u,timescale:f,codec:d,supplemental:_}=c.video;s.id=u,s.timescale=o.timescale=f,s.codec=d,s.supplemental=_}if(c.audio){const{id:u,timescale:f,codec:d}=c.audio;r.id=u,r.timescale=f,r.codec=d}o.id=Ct.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return Ae(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Ke(this.remainderData,e));const o=we(i);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=i;const r=this.extractID3Track(n,t);return s.samples=Ve(t,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:r,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=Ve(e,t),{videoTrack:t,audioTrack:ls(),id3Track:n,textTrack:ls()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=ee(e.samples,["emsg"]);n&&n.forEach(s=>{const r=De(s);if(Xl.test(r.schemeIdUri)){const o=eo(r,t);let c=r.eventDuration===4294967295?Number.POSITIVE_INFINITY:r.eventDuration/r.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=r.payload;i.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:Un.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=eo(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Un.misbklv,duration:Number.POSITIVE_INFINITY})}})}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}}function eo(a,e){return F(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class Ql{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new ln(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Dt.cbc)}decryptAacSample(e,t,i){const n=e[t].unit;if(n.length<=16)return;const s=n.subarray(16,n.length-n.length%16),r=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(r).then(o=>{const c=new Uint8Array(o);n.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(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 s=32;s<e.length-16;s+=160,n+=16)i.set(e.subarray(s,s+16),n);return i}getAvcDecryptedUnit(e,t){const i=new Uint8Array(t);let n=0;for(let s=32;s<e.length-16;s+=160,n+=16)e.set(i.subarray(n,n+16),s);return e}decryptAvcSample(e,t,i,n,s){const r=pt(s.data),o=this.getAvcEncryptedData(r);this.decryptBuffer(o.buffer).then(c=>{s.data=this.getAvcDecryptedUnit(r,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,n)}).catch(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 s=e[t].units;for(;!(i>=s.length);i++){const r=s[i];if(!(r.data.length<=48||r.type!==1&&r.type!==5)&&(this.decryptAvcSample(e,t,i,n,r),!this.decrypter.isSync()))return}}}}class to{constructor(){this.VideoSample=null}createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],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 s=i.units;n=s[s.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 s=i[n-1];e.pts=s.pts,e.dts=s.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,i){const n=t.byteLength;let s=e.naluState||0;const r=s,o=[];let c=0,u,f,d,_=-1,x=0;for(s===-1&&(_=0,x=this.getNALuType(t,0),s=0,c=1);c<n;){if(u=t[c++],!s){s=u?0:1;continue}if(s===1){s=u?0:2;continue}if(!u)s=3;else if(u===1){if(f=c-s-1,_>=0){const T={data:t.subarray(_,f),type:x};o.push(T)}else{const T=this.getLastNalUnit(e.samples);T&&(r&&c<=4-r&&T.state&&(T.data=T.data.subarray(0,T.data.byteLength-r)),f>0&&(T.data=Ke(T.data,t.subarray(0,f)),T.state=0))}c<n?(d=this.getNALuType(t,c),_=c,x=d,s=0):s=-1}else s=0}if(_>=0&&s>=0){const T={data:t.subarray(_,n),type:x,state:s};o.push(T)}if(o.length===0){const T=this.getLastNalUnit(e.samples);T&&(T.data=Ke(T.data,t))}return e.naluState=s,o}}class sr{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),s=Math.min(4,t);if(s===0)throw new Error("no bytes available");n.set(e.subarray(i,i+s)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=s*8,this.bytesAvailable-=s}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&&ne.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)}}class Jl extends to{parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var f,d;switch(u.type){case 1:{let B=!1;o=!0;const P=u.data;if(c&&P.length>4){const ie=this.readSliceType(P);(ie===2||ie===4||ie===7||ie===9)&&(B=!0)}if(B){var _;(_=r)!=null&&_.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.frame=!0,r.key=B;break}case 5:o=!0,(f=r)!=null&&f.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 6:{o=!0,Fe(u.data,1,i.pts,t.samples);break}case 7:{var x,T;o=!0,c=!0;const B=u.data,P=this.readSPS(B);if(!e.sps||e.width!==P.width||e.height!==P.height||((x=e.pixelRatio)==null?void 0:x[0])!==P.pixelRatio[0]||((T=e.pixelRatio)==null?void 0:T[1])!==P.pixelRatio[1]){e.width=P.width,e.height=P.height,e.pixelRatio=P.pixelRatio,e.sps=[B];const ie=B.subarray(1,4);let _e="avc1.";for(let de=0;de<3;de++){let Le=ie[de].toString(16);Le.length<2&&(Le="0"+Le),_e+=Le}e.codec=_e}break}case 8:o=!0,e.pps=[u.data];break;case 9:o=!0,e.audFound=!0,(d=r)!=null&&d.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:o=!0;break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new sr(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,n=8,s;for(let r=0;r<e;r++)n!==0&&(s=t.readEG(),n=(i+s+256)%256),i=n===0?i:n}readSPS(e){const t=new sr(e);let i=0,n=0,s=0,r=0,o,c,u;const f=t.readUByte.bind(t),d=t.readBits.bind(t),_=t.readUEG.bind(t),x=t.readBoolean.bind(t),T=t.skipBits.bind(t),B=t.skipEG.bind(t),P=t.skipUEG.bind(t),ie=this.skipScalingList.bind(this);f();const _e=f();if(d(5),T(3),f(),P(),_e===100||_e===110||_e===122||_e===244||_e===44||_e===83||_e===86||_e===118||_e===128){const He=_();if(He===3&&T(1),P(),P(),T(1),x())for(c=He!==3?8:12,u=0;u<c;u++)x()&&(u<6?ie(16,t):ie(64,t))}P();const de=_();if(de===0)_();else if(de===1)for(T(1),B(),B(),o=_(),u=0;u<o;u++)B();P(),T(1);const Le=_(),Me=_(),tt=d(1);tt===0&&T(1),T(1),x()&&(i=_(),n=_(),s=_(),r=_());let Pe=[1,1];if(x()&&x())switch(f()){case 1:Pe=[1,1];break;case 2:Pe=[12,11];break;case 3:Pe=[10,11];break;case 4:Pe=[16,11];break;case 5:Pe=[40,33];break;case 6:Pe=[24,11];break;case 7:Pe=[20,11];break;case 8:Pe=[32,11];break;case 9:Pe=[80,33];break;case 10:Pe=[18,11];break;case 11:Pe=[15,11];break;case 12:Pe=[64,33];break;case 13:Pe=[160,99];break;case 14:Pe=[4,3];break;case 15:Pe=[3,2];break;case 16:Pe=[2,1];break;case 255:{Pe=[f()<<8|f(),f()<<8|f()];break}}return{width:Math.ceil((Le+1)*16-i*2-n*2),height:(2-tt)*(Me+1)*16-(tt?2:4)*(s+r),pixelRatio:Pe}}}class eu extends to{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,i,n){const s=this.parseNALu(e,i.data,n);let r=this.VideoSample,o,c=!1;i.data=null,r&&s.length&&!e.audFound&&(this.pushAccessUnit(r,e),r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),s.forEach(u=>{var f,d;switch(u.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),r.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var _;(_=r)!=null&&_.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null)}r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 19:case 20:o=!0,(f=r)!=null&&f.frame&&!r.key&&(this.pushAccessUnit(r,e),r=this.VideoSample=null),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0,r.frame=!0;break;case 39:o=!0,Fe(u.data,2,i.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=g(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(o=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],u.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const x=this.readSPS(u.data);e.width=x.width,e.height=x.height,e.pixelRatio=x.pixelRatio,e.codec=x.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const T in x.params)e.params[T]=x.params[T]}this.pushParameterSet(e.sps,u.data,e.vps),r||(r=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),r.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const x=this.readPPS(u.data);for(const T in x)e.params[T]=x[T]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(d=r)!=null&&d.frame&&(this.pushAccessUnit(r,e),r=null),r||(r=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;default:o=!1;break}r&&o&&r.units.push(u)}),n&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)}pushParameterSet(e,t,i){(i&&i[0]===this.initVPS||!i&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let i=0;for(let n=0;n<e.byteLength;n++)n>=2&&e[n]===3&&e[n-1]===0&&e[n-2]===0||(t[i]=e[n],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new sr(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const i=t.readBits(3),n=t.readBoolean();return{numTemporalLayers:i+1,temporalIdNested:n}}readSPS(e){const t=new sr(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const i=t.readBits(3);t.readBoolean();const n=t.readBits(2),s=t.readBoolean(),r=t.readBits(5),o=t.readUByte(),c=t.readUByte(),u=t.readUByte(),f=t.readUByte(),d=t.readUByte(),_=t.readUByte(),x=t.readUByte(),T=t.readUByte(),B=t.readUByte(),P=t.readUByte(),ie=t.readUByte(),_e=[],de=[];for(let Vi=0;Vi<i;Vi++)_e.push(t.readBoolean()),de.push(t.readBoolean());if(i>0)for(let Vi=i;Vi<8;Vi++)t.readBits(2);for(let Vi=0;Vi<i;Vi++)_e[Vi]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),de[Vi]&&t.readUByte();t.readUEG();const Le=t.readUEG();Le==3&&t.skipBits(1);const Me=t.readUEG(),tt=t.readUEG(),Pe=t.readBoolean();let He=0,Xe=0,Oe=0,ft=0;Pe&&(He+=t.readUEG(),Xe+=t.readUEG(),Oe+=t.readUEG(),ft+=t.readUEG());const jt=t.readUEG(),ai=t.readUEG(),fi=t.readUEG(),oi=t.readBoolean();for(let Vi=oi?0:i;Vi<=i;Vi++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let Dn=0;Dn<4;Dn++)for(let zn=0;zn<(Dn===3?2:6);zn++)if(!t.readBoolean())t.readUEG();else{const ss=Math.min(64,1<<4+(Dn<<1));Dn>1&&t.readEG();for(let zs=0;zs<ss;zs++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const Jt=t.readUEG();let ui=0;for(let Vi=0;Vi<Jt;Vi++){let Dn=!1;if(Vi!==0&&(Dn=t.readBoolean()),Dn){Vi===Jt&&t.readUEG(),t.readBoolean(),t.readUEG();let zn=0;for(let Ps=0;Ps<=ui;Ps++){const ss=t.readBoolean();let zs=!1;ss||(zs=t.readBoolean()),(ss||zs)&&zn++}ui=zn}else{const zn=t.readUEG(),Ps=t.readUEG();ui=zn+Ps;for(let ss=0;ss<zn;ss++)t.readUEG(),t.readBoolean();for(let ss=0;ss<Ps;ss++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Vi=t.readUEG();for(let Dn=0;Dn<Vi;Dn++){for(let zn=0;zn<fi+4;zn++)t.readBits(1);t.readBits(1)}}let $t=0,Gt=1,Pi=1,Wi=!0,Ni=1,Ki=0;t.readBoolean(),t.readBoolean();let In=!1;if(t.readBoolean()){if(t.readBoolean()){const Os=t.readUByte(),ll=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],jr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Os>0&&Os<16?(Gt=ll[Os-1],Pi=jr[Os-1]):Os===255&&(Gt=t.readBits(16),Pi=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),In=t.readBoolean(),In&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Ni=t.readBits(32),Ki=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const jr=t.readBoolean(),ul=t.readBoolean();let ur=!1;(jr||ul)&&(ur=t.readBoolean(),ur&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),ur&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let cl=0;cl<=i;cl++){Wi=t.readBoolean();const Ph=Wi||t.readBoolean();let hl=!1;Ph?t.readEG():hl=t.readBoolean();const fl=hl?1:t.readUEG()+1;if(jr)for(let cr=0;cr<fl;cr++)t.readUEG(),t.readUEG(),ur&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(ul)for(let cr=0;cr<fl;cr++)t.readUEG(),t.readUEG(),ur&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),$t=t.readUEG())}let Zn=Me,fs=tt;if(Pe){let Vi=1,Dn=1;Le===1?Vi=Dn=2:Le==2&&(Vi=2),Zn=Me-Vi*Xe-Vi*He,fs=tt-Dn*ft-Dn*Oe}const ks=n?["A","B","C"][n]:"",kh=o<<24|c<<16|u<<8|f;let Fa=0;for(let Vi=0;Vi<32;Vi++)Fa=(Fa|(kh>>Vi&1)<<31-Vi)>>>0;let Ba=Fa.toString(16);return r===1&&Ba==="2"&&(Ba="6"),{codecString:`hvc1.${ks}${r}.${Ba}.${s?"H":"L"}${ie}.B0`,params:{general_tier_flag:s,general_profile_idc:r,general_profile_space:n,general_profile_compatibility_flags:[o,c,u,f],general_constraint_indicator_flags:[d,_,x,T,B,P],general_level_idc:ie,bit_depth:jt+8,bit_depth_luma_minus8:jt,bit_depth_chroma_minus8:ai,min_spatial_segmentation_idc:$t,chroma_format_idc:Le,frame_rate:{fixed:Wi,fps:Ki/Ni}},width:Zn,height:fs,pixelRatio:[Gt,Pi]}}readPPS(e){const t=new sr(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);const n=t.readBoolean(),s=t.readBoolean();let r=1;return s&&n?r=0:s?r=3:n&&(r=2),{parallelismType:r}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Sn=188;class Ts{constructor(e,t,i,n){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.logger=n,this.videoParser=null}static probe(e,t){const i=Ts.syncOffset(e);return i>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${i}`),i!==-1}static syncOffset(e){const t=e.length;let i=Math.min(Sn*5,t-Sn)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=Sn)if(e[c]===71&&(t-c===Sn||e[c+Sn]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+Sn*99,e.length-Sn)+1)),s||(s=ra(e,c)===0),s&&o>1&&(r===0&&o>2||c+Sn>i))return r}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:Ct[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=Ts.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=Ts.createTrack("audio",n),this._id3Track=Ts.createTrack("id3"),this._txtTrack=Ts.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i}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 s;const r=this._videoTrack,o=this._audioTrack,c=this._id3Track,u=this._txtTrack;let f=r.pid,d=r.pesData,_=o.pid,x=c.pid,T=o.pesData,B=c.pesData,P=null,ie=this.pmtParsed,_e=this._pmtId,de=e.length;if(this.remainderData&&(e=Ke(this.remainderData,e),de=e.length,this.remainderData=null),de<Sn&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const Le=Math.max(0,Ts.syncOffset(e));de-=(de-Le)%Sn,de<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,de,e.buffer.byteLength-de));let Me=0;for(let Pe=Le;Pe<de;Pe+=Sn)if(e[Pe]===71){const He=!!(e[Pe+1]&64),Xe=ra(e,Pe),Oe=(e[Pe+3]&48)>>4;let ft;if(Oe>1){if(ft=Pe+5+e[Pe+4],ft===Pe+Sn)continue}else ft=Pe+4;switch(Xe){case f:He&&(d&&(s=Gs(d,this.logger))&&(this.readyVideoParser(r.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(r,u,s,!1)),d={data:[],size:0}),d&&(d.data.push(e.subarray(ft,Pe+Sn)),d.size+=Pe+Sn-ft);break;case _:if(He){if(T&&(s=Gs(T,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s);break}T={data:[],size:0}}T&&(T.data.push(e.subarray(ft,Pe+Sn)),T.size+=Pe+Sn-ft);break;case x:He&&(B&&(s=Gs(B,this.logger))&&this.parseID3PES(c,s),B={data:[],size:0}),B&&(B.data.push(e.subarray(ft,Pe+Sn)),B.size+=Pe+Sn-ft);break;case 0:He&&(ft+=e[ft]+1),_e=this._pmtId=tu(e,ft);break;case _e:{He&&(ft+=e[ft]+1);const jt=iu(e,ft,this.typeSupported,i,this.observer,this.logger);f=jt.videoPid,f>0&&(r.pid=f,r.segmentCodec=jt.segmentVideoCodec),_=jt.audioPid,_>0&&(o.pid=_,o.segmentCodec=jt.segmentAudioCodec),x=jt.id3Pid,x>0&&(c.pid=x),P!==null&&!ie&&(this.logger.warn(`MPEG-TS PMT found at ${Pe} after unknown PID '${P}'. Backtracking to sync byte @${Le} to parse all TS packets.`),P=null,Pe=Le-188),ie=this.pmtParsed=!0;break}case 17:case 8191:break;default:P=Xe;break}}else Me++;Me>0&&aa(this.observer,new Error(`Found ${Me} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=d,o.pesData=T,c.pesData=B;const tt={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return n&&this.extractRemainingSamples(tt),tt}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:s}=e,r=i.pesData,o=t.pesData,c=n.pesData;let u;if(r&&(u=Gs(r,this.logger))?(this.readyVideoParser(i.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(i,s,u,!0),i.pesData=null)):i.pesData=r,o&&(u=Gs(o,this.logger))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,u);break;case"mp3":this.parseMPEGPES(t,u);break;case"ac3":this.parseAC3PES(t,u);break}t.pesData=null}else o!=null&&o.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;c&&(u=Gs(c,this.logger))?(this.parseID3PES(n,u),n.pesData=null):n.pesData=c}demuxSampleAes(e,t,i){const n=this.demux(e,i,!0,!this.config.progressive),s=this.sampleAes=new Ql(this.observer,this.config,t);return this.decrypt(n,s)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Jl:e==="hevc"&&(this.videoParser=new eu))}decrypt(e,t){return new Promise(i=>{const{audioTrack:n,videoTrack:s}=e;n.samples&&n.segmentCodec==="aac"?t.decryptAacSamples(n.samples,0,()=>{s.samples?t.decryptAvcSamples(s.samples,0,0,()=>{i(e)}):i(e)}):s.samples&&t.decryptAvcSamples(s.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,t){let i=0;const n=this.aacOverFlow;let s=t.data;if(n){this.aacOverFlow=null;const d=n.missing,_=n.sample.unit.byteLength;if(d===-1)s=Ke(n.sample.unit,s);else{const x=_-d;n.sample.unit.set(s.subarray(0,d),x),e.samples.push(n.sample),i=n.missing}}let r,o;for(r=i,o=s.length;r<o-1&&!wr(s,r);r++);if(r!==i){let d;const _=r<o-1;if(_?d=`AAC PES did not start with ADTS header,offset:${r}`:d="No ADTS header found in AAC PES",aa(this.observer,new Error(d),_,this.logger),!_)return}Va(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(n){const d=ja(e.samplerate);c=n.sample.pts+d}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,f;for(;r<o;)if(f=Ha(e,s,r,c,u),r+=f.length,f.missing){this.aacOverFlow=f;break}else for(u++;r<o-1&&!wr(s,r);r++);}parseMPEGPES(e,t){const i=t.data,n=i.length;let s=0,r=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;r<n;)if(Xa(i,r)){const c=za(e,i,r,o,s);if(c)r+=c.length,s++;else break}else r++}parseAC3PES(e,t){{const i=t.data,n=t.pts;if(n===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const s=i.length;let r=0,o=0,c;for(;o<s&&(c=Ja(e,i,o,n,r++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const i=g({},t,{type:this._videoTrack?Un.emsg:Un.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ra(a,e){return((a[e+1]&31)<<8)+a[e+2]}function tu(a,e){return(a[e+10]&31)<<8|a[e+11]}function iu(a,e,t,i,n,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=(a[e+1]&15)<<8|a[e+2],c=e+3+o-4,u=(a[e+10]&15)<<8|a[e+11];for(e+=12+u;e<c;){const f=ra(a,e),d=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){oa("ADTS AAC",s);break}case 15:r.audioPid===-1&&(r.audioPid=f);break;case 21:r.id3Pid===-1&&(r.id3Pid=f);break;case 219:if(!i){oa("H.264",s);break}case 27:r.videoPid===-1&&(r.videoPid=f);break;case 3:case 4:!t.mpeg&&!t.mp3?s.log("MPEG audio found, not supported in this browser"):r.audioPid===-1&&(r.audioPid=f,r.segmentAudioCodec="mp3");break;case 193:if(!i){oa("AC-3",s);break}case 129:t.ac3?r.audioPid===-1&&(r.audioPid=f,r.segmentAudioCodec="ac3"):s.log("AC-3 audio found, not supported in this browser");break;case 6:if(r.audioPid===-1&&d>0){let _=e+5,x=d;for(;x>2;){switch(a[_]){case 106:t.ac3!==!0?s.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=f,r.segmentAudioCodec="ac3");break}const B=a[_+1]+2;_+=B,x-=B}}break;case 194:case 135:return aa(n,new Error("Unsupported EC-3 in M2TS found"),void 0,s),r;case 36:r.videoPid===-1&&(r.videoPid=f,r.segmentVideoCodec="hevc",s.log("HEVC in M2TS found"));break}e+=d+5}return r}function aa(a,e,t,i){i.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function oa(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Gs(a,e){let t=0,i,n,s,r,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Ke(c[0],c[1]),c.splice(1,1);if(i=c[0],(i[0]<<16)+(i[1]<<8)+i[2]===1){if(n=(i[4]<<8)+i[5],n&&n>a.size-6)return null;const f=i[7];f&192&&(r=(i[9]&14)*536870912+(i[10]&255)*4194304+(i[11]&254)*16384+(i[12]&255)*128+(i[13]&254)/2,f&64?(o=(i[14]&14)*536870912+(i[15]&255)*4194304+(i[16]&254)*16384+(i[17]&255)*128+(i[18]&254)/2,r-o>60*9e4&&(e.warn(`${Math.round((r-o)/9e4)}s delta between PTS and DTS, align them`),r=o)):o=r),s=i[8];let d=s+9;if(a.size<=d)return null;a.size-=d;const _=new Uint8Array(a.size);for(let x=0,T=c.length;x<T;x++){i=c[x];let B=i.byteLength;if(d)if(d>B){d-=B;continue}else i=i.subarray(d),B-=d,d=0;_.set(i,t),t+=B}return n&&(n-=s+3),{data:_,pts:r,dts:o,len:n}}return null}class nu{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 As=Math.pow(2,32)-1;class Ue{static init(){Ue.types={avc1:[],avcC:[],hvc1:[],hvcC:[],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]),s=new Uint8Array([0,0,0,0,0,0,0,0]);Ue.STTS=Ue.STSC=Ue.STCO=s,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 r=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);Ue.FTYP=Ue.box(Ue.types.ftyp,r,c,r,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 s=n;for(;n--;)i+=t[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(e,4),n=0,i=8;n<s;n++)r.set(t[n],i),i+=t[n].byteLength;return r}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/(As+1)),n=Math.floor(t%(As+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||0,e.duration||0),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||0,e[0].duration||0)].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/(As+1)),n=Math.floor(t%(As+1)),s=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,s)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let n,s;for(n=0;n<t.length;n++)s=t[n].flags,i[n+4]=s.dependsOn<<4|s.isDependedOn<<2|s.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,s,r;for(n=0;n<e.sps.length;n++)s=e.sps[n],r=s.byteLength,t.push(r>>>8&255),t.push(r&255),t=t.concat(Array.prototype.slice.call(s));for(n=0;n<e.pps.length;n++)s=e.pps[n],r=s.byteLength,i.push(r>>>8&255),i.push(r&255),i=i.concat(Array.prototype.slice.call(s));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))),c=e.width,u=e.height,f=e.pixelRatio[0],d=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,c>>8&255,c&255,u>>8&255,u&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([f>>24,f>>16&255,f>>8&255,f&255,d>>24,d>>16&255,d>>8&255,d&255])))}static esds(e){const t=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...t,6,1,2])}static audioStsd(e){const t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,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){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return Ue.box(Ue.types.stsd,Ue.STSD,Ue.mp4a(e));if(t==="ac3"&&e.config)return Ue.box(Ue.types.stsd,Ue.STSD,Ue.ac3(e));if(t==="mp3"&&e.codec==="mp3")return Ue.box(Ue.types.stsd,Ue.STSD,Ue.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return Ue.box(Ue.types.stsd,Ue.STSD,Ue.avc1(e));if(t==="hevc"&&e.vps)return Ue.box(Ue.types.stsd,Ue.STSD,Ue.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${t}/${e.codec})`)}static tkhd(e){const t=e.id,i=(e.duration||0)*(e.timescale||0),n=e.width||0,s=e.height||0,r=Math.floor(i/(As+1)),o=Math.floor(i%(As+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,r>>24,r>>16&255,r>>8&255,r&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,s>>8&255,s&255,0,0]))}static traf(e,t){const i=Ue.sdtp(e),n=e.id,s=Math.floor(t/(As+1)),r=Math.floor(t%(As+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,s>>24,s>>16&255,s>>8&255,s&255,r>>24,r>>16&255,r>>8&255,r&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,s=12+16*n,r=new Uint8Array(s);let o,c,u,f,d,_;for(t+=8+s,r.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++)c=i[o],u=c.duration,f=c.size,d=c.flags,_=c.cts,r.set([u>>>24&255,u>>>16&255,u>>>8&255,u&255,f>>>24&255,f>>>16&255,f>>>8&255,f&255,d.isLeading<<2|d.dependsOn,d.isDependedOn<<6|d.hasRedundancy<<4|d.paddingValue<<1|d.isNonSync,d.degradPrio&61440,d.degradPrio&15,_>>>24&255,_>>>16&255,_>>>8&255,_&255],12+16*o);return Ue.box(Ue.types.trun,r)}static initSegment(e){Ue.types||Ue.init();const t=Ue.moov(e);return Ke(Ue.FTYP,t)}static hvc1(e){const t=e.params,i=[e.vps,e.sps,e.pps],n=4,s=new Uint8Array([1,t.general_profile_space<<6|(t.general_tier_flag?32:0)|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),n-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),i.length]);let r=s.length;for(let T=0;T<i.length;T+=1){r+=3;for(let B=0;B<i[T].length;B+=1)r+=2+i[T][B].length}const o=new Uint8Array(r);o.set(s,0),r=s.length;const c=i.length-1;for(let T=0;T<i.length;T+=1){o.set(new Uint8Array([32+T|(T===c?128:0),0,i[T].length]),r),r+=3;for(let B=0;B<i[T].length;B+=1)o.set(new Uint8Array([i[T][B].length>>8,i[T][B].length&255]),r),r+=2,o.set(i[T][B],r),r+=i[T][B].length}const u=Ue.box(Ue.types.hvcC,o),f=e.width,d=e.height,_=e.pixelRatio[0],x=e.pixelRatio[1];return Ue.box(Ue.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,f>>8&255,f&255,d>>8&255,d&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]),u,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([_>>24,_>>16&255,_>>8&255,_&255,x>>24,x>>16&255,x>>8&255,x&255])))}}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 io=9e4;function la(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function su(a,e,t=1,i=!1){return la(a,e,1/t,i)}function rr(a,e=!1){return la(a,1e3,1/io,e)}function ru(a,e=1){return la(a,io,1/e)}const au=10*1e3,ou=1024,lu=1152,uu=1536;let Vs=null,ua=null;function no(a,e,t,i){return{duration:e,size:t,cts:i,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class Ir extends j{constructor(e,t,i,n){if(super("mp4-remuxer",n),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=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,Vs===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Vs=r?parseInt(r[1]):0}if(ua===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);ua=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e[0].pts,n=e.reduce((s,r)=>{let o=r.pts,c=o-s;return c<-4294967296&&(t=!0,o=Wn(o,i),c=o-s),c>0?s:o},i);return t&&this.debug("PTS rollover detected"),n}remux(e,t,i,n,s,r,o,c){let u,f,d,_,x,T,B=s,P=s;const ie=e.pid>-1,_e=t.pid>-1,de=t.samples.length,Le=e.samples.length>0,Me=o&&de>0||de>1;if((!ie||Le)&&(!_e||Me)||this.ISGenerated||o){if(this.ISGenerated){var Pe,He,Xe,Oe;const fi=this.videoTrackConfig;(fi&&(t.width!==fi.width||t.height!==fi.height||((Pe=t.pixelRatio)==null?void 0:Pe[0])!==((He=fi.pixelRatio)==null?void 0:He[0])||((Xe=t.pixelRatio)==null?void 0:Xe[1])!==((Oe=fi.pixelRatio)==null?void 0:Oe[1]))||!fi&&Me||this.nextAudioTs===null&&Le)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,s,r));const ft=this.isVideoContiguous;let jt=-1,ai;if(Me&&(jt=cu(t.samples),!ft&&this.config.forceKeyFrameOnDiscontinuity))if(T=!0,jt>0){this.warn(`Dropped ${jt} out of ${de} video samples due to a missing keyframe`);const fi=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(jt),t.dropped+=jt,P+=(t.samples[0].pts-fi)/t.inputTimeScale,ai=P}else jt===-1&&(this.warn(`No keyframe found out of ${de} video samples`),T=!1);if(this.ISGenerated){if(Le&&Me){const fi=this.getVideoStartPts(t.samples),Ft=(Wn(e.samples[0].pts,fi)-fi)/t.inputTimeScale;B+=Math.max(0,Ft),P+=Math.max(0,-Ft)}if(Le){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),d=this.generateIS(e,t,s,r)),f=this.remuxAudio(e,B,this.isAudioContiguous,r,_e||Me||c===oe.AUDIO?P:void 0),Me){const fi=f?f.endPTS-f.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),d=this.generateIS(e,t,s,r)),u=this.remuxVideo(t,P,ft,fi)}}else Me&&(u=this.remuxVideo(t,P,ft,0));u&&(u.firstKeyFrame=jt,u.independent=jt!==-1,u.firstKeyFramePTS=ai)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(x=so(i,s,this._initPTS,this._initDTS)),n.samples.length&&(_=ro(n,s,this._initPTS))),{audio:f,video:u,initSegment:d,independent:T,text:_,id3:x}}generateIS(e,t,i,n){const s=e.samples,r=t.samples,o=this.typeSupported,c={},u=this._initPTS;let f=!u||n,d="audio/mp4",_,x,T,B=-1;if(f&&(_=x=1/0),e.config&&s.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(d="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:d,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):Ue.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(B=e.id,T=e.inputTimeScale,!u||T!==u.timescale?_=x=s[0].pts-Math.round(T*i):f=!1)}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Ue.initSegment([t]),metadata:{width:t.width,height:t.height}},f)if(B=t.id,T=t.inputTimeScale,!u||T!==u.timescale){const P=this.getVideoStartPts(r),ie=Math.round(T*i);x=Math.min(x,Wn(r[0].dts,P)-ie),_=Math.min(_,P-ie)}else f=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,f?(u&&this.warn(`Timestamps at playlist time: ${n?"":"~"}${i} ${_/T} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${_/T} (${_}/${T}) trackId: ${B}`),this._initPTS={baseTime:_,timescale:T,trackId:B},this._initDTS={baseTime:x,timescale:T,trackId:B}):_=T=void 0,{tracks:c,initPTS:_,timescale:T,trackId:B}}remuxVideo(e,t,i,n){const s=e.inputTimeScale,r=e.samples,o=[],c=r.length,u=this._initPTS,f=u.baseTime*s/u.timescale;let d=this.nextVideoTs,_=8,x=this.videoSampleDuration,T,B,P=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY,_e=!1;if(!i||d===null){const $t=f+t*s,Gt=r[0].pts-Wn(r[0].dts,r[0].pts);Vs&&d!==null&&Math.abs($t-Gt-(d+f))<15e3?i=!0:d=$t-Gt-f}const de=d+f;for(let $t=0;$t<c;$t++){const Gt=r[$t];Gt.pts=Wn(Gt.pts,de),Gt.dts=Wn(Gt.dts,de),Gt.dts<r[$t>0?$t-1:$t].dts&&(_e=!0)}_e&&r.sort(function($t,Gt){const Pi=$t.dts-Gt.dts,Wi=$t.pts-Gt.pts;return Pi||Wi}),T=r[0].dts,B=r[r.length-1].dts;const Le=B-T,Me=Le?Math.round(Le/(c-1)):x||e.inputTimeScale/30;if(i){const $t=T-de,Gt=$t>Me,Pi=$t<-1;if((Gt||Pi)&&(Gt?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${rr($t,!0)} ms (${$t}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${rr(-$t,!0)} ms (${$t}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Pi||de>=r[0].pts||Vs)){T=de;const Wi=r[0].pts-$t;if(Gt)r[0].dts=T,r[0].pts=Wi;else{let Ni=!0;for(let Ki=0;Ki<r.length&&!(r[Ki].dts>Wi&&Ni);Ki++){const In=r[Ki].pts;if(r[Ki].dts-=$t,r[Ki].pts-=$t,Ki<r.length-1){const Tn=r[Ki+1].pts,Zn=r[Ki].pts,fs=Tn<=Zn,ks=Tn<=In;Ni=fs==ks}}}this.log(`Video: Initial PTS/DTS adjusted: ${rr(Wi,!0)}/${rr(T,!0)}, delta: ${rr($t,!0)} ms`)}}T=Math.max(0,T);let tt=0,Pe=0,He=T;for(let $t=0;$t<c;$t++){const Gt=r[$t],Pi=Gt.units,Wi=Pi.length;let Ni=0;for(let Ki=0;Ki<Wi;Ki++)Ni+=Pi[Ki].data.length;Pe+=Ni,tt+=Wi,Gt.length=Ni,Gt.dts<He?(Gt.dts=He,He+=Me/4|0||1):He=Gt.dts,P=Math.min(Gt.pts,P),ie=Math.max(Gt.pts,ie)}B=r[c-1].dts;const Xe=Pe+4*tt+8;let Oe;try{Oe=new Uint8Array(Xe)}catch($t){this.observer.emit(p.ERROR,p.ERROR,{type:ue.MUX_ERROR,details:G.REMUX_ALLOC_ERROR,fatal:!1,error:$t,bytes:Xe,reason:`fail allocating video mdat ${Xe}`});return}const ft=new DataView(Oe.buffer);ft.setUint32(0,Xe),Oe.set(Ue.types.mdat,4);let jt=!1,ai=Number.POSITIVE_INFINITY,fi=Number.POSITIVE_INFINITY,oi=Number.NEGATIVE_INFINITY,Ft=Number.NEGATIVE_INFINITY;for(let $t=0;$t<c;$t++){const Gt=r[$t],Pi=Gt.units;let Wi=0;for(let In=0,Tn=Pi.length;In<Tn;In++){const Zn=Pi[In],fs=Zn.data,ks=Zn.data.byteLength;ft.setUint32(_,ks),_+=4,Oe.set(fs,_),_+=ks,Wi+=4+ks}let Ni;if($t<c-1)x=r[$t+1].dts-Gt.dts,Ni=r[$t+1].pts-Gt.pts;else{const In=this.config,Tn=$t>0?Gt.dts-r[$t-1].dts:Me;if(Ni=$t>0?Gt.pts-r[$t-1].pts:Me,In.stretchShortVideoTrack&&this.nextAudioTs!==null){const Zn=Math.floor(In.maxBufferHole*s),fs=(n?P+n*s:this.nextAudioTs+f)-Gt.pts;fs>Zn?(x=fs-Tn,x<0?x=Tn:jt=!0,this.log(`It is approximately ${fs/90} ms to the next segment; using duration ${x/90} ms for the last video frame.`)):x=Tn}else x=Tn}const Ki=Math.round(Gt.pts-Gt.dts);ai=Math.min(ai,x),oi=Math.max(oi,x),fi=Math.min(fi,Ni),Ft=Math.max(Ft,Ni),o.push(no(Gt.key,x,Wi,Ki))}if(o.length){if(Vs){if(Vs<70){const $t=o[0].flags;$t.dependsOn=2,$t.isNonSync=0}}else if(ua&&Ft-fi<oi-ai&&Me/oi<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let $t=T;for(let Gt=0,Pi=o.length;Gt<Pi;Gt++){const Wi=$t+o[Gt].duration,Ni=$t+o[Gt].cts;if(Gt<Pi-1){const Ki=Wi+o[Gt+1].cts;o[Gt].duration=Ki-Ni}else o[Gt].duration=Gt?o[Gt-1].duration:Me;o[Gt].cts=0,$t=Wi}}}x=jt||!x?Me:x;const li=B+x;this.nextVideoTs=d=li-f,this.videoSampleDuration=x,this.isVideoContiguous=!0;const xi={data1:Ue.moof(e.sequenceNumber++,T,g(e,{samples:o})),data2:Oe,startPTS:(P-f)/s,endPTS:(ie+x-f)/s,startDTS:(T-f)/s,endDTS:d/s,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,xi}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return lu;case"ac3":return uu;default:return ou}}remuxAudio(e,t,i,n,s){const r=e.inputTimeScale,o=e.samplerate?e.samplerate:r,c=r/o,u=this.getSamplesPerFrame(e),f=u*c,d=this._initPTS,_=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,x=[],T=s!==void 0;let B=e.samples,P=_?0:8,ie=this.nextAudioTs||-1;const _e=d.baseTime*r/d.timescale,de=_e+t*r;if(this.isAudioContiguous=i=i||B.length&&ie>0&&(n&&Math.abs(de-(ie+_e))<9e3||Math.abs(Wn(B[0].pts,de)-(ie+_e))<20*f),B.forEach(function(Ft){Ft.pts=Wn(Ft.pts,de)}),!i||ie<0){if(B=B.filter(Ft=>Ft.pts>=0),!B.length)return;s===0?ie=0:n&&!T?ie=Math.max(0,de-_e):ie=B[0].pts-_e}if(e.segmentCodec==="aac"){const Ft=this.config.maxAudioFramesDrift;for(let li=0,Jt=ie+_e;li<B.length;li++){const ui=B[li],xi=ui.pts,$t=xi-Jt,Gt=Math.abs(1e3*$t/r);if($t<=-Ft*f&&T)li===0&&(this.warn(`Audio frame @ ${(xi/r).toFixed(3)}s overlaps marker by ${Math.round(1e3*$t/r)} ms.`),this.nextAudioTs=ie=xi-_e,Jt=xi);else if($t>=Ft*f&&Gt<au&&T){let Pi=Math.round($t/f);for(Jt=xi-Pi*f;Jt<0&&Pi&&f;)Pi--,Jt+=f;li===0&&(this.nextAudioTs=ie=Jt-_e),this.warn(`Injecting ${Pi} audio frames @ ${((Jt-_e)/r).toFixed(3)}s due to ${Math.round(1e3*$t/r)} ms gap.`);for(let Wi=0;Wi<Pi;Wi++){let Ni=nu.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Ni||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Ni=ui.unit.subarray()),B.splice(li,0,{unit:Ni,pts:Jt}),Jt+=f,li++}}ui.pts=Jt,Jt+=f}}let Le=null,Me=null,tt,Pe=0,He=B.length;for(;He--;)Pe+=B[He].unit.byteLength;for(let Ft=0,li=B.length;Ft<li;Ft++){const Jt=B[Ft],ui=Jt.unit;let xi=Jt.pts;if(Me!==null){const Gt=x[Ft-1];Gt.duration=Math.round((xi-Me)/c)}else if(i&&e.segmentCodec==="aac"&&(xi=ie+_e),Le=xi,Pe>0){Pe+=P;try{tt=new Uint8Array(Pe)}catch(Gt){this.observer.emit(p.ERROR,p.ERROR,{type:ue.MUX_ERROR,details:G.REMUX_ALLOC_ERROR,fatal:!1,error:Gt,bytes:Pe,reason:`fail allocating audio mdat ${Pe}`});return}_||(new DataView(tt.buffer).setUint32(0,Pe),tt.set(Ue.types.mdat,4))}else return;tt.set(ui,P);const $t=ui.byteLength;P+=$t,x.push(no(!0,u,$t,0)),Me=xi}const Xe=x.length;if(!Xe)return;const Oe=x[x.length-1];ie=Me-_e,this.nextAudioTs=ie+c*Oe.duration;const ft=_?new Uint8Array(0):Ue.moof(e.sequenceNumber++,Le/c,g({},e,{samples:x}));e.samples=[];const jt=(Le-_e)/r,ai=ie/r,oi={data1:ft,data2:tt,startPTS:jt,endPTS:ai,startDTS:jt,endDTS:ai,type:"audio",hasAudio:!0,hasVideo:!1,nb:Xe};return this.isAudioContiguous=!0,oi}}function Wn(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 cu(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function so(a,e,t,i){const n=a.samples.length;if(!n)return;const s=a.inputTimeScale;for(let o=0;o<n;o++){const c=a.samples[o];c.pts=Wn(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=Wn(c.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function ro(a,e,t){const i=a.samples.length;if(!i)return;const n=a.inputTimeScale;for(let r=0;r<i;r++){const o=a.samples[r];o.pts=Wn(o.pts-t.baseTime*n/t.timescale,e*n)/n}a.samples.sort((r,o)=>r.pts-o.pts);const s=a.samples;return a.samples=[],{samples:s}}class hu extends j{constructor(e,t,i,n){super("passthrough-remuxer",n),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,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,n){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(e,n),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:i,videoCodec:n}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:s,video:r}=this.initData=Te(e);if(t)Q(e,t);else{const c=s||r;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}s&&(i=ao(s,K.AUDIO,this)),r&&(n=ao(r,K.VIDEO,this));const o={};s&&r?o.audiovideo={container:"video/mp4",codec:i+","+n,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:s?o.audio={container:"audio/mp4",codec:i,encrypted:s.encrypted,initSegment:e,id:"audio"}:r?o.video={container:"video/mp4",codec:n,supplemental:r.supplemental,encrypted:r.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,i,n,s,r){var o,c;let{initPTS:u,lastEndTime:f}=this;const d={audio:void 0,video:void 0,text:n,id3:i,initSegment:void 0};F(f)||(f=this.lastEndTime=s||0);const _=t.samples;if(!_.length)return d;const x={initPTS:void 0,timescale:void 0,trackId:void 0};let T=this.initData;if((o=T)!=null&&o.length||(this.generateInitSegment(_),T=this.initData),!((c=T)!=null&&c.length))return this.warn("Failed to generate initSegment."),d;this.emitInitSegment&&(x.tracks=this.initTracks,this.emitInitSegment=!1);const B=he(_,T,this),P=T.audio?B[T.audio.id]:null,ie=T.video?B[T.video.id]:null,_e=Dr(ie,1/0),de=Dr(P,1/0),Le=Dr(ie,0,!0),Me=Dr(P,0,!0);let tt=s,Pe=0;const He=P&&(!ie||!u&&de<_e||u&&u.trackId===T.audio.id),Xe=He?P:ie;if(Xe){const Jt=Xe.timescale,ui=Xe.start-s*Jt,xi=He?T.audio.id:T.video.id;tt=Xe.start/Jt,Pe=He?Me-de:Le-_e,(r||!u)&&(fu(u,tt,s,Pe)||Jt!==u.timescale)&&(u&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${ui/Jt} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${tt-s} (${ui}/${Jt}) trackId: ${xi}`),u=null,x.initPTS=ui,x.timescale=Jt,x.trackId=xi)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${s}`);u?(x.initPTS=u.baseTime,x.timescale=u.timescale,x.trackId=u.trackId):((!x.timescale||x.trackId===void 0||x.initPTS===void 0)&&(this.warn("Could not set initPTS"),x.initPTS=tt,x.timescale=1,x.trackId=-1),this.initPTS=u={baseTime:x.initPTS,timescale:x.timescale,trackId:x.trackId});const Oe=tt-u.baseTime/u.timescale,ft=Oe+Pe;Pe>0?this.lastEndTime=ft:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const jt=!!T.audio,ai=!!T.video;let fi="";jt&&(fi+="audio"),ai&&(fi+="video");const oi=(T.audio?T.audio.encrypted:!1)||(T.video?T.video.encrypted:!1),Ft={data1:_,startPTS:Oe,startDTS:Oe,endPTS:ft,endDTS:ft,type:fi,hasAudio:jt,hasVideo:ai,nb:1,dropped:0,encrypted:oi};d.audio=jt&&!ai?Ft:void 0,d.video=ai?Ft:void 0;const li=ie==null?void 0:ie.sampleCount;if(li){const Jt=ie.keyFrameIndex,ui=Jt!==-1;Ft.nb=li,Ft.dropped=Jt===0||this.isVideoContiguous?0:ui?Jt:li,Ft.independent=ui,Ft.firstKeyFrame=Jt,ui&&ie.keyFrameStart&&(Ft.firstKeyFramePTS=(ie.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(d.independent=ui),this.isVideoContiguous||(this.isVideoContiguous=ui),Ft.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${Jt}/${li} dropped: ${Ft.dropped} start: ${Ft.firstKeyFramePTS||"NA"}`)}return d.initSegment=x,d.id3=so(i,s,u,u),n.samples.length&&(d.text=ro(n,s,u)),d}}function Dr(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function fu(a,e,t,i){if(a===null)return!0;const n=Math.max(i,1),s=e-a.baseTime/a.timescale;return Math.abs(s-t)>n}function ao(a,e,t){const i=a.codec;return i&&i.length>4?i:e===K.AUDIO?i==="ec-3"||i==="ac-3"||i==="alac"?i:i==="fLaC"||i==="Opus"?Ht(i,!1):(t.warn(`Unhandled audio codec "${i}" in mp4 MAP`),i||"mp4a"):(t.warn(`Unhandled video codec "${i}" in mp4 MAP`),i||"avc1")}let bs;try{bs=self.performance.now.bind(self.performance)}catch(a){bs=Date.now}const Cr=[{demux:ql,remux:hu},{demux:Ts,remux:Ir},{demux:Zl,remux:Ir},{demux:Yl,remux:Ir}];Cr.splice(2,0,{demux:zl,remux:Ir});class oo{constructor(e,t,i,n,s,r){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=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.id=s,this.logger=r}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,n){const s=i.transmuxing;s.executeStart=bs();let r=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;n&&(this.currentTransmuxState=n);const{contiguous:u,discontinuity:f,trackSwitch:d,accurateTimeOffset:_,timeOffset:x,initSegmentChange:T}=n||o,{audioCodec:B,videoCodec:P,defaultInitPts:ie,duration:_e,initSegmentData:de}=c,Le=du(r,t);if(Le&&wn(Le.method)){const He=this.getDecrypter(),Xe=un(Le.method);if(He.isSync()){let Oe=He.softwareDecrypt(r,Le.key.buffer,Le.iv.buffer,Xe);if(i.part>-1){const jt=He.flush();Oe=jt&&jt.buffer}if(!Oe)return s.executeEnd=bs(),ca(i);r=new Uint8Array(Oe)}else return this.asyncResult=!0,this.decryptionPromise=He.webCryptoDecrypt(r,Le.key.buffer,Le.iv.buffer,Xe).then(Oe=>{const ft=this.push(Oe,null,i);return this.decryptionPromise=null,ft}),this.decryptionPromise}const Me=this.needsProbing(f,d);if(Me){const He=this.configureTransmuxer(r);if(He)return this.logger.warn(`[transmuxer] ${He.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:He,reason:He.message}),s.executeEnd=bs(),ca(i)}(f||d||T||Me)&&this.resetInitSegment(de,B,P,_e,t),(f||T||Me)&&this.resetInitialTimestamp(ie),u||this.resetContiguity();const tt=this.transmux(r,Le,x,_,i);this.asyncResult=ar(tt);const Pe=this.currentTransmuxState;return Pe.contiguous=!0,Pe.discontinuity=!1,Pe.trackSwitch=!1,s.executeEnd=bs(),tt}flush(e){const t=e.transmuxing;t.executeStart=bs();const{decrypter:i,currentTransmuxState:n,decryptionPromise:s}=this;if(s)return this.asyncResult=!0,s.then(()=>this.flush(e));const r=[],{timeOffset:o}=n;if(i){const d=i.flush();d&&r.push(this.push(d.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=bs();const d=[ca(e)];return this.asyncResult?Promise.resolve(d):d}const f=c.flush(o);return ar(f)?(this.asyncResult=!0,f.then(d=>(this.flushRemux(r,d,e),r))):(this.flushRemux(r,f,e),this.asyncResult?Promise.resolve(r):r)}flushRemux(e,t,i){const{audioTrack:n,videoTrack:s,id3Track:r,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${i.sn}${i.part>-1?" part: "+i.part:""} of ${this.id===oe.MAIN?"level":"track"} ${i.level}`);const f=this.remuxer.remux(n,s,r,o,u,c,!0,this.id);e.push({remuxResult:f,chunkMeta:i}),i.transmuxing.executeEnd=bs()}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,s){const{demuxer:r,remuxer:o}=this;!r||!o||(r.resetInitSegment(e,t,i,n),o.resetInitSegment(e,t,i,s))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,n,s){let r;return t&&t.method==="SAMPLE-AES"?r=this.transmuxSampleAes(e,t,i,n,s):r=this.transmuxUnencrypted(e,i,n,s),r}transmuxUnencrypted(e,t,i,n){const{audioTrack:s,videoTrack:r,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(s,r,o,c,t,i,!1,this.id),chunkMeta:n}}transmuxSampleAes(e,t,i,n,s){return this.demuxer.demuxSampleAes(e,t,i).then(r=>({remuxResult:this.remuxer.remux(r.audioTrack,r.videoTrack,r.id3Track,r.textTrack,i,n,!1,this.id),chunkMeta:s}))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:n}=this;let s;for(let d=0,_=Cr.length;d<_;d++){var r;if((r=Cr[d].demux)!=null&&r.probe(e,this.logger)){s=Cr[d];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,c=this.remuxer,u=s.remux,f=s.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(i,t,n,this.logger)),(!o||!(o instanceof f))&&(this.demuxer=new f(i,t,n,this.logger),this.probe=f.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new ln(this.config)),e}}function du(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 ca=a=>({remuxResult:{},chunkMeta:a});function ar(a){return"then"in a&&a.then instanceof Function}class pu{constructor(e,t,i,n,s){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=s||null}}class mu{constructor(e,t,i,n,s,r){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=s,this.initSegmentChange=r}}let lo=0;class uo{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=lo++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const u=c.data,f=this.hls;if(!(!f||!(u!=null&&u.event)||u.instanceNo!==this.instanceNo))switch(u.event){case"init":{var d;const _=(d=this.workerContext)==null?void 0:d.objectURL;_&&self.URL.revokeObjectURL(_);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{f.logger[u.data.logType]&&f.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,f.trigger(u.event,u.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const u=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const s=e.config;this.hls=e,this.id=t,this.useWorker=!!s.enableWorker,this.onTransmuxComplete=i,this.onFlush=n;const r=(c,u)=>{u=u||{},u.frag=this.frag||void 0,c===p.ERROR&&(u=u,u.parent=this.id,u.part=this.part,this.error=u.error),this.hls.trigger(c,u)};this.observer=new Qr,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=si(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||yl()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=bl(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=El());const{worker:f}=this.workerContext;f.addEventListener("message",this.onWorkerMessage),f.addEventListener("error",this.onWorkerError),f.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:o,id:t,config:ht(s)})}catch(f){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.terminateWorker(),this.error=null,this.transmuxer=new oo(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new oo(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=lo++;const t=this.hls.config,i=si(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:ht(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),Sl(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,n,s,r,o,c,u,f){var d,_;u.transmuxing.start=self.performance.now();const{instanceNo:x,transmuxer:T}=this,B=r?r.start:s.start,P=s.decryptdata,ie=this.frag,_e=!(ie&&s.cc===ie.cc),de=!(ie&&u.level===ie.level),Le=ie?u.sn-ie.sn:-1,Me=this.part?u.part-this.part.index:-1,tt=Le===0&&u.id>1&&u.id===(ie==null?void 0:ie.stats.chunkCount),Pe=!de&&(Le===1||Le===0&&(Me===1||tt&&Me<=0)),He=self.performance.now();(de||Le||s.stats.parsing.start===0)&&(s.stats.parsing.start=He),r&&(Me||!Pe)&&(r.stats.parsing.start=He);const Xe=!(ie&&((d=s.initSegment)==null?void 0:d.url)===((_=ie.initSegment)==null?void 0:_.url)),Oe=new mu(_e,Pe,c,de,B,Xe);if(!Pe||_e||Xe){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${s.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===oe.MAIN?"level":"track"}: ${u.level} id: ${u.id}
discontinuity: ${_e}
trackSwitch: ${de}
contiguous: ${Pe}
accurateTimeOffset: ${c}
timeOffset: ${B}
initSegmentChange: ${Xe}`);const ft=new pu(i,n,t,o,f);this.configureTransmuxer(ft)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:x,cmd:"demux",data:e,decryptdata:P,chunkMeta:u,state:Oe},e instanceof ArrayBuffer?[e]:[]);else if(T){const ft=T.push(e,P,u,Oe);ar(ft)?ft.then(jt=>{this.handleTransmuxComplete(jt)}).catch(jt=>{this.transmuxerError(jt,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(ft)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){const n=i.flush(e);ar(n)?n.then(s=>{this.handleFlushResult(s,e)}).catch(s=>{this.transmuxerError(s,e,"transmuxer-interface flush error")}):this.handleFlushResult(n,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(i=>{this.handleTransmuxComplete(i)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const co=100;class gu extends Es{constructor(e,t,i){super(e,t,i,"audio-stream-controller",oe.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!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.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s,trackId:r}){if(i===oe.MAIN){const o=t.cc,c=this.fragCurrent;if(this.initPTS[o]={baseTime:n,timescale:s,trackId:r},this.log(`InitPTS for cc: ${o} found from main: ${n/s} (${n}/${s}) trackId: ${r}`),this.mainAnchor=t,this.state===lt.WAITING_INIT_PTS){const u=this.waitingData;(!u&&!this.loadingParts||u&&u.frag.cc!==o)&&this.syncWithAnchor(t,u==null?void 0:u.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==o?(c.abortRequests(),this.syncWithAnchor(t,c)):this.state===lt.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;const n=((i=this.mainFragLoading)==null?void 0:i.frag)||null;if(t&&(n==null?void 0:n.cc)===t.cc)return;const s=(n||e).cc,r=this.getLevelDetails(),o=this.getLoadPosition(),c=Di(r,s,o);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===lt.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=lt.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(co),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=lt.IDLE):this.state=lt.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case lt.IDLE:this.doTickIdle();break;case lt.WAITING_TRACK:{const{levels:e,trackId:t}=this,i=e==null?void 0:e[t],n=i==null?void 0:i.details;if(n&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(n))break;this.state=lt.WAITING_INIT_PTS}break}case lt.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case lt.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:n,complete:s}=e,r=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=lt.FRAG_LOADING;const o=n.flush().buffer,c={frag:t,part:i,payload:o,networkDetails:null};this._handleFragmentLoadProgress(c),s&&super._handleFragmentLoadComplete(c)}else r&&r.cc!==e.frag.cc&&this.syncWithAnchor(r,e.frag)}else this.state=lt.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:t,levels:i,media:n,trackId:s}=this,r=t.config;if(!this.buffering||!n&&!this.primaryPrefetch&&(this.startFragRequested||!r.startFragPrefetch)||!(i!=null&&i[s]))return;const o=i[s],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=lt.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,K.AUDIO,oe.AUDIO));const f=this.getFwdBufferInfo(u,oe.AUDIO);if(f===null)return;if(!this.switchingTrack&&this._streamEnded(f,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=lt.ENDED;return}const d=f.len,_=t.maxBufferLength,x=c.fragments,T=x[0].start,B=this.getLoadPosition(),P=this.flushing?B:f.end;if(this.switchingTrack&&n){const de=B;c.PTSKnown&&de<T&&(f.end>T||f.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),n.currentTime=T+.05)}if(d>=_&&!this.switchingTrack&&P<x[x.length-1].start)return;let ie=this.getNextFragment(P,c);if(ie&&this.isLoopLoading(ie,P)&&(ie=this.getNextFragmentLoopLoading(ie,c,f,oe.MAIN,_)),!ie){this.bufferFlushed=!0;return}let _e=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&_e&&Ee(ie)&&!ie.endList&&(!c.live||!this.loadingParts&&P<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(_e)===Ri.OK&&(this.mainFragLoading=_e=null),_e&&Ee(_e))){if(ie.start>_e.end){const Le=this.fragmentTracker.getFragAtPos(P,oe.MAIN);Le&&Le.end>_e.end&&(_e=Le,this.mainFragLoading={frag:Le,targetBufferTime:null})}if(ie.start>_e.end)return}this.loadFragment(ie,o,P)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new yt(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.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==lt.STOPPED&&(this.setInterval(co),this.state=lt.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;const i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(p.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i;const{levels:n}=this,{details:s,id:r,groupId:o,track:c}=t;if(!n){this.warn(`Audio tracks reset while loading track ${r} "${c.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||s.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==lt.STOPPED&&(this.state=lt.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${r} "${c.name}" of "${o}" loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`);const f=n[r];let d=0;if(s.live||(i=f.details)!=null&&i.live){if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;if(f.details){var _;d=this.alignPlaylists(s,f.details,(_=this.levelLastLoaded)==null?void 0:_.details)}s.alignedSliding||(Rn(s,u),s.alignedSliding||ys(s,u),d=s.fragmentStart)}f.details=s,this.levelLastLoaded=f,this.startFragRequested||this.setStartPosition(u,d),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:s,id:r,groupId:t.groupId}),this.state===lt.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=lt.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{config:r,trackId:o,levels:c}=this;if(!c){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 u=c[o];if(!u){this.warn("Audio track is undefined on fragment load progress");return}const f=u.details;if(!f){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}const d=r.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let _=this.transmuxer;_||(_=this.transmuxer=new uo(this.hls,oe.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const x=this.initPTS[i.cc],T=(t=i.initSegment)==null?void 0:t.data;if(x!==void 0){const P=n?n.index:-1,ie=P!==-1,_e=new fn(i.level,i.sn,i.stats.chunkCount,s.byteLength,P,ie);_.push(s,T,d,"",i,n,f.totalduration,!1,_e,x)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${f.startSN} ,${f.endSN}],track ${o}`);const{cache:B}=this.waitingData=this.waitingData||{frag:i,part:n,cache:new Tr,complete:!1};B.push(new Uint8Array(s)),this.state!==lt.STOPPED&&(this.state=lt.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===oe.MAIN&&Ee(t.frag)&&(this.mainFragLoading=t,this.state===lt.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:i,part:n}=t;if(i.type!==oe.AUDIO){!this.audioOnly&&i.type===oe.MAIN&&!i.elementaryStreams.video&&!i.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);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(Ee(i)){this.fragPrevious=i;const s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,E({},s)))}this.fragBufferedComplete(i,n),this.media&&this.tick()}onError(e,t){var i;if(t.fatal){this.state=lt.ERROR;return}switch(t.details){case G.FRAG_GAP:case G.FRAG_PARSING_ERROR:case G.FRAG_DECRYPT_ERROR:case G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(oe.AUDIO,t);break;case G.AUDIO_TRACK_LOAD_ERROR:case G.AUDIO_TRACK_LOAD_TIMEOUT:case G.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===lt.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ve.AUDIO_TRACK&&(this.state=lt.IDLE);break;case G.BUFFER_ADD_CODEC_ERROR:case G.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case G.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case G.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==K.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==K.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===lt.ENDED&&(this.state=lt.IDLE);const i=this.mediaBuffer||this.media;i&&(this.afterBufferFlushed(i,t,oe.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:n}=this,{remuxResult:s,chunkMeta:r}=e,o=this.getCurrentContext(r);if(!o){this.resetWhenMissingContext(r);return}const{frag:c,part:u,level:f}=o,{details:d}=f,{audio:_,text:x,id3:T,initSegment:B}=s;if(this.fragContextChanged(c)||!d){this.fragmentTracker.removeFragment(c);return}if(this.state=lt.PARSING,this.switchingTrack&&_&&this.completeAudioSwitch(this.switchingTrack),B!=null&&B.tracks){const P=c.initSegment||c;if(this.unhandledEncryptionError(B,c))return;this._bufferInitSegment(f,B.tracks,P,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:P,id:i,tracks:B.tracks})}if(_){const{startPTS:P,endPTS:ie,startDTS:_e,endDTS:de}=_;u&&(u.elementaryStreams[K.AUDIO]={startPTS:P,endPTS:ie,startDTS:_e,endDTS:de}),c.setElementaryStreamInfo(K.AUDIO,P,ie,_e,de),this.bufferFragmentData(_,c,u,r)}if(T!=null&&(t=T.samples)!=null&&t.length){const P=g({id:i,frag:c,details:d},T);n.trigger(p.FRAG_PARSING_METADATA,P)}if(x){const P=g({id:i,frag:c,details:d},x);n.trigger(p.FRAG_PARSING_USERDATA,P)}}_bufferInitSegment(e,t,i,n){if(this.state!==lt.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const s=t.audio;s.id=oe.AUDIO;const r=e.audioCodec;this.log(`Init audio buffer, container:${s.container}, codecs[level/parsed]=[${r}/${s.codec}]`),r&&r.split(",").length===1&&(s.levelCodec=r),this.hls.trigger(p.BUFFER_CODECS,t);const o=s.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:i,part:null,chunkMeta:n,parent:i.type,data:o};this.hls.trigger(p.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);if(this.switchingTrack||n===Ri.NOT_LOADED||n===Ri.PARTIAL){var s;if(!Ee(e))this._loadInitSegment(e,t);else if((s=t.details)!=null&&s.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=lt.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&ys(t.details,r)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o}=this.bufferedTrack;rt({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,Ut)||(yi(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(p.AUDIO_TRACK_SWITCHED,E({},e))}}class ha extends j{constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,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.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){const n=t==null?void 0:t.renditionReports;if(n){let s=-1;for(let r=0;r<n.length;r++){const o=n[r];let c;try{c=new self.URL(o.URI,t.url).href}catch(u){this.warn(`Could not construct new URL for Rendition Report: ${u}`),c=o.URI||""}if(c===e){s=r;break}else c===e.substring(0,c.length)&&(s=r)}if(s!==-1){const r=n[s],o=parseInt(r["LAST-MSN"])||t.lastPartSn;let c=parseInt(r["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){const f=Math.min(t.age-t.partTarget,t.targetduration);c>=0&&f>t.partTarget&&(c+=1)}const u=i&&ct(i);return new ot(o,c>=0?c:void 0,u)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(i){this.warn(`Could not construct new URL with HLS Delivery Directives: ${i}`)}return e}playlistLoaded(e,t,i){const{details:n,stats:s}=t,r=self.performance.now(),o=s.loading.first?Math.max(0,r-s.loading.first):0;n.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==n.appliedTimelineOffset){const f=Math.max(c||0,0);n.appliedTimelineOffset=f,n.fragments.forEach(d=>{d.setStart(d.playlistOffset+f)})}if(n.live||i!=null&&i.live){const f="levelInfo"in t?t.levelInfo:t.track;if(n.reloaded(i),i&&n.fragments.length>0){Qs(i,n,this);const _e=n.playlistParsingError;if(_e){this.warn(_e);const de=this.hls;if(!de.config.ignorePlaylistParsingErrors){var u;const{networkDetails:Le}=t;de.trigger(p.ERROR,{type:ue.NETWORK_ERROR,details:G.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:_e,reason:_e.message,level:t.level||void 0,parent:(u=n.fragments[0])==null?void 0:u.type,networkDetails:Le,stats:s});return}n.playlistParsingError=null}}n.requestScheduled===-1&&(n.requestScheduled=s.loading.start);const d=this.hls.mainForwardBufferInfo,_=d?d.end-d.len:0,x=(n.edge-_)*1e3,T=vr(n,x);if(n.requestScheduled+T<r?n.requestScheduled=r:n.requestScheduled+=T,this.log(`live playlist ${e} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),!this.canLoad||!n.live)return;let B,P,ie;if(n.canBlockReload&&n.endSN&&n.advanced){const _e=this.hls.config.lowLatencyMode,de=n.lastPartSn,Le=n.endSN,Me=n.lastPartIndex,tt=Me!==-1,Pe=de===Le;tt?Pe?(P=Le+1,ie=_e?0:Me):(P=de,ie=_e?Me+1:n.maxPartIndex):P=Le+1;const He=n.age,Xe=He+n.ageHeader;let Oe=Math.min(Xe-n.partTarget,n.targetduration*1.5);if(Oe>0){if(Xe>n.targetduration*3)this.log(`Playlist last advanced ${He.toFixed(2)}s ago. Omitting segment and part directives.`),P=void 0,ie=void 0;else if(i!=null&&i.tuneInGoal&&Xe-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${Oe} with playlist age: ${n.age}`),Oe=0;else{const ft=Math.floor(Oe/n.targetduration);if(P+=ft,ie!==void 0){const jt=Math.round(Oe%n.targetduration/n.partTarget);ie+=jt}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${He.toFixed(2)}s goal: ${Oe} skip sn ${ft} to part ${ie}`)}n.tuneInGoal=Oe}if(B=this.getDeliveryDirectives(n,t.deliveryDirectives,P,ie),_e||!Pe){n.requestScheduled=r,this.loadingPlaylist(f,B);return}}else(n.canBlockReload||n.canSkipUntil)&&(B=this.getDeliveryDirectives(n,t.deliveryDirectives,P,ie));B&&P!==void 0&&n.canBlockReload&&(n.requestScheduled=s.loading.first+Math.max(T-o*2,T/2)),this.scheduleLoading(f,B,n)}else this.clearTimer()}scheduleLoading(e,t,i){const n=i||e.details;if(!n){this.loadingPlaylist(e,t);return}const s=self.performance.now(),r=n.requestScheduled;if(s>=r){this.loadingPlaylist(e,t);return}const o=r-s;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(o)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),o)}getDeliveryDirectives(e,t,i,n){let s=ct(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=Et.No),new ot(i,n,s)}checkRetry(e){const t=e.details,i=Ti(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===Ci.RetryRequest||!n.resolved&&s===Ci.SendAlternateToPenaltyBox);if(c){var u;if(r>=o.maxNumRetry)return!1;if(i&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const f=Fi(o,r);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),f),this.warn(`Retrying playlist loading ${r+1}/${o.maxNumRetry} after "${t}" in ${f}ms`)}e.levelRetry=!0,n.resolved=!0}return c}}function ho(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!or(a[t].attrs,e[t].attrs))return!1;return!0}function or(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 fa(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class _u extends ha{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(p.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:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Audio track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Audio track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.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 s=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(_=>!i||i.indexOf(_.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(_=>_.default)&&(this.selectDefaultTrack=!1),o.forEach((_,x)=>{_.id=x});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!s&&c){const _=qe(c,o,Ut);if(_>-1)s=o[_];else{const x=qe(c,this.tracks);s=this.tracks[x]}}let u=this.findTrackId(s);u===-1&&s&&(u=this.findTrackId(null));const f={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${i==null?void 0:i.join(",")}`),this.hls.trigger(p.AUDIO_TRACKS_UPDATED,f);const d=this.trackId;if(u!==-1&&d===-1)this.setAudioTrack(u);else if(o.length&&d===-1){var r;const _=new Error(`No audio track selected for current audio group-ID(s): ${(r=this.groupIds)==null?void 0:r.join(",")} track count: ${o.length}`);this.warn(_.message),this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:_})}}}onError(e,t){t.fatal||!t.context||t.context.type===ve.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-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&&rt(e,n,Ut))return n;const s=qe(e,this.tracksInGroup,Ut);if(s>-1){const r=this.tracksInGroup[s];return this.setAudioTrack(s),r}else if(n){let r=t.loadLevel;r===-1&&(r=t.firstAutoLevel);const o=bi(e,t.levels,i,r,Ut);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=qe(e,i);if(r>-1)return i[r]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e],s=n.details&&!n.details.live;if(e===this.trackId&&n===i&&s||(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(p.AUDIO_TRACK_SWITCHING,E({},n)),s))return;const r=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(r)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i<t.length;i++){const n=t[i];if(!(this.selectDefaultTrack&&!n.default)&&(!e||rt(e,n,Ut)))return i}if(e){const{name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const f=t[u];if(rt({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},f,Ut))return u}for(let u=0;u<t.length;u++){const f=t[u];if(or(e.attrs,f.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const f=t[u];if(or(e.attrs,f.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&yi(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading audio-track ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.AUDIO_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}}class vu{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,i){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];n.push(e),n.length===1&&!i&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const i={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(i,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const i={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(i)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const i=(t=e[0])==null?void 0:t.label;(i==="async-blocker"||i==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const t=this.queues[e];if(t.length){const n=t[0];try{n.execute()}catch(s){var i;if(n.onError(s),this.queues===null||this.tracks===null)return;const r=(i=this.tracks[e])==null?void 0:i.buffer;r!=null&&r.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return((t=this.queues)==null?void 0:t[e][0])||null}toString(){const{queues:e,tracks:t}=this;return e===null||t===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(e){var t,i;return(t=this.queues)!=null&&t[e]||(i=this.tracks)!=null&&i[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const i=(t=this.tracks)==null?void 0:t[e],n=i==null?void 0:i.buffer;return n?`SourceBuffer${n.updating?" updating":""}${i.ended?" ended":""}${i.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(i=>i.label).join(", "))||""}}const fo=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,po="HlsJsTrackRemovedError";class yu extends Error{constructor(e){super(e),this.name=po}}class Eu extends j{constructor(e,t){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=i=>{var n;this.hls&&((n=this.mediaSource)==null?void 0:n.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=i=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=i=>{const{media:n,mediaSource:s}=this;i&&this.log("Media source opened"),!(!n||!s)&&(s.removeEventListener("sourceopen",this._onMediaSourceOpen),n.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:n,mediaSource:s}),this.mediaSource!==null&&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&&this.error(`Media element src was set while attaching MediaSource (${n} > ${i})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=Ie(ye(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.BUFFER_RESET,this.onBufferReset,this),e.on(p.BUFFER_APPENDING,this.onBufferAppending,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.BUFFER_EOS,this.onBufferEos,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.FRAG_PARSED,this.onFragParsed,this),e.on(p.FRAG_CHANGED,this.onFragChanged,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.BUFFER_RESET,this.onBufferReset,this),e.off(p.BUFFER_APPENDING,this.onBufferAppending,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_EOS,this.onBufferEos,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.FRAG_PARSED,this.onFragParsed,this),e.off(p.FRAG_CHANGED,this.onFragChanged,this),e.off(p.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:t}=this;if(!e)return null;const i={};if(this.operationQueue){const s=this.isUpdating();s||this.operationQueue.removeBlockers();const r=this.isQueued();(s||r)&&this.warn(`Transfering MediaSource with${r?" operations in queue":""}${s?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const n=this.transferData;return!this.sourceBufferCount&&n&&n.mediaSource===t?g(i,n.tracks):this.sourceBuffers.forEach(s=>{const[r]=s;r&&(i[r]=g({},this.tracks[r]),this.removeBuffer(r)),s[0]=s[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){var i;let n=2;(t.audio&&!t.video||!t.altAudio)&&(n=1),this.bufferCodecEventsTotal=n,this.log(`${n} bufferCodec event(s) expected.`),(i=this.transferData)!=null&&i.mediaSource&&this.sourceBufferCount&&n&&this.bufferCreated()}onMediaAttaching(e,t){const i=this.media=t.media;this.transferData=this.overrides=void 0;const n=ye(this.appendSource);if(n){const s=!!t.mediaSource;(s||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const r=this.mediaSource=t.mediaSource||new n;if(this.assignMediaSource(r),s)this._objectUrl=i.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(r);if(this.appendSource)try{i.removeAttribute("src");const c=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||c&&r instanceof c,mo(i),bu(i,o),i.load()}catch(c){i.src=o}else i.src=o}i.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,i;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(i=e.constructor)==null?void 0:i.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,t=this.transferData;if(!t||!e)return;const i=this.tracks,n=t.tracks,s=n?Object.keys(n):null,r=s?s.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(n&&s&&r){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
required tracks: ${ht(i,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${ht(n,(c,u)=>c==="initSegment"?void 0:u)}}`),!xe(n,i)){t.mediaSource=null,t.tracks=void 0;const c=e.currentTime,u=this.details,f=Math.max(c,(u==null?void 0:u.fragments[0].start)||0);if(f-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${f}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(n)}"->"${Object.keys(i)}") start time: ${f} currentTime: ${c}`),this.onMediaDetaching(p.MEDIA_DETACHING,{}),this.onMediaAttaching(p.MEDIA_ATTACHING,t),e.currentTime=f;return}this.transferData=void 0,s.forEach(c=>{const u=c,f=n[u];if(f){const d=f.buffer;if(d){const _=this.fragmentTracker,x=f.id;if(_.hasFragments(x)||_.hasParts(x)){const P=_i.getBuffered(d);_.detectEvictedFragments(u,P,x,null,!0)}const T=da(u),B=[u,d];this.sourceBuffers[T]=B,d.updating&&this.operationQueue&&this.operationQueue.prependBlocker(u),this.trackSourceBuffer(u,f)}}}),o(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),o()}get mediaSourceOpenOrEnded(){var e;const t=(e=this.mediaSource)==null?void 0:e.readyState;return t==="open"||t==="ended"}onMediaDetaching(e,t){const i=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:n,mediaSource:s,_objectUrl:r}=this;if(s){if(this.log(`media source ${i?"transferring":"detaching"}`),i)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=s.readyState==="open";try{const c=s.sourceBuffers;for(let u=c.length;u--;)o&&c[u].abort(),s.removeSourceBuffer(c[u]);o&&s.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.removeEventListener("startstreaming",this._onStartStreaming),s.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}n&&(n.removeEventListener("emptied",this._onMediaEmptied),i||(r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(n.removeAttribute("src"),this.appendSource&&mo(n),n.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(p.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var t;const i=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),i)try{var n;(n=this.mediaSource)!=null&&n.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(i)}catch(s){this.warn(`onBufferReset ${e}`,s)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[da(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new vu(this.tracks)}onBufferCodecs(e,t){const i=this.tracks,n=Object.keys(t);this.log(`BUFFER_CODECS: "${n}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(i.audio||i.video)||i.audiovideo&&("audio"in t||"video"in t),r=!s&&this.sourceBufferCount&&this.media&&n.some(o=>!i[o]);if(s||r){this.warn(`Unsupported transition between "${Object.keys(i)}" and "${n}" SourceBuffers`);return}n.forEach(o=>{var c,u;const f=t[o],{id:d,codec:_,levelCodec:x,container:T,metadata:B,supplemental:P}=f;let ie=i[o];const _e=(c=this.transferData)==null||(c=c.tracks)==null?void 0:c[o],de=_e!=null&&_e.buffer?_e:ie,Le=(de==null?void 0:de.pendingCodec)||(de==null?void 0:de.codec),Me=de==null?void 0:de.levelCodec;ie||(ie=i[o]={buffer:void 0,listeners:[],codec:_,supplemental:P,container:T,levelCodec:x,metadata:B,id:d});const tt=gt(Le,Me),Pe=tt==null?void 0:tt.replace(fo,"$1");let He=gt(_,x);const Xe=(u=He)==null?void 0:u.replace(fo,"$1");He&&tt&&Pe!==Xe&&(o.slice(0,5)==="audio"&&(He=Ht(He,this.appendSource)),this.log(`switching codec ${Le} to ${He}`),He!==(ie.pendingCodec||ie.codec)&&(ie.pendingCodec=He),ie.container=T,this.appendChangeType(o,T,He))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{const i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){const n=`${t};codecs=${i}`,s={label:`change-type=${n}`,execute:()=>{const r=this.tracks[e];if(r){const o=r.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${n}`),o.changeType(n),r.codec=i,r.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:r=>{this.warn(`Failed to change ${e} SourceBuffer type`,r)}};this.append(s,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const i=e.start,n=i+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(i,oe.MAIN))==null?void 0:t.gap)===!0)return;const r={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>n||c!=null&&c.buffer&&_i.isBuffered(c.buffer,n)||((o=this.fragmentTracker.getAppendedFrag(n,oe.MAIN))==null?void 0:o.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn("Error executing block-audio operation",o)}};this.blockedAudioAppend={op:r,frag:e},this.append(r,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:i}=this,{data:n,type:s,parent:r,frag:o,part:c,chunkMeta:u,offset:f}=t,d=u.buffering[s],{sn:_,cc:x}=o,T=self.performance.now();d.start=T;const B=o.stats.buffering,P=c?c.stats.buffering:null;B.start===0&&(B.start=T),P&&P.start===0&&(P.start=T);const ie=i.audio;let _e=!1;s==="audio"&&(ie==null?void 0:ie.container)==="audio/mpeg"&&(_e=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const de=i.video,Le=de==null?void 0:de.buffer;if(Le&&_!=="initSegment"){const Pe=c||o,He=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend&&!(de.ending||de.ended)){const Oe=Pe.start+Pe.duration*.05,ft=Le.buffered,jt=this.currentOp("video");!ft.length&&!jt?this.blockAudio(Pe):!jt&&!_i.isBuffered(Le,Oe)&&this.lastVideoAppendEnd<Oe&&this.blockAudio(Pe)}else if(s==="video"){const Xe=Pe.end;if(He){const Oe=He.frag.start;(Xe>Oe||Xe<this.lastVideoAppendEnd||_i.isBuffered(Le,Oe))&&this.unblockAudio()}this.lastVideoAppendEnd=Xe}}const Me=(c||o).start,tt={label:`append-${s}`,execute:()=>{var Pe;d.executeStart=self.performance.now();const He=(Pe=this.tracks[s])==null?void 0:Pe.buffer;He&&(_e?this.updateTimestampOffset(He,Me,.1,s,_,x):f!==void 0&&F(f)&&this.updateTimestampOffset(He,f,1e-6,s,_,x)),this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const Pe=self.performance.now();d.executeEnd=d.end=Pe,B.first===0&&(B.first=Pe),P&&P.first===0&&(P.first=Pe);const He={};this.sourceBuffers.forEach(([Xe,Oe])=>{Xe&&(He[Xe]=_i.getBuffered(Oe))}),this.appendErrors[s]=0,s==="audio"||s==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:s,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:He})},onError:Pe=>{var He;const Xe={type:ue.MEDIA_ERROR,parent:o.type,details:G.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:Pe,err:Pe,fatal:!1},Oe=(He=this.media)==null?void 0:He.error;if(Pe.code===DOMException.QUOTA_EXCEEDED_ERR||Pe.name=="QuotaExceededError"||"quota"in Pe)Xe.details=G.BUFFER_FULL_ERROR;else if(Pe.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Oe)Xe.errorAction=Qi(!0);else if(Pe.name===po&&this.sourceBufferCount===0)Xe.errorAction=Qi(!0);else{const ft=++this.appendErrors[s];this.warn(`Failed ${ft}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${Oe||"no media error"})`),(ft>=this.hls.config.appendErrorMaxRetry||Oe)&&(Xe.fatal=!0)}this.hls.trigger(p.ERROR,Xe)}};this.append(tt,s,this.isPending(this.tracks[s]))}getFlushOp(e,t,i){return this.log(`queuing "${e}" remove ${t}-${i}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:e})},onError:n=>{this.warn(`Failed to remove ${t}-${i} from "${e}" SourceBuffer`,n)}}}onBufferFlushing(e,t){const{type:i,startOffset:n,endOffset:s}=t;i?this.append(this.getFlushOp(i,n,s),i):this.sourceBuffers.forEach(([r])=>{r&&this.append(this.getFlushOp(r,n,s),r)})}onFragParsed(e,t){const{frag:i,part:n}=t,s=[],r=n?n.elementaryStreams:i.elementaryStreams;r[K.AUDIOVIDEO]?s.push("audiovideo"):(r[K.AUDIO]&&s.push("audio"),r[K.VIDEO]&&s.push("video"));const o=()=>{const c=self.performance.now();i.stats.buffering.end=c,n&&(n.stats.buffering.end=c);const u=n?n.stats:i.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:i,part:n,stats:u,id:i.type})};s.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers(o,s).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const t=this.tracks[e];if(t)return!t.ended||t.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(([r])=>{if(r){const o=this.tracks[r];(!t.type||t.type===r)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${r} buffer reached EOS`)))}});const n=((i=this.overrides)==null?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([r])=>{var o;return r&&!((o=this.tracks[r])!=null&&o.ended)})?n?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:r}=this;if(!r||r.readyState!=="open"){r&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${r.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),r.endOfStream(),this.hls.trigger(p.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(p.BUFFERED_TO_END,void 0)):t.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const t=this.tracks[e];t&&(t.ending=!1)}})}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===G.BUFFER_APPEND_ERROR&&t.frag){var i;const n=(i=t.errorAction)==null?void 0:i.nextAutoLevel;F(n)&&n!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||t===null||!this.sourceBufferCount)return;const n=e.config,s=i.currentTime,r=t.levelTargetDuration,o=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(F(o)&&o>=0){const u=Math.max(o,r),f=Math.floor(s/r)*r-u;this.flushBackBuffer(s,r,f)}const c=n.frontBufferFlushThreshold;if(F(c)&&c>0){const u=Math.max(n.maxBufferLength,c),f=Math.max(u,r),d=Math.floor(s/r)*r+f;this.flushFrontBuffer(s,r,d)}}flushBackBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const o=_i.getBuffered(s);if(o.length>0&&i>o.start(0)){var r;this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:i});const c=this.tracks[n];if((r=this.details)!=null&&r.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(c!=null&&c.ended){this.log(`Cannot flush ${n} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:n})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(([n,s])=>{if(s){const r=_i.getBuffered(s),o=r.length;if(o<2)return;const c=r.start(o-1),u=r.end(o-1);if(i>c||e>=c&&e<=u)return;this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:n})}})}getDurationAndRange(){var e;const{details:t,mediaSource:i}=this;if(!t||!this.media||(i==null?void 0:i.readyState)!=="open")return null;const n=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),f=Math.max(u,n);return{duration:1/0,start:u,end:f}}return{duration:1/0}}const s=(e=this.overrides)==null?void 0:e.duration;if(s)return F(s)?{duration:s}:null;const r=this.media.duration,o=F(i.duration)?i.duration:0;return n>o&&n>r||!F(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(F(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),n.duration=e),t!==void 0&&i!==void 0&&(this.log(`MediaSource duration is set to ${n.duration}. Setting seekable range to ${t}-${i}.`),n.setLiveSeekableRange(t,i)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${ht(i)}`),this.tracksReady){var n;const s=(n=this.transferData)==null?void 0:n.tracks;s&&Object.keys(s).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,i])=>{if(t){const n=this.tracks[t];e[t]={buffer:i,container:n.container,codec:n.codec,supplemental:n.supplemental,levelCodec:n.levelCodec,id:n.id,metadata:n.metadata}}}),this.hls.trigger(p.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw new Error("createSourceBuffers called when mediaSource was null");for(const s in e){const r=s,o=e[r];if(this.isPending(o)){const c=this.getTrackCodec(o,r),u=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${u})${this.currentOp(r)?" Queued":""} ${ht(o)}`);try{const f=i.addSourceBuffer(u),d=da(r),_=[r,f];t[d]=_,o.buffer=f}catch(f){var n;this.error(`error while trying to add sourceBuffer: ${f.message}`),this.shiftAndExecuteNext(r),(n=this.operationQueue)==null||n.removeBlockers(),delete this.tracks[r],this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:f,sourceBufferName:r,mimeType:u,parent:o.id});return}this.trackSourceBuffer(r,o)}}this.bufferCreated()}getTrackCodec(e,t){const i=e.supplemental;let n=e.codec;i&&(t==="video"||t==="audiovideo")&&ni(i,"video")&&(n=wt(n,i));const s=gt(n,e.levelCodec);return s?t.slice(0,5)==="audio"?Ht(s,this.appendSource):s:""}trackSourceBuffer(e,t){const i=t.buffer;if(!i)return;const n=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:n,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(s,r)=>{const o=r.removedRanges;o!=null&&o.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:s})})}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 t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const i=this.currentOp(e);i&&(i.onComplete(),this.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(p.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});const s=this.currentOp(e);s&&s.onError(n)}updateTimestampOffset(e,t,i,n,s,r){const o=t-e.timestampOffset;Math.abs(o)>=i&&(this.log(`Updating ${n} SourceBuffer timestampOffset to ${t} (sn: ${s} cc: ${r})`),e.timestampOffset=t)}removeExecutor(e,t,i){const{media:n,mediaSource:s}=this,r=this.tracks[e],o=r==null?void 0:r.buffer;if(!n||!s||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=F(n.duration)?n.duration:1/0,u=F(s.duration)?s.duration:1/0,f=Math.max(0,t),d=Math.min(i,c,u);d>f&&(!r.ending||r.ended)?(r.ended=!1,this.log(`Removing [${f},${d}] from the ${e} SourceBuffer`),o.remove(f,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.tracks[t],n=i==null?void 0:i.buffer;if(!n)throw new yu(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);i.ending=!1,i.ended=!1,n.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([e,t])=>e&&t.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:i}=this,n=t.map(r=>this.appendBlocker(r));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(n).then(r=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var i;const n=(i=this.tracks[t])==null?void 0:i.buffer;!n||n.updating||this.shiftAndExecuteNext(t)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[t])=>e+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,t,i){const n=this.tracks[e];if(!n)return;const s=n.buffer;if(!s)return;const r=i.bind(this,e);n.listeners.push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const i=t.buffer;i&&(t.listeners.forEach(n=>{i.removeEventListener(n.event,n.listener)}),t.listeners.length=0)}}function mo(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function bu(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function da(a){return a==="audio"?1:0}class pa{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(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.BUFFER_CODECS,this.onBufferCodecs,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(p.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.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&&F(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}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&&t.logger.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelEnabled&&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,s)=>this.isLevelAllowed(n)&&s<=e);return this.clientRect=null,pa.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 Math.min(e,this.hls.config.maxDevicePixelRatio)}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,c)=>c?o.width!==c.width||o.height!==c.height:!0;let s=e.length-1;const r=Math.max(t,i);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=r||c.height>=r)&&n(c,e[o+1])){s=o;break}}return s}}const Nn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Su={HLS:"h"};class us{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof us?i:new us(i))),this.value=e,this.params=t}}const xu="Dict";function Tu(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 Au(a,e,t,i){return new Error(`failed to ${a} "${Tu(e)}" as ${t}`,{cause:i})}function cs(a,e,t){return Au("serialize",a,e,t)}class go{constructor(e){this.description=e}}const _o="Bare Item",wu="Boolean";function Ru(a){if(typeof a!="boolean")throw cs(a,wu);return a?"?1":"?0"}function Lu(a){return btoa(String.fromCharCode(...a))}const Iu="Byte Sequence";function Du(a){if(ArrayBuffer.isView(a)===!1)throw cs(a,Iu);return`:${Lu(a)}:`}const Cu="Integer";function ku(a){return a<-999999999999999||999999999999999<a}function vo(a){if(ku(a))throw cs(a,Cu);return a.toString()}function Pu(a){return`@${vo(a.getTime()/1e3)}`}function yo(a,e){if(a<0)return-yo(-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}const Ou="Decimal";function Mu(a){const e=yo(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw cs(a,Ou);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Nu="String",Fu=/[\x00-\x1f\x7f]+/;function Bu(a){if(Fu.test(a))throw cs(a,Nu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Uu(a){return a.description||a.toString().slice(7,-1)}const Ku="Token";function Eo(a){const e=Uu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw cs(e,Ku);return e}function ma(a){switch(typeof a){case"number":if(!F(a))throw cs(a,_o);return Number.isInteger(a)?vo(a):Mu(a);case"string":return Bu(a);case"symbol":return Eo(a);case"boolean":return Ru(a);case"object":if(a instanceof Date)return Pu(a);if(a instanceof Uint8Array)return Du(a);if(a instanceof go)return Eo(a);default:throw cs(a,_o)}}const $u="Key";function ga(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw cs(a,$u);return a}function _a(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${ga(e)}`:`;${ga(e)}=${ma(t)}`).join("")}function bo(a){return a instanceof us?`${ma(a.value)}${_a(a.params)}`:ma(a)}function Gu(a){return`(${a.value.map(bo).join(" ")})${_a(a.params)}`}function Vu(a,e={whitespace:!0}){if(typeof a!="object"||a==null)throw cs(a,xu);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof us||(s=new us(s));let r=ga(n);return s.value===!0?r+=_a(s.params):(r+="=",Array.isArray(s.value)?r+=Gu(s):r+=bo(s)),r}).join(`,${i}`)}function So(a,e){return Vu(a,e)}const hs="CMCD-Object",mn="CMCD-Request",Ds="CMCD-Session",ws="CMCD-Status",ju={br:hs,ab:hs,d:hs,ot:hs,tb:hs,tpb:hs,lb:hs,tab:hs,lab:hs,url:hs,pb:mn,bl:mn,tbl:mn,dl:mn,ltc:mn,mtp:mn,nor:mn,nrr:mn,rc:mn,sn:mn,sta:mn,su:mn,ttfb:mn,ttfbb:mn,ttlb:mn,cmsdd:mn,cmsds:mn,smrt:mn,df:mn,cs:mn,ts:mn,cid:Ds,pr:Ds,sf:Ds,sid:Ds,st:Ds,v:Ds,msd:Ds,bs:ws,bsd:ws,cdn:ws,rtp:ws,bg:ws,pt:ws,ec:ws,e:ws},Hu={REQUEST:mn};function Wu(a){return Object.keys(a).reduce((e,t)=>{var i;return(i=a[t])===null||i===void 0||i.forEach(n=>e[n]=t),e},{})}function Zu(a,e){const t={};if(!a)return t;const i=Object.keys(a),n=e?Wu(e):{};return i.reduce((s,r)=>{var o;const c=ju[r]||n[r]||Hu.REQUEST,u=(o=s[c])!==null&&o!==void 0?o:s[c]={};return u[r]=a[r],s},t)}function zu(a){return["ot","sf","st","e","sta"].includes(a)}function Yu(a){return typeof a=="number"?F(a):a!=null&&a!==""&&a!==!1}const xo="event";function Xu(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),s=i.pathname.split("/").slice(1,-1);for(;n[0]===s[0];)n.shift(),s.shift();for(;s.length;)s.shift(),n.unshift("..");return n.join("/")+t.search+t.hash}const kr=a=>Math.round(a),va=(a,e)=>Array.isArray(a)?a.map(t=>va(t,e)):a instanceof us&&typeof a.value=="string"?new us(va(a.value,e),a.params):(e.baseUrl&&(a=Xu(a,e.baseUrl)),e.version===1?encodeURIComponent(a):a),Pr=a=>kr(a/100)*100,qu={br:kr,d:kr,bl:Pr,dl:Pr,mtp:Pr,nor:(a,e)=>{let t=a;return e.version>=2&&(a instanceof us&&typeof a.value=="string"?t=new us([a]):typeof a=="string"&&(t=[a])),va(t,e)},rtp:Pr,tb:kr},To="request",Ao="response",ya=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],Qu=["e"],Ju=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Or(a){return Ju.test(a)}function ec(a){return ya.includes(a)||Qu.includes(a)||Or(a)}const wo=["d","dl","nor","ot","rtp","su"];function tc(a){return ya.includes(a)||wo.includes(a)||Or(a)}const ic=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function nc(a){return ya.includes(a)||wo.includes(a)||ic.includes(a)||Or(a)}const sc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function rc(a){return sc.includes(a)||Or(a)}const ac={[Ao]:nc,[xo]:ec,[To]:tc};function Ro(a,e={}){const t={};if(a==null||typeof a!="object")return t;const i=e.version||a.v||1,n=e.reportingMode||To,s=i===1?rc:ac[n];let r=Object.keys(a).filter(s);const o=e.filter;typeof o=="function"&&(r=r.filter(o));const c=n===Ao||n===xo;c&&!r.includes("ts")&&r.push("ts"),i>1&&!r.includes("v")&&r.push("v");const u=g({},qu,e.formatters),f={version:i,reportingMode:n,baseUrl:e.baseUrl};return r.sort().forEach(d=>{let _=a[d];const x=u[d];if(typeof x=="function"&&(_=x(_,f)),d==="v"){if(i===1)return;_=i}d=="pr"&&_===1||(c&&d==="ts"&&!F(_)&&(_=Date.now()),Yu(_)&&(zu(d)&&typeof _=="string"&&(_=new go(_)),t[d]=_))}),t}function oc(a,e={}){const t={};if(!a)return t;const i=Ro(a,e),n=Zu(i,e==null?void 0:e.customHeaderMap);return Object.entries(n).reduce((s,[r,o])=>{const c=So(o,{whitespace:!1});return c&&(s[r]=c),s},t)}function lc(a,e,t){return g(a,oc(e,t))}const uc="CMCD";function cc(a,e={}){return a?So(Ro(a,e),{whitespace:!1}):""}function hc(a,e={}){if(!a)return"";const t=cc(a,e);return encodeURIComponent(t)}function fc(a,e={}){if(!a)return"";const t=hc(a,e);return`${uc}=${t}`}const Lo=/CMCD=[^&#]+/;function dc(a,e,t){const i=fc(e,t);if(!i)return a;if(Lo.test(a))return a.replace(Lo,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class pc{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:Nn.MANIFEST,su:!this.initialized})}catch(s){this.hls.logger.warn("Could not generate manifest CMCD data.",s)}},this.applyFragmentData=n=>{try{const{frag:s,part:r}=n,o=this.hls.levels[s.level],c=this.getObjectType(s),u={d:(r||s).duration*1e3,ot:c};(c===Nn.VIDEO||c===Nn.AUDIO||c==Nn.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const f=r?this.getNextPart(r):this.getNextFrag(s);f!=null&&f.url&&f.url!==s.url&&(u.nor=f.url),this.apply(n,u)}catch(s){this.hls.logger.warn("Could not generate segment CMCD data.",s)}},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||e.sessionId,this.cid=i.contentId,this.useHeaders=i.useHeaders===!0,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHED,this.onMediaDetached,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHED,this.onMediaDetached,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=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:Su.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){g(t,this.createData());const i=t.ot===Nn.INIT||t.ot===Nn.VIDEO||t.ot===Nn.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,o)=>(n.includes(o)&&(r[o]=t[o]),r),{}));const s={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),lc(e.headers,t,s)):e.url=dc(e.url,t,s)}getNextFrag(e){var t;const i=(t=this.hls.levels[e.level])==null?void 0:t.details;if(i){const n=e.sn-i.startSN;return i.fragments[n+1]}}getNextPart(e){var t;const{index:i,fragment:n}=e,s=(t=this.hls.levels[n.level])==null||(t=t.details)==null?void 0:t.partList;if(s){const{sn:r}=n;for(let o=s.length-1;o>=0;o--){const c=s[o];if(c.index===i&&c.fragment.sn===r)return s[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return Nn.TIMED_TEXT;if(e.sn==="initSegment")return Nn.INIT;if(t==="audio")return Nn.AUDIO;if(t==="main")return this.hls.audioTracks.length?Nn.VIDEO:Nn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Nn.AUDIO)i=n.audioTracks;else{const s=n.maxAutoLevel,r=s>-1?s+1:n.levels.length;i=n.levels.slice(0,r)}return i.forEach(s=>{s.bitrate>t&&(t=s.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,i=e===Nn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:_i.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(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new i(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,r,o){t(s),this.loader.load(s,r,o)}}}}const mc=3e5;class gc extends j{constructor(e){super("content-steering",e.logger),this.hls=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.registerListeners()}registerListeners(){const e=this.hls;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(e.indexOf(t.pathwayId)===-1&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}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)===Ci.SendAlternateToPenaltyBox&&i.flags===ki.MoveAllAlternatesMatchingHost){const n=this.levels;let s=this._pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&n?r=this.getPathwayForGroupId(o,u,r):c&&(r=c)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&n&&(s=this.pathways()),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),t.details===G.BUFFER_APPEND_ERROR&&!t.fatal?i.resolved=!0:i.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${n&&n.length} priorities: ${ht(s)} penalized: ${ht(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(s=>{n-i[s]>mc&&delete i[s]});for(let s=0;s<e.length;s++){const r=e[s];if(r in i)continue;if(r===this.pathwayId)return;const o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(r),t.length>0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,br(t),this.hls.trigger(p.LEVELS_UPDATED,{levels:t});const u=this.hls.levels[o];c&&u&&this.levels&&(u.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&u.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${u.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,i){const n=this.getLevelsForPathway(i).concat(this.levels||[]);for(let s=0;s<n.length;s++)if(t===ve.AUDIO_TRACK&&n[s].hasAudioGroup(e)||t===ve.SUBTITLE_TRACK&&n[s].hasSubtitleGroup(e))return n[s].pathwayId;return i}clonePathways(e){const t=this.levels;if(!t)return;const i={},n={};e.forEach(s=>{const{ID:r,"BASE-ID":o,"URI-REPLACEMENT":c}=s;if(t.some(f=>f.pathwayId===r))return;const u=this.getLevelsForPathway(o).map(f=>{const d=new Bi(f.attrs);d["PATHWAY-ID"]=r;const _=d.AUDIO&&`${d.AUDIO}_clone_${r}`,x=d.SUBTITLES&&`${d.SUBTITLES}_clone_${r}`;_&&(i[d.AUDIO]=_,d.AUDIO=_),x&&(n[d.SUBTITLES]=x,d.SUBTITLES=x);const T=Do(f.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),B=new yt({attrs:d,audioCodec:f.audioCodec,bitrate:f.bitrate,height:f.height,name:f.name,url:T,videoCodec:f.videoCodec,width:f.width});if(f.audioGroups)for(let P=1;P<f.audioGroups.length;P++)B.addGroupId("audio",`${f.audioGroups[P]}_clone_${r}`);if(f.subtitleGroups)for(let P=1;P<f.subtitleGroups.length;P++)B.addGroupId("text",`${f.subtitleGroups[P]}_clone_${r}`);return B});t.push(...u),Io(this.audioTracks,i,c,r),Io(this.subtitleTracks,n,c,r)})}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(f){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(n.protocol!=="data:"){const f=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+f)}const s={responseType:"json",url:n.href},r=t.steeringManifestLoadPolicy.default,o=r.errorRetry||r.timeoutRetry||{},c={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(f,d,_,x)=>{this.log(`Loaded steering manifest: "${n}"`);const T=f.data;if((T==null?void 0:T.VERSION)!==1){this.log(`Steering VERSION ${T.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=T.TTL;const{"RELOAD-URI":B,"PATHWAY-CLONES":P,"PATHWAY-PRIORITY":ie}=T;if(B)try{this.uri=new self.URL(B,n).href}catch(de){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${B}`);return}this.scheduleRefresh(this.uri||_.url),P&&this.clonePathways(P);const _e={steeringManifest:T,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,_e),ie&&this.updatePathwayPriority(ie)},onError:(f,d,_,x)=>{if(this.log(`Error loading steering manifest: ${f.code} ${f.text} (${d.url})`),this.stopLoad(),f.code===410){this.enabled=!1,this.log(`Steering manifest ${d.url} no longer available`);return}let T=this.timeToLoad*1e3;if(f.code===429){const B=this.loader;if(typeof(B==null?void 0:B.getResponseHeader)=="function"){const P=B.getResponseHeader("Retry-After");P&&(T=parseFloat(P)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,T)},onTimeout:(f,d,_)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(s,c,u)}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 Io(a,e,t,i){a&&Object.keys(e).forEach(n=>{const s=a.filter(r=>r.groupId===n).map(r=>{const o=g({},r);return o.details=void 0,o.attrs=new Bi(o.attrs),o.url=o.attrs.URI=Do(r.url,r.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[n],o.attrs["PATHWAY-ID"]=i,o});a.push(...s)})}function Do(a,e,t,i){const{HOST:n,PARAMS:s,[t]:r}=i;let o;e&&(o=r==null?void 0:r[e],o&&(a=o));const c=new self.URL(a);return n&&!o&&(c.host=n),s&&Object.keys(s).sort().forEach(u=>{u&&c.searchParams.set(u,s[u])}),c.href}class js extends j{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=js.CDMCleanupPromise?[js.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:i,initData:n}=t,s=`"${t.type}" event: init data type: "${i}"`;if(this.debug(s),n!==null){if(!this.keyFormatPromise){let r=Object.keys(this.keySystemAccessPromises);r.length||(r=pi(this.config));const o=r.map(ii).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=os(r);if(i!=="sinf"||o!==Yi.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}let c;try{const x=Ze(new Uint8Array(n)),T=zi(JSON.parse(x).sinf),B=ce(T);if(!B)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(B.subarray(8,24))}catch(x){this.warn(`${s} Failed to parse sinf: ${x}`);return}const u=J(c),{keyIdToKeySessionPromise:f,mediaKeySessions:d}=this;let _=f[u];for(let x=0;x<d.length;x++){const T=d[x],B=T.decryptdata;if(!B.keyId)continue;const P=J(B.keyId);if(u===P||B.uri.replace(/-/g,"").indexOf(u)!==-1){if(_=f[P],!_)continue;if(B.pssh)break;delete f[P],B.pssh=new Uint8Array(n),B.keyId=c,_=f[u]=_.then(()=>this.generateRequestWithPreferredKeySession(T,i,n,"encrypted-event-key-match")),_.catch(ie=>this.handleError(ie));break}}_||this.handleError(new Error(`Key ID ${u} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(r=>this.handleError(r))}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),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(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(p.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(p.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(p.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(p.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,n=t==null?void 0:t[e];if(n)return n.licenseUrl;if(e===Yi.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==null?void 0:t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(r,o,c)=>!!r&&c.indexOf(r)===o,n=t.map(r=>r.audioCodec).filter(i),s=t.map(r=>r.videoCodec).filter(i);return n.length+s.length===0&&s.push("avc1.42e01e"),new Promise((r,o)=>{const c=u=>{const f=u.shift();this.getMediaKeysPromise(f,n,s).then(d=>r({keySystem:f,mediaKeys:d})).catch(d=>{u.length?c(u):d instanceof ts?o(d):o(new ts({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if(typeof i!="function"){let n=`Configured requestMediaKeySystemAccess is not a function ${i}`;return ji===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){var n;const s=an(e,t,i,this.config.drmSystemOptions||{});let r=this.keySystemAccessPromises[e],o=(n=r)==null?void 0:n.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${ht(s)}`),o=this.requestMediaKeySystemAccess(e,s);const c=r=this.keySystemAccessPromises[e]={keySystemAccess:o};return o.catch(u=>{this.log(`Failed to obtain access to key-system "${e}": ${u}`)}),o.then(u=>{this.log(`Access for key-system "${u.keySystem}" obtained`);const f=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const d=c.mediaKeys=u.createMediaKeys().then(_=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,f.then(x=>x?this.setMediaKeysServerCertificate(_,e,x):_)));return d.catch(_=>{this.error(`Failed to create media-keys for "${e}"}: ${_}`)}),d})}return o.then(()=>r.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${J(e.keyId||[])}`);const n=i.createSession(),s={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),n=this.getKeyIdString(t),s="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(i,s,t.pssh.buffer,"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 J(e.keyId)}updateKeySession(e,t){const i=e.mediaKeysSession;return this.log(`Updating key-session "${i.sessionId}" for keyId ${J(e.decryptdata.keyId||[])}
} (data length: ${t.byteLength})`),i.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>ii(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:i})=>this.attemptSetMediaKeys(t,i))}selectKeySystem(e){return new Promise((t,i)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const s=ii(n);s?t(s):i(new Error(`Unable to find format for key-system "${n}"`))}).catch(i)})}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){const t=pi(this.config),i=e.map(os).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(i)}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),n=this.bannedKeyIds[i];if(n){const o=Co(n,t);return this.handleError(o,e.frag),Promise.reject(o)}const s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);const r=this.keyIdToKeySessionPromise[i];if(!r){const o=this.getKeySystemForKeyPromise(t).then(({keySystem:c,mediaKeys:u})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(c,u).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:u,decryptdata:t}))))).then(c=>{const u="cenc",f=t.pssh?t.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,u,f,"playlist-key")});return o.catch(c=>this.handleError(c,e.frag)),this.keyIdToKeySessionPromise[i]=o,o}return r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){this.hls&&(this.error(e.message),e instanceof ts?(t&&(e.data.frag=t),this.hls.trigger(p.ERROR,e.data)):this.hls.trigger(p.ERROR,{type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=os(e.keyFormat),s=n?[n]:pi(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=pi(this.config)),e.length===0)throw new ts({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${ht({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const n=Promise.all(i).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.mediaKeys=t,this.setMediaKeysQueue.push(n),n.then(()=>{this.log(`Media-keys set for "${e}"`),i.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(s=>i.indexOf(s)===-1)})}generateRequestWithPreferredKeySession(e,t,i,n){var s;const r=(s=this.config.drmSystems)==null||(s=s[e.keySystem])==null?void 0:s.generateRequest;if(r)try{const _=r.call(this.hls,t,i,e);if(!_)throw new Error("Invalid response from configured generateRequest filter");t=_.initDataType,i=_.initData?_.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(_){if(this.warn(_.message),this.hls&&this.hls.config.debug)throw _}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const o=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${n}": ${o} (init data type: ${t} length: ${i.byteLength})`);const c=new Qr,u=e._onmessage=_=>{const x=e.mediaKeysSession;if(!x){c.emit("error",new Error("invalid state"));return}const{messageType:T,message:B}=_;this.log(`"${T}" message event for session "${x.sessionId}" message size: ${B.byteLength}`),T==="license-request"||T==="license-renewal"?this.renewLicense(e,B).catch(P=>{c.eventNames().length?c.emit("error",P):this.handleError(P)}):T==="license-release"?e.keySystem===Yi.FAIRPLAY&&(this.updateKeySession(e,dn("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${T}"`)},f=e._onkeystatuseschange=_=>{if(!e.mediaKeysSession){c.emit("error",new Error("invalid state"));return}const T=e.keyStatus;this.onKeyStatusChange(e);const B=e.keyStatus;B!==T&&(c.emit("keyStatus",B,e),B==="expired"&&(this.log(`${e.keySystem} expired for key ${o}`),this.renewKeySession(e)))};En(e.mediaKeysSession,"message",u),En(e.mediaKeysSession,"keystatuseschange",f);const d=new Promise((_,x)=>{c.on("error",x),c.on("keyStatus",(T,{decryptdata:B})=>{T.startsWith("usable")?_():T==="internal-error"||T==="output-restricted"?x(Co(T,B)):T==="expired"?x(new Error(`key expired while generating request (keyId: ${o})`)):this.warn(`unhandled key status change "${T}" (keyId: ${o})`)})});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o}`)}).catch(_=>{throw new ts({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_SESSION,error:_,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${_}`)}).then(()=>d).catch(_=>{throw c.removeAllListeners(),this.removeSession(e),_}).then(()=>(c.removeAllListeners(),e))}onKeyStatusChange(e){const t=J(new Uint8Array(e.decryptdata.keyId||[]));e.mediaKeysSession.keyStatuses.forEach((i,n)=>{if(typeof n=="string"&&typeof i=="object"){const o=n;n=i,i=o}const s=J("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n));i==="internal-error"&&(this.bannedKeyIds[s]=i);const r=s===t;this.log(`${r?"":"un"}matched key status change "${i}" for keyStatuses keyId: ${s} session keyId: ${t} uri: ${e.decryptdata.uri}`),r&&(e.keyStatus=i)})}fetchServerCertificate(e){const t=this.config,i=t.loader,n=new i(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise((r,o)=>{const c={responseType:"arraybuffer",url:s},u=t.certLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(_,x,T,B)=>{r(_.data)},onError:(_,x,T,B)=>{o(new ts({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:T,response:E({url:c.url,data:void 0},_)},`"${e}" certificate request failed (${s}). Status: ${_.code} (${_.text})`))},onTimeout:(_,x,T)=>{o(new ts({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:T,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(_,x,T)=>{o(new Error("aborted"))}};n.load(c,f,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise((n,s)=>{e.setServerCertificate(i).then(r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${i.byteLength}) on "${t}"`),n(e)}).catch(r=>{s(new ts({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:r,fatal:!0},r.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(i=>this.updateKeySession(e,new Uint8Array(i)).catch(n=>{throw new ts({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:n,fatal:!1},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"),s=n.querySelectorAll("HttpHeader");if(s.length>0){let f;for(let d=0,_=s.length;d<_;d++){var r,o;f=s[d];const x=(r=f.querySelector("name"))==null?void 0:r.textContent,T=(o=f.querySelector("value"))==null?void 0:o.textContent;x&&T&&e.setRequestHeader(x,T)}}const c=n.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return dn(atob(u))}setupLicenseXHR(e,t,i,n){const s=this.config.licenseXhrSetup;return s?Promise.resolve().then(()=>{if(!i.decryptdata)throw new Error("Key removed");return s.call(this.hls,e,t,i,n)}).catch(r=>{if(!i.decryptdata)throw r;return e.open("POST",t,!0),s.call(this.hls,e,t,i,n)}).then(r=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:r||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,s)=>{const r=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${r}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return s(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let c=o.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const u=this.config.licenseResponseCallback;if(u)try{c=u.call(this.hls,o,r,e)}catch(f){this.error(f)}n(c)}else{const c=i.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)s(new ts({type:ue.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:r,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${r}). Status: ${o.status} (${o.statusText})`));else{const f=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${f} attempts left`),this.requestLicense(e,t).then(n,s)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,r,e,t).then(({xhr:c,licenseChallenge:u})=>{e.keySystem==Yi.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)}).catch(s)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,En(i,"encrypted",this.onMediaEncrypted),En(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Ln(e,"encrypted",this.onMediaEncrypted),Ln(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const t=this.media,i=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Jn.clearKeyUriToKeyIdMap();const n=i.length;js.CDMCleanupPromise=Promise.all(i.map(s=>this.removeSession(s)).concat(t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(s=>{this.log(`Could not clear media keys: ${s}`),this.hls&&this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`),this.hls&&this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${s}`)})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const i=t.reduce((n,s)=>(n.indexOf(s.keyFormat)===-1&&n.push(s.keyFormat),n),[]);this.log(`Selecting key-system from session-keys ${i.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(i)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i,decryptdata:n}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${J((n==null?void 0:n.keyId)||[])}`),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 s=this.mediaKeySessions.indexOf(e);s>-1&&this.mediaKeySessions.splice(s,1);const{drmSystemOptions:r}=this.config;return(gs(r)?new Promise((c,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(c).catch(u)}):Promise.resolve()).catch(c=>{this.log(`Could not remove session: ${c}`),this.hls&&this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${c}`)})}).then(()=>t.close()).catch(c=>{this.log(`Could not close session: ${c}`),this.hls&&this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${c}`)})})}}}js.CDMCleanupPromise=void 0;class ts 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}}function Co(a,e){const t=a==="output-restricted",i=t?G.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:G.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new ts({type:ue.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${a}"`)}class _c{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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(p.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(p.MEDIA_DETACHING,this.onMediaDetaching,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)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){const n=performance.now();if(t){if(this.lastTime){const s=n-this.lastTime,r=i-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*r/s,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:r,currentDecoded:o,totalDroppedFrames:i}),c>0&&r>u.config.fpsDroppedMonitoringThreshold*o){let f=u.currentLevel;u.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(u.autoLevelCapping===-1||u.autoLevelCapping>=f)&&(f=f-1,u.trigger(p.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:u.currentLevel}),u.autoLevelCapping=f,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)}}function ko(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 Po(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){ne.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){ne.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function Hs(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let i=a.cues.length;i--;)e&&a.cues[i].removeEventListener("enter",e),a.removeCue(a.cues[i]);t==="disabled"&&(a.mode=t)}function Ea(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=yc(a.cues,e,t);for(let r=0;r<s.length;r++)(!i||i(s[r]))&&a.removeCue(s[r])}n==="disabled"&&(a.mode=n)}function vc(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,s;for(;i<=n;)if(s=Math.floor((n+i)/2),e<a[s].startTime)n=s-1;else if(e>a[s].startTime&&i<t)i=s+1;else return s;return a[i].startTime-e<e-a[n].startTime?i:n}function yc(a,e,t){const i=[],n=vc(a,e);if(n>-1)for(let s=n,r=a.length;s<r;s++){const o=a[s];if(o.startTime>=e&&o.endTime<=t)i.push(o);else if(o.startTime>t)return i}return i}function Mr(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}class Ec extends ha{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.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const i=Mr(this.media.textTracks);for(let s=0;s<i.length;s++)if(i[s].mode==="hidden")t=i[s];else if(i[s].mode==="showing"){t=i[s];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(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.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(e,t){const i=this.media;if(!i)return;const n=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,n)return;Mr(i.textTracks).forEach(r=>{Hs(r)})}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:s}=t,r=this.tracksInGroup[i];if(!r||r.groupId!==n){this.warn(`Subtitle track with id:${i} and group:${n} not found in active group ${r==null?void 0:r.groupId}`);return}const o=r.details;r.details=t.details,this.log(`Subtitle track ${i} "${r.name}" lang:${r.lang} group:${n} loaded [${s.startSN}-${s.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 s=this.currentTrack;if(!i||(n==null?void 0:n.length)!==(i==null?void 0:i.length)||i!=null&&i.some(r=>(n==null?void 0:n.indexOf(r))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const r=this.tracks.filter(f=>!i||i.indexOf(f.groupId)!==-1);if(r.length)this.selectDefaultTrack&&!r.some(f=>f.default)&&(this.selectDefaultTrack=!1),r.forEach((f,d)=>{f.id=d});else if(!s&&!this.tracksInGroup.length)return;this.tracksInGroup=r;const o=this.hls.config.subtitlePreference;if(!s&&o){this.selectDefaultTrack=!1;const f=qe(o,r);if(f>-1)s=r[f];else{const d=qe(o,this.tracks);s=this.tracks[d]}}let c=this.findTrackId(s);c===-1&&s&&(c=this.findTrackId(null));const u={subtitleTracks:r};this.log(`Updating subtitle tracks, ${r.length} track(s) found in "${i==null?void 0:i.join(",")}" group-id`),this.hls.trigger(p.SUBTITLE_TRACKS_UPDATED,u),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let n=0;n<t.length;n++){const s=t[n];if(!(i&&!s.default||!i&&!e)&&(!e||rt(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(or(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(or(e.attrs,s.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(fa(n,e))return i}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ve.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){if(e.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const i=this.currentTrack;if(i&&rt(e,i))return i;const n=qe(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=qe(e,t);if(s>-1)return t[s]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=e.id,n=e.groupId,s=this.getUrlWithDirectives(e.url,t),r=e.details,o=r==null?void 0:r.age;this.log(`Loading subtitle ${i} "${e.name}" lang:${e.lang} group:${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${s}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:s,id:i,groupId:n,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Mr(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(s=>fa(i,s))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach(s=>{s.mode!=="disabled"&&s!==n&&(s.mode="disabled")}),n){const s=this.subtitleDisplay?"showing":"hidden";n.mode!==s&&(n.mode=s)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!F(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const i=this.currentTrack,n=t[e]||null;if(this.trackId=e,this.currentTrack=n,this.toggleTrackModes(),!n){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const s=!!n.details&&!n.details.live;if(e===this.trackId&&n===i&&s)return;this.log(`Switching to subtitle-track ${e}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:r,groupId:o="",name:c,type:u,url:f}=n;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:r,groupId:o,name:c,type:u,url:f});const d=this.switchParams(n.url,i==null?void 0:i.details,n.details);this.loadPlaylist(d)}}function bc(){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 s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n=="x"?s:s&3|8).toString(16)})}}}function lr(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const Ws=.025;let Nr=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Sc(a,e,t){return`${a.identifier}-${t+1}-${lr(e)}`}class xc{constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;const i=this.playoutLimit;return e<=0||isNaN(i)?!1:i===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>i}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const t=this.dateRange.tagAnchor;if(t)return ba(e,t)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const t=this.dateRange.startTime,i=ba(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=F(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const t=this.resumeAnchor;if(t)return ba(e,t)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Ws))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let t;return this._duration!==null?t=this._duration:this.dateRange.duration?t=this.dateRange.duration:t=this.dateRange.plannedDuration||0,!isNaN(e)&&e<t&&(t=e),t}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?Nr.Range:Nr.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return Tc(this)}}function ba(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<Ws)?e.start:e.start+e.duration}function Oo(a,e,t){const i=new self.URL(a,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function Sa(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function Tc(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function Zs(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Ac{constructor(e,t,i,n){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(p.PLAYOUT_LIMIT_REACHED,{})};const s=this.hls=new e(t);this.interstitial=i,this.assetItem=n;const r=()=>{this.hasDetails=!0};s.once(p.LEVEL_LOADED,r),s.once(p.AUDIO_TRACK_LOADED,r),s.once(p.SUBTITLE_TRACK_LOADED,r),s.on(p.MEDIA_ATTACHING,(o,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&s.on(p.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,s.trigger(p.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=Oo(t,e.config.primarySessionId||"").href}catch(i){}e.loadSource(t)}}bufferedInPlaceToEnd(e){var t;if(!this.appendInPlace)return!1;if((t=this.hls)!=null&&t.bufferedToEnd)return!0;if(!e)return!1;const i=Math.min(this._bufferedEosTime||1/0,this.duration),n=this.timelineOffset,s=_i.bufferInfo(e,n,0);return this.getAssetTime(s.end)>=i-.02}reachedPlayout(e){const i=this.interstitial.playoutLimit;return this.startOffset+e>=i}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const t=_i.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const t=this.interstitial.playoutLimit;if(t){const i=t-this.startOffset;if(i>0&&i<e)return i}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const t=this.timelineOffset;if(e!==t){const i=e-t;if(Math.abs(i)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const t=this.timelineOffset,i=this.duration;return Math.min(Math.max(0,e-t),i)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),(t=this.hls)==null||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const t=i=>delete i.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var n;(n=this.hls)==null||n.on(e,t)}once(e,t,i){var n;(n=this.hls)==null||n.once(e,t)}off(e,t,i){var n;(n=this.hls)==null||n.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${Zs(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Mo=.033;class wc extends j{constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,n)=>e<=n.startOffset&&t>n.startOffset?(delete n.error,i+1):i,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);const n=this.items;if(n)for(n[i]||(t===void 0&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&(s=n[i])!=null&&s.event;){var s;i--}return i}findItemIndexAtTime(e,t){const i=this.items;if(i)for(let n=0;n<i.length;n++){let s=i[n];if(t&&t!=="primary"&&(s=s[t]),e===s.start||e>s.start&&e<s.end)return n}return-1}findJumpRestrictedIndex(e,t){const i=this.items;if(i)for(let n=e;n<=t&&i[n];n++){const s=i[n].event;if(s!=null&&s.restrictions.jump&&!s.appendInPlace)return n}return-1}findEventIndex(e){const t=this.items;if(t)for(let n=t.length;n--;){var i;if(((i=t[n].event)==null?void 0:i.identifier)===e)return n}return-1}findAssetIndex(e,t){const i=e.assetList,n=i.length;if(n>1)for(let s=0;s<n;s++){const r=i[s];if(!r.error){const o=r.timelineStart;if(t===o||t>o&&(t<o+(r.duration||0)||s===n-1))return s}}return 0}get assetIdAtEnd(){var e;const t=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(t){const i=t.assetList,n=i[i.length-1];if(n)return n.identifier}return null}parseInterstitialDateRanges(e,t){const i=e.main.details,{dateRanges:n}=i,s=this.events,r=this.parseDateRanges(n,{url:i.url},t),o=Object.keys(n),c=s?s.filter(u=>!o.includes(u.identifier)):[];r.length&&r.sort((u,f)=>{const d=u.cue.pre,_=u.cue.post,x=f.cue.pre,T=f.cue.post;if(d&&!x)return-1;if(x&&!d||_&&!T)return 1;if(T&&!_)return-1;if(!d&&!x&&!_&&!T){const B=u.startTime,P=f.startTime;if(B!==P)return B-P}return u.dateRange.tagOrder-f.dateRange.tagOrder}),this.events=r,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],i=!1){const n=this.events||[];if(n.length||t.length||this.length<2){const s=this.items,r=this.parseSchedule(n,e);(i||t.length||(s==null?void 0:s.length)!==r.length||r.some((c,u)=>Math.abs(c.playout.start-s[u].playout.start)>.005||Math.abs(c.playout.end-s[u].playout.end)>.005))&&(this.items=r,this.onScheduleUpdate(t,s))}}parseDateRanges(e,t,i){const n=[],s=Object.keys(e);for(let r=0;r<s.length;r++){const o=s[r],c=e[o];if(c.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(c):(u=new xc(c,t),this.eventMap[o]=u,i===!1&&(u.appendInPlace=i)),n.push(u)}}return n}parseSchedule(e,t){const i=[],n=t.main.details,s=n.live?1/0:n.edge;let r=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,t);let c=0,u=0;if(e.forEach((f,d)=>{const _=f.cue.pre,x=f.cue.post,T=e[d-1]||null,B=f.appendInPlace,P=x?s:f.startOffset,ie=f.duration,_e=f.timelineOccupancy===Nr.Range?ie:0,de=f.resumptionOffset,Le=(T==null?void 0:T.startTime)===P,Me=P+f.cumulativeDuration;let tt=B?Me+ie:P+de;if(_||!x&&P<=0){const He=u;u+=_e,f.timelineStart=Me;const Xe=r;r+=ie,i.push({event:f,start:Me,end:tt,playout:{start:Xe,end:r},integrated:{start:He,end:u}})}else if(P<=s){if(!Le){const Oe=P-c;if(Oe>Mo){const ft=c,jt=u;u+=Oe;const ai=r;r+=Oe;const fi={previousEvent:e[d-1]||null,nextEvent:f,start:ft,end:ft+Oe,playout:{start:ai,end:r},integrated:{start:jt,end:u}};i.push(fi)}else Oe>0&&T&&(T.cumulativeDuration+=Oe,i[i.length-1].end=P)}x&&(tt=Me),f.timelineStart=Me;const He=u;u+=_e;const Xe=r;r+=ie,i.push({event:f,start:Me,end:tt,playout:{start:Xe,end:r},integrated:{start:He,end:u}})}else return;const Pe=f.resumeTime;x||Pe>s?c=s:c=Pe}),c<s){var o;const f=c,d=u,_=s-c;u+=_;const x=r;r+=_,i.push({previousEvent:((o=i[i.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:f+_,playout:{start:x,end:r},integrated:{start:d,end:u}})}this.setDurations(s,r,u)}else i.push({previousEvent:null,nextEvent:null,start:0,end:s,playout:{start:0,end:s},integrated:{start:0,end:s}}),this.setDurations(s,s,s);return i}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){const i=t.main.details,n=i.live?1/0:i.edge;let s=0,r=-1;e.forEach((o,c)=>{const u=o.cue.pre,f=o.cue.post,d=u?0:f?n:o.startTime;this.updateAssetDurations(o),r===d?o.cumulativeDuration=s:(s=0,r=d),!f&&o.snapOptions.in&&(o.resumeAnchor=wi(null,i.fragments,o.startOffset+o.resumptionOffset,0,0)||void 0),o.appendInPlace&&!o.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(o,t)||(o.appendInPlace=!1)),!o.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<Mo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const x=F(o.resumeOffset)?o.resumeOffset:o.duration;s+=x})}primaryCanResumeInPlaceAt(e,t){const i=e.resumeTime,n=e.startTime+e.resumptionOffset;return Math.abs(i-n)>Ws?(this.log(`"${e.identifier}" resumption ${i} not aligned with estimated timeline end ${n}`),!1):!Object.keys(t).some(r=>{const o=t[r].details,c=o.edge;if(i>=c)return this.log(`"${e.identifier}" resumption ${i} past ${r} playlist end ${c}`),!1;const u=wi(null,o.fragments,i);if(!u)return this.log(`"${e.identifier}" resumption ${i} does not align with any fragments in ${r} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const f=r==="audio"?.175:0;return Math.abs(u.start-i)<Ws+f||Math.abs(u.end-i)<Ws+f?!1:(this.log(`"${e.identifier}" resumption ${i} not aligned with ${r} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let i=0,n=!1,s=!1;for(let r=0;r<e.assetList.length;r++){const o=e.assetList[r],c=t+i;o.startOffset=i,o.timelineStart=c,n||(n=o.duration===null),s||(s=!!o.error);const u=o.error?0:o.duration||0;i+=u}n&&!s?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function is(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class Rc{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=Oo(i,this.hls.sessionId,e.baseUrl)}catch(_){const x=this.assignAssetListError(e,G.ASSET_LIST_LOAD_ERROR,_,i);this.hls.trigger(p.ERROR,x);return}t&&n.protocol!=="data:"&&n.searchParams.set("_HLS_start_offset",""+t);const s=this.hls.config,r=s.loader,o=new r(s),c={responseType:"json",url:n.href},u=s.interstitialAssetListLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(_,x,T,B)=>{const P=_.data,ie=P==null?void 0:P.ASSETS;if(!Array.isArray(ie)){const _e=this.assignAssetListError(e,G.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),T.url,x,B);this.hls.trigger(p.ERROR,_e);return}e.assetListResponse=P,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:P,networkDetails:B})},onError:(_,x,T,B)=>{const P=this.assignAssetListError(e,G.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${_.code} ${_.text} (${x.url})`),x.url,B,T);this.hls.trigger(p.ERROR,P)},onTimeout:(_,x,T)=>{const B=this.assignAssetListError(e,G.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${x.url})`),x.url,_,T);this.hls.trigger(p.ERROR,B)}};return o.load(c,f,d),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,i,n,s,r){return e.error=i,{type:ue.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function No(a){a==null||a.play().catch(()=>{})}function Fr(a,e){return`[${a}] Advancing timeline position to ${e}`}class Lc extends j{constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled||!this.schedule)return;const n=i-this.timelinePos;if(Math.abs(n)<1/7056e5)return;const r=n<=-.01;this.timelinePos=i,this.bufferedPos=i;const o=this.playingItem;if(!o){this.checkBuffer();return}if(r&&this.schedule.resetErrorsInRange(i,i-n)&&this.updateSchedule(!0),this.checkBuffer(),r&&i<o.start||i>=o.end){var c;const x=this.findItemIndex(o);let T=this.schedule.findItemIndexAtTime(i);if(T===-1&&(T=x+(r?-1:1),this.log(`seeked ${r?"back ":""}to position not covered by schedule ${i} (resolving from ${x} to ${T})`)),!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!r&&T>x){const B=this.schedule.findJumpRestrictedIndex(x+1,T);if(B>x){this.setSchedulePosition(B);return}}this.setSchedulePosition(T);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const x=o.event.assetList[0];x&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,x))}return}const f=u.timelineStart,d=u.duration||0;if(r&&i<f||i>=f+d){var _;(_=o.event)!=null&&_.appendInPlace&&(this.clearInterstitial(o.event,o),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,u)}},this.onTimeupdate=()=>{const i=this.currentTime;if(i===void 0||this.playbackDisabled)return;if(i>this.timelinePos)this.timelinePos=i,i>this.bufferedPos&&this.checkBuffer();else return;const n=this.playingItem;if(!n||this.playingLastItem)return;if(i>=n.end){this.timelinePos=n.end;const o=this.findItemIndex(n);this.setSchedulePosition(o+1)}const s=this.playingAsset;if(!s)return;const r=s.timelineStart+(s.duration||0);i>=r&&this.setScheduleToAssetAtTime(i,s)},this.onScheduleUpdate=(i,n)=>{const s=this.schedule;if(!s)return;const r=this.playingItem,o=s.events||[],c=s.items||[],u=s.durations,f=i.map(B=>B.identifier),d=!!(o.length||f.length);(d||n)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(B=>is(B))} pos: ${this.timelinePos}`),f.length&&this.log(`Removed events ${f}`);let _=null,x=null;r&&(_=this.updateItem(r,this.timelinePos),this.itemsMatch(r,_)?this.playingItem=_:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const T=this.bufferingItem;if(T&&(x=this.updateItem(T,this.bufferedPos),this.itemsMatch(T,x)?this.bufferingItem=x:T.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(T.event,null))),i.forEach(B=>{B.assetList.forEach(P=>{this.clearAssetPlayer(P.identifier,null)})}),this.playerQueue.forEach(B=>{if(B.interstitial.appendInPlace){const P=B.assetItem.timelineStart,ie=B.timelineOffset-P;if(ie)try{B.timelineOffset=P}catch(_e){Math.abs(ie)>Ws&&this.warn(`${_e} ("${B.assetId}" ${B.timelineOffset}->${P})`)}}}),d||n){if(this.hls.trigger(p.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:u,removedIds:f}),this.isInterstitial(r)&&f.includes(r.event.identifier)){this.warn(`Interstitial "${r.event.identifier}" removed while playing`),this.primaryFallback(r.event);return}r&&this.trimInPlace(_,r),T&&x!==_&&this.trimInPlace(x,T),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Rc(e),this.schedule=new wc(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(p.MEDIA_ENDED,this.onMediaEnded,this),e.on(p.ERROR,this.onError,this),e.on(p.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(p.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(p.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(p.BUFFER_CODECS,this.onBufferCodecs,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(p.MEDIA_ENDED,this.onMediaEnded,this),e.off(p.ERROR,this.onError,this),e.off(p.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){Ln(e,"play",this.onPlay),Ln(e,"pause",this.onPause),Ln(e,"seeking",this.onSeeking),Ln(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;En(i,"seeking",this.onSeeking),En(i,"timeupdate",this.onTimeupdate),En(i,"play",this.onPlay),En(i,"pause",this.onPause)}onMediaAttached(e,t){const i=this.effectivePlayingItem,n=this.detachedData;if(this.detachedData=null,i===null)this.checkStart();else if(!n){this.clearScheduleState();const s=this.findItemIndex(i);this.setSchedulePosition(s)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){const i=!!t.transferMedia,n=this.media;if(this.media=null,!i&&(n&&this.removeMediaListeners(n),this.detachedData)){const s=this.getBufferingPlayer();s&&(this.log(`Removing schedule state for detachedData and ${s}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,s.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,t=()=>e.bufferingItem||e.waitingItem,i=d=>d&&e.getAssetPlayer(d.identifier),n=(d,_,x,T,B)=>{if(d){let P=d[_].start;const ie=d.event;if(ie){if(_==="playout"||ie.timelineOccupancy!==Nr.Point){const _e=i(x);(_e==null?void 0:_e.interstitial)===ie&&(P+=_e.assetItem.startOffset+_e[B])}}else{const _e=T==="bufferedPos"?r():e[T];P+=_e-d.start}return P}return 0},s=(d,_)=>{var x;if(d!==0&&_!=="primary"&&(x=e.schedule)!=null&&x.length){var T;const B=e.schedule.findItemIndexAtTime(d),P=(T=e.schedule.items)==null?void 0:T[B];if(P){const ie=P[_].start-P.start;return d+ie}}return d},r=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?o("primary"):Math.max(d,0)},o=d=>{var _,x;return(_=e.primaryDetails)!=null&&_.live?e.primaryDetails.edge:((x=e.schedule)==null?void 0:x.durations[d])||0},c=(d,_)=>{var x,T;const B=e.effectivePlayingItem;if(B!=null&&(x=B.event)!=null&&x.restrictions.skip||!e.schedule)return;e.log(`seek to ${d} "${_}"`);const P=e.effectivePlayingItem,ie=e.schedule.findItemIndexAtTime(d,_),_e=(T=e.schedule.items)==null?void 0:T[ie],de=e.getBufferingPlayer(),Le=de==null?void 0:de.interstitial,Me=Le==null?void 0:Le.appendInPlace,tt=P&&e.itemsMatch(P,_e);if(P&&(Me||tt)){const Pe=i(e.playingAsset),He=(Pe==null?void 0:Pe.media)||e.primaryMedia;if(He){const Xe=_==="primary"?He.currentTime:n(P,_,e.playingAsset,"timelinePos","currentTime"),Oe=d-Xe,ft=(Me?Xe:He.currentTime)+Oe;if(ft>=0&&(!Pe||Me||ft<=Pe.duration)){He.currentTime=ft;return}}}if(_e){let Pe=d;if(_!=="primary"){const Xe=_e[_].start,Oe=d-Xe;Pe=_e.start+Oe}const He=!e.isInterstitial(_e);if((!e.isInterstitial(P)||P.event.appendInPlace)&&(He||_e.event.appendInPlace)){const Xe=e.media||(Me?de==null?void 0:de.media:null);Xe&&(Xe.currentTime=Pe)}else if(P){const Xe=e.findItemIndex(P);if(ie>Xe){const ft=e.schedule.findJumpRestrictedIndex(Xe+1,ie);if(ft>Xe){e.setSchedulePosition(ft);return}}let Oe=0;if(He)e.timelinePos=Pe,e.checkBuffer();else{const ft=_e.event.assetList,jt=d-(_e[_]||_e).start;for(let ai=ft.length;ai--;){const fi=ft[ai];if(fi.duration&&jt>=fi.startOffset&&jt<fi.startOffset+fi.duration){Oe=ai;break}}}e.setSchedulePosition(ie,Oe)}}},u=()=>{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const _=t();return e.isInterstitial(_)?_:null},f={get bufferedEnd(){const d=t(),_=e.bufferingItem;if(_&&_===d){var x;return n(_,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-_.playout.start||((x=e.bufferingAsset)==null?void 0:x.startOffset)||0}return 0},get currentTime(){const d=u(),_=e.effectivePlayingItem;return _&&_===d?n(_,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-_.playout.start:0},set currentTime(d){const _=u(),x=e.effectivePlayingItem;x&&x===_&&c(d+x.playout.start,"playout")},get duration(){const d=u();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const _=(d=u())==null?void 0:d.event.assetList;return _?_.map(x=>e.getAssetPlayer(x.identifier)):[]},get playingIndex(){var d;const _=(d=u())==null?void 0:d.event;return _&&e.effectivePlayingAsset?_.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return u()}};return this.manager={get events(){var d;return((d=e.schedule)==null||(d=d.events)==null?void 0:d.slice(0))||[]},get schedule(){var d;return((d=e.schedule)==null||(d=d.items)==null?void 0:d.slice(0))||[]},get interstitialPlayer(){return u()?f:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const d=t();return e.findItemIndex(d)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const d=e.effectivePlayingItem;return e.findItemIndex(d)},primary:{get bufferedEnd(){return r()},get currentTime(){const d=e.timelinePos;return d>0?d:0},set currentTime(d){c(d,"primary")},get duration(){return o("primary")},get seekableStart(){var d;return((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0}},integrated:{get bufferedEnd(){return n(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return n(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){c(d,"integrated")},get duration(){return o("integrated")},get seekableStart(){var d;return s(((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,_=d==null?void 0:d.event;if(_&&!_.restrictions.skip){const x=e.findItemIndex(d);if(_.appendInPlace){const T=d.playout.start+d.event.duration;c(T+.001,"playout")}else e.advanceAfterAssetEnded(_,x,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const t=this.playingItem,i=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!i?!1:this.findItemIndex(t)===i.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let n=this.media;!n&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(n=this.primaryMedia);const s=(t=n)==null?void 0:t.currentTime;if(!(s===void 0||!F(s)))return s}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,t){const i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){const i=e.interstitial.appendInPlace,n=e.media;if(i&&n===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&n){this.detachedData={media:n};return}const s=e.transferMedia();this.log(`transfer MediaSource from ${e} ${ht(s)}`),this.detachedData=s}else t&&n&&(this.shouldPlay||(this.shouldPlay=!n.paused))}transferMediaTo(e,t){var i,n;if(e.media===t)return;let s=null;const r=this.hls,o=e!==r,c=o&&e.interstitial.appendInPlace,u=(i=this.detachedData)==null?void 0:i.mediaSource;let f;if(r.media)c&&(s=r.transferMedia(),this.detachedData=s),f="Primary";else if(u){const T=this.getBufferingPlayer();T?(s=T.transferMedia(),f=`${T}`):f="detached MediaSource"}else f="detached media";if(!s){if(u)s=this.detachedData,this.log(`using detachedData: MediaSource ${ht(s)}`);else if(!this.detachedData||r.media===t){const T=this.playerQueue;T.length>1&&T.forEach(B=>{if(o&&B.interstitial.appendInPlace!==c){const P=B.interstitial;this.clearInterstitial(B.interstitial,null),P.appendInPlace=!1,P.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${P}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const d=s&&"mediaSource"in s&&((n=s.mediaSource)==null?void 0:n.readyState)!=="closed",_=d&&s?s:t;this.log(`${d?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${f} (media.currentTime: ${t.currentTime})`);const x=this.schedule;if(_===s&&x){const T=o&&e.assetId===x.assetIdAtEnd;_.overrides={duration:x.duration,endOfStream:!o||T,cueRemoval:!o}}e.attachMedia(_)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,t=e==null?void 0:e.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const i=this.timelinePos,n=this.effectivePlayingItem;if(i===-1){const s=this.hls.startPosition;if(this.log(Fr("checkStart",s)),this.timelinePos=s,t.length&&t[0].cue.pre){const r=e.findEventIndex(t[0].identifier);this.setSchedulePosition(r)}else if(s>=0||!this.primaryLive){const r=this.timelinePos=s>0?s:0,o=e.findItemIndexAtTime(r);this.setSchedulePosition(o)}}else if(n&&!this.playingItem){const s=e.findItemIndex(n);this.setSchedulePosition(s)}}advanceAssetBuffering(e,t){const i=e.event,n=i.findAssetIndex(t),s=Sa(i,n);if(!i.isAssetPastPlayoutLimit(s))this.bufferedToEvent(e,s);else if(this.schedule){var r;const o=(r=this.schedule.items)==null?void 0:r[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,i){const n=Sa(e,i);if(e.isAssetPastPlayoutLimit(n)){if(this.schedule){const s=this.schedule.items;if(s){const r=t+1,o=s.length;if(r>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.log(Fr("advanceAfterAssetEnded",c)),this.timelinePos=c,e.appendInPlace&&this.advanceInPlace(c),this.checkBuffer(this.bufferedPos<c)),this.setSchedulePosition(r)}}}else{if(e.appendInPlace){const s=e.assetList[n];s&&this.advanceInPlace(s.timelineStart)}this.setSchedulePosition(t,n)}}setScheduleToAssetAtTime(e,t){const i=this.schedule;if(!i)return;const n=t.parentIdentifier,s=i.getEvent(n);if(s){const r=i.findEventIndex(n),o=i.findAssetIndex(s,e);this.advanceAfterAssetEnded(s,r,o-1)}}setSchedulePosition(e,t){var i;const n=(i=this.schedule)==null?void 0:i.items;if(!n||this.playbackDisabled)return;const s=e>=0?n[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${s&&is(s)}) pos: ${this.timelinePos}`);const r=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(r)){const f=r.event,d=this.playingAsset,_=d==null?void 0:d.identifier,x=_?this.getAssetPlayer(_):null;if(x&&_&&(!this.eventItemsMatch(r,s)||t!==void 0&&_!==f.assetList[t].identifier)){var c;const T=f.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${T+1}/${f.assetList.length} ${Zs(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:T,event:f,schedule:n.slice(0),scheduleIndex:e,player:x}),r!==this.playingItem){this.itemsMatch(r,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(f,this.findItemIndex(this.playingItem),T);return}this.retreiveMediaSource(_,s),x.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&x.detachMedia()}if(!this.eventItemsMatch(r,s)&&(this.endedItem=r,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${f} ${is(r)}`),f.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:f,schedule:n.slice(0),scheduleIndex:e}),f.cue.once)){var u;this.updateSchedule();const T=(u=this.schedule)==null?void 0:u.items;if(s&&T){const B=this.findItemIndex(s);this.advanceSchedule(B,T,t,r,o)}return}}this.advanceSchedule(e,n,t,r,o)}advanceSchedule(e,t,i,n,s){const r=this.schedule;if(!r)return;const o=t[e]||null,c=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach(f=>{const d=f.interstitial,_=r.findEventIndex(d.identifier);(_<e||_>e+1)&&this.clearInterstitial(d,o)}),this.isInterstitial(o)){this.timelinePos=Math.min(Math.max(this.timelinePos,o.start),o.end);const f=o.event;if(i===void 0){i=r.findAssetIndex(f,this.timelinePos);const T=Sa(f,i-1);if(f.isAssetPastPlayoutLimit(T)||f.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(f,e,i);return}i=T}const d=this.waitingItem;this.assetsBuffered(o,c)||this.setBufferingItem(o);let _=this.preloadAssets(f,i);if(this.eventItemsMatch(o,d||n)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${is(o)} ${f.appendInPlace?"append in place":""}`),this.hls.trigger(p.INTERSTITIAL_STARTED,{event:f,schedule:t.slice(0),scheduleIndex:e})),!f.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${f}`);return}if(f.assetListLoader&&(f.assetListLoader.destroy(),f.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${f}`);return}this.waitingItem=this.endedItem=null,this.playingItem=o;const x=f.assetList[i];if(!x){this.advanceAfterAssetEnded(f,e,i||0);return}if(_||(_=this.getAssetPlayer(x.identifier)),_===null||_.destroyed){const T=f.assetList.length;this.warn(`asset ${i+1}/${T} player destroyed ${f}`),_=this.createAssetPlayer(f,x,i),_.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&f.appendInPlace&&this.isAssetBuffered(x))return;this.startAssetPlayer(_,i,t,e,c),this.shouldPlay&&No(_.media)}else o?(this.resumePrimary(o,e,n),this.shouldPlay&&No(this.hls.media)):s&&this.isInterstitial(n)&&(this.endedItem=null,this.playingItem=n,n.event.appendInPlace||this.attachPrimary(r.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,t,i){var n,s;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${is(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(Fr("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!i)return;const r=(s=this.schedule)==null?void 0:s.items;r&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${is(e)}`),this.hls.trigger(p.INTERSTITIALS_PRIMARY_RESUMED,{schedule:r.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const i=e.start;if(this.primaryLive){const n=this.primaryDetails;if(t===0)return this.hls.startPosition;if(n&&(i<n.fragmentStart||i>n.edge))return this.hls.liveSyncPosition||-1}return i}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:_i.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const n=this.primaryMedia;if(!n)return;const s=this.hls;s.media?this.checkBuffer():(this.transferMediaTo(s,n),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(Fr("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){var i;const n=this.hls;!n.loadingEnabled||!n.media||Math.abs((((i=n.mainForwardBufferInfo)==null?void 0:i.start)||n.media.currentTime)-e)>.5?n.startLoad(e,t):n.bufferingEnabled||n.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(p.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(p.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(t.level===-1||!this.schedule)return;const i=this.hls.levels[t.level],n=E(E({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=n,this.schedule.parseInterstitialDateRanges(n,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const i=this.hls.audioTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=E(E({},this.altSelection),{},{audio:i});return}const s=E(E({},n),{},{audio:i});this.mediaSelection=s}onSubtitleTrackUpdated(e,t){const i=this.hls.subtitleTracks[t.id],n=this.mediaSelection;if(!n){this.altSelection=E(E({},this.altSelection),{},{subtitles:i});return}const s=E(E({},n),{},{subtitles:i});this.mediaSelection=s}onAudioTrackSwitching(e,t){const i=et(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setAudioOption(t)||n.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=et(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setSubtitleOption(t)||t.id!==-1&&n.setSubtitleOption(i)))}onBufferCodecs(e,t){const i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){const n=this.timelinePos;this.bufferedPos=n,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let n=0;n<t.length;n++){const s=t[n];if(s.cue.post){var i;const r=this.schedule.findEventIndex(s.identifier),o=(i=this.schedule.items)==null?void 0:i[r];this.isInterstitial(o)&&this.eventItemsMatch(o,this.bufferingItem)&&this.bufferedToItem(o,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const t=this.playingItem;if(!this.playingLastItem&&t){const i=this.findItemIndex(t);this.setSchedulePosition(i+1)}else this.shouldPlay=!1}updateItem(e,t){var i;const n=(i=this.schedule)==null?void 0:i.items;if(e&&n){const s=this.findItemIndex(e,t);return n[s]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((s,r)=>{e.event.isAssetPastPlayoutLimit(r)&&this.clearAssetPlayer(s.identifier,null)});const i=e.end+.25,n=_i.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${is(e)} (was ${is(t)})`),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===((i=t.event)==null?void 0:i.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const i=this.mediaSelection;i&&((t=this.schedule)==null||t.updateSchedule(i,[],e))}checkBuffer(e){var t;const i=(t=this.schedule)==null?void 0:t.items;if(!i)return;const n=_i.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=n.len<1),this.updateBufferedPos(n.end,i,e)}updateBufferedPos(e,t,i){const n=this.schedule,s=this.bufferingItem;if(this.bufferedPos>e||!n)return;if(t.length===1&&this.itemsMatch(t[0],s)){this.bufferedPos=e;return}const r=this.playingItem,o=this.findItemIndex(r);let c=n.findItemIndexAtTime(e);if(this.bufferedPos<e){var u;const f=this.findItemIndex(s),d=Math.min(f+1,t.length-1),_=t[d];if((c===-1&&s&&e>=s.end||(u=_.event)!=null&&u.appendInPlace&&e+.01>=_.start)&&(c=d),this.isInterstitial(s)){const x=s.event;if(d-o>1&&x.appendInPlace===!1||x.assetList.length===0&&x.assetListLoader)return}if(this.bufferedPos=e,c>f&&c>o)this.bufferedToItem(_);else{const x=this.primaryDetails;this.primaryLive&&x&&e>x.edge-x.targetduration&&_.start<x.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(_)&&this.preloadAssets(_.event,0)}}else i&&r&&!this.itemsMatch(r,s)&&(c===o?this.bufferedToItem(r):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(n=>{const s=this.getAssetPlayer(n.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){const{items:n,events:s}=i;if(!n||!s)return t;const r=this.isInterstitial(e),o=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=o?o.remaining:t?t.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${is(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(r){const u=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((f,d)=>{const _=this.getAssetPlayer(f.identifier);_&&(d===u&&_.loadSource(),_.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering());this.hls.trigger(p.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:s.slice(0),schedule:n.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e,t=0){const i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(i!==null){this.bufferingAsset=null;const n=this.detachedData;n?n.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),i=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(i)}bufferedToEvent(e,t){const i=e.event,n=i.assetList.length===0&&!i.assetListLoader,s=i.cue.once;if(n||!s){const r=this.preloadAssets(i,t);if(r!=null&&r.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(r,o)}}}preloadAssets(e,t){const i=e.assetUrl,n=e.assetList.length,s=n===0&&!e.assetListLoader,r=e.cue.once;if(s){const c=e.timelineStart;if(e.appendInPlace){var o;const _=this.playingItem;!this.isInterstitial(_)&&(_==null||(o=_.nextEvent)==null?void 0:o.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let u,f=0;if(!this.playingItem&&this.primaryLive&&(f=this.hls.startPosition,f===-1&&(f=this.hls.liveSyncPosition||0)),f&&!(e.cue.pre||e.cue.post)){const _=f-c;_>0&&(u=Math.round(_*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${i?1:n} ${e}${u?` live-start: ${f} start-offset: ${u}`:""}`),i)return this.createAsset(e,0,0,c,e.duration,i);const d=this.assetListLoader.loadAssetList(e,u);d&&(e.assetListLoader=d)}else if(!r&&n){for(let u=t;u<n;u++){const f=e.assetList[u],d=this.getAssetPlayerQueueIndex(f.identifier);(d===-1||this.playerQueue[d].destroyed)&&!f.error&&this.createAssetPlayer(e,f,u)}const c=e.assetList[t];if(c){const u=this.getAssetPlayer(c.identifier);return u&&u.loadSource(),u}}return null}flushFrontBuffer(e){const t=this.requiredTracks;if(!t)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(t).forEach(n=>{this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:n})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return-1}getAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,n,s,r){const o={parentIdentifier:e.identifier,identifier:Sc(e,r,t),duration:s,startOffset:i,timelineStart:n,uri:r};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,i){const n=this.hls,s=n.userConfig;let r=s.videoPreference;const o=n.loadLevelObj||n.levels[n.currentLevel];(r||o)&&(r=g({},r),o.videoCodec&&(r.videoCodec=o.videoCodec),o.videoRange&&(r.allowedVideoRanges=[o.videoRange]));const c=n.audioTracks[n.audioTrack],u=n.subtitleTracks[n.subtitleTrack];let f=0;if(this.primaryLive||e.appendInPlace){const Le=this.timelinePos-t.timelineStart;if(Le>1){const Me=t.duration;Me&&Le<Me&&(f=Le)}}const d=t.identifier,_=E(E({},s),{},{maxMaxBufferLength:Math.min(180,n.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:n.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:n.bandwidthEstimate,interstitialsController:void 0,startPosition:f,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:r,audioPreference:c||s.audioPreference,subtitlePreference:u||s.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(_.timelineOffset=t.timelineStart));const x=_.cmcd;x!=null&&x.sessionId&&x.contentId&&(_.cmcd=g({},x,{contentId:lr(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const T=new Ac(this.HlsPlayerClass,_,e,t);this.playerQueue.push(T),e.assetList[i]=t;let B=!0;const P=Le=>{if(Le.live){var Me;const He=new Error(`Interstitials MUST be VOD assets ${e}`),Xe={fatal:!0,type:ue.OTHER_ERROR,details:G.INTERSTITIAL_ASSET_ITEM_ERROR,error:He},Oe=((Me=this.schedule)==null?void 0:Me.findEventIndex(e.identifier))||-1;this.handleAssetItemError(Xe,e,Oe,i,He.message);return}const tt=Le.edge-Le.fragmentStart,Pe=t.duration;(B||Pe===null||tt>Pe)&&(B=!1,this.log(`Interstitial asset "${d}" duration change ${Pe} > ${tt}`),t.duration=tt,this.updateSchedule())};T.on(p.LEVEL_UPDATED,(Le,{details:Me})=>P(Me)),T.on(p.LEVEL_PTS_UPDATED,(Le,{details:Me})=>P(Me)),T.on(p.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const ie=(Le,Me)=>{const tt=this.getAssetPlayer(d);if(tt&&Me.tracks){tt.off(p.BUFFER_CODECS,ie),tt.tracks=Me.tracks;const Pe=this.primaryMedia;this.bufferingAsset===tt.assetItem&&Pe&&!tt.media&&this.bufferAssetPlayer(tt,Pe)}};T.on(p.BUFFER_CODECS,ie);const _e=()=>{var Le;const Me=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${Me}`),!Me||!this.schedule)return;const tt=this.schedule.findEventIndex(e.identifier),Pe=(Le=this.schedule.items)==null?void 0:Le[tt];this.isInterstitial(Pe)&&this.advanceAssetBuffering(Pe,t)};T.on(p.BUFFERED_TO_END,_e);const de=Le=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const tt=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,tt,Le)};return T.once(p.MEDIA_ENDED,de(i)),T.once(p.PLAYOUT_LIMIT_REACHED,de(1/0)),T.on(p.ERROR,(Le,Me)=>{if(!this.schedule)return;const tt=this.getAssetPlayer(d);if(Me.details===G.BUFFER_STALLED_ERROR){if(tt!=null&&tt.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(Me,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${Me.error} ${e}`)}),T.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const Me=new Error(`Asset player destroyed unexpectedly ${d}`),tt={fatal:!0,type:ue.OTHER_ERROR,details:G.INTERSTITIAL_ASSET_ITEM_ERROR,error:Me};this.handleAssetItemError(tt,e,this.schedule.findEventIndex(e.identifier),i,Me.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Zs(t)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:T}),T}clearInterstitial(e,t){e.assetList.forEach(i=>{this.clearAssetPlayer(i.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){const i=this.getAssetPlayerQueueIndex(e);if(i!==-1){const n=this.playerQueue[i];this.log(`clear ${n} toSegment: ${t&&is(t)}`),this.transferMediaFromPlayer(n,t),this.playerQueue.splice(i,1),n.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,i,n,s){const{interstitial:r,assetItem:o,assetId:c}=e,u=r.assetList.length,f=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!f||f.identifier!==c)&&(f&&(this.clearAssetPlayer(f.identifier,i[n]),delete f.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${Zs(o)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:r,schedule:i.slice(0),scheduleIndex:n,player:e})),this.bufferAssetPlayer(e,s)}bufferAssetPlayer(e,t){var i,n;if(!this.schedule)return;const{interstitial:s,assetItem:r}=e,o=this.schedule.findEventIndex(s.identifier),c=(i=this.schedule.items)==null?void 0:i[o];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=r;const u=this.getBufferingPlayer();if(u===e)return;const f=s.appendInPlace;if(f&&(u==null?void 0:u.interstitial.appendInPlace)===!1)return;const d=(u==null?void 0:u.tracks)||((n=this.detachedData)==null?void 0:n.tracks)||this.requiredTracks;if(f&&r!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(d&&!xe(d,e.tracks)){const _=new Error(`Asset ${Zs(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),x={fatal:!0,type:ue.OTHER_ERROR,details:G.INTERSTITIAL_ASSET_ITEM_ERROR,error:_},T=s.findAssetIndex(r);this.handleAssetItemError(x,s,o,T,_.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,i=this.primaryMedia;if(!t||!i)return;const n=i.currentTime,s=t.findAssetIndex(e,n),r=e.assetList[s];if(r){const o=this.getAssetPlayer(r.identifier);if(o){const c=o.currentTime||n-r.timelineStart,u=o.duration-c;if(this.warn(`Stalled at ${c} of ${c+u} in ${o} ${e} (media.currentTime: ${n})`),c&&(u/i.playbackRate<.5||o.bufferedInPlaceToEnd(i))&&o.hls){const f=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,f,s)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,i,n,s){if(e.details===G.BUFFER_STALLED_ERROR)return;const r=t.assetList[n]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${r&&Zs(r)} ${e.error}`),!this.schedule)return;const o=(r==null?void 0:r.identifier)||"",c=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[c]||null,f=this.schedule.items,d=g({},e,{fatal:!1,errorAction:Qi(!0),asset:r,assetListIndex:n,event:t,schedule:f,scheduleIndex:i,player:u});if(this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const _=this.playingAsset,x=this.bufferingAsset,T=new Error(s);if(r&&(this.clearAssetPlayer(o,null),r.error=T),!t.assetList.some(B=>!B.error))t.error=T;else for(let B=n;B<t.assetList.length;B++)this.resetAssetPlayer(t.assetList[B].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):_&&_.identifier===o?this.advanceAfterAssetEnded(t,i,n):x&&x.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,x)}primaryFallback(e){const t=e.timelineStart,i=this.effectivePlayingItem;if(i){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${is(i)} error: ${e.error}`);let n=this.timelinePos;n===-1&&(n=this.hls.startPosition);const s=this.updateItem(i,n);if(this.itemsMatch(i,s)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const r=this.schedule.findItemIndexAtTime(n);this.setSchedulePosition(r)}else this.checkStart()}onAssetListLoaded(e,t){var i,n;const s=t.event,r=s.identifier,o=t.assetListResponse.ASSETS;if(!((i=this.schedule)!=null&&i.hasEvent(r)))return;const c=s.timelineStart,u=s.duration;let f=0;o.forEach((B,P)=>{const ie=parseFloat(B.DURATION);this.createAsset(s,P,f,c+f,ie,B.URI),f+=ie}),s.duration=f,this.log(`Loaded asset-list with duration: ${f} (was: ${u}) ${s}`);const d=this.waitingItem,_=(d==null?void 0:d.event.identifier)===r;this.updateSchedule();const x=(n=this.bufferingItem)==null?void 0:n.event;if(_){var T;const B=this.schedule.findEventIndex(r),P=(T=this.schedule.items)==null?void 0:T[B];if(P){if(!this.playingItem&&this.timelinePos>P.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==B){s.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${s}`),this.updateSchedule(!0),this.primaryFallback(s);return}this.setBufferingItem(P)}this.setSchedulePosition(B)}else if((x==null?void 0:x.identifier)===r){const B=s.assetList[0];if(B){const P=this.getAssetPlayer(B.identifier);if(x.appendInPlace){const ie=this.primaryMedia;P&&ie&&this.bufferAssetPlayer(P,ie)}else P&&P.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case G.ASSET_LIST_PARSING_ERROR:case G.ASSET_LIST_LOAD_ERROR:case G.ASSET_LIST_LOAD_TIMEOUT:{const i=t.interstitial;i&&(this.updateSchedule(!0),this.primaryFallback(i));break}case G.BUFFER_STALLED_ERROR:{const i=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&i.event.appendInPlace){this.handleInPlaceStall(i.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Fo=500;class Ic extends Es{constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",oe.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(p.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(p.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=lt.IDLE,this.setInterval(Fo),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:n}=t;if(this.fragContextChanged(i)||(Ee(i)&&(this.fragPrevious=i),this.state=lt.IDLE),!n)return;const s=this.tracksBuffered[this.currentTrackId];if(!s)return;let r;const o=i.start;for(let u=0;u<s.length;u++)if(o>=s[u].start&&o<=s[u].end){r=s[u];break}const c=i.start+i.duration;r?r.end=c:(r={start:o,end:c},s.push(r)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:i,endOffset:n}=t;if(i===0&&n!==Number.POSITIVE_INFINITY){const s=n-1;if(s<=0)return;t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(r=>{for(let o=0;o<r.length;){if(r[o].end<=s){r.shift();continue}else if(r[o].start<s)r[o].start=s;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(i,s,oe.SUBTITLE)}}onError(e,t){const i=t.frag;(i==null?void 0:i.type)===oe.SUBTITLE&&(t.details===G.FRAG_GAP&&this.fragmentTracker.fragBuffered(i,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==lt.STOPPED&&(this.state=lt.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&ho(this.levels,t)){this.levels=t.map(i=>new yt(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new yt(i);return this.tracksBuffered[n.id]=[],n}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,oe.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.state!==lt.STOPPED&&this.setInterval(Fo)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:n,levels:s}=this,{details:r,id:o}=t;if(!s){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const c=s[o];if(o>=s.length||!c)return;this.log(`Subtitle track ${o} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(r.live||(i=c.details)!=null&&i.live){if(r.deltaUpdateFailed)return;const d=this.mainDetails;if(!d){this.startFragRequested=!1;return}const _=d.fragments[0];if(!c.details)r.hasProgramDateTime&&d.hasProgramDateTime?(ys(r,d),u=r.fragmentStart):_&&(u=_.start,er(r,u));else{var f;u=this.alignPlaylists(r,c.details,(f=this.levelLastLoaded)==null?void 0:f.details),u===0&&_&&(u=_.start,er(r,u))}d&&!this.startFragRequested&&this.setStartPosition(d,u)}c.details=r,this.levelLastLoaded=c,o===n&&(this.hls.trigger(p.SUBTITLE_TRACK_UPDATED,{details:r,id:o,groupId:t.groupId}),this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===lt.IDLE&&(wi(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,n=t.decryptdata,s=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&n!=null&&n.key&&n.iv&&wn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,un(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();s.trigger(p.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:r,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=lt.IDLE})}}doTick(){if(!this.media){this.state=lt.IDLE;return}if(this.state===lt.IDLE){const{currentTrackId:e,levels:t}=this,i=t==null?void 0:t[e];if(!i||!t.length||!i.details||this.waitForLive(i))return;const{config:n}=this,s=this.getLoadPosition(),r=_i.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],s,n.maxBufferHole),{end:o,len:c}=r,u=i.details,f=this.hls.maxBufferLength+u.levelTargetDuration;if(c>f)return;const d=u.fragments,_=d.length,x=u.edge;let T=null;const B=this.fragPrevious;if(o<x){const _e=n.maxFragLookUpTolerance,de=o>x-_e?0:_e;T=wi(B,d,Math.max(d[0].start,o),de),!T&&B&&B.start<d[0].start&&(T=d[0])}else T=d[_-1];if(T=this.filterReplacedPrimary(T,i.details),!T)return;const P=T.sn-u.startSN,ie=d[P-1];if(ie&&ie.cc===T.cc&&this.fragmentTracker.getState(ie)===Ri.NOT_LOADED&&(T=ie),this.fragmentTracker.getState(T)===Ri.NOT_LOADED){const _e=this.mapToInitFragWhenRequired(T);_e&&this.loadFragment(_e,i,o)}}}loadFragment(e,t,i){Ee(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Dc(this.tracksBuffered[this.currentTrackId]||[])}}class Dc{constructor(e){this.buffered=void 0;const t=(i,n,s)=>{if(n=n>>>0,n>s-1)throw new DOMException(`Failed to execute '${i}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${s})`);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)}}}}const Cc={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},Bo=a=>String.fromCharCode(Cc[a]||a),ns=15,Ss=100,kc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Pc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Oc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Mc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Nc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Fc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;ne.log(`${this.time} [${e}] ${i}`)}}}const Cs=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class Uo{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 Bc{constructor(){this.uchar=" ",this.penState=new Uo}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 Uc{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Uo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Ss;t++)this.chars.push(new Bc);this.logger=e}equals(e){for(let t=0;t<Ss;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Ss;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Ss;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>Ss&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ss)}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=Bo(e);if(this.pos>=Ss){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<Ss;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<Ss;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 xa{constructor(e){this.rows=[],this.currRow=ns-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<ns;t++)this.rows.push(new Uc(e));this.logger=e}reset(){for(let e=0;e<ns;e++)this.rows[e].clear();this.currRow=ns-1}equals(e){let t=!0;for(let i=0;i<ns;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<ns;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<ns;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 = "+ht(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<ns;o++)this.rows[o].clear();const s=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const o=r.rows[s].cueStartTime,c=this.logger.time;if(o!==null&&c!==null&&o<c)for(let u=0;u<this.nrRollUpRows;u++)this.rows[t-this.nrRollUpRows+u+1].copy(r.rows[s+u])}}this.currRow=t;const i=this.rows[this.currRow];if(e.indent!==null){const s=e.indent,r=Math.max(s-1,0);i.setCursor(e.indent),e.color=i.chars[r].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 = "+ht(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 s=0;s<ns;s++){const r=this.rows[s].getTextString();r&&(n=s+1,e?t.push("Row "+n+": '"+r+"'"):t.push(r.trim()))}return t.length>0&&(e?i="["+t.join(" | ")+"]":i=t.join(`
`)),i}getTextAndFormat(){return this.rows}}class Ko{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 xa(i),this.nonDisplayedMemory=new xa(i),this.lastOutputScreen=new xa(i),this.currRollUpRow=this.displayedMemory.rows[ns-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[ns-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: "+ht(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 $o{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=$c(),this.logger=void 0;const n=this.logger=new Fc;this.channels=[null,new Ko(e,t,n),new Ko(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,s=t[i+1]&127;let r=!1,o=null;if(n===0&&s===0)continue;this.logger.log(3,()=>"["+Cs([t[i],t[i+1]])+"] -> ("+Cs([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(Kc(n,s,c)){Br(null,null,c),this.logger.log(3,()=>"Repeated command ("+Cs([n,s])+") is dropped");continue}Br(n,s,this.cmdHistory),r=this.parseCmd(n,s),r||(r=this.parseMidrow(n,s)),r||(r=this.parsePAC(n,s)),r||(r=this.parseBackgroundAttributes(n,s))}else Br(null,null,c);if(!r&&(o=this.parseChars(n,s),o)){const f=this.currentChannel;f&&f>0?this.channels[f].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!r&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Cs([n,s])+" orig: "+Cs([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 s=e===20||e===21||e===23?1:2,r=this.channels[s];return e===20||e===21||e===28||e===29?t===32?r.ccRCL():t===33?r.ccBS():t===34?r.ccAOF():t===35?r.ccAON():t===36?r.ccDER():t===37?r.ccRU(2):t===38?r.ccRU(3):t===39?r.ccRU(4):t===40?r.ccFON():t===41?r.ccRDC():t===42?r.ccTR():t===43?r.ccRTD():t===44?r.ccEDM():t===45?r.ccCR():t===46?r.ccENM():t===47&&r.ccEOC():r.ccTO(t-32),this.currentChannel=s,!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 ("+Cs([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,s=(e===16||e===24)&&t>=64&&t<=95;if(!(n||s))return!1;const r=e<=23?1:2;t>=64&&t<=95?i=r===1?kc[e]:Oc[e]:i=r===1?Pc[e]:Mc[e];const o=this.channels[r];return o?(o.setPAC(this.interpretPAC(i,t)),this.currentChannel=r,!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,s=null;if(e>=25?(i=2,s=e-8):(i=1,s=e),s>=17&&s<=19){let r;s===17?r=t+80:s===18?r=t+112:r=t+144,this.logger.log(2,()=>"Special char '"+Bo(r)+"' in channel "+i),n=[r]}else e>=32&&e<=127&&(n=t===0?[e]:[e,t]);return n&&this.logger.log(3,()=>"Char codes = "+Cs(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 s;const r={};e===16||e===24?(s=Math.floor((t-32)/2),r.background=Nc[s],t%2===1&&(r.background=r.background+"_semi")):t===45?r.background="transparent":(r.foreground="black",t===47&&(r.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(r),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Br(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 Br(a,e,t){t.a=a,t.b=e}function Kc(a,e,t){return t.a===a&&t.b===e}function $c(){return{a:null,b:null}}var Ta=function(){if(Qn!=null&&Qn.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,c){if(typeof c!="string"||!Array.isArray(o))return!1;const u=c.toLowerCase();return~o.indexOf(u)?u:!1}function i(o){return t(a,o)}function n(o){return t(e,o)}function s(o,...c){let u=1;for(;u<arguments.length;u++){const f=arguments[u];for(const d in f)o[d]=f[d]}return o}function r(o,c,u){const f=this,d={enumerable:!0};f.hasBeenReset=!1;let _="",x=!1,T=o,B=c,P=u,ie=null,_e="",de=!0,Le="auto",Me="start",tt=50,Pe="middle",He=50,Xe="middle";Object.defineProperty(f,"id",s({},d,{get:function(){return _},set:function(Oe){_=""+Oe}})),Object.defineProperty(f,"pauseOnExit",s({},d,{get:function(){return x},set:function(Oe){x=!!Oe}})),Object.defineProperty(f,"startTime",s({},d,{get:function(){return T},set:function(Oe){if(typeof Oe!="number")throw new TypeError("Start time must be set to a number.");T=Oe,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",s({},d,{get:function(){return B},set:function(Oe){if(typeof Oe!="number")throw new TypeError("End time must be set to a number.");B=Oe,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",s({},d,{get:function(){return P},set:function(Oe){P=""+Oe,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",s({},d,{get:function(){return ie},set:function(Oe){ie=Oe,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",s({},d,{get:function(){return _e},set:function(Oe){const ft=i(Oe);if(ft===!1)throw new SyntaxError("An invalid or illegal string was specified.");_e=ft,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",s({},d,{get:function(){return de},set:function(Oe){de=!!Oe,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",s({},d,{get:function(){return Le},set:function(Oe){if(typeof Oe!="number"&&Oe!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Le=Oe,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",s({},d,{get:function(){return Me},set:function(Oe){const ft=n(Oe);if(!ft)throw new SyntaxError("An invalid or illegal string was specified.");Me=ft,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",s({},d,{get:function(){return tt},set:function(Oe){if(Oe<0||Oe>100)throw new Error("Position must be between 0 and 100.");tt=Oe,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",s({},d,{get:function(){return Pe},set:function(Oe){const ft=n(Oe);if(!ft)throw new SyntaxError("An invalid or illegal string was specified.");Pe=ft,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",s({},d,{get:function(){return He},set:function(Oe){if(Oe<0||Oe>100)throw new Error("Size must be between 0 and 100.");He=Oe,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",s({},d,{get:function(){return Xe},set:function(Oe){const ft=n(Oe);if(!ft)throw new SyntaxError("An invalid or illegal string was specified.");Xe=ft,this.hasBeenReset=!0}})),f.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class Gc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Go(a){function e(i,n,s,r){return(i|0)*3600+(n|0)*60+(s|0)+parseFloat(r||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 Vc{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 Vo(a,e,t,i){const n=i?a.split(i):[a];for(const s in n){if(typeof n[s]!="string")continue;const r=n[s].split(t);if(r.length!==2)continue;const o=r[0],c=r[1];e(o,c)}}const Aa=new Ta(0,0,""),Ur=Aa.align==="middle"?"middle":"center";function jc(a,e,t){const i=a;function n(){const o=Go(a);if(o===null)throw new Error("Malformed timestamp: "+i);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function s(o,c){const u=new Vc;Vo(o,function(_,x){let T;switch(_){case"region":for(let B=t.length-1;B>=0;B--)if(t[B].id===x){u.set(_,t[B].region);break}break;case"vertical":u.alt(_,x,["rl","lr"]);break;case"line":T=x.split(","),u.integer(_,T[0]),u.percent(_,T[0])&&u.set("snapToLines",!1),u.alt(_,T[0],["auto"]),T.length===2&&u.alt("lineAlign",T[1],["start",Ur,"end"]);break;case"position":T=x.split(","),u.percent(_,T[0]),T.length===2&&u.alt("positionAlign",T[1],["start",Ur,"end","line-left","line-right","auto"]);break;case"size":u.percent(_,x);break;case"align":u.alt(_,x,["start",Ur,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let f=u.get("line","auto");f==="auto"&&Aa.line===-1&&(f=-1),c.line=f,c.lineAlign=u.get("lineAlign","start"),c.snapToLines=u.get("snapToLines",!0),c.size=u.get("size",100),c.align=u.get("align",Ur);let d=u.get("position","auto");d==="auto"&&Aa.position===50&&(d=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=d}function r(){a=a.replace(/^\s+/,"")}if(r(),e.startTime=n(),r(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);a=a.slice(3),r(),e.endTime=n(),r(),s(a,e)}function jo(a){return a.replace(/<br(?: \/)?>/gi,`
`)}class Hc{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Gc,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 s=t.buffer,r=0;for(s=jo(s);r<s.length&&s[r]!=="\r"&&s[r]!==`
`;)++r;const o=s.slice(0,r);return s[r]==="\r"&&++r,s[r]===`
`&&++r,t.buffer=s.slice(r),o}function n(s){Vo(s,function(r,o){},/:/)}try{let s="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;s=i();const o=s.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let r=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(r?r=!1:s=i(),t.state){case"HEADER":/:/.test(s)?n(s):s||(t.state="ID");continue;case"NOTE":s||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(s)){t.state="NOTE";break}if(!s)continue;if(t.cue=new Ta(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{jc(s,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=s.indexOf("-->")!==-1;if(!s||o&&(r=!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+=s}continue;case"BADCUE":s||(t.state="ID")}}}catch(s){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 Wc=/\r\n|\n\r|\n|\r/g,wa=function(e,t,i=0){return e.slice(i,i+t.length)===t},Zc=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),n=parseInt(e.slice(-9,-7)),s=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!F(t)||!F(i)||!F(n)||!F(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*s,t};function Ra(a,e,t){return lr(a.toString())+lr(e.toString())+lr(t)}const zc=function(e,t,i){let n=e[t],s=e[n.prevCC];if(!s||!s.new&&n.new){e.ccOffset=e.presentationOffset=n.start,n.new=!1;return}for(;(r=s)!=null&&r.new;){var r;e.ccOffset+=n.start-s.start,n.new=!1,n=s,s=e[n.prevCC]}e.presentationOffset=i};function Yc(a,e,t,i,n,s,r){const o=new Hc,c=$e(new Uint8Array(a)).trim().replace(Wc,`
`).split(`
`),u=[],f=e?ru(e.baseTime,e.timescale):0;let d="00:00.000",_=0,x=0,T,B=!0;o.oncue=function(P){const ie=t[i];let _e=t.ccOffset;const de=(_-f)/9e4;if(ie!=null&&ie.new&&(x!==void 0?_e=t.ccOffset=ie.start:zc(t,i,de)),de){if(!e){T=new Error("Missing initPTS for VTT MPEGTS");return}_e=de-t.presentationOffset}const Le=P.endTime-P.startTime,Me=Wn((P.startTime+_e-x)*9e4,n*9e4)/9e4;P.startTime=Math.max(Me,0),P.endTime=Math.max(Me+Le,0);const tt=P.text.trim();P.text=decodeURIComponent(encodeURIComponent(tt)),P.id||(P.id=Ra(P.startTime,P.endTime,tt)),P.endTime>0&&u.push(P)},o.onparsingerror=function(P){T=P},o.onflush=function(){if(T){r(T);return}s(u)},c.forEach(P=>{if(B)if(wa(P,"X-TIMESTAMP-MAP=")){B=!1,P.slice(16).split(",").forEach(ie=>{wa(ie,"LOCAL:")?d=ie.slice(6):wa(ie,"MPEGTS:")&&(_=parseInt(ie.slice(7)))});try{x=Zc(d)/1e3}catch(ie){T=ie}return}else P===""&&(B=!1);o.parse(P+`
`)}),o.flush()}const La="stpp.ttml.im1t",Ho=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Wo=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Xc={left:"start",center:"center",right:"end",start:"start",end:"end"};function Zo(a,e,t,i){const n=ee(new Uint8Array(a),["mdat"]);if(n.length===0){i(new Error("Could not parse IMSC1 mdat"));return}const s=n.map(o=>$e(o)),r=su(e.baseTime,1,e.timescale);try{s.forEach(o=>t(qc(o,r)))}catch(o){i(o)}}function qc(a,e){const n=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");const s={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},r=Object.keys(s).reduce((d,_)=>(d[_]=n.getAttribute(`ttp:${_}`)||s[_],d),{}),o=n.getAttribute("xml:space")!=="preserve",c=zo(Ia(n,"styling","style")),u=zo(Ia(n,"layout","region")),f=Ia(n,"body","[begin]");return[].map.call(f,d=>{const _=Yo(d,o);if(!_||!d.hasAttribute("begin"))return null;const x=Ca(d.getAttribute("begin"),r),T=Ca(d.getAttribute("dur"),r);let B=Ca(d.getAttribute("end"),r);if(x===null)throw Xo(d);if(B===null){if(T===null)throw Xo(d);B=x+T}const P=new Ta(x-e,B-e,_);P.id=Ra(P.startTime,P.endTime,P.text);const ie=u[d.getAttribute("region")],_e=c[d.getAttribute("style")],de=Qc(ie,_e,c),{textAlign:Le}=de;if(Le){const Me=Xc[Le];Me&&(P.lineAlign=Me),P.align=Le}return g(P,de),P}).filter(d=>d!==null)}function Ia(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function zo(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function Yo(a,e){return[].slice.call(a.childNodes).reduce((t,i,n)=>{var s;return i.nodeName==="br"&&n?t+`
`:(s=i.childNodes)!=null&&s.length?Yo(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function Qc(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let n=null;const s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],r=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return r&&t.hasOwnProperty(r)&&(n=t[r]),s.reduce((o,c)=>{const u=Da(e,i,c)||Da(a,i,c)||Da(n,i,c);return u&&(o[c]=u),o},{})}function Da(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function Xo(a){return new Error(`Could not parse ttml timestamp ${a}`)}function Ca(a,e){if(!a)return null;let t=Go(a);return t===null&&(Ho.test(a)?t=Jc(a,e):Wo.test(a)&&(t=eh(a,e))),t}function Jc(a,e){const t=Ho.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 eh(a,e){const t=Wo.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 Kr{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class th{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=Jo(),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(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(p.FRAG_LOADING,this.onFragLoading,this),e.on(p.FRAG_LOADED,this.onFragLoaded,this),e.on(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(p.FRAG_LOADING,this.onFragLoading,this),e.off(p.FRAG_LOADED,this.onFragLoaded,this),e.off(p.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(p.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(p.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(p.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new Kr(this,"textTrack1"),t=new Kr(this,"textTrack2"),i=new Kr(this,"textTrack3"),n=new Kr(this,"textTrack4");this.cea608Parser1=new $o(1,e,t),this.cea608Parser2=new $o(3,i,n)}addCues(e,t,i,n,s){let r=!1;for(let o=s.length;o--;){const c=s[o],u=ih(c[0],c[1],t,i);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],i),r=!0,u/(i-t)>.5))return}if(r||s.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(p.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:n,timescale:s,trackId:r}){const{unparsedVttFrags:o}=this;i===oe.MAIN&&(this.initPTS[t.cc]={baseTime:n,timescale:s,trackId:r}),o.length&&(this.unparsedVttFrags=[],o.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded(p.FRAG_LOADED,c):this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let n=0;n<i.textTracks.length;n++){const s=i.textTracks[n];if(Qo(s,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return s}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:s,languageCode:r}=t[e],o=this.getExistingTrack(s,r);if(o)i[e]=o,Hs(i[e]),ko(i[e],n);else{const c=this.createTextTrack("captions",s,r);c&&(c[e]=!0,i[e]=c)}}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(p.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,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const i=!!t.transferMedia;if(this.media=null,i)return;const{captionsTracks:n}=this;Object.keys(n).forEach(s=>{Hs(n[s]),delete n[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Jo(),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++)Hs(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(s=>s.textCodec===La);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(ho(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Mr(r.textTracks):null;if(this.tracks.forEach((c,u)=>{let f;if(o){let d=null;for(let _=0;_<o.length;_++)if(o[_]&&Qo(o[_],c)){d=o[_],o[_]=null;break}d&&(f=d)}if(f)Hs(f);else{const d=qo(c);f=this.createTextTrack(d,c.name,c.lang),f&&(f.mode="disabled")}f&&this.textTracks.push(f)}),o!=null&&o.length){const c=o.filter(u=>u!==null).map(u=>u.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const r=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:r})}}}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 s=`textTrack${n[1]}`,r=this.captionsProperties[s];r&&(r.label=i.name,i.lang&&(r.languageCode=i.lang),r.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===oe.MAIN){var i,n;const{cea608Parser1:s,cea608Parser2:r,lastSn:o}=this,{cc:c,sn:u}=t.frag,f=(i=(n=t.part)==null?void 0:n.index)!=null?i:-1;s&&r&&(u!==o+1||u===o&&f!==this.lastPartIndex+1||c!==this.lastCc)&&(s.reset(),r.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=f}}onFragLoaded(e,t){const{frag:i,payload:n}=t;if(i.type===oe.SUBTITLE)if(n.byteLength){const s=i.decryptdata,r="stats"in t;if(s==null||!s.encrypted||r){const o=this.tracks[i.level],c=this.vttCCs;c[i.cc]||(c[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),o&&o.textCodec===La?this._parseIMSC1(i,n):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;Zo(t,this.initPTS[e.cc],n=>{this._appendCues(n,e.level),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},n=>{i.logger.log(`Failed to parse IMSC1: ${n}`),i.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:n})})}_parseVTTs(e){var t;const{frag:i,payload:n}=e,{initPTS:s,unparsedVttFrags:r}=this,o=s.length-1;if(!s[i.cc]&&o===-1){r.push(e);return}const c=this.hls,u=(t=i.initSegment)!=null&&t.data?Ke(i.initSegment.data,new Uint8Array(n)).buffer:n;Yc(u,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,f=>{this._appendCues(f,i.level),c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})},f=>{const d=f.message==="Missing initPTS for VTT MPEGTS";d?r.push(e):this._fallbackToIMSC1(i,n),c.logger.log(`Failed to parse VTT cue: ${f}`),!(d&&o>i.cc)&&c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:f})})}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||Zo(t,this.initPTS[e.cc],()=>{i.textCodec=La,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(s=>Po(n,s))}else{const n=this.tracks[t];if(!n)return;const s=n.default?"default":"subtitles"+t;i.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:s})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===oe.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:i,samples:n}=t;if(!(i.type===oe.MAIN&&this.closedCaptionsForLevel(i)==="NONE"))for(let s=0;s<n.length;s++){const r=n[s].bytes;if(r){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(r);this.cea608Parser1.addData(n[s].pts,o[0]),this.cea608Parser2.addData(n[s].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:i,endOffsetSubtitles:n,type:s}){const{media:r}=this;if(!(!r||r.currentTime<i)){if(!s||s==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>Ea(o[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>Ea(o[c],t,n))}}}extractCea608Data(e){const t=[[],[]],i=e[0]&31;let n=2;for(let s=0;s<i;s++){const r=e[n++],o=127&e[n++],c=127&e[n++];if(o===0&&c===0)continue;if((4&r)!==0){const f=3&r;(f===0||f===1)&&(t[f].push(o),t[f].push(c))}}return t}}function qo(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function Qo(a,e){return!!a&&a.kind===qo(e)&&fa(e,a)}function ih(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function Jo(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const nh=/\s/,sh={newCue(a,e,t,i){const n=[];let s,r,o,c,u;const f=self.VTTCue||self.TextTrackCue;for(let _=0;_<i.rows.length;_++)if(s=i.rows[_],o=!0,c=0,u="",!s.isEmpty()){var d;for(let B=0;B<s.chars.length;B++)nh.test(s.chars[B].uchar)&&o?c++:(u+=s.chars[B].uchar,o=!1);s.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const x=jo(u.trim()),T=Ra(e,t,x);a!=null&&(d=a.cues)!=null&&d.getCueById(T)||(r=new f(e,t,x),r.id=T,r.line=_+1,r.align="left",r.position=10+Math.min(80,Math.floor(c*8/32)*10),n.push(r))}return a&&n.length&&(n.sort((_,x)=>_.line==="auto"||x.line==="auto"?0:_.line>8&&x.line>8?x.line-_.line:_.line-x.line),n.forEach(_=>Po(a,_))),n}};function rh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const ah=/(\d+)-(\d+)\/(\d+)/;class el{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||ch,this.controller=new self.AbortController,this.stats=new b}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 s=oh(e,this.controller.signal),r=e.responseType==="arraybuffer",o=r?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,s),self.clearTimeout(this.requestTimeout),t.timeout=c&&F(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(ar(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var _;this.response=this.loader=d;const x=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},u-(x-n.loading.start)),!d.ok){const{status:B,statusText:P}=d;throw new hh(P||"fetch, bad network response",B,d)}n.loading.first=x,n.total=uh(d.headers)||n.total;const T=(_=this.callbacks)==null?void 0:_.onProgress;return T&&F(t.highWaterMark)?this.loadProgressively(d,n,e,t.highWaterMark,T):r?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{var _,x;const T=this.response;if(!T)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const B=d[o];B&&(n.loaded=n.total=B);const P={url:T.url,data:d,code:T.status},ie=(_=this.callbacks)==null?void 0:_.onProgress;ie&&!F(t.highWaterMark)&&ie(n,e,d,T),(x=this.callbacks)==null||x.onSuccess(P,n,e,T)}).catch(d=>{var _;if(self.clearTimeout(this.requestTimeout),n.aborted)return;const x=d&&d.code||0,T=d?d.message:null;(_=this.callbacks)==null||_.onError({code:x,text:T},e,d?d.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,s){const r=new Tr,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return r.dataLength&&s(t,i,r.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const f=u.value,d=f.length;return t.loaded+=d,d<n||r.dataLength?(r.push(f),r.dataLength>=n&&s(t,i,r.flush().buffer,e)):s(t,i,f.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function oh(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(g({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function lh(a){const e=ah.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function uh(a){const e=a.get("Content-Range");if(e){const i=lh(e);if(F(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function ch(a,e){return new self.Request(a.url,e)}class hh extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const fh=/^age:\s*[\d.]+\s*$/im;class tl{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 b,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 s=this.xhrSetup;s?Promise.resolve().then(()=>{if(!(this.loader!==i||this.stats.aborted))return s(i,t.url)}).catch(r=>{if(!(this.loader!==i||this.stats.aborted))return i.open("GET",t.url,!0),s(i,t.url)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(r=>{var o;(o=this.callbacks)==null||o.onError({code:i.status,text:r.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:s,maxLoadTimeMs:r}=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=s&&F(s)?s:r,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,s=this.config;if(!i.aborted&&n>=2&&(i.loading.first===0&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),s.timeout!==s.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),s.timeout=s.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),n===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const u=t.status,f=t.responseType==="text"?t.responseText:null;if(u>=200&&u<300){const T=f!=null?f:t.response;if(T!=null){var r,o;i.loading.end=Math.max(self.performance.now(),i.loading.first);const B=t.responseType==="arraybuffer"?T.byteLength:T.length;i.loaded=i.total=B,i.bwEstimate=i.total*8e3/(i.loading.end-i.loading.first);const P=(r=this.callbacks)==null?void 0:r.onProgress;P&&P(i,e,T,t);const ie={url:t.responseURL,data:T,code:u};(o=this.callbacks)==null||o.onSuccess(ie,i,e,t);return}}const d=s.loadPolicy.errorRetry,_=i.retry,x={url:e.url,data:void 0,code:u};if(Oi(d,_,!1,x))this.retry(d);else{var c;ne.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,i)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Oi(e,t,!0))this.retry(e);else{var i;ne.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=Fi(e,i.retry),i.retry++,ne.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&&fh.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const dh={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},ph=E(E({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:tl,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ci,bufferController:Eu,capLevelController:pa,errorController:qi,fpsController:_c,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:ji,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:dh},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},mh()),{},{subtitleStreamController:Ic,subtitleTrackController:Ec,timelineController:th,audioStreamController:gu,audioTrackController:_u,emeController:js,cmcdController:pc,contentSteeringController:gc,interstitialsController:Lc});function mh(){return{cueHandler:sh,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 gh(a,e,t){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=ka(a),n=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return n.forEach(r=>{const o=`${r==="level"?"playlist":r}LoadPolicy`,c=e[o]===void 0,u=[];s.forEach(f=>{const d=`${r}Loading${f}`,_=e[d];if(_!==void 0&&c){u.push(d);const x=i[o].default;switch(e[o]={default:x},f){case"TimeOut":x.maxLoadTimeMs=_,x.maxTimeToFirstByteMs=_;break;case"MaxRetry":x.errorRetry.maxNumRetry=_,x.timeoutRetry.maxNumRetry=_;break;case"RetryDelay":x.errorRetry.retryDelayMs=_,x.timeoutRetry.retryDelayMs=_;break;case"MaxRetryTimeout":x.errorRetry.maxRetryDelayMs=_,x.timeoutRetry.maxRetryDelayMs=_;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${ht(e[o])}`)}),E(E({},i),e)}function ka(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(ka):Object.keys(a).reduce((e,t)=>(e[t]=ka(a[t]),e),{}):a}function _h(a,e){const t=a.loader;t!==el&&t!==tl?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):rh()&&(a.loader=el,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const $r=2,vh=.1,yh=.05,Eh=100;class bh extends On{constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var i;(i=this.media)!=null&&i.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var i;this.ended=((i=this.media)==null?void 0:i.currentTime)||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(Eh),this.mediaSource=t.mediaSource;const i=this.media=t.media;En(i,"playing",this.onMediaPlaying),En(i,"waiting",this.onMediaWaiting),En(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(Ln(i,"playing",this.onMediaPlaying),Ln(i,"waiting",this.onMediaWaiting),Ln(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const t=this.media.currentTime;this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t}poll(e,t){var i,n;const s=(i=this.hls)==null?void 0:i.config;if(!s)return;const r=this.media;if(!r)return;const{seeking:o}=r,c=this.seeking&&!o,u=!this.seeking&&o,f=r.paused&&!o||r.ended||r.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,s.nudgeOnVideoHole&&!f&&e>t&&this.nudgeOnVideoHole(e,t)),this.waiting===0&&this.stallResolved(e);return}if(u||c){c&&this.stallResolved(e);return}if(f){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&r.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1}));return}if(!_i.getBuffered(r).length){this.nudgeRetry=0;return}const d=_i.bufferInfo(r,e,0),_=d.nextStart||0,x=this.fragmentTracker;if(o&&x&&this.hls){const tt=il(this.hls.inFlightFragments,e),Pe=d.len>$r,He=!_||tt||_-e>$r&&!x.getPartialFragment(e);if(Pe||He)return;this.moved=!1}const T=(n=this.hls)==null?void 0:n.latestLevelDetails;if(!this.moved&&this.stalled!==null&&x){if(!(d.len>0)&&!_)return;const Pe=Math.max(_,d.start||0)-e,Xe=!!(T!=null&&T.live)?T.targetduration*2:$r,Oe=Gr(e,x);if(Pe>0&&(Pe<=Xe||Oe)){r.paused||this._trySkipBufferHole(Oe);return}}const B=s.detectStallWithCurrentTimeMs,P=self.performance.now(),ie=this.waiting;let _e=this.stalled;if(_e===null)if(ie>0&&P-ie<B)_e=this.stalled=ie;else{this.stalled=P;return}const de=P-_e;if(!o&&(de>=B||ie)&&this.hls){var Le;if(((Le=this.mediaSource)==null?void 0:Le.readyState)==="ended"&&!(T!=null&&T.live)&&Math.abs(e-((T==null?void 0:T.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(d),!this.media||!this.hls)return}const Me=_i.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(Me,de,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const i=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(i)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(p.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;const n=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(i=this.buffered.audio)!=null&&i.length&&n&&n.length>1&&e>n.end(0)){const s=_i.bufferedInfo(_i.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=_i.timeRangesToArray(n),o=_i.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=_i.bufferedInfo(r,e,0).bufferedIndex,u=r[o].end,f=r[o+1].start;if((c===-1||c>o)&&f-u<1&&e-u<2){const d=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${u} -> ${f} buffered index: ${c}`);this.warn(d.message),this.media.currentTime+=1e-6;let _=Gr(e,this.fragmentTracker);_&&"fragment"in _?_=_.fragment:_||(_=void 0);const x=_i.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:_,buffer:x.len,bufferInfo:x})}}}}}_tryFixBufferStall(e,t,i){var n,s;const{fragmentTracker:r,media:o}=this,c=(n=this.hls)==null?void 0:n.config;if(!o||!r||!c)return;const u=(s=this.hls)==null?void 0:s.latestLevelDetails,f=Gr(i,r);if((f||u!=null&&u.live&&i<u.fragmentStart)&&(this._trySkipBufferHole(f)||!this.media))return;const d=e.buffered,_=this.adjacentTraversal(e,i);(d&&d.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-i<c.maxBufferHole||_))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const i=this.fragmentTracker,n=e.nextStart;if(i&&n){const s=i.getFragAtPos(t,oe.MAIN),r=i.getFragAtPos(n,oe.MAIN);if(s&&r)return r.sn-s.sn<2}return!1}_reportStall(e){const{hls:t,media:i,stallReported:n,stalled:s}=this;if(!n&&s!==null&&i&&t){this.stallReported=!0;const r=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${ht(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:s}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:i,media:n}=this,s=(t=this.hls)==null?void 0:t.config;if(!n||!i||!s)return 0;const r=n.currentTime,o=_i.bufferInfo(n,r,0),c=r<o.start?o.start:o.nextStart;if(c&&this.hls){const f=o.len<=s.maxBufferHole,d=o.len>0&&o.len<1&&n.readyState<3,_=c-r;if(_>0&&(f||d)){if(_>s.maxBufferHole){let T=!1;if(r===0){const B=i.getAppendedFrag(0,oe.MAIN);B&&c<B.end&&(T=!0)}if(!T&&e){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||il(this.hls.inFlightFragments,c))return 0;let P=!1,ie=e.end;for(;ie<c;){const _e=Gr(ie,i);if(_e)ie+=_e.duration;else{P=!0;break}}if(P)return 0}}const x=Math.max(c+yh,r+vh);if(this.warn(`skipping hole, adjusting currentTime from ${r} to ${x}`),this.moved=!0,n.currentTime=x,!(e!=null&&e.gap)){const T=new Error(`fragment loaded with buffer holes, seeking from ${r} to ${x}`),B={type:ue.MEDIA_ERROR,details:G.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:T,reason:T.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?B.part=e:B.frag=e),this.hls.trigger(p.ERROR,B)}return x}}return 0}_tryNudgeBuffer(e){const{hls:t,media:i,nudgeRetry:n}=this,s=t==null?void 0:t.config;if(!i||!s)return 0;const r=i.currentTime;if(this.nudgeRetry++,n<s.nudgeMaxRetry){const o=r+(n+1)*s.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${r} to ${o}`);this.warn(c.message),i.currentTime=o,t.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const o=new Error(`Playhead still not moving while enough data buffered @${r} after ${s.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function il(a,e){const t=nl(a.main);if(t&&t.start<=e)return t;const i=nl(a.audio);return i&&i.start<=e?i:null}function nl(a){if(!a)return null;switch(a.state){case lt.IDLE:case lt.STOPPED:case lt.ENDED:case lt.ERROR:return null}return a.frag}function Gr(a,e){return e.getAppendedFrag(a,oe.MAIN)||e.getPartialFragment(a)}const Sh=.25;function Pa(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Oa(a,e,t,i,n){let s=new a(e,t,"");try{s.value=i,n&&(s.type=n)}catch(r){s=new a(e,t,ht(n?E({type:n},i):i))}return s}const Vr=(()=>{const a=Pa();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class xh{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(p.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(p.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){var i;this.media=t.media,((i=t.overrides)==null?void 0:i.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const t=(e=this.hls)==null?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,!t.transferMedia&&(this.id3Track&&(this.removeCues&&Hs(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const i=e[t];if(i.kind==="metadata"&&i.label==="id3")return ko(i,this.media),i}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:i,enableID3MetadataCues:n}=this.hls.config;if(!i&&!n)return;const{samples:s}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const r=Pa();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Un.emsg&&!i||!n)continue;const u=Wa(s[o].data),f=s[o].pts;let d=f+s[o].duration;d>Vr&&(d=Vr),d-f<=0&&(d=f+Sh);for(let x=0;x<u.length;x++){const T=u[x];if(!Za(T)){this.updateId3CueEnds(f,c);const B=Oa(r,f,d,T,c);B&&this.id3Track.addCue(B)}}}}updateId3CueEnds(e,t){var i;const n=(i=this.id3Track)==null?void 0:i.cues;if(n)for(let s=n.length;s--;){const r=n[s];r.type===t&&r.startTime<e&&r.endTime===Vr&&(r.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:i,type:n}){const{id3Track:s,hls:r}=this;if(!r)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=r;if(s&&(o||c)){let u;n==="audio"?u=f=>f.type===Un.audioId3&&c:n==="video"?u=f=>f.type===Un.emsg&&o:u=f=>f.type===Un.audioId3&&c||f.type===Un.emsg&&o,Ea(s,t,i,u)}}onLevelUpdated(e,{details:t}){this.updateDateRangeCues(t,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){if(!this.hls||!this.media)return;const{assetPlayerId:i,timelineOffset:n,enableDateRangeMetadataCues:s,interstitialsController:r}=this.hls.config;if(!s)return;const o=Pa();if(i&&n&&!r){const{fragmentStart:B,fragmentEnd:P}=e;let ie=this.assetCue;ie?(ie.startTime=B,ie.endTime=P):o&&(ie=this.assetCue=Oa(o,B,P,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),ie&&(ie.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(ie),ie.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:u}=e,f=Object.keys(u);let d=this.dateRangeCuesAppended;if(c&&t){var _;if((_=c.cues)!=null&&_.length){const B=Object.keys(d).filter(P=>!f.includes(P));for(let P=B.length;P--;){var x;const ie=B[P],_e=(x=d[ie])==null?void 0:x.cues;delete d[ie],_e&&Object.keys(_e).forEach(de=>{const Le=_e[de];if(Le){Le.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(Le)}catch(Me){}}})}}else d=this.dateRangeCuesAppended={}}const T=e.fragments[e.fragments.length-1];if(!(f.length===0||!F(T==null?void 0:T.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let B=0;B<f.length;B++){const P=f[B],ie=u[P],_e=ie.startTime,de=d[P],Le=(de==null?void 0:de.cues)||{};let Me=(de==null?void 0:de.durationKnown)||!1,tt=Vr;const{duration:Pe,endDate:He}=ie;if(He&&Pe!==null)tt=_e+Pe,Me=!0;else if(ie.endOnNext&&!Me){const Oe=f.reduce((ft,jt)=>{if(jt!==ie.id){const ai=u[jt];if(ai.class===ie.class&&ai.startDate>ie.startDate&&(!ft||ie.startDate<ft.startDate))return ai}return ft},null);Oe&&(tt=Oe.startTime,Me=!0)}const Xe=Object.keys(ie.attr);for(let Oe=0;Oe<Xe.length;Oe++){const ft=Xe[Oe];if(!ms(ft))continue;const jt=Le[ft];if(jt)Me&&!(de!=null&&de.durationKnown)?jt.endTime=tt:Math.abs(jt.startTime-_e)>.01&&(jt.startTime=_e,jt.endTime=tt);else if(o){let ai=ie.attr[ft];Yn(ft)&&(ai=D(ai));const oi=Oa(o,_e,tt,{key:ft,data:ai},Un.dateRange);oi&&(oi.id=P,this.id3Track.addCue(oi),Le[ft]=oi,r&&(ft==="X-ASSET-LIST"||ft==="X-ASSET-URL")&&oi.addEventListener("enter",this.onEventCueEnter))}}d[P]={cues:Le,dateRange:ie,durationKnown:Me}}}}}class Th{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:t}=this,i=this.levelDetails;if(!t||!i)return;this.currentTime=t.currentTime;const n=this.computeLatency();if(n===null)return;this._latency=n;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||r===1||!i.live)return;const o=this.targetLatency;if(o===null)return;const c=n-o,u=Math.min(this.maxLatency,o+i.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,r)),_=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,x=Math.min(d,Math.max(1,_));this.changeMediaPlaybackRate(t,x)}else t.playbackRate!==1&&t.playbackRate!==0&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const t=this.levelDetails;return t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:t,partHoldBack:i,targetduration:n}=e,{liveSyncDuration:s,liveSyncDurationCount:r,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&i||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=s!==void 0?s:r*n);const f=n;return u+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,f)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency;if(e===null||t===null)return null;const i=this.levelDetails;if(i===null)return null;const n=i.edge,s=e-t-this.edgeStalled,r=n-i.totalduration,o=n-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(r,s),o)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(p.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(p.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(p.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(p.ERROR,this.onError,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){t.advanced&&this.onTimeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,t){var i;t.details===G.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(i=this.levelDetails)!=null&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,n;e.playbackRate!==t&&((i=this.hls)==null||i.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(n=this.targetLatency)==null?void 0:n.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${t}`),e.playbackRate=t)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}class Ah extends ha{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(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this),e.on(p.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this),e.off(p.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=[],s={},r={};let o=!1,c=!1,u=!1;t.levels.forEach(f=>{const d=f.attrs;let{audioCodec:_,videoCodec:x}=f;_&&(f.audioCodec=_=Ht(_,i)||void 0),x&&(x=f.videoCodec=Ei(x));const{width:T,height:B,unknownCodecs:P}=f;let ie=P?P.length:0;if(P)for(let Oe=ie;Oe--;){const ft=P[Oe];this.isAudioSupported(ft)?(f.audioCodec=_=_?`${_},${ft}`:ft,ie--,dt.audio[_.substring(0,4)]=2):this.isVideoSupported(ft)&&(f.videoCodec=x=x?`${x},${ft}`:ft,ie--,dt.video[x.substring(0,4)]=2)}if(o||(o=!!(T&&B)),c||(c=!!x),u||(u=!!_),ie||_&&!this.isAudioSupported(_)||x&&!this.isVideoSupported(x)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:_e,"FRAME-RATE":de,"HDCP-LEVEL":Le,"PATHWAY-ID":Me,RESOLUTION:tt,"VIDEO-RANGE":Pe}=d,Xe=`${`${Me||"."}-`}${f.bitrate}-${tt}-${de}-${_e}-${Pe}-${Le}`;if(s[Xe])if(s[Xe].uri!==f.url&&!f.attrs["PATHWAY-ID"]){const Oe=r[Xe]+=1;f.attrs["PATHWAY-ID"]=new Array(Oe+1).join(".");const ft=this.createLevel(f);s[Xe]=ft,n.push(ft)}else s[Xe].addGroupId("audio",d.AUDIO),s[Xe].addGroupId("text",d.SUBTITLES);else{const Oe=this.createLevel(f);s[Xe]=Oe,r[Xe]=1,n.push(Oe)}}),this.filterAndSortMediaOptions(n,t,o,c,u)}createLevel(e){const t=new yt(e),i=e.supplemental;if(i!=null&&i.videoCodec&&!this.isVideoSupported(i.videoCodec)){const n=new Error(`SUPPLEMENTAL-CODECS not supported "${i.videoCodec}"`);this.log(n.message),t.supportedResult=y(n,[])}return t}isAudioSupported(e){return ni(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return ni(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,s){let r=[],o=[],c=e;if((i||n)&&s&&(c=c.filter(({videoCodec:P,videoRange:ie,width:_e,height:de})=>(!!P||!!(_e&&de))&&Kt(ie))),c.length===0){Promise.resolve().then(()=>{if(this.hls){let P="no level with compatible codecs found in manifest",ie=P;t.levels.length&&(ie=`one or more CODECS in variant not supported: ${ht(t.levels.map(de=>de.attrs.CODECS).filter((de,Le,Me)=>Me.indexOf(de)===Le))}`,this.warn(ie),P+=` (${ie})`);const _e=new Error(P);this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:G.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:_e,reason:ie})}});return}t.audioTracks&&(r=t.audioTracks.filter(P=>!P.audioCodec||this.isAudioSupported(P.audioCodec)),sl(r)),t.subtitles&&(o=t.subtitles,sl(o));const u=c.slice(0);c.sort((P,ie)=>{if(P.attrs["HDCP-LEVEL"]!==ie.attrs["HDCP-LEVEL"])return(P.attrs["HDCP-LEVEL"]||"")>(ie.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&P.height!==ie.height)return P.height-ie.height;if(P.frameRate!==ie.frameRate)return P.frameRate-ie.frameRate;if(P.videoRange!==ie.videoRange)return xt.indexOf(P.videoRange)-xt.indexOf(ie.videoRange);if(P.videoCodec!==ie.videoCodec){const _e=ri(P.videoCodec),de=ri(ie.videoCodec);if(_e!==de)return de-_e}if(P.uri===ie.uri&&P.codecSet!==ie.codecSet){const _e=Rt(P.codecSet),de=Rt(ie.codecSet);if(_e!==de)return de-_e}return P.averageBitrate!==ie.averageBitrate?P.averageBitrate-ie.averageBitrate:0});let f=u[0];if(this.steering&&(c=this.steering.filterParsedLevels(c),c.length!==u.length)){for(let P=0;P<u.length;P++)if(u[P].pathwayId===c[0].pathwayId){f=u[P];break}}this._levels=c;for(let P=0;P<c.length;P++)if(c[P]===f){var d;this._firstLevel=P;const ie=f.bitrate,_e=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${c.length} level(s) found, first bitrate: ${ie}`),((d=this.hls.userConfig)==null?void 0:d.abrEwmaDefaultEstimate)===void 0){const de=Math.min(ie,this.hls.config.abrEwmaDefaultEstimateMax);de>_e&&_e===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=de)}break}const _=s&&!n,x=this.hls.config,T=!!(x.audioStreamController&&x.audioTrackController),B={levels:c,audioTracks:r,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:T&&!_&&r.some(P=>!!P.url)};this.hls.trigger(p.MANIFEST_PARSED,B)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const f=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:f,reason:f.message}),d)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,n=this.currentLevel,s=n?n.attrs["PATHWAY-ID"]:void 0,r=t[e],o=r.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=r,i===e&&n&&s===o)return;this.log(`Switching to level ${e} (${r.height?r.height+"p ":""}${r.videoRange?r.videoRange+" ":""}${r.codecSet?r.codecSet+" ":""}@${r.bitrate})${o?" with Pathway "+o:""} from level ${i}${s?" with Pathway "+s:""}`);const c={level:e,attrs:r.attrs,details:r.details,bitrate:r.bitrate,averageBitrate:r.averageBitrate,maxBitrate:r.maxBitrate,realBitrate:r.realBitrate,width:r.width,height:r.height,codecSet:r.codecSet,audioCodec:r.audioCodec,videoCodec:r.videoCodec,audioGroups:r.audioGroups,subtitleGroups:r.subtitleGroups,loaded:r.loaded,loadError:r.loadError,fragmentError:r.fragmentError,name:r.name,id:r.id,uri:r.uri,url:r.url,urlId:0,audioGroupIds:r.audioGroupIds,textGroupIds:r.textGroupIds};this.hls.trigger(p.LEVEL_SWITCHING,c);const u=r.details;if(!u||u.live){const f=this.switchParams(r.uri,n==null?void 0:n.details,u);this.loadPlaylist(f)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const t=this.steering.pathways(),i=e.filter(n=>t.indexOf(n)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=i}}onError(e,t){t.fatal||!t.context||t.context.type===ve.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===oe.MAIN){const i=t.elementaryStreams;if(!Object.keys(i).some(s=>!!i[s]))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:s}=t,r=t.levelInfo;if(!r){var o;this.warn(`Invalid level index ${n}`),(o=t.deliveryDirectives)!=null&&o.skip&&(s.deltaUpdateFailed=!0);return}if(r===this.currentLevel||t.withoutMultiVariant){r.fragmentError===0&&(r.loadError=0);let c=r.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(n,t,c)}else(i=t.deliveryDirectives)!=null&&i.skip&&(s.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const i=this.getUrlWithDirectives(e.uri,t),n=this.currentLevelIndex,s=e.attrs["PATHWAY-ID"],r=e.details,o=r==null?void 0:r.age;this.log(`Loading level index ${n}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${s?" Pathway "+s:""}${o&&r.live?" age "+o.toFixed(1)+(r.type?" "+r.type||0:""):""} ${i}`),this.hls.trigger(p.LEVEL_LOADING,{url:i,level:n,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(this._levels.length===1)return;const i=this._levels.filter((s,r)=>r!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(o=>o.level=-1)),!1));br(i),this._levels=i,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const n=i.length-1;this._firstLevel=Math.min(this._firstLevel,n),this._startLevel&&(this._startLevel=Math.min(this._startLevel,n)),this.hls.trigger(p.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(p.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function sl(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function rl(){return self.SourceBuffer||self.WebKitSourceBuffer}function al(){if(!ye())return!1;const e=rl();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function wh(){if(!al())return!1;const a=ye();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(Wt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(Wt(e,"audio"))))}function Rh(){var a;const e=rl();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Lh=100;class Ih extends Es{constructor(e,t,i){super(e,t,i,"stream-controller",oe.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const n=this.media,s=n?n.currentTime:null;if(s===null||!F(s)||(this.log(`Media seeked to ${s.toFixed(3)}`),!this.getBufferedFrag(s)))return;const r=this.getFwdBufferInfoAtPos(n,s,oe.MAIN,0);if(r===null||r.len===0){this.warn(`Main forward buffer length at ${s} on "seeked" event ${r?r.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(p.MANIFEST_PARSED,this.onManifestParsed,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.LEVEL_LOADED,this.onLevelLoaded,this),e.on(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(p.BUFFER_CREATED,this.onBufferCreated,this),e.on(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(p.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(p.MANIFEST_PARSED,this.onManifestParsed,this),e.off(p.LEVEL_LOADED,this.onLevelLoaded,this),e.off(p.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(p.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(p.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(p.BUFFER_CREATED,this.onBufferCreated,this),e.off(p.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(p.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,t){if(this.levels){const{lastCurrentTime:i,hls:n}=this;if(this.stopLoad(),this.setInterval(Lh),this.level=-1,!this.startFragRequested){let s=n.startLevel;s===-1&&(n.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=n.firstAutoLevel),n.nextLoadLevel=s,this.level=n.loadLevel,this._hasEnoughToStart=!!t}i>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i),this.state=lt.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=lt.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case lt.WAITING_LEVEL:{const{levels:e,level:t}=this,i=e==null?void 0:e[t],n=i==null?void 0:i.details;if(n&&(!n.live||this.levelLastLoaded===i&&!this.waitForLive(i))){if(this.waitForCdnTuneIn(n))break;this.state=lt.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=lt.IDLE;break}break}case lt.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===lt.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:n}=this;if(t===null||!n&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const s=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(i!=null&&i[s]))return;const r=i[s],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const B={};this.altAudio===2&&(B.type="video"),this.hls.trigger(p.BUFFER_EOS,B),this.state=lt.ENDED;return}if(!this.buffering)return;e.loadLevel!==s&&e.manualLevel===-1&&this.log(`Adapting to level ${s} from level ${this.level}`),this.level=e.nextLoadLevel=s;const u=r.details;if(!u||this.state===lt.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=lt.WAITING_LEVEL,this.startFragRequested=!1;return}const f=o.len,d=this.getMaxBufferLength(r.maxBitrate);if(f>=d)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const _=this.backtrackFragment?this.backtrackFragment.start:o.end;let x=this.getNextFragment(_,u);if(this.couldBacktrack&&!this.fragPrevious&&x&&Ee(x)&&this.fragmentTracker.getState(x)!==Ri.OK){var T;const P=((T=this.backtrackFragment)!=null?T:x).sn-u.startSN,ie=u.fragments[P-1];ie&&x.cc===ie.cc&&(x=ie,this.fragmentTracker.removeFragment(ie))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(x&&this.isLoopLoading(x,_)){if(!x.gap){const P=this.audioOnly&&!this.altAudio?K.AUDIO:K.VIDEO,ie=(P===K.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;ie&&this.afterBufferFlushed(ie,P,oe.MAIN)}x=this.getNextFragmentLoopLoading(x,u,o,oe.MAIN,d)}x&&(x.initSegment&&!x.initSegment.data&&!this.bitrateTest&&(x=x.initSegment),this.loadFragment(x,r,_))}loadFragment(e,t,i){const n=this.fragmentTracker.getState(e);n===Ri.NOT_LOADED||n===Ri.PARTIAL?Ee(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,oe.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 s=this.getLevelDetails();if(s!=null&&s.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<s.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,c=e[o],u=this.fragLastKbps;u&&this.fragCurrent?i=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:i=0}else i=0;const r=this.getBufferedFrag(t.currentTime+i);if(r){const o=this.followingBufferedFrag(r);if(o){this.abortCurrentFrag();const c=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,f=Math.max(r.end,c+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(f,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 lt.KEY_LOADING:case lt.FRAG_LOADING:case lt.FRAG_LOADING_WAITING_RETRY:case lt.PARSING:case lt.PARSED:this.state=lt.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio===2?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;En(i,"playing",this.onMediaPlaying),En(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(Ln(i,"playing",this.onMediaPlaying),Ln(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,t),!t.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(p.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,n=!1;for(let s=0;s<t.levels.length;s++){const r=t.levels[s].audioCodec;r&&(i=i||r.indexOf("mp4a.40.2")!==-1,n=n||r.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=i&&n&&!Rh(),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!==lt.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=lt.WAITING_LEVEL)}onLevelLoaded(e,t){var i;const{levels:n,startFragRequested:s}=this,r=t.level,o=t.details,c=o.totalduration;if(!n){this.warn(`Levels were reset while loading level ${r}`);return}this.log(`Level ${r} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""}, cc [${o.startCC}, ${o.endCC}] duration:${c}`);const u=t.levelInfo,f=this.fragCurrent;f&&(this.state===lt.FRAG_LOADING||this.state===lt.FRAG_LOADING_WAITING_RETRY)&&f.level!==t.level&&f.loader&&this.abortCurrentFrag();let d=0;if(o.live||(i=u.details)!=null&&i.live){var _;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,u.details,(_=this.levelLastLoaded)==null?void 0:_.details)}if(u.details=o,this.levelLastLoaded=u,s||this.setStartPosition(o,d),this.hls.trigger(p.LEVEL_UPDATED,{details:o,level:r}),this.state===lt.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=lt.IDLE}s&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:i}=this;if(!i)return;const n=this.hls.liveSyncPosition,s=this.getLoadPosition(),r=e.fragmentStart,o=e.edge,c=s>=r-t.maxFragLookUpTolerance&&s<=o;if(n!==null&&i.duration>n&&(s<n||!c)){const f=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&i.readyState<4||s<o-f)&&(this._hasEnoughToStart||(this.nextLoadPosition=n),i.readyState))if(this.warn(`Playback: ${s.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${n.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var u;const d=_i.bufferInfo(i,n,0);if(!((u=d.buffered)!=null&&u.length)){i.currentTime=n;return}if(d.start<=s){i.currentTime=n;return}const{nextStart:x}=_i.bufferedInfo(d.buffered,s,0);x&&(i.currentTime=x)}else i.currentTime=n}}_handleFragmentLoadProgress(e){var t;const i=e.frag,{part:n,payload:s}=e,{levels:r}=this;if(!r){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=r[i.level];if(!o){this.warn(`Level ${i.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),this.fragmentTracker.removeFragment(i);return}const u=o.videoCodec,f=c.PTSKnown||!c.live,d=(t=i.initSegment)==null?void 0:t.data,_=this._getAudioCodec(o),x=this.transmuxer=this.transmuxer||new uo(this.hls,oe.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),T=n?n.index:-1,B=T!==-1,P=new fn(i.level,i.sn,i.stats.chunkCount,s.byteLength,T,B),ie=this.initPTS[i.cc];x.push(s,d,_,u,i,n,c.totalduration,f,P,ie)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(yi(t.url,i))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const r=this.fragCurrent;r&&(this.log("Switching to main audio track, cancel main fragment load"),r.abortRequests(),this.fragmentTracker.removeFragment(r)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(n){this.fragmentTracker.removeAllFragments(),i.once(p.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(p.AUDIO_TRACK_SWITCHED,t)}),i.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}i.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=yi(t.url,this.hls);if(i){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=i?2:0,this.tick()}onBufferCreated(e,t){const i=t.tracks;let n,s,r=!1;for(const o in i){const c=i[o];if(c.id==="main"){if(s=o,n=c,o==="video"){const u=i[o];u&&(this.videoBuffer=u.buffer)}}else r=!0}r&&n?(this.log(`Alternate track found, use ${s}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:n}=t,s=i.type===oe.MAIN;if(s){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===lt.PARSED&&(this.state=lt.IDLE);return}const o=n?n.stats:i.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),Ee(i)&&(this.fragPrevious=i),this.fragBufferedComplete(i,n)}const r=this.media;r&&(!this._hasEnoughToStart&&_i.getBuffered(r).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),s&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=lt.ERROR;return}switch(t.details){case G.FRAG_GAP:case G.FRAG_PARSING_ERROR:case G.FRAG_DECRYPT_ERROR:case G.FRAG_LOAD_ERROR:case G.FRAG_LOAD_TIMEOUT:case G.KEY_LOAD_ERROR:case G.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(oe.MAIN,t);break;case G.LEVEL_LOAD_ERROR:case G.LEVEL_LOAD_TIMEOUT:case G.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===lt.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ve.LEVEL&&(this.state=lt.IDLE);break;case G.BUFFER_ADD_CODEC_ERROR:case G.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case G.BUFFER_FULL_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case G.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=lt.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==K.AUDIO||!this.altAudio){const i=(t===K.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;i&&(this.afterBufferFlushed(i,t,oe.MAIN),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t<i){if(e.seeking){this.log(`could not seek to ${i}, already seeking at ${t}`);return}const n=this.timelineOffset;n&&i&&(i+=n);const s=this.getLevelDetails(),r=_i.getBuffered(e),o=r.length?r.start(0):0,c=o-i,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<u||this.loadingParts&&c<2*((s==null?void 0:s.partTarget)||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),i+=c,this.startPosition=i),t<i&&(this.log(`seek to target start position ${i} from current time ${t} buffer start ${o}`),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(i=>{const{hls:n}=this,s=i==null?void 0:i.frag;if(!s||this.fragContextChanged(s))return;t.fragmentError=0,this.state=lt.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const r=s.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),n.trigger(p.FRAG_LOADED,i),s.bitrateTest=!1}).catch(i=>{this.state===lt.STOPPED||this.state===lt.ERROR||(this.warn(i),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:i}=this,{remuxResult:n,chunkMeta:s}=e,r=this.getCurrentContext(s);if(!r){this.resetWhenMissingContext(s);return}const{frag:o,part:c,level:u}=r,{video:f,text:d,id3:_,initSegment:x}=n,{details:T}=u,B=this.altAudio?void 0:n.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=lt.PARSING,x){const P=x.tracks;if(P){const Le=o.initSegment||o;if(this.unhandledEncryptionError(x,o))return;this._bufferInitSegment(u,P,Le,s),i.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:Le,id:t,tracks:P})}const ie=x.initPTS,_e=x.timescale,de=this.initPTS[o.cc];if(F(ie)&&(!de||de.baseTime!==ie||de.timescale!==_e)){const Le=x.trackId;this.initPTS[o.cc]={baseTime:ie,timescale:_e,trackId:Le},i.trigger(p.INIT_PTS_FOUND,{frag:o,id:t,initPTS:ie,timescale:_e,trackId:Le})}}if(f&&T){B&&f.type==="audiovideo"&&this.logMuxedErr(o);const P=T.fragments[o.sn-1-T.startSN],ie=o.sn===T.startSN,_e=!P||o.cc>P.cc;if(n.independent!==!1){const{startPTS:de,endPTS:Le,startDTS:Me,endDTS:tt}=f;if(c)c.elementaryStreams[f.type]={startPTS:de,endPTS:Le,startDTS:Me,endDTS:tt};else if(f.firstKeyFrame&&f.independent&&s.id===1&&!_e&&(this.couldBacktrack=!0),f.dropped&&f.independent){const Pe=this.getMainFwdBufferInfo(),He=(Pe?Pe.end:this.getLoadPosition())+this.config.maxBufferHole,Xe=f.firstKeyFramePTS?f.firstKeyFramePTS:de;if(!ie&&He<Xe-this.config.maxBufferHole&&!_e){this.backtrack(o);return}else _e&&(o.gap=!0);o.setElementaryStreamInfo(f.type,o.start,Le,o.start,tt,!0)}else ie&&de-(T.appliedTimelineOffset||0)>$r&&(o.gap=!0);o.setElementaryStreamInfo(f.type,de,Le,Me,tt),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(f,o,c,s,ie||_e)}else if(ie||_e)o.gap=!0;else{this.backtrack(o);return}}if(B){const{startPTS:P,endPTS:ie,startDTS:_e,endDTS:de}=B;c&&(c.elementaryStreams[K.AUDIO]={startPTS:P,endPTS:ie,startDTS:_e,endDTS:de}),o.setElementaryStreamInfo(K.AUDIO,P,ie,_e,de),this.bufferFragmentData(B,o,c,s)}if(T&&_!=null&&_.samples.length){const P={id:t,frag:o,details:T,samples:_.samples};i.trigger(p.FRAG_PARSING_METADATA,P)}if(T&&d){const P={id:t,frag:o,details:T,samples:d.samples};i.trigger(p.FRAG_PARSING_USERDATA,P)}}logMuxedErr(e){this.warn(`${Ee(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,i,n){if(this.state!==lt.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));const{audio:s,video:r,audiovideo:o}=t;if(s){const u=e.audioCodec;let f=gt(s.codec,u);f==="mp4a"&&(f="mp4a.40.5");const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){f&&(f.indexOf("mp4a.40.5")!==-1?f="mp4a.40.2":f="mp4a.40.5");const _=s.metadata;_&&"channelCount"in _&&(_.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(f="mp4a.40.5")}f&&f.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&s.container!=="audio/mpeg"&&(f="mp4a.40.2",this.log(`Android: force audio codec to ${f}`)),u&&u!==f&&this.log(`Swapping manifest audio codec "${u}" for "${f}"`),s.levelCodec=f,s.id=oe.MAIN,this.log(`Init audio buffer, container:${s.container}, codecs[selected/level/parsed]=[${f||""}/${u||""}/${s.codec}]`),delete t.audiovideo}if(r){r.levelCodec=e.videoCodec,r.id=oe.MAIN;const u=r.codec;if((u==null?void 0:u.length)===4)switch(u){case"hvc1":case"hev1":r.codec="hvc1.1.6.L120.90";break;case"av01":r.codec="av01.0.04M.08";break;case"avc1":r.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${r.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${r.codec!==u?" parsed-corrected="+r.codec:""}${r.supplemental?" supplemental="+r.supplemental:""}`),delete t.audiovideo}o&&(this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),delete t.video,delete t.audio);const c=Object.keys(t);if(c.length){if(this.hls.trigger(p.BUFFER_CODECS,t),!this.hls)return;c.forEach(u=>{const d=t[u].initSegment;d!=null&&d.byteLength&&this.hls.trigger(p.BUFFER_APPENDING,{type:u,data:d,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,oe.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,i=e==null?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=lt.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(_i.isBuffered(e,i)?t=this.getAppendedFrag(i):_i.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const n=this.fragPlaying,s=t.level;(!n||t.sn!==n.sn||n.level!==s)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!n||n.level!==s)&&this.hls.trigger(p.LEVEL_SWITCHED,{level:s}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return F(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(F(t)){const i=this.getLevelDetails(),n=this.currentFrag||(i?wi(null,i.fragments,t):null);if(n){const s=n.programDateTime;if(s!==null){const r=s+(t-n.start)*1e3;return new Date(r)}}}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 Dh extends j{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[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.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const t=this.keyIdToKeyInfo[e].loader;t&&t.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,t=G.KEY_LOAD_ERROR,i,n,s){return new sn({type:ue.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:s,error:i,networkDetails:n})}loadClear(e,t,i){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let n=0,s=t.length;n<s;n++){const r=t[n];if(e.cc<=r.cc&&(!Ee(e)||!Ee(r)||e.sn<r.sn)||!i&&n==s-1)return this.emeController.selectKeySystemFormat(r).then(o=>{if(!this.emeController)return;r.setKeyFormat(o);const c=os(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const n=pi(this.config);if(n.length)return this.emeController.getKeySystemAccess(n)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var i,n;t&&e.setKeyFormat(t);const s=e.decryptdata;if(!s){const f=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,G.KEY_LOAD_ERROR,f))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,G.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const o=Ma(s);let c=this.keyIdToKeyInfo[o];if((i=c)!=null&&i.decryptdata.key)return s.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if((n=c)!=null&&n.keyLoadPromise){var u;switch((u=c.mediaKeySessionContext)==null?void 0:u.keyStatus){case"usable":case"usable-in-future":return c.keyLoadPromise.then(d=>{const{keyInfo:_}=d;return s.key=_.decryptdata.key,{frag:e,keyInfo:_}})}}switch(this.log(`Loading key ${J(s.keyId||[])} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[o]={decryptdata:s,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},s.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,G.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const n=this.emeController.loadKey(i);return(e.keyLoadPromise=n.then(s=>(e.mediaKeySessionContext=s,i))).catch(s=>{throw e.keyLoadPromise=null,s.data&&(s.data.frag=t),s})}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,n=i.loader,s=new n(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise((r,o)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=i.keyLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(_,x,T,B)=>{const{frag:P,keyInfo:ie,url:_e}=T,de=Ma(ie.decryptdata)||_e;if(!P.decryptdata||ie!==this.keyIdToKeyInfo[de])return o(this.createKeyLoadError(P,G.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),B));ie.decryptdata.key=P.decryptdata.key=new Uint8Array(_.data),P.keyLoader=null,ie.loader=null,r({frag:P,keyInfo:ie})},onError:(_,x,T,B)=>{this.resetLoader(x),o(this.createKeyLoadError(t,G.KEY_LOAD_ERROR,new Error(`HTTP Error ${_.code} loading key ${_.text}`),T,E({url:c.url,data:void 0},_)))},onTimeout:(_,x,T)=>{this.resetLoader(x),o(this.createKeyLoadError(t,G.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),T))},onAbort:(_,x,T)=>{this.resetLoader(x),o(this.createKeyLoadError(t,G.INTERNAL_ABORTED,new Error("key loading aborted"),T))}};s.load(c,f,d)})}resetLoader(e){const{frag:t,keyInfo:i,url:n}=e,s=i.loader;t.keyLoader===s&&(t.keyLoader=null,i.loader=null);const r=Ma(i.decryptdata)||n;delete this.keyIdToKeyInfo[r],s&&s.destroy()}}function Ma(a){const e=a.keyId;return e?J(e):a.uri}function ol(a){const{type:e}=a;switch(e){case ve.AUDIO_TRACK:return oe.AUDIO;case ve.SUBTITLE_TRACK:return oe.SUBTITLE;default:return oe.MAIN}}function Na(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Ch{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(p.MANIFEST_LOADING,this.onManifestLoading,this),e.on(p.LEVEL_LOADING,this.onLevelLoading,this),e.on(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(p.MANIFEST_LOADING,this.onManifestLoading,this),e.off(p.LEVEL_LOADING,this.onLevelLoading,this),e.off(p.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(p.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(p.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,n=t.loader,s=i||n,r=new s(t);return this.loaders[e.type]=r,r}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:ve.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:i,level:n,pathwayId:s,url:r,deliveryDirectives:o,levelInfo:c}=t;this.load({id:i,level:n,pathwayId:s,responseType:"text",type:ve.LEVEL,url:r,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:ve.AUDIO_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:i,groupId:n,url:s,deliveryDirectives:r,track:o}=t;this.load({id:i,groupId:n,level:null,responseType:"text",type:ve.SUBTITLE_TRACK,url:s,deliveryDirectives:r,levelOrTrack:o})}onLevelsUpdated(e,t){const i=this.loaders[ve.LEVEL];if(i){const n=i.context;n&&!t.levels.some(s=>s===n.levelOrTrack)&&(i.abort(),delete this.loaders[ve.LEVEL])}}load(e){var t;const i=this.hls.config;let n=this.getInternalLoader(e);if(n){const u=this.hls.logger,f=n.context;if(f&&f.levelOrTrack===e.levelOrTrack&&(f.url===e.url||f.deliveryDirectives&&!e.deliveryDirectives)){f.url===e.url?u.log(`[playlist-loader]: ignore ${e.url} ongoing request`):u.log(`[playlist-loader]: ignore ${e.url} in favor of ${f.url}`);return}u.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),n.abort()}let s;if(e.type===ve.MANIFEST?s=i.manifestLoadPolicy.default:s=g({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),F((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ve.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ve.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ve.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const f=u.partTarget,d=u.targetduration;if(f&&d){const _=Math.max(f*3,d*.8)*1e3;s=g({},s,{maxTimeToFirstByteMs:Math.min(_,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(_,s.maxTimeToFirstByteMs)})}}}const r=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:r.maxNumRetry||0,retryDelay:r.retryDelayMs||0,maxRetryDelay:r.maxRetryDelayMs||0},c={onSuccess:(u,f,d,_)=>{const x=this.getInternalLoader(d);this.resetInternalLoader(d.type);const T=u.data;if(T.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(u,d,new Error("no EXTM3U delimiter"),_||null,f);return}f.parsing.start=performance.now(),Hn.isMediaPlaylist(T)||d.type!==ve.MANIFEST?this.handleTrackOrLevelPlaylist(u,f,d,_||null,x):this.handleMasterPlaylist(u,f,d,_)},onError:(u,f,d,_)=>{this.handleNetworkError(f,d,!1,u,_)},onTimeout:(u,f,d)=>{this.handleNetworkError(f,d,!0,void 0,u)}};n.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,n){const s=this.hls,r=e.data,o=Na(e,i),c=Hn.parseMasterPlaylist(r,o);if(c.playlistParsingError){this.handleManifestParsingError(e,i,c.playlistParsingError,n,t);return}const{contentSteering:u,levels:f,sessionData:d,sessionKeys:_,startTimeOffset:x,variableList:T}=c;this.variableList=T;const{AUDIO:B=[],SUBTITLES:P,"CLOSED-CAPTIONS":ie}=Hn.parseMasterPlaylistMedia(r,o,c);B.length&&!B.some(de=>!de.url)&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),B.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Bi({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:f,audioTracks:B,subtitles:P,captions:ie,contentSteering:u,url:o,stats:t,networkDetails:n,sessionData:d,sessionKeys:_,startTimeOffset:x,variableList:T})}handleTrackOrLevelPlaylist(e,t,i,n,s){const r=this.hls,{id:o,level:c,type:u}=i,f=Na(e,i),d=F(c)?c:F(o)?o:0,_=ol(i),x=Hn.parseLevelPlaylist(e.data,f,d,_,0,this.variableList);if(u===ve.MANIFEST){const T={attrs:new Bi({}),bitrate:0,details:x,name:"",url:f};x.requestScheduled=t.loading.start+vr(x,0),r.trigger(p.MANIFEST_LOADED,{levels:[T],audioTracks:[],url:f,stats:t,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=x,this.handlePlaylistLoaded(x,e,t,i,n,s)}handleManifestParsingError(e,t,i,n,s){this.hls.trigger(p.ERROR,{type:ue.NETWORK_ERROR,details:G.MANIFEST_PARSING_ERROR,fatal:t.type===ve.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:n,stats:s})}handleNetworkError(e,t,i=!1,n,s){let r=`A network ${i?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${e.type}`;e.type===ve.LEVEL?r+=`: ${e.level} id: ${e.id}`:(e.type===ve.AUDIO_TRACK||e.type===ve.SUBTITLE_TRACK)&&(r+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(r);this.hls.logger.warn(`[playlist-loader]: ${r}`);let c=G.UNKNOWN,u=!1;const f=this.getInternalLoader(e);switch(e.type){case ve.MANIFEST:c=i?G.MANIFEST_LOAD_TIMEOUT:G.MANIFEST_LOAD_ERROR,u=!0;break;case ve.LEVEL:c=i?G.LEVEL_LOAD_TIMEOUT:G.LEVEL_LOAD_ERROR,u=!1;break;case ve.AUDIO_TRACK:c=i?G.AUDIO_TRACK_LOAD_TIMEOUT:G.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ve.SUBTITLE_TRACK:c=i?G.SUBTITLE_TRACK_LOAD_TIMEOUT:G.SUBTITLE_LOAD_ERROR,u=!1;break}f&&this.resetInternalLoader(e.type);const d={type:ue.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:f,context:e,error:o,networkDetails:t,stats:s};if(n){const _=(t==null?void 0:t.url)||e.url;d.response=E({url:_,data:void 0},n)}this.hls.trigger(p.ERROR,d)}handlePlaylistLoaded(e,t,i,n,s,r){const o=this.hls,{type:c,level:u,id:f,groupId:d,deliveryDirectives:_}=n,x=Na(t,n),T=ol(n),B=typeof n.level=="number"&&T===oe.MAIN?u:void 0;if(!e.fragments.length){const ie=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:ue.NETWORK_ERROR,details:G.LEVEL_EMPTY_ERROR,fatal:!1,url:x,error:ie,reason:ie.message,response:t,context:n,level:B,parent:T,networkDetails:s,stats:i});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const P=e.playlistParsingError;if(P){if(this.hls.logger.warn(`${P} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:ue.NETWORK_ERROR,details:G.LEVEL_PARSING_ERROR,fatal:!1,url:x,error:P,reason:P.message,response:t,context:n,level:B,parent:T,networkDetails:s,stats:i});return}e.playlistParsingError=null}switch(e.live&&r&&(r.getCacheAge&&(e.ageHeader=r.getCacheAge()||0),(!r.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case ve.MANIFEST:case ve.LEVEL:o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:n.levelOrTrack||o.levels[0],level:B||0,id:f||0,stats:i,networkDetails:s,deliveryDirectives:_,withoutMultiVariant:c===ve.MANIFEST});break;case ve.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:f||0,groupId:d||"",stats:i,networkDetails:s,deliveryDirectives:_});break;case ve.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:n.levelOrTrack,id:f||0,groupId:d||"",stats:i,networkDetails:s,deliveryDirectives:_});break}}}class Rs{static get version(){return ir}static isMSESupported(){return al()}static isSupported(){return wh()}static getMediaSource(){return ye()}static get Events(){return p}static get MetadataSchema(){return Un}static get ErrorTypes(){return ue}static get ErrorDetails(){return G}static get DefaultConfig(){return Rs.defaultConfig?Rs.defaultConfig:ph}static set DefaultConfig(e){Rs.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new Qr,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const t=this.logger=se(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=gh(Rs.DefaultConfig,e,t);this.userConfig=e,i.progressive&&_h(i,t);const{abrController:n,bufferController:s,capLevelController:r,errorController:o,fpsController:c}=i,u=new o(this),f=this.abrController=new n(this),d=new rn(this),_=i.interstitialsController,x=_?this.interstitialsController=new _(this,Rs):null,T=this.bufferController=new s(this,d),B=this.capLevelController=new r(this),P=new c(this),ie=new Ch(this),_e=i.contentSteeringController,de=_e?new _e(this):null,Le=this.levelController=new Ah(this,de),Me=new xh(this),tt=new Dh(this.config,this.logger),Pe=this.streamController=new Ih(this,d,tt),He=this.gapController=new bh(this,d);B.setStreamController(Pe),P.setStreamController(Pe);const Xe=[ie,Le,Pe];x&&Xe.splice(1,0,x),de&&Xe.splice(1,0,de),this.networkControllers=Xe;const Oe=[f,T,He,B,P,Me,d];this.audioTrackController=this.createController(i.audioTrackController,Xe);const ft=i.audioStreamController;ft&&Xe.push(this.audioStreamController=new ft(this,d,tt)),this.subtitleTrackController=this.createController(i.subtitleTrackController,Xe);const jt=i.subtitleStreamController;jt&&Xe.push(this.subtititleStreamController=new jt(this,d,tt)),this.createController(i.timelineController,Oe),tt.emeController=this.emeController=this.createController(i.emeController,Oe),this.cmcdController=this.createController(i.cmcdController,Oe),this.latencyController=this.createController(Th,Oe),this.coreComponents=Oe,Xe.push(u);const ai=u.onErrorOut;typeof ai=="function"&&this.on(p.ERROR,ai,u),this.on(p.MANIFEST_LOADED,ie.onManifestLoaded,ie)}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(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+i.message+'". Here is a stacktrace:',i),!this.triggeringException){this.triggeringException=!0;const n=e===p.ERROR;this.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.INTERNAL_EXCEPTION,fatal:n,event:e,error:i}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(p.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const s=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:G.ATTACH_MEDIA_ERROR,fatal:!0,error:s});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,i=t?e.media:e,n=t?e:{media:i};this._media=i,this.trigger(p.MEDIA_ATTACHING,n)}detachMedia(){this.logger.log("detachMedia"),this.trigger(p.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(p.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const t=this.media,i=this._url,n=this._url=S.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${n}`),t&&i&&(i!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(p.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,t){this.logger.log(`startLoad(${e+(t?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),!(!this.started||!this.networkControllers));i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[oe.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[oe.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[oe.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,t=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&this.startLoad(t))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=bc()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){Mt(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 s=n;s--;){const r=e[s].attrs["HDCP-LEVEL"];if(r&&r<=i)return s}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()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return((t=this.audioTrackController)==null?void 0:t.setAudioOption(e))||null}setSubtitleOption(e){var t;return((t=this.subtitleTrackController)==null?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,t=this.allAudioTracks){const i=be(t);return H(e,i,navigator.mediaCapabilities)}}Rs.defaultConfig=void 0}}]);
}());