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.
121 lines
1.1 MiB
121 lines
1.1 MiB
!(function(){var Sl=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[6444],{65030:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return Me}});var N=U(33885),me=U(42978),be=U(75931),ce=U(43403),G=U(92310),p=U.n(G),ve=U(29301),oe=U(76846),l=U(96452),Z=U(6089),C=U(80402),g=U(34280),v=U(49658),E=U(59301),A=U(54476),O=U(77900),j=U(8654);function V(_e){var Re=_e.prefixCls,ee=_e.align,Le=_e.arrow,we=_e.arrowPos,q=Le||{},W=q.className,Y=q.content,re=we.x,X=re===void 0?0:re,$=we.y,Q=$===void 0?0:$,he=E.useRef();if(!ee||!ee.points)return null;var pe={position:"absolute"};if(ee.autoArrow!==!1){var Ae=ee.points[0],Xe=ee.points[1],We=Ae[0],ze=Ae[1],Ke=Xe[0],Be=Xe[1];We===Ke||!["t","b"].includes(We)?pe.top=Q:We==="t"?pe.top=0:pe.bottom=0,ze===Be||!["l","r"].includes(ze)?pe.left=X:ze==="l"?pe.left=0:pe.right=0}return E.createElement("div",{ref:he,className:p()("".concat(Re,"-arrow"),W),style:pe},Y)}function L(_e){var Re=_e.prefixCls,ee=_e.open,Le=_e.zIndex,we=_e.mask,q=_e.motion;return we?E.createElement(O.default,(0,A.Z)({},q,{motionAppear:!0,visible:ee,removeOnLeave:!0}),function(W){var Y=W.className;return E.createElement("div",{style:{zIndex:Le},className:p()("".concat(Re,"-mask"),Y)})}):null}var I=E.memo(function(_e){var Re=_e.children;return Re},function(_e,Re){return Re.cache}),w=I,R=E.forwardRef(function(_e,Re){var ee=_e.popup,Le=_e.className,we=_e.prefixCls,q=_e.style,W=_e.target,Y=_e.onVisibleChanged,re=_e.open,X=_e.keepDom,$=_e.fresh,Q=_e.onClick,he=_e.mask,pe=_e.arrow,Ae=_e.arrowPos,Xe=_e.align,We=_e.motion,ze=_e.maskMotion,Ke=_e.forceRender,Be=_e.getPopupContainer,mt=_e.autoDestroy,Oe=_e.portal,st=_e.zIndex,Bt=_e.onMouseEnter,yt=_e.onMouseLeave,ft=_e.onPointerEnter,jt=_e.onPointerDownCapture,si=_e.ready,ti=_e.offsetX,Gt=_e.offsetY,ri=_e.offsetR,Rt=_e.offsetB,ut=_e.onAlign,nt=_e.onPrepare,Mt=_e.stretch,Ht=_e.targetWidth,Tt=_e.targetHeight,_t=typeof ee=="function"?ee():ee,At=re||X,vi=(Be==null?void 0:Be.length)>0,Zt=E.useState(!Be||!vi),Xt=(0,me.Z)(Zt,2),Dt=Xt[0],Ve=Xt[1];if((0,g.Z)(function(){!Dt&&vi&&W&&Ve(!0)},[Dt,vi,W]),!Dt)return null;var h="auto",m={left:"-1000vw",top:"-1000vh",right:h,bottom:h};if(si||!re){var y,k=Xe.points,H=Xe.dynamicInset||((y=Xe._experimental)===null||y===void 0?void 0:y.dynamicInset),ge=H&&k[0][1]==="r",de=H&&k[0][0]==="b";ge?(m.right=ri,m.left=h):(m.left=ti,m.right=h),de?(m.bottom=Rt,m.top=h):(m.top=Gt,m.bottom=h)}var ke={};return Mt&&(Mt.includes("height")&&Tt?ke.height=Tt:Mt.includes("minHeight")&&Tt&&(ke.minHeight=Tt),Mt.includes("width")&&Ht?ke.width=Ht:Mt.includes("minWidth")&&Ht&&(ke.minWidth=Ht)),re||(ke.pointerEvents="none"),E.createElement(Oe,{open:Ke||At,getContainer:Be&&function(){return Be(W)},autoDestroy:mt},E.createElement(L,{prefixCls:we,open:re,zIndex:st,mask:he,motion:ze}),E.createElement(ve.Z,{onResize:ut,disabled:!re},function(He){return E.createElement(O.default,(0,A.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Ke,leavedClassName:"".concat(we,"-hidden")},We,{onAppearPrepare:nt,onEnterPrepare:nt,visible:re,onVisibleChanged:function(Lt){var Ot;We==null||(Ot=We.onVisibleChanged)===null||Ot===void 0||Ot.call(We,Lt),Y(Lt)}}),function(lt,Lt){var Ot=lt.className,bt=lt.style,Ut=p()(we,Ot,Le);return E.createElement("div",{ref:(0,j.sQ)(He,Re,Lt),className:Ut,style:(0,N.Z)((0,N.Z)((0,N.Z)((0,N.Z)({"--arrow-x":"".concat(Ae.x||0,"px"),"--arrow-y":"".concat(Ae.y||0,"px")},m),ke),bt),{},{boxSizing:"border-box",zIndex:st},q),onMouseEnter:Bt,onMouseLeave:yt,onPointerEnter:ft,onClick:Q,onPointerDownCapture:jt},pe&&E.createElement(V,{prefixCls:we,arrow:pe,arrowPos:Ae,align:Xe}),E.createElement(w,{cache:!re&&!$},_t))})}))}),z=R,ne=E.forwardRef(function(_e,Re){var ee=_e.children,Le=_e.getTriggerDOMNode,we=(0,j.Yr)(ee),q=E.useCallback(function(Y){(0,j.mH)(Re,Le?Le(Y):Y)},[Le]),W=(0,j.x1)(q,(0,j.C4)(ee));return we?E.cloneElement(ee,{ref:W}):ee}),ie=ne,ye=E.createContext(null),De=ye;function xe(_e){return _e?Array.isArray(_e)?_e:[_e]:[]}function $e(_e,Re,ee,Le){return E.useMemo(function(){var we=xe(ee!=null?ee:Re),q=xe(Le!=null?Le:Re),W=new Set(we),Y=new Set(q);return _e&&(W.has("hover")&&(W.delete("hover"),W.add("click")),Y.has("hover")&&(Y.delete("hover"),Y.add("click"))),[W,Y]},[_e,Re,ee,Le])}var J=U(29194);function D(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],ee=arguments.length>2?arguments[2]:void 0;return ee?_e[0]===Re[0]:_e[0]===Re[0]&&_e[1]===Re[1]}function M(_e,Re,ee,Le){for(var we=ee.points,q=Object.keys(_e),W=0;W<q.length;W+=1){var Y,re=q[W];if(D((Y=_e[re])===null||Y===void 0?void 0:Y.points,we,Le))return"".concat(Re,"-placement-").concat(re)}return""}function P(_e,Re,ee,Le){return Re||(ee?{motionName:"".concat(_e,"-").concat(ee)}:Le?{motionName:Le}:null)}function ae(_e){return _e.ownerDocument.defaultView}function te(_e){for(var Re=[],ee=_e==null?void 0:_e.parentElement,Le=["hidden","scroll","clip","auto"];ee;){var we=ae(ee).getComputedStyle(ee),q=we.overflowX,W=we.overflowY,Y=we.overflow;[q,W,Y].some(function(re){return Le.includes(re)})&&Re.push(ee),ee=ee.parentElement}return Re}function S(_e){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(_e)?Re:_e}function b(_e){return S(parseFloat(_e),0)}function K(_e,Re){var ee=(0,N.Z)({},_e);return(Re||[]).forEach(function(Le){if(!(Le instanceof HTMLBodyElement||Le instanceof HTMLHtmlElement)){var we=ae(Le).getComputedStyle(Le),q=we.overflow,W=we.overflowClipMargin,Y=we.borderTopWidth,re=we.borderBottomWidth,X=we.borderLeftWidth,$=we.borderRightWidth,Q=Le.getBoundingClientRect(),he=Le.offsetHeight,pe=Le.clientHeight,Ae=Le.offsetWidth,Xe=Le.clientWidth,We=b(Y),ze=b(re),Ke=b(X),Be=b($),mt=S(Math.round(Q.width/Ae*1e3)/1e3),Oe=S(Math.round(Q.height/he*1e3)/1e3),st=(Ae-Xe-Ke-Be)*mt,Bt=(he-pe-We-ze)*Oe,yt=We*Oe,ft=ze*Oe,jt=Ke*mt,si=Be*mt,ti=0,Gt=0;if(q==="clip"){var ri=b(W);ti=ri*mt,Gt=ri*Oe}var Rt=Q.x+jt-ti,ut=Q.y+yt-Gt,nt=Rt+Q.width+2*ti-jt-si-st,Mt=ut+Q.height+2*Gt-yt-ft-Bt;ee.left=Math.max(ee.left,Rt),ee.top=Math.max(ee.top,ut),ee.right=Math.min(ee.right,nt),ee.bottom=Math.min(ee.bottom,Mt)}}),ee}function le(_e){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ee="".concat(Re),Le=ee.match(/^(.*)\%$/);return Le?_e*(parseFloat(Le[1])/100):parseFloat(ee)}function Ee(_e,Re){var ee=Re||[],Le=(0,me.Z)(ee,2),we=Le[0],q=Le[1];return[le(_e.width,we),le(_e.height,q)]}function Fe(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[_e[0],_e[1]]}function et(_e,Re){var ee=Re[0],Le=Re[1],we,q;return ee==="t"?q=_e.y:ee==="b"?q=_e.y+_e.height:q=_e.y+_e.height/2,Le==="l"?we=_e.x:Le==="r"?we=_e.x+_e.width:we=_e.x+_e.width/2,{x:we,y:q}}function Et(_e,Re){var ee={t:"b",b:"t",l:"r",r:"l"};return _e.map(function(Le,we){return we===Re?ee[Le]||"c":Le}).join("")}function It(_e,Re,ee,Le,we,q,W){var Y=E.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:we[Le]||{}}),re=(0,me.Z)(Y,2),X=re[0],$=re[1],Q=E.useRef(0),he=E.useMemo(function(){return Re?te(Re):[]},[Re]),pe=E.useRef({}),Ae=function(){pe.current={}};_e||Ae();var Xe=(0,Z.Z)(function(){if(Re&&ee&&_e){let ln=function(mn,yn){var Kn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wt,Pn=At.x+mn,us=At.y+yn,gs=Pn+de,ns=us+ge,Rs=Math.max(Pn,Kn.left),ii=Math.max(us,Kn.top),_i=Math.min(gs,Kn.right),Vi=Math.min(ns,Kn.bottom);return Math.max(0,(_i-Rs)*(Vi-ii))},en=function(){nn=At.y+yi,Ji=nn+ge,Ii=At.x+fi,Pi=Ii+de};var Ke,Be,mt,Oe,st=Re,Bt=st.ownerDocument,yt=ae(st),ft=yt.getComputedStyle(st),jt=ft.position,si=st.style.left,ti=st.style.top,Gt=st.style.right,ri=st.style.bottom,Rt=st.style.overflow,ut=(0,N.Z)((0,N.Z)({},we[Le]),q),nt=Bt.createElement("div");(Ke=st.parentElement)===null||Ke===void 0||Ke.appendChild(nt),nt.style.left="".concat(st.offsetLeft,"px"),nt.style.top="".concat(st.offsetTop,"px"),nt.style.position=jt,nt.style.height="".concat(st.offsetHeight,"px"),nt.style.width="".concat(st.offsetWidth,"px"),st.style.left="0",st.style.top="0",st.style.right="auto",st.style.bottom="auto",st.style.overflow="hidden";var Mt;if(Array.isArray(ee))Mt={x:ee[0],y:ee[1],width:0,height:0};else{var Ht,Tt,_t=ee.getBoundingClientRect();_t.x=(Ht=_t.x)!==null&&Ht!==void 0?Ht:_t.left,_t.y=(Tt=_t.y)!==null&&Tt!==void 0?Tt:_t.top,Mt={x:_t.x,y:_t.y,width:_t.width,height:_t.height}}var At=st.getBoundingClientRect(),vi=yt.getComputedStyle(st),Zt=vi.height,Xt=vi.width;At.x=(Be=At.x)!==null&&Be!==void 0?Be:At.left,At.y=(mt=At.y)!==null&&mt!==void 0?mt:At.top;var Dt=Bt.documentElement,Ve=Dt.clientWidth,h=Dt.clientHeight,m=Dt.scrollWidth,y=Dt.scrollHeight,k=Dt.scrollTop,H=Dt.scrollLeft,ge=At.height,de=At.width,ke=Mt.height,He=Mt.width,lt={left:0,top:0,right:Ve,bottom:h},Lt={left:-H,top:-k,right:m-H,bottom:y-k},Ot=ut.htmlRegion,bt="visible",Ut="visibleFirst";Ot!=="scroll"&&Ot!==Ut&&(Ot=bt);var vt=Ot===Ut,ht=K(Lt,he),ot=K(lt,he),wt=Ot===bt?ot:ht,St=vt?ot:wt;st.style.left="auto",st.style.top="auto",st.style.right="0",st.style.bottom="0";var pi=st.getBoundingClientRect();st.style.left=si,st.style.top=ti,st.style.right=Gt,st.style.bottom=ri,st.style.overflow=Rt,(Oe=st.parentElement)===null||Oe===void 0||Oe.removeChild(nt);var zt=S(Math.round(de/parseFloat(Xt)*1e3)/1e3),Ft=S(Math.round(ge/parseFloat(Zt)*1e3)/1e3);if(zt===0||Ft===0||(0,oe.Sh)(ee)&&!(0,J.Z)(ee))return;var xt=ut.offset,ni=ut.targetOffset,mi=Ee(At,xt),Te=(0,me.Z)(mi,2),Pe=Te[0],rt=Te[1],qe=Ee(Mt,ni),Ge=(0,me.Z)(qe,2),tt=Ge[0],pt=Ge[1];Mt.x-=tt,Mt.y-=pt;var Ct=ut.points||[],ui=(0,me.Z)(Ct,2),qt=ui[0],Si=ui[1],ai=Fe(Si),gi=Fe(qt),bi=et(Mt,ai),Li=et(At,gi),ki=(0,N.Z)({},ut),fi=bi.x-Li.x+Pe,yi=bi.y-Li.y+rt,wi=ln(fi,yi),Ri=ln(fi,yi,ot),Ti=et(Mt,["t","l"]),Bi=et(At,["t","l"]),Di=et(Mt,["b","r"]),Mi=et(At,["b","r"]),Yi=ut.overflow||{},$i=Yi.adjustX,rn=Yi.adjustY,Zi=Yi.shiftX,Xi=Yi.shiftY,tn=function(yn){return typeof yn=="boolean"?yn:yn>=0},nn,Ji,Ii,Pi;en();var ei=tn(rn),Pt=gi[0]===ai[0];if(ei&&gi[0]==="t"&&(Ji>St.bottom||pe.current.bt)){var Yt=yi;Pt?Yt-=ge-ke:Yt=Ti.y-Mi.y-rt;var Ni=ln(fi,Yt),Ui=ln(fi,Yt,ot);Ni>wi||Ni===wi&&(!vt||Ui>=Ri)?(pe.current.bt=!0,yi=Yt,rt=-rt,ki.points=[Et(gi,0),Et(ai,0)]):pe.current.bt=!1}if(ei&&gi[0]==="b"&&(nn<St.top||pe.current.tb)){var qi=yi;Pt?qi+=ge-ke:qi=Di.y-Bi.y-rt;var on=ln(fi,qi),ji=ln(fi,qi,ot);on>wi||on===wi&&(!vt||ji>=Ri)?(pe.current.tb=!0,yi=qi,rt=-rt,ki.points=[Et(gi,0),Et(ai,0)]):pe.current.tb=!1}var cn=tn($i),Tn=gi[1]===ai[1];if(cn&&gi[1]==="l"&&(Pi>St.right||pe.current.rl)){var hn=fi;Tn?hn-=de-He:hn=Ti.x-Mi.x-Pe;var bn=ln(hn,yi),an=ln(hn,yi,ot);bn>wi||bn===wi&&(!vt||an>=Ri)?(pe.current.rl=!0,fi=hn,Pe=-Pe,ki.points=[Et(gi,1),Et(ai,1)]):pe.current.rl=!1}if(cn&&gi[1]==="r"&&(Ii<St.left||pe.current.lr)){var fn=fi;Tn?fn+=de-He:fn=Di.x-Bi.x-Pe;var gn=ln(fn,yi),Mn=ln(fn,yi,ot);gn>wi||gn===wi&&(!vt||Mn>=Ri)?(pe.current.lr=!0,fi=fn,Pe=-Pe,ki.points=[Et(gi,1),Et(ai,1)]):pe.current.lr=!1}en();var dn=Zi===!0?0:Zi;typeof dn=="number"&&(Ii<ot.left&&(fi-=Ii-ot.left-Pe,Mt.x+He<ot.left+dn&&(fi+=Mt.x-ot.left+He-dn)),Pi>ot.right&&(fi-=Pi-ot.right-Pe,Mt.x>ot.right-dn&&(fi+=Mt.x-ot.right+dn)));var _n=Xi===!0?0:Xi;typeof _n=="number"&&(nn<ot.top&&(yi-=nn-ot.top-rt,Mt.y+ke<ot.top+_n&&(yi+=Mt.y-ot.top+ke-_n)),Ji>ot.bottom&&(yi-=Ji-ot.bottom-rt,Mt.y>ot.bottom-_n&&(yi+=Mt.y-ot.bottom+_n)));var Dn=At.x+fi,Bn=Dn+de,vn=At.y+yi,Hn=vn+ge,Un=Mt.x,Cn=Un+He,Jn=Mt.y,Ei=Jn+ke,Wn=Math.max(Dn,Un),Sn=Math.min(Bn,Cn),es=(Wn+Sn)/2,os=es-Dn,ts=Math.max(vn,Jn),ls=Math.min(Hn,Ei),Zn=(ts+ls)/2,Gi=Zn-vn;W==null||W(Re,ki);var pn=pi.right-At.x-(fi+At.width),kn=pi.bottom-At.y-(yi+At.height);zt===1&&(fi=Math.round(fi),pn=Math.round(pn)),Ft===1&&(yi=Math.round(yi),kn=Math.round(kn));var is={ready:!0,offsetX:fi/zt,offsetY:yi/Ft,offsetR:pn/zt,offsetB:kn/Ft,arrowX:os/zt,arrowY:Gi/Ft,scaleX:zt,scaleY:Ft,align:ki};$(is)}}),We=function(){Q.current+=1;var Be=Q.current;Promise.resolve().then(function(){Q.current===Be&&Xe()})},ze=function(){$(function(Be){return(0,N.Z)((0,N.Z)({},Be),{},{ready:!1})})};return(0,g.Z)(ze,[Le]),(0,g.Z)(function(){_e||ze()},[_e]),[X.ready,X.offsetX,X.offsetY,X.offsetR,X.offsetB,X.arrowX,X.arrowY,X.scaleX,X.scaleY,X.align,We]}var Jt=U(94480);function Qe(_e,Re,ee,Le,we){(0,g.Z)(function(){if(_e&&Re&&ee){let Q=function(){Le(),we()};var q=Re,W=ee,Y=te(q),re=te(W),X=ae(W),$=new Set([X].concat((0,Jt.Z)(Y),(0,Jt.Z)(re)));return $.forEach(function(he){he.addEventListener("scroll",Q,{passive:!0})}),X.addEventListener("resize",Q,{passive:!0}),Le(),function(){$.forEach(function(he){he.removeEventListener("scroll",Q),X.removeEventListener("resize",Q)})}}},[_e,Re,ee])}var kt=U(48736);function Ye(_e,Re,ee,Le,we,q,W,Y){var re=E.useRef(_e);re.current=_e;var X=E.useRef(!1);E.useEffect(function(){if(Re&&Le&&(!we||q)){var Q=function(){X.current=!1},he=function(mt){var Oe;re.current&&!W(((Oe=mt.composedPath)===null||Oe===void 0||(Oe=Oe.call(mt))===null||Oe===void 0?void 0:Oe[0])||mt.target)&&!X.current&&Y(!1)},pe=ae(Le);pe.addEventListener("pointerdown",Q,!0),pe.addEventListener("mousedown",he,!0),pe.addEventListener("contextmenu",he,!0);var Ae=(0,l.A)(ee);if(Ae&&(Ae.addEventListener("mousedown",he,!0),Ae.addEventListener("contextmenu",he,!0)),0)var Xe,We,ze,Ke;return function(){pe.removeEventListener("pointerdown",Q,!0),pe.removeEventListener("mousedown",he,!0),pe.removeEventListener("contextmenu",he,!0),Ae&&(Ae.removeEventListener("mousedown",he,!0),Ae.removeEventListener("contextmenu",he,!0))}}},[Re,ee,Le,we,q]);function $(){X.current=!0}return $}var gt=["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 Je(){var _e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ce.Z,Re=E.forwardRef(function(ee,Le){var we=ee.prefixCls,q=we===void 0?"rc-trigger-popup":we,W=ee.children,Y=ee.action,re=Y===void 0?"hover":Y,X=ee.showAction,$=ee.hideAction,Q=ee.popupVisible,he=ee.defaultPopupVisible,pe=ee.onPopupVisibleChange,Ae=ee.afterPopupVisibleChange,Xe=ee.mouseEnterDelay,We=ee.mouseLeaveDelay,ze=We===void 0?.1:We,Ke=ee.focusDelay,Be=ee.blurDelay,mt=ee.mask,Oe=ee.maskClosable,st=Oe===void 0?!0:Oe,Bt=ee.getPopupContainer,yt=ee.forceRender,ft=ee.autoDestroy,jt=ee.destroyPopupOnHide,si=ee.popup,ti=ee.popupClassName,Gt=ee.popupStyle,ri=ee.popupPlacement,Rt=ee.builtinPlacements,ut=Rt===void 0?{}:Rt,nt=ee.popupAlign,Mt=ee.zIndex,Ht=ee.stretch,Tt=ee.getPopupClassNameFromAlign,_t=ee.fresh,At=ee.alignPoint,vi=ee.onPopupClick,Zt=ee.onPopupAlign,Xt=ee.arrow,Dt=ee.popupMotion,Ve=ee.maskMotion,h=ee.popupTransitionName,m=ee.popupAnimation,y=ee.maskTransitionName,k=ee.maskAnimation,H=ee.className,ge=ee.getTriggerDOMNode,de=(0,be.Z)(ee,gt),ke=ft||jt||!1,He=E.useState(!1),lt=(0,me.Z)(He,2),Lt=lt[0],Ot=lt[1];(0,g.Z)(function(){Ot((0,v.Z)())},[]);var bt=E.useRef({}),Ut=E.useContext(De),vt=E.useMemo(function(){return{registerSubPopup:function(_i,Vi){bt.current[_i]=Vi,Ut==null||Ut.registerSubPopup(_i,Vi)}}},[Ut]),ht=(0,C.Z)(),ot=E.useState(null),wt=(0,me.Z)(ot,2),St=wt[0],pi=wt[1],zt=E.useRef(null),Ft=(0,Z.Z)(function(ii){zt.current=ii,(0,oe.Sh)(ii)&&St!==ii&&pi(ii),Ut==null||Ut.registerSubPopup(ht,ii)}),xt=E.useState(null),ni=(0,me.Z)(xt,2),mi=ni[0],Te=ni[1],Pe=E.useRef(null),rt=(0,Z.Z)(function(ii){(0,oe.Sh)(ii)&&mi!==ii&&(Te(ii),Pe.current=ii)}),qe=E.Children.only(W),Ge=(qe==null?void 0:qe.props)||{},tt={},pt=(0,Z.Z)(function(ii){var _i,Vi,Ai=mi;return(Ai==null?void 0:Ai.contains(ii))||((_i=(0,l.A)(Ai))===null||_i===void 0?void 0:_i.host)===ii||ii===Ai||(St==null?void 0:St.contains(ii))||((Vi=(0,l.A)(St))===null||Vi===void 0?void 0:Vi.host)===ii||ii===St||Object.values(bt.current).some(function(Ci){return(Ci==null?void 0:Ci.contains(ii))||ii===Ci})}),Ct=P(q,Dt,m,h),ui=P(q,Ve,k,y),qt=E.useState(he||!1),Si=(0,me.Z)(qt,2),ai=Si[0],gi=Si[1],bi=Q!=null?Q:ai,Li=(0,Z.Z)(function(ii){Q===void 0&&gi(ii)});(0,g.Z)(function(){gi(Q||!1)},[Q]);var ki=E.useRef(bi);ki.current=bi;var fi=E.useRef([]);fi.current=[];var yi=(0,Z.Z)(function(ii){var _i;Li(ii),((_i=fi.current[fi.current.length-1])!==null&&_i!==void 0?_i:bi)!==ii&&(fi.current.push(ii),pe==null||pe(ii))}),wi=E.useRef(),Ri=function(){clearTimeout(wi.current)},Ti=function(_i){var Vi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;Ri(),Vi===0?yi(_i):wi.current=setTimeout(function(){yi(_i)},Vi*1e3)};E.useEffect(function(){return Ri},[]);var Bi=E.useState(!1),Di=(0,me.Z)(Bi,2),Mi=Di[0],Yi=Di[1];(0,g.Z)(function(ii){(!ii||bi)&&Yi(!0)},[bi]);var $i=E.useState(null),rn=(0,me.Z)($i,2),Zi=rn[0],Xi=rn[1],tn=E.useState(null),nn=(0,me.Z)(tn,2),Ji=nn[0],Ii=nn[1],Pi=function(_i){Ii([_i.clientX,_i.clientY])},ei=It(bi,St,At&&Ji!==null?Ji:mi,ri,ut,nt,Zt),Pt=(0,me.Z)(ei,11),Yt=Pt[0],Ni=Pt[1],Ui=Pt[2],qi=Pt[3],on=Pt[4],ji=Pt[5],cn=Pt[6],Tn=Pt[7],hn=Pt[8],bn=Pt[9],an=Pt[10],fn=$e(Lt,re,X,$),gn=(0,me.Z)(fn,2),Mn=gn[0],dn=gn[1],_n=Mn.has("click"),Dn=dn.has("click")||dn.has("contextMenu"),Bn=(0,Z.Z)(function(){Mi||an()}),vn=function(){ki.current&&At&&Dn&&Ti(!1)};Qe(bi,mi,St,Bn,vn),(0,g.Z)(function(){Bn()},[Ji,ri]),(0,g.Z)(function(){bi&&!(ut!=null&&ut[ri])&&Bn()},[JSON.stringify(nt)]);var Hn=E.useMemo(function(){var ii=M(ut,q,bn,At);return p()(ii,Tt==null?void 0:Tt(bn))},[bn,Tt,ut,q,At]);E.useImperativeHandle(Le,function(){return{nativeElement:Pe.current,popupElement:zt.current,forceAlign:Bn}});var Un=E.useState(0),Cn=(0,me.Z)(Un,2),Jn=Cn[0],Ei=Cn[1],Wn=E.useState(0),Sn=(0,me.Z)(Wn,2),es=Sn[0],os=Sn[1],ts=function(){if(Ht&&mi){var _i=mi.getBoundingClientRect();Ei(_i.width),os(_i.height)}},ls=function(){ts(),Bn()},Zn=function(_i){Yi(!1),an(),Ae==null||Ae(_i)},Gi=function(){return new Promise(function(_i){ts(),Xi(function(){return _i})})};(0,g.Z)(function(){Zi&&(an(),Zi(),Xi(null))},[Zi]);function pn(ii,_i,Vi,Ai){tt[ii]=function(Ci){var zn;Ai==null||Ai(Ci),Ti(_i,Vi);for(var An=arguments.length,cs=new Array(An>1?An-1:0),_s=1;_s<An;_s++)cs[_s-1]=arguments[_s];(zn=Ge[ii])===null||zn===void 0||zn.call.apply(zn,[Ge,Ci].concat(cs))}}(_n||Dn)&&(tt.onClick=function(ii){var _i;ki.current&&Dn?Ti(!1):!ki.current&&_n&&(Pi(ii),Ti(!0));for(var Vi=arguments.length,Ai=new Array(Vi>1?Vi-1:0),Ci=1;Ci<Vi;Ci++)Ai[Ci-1]=arguments[Ci];(_i=Ge.onClick)===null||_i===void 0||_i.call.apply(_i,[Ge,ii].concat(Ai))});var kn=Ye(bi,Dn,mi,St,mt,st,pt,Ti),is=Mn.has("hover"),ln=dn.has("hover"),en,mn;is&&(pn("onMouseEnter",!0,Xe,function(ii){Pi(ii)}),pn("onPointerEnter",!0,Xe,function(ii){Pi(ii)}),en=function(_i){(bi||Mi)&&St!==null&&St!==void 0&&St.contains(_i.target)&&Ti(!0,Xe)},At&&(tt.onMouseMove=function(ii){var _i;(_i=Ge.onMouseMove)===null||_i===void 0||_i.call(Ge,ii)})),ln&&(pn("onMouseLeave",!1,ze),pn("onPointerLeave",!1,ze),mn=function(){Ti(!1,ze)}),Mn.has("focus")&&pn("onFocus",!0,Ke),dn.has("focus")&&pn("onBlur",!1,Be),Mn.has("contextMenu")&&(tt.onContextMenu=function(ii){var _i;ki.current&&dn.has("contextMenu")?Ti(!1):(Pi(ii),Ti(!0)),ii.preventDefault();for(var Vi=arguments.length,Ai=new Array(Vi>1?Vi-1:0),Ci=1;Ci<Vi;Ci++)Ai[Ci-1]=arguments[Ci];(_i=Ge.onContextMenu)===null||_i===void 0||_i.call.apply(_i,[Ge,ii].concat(Ai))}),H&&(tt.className=p()(Ge.className,H));var yn=E.useRef(!1);yn.current||(yn.current=yt||bi||Mi);var Kn=(0,N.Z)((0,N.Z)({},Ge),tt),Pn={},us=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];us.forEach(function(ii){de[ii]&&(Pn[ii]=function(){for(var _i,Vi=arguments.length,Ai=new Array(Vi),Ci=0;Ci<Vi;Ci++)Ai[Ci]=arguments[Ci];(_i=Kn[ii])===null||_i===void 0||_i.call.apply(_i,[Kn].concat(Ai)),de[ii].apply(de,Ai)})});var gs=E.cloneElement(qe,(0,N.Z)((0,N.Z)({},Kn),Pn)),ns={x:ji,y:cn},Rs=Xt?(0,N.Z)({},Xt!==!0?Xt:{}):null;return E.createElement(E.Fragment,null,E.createElement(ve.Z,{disabled:!bi,ref:rt,onResize:ls},E.createElement(ie,{getTriggerDOMNode:ge},gs)),yn.current&&E.createElement(De.Provider,{value:vt},E.createElement(z,{portal:_e,ref:Ft,prefixCls:q,popup:si,className:p()(ti,Hn),style:Gt,target:mi,onMouseEnter:en,onMouseLeave:mn,onPointerEnter:en,zIndex:Mt,open:bi,keepDom:Mi,fresh:_t,onClick:vi,onPointerDownCapture:kn,mask:mt,motion:Ct,maskMotion:ui,onVisibleChanged:Zn,onPrepare:Gi,forceRender:yt,autoDestroy:ke,getPopupContainer:Bt,align:bn,arrow:Rs,arrowPos:ns,ready:Yt,offsetX:Ni,offsetY:Ui,offsetR:qi,offsetB:on,onAlign:Bn,stretch:Ht,targetWidth:Jn/Tn,targetHeight:es/hn})))});return Re}var Me=Je(ce.Z)},2524:function(Wt,at,U){"use strict";var N=U(59301),me=U(93314),be=U(7939),ce=Object.defineProperty,G=Object.defineProperties,p=Object.getOwnPropertyDescriptors,ve=Object.getOwnPropertySymbols,oe=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,Z=(E,A,O)=>A in E?ce(E,A,{enumerable:!0,configurable:!0,writable:!0,value:O}):E[A]=O,C=(E,A)=>{for(var O in A||(A={}))oe.call(A,O)&&Z(E,O,A[O]);if(ve)for(var O of ve(A))l.call(A,O)&&Z(E,O,A[O]);return E},g=(E,A)=>G(E,p(A));const v=({img:E,buttonProps:A={},styles:O={},customText:j,ButtonText:V,ButtonClick:L,Buttonclass:I,ButtonTwo:w,imgStyles:R,loading:z=!1,className:ne=""})=>N.createElement("section",{className:`tc animated fadeIn ${ne}`,style:C({color:"#999",margin:"100px auto",visibility:z?"hidden":"visible"},O)},N.createElement("img",{src:E||me,style:g(C({},R),{pointerEvents:"none",userSelect:"none"})}),N.createElement("p",{className:"mt20 font14"},j||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),V&&N.createElement(be.ZP,C({className:I,onClick:L},A),V),w&&w);at.Z=v},52918:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return I}});var N=U(59301),me={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},be=U(7939),ce=U(70557),G=U(50258),p=U(25399),ve=U(65862),oe=U(87513),l=U(2524),Z=U(74128),C=U(7310),g=U(59301),v=Object.defineProperty,E=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,j=(w,R,z)=>R in w?v(w,R,{enumerable:!0,configurable:!0,writable:!0,value:z}):w[R]=z,V=(w,R)=>{for(var z in R||(R={}))A.call(R,z)&&j(w,z,R[z]);if(E)for(var z of E(R))O.call(R,z)&&j(w,z,R[z]);return w},L=(w,R,z)=>new Promise((ne,ie)=>{var ye=$e=>{try{xe(z.next($e))}catch(J){ie(J)}},De=$e=>{try{xe(z.throw($e))}catch(J){ie(J)}},xe=$e=>$e.done?ne($e.value):Promise.resolve($e.value).then(ye,De);xe((z=z.apply(w,R)).next())}),I=({editOffice:w="view",data:R,issaver:z,onSaver:ne,theme:ie,type:ye,filename:De,monacoEditor:xe,className:$e,style:J,close:D,onClose:M,hasMask:P,disabledDownload:ae,onImgDimensions:te,showNodata:S,recordInfo:b})=>{const[K,le]=(0,N.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Ee,Fe]=(0,N.useState)(""),[et,Et]=(0,N.useState)(),It=window.ENV==="build"?"/react/build":"",Jt=location.host.startsWith("localhost")?Z.Z.PROXY_SERVER:Z.Z.API_SERVER,kt=10*(1024*1024),Ye=(0,N.useRef)();R!=null&&R.startsWith("/api")&&ye!=="txt"&&(R=Z.Z.API_SERVER+R);const gt=ee=>ee.substring(ee.lastIndexOf("/")+1).split(".").pop();De&&xe&&(xe.filename=De),(0,N.useEffect)(()=>{var ee,Le;const we=(Le=(ee=document.cookie)==null?void 0:ee.replace(/\s/g,""))==null?void 0:Le.split(";");we==null||we.map(q=>{let W=q.split("=");W[0]==="_educoder_session"&&Fe(W[1])})},[]),(0,N.useEffect)(()=>{ye==="office"&&(R.indexOf("bigfilescdn.")>-1||R.indexOf("bigfiles1")>-1?Et({url:R,fileType:gt(R),model:R.indexOf("model=edit")?"edit":"view"}):Me())},[ye,R]);function Je(ee){return L(this,null,function*(){ee.data.type==="pdfdata"&&(ne(ee.data.data),window.removeEventListener("message",Je,!1)),console.log("mess---:",ee.data)})}const Me=()=>L(void 0,null,function*(){console.log("data:",R);let ee=R;R.startsWith("http")||(ee=location.origin+ee);let Le=new URL(ee).pathname.split("/").pop();const we=yield(0,oe.gJ)({attachment_id:Le});we.url=Jt+we.url,Et(we)}),_e=()=>{if(R.startsWith("http")||R.startsWith("blob:")){Re();return}(0,ve.Sv)(De||"educoder",R,De)},Re=()=>{b&&(0,C.fc)({id:b==null?void 0:b.id,watch_type:1,course_id:b==null?void 0:b.course_id}),(0,ve.Nd)(De||"educoder",decodeURIComponent(R))};return g.createElement("div",{style:V({},J||{}),className:`${P&&me.bgBlack} ${ye?me.wrp:"hide"}`},D&&g.createElement("div",{className:me.close,ref:Ye},!!te&&g.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>Ye.current},g.createElement("span",{onClick:()=>{M(),te()}},g.createElement("i",{className:"icon-yulanpizhu"}))),!ae&&g.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>Ye.current},g.createElement("span",{onClick:Re},g.createElement("i",{className:"icon-quxiaozhiding"}))),z&&g.createElement(p.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>Ye.current},g.createElement("span",{className:"",onClick:()=>{const ee=document.getElementById("pdfiframe");window.addEventListener("message",Je,!1),setTimeout(()=>{ee.contentWindow.postMessage("getData","*")},300)}},g.createElement("i",{className:"icon-baocun"}))),g.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>Ye.current},g.createElement("span",{className:"",onClick:()=>{M()}},g.createElement("i",{className:"icon-guanbi1"})))),g.createElement("div",{className:`${me[$e]} ${$e} ${me.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"&&et&&g.createElement("iframe",{src:`${It}/office.html?key=${et.key}&url=${btoa(et.url)}&callbackUrl=${Jt+(et.callbackUrl||"")}&fileType=${et.fileType}&title=${et.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:`${It}/js/pdf/index.html?filename=${De||"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(be.ZP,{icon:g.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:_e,disabled:ae},"\u4E0B\u8F7D")}):g.createElement(be.ZP,{type:"primary",size:"middle",onClick:_e,disabled:ae},g.createElement(ce.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"})))}},44080:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return A}});var N=U(59301),me=U(6767),be=U(75727),ce=U(73217),G=U(80360),p=U(41867),ve=U(56102),oe=U(84056),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=(O,j,V)=>new Promise((L,I)=>{var w=ne=>{try{z(V.next(ne))}catch(ie){I(ie)}},R=ne=>{try{z(V.throw(ne))}catch(ie){I(ie)}},z=ne=>ne.done?L(ne.value):Promise.resolve(ne.value).then(w,R);z((V=V.apply(O,j)).next())});function C(O){if(isNaN(O))return{minutes:"00",seconds:"00"};const j=new Date(O*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(O,j){return O-j}function v(O){O.sort(g);let j=0;for(let V=0;V<O.length-1;V++){let L=Math.abs(O[V+1]-O[V]);L<21&&(j+=L)}return j}const E=/(android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini)/i;var A=(0,N.forwardRef)(({allow_skip:O,src:j,toLog:V,videoId:L,logWatchHistory:I,courseId:w=null,startTime:R,handlePause:z=()=>{},handlePlay:ne=()=>{},handlePlayEnded:ie=()=>{},autoPlay:ye=!1,onPlayEnded:De=()=>{},isShowWaterMark:xe=!0},$e)=>{var J;j=j==null?void 0:j.replace("http://","https://");const M=((J=j==null?void 0:j.split("."))==null?void 0:J.pop())==="flv",P=(0,N.useRef)(),ae=(0,N.useRef)(),te=(0,N.useRef)(),S=(0,N.useRef)(),b=(0,N.useRef)(),K=(0,N.useRef)(),le=(0,N.useRef)(),Ee=(0,N.useRef)(),Fe=(0,N.useRef)(),et=(0,N.useRef)(),Et=(0,N.useRef)(),It=(0,N.useRef)(),Jt=(0,N.useRef)(),Qe=(0,N.useRef)(),kt=navigator.userAgent.toLowerCase().match(E),Ye=kt?kt[0]:"pc",gt=(0,N.useRef)(!1),Je=(0,p.eY)();let Me=0,_e=0,Re=0,ee=null,Le=!1,we=20,q=1,W=!1,Y=!1,re=[];(0,N.useImperativeHandle)($e,()=>({getLastUpdatedTime:()=>P.current.currentTime,getDuration:()=>P.current.duration})),me.ZP.config({maxCount:1,getContainer:()=>te.current});const X=(0,N.useCallback)((We,ze=!1)=>{let Ke={point:P.current.currentTime};ee?(Ke.log_id=ee,Ke.watch_duration=v(re),Ke.total_duration=_e):(w?(Ke.video_id=parseInt(L,10),Ke.course_id=w):Ke.video_id=L,Ke.duration=Me,Ke.device=Ye),ze&&(Ke.ed="1");function Be(){return Z(this,null,function*(){W=!0,ee=yield I==null?void 0:I(Ke),W=!1,We&&We()})}Be()},[L,w]);(0,N.useEffect)(()=>{P.current&&(S.current.style.display="none",b.current.style.display="block"),me.ZP.destroy();let We=null;return ce.Z.isSupported&&M&&j&&(j==null?void 0:j.indexOf(".m3u8"))<0?(We=ce.Z.createPlayer({type:"flv",volume:.8,cors:!0,url:j,muted:!1}),P.current&&(We.attachMediaElement(P.current),We.load())):P.current.setAttribute("src",j),Q(),()=>{We&&(We.unload(),We.pause(),We.destroy(),We=null)}},[P,M,j]);function $(){P.current.paused?(S.current.style.display="none",b.current.style.display="block"):(S.current.style.display="block",b.current.style.display="none")}function Q(){Et.current.style.display="none",Jt.current.style.display="none",It.current.style.display="none",P.current.muted||P.current.volume===0?Et.current.style.display="block":P.current.volume>0&&P.current.volume<=.5?Jt.current.style.display="block":It.current.style.display="block"}(0,N.useEffect)(()=>{const We=document.getElementById("play"),ze=document.querySelectorAll(".playback-icons use");function Ke(){ne(),R&&!gt.current&&(P.current.currentTime=R),gt.current=!0,re.push(P.current.currentTime),Le||(Le=!0,V&&X())}function Be(){return Z(this,null,function*(){$(),re.push(P.current.currentTime),V&&X(()=>{ee=null,Re=0,Le=!1,W=!1,Y=!1,re=[],_e=0,q=1},!0),De()})}function mt(){K.current.value=Math.round(P.current.currentTime),le.current.value=Math.round(P.current.currentTime)}function Oe(){const ut=C(Math.round(P.current.currentTime));Fe.current.innerText=`${ut.hour>0?ut.hour+":":""}${ut.minutes}:${ut.seconds}`,Fe.current.setAttribute("datetime",`${ut.hour>0?" "+ut.hour+" ":""}${ut.minutes}m ${ut.seconds}s`)}function st(){var ut,nt,Mt,Ht,Tt,_t,At;const vi=Math.round((ut=P.current)==null?void 0:ut.duration);(Mt=(nt=K.current)==null?void 0:nt.setAttribute)==null||Mt.call(nt,"max",vi),(Tt=(Ht=le.current)==null?void 0:Ht.setAttribute)==null||Tt.call(Ht,"max",vi);const Zt=C(vi);Ee.current&&(Ee.current.innerText=`${Zt.hour>0?Zt.hour+":":""}${Zt.minutes}:${Zt.seconds}`,(At=(_t=Ee.current).setAttribute)==null||At.call(_t,"datetime",`${Zt.hour>0?" "+Zt.hour+" ":""}${Zt.minutes}m ${Zt.seconds}s`))}function Bt(){try{const ut=Math.round(P.current.duration);K.current.setAttribute("max",ut),le.current.setAttribute("max",ut);const nt=C(ut);Ee.current.innerText=`${nt.hour>0?nt.hour+":":""}${nt.minutes}:${nt.seconds}`,Ee.current.setAttribute("datetime",`${nt.hour>0?" "+nt.hour+" ":""}${nt.minutes}m ${nt.seconds}s`),mt(),Oe();const{width:Mt,height:Ht,x:Tt,y:_t}=ae.current.getBoundingClientRect();if(Tt<0||_t<0,!Y){let At=P.current.currentTime,vi=At-Re;Math.abs(vi)<10?(_e+=Math.abs(vi),Re=At,W||_e-q*we>=0&&(q++,re.push(Re),V&&X())):(Re=At,V&&X())}}catch(ut){console.log("videoplaying:",ut)}}function yt(){Y=!0}function ft(){P.current.playing&&re.push(P.current.currentTime,Re),Re=P.current.currentTime,Y=!1}function jt(){Me=P.current.duration,Me<=20&&(we=Me/3),P.current.addEventListener("play",Ke)}function si(ut){ut.preventDefault(),(0,oe.vp)()?(P.current.style.width="100%",P.current.style.height="100%"):P.current.style.cssText=""}function ti(){z()}function Gt(ut){if(!O){me.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");return}const nt=ut.target.dataset.seek?ut.target.dataset.seek:ut.target.value;P.current.currentTime=nt,le.current.value=nt,K.current.value=nt}function ri(ut){const nt=Math.round(ut.offsetX/ut.target.clientWidth*parseInt(ut.target.getAttribute("max"),10));K.current.setAttribute("data-seek",nt);const Mt=C(nt);et.current.textContent=`${Mt.hour>0?Mt.hour+":":""}${Mt.minutes}:${Mt.seconds}`;const Ht=P.current.getBoundingClientRect();et.current.style.left=`${ut.pageX-Ht.left}px`}function Rt(ut){switch(ut.code){case"Space":ut.preventDefault(),Ae();break;case"ArrowRight":if(ut.preventDefault(),!O){me.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(P.current.currentTime>=P.current.duration)break;P.current.currentTime=parseInt(P.current.currentTime)+5,mt();break;case"ArrowLeft":if(ut.preventDefault(),!O){me.ZP.warning("\u8BE5\u89C6\u9891\u7981\u6B62\u5FEB\u8FDB/\u540E\u9000\u64AD\u653E");break}if(P.current.currentTime===0)break;P.current.currentTime=parseInt(P.current.currentTime)-5,mt();break;case"ArrowUp":ut.preventDefault(),P.current.volume<1&&(P.current.volume=(parseInt(P.current.volume*10)+1)/10);break;case"ArrowDown":ut.preventDefault(),P.current.volume>0&&(P.current.volume=(parseInt(P.current.volume*10)-1)/10);break}}return te.current.addEventListener((0,oe.gH)(),si),P.current.addEventListener("canplay",jt),P.current.addEventListener("ended",Be),P.current.addEventListener("seeking",yt),P.current.addEventListener("seeked",ft),P.current.addEventListener("loadedmetadata",st),K.current.addEventListener("mousemove",ri),K.current.addEventListener("input",Gt),P.current.addEventListener("timeupdate",Bt),P.current.addEventListener("pause",ti),P.current.addEventListener("volumechange",Q),document.addEventListener("keydown",Rt),()=>{var ut,nt,Mt,Ht,Tt,_t,At,vi,Zt,Xt,Dt,Ve;(ut=P.current)==null||ut.removeEventListener("canplay",jt),(nt=P.current)==null||nt.removeEventListener("play",Ke),(Mt=P.current)==null||Mt.removeEventListener("ended",Be),(Ht=P.current)==null||Ht.removeEventListener("seeking",yt),(Tt=P.current)==null||Tt.removeEventListener("seeked",ft),(_t=K.current)==null||_t.removeEventListener("mousemove",ri),(At=K.current)==null||At.removeEventListener("input",Gt),(vi=P.current)==null||vi.removeEventListener("timeupdate",Bt),(Zt=P.current)==null||Zt.removeEventListener("pause",ti),(Xt=P.current)==null||Xt.removeEventListener("loadedmetadata",st),(Dt=P.current)==null||Dt.removeEventListener("volumechange",Q),document.removeEventListener("keydown",Rt),(Ve=P.current)!=null&&Ve.playing&&(re.push(Re,P.current.currentTime),V&&X())}},[P,j]),(0,N.useEffect)(()=>{if(P.current.onended=()=>{ie(P)},P.current.oncontextmenu=()=>!1,(j==null?void 0:j.indexOf(".m3u8"))>-1){if(P.current.canPlayType("application/vnd.apple.mpegurl"))P.current.src=j;else if(G.ZP.isSupported()){var We=new G.ZP;We.loadSource(j),We.attachMedia(P.current)}}},[j]);const[he,pe]=(0,N.useState)(1),Ae=()=>{P.current.paused||P.current.ended?P.current.play():P.current.pause(),$()};function Xe(){P.current.muted=!P.current.muted,P.current.muted?(Qe.current.setAttribute("data-volume",volume.value),Qe.current.value=0):Qe.current.value=Qe.current.dataset.volume}return N.createElement("div",{style:{position:"relative"},ref:te},N.createElement("div",{ref:ae,className:`${l.watermark} animated_alternate animate__animated_10s animate__infinite animate__stepstart ${l.animate__loop}`},xe&&Je?Je.login:" "),N.createElement("div",{className:l.container},N.createElement("div",{className:l["video-container"],id:"video-container"},N.createElement("div",{className:l["playback-animation"],id:"playback-animation"},N.createElement("svg",{className:l["playback-icons"]},N.createElement("use",{className:"hidden",href:"#play-icon"}),N.createElement("use",{href:"#pause"}))),N.createElement("video",{className:l.video,id:"video",preload:"auto",disablePictureInPicture:!0,ref:P,autoPlay:ye}),N.createElement("div",{className:`${l["video-controls"]} `,id:"video-controls"},N.createElement("div",{className:l["bottom-controls"]},N.createElement("div",{className:l["left-controls"]},N.createElement("button",{"data-title":"\u64AD\u653E/\u6682\u505C",id:"play",onClick:Ae},N.createElement("svg",{className:l["playback-icons"]},N.createElement("use",{ref:b,href:"#play-icon"}),N.createElement("use",{ref:S,style:{display:"none"},href:"#pause"}))),N.createElement("div",{className:l.time},N.createElement("time",{id:"time-elapsed",ref:Fe},"00:00"),N.createElement("span",null," / "),N.createElement("time",{id:"duration",ref:Ee},"00:00"))),N.createElement("div",{className:l["right-controls"]},O&&N.createElement(be.Z,{placement:"top",overlayClassName:l.rateOverlay,getPopupContainer:We=>We.parentNode,menu:{items:[{key:"1",label:N.createElement("span",{onClick:()=>{pe(1),P.current.playbackRate=1}},"1.0x")},{key:"2",label:N.createElement("span",{onClick:()=>{pe(1.5),P.current.playbackRate=1.5}},"1.5x")},{key:"3",label:N.createElement("span",{onClick:()=>{pe(2),P.current.playbackRate=2}},"2.0x")}]}},N.createElement("div",{className:`${l.controlText} mr5`},"\u500D\u901F")),N.createElement(ve.CopyToClipboard,{text:j,onCopy:()=>me.ZP.success("\u590D\u5236\u6210\u529F")},N.createElement("button",{"data-title":"\u590D\u5236\u94FE\u63A5"},N.createElement("i",{className:"icon-lianjie2 iconfont",style:{fontSize:"12px",color:"white"}}))),N.createElement("div",{className:l["volume-controls"]},N.createElement("button",{"data-title":"\u5F00\u542F/\u5173\u95ED\u58F0\u97F3",className:l["volume-button"],id:"volume-button",onClick:Xe},N.createElement("i",{ref:Et,className:"icon-a-bianzu8 iconfont",style:{fontSize:"14px",color:"white"}}),N.createElement("i",{ref:Jt,className:"icon-shengyinkaibeifen iconfont",style:{fontSize:"14px",color:"white"}}),N.createElement("i",{ref:It,className:"icon-shengyinkai iconfont",style:{fontSize:"14px",color:"white"}})),N.createElement("input",{className:l.volume,id:"volume",value:"1","data-mute":"0.5",type:"range",max:"1",min:"0",step:"0.01",ref:Qe,style:{display:"none"},onClick:Q})),N.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)}},N.createElement("i",{className:"icon-fangda1 iconfont",style:{fontSize:"12px",color:"white"}})))),N.createElement("div",{className:l["video-progress"]},N.createElement("progress",{ref:le,value:"0",min:"0"}),N.createElement("input",{className:l.seek,ref:K,value:"0",min:"0",type:"range",step:"1"}),N.createElement("div",{className:l["seek-tooltip"],ref:et,id:"seek-tooltip"},"00:00"))))),N.createElement("svg",{style:{display:"none"}},N.createElement("defs",null,N.createElement("symbol",{id:"pause",viewBox:"0 0 24 24"},N.createElement("path",{d:"M14.016 5.016h3.984v13.969h-3.984v-13.969zM6 18.984v-13.969h3.984v13.969h-3.984z"})),N.createElement("symbol",{id:"play-icon",viewBox:"0 0 24 24"},N.createElement("path",{d:"M8.016 5.016l10.969 6.984-10.969 6.984v-13.969z"})),N.createElement("symbol",{id:"volume-high",viewBox:"0 0 24 24"},N.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"})),N.createElement("symbol",{id:"volume-low",viewBox:"0 0 24 24"},N.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"})),N.createElement("symbol",{id:"volume-mute",viewBox:"0 0 24 24"},N.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"})),N.createElement("symbol",{id:"fullscreen",viewBox:"0 0 24 24"},N.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"})),N.createElement("symbol",{id:"fullscreen-exit",viewBox:"0 0 24 24"},N.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"})),N.createElement("symbol",{id:"pip",viewBox:"0 0 24 24"},N.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"})))))})},50258:function(Wt,at,U){"use strict";U.d(at,{SV:function(){return kt},ZP:function(){return Qe}});var N=U(59301),me=U(76374);const be={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"]},ce={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=(Ye,gt,Je)=>new Promise((Me,_e)=>{var Re=we=>{try{Le(Je.next(we))}catch(q){_e(q)}},ee=we=>{try{Le(Je.throw(we))}catch(q){_e(q)}},Le=we=>we.done?Me(we.value):Promise.resolve(we.value).then(Re,ee);Le((Je=Je.apply(Ye,gt)).next())});const C={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=(Ye,gt,Je,Me)=>{const _e=gt.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:Je.lineNumber,endColumn:Je.column});return Array.from(new Set(_e.match(/\b\w{2,}\b/g)||[])).map(ee=>({label:ee,kind:Ye.languages.CompletionItemKind.Text,insertText:ee,range:Me}))},v=(Ye,gt,Je,Me)=>{Ye.languages.registerCompletionItemProvider(gt,{provideCompletionItems(_e,Re){const ee=_e.getWordUntilPosition(Re),Le={startLineNumber:Re.lineNumber,endLineNumber:Re.lineNumber,startColumn:ee.startColumn,endColumn:ee.endColumn},we=_e.getLineContent(Re.lineNumber).substring(ee.startColumn-2,ee.endColumn);return{suggestions:[...g(Ye,_e,Re,Le),...Je.map(W=>({label:W,kind:Ye.languages.CompletionItemKind.Keyword,documentation:W,insertText:W,insertTextRules:Ye.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le})),...Me.map(W=>({label:W.label,kind:Ye.languages.CompletionItemKind.Snippet,documentation:W.content,insertText:we.startsWith("#")?W.content.replace(/#/,""):W.content,insertTextRules:Ye.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:Le}))]}}})};var E=Ye=>{C.languages.forEach(gt=>{Ye.languages.registerDocumentFormattingEditProvider(gt,{provideDocumentFormattingEdits(Je){return Z(this,null,function*(){const Me=l()(Je.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:Je.getFullModelRange(),text:Me}]})}})}),v(Ye,"java",ce.keywords,ce.quickKey),v(Ye,"cpp",G.keywords,G.quickKey),v(Ye,"c",be.keywords,[]),v(Ye,"python",p.keywords,p.quickKey),v(Ye,"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 O=Object.defineProperty,j=(Ye,gt,Je)=>gt in Ye?O(Ye,gt,{enumerable:!0,configurable:!0,writable:!0,value:Je}):Ye[gt]=Je,V=(Ye,gt,Je)=>j(Ye,typeof gt!="symbol"?gt+"":gt,Je);const L=class xl{constructor(gt,Je,Me){this.placeholder=gt,this.editor=Je,this.monaco=Me,Je.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return xl.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),z=U(6767),ne=U(25399),ie=U(89392),ye=U(77254),De=U(56102),xe=Object.defineProperty,$e=Object.defineProperties,J=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,ae=(Ye,gt,Je)=>gt in Ye?xe(Ye,gt,{enumerable:!0,configurable:!0,writable:!0,value:Je}):Ye[gt]=Je,te=(Ye,gt)=>{for(var Je in gt||(gt={}))M.call(gt,Je)&&ae(Ye,Je,gt[Je]);if(D)for(var Je of D(gt))P.call(gt,Je)&&ae(Ye,Je,gt[Je]);return Ye},S=(Ye,gt)=>$e(Ye,J(gt)),b=(Ye,gt)=>{var Je={};for(var Me in Ye)M.call(Ye,Me)&>.indexOf(Me)<0&&(Je[Me]=Ye[Me]);if(Ye!=null&&D)for(var Me of D(Ye))gt.indexOf(Me)<0&&P.call(Ye,Me)&&(Je[Me]=Ye[Me]);return Je},K=(Ye,gt,Je)=>new Promise((Me,_e)=>{var Re=we=>{try{Le(Je.next(we))}catch(q){_e(q)}},ee=we=>{try{Le(Je.throw(we))}catch(q){_e(q)}},Le=we=>we.done?Me(we.value):Promise.resolve(we.value).then(Re,ee);Le((Je=Je.apply(Ye,gt)).next())});function le(Ye){return/^\d+$/.test(Ye)?`${Ye}px`:Ye}function Ee(){}let Fe=!1;const et={"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 Et(Ye=[]){let gt=Ye;if(Array.isArray(Ye)){for(let Je=0;Je<Ye.length;Je++){let Me=et[Ye[Je]];if(Me)return Me}return gt[0]}return et[gt]||gt}let It=null;const Jt=()=>K(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(Ye){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",Ye)}});var Qe=Ye=>{var gt=Ye,{width:Je="100%",height:Me="100%",value:_e,language:Re="javascript",style:ee={},options:Le={},overrideServices:we={},theme:q="vs-dark",onEditBlur:W,isCopy:Y=!1,onSave:re,autoHeight:X=!1,forbidCopy:$=!1,onChange:Q=Ee,editorDidMount:he=Ee,onFocus:pe=Ee,onBreakPoint:Ae=Ee,breakPointValue:Xe=[],filename:We="educoder.txt",errorLine:ze,errorContent:Ke="",highlightLine:Be,openBreakPoint:mt=!1,placeholder:Oe="",showMiniMap:st=!0}=gt,Bt=b(gt,["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 yt=(0,N.useRef)(),ft=(0,N.useRef)({}),jt=(0,N.useRef)(),si=(0,N.useRef)(),ti=(0,N.useRef)([]),Gt=(0,N.useRef)(!1),ri=(0,N.useRef)(),Rt=(0,N.useRef)(),ut=(0,N.useRef)(!1),[nt,Mt]=(0,N.useState)(!1);function Ht(){let de;return yt.current&&(de=new me.Z(ke=>{for(let He of ke)(He.target.offsetHeight>0||He.target.offsetWidth>0)&&ft.current.instance.layout()}),de.observe(yt.current)),de}function Tt(){z.ZP.warning({content:decodeURIComponent(A),key:"monaco-editor-tip"})}const _t=()=>{let de=ft.current.instance;if(_e!=null&&de&&nt){const ke=de.getModel();ke&&_e!==ke.getValue()&&(Fe=!0,ke.setValue(_e),de.layout(),Fe=!1)}};(0,N.useEffect)(()=>{const de=ye.Z.subscribe("formatDocument",ke=>{var He;let lt=ft.current.instance;(He=lt==null?void 0:lt.getAction)==null||He.call(lt,"editor.action.formatDocument").run()});return window.updateMonacoValue=ke=>{Q(ke)},de},[]),(0,N.useEffect)(()=>{var de;let ke=ft.current.instance;si.current&&clearTimeout(si.current),si.current=setTimeout(()=>{_t()},500),_e&&(_e!=null&&_e.length)&&((de=ke==null?void 0:ke.updateOptions)==null||de.call(ke,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(_e.split(/\r\n|\r|\n/g).length))+3,5)}))},[_e,nt,ft.current]),(0,N.useEffect)(()=>{if(ze&&ft.current&&ft.current.instance){let ke=ft.current.instance;ke.changeViewZones(function(He){var lt=document.createElement("div");lt.style.padding="10px 20px",lt.style.width="calc(100% - 20px)",lt.className="my-error-line-wrp",lt.innerHTML=Ke,He.addZone({afterLineNumber:ze||11,heightInLines:3,domNode:lt})});var de={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}};ke.addOverlayWidget(de),ke.revealPositionInCenter({lineNumber:20,column:1})}},[ze,ft.current,nt]);const At=(de="",ke)=>{if(!de||de.trim()==="")return!0;const lt=ft.current.instance.getModel().getLineTokens(ke);let Lt=!1;for(let Ot=0;Ot<2;Ot++)lt.getStandardTokenType(Ot)===1&&(Lt=!0);return Lt};(0,N.useEffect)(()=>{var de;const ke=(de=ft.current)==null?void 0:de.instance;if(ke&&nt&&$){const He=ke.onDidBlurEditorWidget(()=>{ut.current=!1}),lt=ke.onDidFocusEditorText(()=>{ut.current=!0});return()=>{He.dispose(),lt.dispose()}}},[ft.current,nt,$]),(0,N.useEffect)(()=>{var de;if((de=ft.current)!=null&&de.instance&&nt&&mt){let ke=ft.current.instance,He=ke.getModel();if(!He)return;(()=>{var zt;let Ft=[],xt=[];const ni=He.getAllDecorations();for(let Te of ni)Te.options.className==="highlighted-line"&&(Ft.push((zt=Te==null?void 0:Te.range)==null?void 0:zt.startLineNumber),xt.push(Te==null?void 0:Te.id));if(Be===Ft[0])return;He.deltaDecorations(xt,[]);const mi=He.getLineCount();Be&&Be<=mi&&(ke.deltaDecorations([],[{range:new It.Range(Be,1,Be,He.getLineMaxColumn(Be)),options:{isWholeLine:!0,className:"highlighted-line"}}]),ke.revealLineInCenter(Be))})();const Lt=(zt=!1)=>{var Ft;let xt=[],ni=[];const mi=He.getAllDecorations();for(let Te of mi)Te.options.linesDecorationsClassName==="breakpoints-select"&&(xt.push((Ft=Te==null?void 0:Te.range)==null?void 0:Ft.startLineNumber),ni.push(Te==null?void 0:Te.id));if(zt)return{lines:xt,ids:ni};Ae(xt)},Ot=zt=>K(void 0,null,function*(){let Ft={range:new It.Range(zt,1,zt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield He.deltaDecorations([],[Ft]),Lt()}),bt=zt=>K(void 0,null,function*(){let Ft=[];const xt=ke.getLineDecorations(zt);for(let ni of xt)ni.options.linesDecorationsClassName==="breakpoints-select"&&Ft.push(ni.id);yield He.deltaDecorations(Ft,[]),Lt()}),Ut=zt=>{let Ft=ke.getLineDecorations(zt);for(let xt of Ft)if(xt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,ie.isEqual)(Xe,Lt(!0).lines)){He.deltaDecorations(Lt(!0).ids,[]);const zt=Xe.map(Ft=>({range:new It.Range(Ft,1,Ft,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));He.deltaDecorations([],zt)}const vt=ke.onDidChangeModelContent(zt=>{let Ft=ke.getPosition();if(Ft){let xt=Ft.lineNumber;clearTimeout(Rt.current),Rt.current=setTimeout(()=>{At(He.getLineContent(xt),xt)?bt(xt):Ut(xt)?(bt(xt),Ot(xt)):Lt()},100)}}),ht=ke.onMouseDown(zt=>{var Ft,xt,ni;if(zt.target.detail&&((ni=(xt=(Ft=zt.target)==null?void 0:Ft.element)==null?void 0:xt.className)!=null&&ni.includes("line-numbers"))){let mi=zt.target.position.lineNumber;if(At(He.getLineContent(mi),mi))return;Ut(mi)?bt(mi):Ot(mi)}}),ot=zt=>{let Ft={range:new It.Range(zt,1,zt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};ti.current=ke.deltaDecorations(ti.current,[Ft])},wt=()=>{ti.current=ke.deltaDecorations(ti.current,[])},St=ke.onMouseMove(zt=>{var Ft,xt,ni;if(wt(),zt.target.detail&&((ni=(xt=(Ft=zt.target)==null?void 0:Ft.element)==null?void 0:xt.className)!=null&&ni.includes("line-numbers"))){let mi=zt.target.position.lineNumber;if(At(He.getLineContent(mi),mi))return;ot(mi)}}),pi=ke.onMouseLeave(()=>{wt()});return()=>{vt.dispose(),ht.dispose(),St.dispose(),pi.dispose()}}},[ft.current,nt,Xe,Be,mt,Re]),(0,N.useEffect)(()=>{var de;(de=ft.current)!=null&&de.instance&&mt&&ft.current.instance.setPosition({lineNumber:0,column:0})},[Be]);function vi(){let de=ft.current.instance;if(de){const ke=de.getSelection(),He=ft.current.pastePos||{},lt=new It.Range(He.startLineNumber||ke.endLineNumber,He.startColumn||ke.endColumn,He.endLineNumber||ke.endLineNumber,He.endColumn||ke.endColumn);setTimeout(()=>{de.executeEdits("",[{range:lt,text:""}])},300)}}function Zt(de){(window.navigator.platform.match("Mac")?de.metaKey:de.ctrlKey)&&de.keyCode==83&&(de.preventDefault(),re())}const Xt=()=>{if(X&&ft.current.instance){const de=ft.current.instance.getContentHeight();H(de<Me?Me:de)}else H(Me)};function Dt(de){var ke=document.createEvent("MouseEvents");ke.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),de.dispatchEvent(ke)}const Ve=de=>{if(!ut.current)return;const{keyCode:ke,ctrlKey:He,metaKey:lt,target:Lt,type:Ot}=de;return(Ot==="paste"||(ke===67||ke===86)&&(lt||He))&&Lt.nodeName==="TEXTAREA"&&(Tt(),de.preventDefault()),!1};function h(de,ke){var He=window.URL||window.webkitURL||window,lt=new Blob([ke]),Lt=document.createElementNS("http://www.w3.org/1999/xhtml","a");Lt.href=He.createObjectURL(lt),Lt.download=de,Dt(Lt)}(0,N.useEffect)(()=>{Xt()},[Xt]),(0,N.useEffect)(()=>{yt.current&&!nt&&Promise.all([U.e(8909),U.e(2460)]).then(U.bind(U,71448)).then(de=>{try{It=de,ft.current.instance=It.editor.create(yt.current,{value:_e,language:Et(Re),theme:q,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:st||!1}},we);const ke=ft.current.instance;let Lt=[...R.BH._menuItems].find(vt=>vt[0]._debugName=="EditorContext")[1],Ot=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],bt=(vt,ht)=>{var ot,wt;let St=vt._first;do ht.includes((wt=(ot=St.element)==null?void 0:ot.command)==null?void 0:wt.id)&&vt._remove(St);while(St=St.next)};if(he(ke,It),setTimeout(()=>{Xt(),ft.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{h(We||"educoder.txt",ke.getValue())}})},500),ft.current.subscription=ke.onDidChangeModelContent(vt=>{Gt.current?clearTimeout(ri.current):(Xt(),Q(ke.getValue(),vt)),ri.current=setTimeout(()=>{Gt.current=!1},500)}),window.Monaco||E(It,Et(Re)),$&&(bt(Lt,Ot),yt.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",Ve),window.removeEventListener("paste",Ve),window.addEventListener("keydown",Ve),window.addEventListener("paste",Ve)),window.Monaco=It,W&&ke.onDidBlurEditorWidget(()=>{W(ke.getValue())}),pe&&ke.onDidFocusEditorText(()=>{$&&Jt(),pe(ke.getValue())}),$){Jt();try{ke.onDidPaste(vt=>{const ht=ke.getSelection(),ot=ft.current.pastePos||{},wt=new It.Range(ot.startLineNumber||ht.endLineNumber,ot.startColumn||ht.endColumn,ot.endLineNumber||ht.endLineNumber,ot.endColumn||ht.endColumn);ke.executeEdits("",[{range:vt.range,text:""}])})}catch(vt){}}let Ut=Ht();return Oe&&typeof Oe=="string"&&new w(Oe,ke,It),Mt(!0),()=>{const vt=ft.current.instance;vt.dispose();const ht=vt.getModel();ht&&ht.dispose(),ft.current.subscription&&ft.current.subscription.dispose(),Ut.unobserve(yt.current)}}catch(ke){}})},[]),(0,N.useEffect)(()=>{if(ft.current.instance&&nt)return document.addEventListener("keydown",Zt,!1),()=>{document.removeEventListener("keydown",Zt)}},[re,nt]),(0,N.useEffect)(()=>{let de=ft.current.instance;if(de&&nt){let ke=Et(Re);It.editor.setModelLanguage(de.getModel(),ke)}},[Re,nt]),(0,N.useEffect)(()=>{ft.current.instance&&nt&&It.editor.setTheme(q)},[q,nt]),(0,N.useEffect)(()=>{let de=ft.current.instance;jt.current=Le,de&&nt&&(de.updateOptions(te({},Le)),setTimeout(()=>{de.getModel().updateOptions(te({},Le))},200))},[JSON.stringify(Le),nt]),(0,N.useEffect)(()=>{let de=ft.current.instance;de&&nt&&de.layout()},[Je,Me,nt]);const[m,y]=(0,N.useState)(le(Je)),[k,H]=(0,N.useState)(le(Me)),ge=S(te({},ee),{width:m,height:k,position:"relative"});return N.createElement("div",{className:"my-monaco-editor",ref:yt,style:ge,onFocus:()=>{$&&Jt()}},Y&&N.createElement(De.CopyToClipboard,{text:_e,onCopy:()=>z.ZP.success("\u590D\u5236\u6210\u529F")},N.createElement(ne.Z,{title:"\u590D\u5236\u4EE3\u7801"},N.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},N.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function kt({width:Ye="100%",height:gt="100%",original:Je,modified:Me,language:_e,options:Re={}}){const ee=(0,N.useRef)(),[Le,we]=(0,N.useState)(null);function q(X){let $;return ee.current&&($=new me.Z(Q=>{for(let he of Q)(he.target.offsetHeight>0||he.target.offsetWidth>0)&&X.layout()}),$.observe(ee.current)),$}(0,N.useEffect)(()=>(ee.current&&Promise.all([U.e(8909),U.e(9404)]).then(U.bind(U,2550)).then(X=>{It=X;const $=It.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},Re),{wordWrap:!0}));we($);let Q=q($);return()=>{$.dispose();const he=$.getModel();he&&he.dispose(),Q.unobserve(ee.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,N.useEffect)(()=>{Le&&Le.setModel({original:It.editor.createModel(Je,_e),modified:It.editor.createModel(Me,_e)})},[Je,Me,_e,Le]);const W=le(Ye),Y=le(gt),re={width:W,height:Y};return N.createElement("div",{className:"my-diff-editor",ref:ee,style:re})}},31103:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return me}});var N=U(59301);function me(be,ce){const G=(0,N.useRef)();(0,N.useEffect)(()=>{G.current=be}),(0,N.useEffect)(()=>{function p(){G.current()}if(ce!==null){let ve=setInterval(p,ce);return()=>clearInterval(ve)}},[ce])}},90131:function(Wt,at,U){"use strict";U.r(at),U.d(at,{default:function(){return $},formatQuery:function(){return re}});var N=U(59301),me=U(65582),be=U(29787),ce={bg:"bg___eq_Aq",container:"container___j770l",widthle:"widthle___ouh1T"},G=U(24334),p=U(44080),ve=U(62957),oe=U(58018),l=U(71411),Z=U(584),C={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(31103),v=U(54624),E=U(65862),A=U(59301),O=Object.defineProperty,j=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,I=(Q,he,pe)=>he in Q?O(Q,he,{enumerable:!0,configurable:!0,writable:!0,value:pe}):Q[he]=pe,w=(Q,he)=>{for(var pe in he||(he={}))V.call(he,pe)&&I(Q,pe,he[pe]);if(j)for(var pe of j(he))L.call(he,pe)&&I(Q,pe,he[pe]);return Q},R=(Q,he)=>{var pe={};for(var Ae in Q)V.call(Q,Ae)&&he.indexOf(Ae)<0&&(pe[Ae]=Q[Ae]);if(Q!=null&&j)for(var Ae of j(Q))he.indexOf(Ae)<0&&L.call(Q,Ae)&&(pe[Ae]=Q[Ae]);return pe},z=(Q,he,pe)=>new Promise((Ae,Xe)=>{var We=Be=>{try{Ke(pe.next(Be))}catch(mt){Xe(mt)}},ze=Be=>{try{Ke(pe.throw(Be))}catch(mt){Xe(mt)}},Ke=Be=>Be.done?Ae(Be.value):Promise.resolve(Be.value).then(We,ze);Ke((pe=pe.apply(Q,he)).next())});const ne=Q=>{var he=Q,{videoDetail:pe,globalSetting:Ae,loading:Xe,dispatch:We}=he,ze=R(he,["videoDetail","globalSetting","loading","dispatch"]);const{queryParams:Ke,selectParams:Be,videoList:mt}=pe,{subject_id:Oe,videoId:st}=Ke,{checkBoxValue:Bt,radioValue:yt}=Be,ft={videoId:st},jt={query:Ke},si=(0,N.useRef)(),ti=(0,N.useRef)(),Gt=(0,N.useRef)(),ri=(0,N.useRef)(5),{video_item:Rt}=pe.detail||{};(0,g.Z)(()=>z(void 0,null,function*(){ti.current&&(console.log("videoRef lastUpdatedTime: ",si.current.getLastUpdatedTime()),console.log(si.current),yield ut())}),ri.current*1e3);const ut=(Zt=!1)=>{const Xt=Zt?{is_f:1}:{};return(0,v.DH)(w(w({},Xt),{id:ft.videoId,point:si.current.getLastUpdatedTime(),total:si.current.getDuration()}))},nt=Zt=>(Zt.ed==="1"&&(ti.current=!1,ut(!0)),!ti.current&&!Zt.ed&&(ti.current=!0,ri.current=si.current.getDuration()<=5?1:5,ut()),We({type:"userDetail/logWatchHistory",payload:Zt})),Mt=()=>{ti.current=!1},Ht=()=>{ti.current=!0},Tt=()=>{Gt.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:Gt.current,onChange:Zt=>Gt.current=Zt,className:C.modalRating})),onOk:()=>z(void 0,null,function*(){if((yield(0,v.jK)({id:ft.videoId,star:Gt.current})).status===0){const{course_id:Xt}=(0,E.oP)();We({type:"videoDetail/getVideoDetail",payload:{id:ft.videoId,videoId:ft.videoId,course_id:Xt,subject_id:Oe}})}})})},_t=Zt=>{const Xt=window.filterVideoSign,Dt=Xt.findIndex(H=>H.id===st);if(Dt===Xt.length-1)return;const h=Xt[Dt+1].id,m=Xt[Dt+1].can_view,y=Xt[Dt+1].link,k=Xt[Dt+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(!k){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}We({type:"videoDetail/handleListItemClick",payload:{videoId:h}}),window.videoTimer=setTimeout(()=>{Zt.current.play()},2e3)}},At=(Zt,Xt)=>{if(Zt==="checkBox"){const Dt=Xt;window.checkBoxValue=Dt,We({type:"videoDetail/setSelectValue",payload:{radioValue:yt,checkBoxValue:Dt}});return}We({type:"videoDetail/setSelectValue",payload:{checkBoxValue:Bt,radioValue:Xt.target.value}})},vi=()=>mt.findIndex(Dt=>Dt.id===st)===mt.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:Dt=>{At("checkBox",Dt)},defaultChecked:Bt,size:"small"}),A.createElement("span",{className:C.zdbf},"\u81EA\u52A8\u64AD\u653E\u4E0B\u4E00\u4E2A\u89C6\u9891"));return A.createElement("aside",{className:C.contentWrap},A.createElement("aside",{className:C.wrap},A.createElement("header",null),A.createElement("div",{className:C.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:si,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:nt,handlePause:Mt,handlePlay:Ht,allow_skip:Rt==null?void 0:Rt.allow_skip,handlePlayEnded:_t,toLog:()=>{}}),A.createElement("div",{className:C.footer},A.createElement("div",{className:C.footer_left},A.createElement("div",{className:C.pingfen},"\u8BC4\u5206"),A.createElement(oe.Z,{value:Rt==null?void 0:Rt.star,disabled:!0,className:C.rating,style:{color:"#FFA100",fontSize:12,marginLeft:10}}),A.createElement("div",{className:C.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:C.checkBox},vi()))),A.createElement("div",{className:"mt10"},(Rt==null?void 0:Rt.description)&&A.createElement("span",{className:C.introName},"\u7B80\u4ECB\uFF1A",Rt.description))))};var ie=(0,me.connect)(({videoDetail:Q,loading:he,globalSetting:pe})=>({videoDetail:Q,globalSetting:pe,loading:he}))(ne),ye=U(6767),De=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(87513),J=U(60979),D=U(74128),M=U(59301),P=Object.defineProperty,ae=Object.defineProperties,te=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,le=(Q,he,pe)=>he in Q?P(Q,he,{enumerable:!0,configurable:!0,writable:!0,value:pe}):Q[he]=pe,Ee=(Q,he)=>{for(var pe in he||(he={}))b.call(he,pe)&&le(Q,pe,he[pe]);if(S)for(var pe of S(he))K.call(he,pe)&&le(Q,pe,he[pe]);return Q},Fe=(Q,he)=>ae(Q,te(he)),et=(Q,he)=>{var pe={};for(var Ae in Q)b.call(Q,Ae)&&he.indexOf(Ae)<0&&(pe[Ae]=Q[Ae]);if(Q!=null&&S)for(var Ae of S(Q))he.indexOf(Ae)<0&&K.call(Q,Ae)&&(pe[Ae]=Q[Ae]);return pe},Et=(Q,he,pe)=>new Promise((Ae,Xe)=>{var We=Be=>{try{Ke(pe.next(Be))}catch(mt){Xe(mt)}},ze=Be=>{try{Ke(pe.throw(Be))}catch(mt){Xe(mt)}},Ke=Be=>Be.done?Ae(Be.value):Promise.resolve(Be.value).then(We,ze);Ke((pe=pe.apply(Q,he)).next())});const It=[{name:"\u5B9E\u8DF5\u9879\u76EE",type:"Shixun",icon:M.createElement("i",{className:"iconfont icon-shixun2 font20"}),bq:M.createElement("span",{style:{border:"1px solid #FF9D18",color:"#FF9D18"},className:xe.s1},"\u5B9E\u8BAD")},{name:"\u89C6\u9891\u9879\u76EE",type:"VideoItem",icon:M.createElement("i",{className:"iconfont icon-shipin font20"}),bq:M.createElement("span",{style:{border:"1px solid #9B18FF",color:"#9B18FF"},className:xe.s1},"\u89C6\u9891")},{name:"\u6559\u5B66\u8BFE\u4EF6",type:"Attachment",icon:M.createElement("i",{className:"iconfont icon-jiaoxueanli font20"}),bq:M.createElement("span",{style:{border:"1px solid #3061D0",color:"#3061D0"},className:xe.s1},"\u8D44\u6599")},{name:"\u7A7A\u76EE\u5F55",type:"StageCatalog",icon:M.createElement("i",{className:"iconfont icon-kongbai font20"}),bq:M.createElement("span",null)}],Jt=Q=>{var he=Q,{dispatch:pe,pathsDetail:Ae,videoDetail:Xe,user:We}=he,ze=et(he,["dispatch","pathsDetail","videoDetail","user"]);const{queryParams:Ke,stages:Be,cust_seq:mt,active:Oe}=Xe,{subject_id:st,course_id:Bt}=Ke,yt=(0,me.useParams)(),[ft]=(0,me.useSearchParams)(),[jt,si]=(0,N.useState)([]),[ti,Gt]=(0,N.useState)([(Oe==null?void 0:Oe.id)||Number(yt.videoId)]),[ri,Rt]=(0,N.useState)("\u8BFE\u7A0B\u8D44\u6E90\u76EE\u5F55"),ut=[".PDF",".DOC",".DOCX",".XLS",".XLSX",".PPT",".PPTX"];(0,N.useEffect)(()=>{pe(st?{type:"videoDetail/getStageData",payload:{subject_id:st,page_type:"video"}}:{type:"videoDetail/getCourseStageData",payload:{coursesId:Bt}})},[]),(0,N.useEffect)(()=>{nt()},[Xe==null?void 0:Xe.stages]);const nt=()=>{let Dt=jt;Be.forEach((Ve,h)=>{Dt.push({title:M.createElement("div",{title:Ve.stage_name,className:xe.title},Ve.stage_name),value:Ve==null?void 0:Ve.stage_id,key:Ve==null?void 0:Ve.stage_id,icon:M.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:Mt(Ve.items||[])})}),si(Dt)},Mt=Dt=>{function Ve(h){var m;const y=h.children,k=Array.isArray(y)&&y.length>0,H=h==null?void 0:h.id,{name:ge,item_type:de,id:ke}=h,He=(m=It.find(Ot=>Ot.type===de))==null?void 0:m.bq,lt=xe.brght,Lt=Oe.id===ke?`${lt} ${xe.active}`:lt;return{title:M.createElement("div",{onClick:()=>At(h),className:lt,title:ge},He,M.createElement("div",{className:xe.s3},ge)),value:H,key:H,icon:M.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:k?y==null?void 0:y.map(Ot=>Ve(Ot)):[]}}return Dt==null?void 0:Dt.map(h=>Ve(h))},Ht=(Dt,Ve)=>Et(void 0,null,function*(){pe({type:"globalSetting/setGlobalLoading",payload:{show:!0,text:"\u6B63\u5728\u8FDB\u5165\u5B9E\u8DF5\u9879\u76EE\uFF0C\u8BF7\u7A0D\u540E..."}});const h=Ve?yield(0,J.BK)({id:Dt}):yield(0,J.Ir)({id:Dt});if(pe({type:"globalSetting/setGlobalLoading",payload:{show:!1,text:""}}),h!=null&&h.game_identifier||h!=null&&h.identifier){(0,E.xg)(Ve?`/tasks/${h==null?void 0:h.identifier}/jupyter`:`/tasks/${h.game_identifier}`);return}(h==null?void 0:h.status)===2?_t(h==null?void 0:h.message):(h==null?void 0:h.status)===3&&Tt(h==null?void 0:h.message)}),Tt=Dt=>{ve.default.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:M.createElement("div",{className:"tc font16"},"\u76EE\u524D\u8BE5\u5B9E\u8DF5\u9879\u76EE\u5C1A\u5728\u5185\u6D4B\u4E2D\uFF0C\u5C06\u4E8E",Dt,"\u4E4B\u540E\u5F00\u653E\uFF0C\u8C22\u8C22\uFF01")})},_t=Dt=>{Dt=Dt!=null&&Dt.includes(".json")?Dt:`${Dt}.json`,ve.default.confirm({centered:!0,title:"\u63D0\u793A",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",content:M.createElement("div",{className:"tc font16"},"\u5B9E\u8BAD\u5DF2\u7ECF\u66F4\u65B0\u4E86\uFF0C\u6B63\u5728\u4E3A\u60A8\u91CD\u7F6E!"),onOk:()=>Et(void 0,null,function*(){const Ve=yield(0,$e.L8)({url:Dt});if(!Ve)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:Ve.shixun_identifier});if(h!=null&&h.game_identifier){(0,E.xg)(`/tasks/${h.game_identifier}`);return}(h==null?void 0:h.status)===2?_t(h==null?void 0:h.message):(h==null?void 0:h.status)===3&&Tt(h==null?void 0:h.message)})})},At=Dt=>{var Ve,h,m,y,k;if((Dt==null?void 0:Dt.item_type)==="StageCatalog")return;clearTimeout(window.videoTimer);const{id:H,item_type:ge,identifier:de,is_jupyter:ke,url:He,link:lt}=Dt;if(ge==="VideoItem"&&!lt){if(!((Ve=We.userInfo)!=null&&Ve.admin)&&!((h=We.userInfo)!=null&&h.business)&&!Dt.can_view){ve.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:M.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}pe({type:"videoDetail/handleListItemClick",payload:{videoId:H}}),pe({type:"videoDetail/getVideoDetail",payload:Fe(Ee({id:H},Ke),{videoId:H}),callback:Lt=>{if(Lt&&Lt.video_item&&!Lt.video_item.can_edit&&!Dt.is_public){ve.default.info({centered:!0,width:400,okText:"\u77E5\u9053\u5566",icon:null,content:M.createElement("div",{className:"tc font14"},"\u5F53\u524D\u89C6\u9891\u6682\u672A\u516C\u5F00\uFF0C\u656C\u8BF7\u671F\u5F85")});return}}});return}if(ge==="VideoItem"&<){Dt.link&&(0,v.DH)({is_f:1,id:Dt.id,point:0,total:0}),window.open(lt);return}if(ge==="Shixun"){Ht(de,ke);return}if(ge==="Attachment"){if(lt){(0,E.xg)(lt);return}let Lt=(y=Dt==null?void 0:Dt.name)==null?void 0:y.substr((m=Dt==null?void 0:Dt.name)==null?void 0:m.lastIndexOf("."));if(ut.includes(Lt.toUpperCase())){pe({type:"videoDetail/handleListItemClick",payload:{attachmentId:H}});return}else{if(!((k=Ae.detail)!=null&&k.allow_download)){ye.ZP.info("\u6559\u5B66\u8BFE\u4EF6\u4E0D\u652F\u6301\u4E0B\u8F7D");return}(0,E.FH)(Dt.name,D.Z.API_SERVER+Dt.url);return}}window.open(D.Z.IMG_SERVER+He)},vi=Dt=>{let Ve=["\u96F6","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D"],h=["","\u5341","\u767E","\u5343","\u4E07"];Dt=parseInt(Dt);let m=H=>{let ge=H.toString().split("").reverse(),de="";for(var ke=0;ke<ge.length;ke++)de=(ke==0&&ge[ke]==0||ke>0&&ge[ke]==0&&ge[ke-1]==0?"":Ve[ge[ke]]+(ge[ke]==0?h[0]:h[ke]))+de;return de},y=Math.floor(Dt/1e4),k=Dt%1e4;return k.toString().length<4&&(k="0"+k),y?m(y)+"\u4E07"+m(k):m(Dt)},Zt=(Dt,Ve,h,m)=>{var y;const{name:k,item_type:H,id:ge}=Dt,de=`${Ve+1}-${h+1}-${m+1}`,ke=(y=It.find(Lt=>Lt.type===H))==null?void 0:y.icon,He=xe.brght,lt=Oe.id===ge?`${He} ${xe.active}`:He;return M.createElement("div",{key:de,onClick:()=>At(Dt),className:lt,style:{paddingLeft:52}},M.createElement("span",{className:xe.s1},ke),!!mt&&M.createElement("span",{className:xe.s2},de),M.createElement("span",{className:xe.s3},"\u203B ",k))},Xt=(Dt,Ve,h)=>{var m;const{name:y,item_type:k,id:H,children:ge}=Dt,de=`${Ve+1}-${h+1}`,ke=(m=It.find(Lt=>Lt.type===k))==null?void 0:m.icon,He=xe.brght,lt=Oe.id===H?`${He} ${xe.active}`:He;return M.createElement(N.Fragment,{key:de},M.createElement("div",{onClick:()=>At(Dt),className:lt},M.createElement("span",{className:xe.s1},ke),!!mt&&M.createElement("span",{className:xe.s2},de),M.createElement("span",{className:xe.s3},"\u203B ",y)),!!ge.length&&ge.map((Lt,Ot)=>Zt(Lt,Ve,h,Ot)))};return M.createElement("aside",{className:xe.list},M.createElement("div",{className:xe.tabs_style},M.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"&&M.createElement("div",{className:xe.tabs_item_active}))),M.createElement("div",{className:xe.tree_style},(jt==null?void 0:jt.length)>0&&M.createElement(De.default,{selectedKeys:ti,onSelect:(Dt,Ve)=>{Gt([...Dt])},blockNode:!0,treeData:jt,defaultExpandAll:!0,className:xe.tree_line})))};var Qe=(0,me.connect)(({user:Q,videoDetail:he,loading:pe,globalSetting:Ae,pathsDetail:Xe})=>({user:Q,videoDetail:he,globalSetting:Ae,loading:pe,pathsDetail:Xe}))(Jt),kt=U(52918),Ye=U(59301),gt=Object.defineProperty,Je=Object.defineProperties,Me=Object.getOwnPropertyDescriptors,_e=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable,Le=(Q,he,pe)=>he in Q?gt(Q,he,{enumerable:!0,configurable:!0,writable:!0,value:pe}):Q[he]=pe,we=(Q,he)=>{for(var pe in he||(he={}))Re.call(he,pe)&&Le(Q,pe,he[pe]);if(_e)for(var pe of _e(he))ee.call(he,pe)&&Le(Q,pe,he[pe]);return Q},q=(Q,he)=>Je(Q,Me(he)),W=(Q,he)=>{var pe={};for(var Ae in Q)Re.call(Q,Ae)&&he.indexOf(Ae)<0&&(pe[Ae]=Q[Ae]);if(Q!=null&&_e)for(var Ae of _e(Q))he.indexOf(Ae)<0&&ee.call(Q,Ae)&&(pe[Ae]=Q[Ae]);return pe},Y=(Q,he,pe)=>new Promise((Ae,Xe)=>{var We=Be=>{try{Ke(pe.next(Be))}catch(mt){Xe(mt)}},ze=Be=>{try{Ke(pe.throw(Be))}catch(mt){Xe(mt)}},Ke=Be=>Be.done?Ae(Be.value):Promise.resolve(Be.value).then(We,ze);Ke((pe=pe.apply(Q,he)).next())});const re=Q=>{const{subject_id:he}=Q;return{subject_id:he,course_id:he}},X=Q=>{var he=Q,{videoDetail:pe,globalSetting:Ae,loading:Xe,pathsDetail:We,dispatch:ze}=he,Ke=W(he,["videoDetail","globalSetting","loading","pathsDetail","dispatch"]),Be,mt;const{queryParams:Oe,videoList:st,attachmentList:Bt,active:yt}=pe,{subject_id:ft,videoId:jt}=Oe,si={videoId:jt};(0,N.useEffect)(()=>{if(yt){const{item_type:ri,id:Rt}=yt;ri==="VideoItem"&&ze({type:"videoDetail/getVideoDetail",payload:q(we({},Oe),{id:Rt})})}},[yt.id]),console.log("---",yt),(0,N.useEffect)(()=>{ft&&ti()},[]);function ti(){return Y(this,null,function*(){const ri=yield ze({type:"pathsDetail/getPathsDetail",payload:{id:ft}})})}(0,N.useEffect)(()=>{var ri,Rt;(0,E.Dk)((Rt=(ri=pe.detail)==null?void 0:ri.video_item)==null?void 0:Rt.name)},[pe]);let Gt={width:1200};return yt&&yt.item_type==="Attachment"&&yt.content_type==="application/pdf"&&(Gt={width:1250,marginLeft:(document.body.clientWidth-1200)/2}),Ye.createElement(be.Z,{spinning:!1},Ye.createElement("section",{className:ce.bg},Ye.createElement("div",{className:ce.container,style:Gt},Ye.createElement(Qe,null),yt&&yt.item_type==="VideoItem"&&Ye.createElement(ie,null),yt&&yt.item_type==="Attachment"&&yt.content_type==="application/pdf"&&yt.url&&Ye.createElement("div",{className:ce.widthle},Ye.createElement(kt.Z,{disabledDownload:!((Be=We.detail)!=null&&Be.allow_download),type:"pdf",filename:yt.name,data:D.Z.API_SERVER+yt.url,style:{position:"absolute",zIndex:1}})),yt&&yt.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(yt.content_type)&&yt.url&&Ye.createElement("div",{className:ce.widthle},Ye.createElement(kt.Z,{disabledDownload:!((mt=We.detail)!=null&&mt.allow_download),type:"office",data:D.Z.API_SERVER+yt.url,style:{position:"absolute",zIndex:1}})))))};var $=(0,me.connect)(({videoDetail:Q,loading:he,globalSetting:pe,pathsDetail:Ae})=>({videoDetail:Q,globalSetting:pe,loading:he,pathsDetail:Ae}))(X)},84056:function(Wt,at,U){"use strict";U.d(at,{BU:function(){return me},Dj:function(){return N},gH:function(){return be},vp:function(){return ce}});function N(G){try{G.mozRequestFullScreen?G.mozRequestFullScreen():G.webkitRequestFullScreen&&G.webkitRequestFullScreen()}catch(p){console.log(p,":e")}}function me(){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 be=()=>{if(document.webkitExitFullscreen)return"webkitfullscreenchange";if(document.exitFullscreen)return"fullscreenchange";if(document.msExitFullscreen)return"msfullscreenchange";if(document.mozCancelFullScreen)return"mozfullscreenchange"};function ce(){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}},73217:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return Dt}});class N{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 k=arguments[y];if(k!=null)for(let H in k)k.hasOwnProperty(H)&&(m[H]=k[H])}return m},typeof self.Promise!="function"&&U(3867).polyfill()}}N.install();var me=N,be=U(86204),ce=U.n(be);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(ce());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 C 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 O={};function j(){let Ve=self.navigator.userAgent.toLowerCase(),h=/(edge)\/([\w.]+)/.exec(Ve)||/(opr)[\/]([\w.]+)/.exec(Ve)||/(chrome)[ \/]([\w.]+)/.exec(Ve)||/(iemobile)[\/]([\w.]+)/.exec(Ve)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(Ve)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(Ve)||/(webkit)[ \/]([\w.]+)/.exec(Ve)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(Ve)||/(msie) ([\w.]+)/.exec(Ve)||Ve.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(Ve)||Ve.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(Ve)||[],m=/(ipad)/.exec(Ve)||/(ipod)/.exec(Ve)||/(windows phone)/.exec(Ve)||/(iphone)/.exec(Ve)||/(kindle)/.exec(Ve)||/(android)/.exec(Ve)||/(windows)/.exec(Ve)||/(mac)/.exec(Ve)||/(linux)/.exec(Ve)||/(cros)/.exec(Ve)||[],y={browser:h[5]||h[3]||h[1]||"",version:h[2]||h[4]||"0",majorVersion:h[4]||h[2]||"0",platform:m[0]||""},k={};if(y.browser){k[y.browser]=!0;let H=y.majorVersion.split(".");k.version={major:parseInt(y.majorVersion,10),string:y.version},H.length>1&&(k.version.minor=parseInt(H[1],10)),H.length>2&&(k.version.build=parseInt(H[2],10))}if(y.platform&&(k[y.platform]=!0),(k.chrome||k.opr||k.safari)&&(k.webkit=!0),k.rv||k.iemobile){k.rv&&delete k.rv;let H="msie";y.browser=H,k[H]=!0}if(k.edge){delete k.edge;let H="msedge";y.browser=H,k[H]=!0}if(k.opr){let H="opera";y.browser=H,k[H]=!0}if(k.safari&&k.android){let H="android";y.browser=H,k[H]=!0}k.name=y.browser,k.platform=y.platform;for(let H in O)O.hasOwnProperty(H)&&delete O[H];Object.assign(O,k)}j();var V=O;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 k=this._seekHandler.getConfig(y,m),H=new self.Headers;if(typeof k.headers=="object"){let de=k.headers;for(let ke in de)de.hasOwnProperty(ke)&&H.append(ke,de[ke])}let ge={method:"GET",headers:H,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(let de in this._config.headers)H.append(de,this._config.headers[de]);h.cors===!1&&(ge.mode="same-origin"),h.withCredentials&&(ge.credentials="include"),h.referrerPolicy&&(ge.referrerPolicy=h.referrerPolicy),this._status=v.kConnecting,self.fetch(k.url,ge).then(de=>{if(this._requestAbort){this._requestAbort=!1,this._status=v.kIdle;return}if(de.ok&&de.status>=200&&de.status<=299){if(de.url!==k.url&&this._onURLRedirect){let He=this._seekHandler.removeURLParameters(de.url);this._onURLRedirect(He)}let ke=de.headers.get("Content-Length");return ke!=null&&(this._contentLength=parseInt(ke),this._contentLength!==0&&this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)),this._pump.call(this,de.body.getReader())}else if(this._status=v.kError,this._onError)this._onError(E.HTTP_STATUS_CODE_INVALID,{code:de.status,msg:de.statusText});else throw new l("FetchStreamLoader: Http code invalid, "+de.status+" "+de.statusText)}).catch(de=>{if(this._status=v.kError,this._onError)this._onError(E.EXCEPTION,{code:-1,msg:de.message});else throw de})}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,k={code:-1,msg:"Fetch stream meet Early-EOF"};if(this._onError)this._onError(y,k);else throw new l(k.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,k=this._range.from+this._receivedLength;this._receivedLength+=y.byteLength,this._onDataArrival&&this._onDataArrival(y,k,this._receivedLength),this._pump(h)}}).catch(m=>{if(m.code===11&&V.msedge)return;this._status=v.kError;let y=0,k=null;if((m.code===19||m.message==="network error")&&(this._contentLength===null||this._contentLength!==null&&this._receivedLength<this._contentLength)?(y=E.EARLY_EOF,k={code:m.code,msg:"Fetch stream meet Early-EOF"}):(y=E.EXCEPTION,k={code:m.code,msg:m.message}),this._onError)this._onError(y,k);else throw new l(k.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 k=this._seekHandler.getConfig(y,m);this._requestURL=k.url;let H=this._xhr=new XMLHttpRequest;if(H.open("GET",k.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 k.headers=="object"){let ge=k.headers;for(let de in ge)ge.hasOwnProperty(de)&&H.setRequestHeader(de,ge[de])}if(typeof this._config.headers=="object"){let ge=this._config.headers;for(let de in ge)ge.hasOwnProperty(de)&&H.setRequestHeader(de,ge[de])}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 z 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 k=h.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?k=this._currentRedirectedURL:h.redirectedURL!=null&&(k=h.redirectedURL));let H=this._seekHandler.getConfig(k,m);this._currentRequestURL=H.url;let ge=this._reader=new self.MSStreamReader;ge.onprogress=this._msrOnProgress.bind(this),ge.onload=this._msrOnLoad.bind(this),ge.onerror=this._msrOnError.bind(this);let de=this._xhr=new XMLHttpRequest;if(de.open("GET",H.url,!0),de.responseType="ms-stream",de.onreadystatechange=this._xhrOnReadyStateChange.bind(this),de.onerror=this._xhrOnError.bind(this),h.withCredentials&&(de.withCredentials=!0),typeof H.headers=="object"){let ke=H.headers;for(let He in ke)ke.hasOwnProperty(He)&&de.setRequestHeader(He,ke[He])}if(typeof this._config.headers=="object"){let ke=this._config.headers;for(let He in ke)ke.hasOwnProperty(He)&&de.setRequestHeader(He,ke[He])}this._isReconnecting?this._isReconnecting=!1:this._status=LoaderStatus.kConnecting,de.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 k=this._seekHandler.removeURLParameters(m.responseURL);m.responseURL!==this._currentRequestURL&&k!==this._currentRedirectedURL&&(this._currentRedirectedURL=k,this._onURLRedirect&&this._onURLRedirect(k))}let y=m.getResponseHeader("Content-Length");if(y!=null&&this._contentLength==null){let k=parseInt(y);k>0&&(this._contentLength=k,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 k=y.slice(this._lastTimeBufferSize);this._lastTimeBufferSize=y.byteLength;let H=this._totalRange.from+this._receivedLength;this._receivedLength+=k.byteLength,this._onDataArrival&&this._onDataArrival(k,H,this._receivedLength),y.byteLength>=this._bufferLimit&&(Log.v(this.TAG,`MSStream buffer exceeded max size near ${H+k.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 ne=null;class ie 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 k=this._seekHandler.getConfig(y,m);this._currentRequestURL=k.url;let H=this._xhr=new XMLHttpRequest;if(H.open("GET",k.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 k.headers=="object"){let ge=k.headers;for(let de in ge)ge.hasOwnProperty(de)&&H.setRequestHeader(de,ge[de])}if(typeof this._config.headers=="object"){let ge=this._config.headers;for(let de in ge)ge.hasOwnProperty(de)&&H.setRequestHeader(de,ge[de])}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 k=h.total;this._internalAbort(),k!=null&k!==0&&(this._totalLength=k)}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,k=0,H=0,ge=y;if(h<m[0])return m[0];for(;H<=ge;){if(k=H+Math.floor((ge-H)/2),k===y||h>=m[k]&&h<m[k+1])return m[k];m[k]<h?H=k+1:ge=k-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 ge=this._normalizeSpeed(m);this._currentSpeedNormalized!==ge&&(this._currentSpeedNormalized=ge,this._currentChunkSizeKB=ge)}let y=h.target.response,k=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,k,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=ie;class De 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=De;class $e{constructor(h){this._zeroStart=h||!1}getConfig(h,m){let y={};if(m.from!==0||m.to!==-1){let k;m.to!==-1?k=`bytes=${m.from.toString()}-${m.to.toString()}`:k=`bytes=${m.from.toString()}-`,y.Range=k}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 k=!0;y.indexOf("?")===-1&&(y+="?",k=!1),k&&(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,k=h.indexOf("?");k!==-1&&(y=h.substring(k+1));let H="";if(y!=null&&y.length>0){let ge=y.split("&");for(let de=0;de<ge.length;de++){let ke=ge[de].split("="),He=de>0;ke[0]!==this._startName&&ke[0]!==this._endName&&(He&&(H+="&"),H+=ge[de])}}return H.length===0?m:m+"?"+H}}var M=D;class P{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 M(m,y)}else if(h.seekType==="custom"){if(typeof h.customSeekHandler!="function")throw new C("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new h.customSeekHandler}else throw new C(`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 C("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 k=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(y,0,m).set(k,0)}this._stashBuffer=y,this._bufferSize=m}_normalizeSpeed(h){let m=this._speedNormalizeList,y=m.length-1,k=0,H=0,ge=y;if(h<m[0])return m[0];for(;H<=ge;){if(k=H+Math.floor((ge-H)/2),k===y||h>=m[k]&&h<m[k+1])return m[k];m[k]<h?H=k+1:ge=k-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 k=this._speedSampler.lastSecondKBps;if(k!==0){let H=this._normalizeSpeed(k);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 ge=this._stashBuffer.slice(0,this._stashUsed),de=this._dispatchChunks(ge,this._stashByteStart);if(de<ge.byteLength){if(de>0){let ke=new Uint8Array(ge,de);H.set(ke,0),this._stashUsed=ke.byteLength,this._stashByteStart+=de}}else this._stashUsed=0,this._stashByteStart+=de;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 ge=this._dispatchChunks(h,m);if(ge<h.byteLength){let de=h.byteLength-ge;de>this._bufferSize&&(this._expandBuffer(de),H=new Uint8Array(this._stashBuffer,0,this._bufferSize)),H.set(new Uint8Array(h,ge),0),this._stashUsed+=de,this._stashByteStart=m+ge}}}else if(this._stashUsed===0){let H=this._dispatchChunks(h,m);if(H<h.byteLength){let ge=h.byteLength-H;ge>this._bufferSize&&this._expandBuffer(ge),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(h,H),0),this._stashUsed+=ge,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 ge=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(ge<this._stashUsed&&ge>0){let de=new Uint8Array(this._stashBuffer,ge);H.set(de,0)}this._stashUsed-=ge,this._stashByteStart+=ge}}_flushStashBuffer(h){if(this._stashUsed>0){let m=this._stashBuffer.slice(0,this._stashUsed),y=this._dispatchChunks(m,this._stashByteStart),k=m.byteLength-y;if(y<m.byteLength)if(h)p.w(this.TAG,`${k} bytes unconsumed data remain when flush buffer, dropped`);else{if(y>0){let H=new Uint8Array(this._stashBuffer,0,this._bufferSize),ge=new Uint8Array(m,y);H.set(ge,0),this._stashUsed=ge.byteLength,this._stashByteStart+=y}return 0}return this._stashUsed=0,this._stashByteStart=0,k}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=P;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 Fe{static get forceGlobalTag(){return p.FORCE_GLOBAL_TAG}static set forceGlobalTag(h){p.FORCE_GLOBAL_TAG=h,Fe._notifyChange()}static get globalTag(){return p.GLOBAL_TAG}static set globalTag(h){p.GLOBAL_TAG=h,Fe._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,Fe._notifyChange()}static get enableDebug(){return p.ENABLE_DEBUG}static set enableDebug(h){p.ENABLE_DEBUG=h,Fe._notifyChange()}static get enableVerbose(){return p.ENABLE_VERBOSE}static set enableVerbose(h){p.ENABLE_VERBOSE=h,Fe._notifyChange()}static get enableInfo(){return p.ENABLE_INFO}static set enableInfo(h){p.ENABLE_INFO=h,Fe._notifyChange()}static get enableWarn(){return p.ENABLE_WARN}static set enableWarn(h){p.ENABLE_WARN=h,Fe._notifyChange()}static get enableError(){return p.ENABLE_ERROR}static set enableError(h){p.ENABLE_ERROR=h,Fe._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=Fe.emitter;if(h.listenerCount("change")>0){let m=Fe.getConfig();h.emit("change",m)}}static registerListener(h){Fe.emitter.addListener("change",h)}static removeListener(h){Fe.emitter.removeListener("change",h)}static addLogListener(h){p.emitter.addListener("log",h),p.emitter.listenerCount("log")>0&&(p.ENABLE_CALLBACK=!0,Fe._notifyChange())}static removeLogListener(h){p.emitter.removeListener("log",h),p.emitter.listenerCount("log")===0&&(p.ENABLE_CALLBACK=!1,Fe._notifyChange())}}Fe.emitter=new(ce());var et=Fe;class Et{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,k=h.length-1,H=0,ge=0,de=k;for(m<h[0]&&(y=0,ge=de+1);ge<=de;)if(H=ge+Math.floor((de-ge)/2),H===k||m>=h[H]&&m<h[H+1]){y=H;break}else h[H]<m?ge=H+1:de=H-1;return y}}var It=Et;function Jt(Ve,h,m){let y=Ve;if(h+m<y.length){for(;m--;)if((y[++h]&192)!==128)return!1;return!0}else return!1}function Qe(Ve){let h=[],m=Ve,y=0,k=Ve.length;for(;y<k;){if(m[y]<128){h.push(String.fromCharCode(m[y])),++y;continue}else if(!(m[y]<192)){if(m[y]<224){if(Jt(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(Jt(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&&Jt(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 kt=Qe;let Ye=function(){let Ve=new ArrayBuffer(2);return new DataView(Ve).setInt16(0,256,!0),new Int16Array(Ve)[0]===256}();class gt{static parseScriptData(h,m,y){let k={};try{let H=gt.parseValue(h,m,y),ge=gt.parseValue(h,m+H.size,y-H.size);k[H.data]=ge.data}catch(H){p.e("AMF",H.toString())}return k}static parseObject(h,m,y){if(y<3)throw new Z("Data not enough when parse ScriptDataObject");let k=gt.parseString(h,m,y),H=gt.parseValue(h,m+k.size,y-k.size),ge=H.objectEnd;return{data:{name:k.data,value:H.data},size:k.size+H.size,objectEnd:ge}}static parseVariable(h,m,y){return gt.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,!Ye),ge;return H>0?ge=kt(new Uint8Array(h,m+2,H)):ge="",{data:ge,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,!Ye),ge;return H>0?ge=kt(new Uint8Array(h,m+4,H)):ge="",{data:ge,size:4+H}}static parseDate(h,m,y){if(y<10)throw new Z("Data size invalid when parse Date");let k=new DataView(h,m,y),H=k.getFloat64(0,!Ye),ge=k.getInt16(8,!Ye);return H+=ge*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 k=new DataView(h,m,y),H=1,ge=k.getUint8(0),de,ke=!1;try{switch(ge){case 0:de=k.getFloat64(1,!Ye),H+=8;break;case 1:{de=!!k.getUint8(1),H+=1;break}case 2:{let He=gt.parseString(h,m+1,y-1);de=He.data,H+=He.size;break}case 3:{de={};let He=0;for((k.getUint32(y-4,!Ye)&16777215)===9&&(He=3);H<y-4;){let lt=gt.parseObject(h,m+H,y-H-He);if(lt.objectEnd)break;de[lt.data.name]=lt.data.value,H+=lt.size}H<=y-3&&(k.getUint32(H-1,!Ye)&16777215)===9&&(H+=3);break}case 8:{de={},H+=4;let He=0;for((k.getUint32(y-4,!Ye)&16777215)===9&&(He=3);H<y-8;){let lt=gt.parseVariable(h,m+H,y-H-He);if(lt.objectEnd)break;de[lt.data.name]=lt.data.value,H+=lt.size}H<=y-3&&(k.getUint32(H-1,!Ye)&16777215)===9&&(H+=3);break}case 9:de=void 0,H=1,ke=!0;break;case 10:{de=[];let He=k.getUint32(1,!Ye);H+=4;for(let lt=0;lt<He;lt++){let Lt=gt.parseValue(h,m+H,y-H);de.push(Lt.data),H+=Lt.size}break}case 11:{let He=gt.parseDate(h,m+1,y-1);de=He.data,H+=He.size;break}case 12:{let He=gt.parseString(h,m+1,y-1);de=He.data,H+=He.size;break}default:H=y,p.w("AMF","Unsupported AMF value type "+ge)}}catch(He){p.e("AMF",He.toString())}return{data:de,size:H,objectEnd:ke}}}var Je=gt;class Me{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 C("ExpGolomb: readBits() bits exceeded max 32bits!");if(h<=this._current_word_bits_left){let ge=this._current_word>>>32-h;return this._current_word<<=h,this._current_word_bits_left-=h,ge}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 k=Math.min(y,this._current_word_bits_left),H=this._current_word>>>32-k;return this._current_word<<=k,this._current_word_bits_left-=k,m=m<<k|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 _e=Me;class Re{static _ebsp2rbsp(h){let m=h,y=m.byteLength,k=new Uint8Array(y),H=0;for(let ge=0;ge<y;ge++)ge>=2&&m[ge]===3&&m[ge-1]===0&&m[ge-2]===0||(k[H]=m[ge],H++);return new Uint8Array(k.buffer,0,H)}static parseSPS(h){let m=Re._ebsp2rbsp(h),y=new _e(m);y.readByte();let k=y.readByte();y.readByte();let H=y.readByte();y.readUEG();let ge=Re.getProfileString(k),de=Re.getLevelString(H),ke=1,He=420,lt=[0,420,422,444],Lt=8;if((k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128||k===138||k===144)&&(ke=y.readUEG(),ke===3&&y.readBits(1),ke<=3&&(He=lt[ke]),Lt=y.readUEG()+8,y.readUEG(),y.readBits(1),y.readBool())){let qt=ke!==3?8:12;for(let Si=0;Si<qt;Si++)y.readBool()&&(Si<6?Re._skipScalingList(y,16):Re._skipScalingList(y,64))}y.readUEG();let Ot=y.readUEG();if(Ot===0)y.readUEG();else if(Ot===1){y.readBits(1),y.readSEG(),y.readSEG();let qt=y.readUEG();for(let Si=0;Si<qt;Si++)y.readSEG()}let bt=y.readUEG();y.readBits(1);let Ut=y.readUEG(),vt=y.readUEG(),ht=y.readBits(1);ht===0&&y.readBits(1),y.readBits(1);let ot=0,wt=0,St=0,pi=0;y.readBool()&&(ot=y.readUEG(),wt=y.readUEG(),St=y.readUEG(),pi=y.readUEG());let Ft=1,xt=1,ni=0,mi=!0,Te=0,Pe=0;if(y.readBool()){if(y.readBool()){let qt=y.readByte(),Si=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],ai=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];qt>0&&qt<16?(Ft=Si[qt-1],xt=ai[qt-1]):qt===255&&(Ft=y.readByte()<<8|y.readByte(),xt=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),Si=y.readBits(32);mi=y.readBool(),Te=Si,Pe=qt*2,ni=Te/Pe}}let qe=1;(Ft!==1||xt!==1)&&(qe=Ft/xt);let Ge=0,tt=0;if(ke===0)Ge=1,tt=2-ht;else{let qt=ke===3?1:2,Si=ke===1?2:1;Ge=qt,tt=Si*(2-ht)}let pt=(Ut+1)*16,Ct=(2-ht)*((vt+1)*16);pt-=(ot+wt)*Ge,Ct-=(St+pi)*tt;let ui=Math.ceil(pt*qe);return y.destroy(),y=null,{profile_string:ge,level_string:de,bit_depth:Lt,ref_frames:bt,chroma_format:He,chroma_format_string:Re.getChromaFormatString(He),frame_rate:{fixed:mi,fps:ni,fps_den:Pe,fps_num:Te},sar_ratio:{width:Ft,height:xt},codec_size:{width:pt,height:Ct},present_size:{width:ui,height:Ct}}}static _skipScalingList(h,m){let y=8,k=8,H=0;for(let ge=0;ge<m;ge++)k!==0&&(H=h.readSEG(),k=(y+H+256)%256),y=k===0?y:k}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=Re,we={OK:"OK",FORMAT_ERROR:"FormatError",FORMAT_UNSUPPORTED:"FormatUnsupported",CODEC_UNSUPPORTED:"CodecUnsupported"};function q(Ve){return Ve>>>8&255|(Ve&255)<<8}function W(Ve){return(Ve&4278190080)>>>24|(Ve&16711680)>>>8|(Ve&65280)<<8|(Ve&255)<<24}function Y(Ve,h){return Ve[h]<<24|Ve[h+1]<<16|Ve[h+2]<<8|Ve[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 It,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 k=(m[4]&4)>>>2!==0,H=(m[4]&1)!==0,ge=Y(m,5);return ge<9?y:{match:!0,consumed:ge,dataOffset:ge,hasAudioTrack:k,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 It}_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,k=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,!k)!==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 ge=H.getUint8(0),de=H.getUint32(0,!k)&16777215;if(y+11+de+4>h.byteLength)break;if(ge!==8&&ge!==9&&ge!==18){p.w(this.TAG,`Unsupported tag type ${ge}, skipped`),y+=11+de+4;continue}let ke=H.getUint8(4),He=H.getUint8(5),lt=H.getUint8(6),Lt=H.getUint8(7),Ot=lt|He<<8|ke<<16|Lt<<24;(H.getUint32(7,!k)&16777215)!==0&&p.w(this.TAG,"Meet tag which has StreamID != 0!");let Ut=y+11;switch(ge){case 8:this._parseAudioData(h,Ut,de,Ot);break;case 9:this._parseVideoData(h,Ut,de,Ot,m+y);break;case 18:this._parseScriptData(h,Ut,de);break}let vt=H.getUint32(11+de,!k);vt!==11+de&&p.w(this.TAG,`Invalid PrevTagSize ${vt}`),y+=11+de+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),y}_parseScriptData(h,m,y){let k=Je.parseScriptData(h,m,y);if(k.hasOwnProperty("onMetaData")){if(k.onMetaData==null||typeof k.onMetaData!="object"){p.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&p.w(this.TAG,"Found another onMetaData tag!"),this._metadata=k;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 ge=Math.floor(H.duration*this._timescale);this._duration=ge,this._mediaInfo.duration=ge}}else this._mediaInfo.duration=0;if(typeof H.framerate=="number"){let ge=Math.floor(H.framerate*1e3);if(ge>0){let de=ge/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=de,this._referenceFrameRate.fps_num=ge,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=de}}if(typeof H.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;let ge=H.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(ge),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(k).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},k))}_parseKeyframesIndex(h){let m=[],y=[];for(let k=1;k<h.times.length;k++){let H=this._timestampBase+Math.floor(h.times[k]*1e3);m.push(H),y.push(h.filepositions[k])}return{times:m,filepositions:y}}_parseAudioData(h,m,y,k){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,de=new DataView(h,m,y).getUint8(0),ke=de>>>4;if(ke!==2&&ke!==10){this._onError(we.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+ke);return}let He=0,lt=(de&12)>>>2;if(lt>=0&<<=4)He=this._flvSoundRateTable[lt];else{this._onError(we.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+lt);return}let Lt=(de&2)>>>1,Ot=de&1,bt=this._audioMetadata,Ut=this._audioTrack;if(bt||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),bt=this._audioMetadata={},bt.type="audio",bt.id=Ut.id,bt.timescale=this._timescale,bt.duration=this._duration,bt.audioSampleRate=He,bt.channelCount=Ot===0?1:2),ke===10){let vt=this._parseAACAudioData(h,m+1,y-1);if(vt==null)return;if(vt.packetType===0){bt.config&&p.w(this.TAG,"Found another AudioSpecificConfig!");let ht=vt.data;bt.audioSampleRate=ht.samplingRate,bt.channelCount=ht.channelCount,bt.codec=ht.codec,bt.originalCodec=ht.originalCodec,bt.config=ht.config,bt.refSampleDuration=1024/bt.audioSampleRate*bt.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",bt);let ot=this._mediaInfo;ot.audioCodec=bt.originalCodec,ot.audioSampleRate=bt.audioSampleRate,ot.audioChannelCount=bt.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(vt.packetType===1){let ht=this._timestampBase+k,ot={unit:vt.data,length:vt.data.byteLength,dts:ht,pts:ht};Ut.samples.push(ot),Ut.length+=vt.data.length}else p.e(this.TAG,`Flv: Unsupported AAC data type ${vt.packetType}`)}else if(ke===2){if(!bt.codec){let wt=this._parseMP3AudioData(h,m+1,y-1,!0);if(wt==null)return;bt.audioSampleRate=wt.samplingRate,bt.channelCount=wt.channelCount,bt.codec=wt.codec,bt.originalCodec=wt.originalCodec,bt.refSampleDuration=1152/bt.audioSampleRate*bt.timescale,p.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",bt);let St=this._mediaInfo;St.audioCodec=bt.codec,St.audioSampleRate=bt.audioSampleRate,St.audioChannelCount=bt.channelCount,St.audioDataRate=wt.bitRate,St.hasVideo?St.videoCodec!=null&&(St.mimeType='video/x-flv; codecs="'+St.videoCodec+","+St.audioCodec+'"'):St.mimeType='video/x-flv; codecs="'+St.audioCodec+'"',St.isComplete()&&this._onMediaInfo(St)}let vt=this._parseMP3AudioData(h,m+1,y-1,!1);if(vt==null)return;let ht=this._timestampBase+k,ot={unit:vt,length:vt.byteLength,dts:ht,pts:ht};Ut.samples.push(ot),Ut.length+=vt.length}}_parseAACAudioData(h,m,y){if(y<=1){p.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}let k={},H=new Uint8Array(h,m,y);return k.packetType=H[0],H[0]===0?k.data=this._parseAACAudioSpecificConfig(h,m+1,y-1):k.data=H.subarray(1),k}_parseAACAudioSpecificConfig(h,m,y){let k=new Uint8Array(h,m,y),H=null,ge=0,de=0,ke=null,He=0,lt=null;if(ge=de=k[0]>>>3,He=(k[0]&7)<<1|k[1]>>>7,He<0||He>=this._mpegSamplingRates.length){this._onError(we.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}let Lt=this._mpegSamplingRates[He],Ot=(k[1]&120)>>>3;if(Ot<0||Ot>=8){this._onError(we.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}ge===5&&(lt=(k[1]&7)<<1|k[2]>>>7,ke=(k[2]&124)>>>2);let bt=self.navigator.userAgent.toLowerCase();return bt.indexOf("firefox")!==-1?He>=6?(ge=5,H=new Array(4),lt=He-3):(ge=2,H=new Array(2),lt=He):bt.indexOf("android")!==-1?(ge=2,H=new Array(2),lt=He):(ge=5,lt=He,H=new Array(4),He>=6?lt=He-3:Ot===1&&(ge=2,H=new Array(2),lt=He)),H[0]=ge<<3,H[0]|=(He&15)>>>1,H[1]=(He&15)<<7,H[1]|=(Ot&15)<<3,ge===5&&(H[1]|=(lt&15)>>>1,H[2]=(lt&1)<<7,H[2]|=8,H[3]=0),{config:H,samplingRate:Lt,channelCount:Ot,codec:"mp4a.40."+ge,originalCodec:"mp4a.40."+de}}_parseMP3AudioData(h,m,y,k){if(y<4){p.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");return}let H=this._littleEndian,ge=new Uint8Array(h,m,y),de=null;if(k){if(ge[0]!==255)return;let ke=ge[1]>>>3&3,He=(ge[1]&6)>>1,lt=(ge[2]&240)>>>4,Lt=(ge[2]&12)>>>2,bt=(ge[3]>>>6&3)!==3?2:1,Ut=0,vt=0,ht=34,ot="mp3";switch(ke){case 0:Ut=this._mpegAudioV25SampleRateTable[Lt];break;case 2:Ut=this._mpegAudioV20SampleRateTable[Lt];break;case 3:Ut=this._mpegAudioV10SampleRateTable[Lt];break}switch(He){case 1:ht=34,lt<this._mpegAudioL3BitRateTable.length&&(vt=this._mpegAudioL3BitRateTable[lt]);break;case 2:ht=33,lt<this._mpegAudioL2BitRateTable.length&&(vt=this._mpegAudioL2BitRateTable[lt]);break;case 3:ht=32,lt<this._mpegAudioL1BitRateTable.length&&(vt=this._mpegAudioL1BitRateTable[lt]);break}de={bitRate:vt,samplingRate:Ut,channelCount:bt,codec:ot,originalCodec:ot}}else de=ge;return de}_parseVideoData(h,m,y,k,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 ge=new Uint8Array(h,m,y)[0],de=(ge&240)>>>4,ke=ge&15;if(ke!==7){this._onError(we.CODEC_UNSUPPORTED,`Flv: Unsupported codec in video frame: ${ke}`);return}this._parseAVCVideoPacket(h,m+1,y-1,k,H,de)}_parseAVCVideoPacket(h,m,y,k,H,ge){if(y<4){p.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}let de=this._littleEndian,ke=new DataView(h,m,y),He=ke.getUint8(0),Lt=(ke.getUint32(0,!de)&16777215)<<8>>8;if(He===0)this._parseAVCDecoderConfigurationRecord(h,m+4,y-4);else if(He===1)this._parseAVCVideoData(h,m+4,y-4,k,H,ge,Lt);else if(He!==2){this._onError(we.FORMAT_ERROR,`Flv: Invalid video packet type ${He}`);return}}_parseAVCDecoderConfigurationRecord(h,m,y){if(y<7){p.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}let k=this._videoMetadata,H=this._videoTrack,ge=this._littleEndian,de=new DataView(h,m,y);k?typeof k.avcc!="undefined"&&p.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),k=this._videoMetadata={},k.type="video",k.id=H.id,k.timescale=this._timescale,k.duration=this._duration);let ke=de.getUint8(0),He=de.getUint8(1),lt=de.getUint8(2),Lt=de.getUint8(3);if(ke!==1||He===0){this._onError(we.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");return}if(this._naluLengthSize=(de.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(we.FORMAT_ERROR,`Flv: Strange NaluLengthSizeMinusOne: ${this._naluLengthSize-1}`);return}let Ot=de.getUint8(5)&31;if(Ot===0){this._onError(we.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else Ot>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: SPS Count = ${Ot}`);let bt=6;for(let vt=0;vt<Ot;vt++){let ht=de.getUint16(bt,!ge);if(bt+=2,ht===0)continue;let ot=new Uint8Array(h,m+bt,ht);bt+=ht;let wt=ee.parseSPS(ot);if(vt!==0)continue;k.codecWidth=wt.codec_size.width,k.codecHeight=wt.codec_size.height,k.presentWidth=wt.present_size.width,k.presentHeight=wt.present_size.height,k.profile=wt.profile_string,k.level=wt.level_string,k.bitDepth=wt.bit_depth,k.chromaFormat=wt.chroma_format,k.sarRatio=wt.sar_ratio,k.frameRate=wt.frame_rate,(wt.frame_rate.fixed===!1||wt.frame_rate.fps_num===0||wt.frame_rate.fps_den===0)&&(k.frameRate=this._referenceFrameRate);let St=k.frameRate.fps_den,pi=k.frameRate.fps_num;k.refSampleDuration=k.timescale*(St/pi);let zt=ot.subarray(1,4),Ft="avc1.";for(let ni=0;ni<3;ni++){let mi=zt[ni].toString(16);mi.length<2&&(mi="0"+mi),Ft+=mi}k.codec=Ft;let xt=this._mediaInfo;xt.width=k.codecWidth,xt.height=k.codecHeight,xt.fps=k.frameRate.fps,xt.profile=k.profile,xt.level=k.level,xt.refFrames=wt.ref_frames,xt.chromaFormat=wt.chroma_format_string,xt.sarNum=k.sarRatio.width,xt.sarDen=k.sarRatio.height,xt.videoCodec=Ft,xt.hasAudio?xt.audioCodec!=null&&(xt.mimeType='video/x-flv; codecs="'+xt.videoCodec+","+xt.audioCodec+'"'):xt.mimeType='video/x-flv; codecs="'+xt.videoCodec+'"',xt.isComplete()&&this._onMediaInfo(xt)}let Ut=de.getUint8(bt);if(Ut===0){this._onError(we.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No PPS");return}else Ut>1&&p.w(this.TAG,`Flv: Strange AVCDecoderConfigurationRecord: PPS Count = ${Ut}`);bt++;for(let vt=0;vt<Ut;vt++){let ht=de.getUint16(bt,!ge);bt+=2,ht!==0&&(bt+=ht)}k.avcc=new Uint8Array(y),k.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",k)}_parseAVCVideoData(h,m,y,k,H,ge,de){let ke=this._littleEndian,He=new DataView(h,m,y),lt=[],Lt=0,Ot=0;const bt=this._naluLengthSize;let Ut=this._timestampBase+k,vt=ge===1;for(;Ot<y;){if(Ot+4>=y){p.w(this.TAG,`Malformed Nalu near timestamp ${Ut}, offset = ${Ot}, dataSize = ${y}`);break}let ht=He.getUint32(Ot,!ke);if(bt===3&&(ht>>>=8),ht>y-bt){p.w(this.TAG,`Malformed Nalus near timestamp ${Ut}, NaluSize > DataSize!`);return}let ot=He.getUint8(Ot+bt)&31;ot===5&&(vt=!0);let wt=new Uint8Array(h,m+Ot,bt+ht),St={type:ot,data:wt};lt.push(St),Lt+=wt.byteLength,Ot+=bt+ht}if(lt.length){let ht=this._videoTrack,ot={units:lt,length:Lt,isKeyframe:vt,dts:Ut,cts:de,pts:Ut+de};vt&&(ot.fileposition=H),ht.samples.push(ot),ht.length+=Lt}}}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,k=Array.prototype.slice.call(arguments,1),H=k.length;for(let de=0;de<H;de++)m+=k[de].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 ge=8;for(let de=0;de<H;de++)y.set(k[de],ge),ge+=k[de].byteLength;return y}static generateInitSegment(h){let m=$.box($.types.ftyp,$.constants.FTYP),y=$.moov(h),k=new Uint8Array(m.byteLength+y.byteLength);return k.set(m,0),k.set(y,m.byteLength),k}static moov(h){let m=$.mvhd(h.timescale,h.duration),y=$.trak(h),k=$.mvex(h);return $.box($.types.moov,m,y,k)}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,k=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,k>>>8&255,k&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,k=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"],k)}static mp4a(h){let m=h.channelCount,y=h.audioSampleRate,k=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,k,$.esds(h))}static esds(h){let m=h.config||[],y=m.length,k=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,k)}static avc1(h){let m=h.avcc,y=h.codecWidth,k=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,k>>>8&255,k&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,k=$.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])),ge=$.sdtp(h),de=$.trun(h,ge.byteLength+16+16+8+16+8+8);return $.box($.types.traf,k,H,de,ge)}static sdtp(h){let m=h.samples||[],y=m.length,k=new Uint8Array(4+y);for(let H=0;H<y;H++){let ge=m[H].flags;k[H+4]=ge.isLeading<<6|ge.dependsOn<<4|ge.isDependedOn<<2|ge.hasRedundancy}return $.box($.types.sdtp,k)}static trun(h,m){let y=h.samples||[],k=y.length,H=12+16*k,ge=new Uint8Array(H);m+=8+H,ge.set([0,0,15,1,k>>>24&255,k>>>16&255,k>>>8&255,k&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255],0);for(let de=0;de<k;de++){let ke=y[de].duration,He=y[de].size,lt=y[de].flags,Lt=y[de].cts;ge.set([ke>>>24&255,ke>>>16&255,ke>>>8&255,ke&255,He>>>24&255,He>>>16&255,He>>>8&255,He&255,lt.isLeading<<2|lt.dependsOn,lt.isDependedOn<<6|lt.hasRedundancy<<4|lt.isNonSync,0,0,Lt>>>24&255,Lt>>>16&255,Lt>>>8&255,Lt&255],12+16*de)}return $.box($.types.trun,ge)}static mdat(h){return $.box($.types.mdat,h)}}$.init();var Q=$;class he{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 pe=he;class Ae{constructor(h,m,y,k,H){this.dts=h,this.pts=m,this.duration=y,this.originalDts=k,this.isSyncPoint=H,this.fileposition=null}}class Xe{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 We{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,k=m.length-1,H=0,ge=0,de=k;for(h<m[0].dts&&(y=0,ge=de+1);ge<=de;)if(H=ge+Math.floor((de-ge)/2),H===k||h>=m[H].dts&&h<m[H+1].dts){y=H;break}else m[H].dts<h?ge=H+1:de=H-1;return this._list[y]}}class ze{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,k=0,H=0,ge=y,de=0;if(h<m[0].originalBeginDts)return de=-1,de;for(;H<=ge;)if(k=H+Math.floor((ge-H)/2),k===y||h>m[k].lastSample.originalDts&&h<m[k+1].originalBeginDts){de=k;break}else m[k].originalBeginDts<h?H=k+1:ge=k-1;return de}_searchNearestSegmentAfter(h){return this._searchNearestSegmentBefore(h)+1}append(h){let m=this._list,y=h,k=this._lastAppendLocation,H=0;k!==-1&&k<m.length&&y.originalBeginDts>=m[k].lastSample.originalDts&&(k===m.length-1||k<m.length-1&&y.originalBeginDts<m[k+1].originalBeginDts)?H=k+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 Ke{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 ze("audio"),this._videoSegmentInfoList=new ze("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,k="mp4",H=m.codec;if(h==="audio")this._audioMeta=m,m.codec==="mp3"&&this._mp3UseMpegAudio?(k="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}/${k}`,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 k={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};m!=null&&(k.samples.push(m),k.length=m.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(y,!0),this._remuxAudio(k,!0)}_remuxAudio(h,m){if(this._audioMeta==null)return;let y=h,k=y.samples,H,ge=-1,de=-1,ke=-1,He=this._audioMeta.refSampleDuration,lt=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,Lt=this._dtsBaseInited&&this._audioNextDts===void 0,Ot=!1;if(!k||k.length===0||k.length===1&&!m)return;let bt=0,Ut=null,vt=0;lt?(bt=0,vt=y.length):(bt=8,vt=8+y.length);let ht=null;if(k.length>1&&(ht=k.pop(),vt-=ht.length),this._audioStashedLastSample!=null){let xt=this._audioStashedLastSample;this._audioStashedLastSample=null,k.unshift(xt),vt+=xt.length}ht!=null&&(this._audioStashedLastSample=ht);let ot=k[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"&&(Ot=!0);else{let xt=this._audioSegmentInfoList.getLastSampleBefore(ot);if(xt!=null){let ni=ot-(xt.originalDts+xt.duration);ni<=3&&(ni=0);let mi=xt.dts+xt.duration+ni;H=ot-mi}else H=0}if(Ot){let xt=ot-H,ni=this._videoSegmentInfoList.getLastSegmentBefore(ot);if(ni!=null&&ni.beginDts<xt){let mi=pe.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);if(mi){let Te=ni.beginDts,Pe=xt-ni.beginDts;p.v(this.TAG,`InsertPrefixSilentAudio: dts: ${Te}, duration: ${Pe}`),k.unshift({unit:mi,dts:Te,pts:Te}),vt+=mi.byteLength}}else Ot=!1}let wt=[];for(let xt=0;xt<k.length;xt++){let ni=k[xt],mi=ni.unit,Te=ni.dts-this._dtsBase,Pe=Te-H;ge===-1&&(ge=Pe);let rt=0;xt!==k.length-1?rt=k[xt+1].dts-this._dtsBase-H-Pe:ht!=null?rt=ht.dts-this._dtsBase-H-Pe:wt.length>=1?rt=wt[wt.length-1].duration:rt=Math.floor(He);let qe=!1,Ge=null;if(rt>He*1.5&&this._audioMeta.codec!=="mp3"&&this._fillAudioTimestampGap&&!V.safari){qe=!0;let tt=Math.abs(rt-He),pt=Math.ceil(tt/He),Ct=Pe+He;p.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.
|
|
dts: ${Pe+rt} ms, expected: ${Pe+Math.round(He)} ms, delta: ${Math.round(tt)} ms, generate: ${pt} frames`);let ui=pe.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);ui==null&&(p.w(this.TAG,`Unable to generate silent frame for ${this._audioMeta.originalCodec} with ${this._audioMeta.channelCount} channels, repeat last frame`),ui=mi),Ge=[];for(let Si=0;Si<pt;Si++){let ai=Math.round(Ct);if(Ge.length>0){let bi=Ge[Ge.length-1];bi.duration=ai-bi.dts}let gi={dts:ai,pts:ai,cts:0,unit:ui,size:ui.byteLength,duration:0,originalDts:Te,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};Ge.push(gi),vt+=gi.size,Ct+=He}let qt=Ge[Ge.length-1];qt.duration=Pe+rt-qt.dts,rt=Math.round(He)}wt.push({dts:Pe,pts:Pe,cts:0,unit:ni.unit,size:ni.unit.byteLength,duration:rt,originalDts:Te,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),qe&&wt.push.apply(wt,Ge)}lt?Ut=new Uint8Array(vt):(Ut=new Uint8Array(vt),Ut[0]=vt>>>24&255,Ut[1]=vt>>>16&255,Ut[2]=vt>>>8&255,Ut[3]=vt&255,Ut.set(Q.types.mdat,4));for(let xt=0;xt<wt.length;xt++){let ni=wt[xt].unit;Ut.set(ni,bt),bt+=ni.byteLength}let St=wt[wt.length-1];de=St.dts+St.duration,this._audioNextDts=de;let pi=new Xe;pi.beginDts=ge,pi.endDts=de,pi.beginPts=ge,pi.endPts=de,pi.originalBeginDts=wt[0].originalDts,pi.originalEndDts=St.originalDts+St.duration,pi.firstSample=new Ae(wt[0].dts,wt[0].pts,wt[0].duration,wt[0].originalDts,!1),pi.lastSample=new Ae(St.dts,St.pts,St.duration,St.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(pi),y.samples=wt,y.sequenceNumber++;let zt=null;lt?zt=new Uint8Array:zt=Q.moof(y,ge),y.samples=[],y.length=0;let Ft={type:"audio",data:this._mergeBoxes(zt,Ut).buffer,sampleCount:wt.length,info:pi};lt&&Lt&&(Ft.timestampOffset=ge),this._onMediaSegment("audio",Ft)}_remuxVideo(h,m){if(this._videoMeta==null)return;let y=h,k=y.samples,H,ge=-1,de=-1,ke=-1,He=-1;if(!k||k.length===0||k.length===1&&!m)return;let lt=8,Lt=null,Ot=8+h.length,bt=null;if(k.length>1&&(bt=k.pop(),Ot-=bt.length),this._videoStashedLastSample!=null){let St=this._videoStashedLastSample;this._videoStashedLastSample=null,k.unshift(St),Ot+=St.length}bt!=null&&(this._videoStashedLastSample=bt);let Ut=k[0].dts-this._dtsBase;if(this._videoNextDts)H=Ut-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())H=0;else{let St=this._videoSegmentInfoList.getLastSampleBefore(Ut);if(St!=null){let pi=Ut-(St.originalDts+St.duration);pi<=3&&(pi=0);let zt=St.dts+St.duration+pi;H=Ut-zt}else H=0}let vt=new Xe,ht=[];for(let St=0;St<k.length;St++){let pi=k[St],zt=pi.dts-this._dtsBase,Ft=pi.isKeyframe,xt=zt-H,ni=pi.cts,mi=xt+ni;ge===-1&&(ge=xt,ke=mi);let Te=0;if(St!==k.length-1?Te=k[St+1].dts-this._dtsBase-H-xt:bt!=null?Te=bt.dts-this._dtsBase-H-xt:ht.length>=1?Te=ht[ht.length-1].duration:Te=Math.floor(this._videoMeta.refSampleDuration),Ft){let Pe=new Ae(xt,mi,Te,pi.dts,!0);Pe.fileposition=pi.fileposition,vt.appendSyncPoint(Pe)}ht.push({dts:xt,pts:mi,cts:ni,units:pi.units,size:pi.length,isKeyframe:Ft,duration:Te,originalDts:zt,flags:{isLeading:0,dependsOn:Ft?2:1,isDependedOn:Ft?1:0,hasRedundancy:0,isNonSync:Ft?0:1}})}Lt=new Uint8Array(Ot),Lt[0]=Ot>>>24&255,Lt[1]=Ot>>>16&255,Lt[2]=Ot>>>8&255,Lt[3]=Ot&255,Lt.set(Q.types.mdat,4);for(let St=0;St<ht.length;St++){let pi=ht[St].units;for(;pi.length;){let Ft=pi.shift().data;Lt.set(Ft,lt),lt+=Ft.byteLength}}let ot=ht[ht.length-1];if(de=ot.dts+ot.duration,He=ot.pts+ot.duration,this._videoNextDts=de,vt.beginDts=ge,vt.endDts=de,vt.beginPts=ke,vt.endPts=He,vt.originalBeginDts=ht[0].originalDts,vt.originalEndDts=ot.originalDts+ot.duration,vt.firstSample=new Ae(ht[0].dts,ht[0].pts,ht[0].duration,ht[0].originalDts,ht[0].isKeyframe),vt.lastSample=new Ae(ot.dts,ot.pts,ot.duration,ot.originalDts,ot.isKeyframe),this._isLive||this._videoSegmentInfoList.append(vt),y.samples=ht,y.sequenceNumber++,this._forceFirstIDR){let St=ht[0].flags;St.dependsOn=2,St.isNonSync=0}let wt=Q.moof(y,ge);y.samples=[],y.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(wt,Lt).buffer,sampleCount:ht.length,info:vt})}_mergeBoxes(h,m){let y=new Uint8Array(h.byteLength+m.byteLength);return y.set(h,0),y.set(m,h.byteLength),y}}var Be=Ke,Oe={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 st{constructor(h,m){this.TAG="TransmuxingController",this._emitter=new(ce()),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(k=>{k.timestampBase=y,y+=k.duration,k.cors=h.cors,k.withCredentials=h.withCredentials,m.referrerPolicy&&(k.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],k=this._ioctl=new ae(y,this._config,h);k.onError=this._onIOException.bind(this),k.onSeeked=this._onIOSeeked.bind(this),k.onComplete=this._onIOComplete.bind(this),k.onRedirect=this._onIORedirect.bind(this),k.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),m?this._demuxer.bindDataSource(this._ioctl):k.onDataArrival=this._onInitChunkArrival.bind(this),k.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 k=y.getNearestKeyframe(h);this._remuxer.seek(k.milliseconds),this._ioctl.seek(k.fileposition),this._pendingResolveSeekPoint=k.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 k=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,k.fileposition),this._pendingResolveSeekPoint=k.milliseconds,this._reportSegmentMediaInfo(m)}}this._enableStatisticsReporter()}_searchSegmentIndexContains(h){let m=this._mediaDataSource.segments,y=m.length-1;for(let k=0;k<m.length;k++)if(h<m[k].timestampBase){y=k-1;break}return y}_onInitChunkArrival(h,m){let y=null,k=0;if(m>0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,k=this._demuxer.parseChunks(h,m);else if((y=X.probe(h)).match){this._demuxer=new X(y,this._config),this._remuxer||(this._remuxer=new Be(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),k=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(Oe.DEMUX_ERROR,we.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),k=0;return k}_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,It.prototype));let m=Object.assign({},h);Object.setPrototypeOf(m,It.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(Oe.METADATA_ARRIVED,h)}_onScriptDataArrived(h){this._emitter.emit(Oe.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(Oe.LOADING_COMPLETE),this._disableStatisticsReporter())}_onIORedirect(h){let m=this._ioctl.extraData;this._mediaDataSource.segments[m].redirectedURL=h}_onIORecoveredEarlyEof(){this._emitter.emit(Oe.RECOVERED_EARLY_EOF)}_onIOException(h,m){p.e(this.TAG,`IOException: type = ${h}, code = ${m.code}, msg = ${m.msg}`),this._emitter.emit(Oe.IO_ERROR,h,m),this._disableStatisticsReporter()}_onDemuxException(h,m){p.e(this.TAG,`DemuxException: type = ${h}, info = ${m}`),this._emitter.emit(Oe.DEMUX_ERROR,h,m)}_onRemuxerInitSegmentArrival(h,m){this._emitter.emit(Oe.INIT_SEGMENT,h,m)}_onRemuxerMediaSegmentArrival(h,m){if(this._pendingSeekTime==null&&(this._emitter.emit(Oe.MEDIA_SEGMENT,h,m),this._pendingResolveSeekPoint!=null&&h==="video")){let y=m.info.syncPoints,k=this._pendingResolveSeekPoint;this._pendingResolveSeekPoint=null,V.safari&&y.length>0&&y[0].originalDts===k&&(k=y[0].pts),this._emitter.emit(Oe.RECOMMEND_SEEKPOINT,k)}}_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(Oe.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(Oe.STATISTICS_INFO,h)}}var Bt=st,ft=function(Ve){let h="TransmuxingWorker",m=null,y=vt.bind(this);me.install(),Ve.addEventListener("message",function(ht){switch(ht.data.cmd){case"init":m=new Bt(ht.data.param[0],ht.data.param[1]),m.on(Oe.IO_ERROR,Ot.bind(this)),m.on(Oe.DEMUX_ERROR,bt.bind(this)),m.on(Oe.INIT_SEGMENT,k.bind(this)),m.on(Oe.MEDIA_SEGMENT,H.bind(this)),m.on(Oe.LOADING_COMPLETE,ge.bind(this)),m.on(Oe.RECOVERED_EARLY_EOF,de.bind(this)),m.on(Oe.MEDIA_INFO,ke.bind(this)),m.on(Oe.METADATA_ARRIVED,He.bind(this)),m.on(Oe.SCRIPTDATA_ARRIVED,lt.bind(this)),m.on(Oe.STATISTICS_INFO,Lt.bind(this)),m.on(Oe.RECOMMEND_SEEKPOINT,Ut.bind(this));break;case"destroy":m&&(m.destroy(),m=null),Ve.postMessage({msg:"destroyed"});break;case"start":m.start();break;case"stop":m.stop();break;case"seek":m.seek(ht.data.param);break;case"pause":m.pause();break;case"resume":m.resume();break;case"logging_config":{let ot=ht.data.param;et.applyConfig(ot),ot.enableCallback===!0?et.addLogListener(y):et.removeLogListener(y);break}}});function k(ht,ot){let wt={msg:Oe.INIT_SEGMENT,data:{type:ht,data:ot}};Ve.postMessage(wt,[ot.data])}function H(ht,ot){let wt={msg:Oe.MEDIA_SEGMENT,data:{type:ht,data:ot}};Ve.postMessage(wt,[ot.data])}function ge(){let ht={msg:Oe.LOADING_COMPLETE};Ve.postMessage(ht)}function de(){let ht={msg:Oe.RECOVERED_EARLY_EOF};Ve.postMessage(ht)}function ke(ht){let ot={msg:Oe.MEDIA_INFO,data:ht};Ve.postMessage(ot)}function He(ht){let ot={msg:Oe.METADATA_ARRIVED,data:ht};Ve.postMessage(ot)}function lt(ht){let ot={msg:Oe.SCRIPTDATA_ARRIVED,data:ht};Ve.postMessage(ot)}function Lt(ht){let ot={msg:Oe.STATISTICS_INFO,data:ht};Ve.postMessage(ot)}function Ot(ht,ot){Ve.postMessage({msg:Oe.IO_ERROR,data:{type:ht,info:ot}})}function bt(ht,ot){Ve.postMessage({msg:Oe.DEMUX_ERROR,data:{type:ht,info:ot}})}function Ut(ht){Ve.postMessage({msg:Oe.RECOMMEND_SEEKPOINT,data:ht})}function vt(ht,ot){Ve.postMessage({msg:"logcat_callback",data:{type:ht,logcat:ot}})}};class jt{constructor(h,m){if(this.TAG="Transmuxer",this._emitter=new(ce()),m.enableWorker&&typeof Worker!="undefined")try{let y=U(82059);this._worker=y(ft),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)},et.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:et.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(Oe.IO_ERROR,this._onIOError.bind(this)),y.on(Oe.DEMUX_ERROR,this._onDemuxError.bind(this)),y.on(Oe.INIT_SEGMENT,this._onInitSegment.bind(this)),y.on(Oe.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),y.on(Oe.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),y.on(Oe.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),y.on(Oe.MEDIA_INFO,this._onMediaInfo.bind(this)),y.on(Oe.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),y.on(Oe.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),y.on(Oe.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),y.on(Oe.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}destroy(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),et.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(Oe.INIT_SEGMENT,h,m)})}_onMediaSegment(h,m){Promise.resolve().then(()=>{this._emitter.emit(Oe.MEDIA_SEGMENT,h,m)})}_onLoadingComplete(){Promise.resolve().then(()=>{this._emitter.emit(Oe.LOADING_COMPLETE)})}_onRecoveredEarlyEof(){Promise.resolve().then(()=>{this._emitter.emit(Oe.RECOVERED_EARLY_EOF)})}_onMediaInfo(h){Promise.resolve().then(()=>{this._emitter.emit(Oe.MEDIA_INFO,h)})}_onMetaDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(Oe.METADATA_ARRIVED,h)})}_onScriptDataArrived(h){Promise.resolve().then(()=>{this._emitter.emit(Oe.SCRIPTDATA_ARRIVED,h)})}_onStatisticsInfo(h){Promise.resolve().then(()=>{this._emitter.emit(Oe.STATISTICS_INFO,h)})}_onIOError(h,m){Promise.resolve().then(()=>{this._emitter.emit(Oe.IO_ERROR,h,m)})}_onDemuxError(h,m){Promise.resolve().then(()=>{this._emitter.emit(Oe.DEMUX_ERROR,h,m)})}_onRecommendSeekpoint(h){Promise.resolve().then(()=>{this._emitter.emit(Oe.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 Oe.INIT_SEGMENT:case Oe.MEDIA_SEGMENT:this._emitter.emit(m.msg,y.type,y.data);break;case Oe.LOADING_COMPLETE:case Oe.RECOVERED_EARLY_EOF:this._emitter.emit(m.msg);break;case Oe.MEDIA_INFO:Object.setPrototypeOf(y,It.prototype),this._emitter.emit(m.msg,y);break;case Oe.METADATA_ARRIVED:case Oe.SCRIPTDATA_ARRIVED:case Oe.STATISTICS_INFO:this._emitter.emit(m.msg,y);break;case Oe.IO_ERROR:case Oe.DEMUX_ERROR:this._emitter.emit(m.msg,y.type,y.info);break;case Oe.RECOMMEND_SEEKPOINT:this._emitter.emit(m.msg,y);break;case"logcat_callback":p.emitter.emit("log",y.type,y.logcat);break;default:break}}}var si=jt,Gt={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(ce()),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 We}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 k=this._sourceBuffers[m];if(k){if(h.readyState!=="closed"){try{h.removeSourceBuffer(k)}catch(H){p.e(this.TAG,H.message)}k.removeEventListener("error",this.e.onSourceBufferError),k.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,k=`${y.container}`;y.codec&&y.codec.length>0&&(k+=`;codecs=${y.codec}`);let H=!1;if(p.v(this.TAG,"Received Initialization Segment, mimeType: "+k),this._lastInitSegments[y.type]=y,k!==this._mimeTypes[y.type]){if(this._mimeTypes[y.type])p.v(this.TAG,`Notice: ${y.type} mimeType changed, origin: ${this._mimeTypes[y.type]}, target: ${k}`);else{H=!0;try{let ge=this._sourceBuffers[y.type]=this._mediaSource.addSourceBuffer(k);ge.addEventListener("error",this.e.onSourceBufferError),ge.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(ge){p.e(this.TAG,ge.message),this._emitter.emit(Gt.ERROR,{code:ge.code,msg:ge.message});return}}this._mimeTypes[y.type]=k}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 k=this._pendingSegments[m];if(k.splice(0,k.length),this._mediaSource.readyState!=="closed"){for(let H=0;H<y.buffered.length;H++){let ge=y.buffered.start(H),de=y.buffered.end(H);this._pendingRemoveRanges[m].push({start:ge,end:de})}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 k=y.buffered;if(k.length>=1&&h-k.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 k=y.buffered,H=!1;for(let ge=0;ge<k.length;ge++){let de=k.start(ge),ke=k.end(ge);if(de<=h&&h<ke+3){if(h-de>=this._config.autoCleanupMaxBackwardDuration){H=!0;let He=h-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[m].push({start:de,end:He})}}else ke<h&&(H=!0,this._pendingRemoveRanges[m].push({start:de,end:ke}))}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 k=y.shift();m.remove(k.start,k.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 k=this._sourceBuffers[m].timestampOffset,H=y.timestampOffset/1e3;Math.abs(k-H)>.1&&(p.v(this.TAG,`Update MPEG audio timestampOffset from ${k} 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(k){this._pendingSegments[m].unshift(y),k.code===22?(this._isBufferFull||this._emitter.emit(Gt.BUFFER_FULL),this._isBufferFull=!0):(p.e(this.TAG,k.message),this._emitter.emit(Gt.ERROR,{code:k.code,msg:k.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(Gt.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(Gt.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"},nt={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:we.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:we.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:we.CODEC_UNSUPPORTED};class Mt{constructor(h,m){if(this.TAG="FlvPlayer",this._type="FlvPlayer",this._emitter=new(ce()),this._config=S(),typeof m=="object"&&Object.assign(this._config,m),h.type.toLowerCase()!=="flv")throw new C("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(Gt.UPDATE_END,this._onmseUpdateEnd.bind(this)),this._msectl.on(Gt.BUFFER_FULL,this._onmseBufferFull.bind(this)),this._msectl.on(Gt.SOURCE_OPEN,()=>{this._mseSourceOpened=!0,this._hasPendingLoad&&(this._hasPendingLoad=!1,this.load())}),this._msectl.on(Gt.ERROR,m=>{this._emitter.emit(Ee.ERROR,ut.MEDIA_ERROR,nt.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 si(this._mediaDataSource,this._config),this._transmuxer.on(Oe.INIT_SEGMENT,(h,m)=>{this._msectl.appendInitSegment(m)}),this._transmuxer.on(Oe.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(Oe.LOADING_COMPLETE,()=>{this._msectl.endOfStream(),this._emitter.emit(Ee.LOADING_COMPLETE)}),this._transmuxer.on(Oe.RECOVERED_EARLY_EOF,()=>{this._emitter.emit(Ee.RECOVERED_EARLY_EOF)}),this._transmuxer.on(Oe.IO_ERROR,(h,m)=>{this._emitter.emit(Ee.ERROR,ut.NETWORK_ERROR,h,m)}),this._transmuxer.on(Oe.DEMUX_ERROR,(h,m)=>{this._emitter.emit(Ee.ERROR,ut.MEDIA_ERROR,h,{code:-1,msg:m})}),this._transmuxer.on(Oe.MEDIA_INFO,h=>{this._mediaInfo=h,this._emitter.emit(Ee.MEDIA_INFO,Object.assign({},h))}),this._transmuxer.on(Oe.METADATA_ARRIVED,h=>{this._emitter.emit(Ee.METADATA_ARRIVED,h)}),this._transmuxer.on(Oe.SCRIPTDATA_ARRIVED,h=>{this._emitter.emit(Ee.SCRIPTDATA_ARRIVED,h)}),this._transmuxer.on(Oe.STATISTICS_INFO,h=>{this._statisticsInfo=this._fillStatisticsInfo(h),this._emitter.emit(Ee.STATISTICS_INFO,Object.assign({},this._statisticsInfo))}),this._transmuxer.on(Oe.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,k=0;if(this._mediaElement.getVideoPlaybackQuality){let H=this._mediaElement.getVideoPlaybackQuality();y=H.totalVideoFrames,k=H.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,k=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=k),h}_onmseUpdateEnd(){if(!this._config.lazyLoad||this._config.isLive)return;let h=this._mediaElement.buffered,m=this._mediaElement.currentTime,y=0,k=0;for(let H=0;H<h.length;H++){let ge=h.start(H),de=h.end(H);if(ge<=m&&m<de){y=ge,k=de;break}}k>=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 k=0;k<m.length;k++){let H=m.start(k),ge=m.end(k);if(h>=H&&h<ge){h>=ge-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 k=m.start(y),H=m.end(y);if(h>=k&&h<H)return!0}return!1}_internalSeek(h){let m=this._isTimepointBuffered(h),y=!1,k=0;if(h<1&&this._mediaElement.buffered.length>0){let H=this._mediaElement.buffered.start(0);(H<1&&h<H||V.safari)&&(y=!0,k=V.safari?.1:H)}if(y)this._requestSetTime=!0,this._mediaElement.currentTime=k;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 k=y.start(0);if(k<1&&m<k||V.safari){this._requestSetTime=!0,this._mediaElement.currentTime=V.safari?.1:k;return}}if(this._isTimepointBuffered(m)){if(this._alwaysSeekKeyframe){let k=this._msectl.getNearestKeyframe(Math.floor(m*1e3));k!=null&&(this._requestSetTime=!0,this._mediaElement.currentTime=k.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=Mt;class Tt{constructor(h,m){if(this.TAG="NativePlayer",this._type="NativePlayer",this._emitter=new(ce()),this._config=S(),typeof m=="object"&&Object.assign(this._config,m),h.type.toLowerCase()==="flv")throw new C("NativePlayer does't support flv MediaDataSource input!");if(h.hasOwnProperty("segments"))throw new C(`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,k=0;if(this._mediaElement.getVideoPlaybackQuality){let H=this._mediaElement.getVideoPlaybackQuality();y=H.totalVideoFrames,k=H.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,k=this._mediaElement.webkitDroppedFrameCount):m=!1;return m&&(h.decodedFrames=y,h.droppedFrames=k),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 _t=Tt;me.install();function At(Ve,h){let m=Ve;if(m==null||typeof m!="object")throw new C("MediaDataSource must be an javascript object!");if(!m.hasOwnProperty("type"))throw new C("MediaDataSource must has type field to indicate video file type!");switch(m.type){case"flv":return new Ht(m,h);default:return new _t(m,h)}}function vi(){return K.supportMSEH264Playback()}function Zt(){return K.getFeatureList()}let Xt={};Xt.createPlayer=At,Xt.isSupported=vi,Xt.getFeatureList=Zt,Xt.BaseLoader=A,Xt.LoaderStatus=v,Xt.LoaderErrors=E,Xt.Events=Ee,Xt.ErrorTypes=ut,Xt.ErrorDetails=nt,Xt.FlvPlayer=Ht,Xt.NativePlayer=_t,Xt.LoggingControl=et,Object.defineProperty(Xt,"version",{enumerable:!0,get:function(){return"__VERSION__"}});var Dt=Xt},25769:function(Wt,at,U){"use strict";var N=U(98040),me={"text/plain":"Text","text/html":"Url",default:"Text"},be="Copy to clipboard: #{key}, Enter";function ce(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,C,g,v,E=!1;ve||(ve={}),oe=ve.debug||!1;try{Z=N(),C=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(O){if(O.stopPropagation(),ve.format)if(O.preventDefault(),typeof O.clipboardData=="undefined"){oe&&console.warn("unable to use e.clipboardData"),oe&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var j=me[ve.format]||me.default;window.clipboardData.setData(j,p)}else O.clipboardData.clearData(),O.clipboardData.setData(ve.format,p);ve.onCopy&&(O.preventDefault(),ve.onCopy(O.clipboardData))}),document.body.appendChild(v),C.selectNodeContents(v),g.addRange(C);var A=document.execCommand("copy");if(!A)throw new Error("copy command was unsuccessful");E=!0}catch(O){oe&&console.error("unable to copy using execCommand: ",O),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=ce("message"in ve?ve.message:be),window.prompt(l,p)}}finally{g&&(typeof g.removeRange=="function"?g.removeRange(C):g.removeAllRanges()),v&&document.body.removeChild(v),Z()}return E}Wt.exports=G},3867:function(Wt,at,U){var N=U(97671);(function(me,be){Wt.exports=be()})(this,function(){"use strict";function me(Y){var re=typeof Y;return Y!==null&&(re==="object"||re==="function")}function be(Y){return typeof Y=="function"}var ce=void 0;Array.isArray?ce=Array.isArray:ce=function(Y){return Object.prototype.toString.call(Y)==="[object Array]"};var G=ce,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(z):ie())};function Z(Y){oe=Y}function C(Y){l=Y}var g=typeof window!="undefined"?window:void 0,v=g||{},E=v.MutationObserver||v.WebKitMutationObserver,A=typeof self=="undefined"&&typeof N!="undefined"&&{}.toString.call(N)==="[object process]",O=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function j(){return function(){return N.nextTick(z)}}function V(){return typeof ve!="undefined"?function(){ve(z)}:w()}function L(){var Y=0,re=new E(z),X=document.createTextNode("");return re.observe(X,{characterData:!0}),function(){X.data=Y=++Y%2}}function I(){var Y=new MessageChannel;return Y.port1.onmessage=z,function(){return Y.port2.postMessage(0)}}function w(){var Y=setTimeout;return function(){return Y(z,1)}}var R=new Array(1e3);function z(){for(var Y=0;Y<p;Y+=2){var re=R[Y],X=R[Y+1];re(X),R[Y]=void 0,R[Y+1]=void 0}p=0}function ne(){try{var Y=Function("return this")().require("vertx");return ve=Y.runOnLoop||Y.runOnContext,V()}catch(re){return w()}}var ie=void 0;A?ie=j():E?ie=L():O?ie=I():g===void 0?ie=ne():ie=w();function ye(Y,re){var X=this,$=new this.constructor($e);$[xe]===void 0&>($);var Q=X._state;if(Q){var he=arguments[Q-1];l(function(){return Jt(Q,$,he,X._result)})}else Et(X,$,Y,re);return $}function De(Y){var re=this;if(Y&&typeof Y=="object"&&Y.constructor===re)return Y;var X=new re($e);return le(X,Y),X}var xe=Math.random().toString(36).substring(2);function $e(){}var J=void 0,D=1,M=2;function P(){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(Y,re,X,$){try{Y.call(re,X,$)}catch(Q){return Q}}function S(Y,re,X){l(function($){var Q=!1,he=te(X,re,function(pe){Q||(Q=!0,re!==pe?le($,pe):Fe($,pe))},function(pe){Q||(Q=!0,et($,pe))},"Settle: "+($._label||" unknown promise"));!Q&&he&&(Q=!0,et($,he))},Y)}function b(Y,re){re._state===D?Fe(Y,re._result):re._state===M?et(Y,re._result):Et(re,void 0,function(X){return le(Y,X)},function(X){return et(Y,X)})}function K(Y,re,X){re.constructor===Y.constructor&&X===ye&&re.constructor.resolve===De?b(Y,re):X===void 0?Fe(Y,re):be(X)?S(Y,re,X):Fe(Y,re)}function le(Y,re){if(Y===re)et(Y,P());else if(me(re)){var X=void 0;try{X=re.then}catch($){et(Y,$);return}K(Y,re,X)}else Fe(Y,re)}function Ee(Y){Y._onerror&&Y._onerror(Y._result),It(Y)}function Fe(Y,re){Y._state===J&&(Y._result=re,Y._state=D,Y._subscribers.length!==0&&l(It,Y))}function et(Y,re){Y._state===J&&(Y._state=M,Y._result=re,l(Ee,Y))}function Et(Y,re,X,$){var Q=Y._subscribers,he=Q.length;Y._onerror=null,Q[he]=re,Q[he+D]=X,Q[he+M]=$,he===0&&Y._state&&l(It,Y)}function It(Y){var re=Y._subscribers,X=Y._state;if(re.length!==0){for(var $=void 0,Q=void 0,he=Y._result,pe=0;pe<re.length;pe+=3)$=re[pe],Q=re[pe+X],$?Jt(X,$,Q,he):Q(he);Y._subscribers.length=0}}function Jt(Y,re,X,$){var Q=be(X),he=void 0,pe=void 0,Ae=!0;if(Q){try{he=X($)}catch(Xe){Ae=!1,pe=Xe}if(re===he){et(re,ae());return}}else he=$;re._state!==J||(Q&&Ae?le(re,he):Ae===!1?et(re,pe):Y===D?Fe(re,he):Y===M&&et(re,he))}function Qe(Y,re){try{re(function($){le(Y,$)},function($){et(Y,$)})}catch(X){et(Y,X)}}var kt=0;function Ye(){return kt++}function gt(Y){Y[xe]=kt++,Y._state=void 0,Y._result=void 0,Y._subscribers=[]}function Je(){return new Error("Array Methods must be provided an Array")}var Me=function(){function Y(re,X){this._instanceConstructor=re,this.promise=new re($e),this.promise[xe]||gt(this.promise),G(X)?(this.length=X.length,this._remaining=X.length,this._result=new Array(this.length),this.length===0?Fe(this.promise,this._result):(this.length=this.length||0,this._enumerate(X),this._remaining===0&&Fe(this.promise,this._result))):et(this.promise,Je())}return Y.prototype._enumerate=function(X){for(var $=0;this._state===J&&$<X.length;$++)this._eachEntry(X[$],$)},Y.prototype._eachEntry=function(X,$){var Q=this._instanceConstructor,he=Q.resolve;if(he===De){var pe=void 0,Ae=void 0,Xe=!1;try{pe=X.then}catch(ze){Xe=!0,Ae=ze}if(pe===ye&&X._state!==J)this._settledAt(X._state,$,X._result);else if(typeof pe!="function")this._remaining--,this._result[$]=X;else if(Q===q){var We=new Q($e);Xe?et(We,Ae):K(We,X,pe),this._willSettleAt(We,$)}else this._willSettleAt(new Q(function(ze){return ze(X)}),$)}else this._willSettleAt(he(X),$)},Y.prototype._settledAt=function(X,$,Q){var he=this.promise;he._state===J&&(this._remaining--,X===M?et(he,Q):this._result[$]=Q),this._remaining===0&&Fe(he,this._result)},Y.prototype._willSettleAt=function(X,$){var Q=this;Et(X,void 0,function(he){return Q._settledAt(D,$,he)},function(he){return Q._settledAt(M,$,he)})},Y}();function _e(Y){return new Me(this,Y).promise}function Re(Y){var re=this;return G(Y)?new re(function(X,$){for(var Q=Y.length,he=0;he<Q;he++)re.resolve(Y[he]).then(X,$)}):new re(function(X,$){return $(new TypeError("You must pass an array to race."))})}function ee(Y){var re=this,X=new re($e);return et(X,Y),X}function Le(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function we(){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 Y(re){this[xe]=Ye(),this._result=this._state=void 0,this._subscribers=[],$e!==re&&(typeof re!="function"&&Le(),this instanceof Y?Qe(this,re):we())}return Y.prototype.catch=function(X){return this.then(null,X)},Y.prototype.finally=function(X){var $=this,Q=$.constructor;return be(X)?$.then(function(he){return Q.resolve(X()).then(function(){return he})},function(he){return Q.resolve(X()).then(function(){throw he})}):$.then(X,X)},Y}();q.prototype.then=ye,q.all=_e,q.race=Re,q.resolve=De,q.reject=ee,q._setScheduler=Z,q._setAsap=C,q._asap=l;function W(){var Y=void 0;if(typeof U.g!="undefined")Y=U.g;else if(typeof self!="undefined")Y=self;else try{Y=Function("return this")()}catch($){throw new Error("polyfill failed because global object is unavailable in this environment")}var re=Y.Promise;if(re){var X=null;try{X=Object.prototype.toString.call(re.resolve())}catch($){}if(X==="[object Promise]"&&!re.cast)return}Y.Promise=q}return q.polyfill=W,q.Promise=q,q})},86204:function(Wt){"use strict";var at=typeof Reflect=="object"?Reflect:null,U=at&&typeof at.apply=="function"?at.apply:function(I,w,R){return Function.prototype.apply.call(I,w,R)},N;at&&typeof at.ownKeys=="function"?N=at.ownKeys:Object.getOwnPropertySymbols?N=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:N=function(I){return Object.getOwnPropertyNames(I)};function me(L){console&&console.warn&&console.warn(L)}var be=Number.isNaN||function(I){return I!==I};function ce(){ce.init.call(this)}Wt.exports=ce,Wt.exports.once=O,ce.EventEmitter=ce,ce.prototype._events=void 0,ce.prototype._eventsCount=0,ce.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(ce,"defaultMaxListeners",{enumerable:!0,get:function(){return G},set:function(L){if(typeof L!="number"||L<0||be(L))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+L+".");G=L}}),ce.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},ce.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||be(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?ce.defaultMaxListeners:L._maxListeners}ce.prototype.getMaxListeners=function(){return ve(this)},ce.prototype.emit=function(I){for(var w=[],R=1;R<arguments.length;R++)w.push(arguments[R]);var z=I==="error",ne=this._events;if(ne!==void 0)z=z&&ne.error===void 0;else if(!z)return!1;if(z){var ie;if(w.length>0&&(ie=w[0]),ie instanceof Error)throw ie;var ye=new Error("Unhandled error."+(ie?" ("+ie.message+")":""));throw ye.context=ie,ye}var De=ne[I];if(De===void 0)return!1;if(typeof De=="function")U(De,this,w);else for(var xe=De.length,$e=v(De,xe),R=0;R<xe;++R)U($e[R],this,w);return!0};function oe(L,I,w,R){var z,ne,ie;if(p(w),ne=L._events,ne===void 0?(ne=L._events=Object.create(null),L._eventsCount=0):(ne.newListener!==void 0&&(L.emit("newListener",I,w.listener?w.listener:w),ne=L._events),ie=ne[I]),ie===void 0)ie=ne[I]=w,++L._eventsCount;else if(typeof ie=="function"?ie=ne[I]=R?[w,ie]:[ie,w]:R?ie.unshift(w):ie.push(w),z=ve(L),z>0&&ie.length>z&&!ie.warned){ie.warned=!0;var ye=new Error("Possible EventEmitter memory leak detected. "+ie.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");ye.name="MaxListenersExceededWarning",ye.emitter=L,ye.type=I,ye.count=ie.length,me(ye)}return L}ce.prototype.addListener=function(I,w){return oe(this,I,w,!1)},ce.prototype.on=ce.prototype.addListener,ce.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},z=l.bind(R);return z.listener=w,R.wrapFn=z,z}ce.prototype.once=function(I,w){return p(w),this.on(I,Z(this,I,w)),this},ce.prototype.prependOnceListener=function(I,w){return p(w),this.prependListener(I,Z(this,I,w)),this},ce.prototype.removeListener=function(I,w){var R,z,ne,ie,ye;if(p(w),z=this._events,z===void 0)return this;if(R=z[I],R===void 0)return this;if(R===w||R.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete z[I],z.removeListener&&this.emit("removeListener",I,R.listener||w));else if(typeof R!="function"){for(ne=-1,ie=R.length-1;ie>=0;ie--)if(R[ie]===w||R[ie].listener===w){ye=R[ie].listener,ne=ie;break}if(ne<0)return this;ne===0?R.shift():E(R,ne),R.length===1&&(z[I]=R[0]),z.removeListener!==void 0&&this.emit("removeListener",I,ye||w)}return this},ce.prototype.off=ce.prototype.removeListener,ce.prototype.removeAllListeners=function(I){var w,R,z;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 ne=Object.keys(R),ie;for(z=0;z<ne.length;++z)ie=ne[z],ie!=="removeListener"&&this.removeAllListeners(ie);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(z=w.length-1;z>=0;z--)this.removeListener(I,w[z]);return this};function C(L,I,w){var R=L._events;if(R===void 0)return[];var z=R[I];return z===void 0?[]:typeof z=="function"?w?[z.listener||z]:[z]:w?A(z):v(z,z.length)}ce.prototype.listeners=function(I){return C(this,I,!0)},ce.prototype.rawListeners=function(I){return C(this,I,!1)},ce.listenerCount=function(L,I){return typeof L.listenerCount=="function"?L.listenerCount(I):g.call(L,I)},ce.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}ce.prototype.eventNames=function(){return this._eventsCount>0?N(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 O(L,I){return new Promise(function(w,R){function z(ie){L.removeListener(I,ne),R(ie)}function ne(){typeof L.removeListener=="function"&&L.removeListener("error",z),w([].slice.call(arguments))}V(L,I,ne,{once:!0}),I!=="error"&&j(L,z,{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 z(ne){R.once&&L.removeEventListener(I,z),w(ne)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof L)}},24334:function(Wt,at,U){var N,me;(function(be,ce){Wt.exports=ce(be)})(typeof self!="undefined"?self:typeof window!="undefined"?window:typeof U.g!="undefined"?U.g:this,function(be){"use strict";be=be||{};var ce=be.Base64,G="2.6.4",p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ve=function(D){for(var M={},P=0,ae=D.length;P<ae;P++)M[D.charAt(P)]=P;return M}(p),oe=String.fromCharCode,l=function(D){if(D.length<2){var M=D.charCodeAt(0);return M<128?D:M<2048?oe(192|M>>>6)+oe(128|M&63):oe(224|M>>>12&15)+oe(128|M>>>6&63)+oe(128|M&63)}else{var M=65536+(D.charCodeAt(0)-55296)*1024+(D.charCodeAt(1)-56320);return oe(240|M>>>18&7)+oe(128|M>>>12&63)+oe(128|M>>>6&63)+oe(128|M&63)}},Z=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,C=function(D){return D.replace(Z,l)},g=function(D){var M=[0,2,1][D.length%3],P=D.charCodeAt(0)<<16|(D.length>1?D.charCodeAt(1):0)<<8|(D.length>2?D.charCodeAt(2):0),ae=[p.charAt(P>>>18),p.charAt(P>>>12&63),M>=2?"=":p.charAt(P>>>6&63),M>=1?"=":p.charAt(P&63)];return ae.join("")},v=be.btoa&&typeof be.btoa=="function"?function(D){return be.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(C(String(D)))},A=function(D){return D.replace(/[+\/]/g,function(M){return M=="+"?"-":"_"}).replace(/=/g,"")},O=function(D,M){return M?A(E(D)):E(D)},j=function(D){return O(D,!0)},V;be.Uint8Array&&(V=function(D,M){for(var P="",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;P+=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 M?A(P):P});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 M=(7&D.charCodeAt(0))<<18|(63&D.charCodeAt(1))<<12|(63&D.charCodeAt(2))<<6|63&D.charCodeAt(3),P=M-65536;return oe((P>>>10)+55296)+oe((P&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 M=D.length,P=M%4,ae=(M>0?ve[D.charAt(0)]<<18:0)|(M>1?ve[D.charAt(1)]<<12:0)|(M>2?ve[D.charAt(2)]<<6:0)|(M>3?ve[D.charAt(3)]:0),te=[oe(ae>>>16),oe(ae>>>8&255),oe(ae&255)];return te.length-=[0,0,2,1][P],te.join("")},z=be.atob&&typeof be.atob=="function"?function(D){return be.atob(D)}:function(D){return D.replace(/\S{1,4}/g,R)},ne=function(D){return z(String(D).replace(/[^A-Za-z0-9\+\/]/g,""))},ie=function(D){return w(z(D))},ye=function(D){return String(D).replace(/[-_]/g,function(M){return M=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},De=function(D){return ie(ye(D))},xe;be.Uint8Array&&(xe=function(D){return Uint8Array.from(ne(ye(D)),function(M){return M.charCodeAt(0)})});var $e=function(){var D=be.Base64;return be.Base64=ce,D};if(be.Base64={VERSION:G,atob:ne,btoa:v,fromBase64:De,toBase64:O,utob:C,encode:O,encodeURI:j,btou:w,decode:De,noConflict:$e,fromUint8Array:V,toUint8Array:xe},typeof Object.defineProperty=="function"){var J=function(D){return{value:D,enumerable:!1,writable:!0,configurable:!0}};be.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",J(function(){return De(this)})),Object.defineProperty(String.prototype,"toBase64",J(function(D){return O(this,D)})),Object.defineProperty(String.prototype,"toBase64URI",J(function(){return O(this,!0)}))}}return be.Meteor&&(Base64=be.Base64),Wt.exports?Wt.exports.Base64=be.Base64:(N=[],me=function(){return be.Base64}.apply(at,N),me!==void 0&&(Wt.exports=me)),{Base64:be.Base64}})},53184:function(Wt,at,U){"use strict";var N,me;function be(ce,G,p){var ve=function(oe,l){return ce.js_beautify(oe,l)};return ve.js=ce.js_beautify,ve.css=G.css_beautify,ve.html=p.html_beautify,ve.js_beautify=ce.js_beautify,ve.css_beautify=G.css_beautify,ve.html_beautify=p.html_beautify,ve}N=[U(58553),U(87804),U(40998)],me=function(ce,G,p){return be(ce,G,p)}.apply(at,N),me!==void 0&&(Wt.exports=me)},87804:function(Wt,at){var U,N;(function(){var me;(function(){"use strict";var ce=[,,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 C(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()}C.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},C.prototype.get_line_number=function(){return this.__lines.length},C.prototype.get_indent_string=function(g,v){return this.__indent_cache.get_indent_string(g,v)},C.prototype.get_indent_size=function(g,v){return this.__indent_cache.get_indent_size(g,v)},C.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},C.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},C.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},C.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},C.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)},C.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},C.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()},C.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(" "))},C.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()},C.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},C.prototype.just_added_newline=function(){return this.current_line.is_empty()},C.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},C.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=C},,,,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=C(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 C(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=C,oe.exports.mergeOpts=Z},,function(oe){var l=RegExp.prototype.hasOwnProperty("sticky");function Z(C){this.__input=C||"",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 C=null;return this.hasNext()&&(C=this.__input.charAt(this.__position),this.__position+=1),C},Z.prototype.peek=function(C){var g=null;return C=C||0,C+=this.__position,C>=0&&C<this.__input_length&&(g=this.__input.charAt(C)),g},Z.prototype.__match=function(C,g){C.lastIndex=g;var v=C.exec(this.__input);return v&&!(l&&C.sticky)&&v.index!==g&&(v=null),v},Z.prototype.test=function(C,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(C,g):!1},Z.prototype.testChar=function(C,g){var v=this.peek(g);return C.lastIndex=0,v!==null&&C.test(v)},Z.prototype.match=function(C){var g=this.__match(C,this.__position);return g?this.__position+=g[0].length:g=null,g},Z.prototype.read=function(C,g,v){var E="",A;return C&&(A=this.match(C),A&&(E+=A[0])),g&&(A||!C)&&(E+=this.readUntil(g,v)),E},Z.prototype.readUntil=function(C,g){var v="",E=this.__position;C.lastIndex=this.__position;var A=C.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(C){return this.readUntil(C,!0)},Z.prototype.get_regexp=function(C,g){var v=null,E="g";return g&&l&&(E="y"),typeof C=="string"&&C!==""?v=new RegExp(C,E):C&&(v=new RegExp(C.source,E)),v},Z.prototype.get_literal_regexp=function(C){return RegExp(C.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},Z.prototype.peekUntilAfter=function(C){var g=this.__position,v=this.readUntilAfter(C);return this.__position=g,v},Z.prototype.lookBack=function(C){var g=this.__position-1;return g>=C.length&&this.__input.substring(g-C.length,g).toLowerCase()===C},oe.exports.InputScanner=Z},,,,,function(oe){function l(Z,C){Z=typeof Z=="string"?Z:Z.source,C=typeof C=="string"?C:C.source,this.__directives_block_pattern=new RegExp(Z+/ beautify( \w+[:]\w+)+ /.source+C,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(Z+/\sbeautify\signore:end\s/.source+C,"g")}l.prototype.get_directives=function(Z){if(!Z.match(this.__directives_block_pattern))return null;var C={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(Z);g;)C[g[1]]=g[2],g=this.__directive_pattern.exec(Z);return C},l.prototype.readIgnored=function(Z){return Z.readUntilAfter(this.__directives_end_ignore_pattern)},oe.exports.Directives=l},,function(oe,l,Z){var C=Z(16).Beautifier,g=Z(17).Options;function v(E,A){var O=new C(E,A);return O.beautify()}oe.exports=v,oe.exports.defaultOptions=function(){return new g}},function(oe,l,Z){var C=Z(17).Options,g=Z(2).Output,v=Z(8).InputScanner,E=Z(13).Directives,A=new E(/\/\*/,/\*\//),O=/\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(z,ne){this._source_text=z||"",this._options=new C(ne),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(z){var ne="";for(this._ch=this._input.next();this._ch;){if(ne+=this._ch,this._ch==="\\")ne+=this._input.next();else if(z.indexOf(this._ch)!==-1||this._ch===`
|
|
`)break;this._ch=this._input.next()}return ne},R.prototype.eatWhitespace=function(z){for(var ne=V.test(this._input.peek()),ie=0;V.test(this._input.peek());)this._ch=this._input.next(),z&&this._ch===`
|
|
`&&(ie===0||ie<this._options.max_preserve_newlines)&&(ie++,this._output.add_new_line(!0));return ne},R.prototype.foundNestedPseudoClass=function(){for(var z=0,ne=1,ie=this._input.peek(ne);ie;){if(ie==="{")return!0;if(ie==="(")z+=1;else if(ie===")"){if(z===0)return!1;z-=1}else if(ie===";"||ie==="}")return!1;ne++,ie=this._input.peek(ne)}return!1},R.prototype.print_string=function(z){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(z)},R.prototype.preserveSingleSpace=function(z){z&&(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 z=this._source_text,ne=this._options.eol;ne==="auto"&&(ne=`
|
|
`,z&&O.test(z||"")&&(ne=z.match(O)[0])),z=z.replace(j,`
|
|
`);var ie=z.match(/^[\t ]*/)[0];this._output=new g(this._options,ie),this._input=new v(z),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ye=0,De=!1,xe=!1,$e=!1,J=!1,D=!1,M=this._ch,P=!1,ae,te,S;ae=this._input.read(L),te=ae!=="",S=M,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),M=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,De=this._indentLevel>=this._nestedLevel):De=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&De&&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),De=!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 Fe=0;Fe<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Fe++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Fe])){P=!0;break}(De||$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 et=S==='"'||S==="'";this.preserveSingleSpace(et||te),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")P=!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 Et=!1;this._input.lookBack("with")&&(Et=!0),this.preserveSingleSpace(te||Et),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 It=S==='"'||S==="'";this.preserveSingleSpace(It||te),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
|
|
`&&P&&this._output.add_new_line()}var Jt=this._output.get_code(ne);return Jt},oe.exports.Beautifier=R},function(oe,l,Z){var C=Z(6).Options;function g(v){C.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 O=0;O<A.length;O++)A[O]!=="expand"?this.brace_style="collapse":this.brace_style=A[O]}g.prototype=new C,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 ce[oe](Z,Z.exports,p),Z.exports}var ve=p(15);me=ve})();var be=me;U=[],N=function(){return{css_beautify:be}}.apply(at,U),N!==void 0&&(Wt.exports=N)})()},40998:function(Wt,at,U){var N,me;(function(){var be;(function(){"use strict";var ve=[,,function(C){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 O=this.__items.length-1;O>=0;O--)if(this.__items[O].match(A))return!0;return!1},g.prototype.set_indent=function(A,O){this.is_empty()&&(this.__indent_count=A||0,this.__alignment_count=O||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 O=A.lastIndexOf(`
|
|
`);O!==-1?this.__character_count=A.length-O: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,O){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)),O=O||"",A.indent_level>0&&(O=new Array(A.indent_level+1).join(this.__indent_string)),this.__base_string=O,this.__base_string_length=O.length}v.prototype.get_indent_size=function(A,O){var j=this.__base_string_length;return O=O||0,A<0&&(j=0),j+=A*this.__indent_size,j+=O,j},v.prototype.get_indent_string=function(A,O){var j=this.__base_string;return O=O||0,A<0&&(A=0,j=""),O+=A*this.__indent_size,this.__ensure_cache(O),j+=this.__cache[O],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,O=0,j="";this.__indent_size&&A>=this.__indent_size&&(O=Math.floor(A/this.__indent_size),A-=O*this.__indent_size,j=new Array(O+1).join(this.__indent_string)),A&&(j+=new Array(A+1).join(" ")),this.__cache.push(j)};function E(A,O){this.__indent_cache=new v(A,O),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,O){return this.__indent_cache.get_indent_string(A,O)},E.prototype.get_indent_size=function(A,O){return this.__indent_cache.get_indent_size(A,O)},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 O=this.current_line.pop();O&&(O[O.length-1]===`
|
|
`&&(O=O.replace(/\n+$/g,"")),this.current_line.push(O)),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,O){return A=A||0,O=O||0,this.next_line.set_indent(A,O),this.__lines.length>1?(this.current_line.set_indent(A,O),!0):(this.current_line.set_indent(),!1)},E.prototype.add_raw_token=function(A){for(var O=0;O<A.newlines;O++)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 O=this.__lines.length;A<O;)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,O){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)!==O){this.__lines.splice(j+1,0,new g(this)),this.previous_line=this.__lines[this.__lines.length-2];break}j--}},C.exports.Output=E},function(C){function g(v,E,A,O){this.type=v,this.text=E,this.comments_before=null,this.newlines=A||0,this.whitespace_before=O||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}C.exports.Token=g},,,function(C){function g(A,O){this.raw_options=v(A,O),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,O){var j=this.raw_options[A],V=O||[];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,O){var j=this.raw_options[A],V=j===void 0?!!O:!!j;return V},g.prototype._get_characters=function(A,O){var j=this.raw_options[A],V=O||"";return typeof j=="string"&&(V=j.replace(/\\r/,"\r").replace(/\\n/,`
|
|
`).replace(/\\t/," ")),V},g.prototype._get_number=function(A,O){var j=this.raw_options[A];O=parseInt(O,10),isNaN(O)&&(O=0);var V=parseInt(j,10);return isNaN(V)&&(V=O),V},g.prototype._get_selection=function(A,O,j){var V=this._get_selection_list(A,O,j);if(V.length!==1)throw new Error("Invalid Option Value: The option '"+A+`' can only be one of the following values:
|
|
`+O+`
|
|
You passed in: '`+this.raw_options[A]+"'");return V[0]},g.prototype._get_selection_list=function(A,O,j){if(!O||O.length===0)throw new Error("Selection list cannot be empty.");if(j=j||[O[0]],!this._is_valid_selection(j,O))throw new Error("Invalid Default Value!");var V=this._get_array(A,j);if(!this._is_valid_selection(V,O))throw new Error("Invalid Option Value: The option '"+A+`' can contain only the following values:
|
|
`+O+`
|
|
You passed in: '`+this.raw_options[A]+"'");return V},g.prototype._is_valid_selection=function(A,O){return A.length&&O.length&&!A.some(function(j){return O.indexOf(j)===-1})};function v(A,O){var j={};A=E(A);var V;for(V in A)V!==O&&(j[V]=A[V]);if(O&&A[O])for(V in A[O])j[V]=A[O][V];return j}function E(A){var O={},j;for(j in A){var V=j.replace(/-/g,"_");O[V]=A[j]}return O}C.exports.Options=g,C.exports.normalizeOpts=E,C.exports.mergeOpts=v},,function(C){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 O=E.exec(this.__input);return O&&!(g&&E.sticky)&&O.index!==A&&(O=null),O},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 O=this.peek(A);return E.lastIndex=0,O!==null&&E.test(O)},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,O){var j="",V;return E&&(V=this.match(E),V&&(j+=V[0])),A&&(V||!E)&&(j+=this.readUntil(A,O)),j},v.prototype.readUntil=function(E,A){var O="",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,O=this.__input.substring(this.__position,j),this.__position=j,O},v.prototype.readUntilAfter=function(E){return this.readUntil(E,!0)},v.prototype.get_regexp=function(E,A){var O=null,j="g";return A&&g&&(j="y"),typeof E=="string"&&E!==""?O=new RegExp(E,j):E&&(O=new RegExp(E.source,j)),O},v.prototype.get_literal_regexp=function(E){return RegExp(E.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},v.prototype.peekUntilAfter=function(E){var A=this.__position,O=this.readUntilAfter(E);return this.__position=A,O},v.prototype.lookBack=function(E){var A=this.__position-1;return A>=E.length&&this.__input.substring(A-E.length,A).toLowerCase()===E},C.exports.InputScanner=v},function(C,g,v){var E=v(8).InputScanner,A=v(3).Token,O=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 O,this._reset();for(var I,w=new A(V.START,""),R=null,z=[],ne=new O;w.type!==V.EOF;){for(I=this._get_next_token(w,R);this._is_comment(I);)ne.add(I),I=this._get_next_token(w,R);ne.isEmpty()||(I.comments_before=ne,ne=new O),I.parent=R,this._is_opening(I)?(z.push(R),R=I):R&&this._is_closing(I,R)&&(I.opened=R,R.closed=I,R=z.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()},C.exports.Tokenizer=L,C.exports.TOKEN=V},function(C){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},C.exports.TokenStream=g},function(C,g,v){var E=v(12).Pattern;function A(O,j){E.call(this,O,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(O,j){O+="\\t ",j+="\\n\\r",this._match_pattern=this._input.get_regexp("["+O+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 O=this._input.read(this._match_pattern);if(O===" ")this.whitespace_before_token=" ";else if(O){var j=this.__split(this._newline_regexp,O);this.newline_count=j.length-1,this.whitespace_before_token=j[this.newline_count]}return O},A.prototype.matching=function(O,j){var V=this._create();return V.__set_whitespace_patterns(O,j),V._update(),V},A.prototype._create=function(){return new A(this._input,this)},A.prototype.__split=function(O,j){O.lastIndex=0;for(var V=0,L=[],I=O.exec(j);I;)L.push(j.substring(V,I.index)),V=I.index+I[0].length,I=O.exec(j);return V<j.length?L.push(j.substring(V,j.length)):L.push(""),L},C.exports.WhitespacePattern=A},function(C){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(){},C.exports.Pattern=g},function(C){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)},C.exports.Directives=g},function(C,g,v){var E=v(12).Pattern,A={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function O(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}/)}}O.prototype=new E,O.prototype._create=function(){return new O(this._input,this)},O.prototype._update=function(){this.__set_templated_pattern()},O.prototype.disable=function(j){var V=this._create();return V._disabled[j]=!0,V._update(),V},O.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},O.prototype.exclude=function(j){var V=this._create();return V._excluded[j]=!0,V._update(),V},O.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},O.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("|")+")")},O.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},C.exports.TemplatablePattern=O},,,,function(C,g,v){var E=v(19).Beautifier,A=v(20).Options;function O(j,V,L,I){var w=new E(j,V,L,I);return w.beautify()}C.exports=O,C.exports.defaultOptions=function(){return new A}},function(C,g,v){var E=v(20).Options,A=v(2).Output,O=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 M=0;M<D;M++)this.print_newline(M>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,M=J.next;M.type!==j.EOF&&J.closed!==M;){if(M.type===j.ATTRIBUTE&&M.text==="type"){M.next&&M.next.type===j.EQUALS&&M.next.next&&M.next.next.type===j.VALUE&&(D=M.next.next.text);break}M=M.next}return D},R=function(J,D){var M=null,P=null;return D.closed?(J==="script"?M="text/javascript":J==="style"&&(M="text/css"),M=w(D)||M,M.search("text/css")>-1?P="css":M.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?P="javascript":M.search(/(text|application|dojo)\/(x-)?(html)/)>-1?P="html":M.search(/test\/null/)>-1&&(P="null"),P):null};function z(J,D){return D.indexOf(J)!==-1}function ne(J,D,M){this.parent=J||null,this.tag=D?D.tag_name:"",this.indent_level=M||0,this.parser_token=D||null}function ie(J){this._printer=J,this._current_frame=null}ie.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},ie.prototype.record_tag=function(J){var D=new ne(this._current_frame,J,this._printer.indent_level);this._current_frame=D},ie.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},ie.prototype._get_frame=function(J,D){for(var M=this._current_frame;M&&J.indexOf(M.tag)===-1;){if(D&&D.indexOf(M.tag)!==-1){M=null;break}M=M.parent}return M},ie.prototype.try_pop=function(J,D){var M=this._get_frame([J],D);return this._try_pop_frame(M)},ie.prototype.indent_to_tag=function(J){var D=this._get_frame(J);D&&(this._printer.indent_level=D.indent_level)};function ye(J,D,M,P){this._source_text=J||"",D=D||{},this._js_beautify=M,this._css_beautify=P,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 M=J.match(/^[\t ]*/)[0],P={text:"",type:""},ae=new De(this._options),te=new I(this._options,M),S=new O(J,this._options).tokenize();this._tag_stack=new ie(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,P,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,P):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),P=b,K=S.next();var le=te._output.get_code(D);return le},ye.prototype._handle_control_flow_open=function(J,D){var M={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(),M},ye.prototype._handle_control_flow_close=function(J,D){var M={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),M},ye.prototype._handle_tag_close=function(J,D,M){var P={text:D.text,type:D.type};return J.alignment_size=0,M.tag_complete=!0,J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),M.is_unformatted?J.add_raw_token(D):(M.tag_start_char==="<"&&(J.set_space_before_token(D.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&M.has_wrapped_attrs&&J.print_newline(!1)),J.print_token(D)),M.indent_content&&!(M.is_unformatted||M.is_content_unformatted)&&(J.indent(),M.indent_content=!1),!M.is_inline_element&&!(M.is_unformatted||M.is_content_unformatted)&&J.set_wrap_point(),P},ye.prototype._handle_inside_tag=function(J,D,M,P){var ae=M.has_wrapped_attrs,te={text:D.text,type:D.type};return J.set_space_before_token(D.newlines||D.whitespace_before!=="",!0),M.is_unformatted?J.add_raw_token(D):M.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&&M.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&&M.attr_count>=this._options.wrap_attributes_min_attrs&&(P.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(),M.has_wrapped_attrs=ae),te},ye.prototype._handle_text=function(J,D,M){var P={text:D.text,type:"TK_CONTENT"};return M.custom_beautifier_name?this._print_custom_beatifier_text(J,D,M):M.is_unformatted||M.is_content_unformatted?J.add_raw_token(D):(J.traverse_whitespace(D),J.print_token(D)),P},ye.prototype._print_custom_beatifier_text=function(J,D,M){var P=this;if(D.text!==""){var ae=D.text,te,S=1,b="",K="";M.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?te=this._js_beautify:M.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?te=this._css_beautify:M.custom_beautifier_name==="html"&&(te=function(It,Jt){var Qe=new ye(It,Jt,P._js_beautify,P._css_beautify);return Qe.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]*$/,""),M.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 Fe=function(){this.eol=`
|
|
`};Fe.prototype=this._options.raw_options;var et=new Fe;ae=te(le+ae,et)}else{var Et=D.whitespace_before;Et&&(ae=ae.replace(new RegExp(`
|
|
(`+Et+")?","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,M,P,ae){var te=this._get_tag_open_token(D);if((M.is_unformatted||M.is_content_unformatted)&&!M.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,M,P),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 De=function(J,D,M){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="",!M)this.tag_complete=!0;else{var P;this.tag_start_char=M.text[0],this.text=M.text,this.tag_start_char==="<"?(P=M.text.match(/^<([^\s>]*)/),this.tag_check=P?P[1]:""):(P=M.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=P?P[1]:"",(M.text.startsWith("{{#>")||M.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&M.next!==null?this.tag_check=M.next.text.split(" ")[0]:this.tag_check=M.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),M.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||M.closed&&M.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 De(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||z(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&&z(D.tag_check,this._options.unformatted),D.is_content_unformatted=!D.is_empty_element&&z(D.tag_check,this._options.content_unformatted),D.is_inline_element=z(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,M,P,ae){if(M.is_empty_element||(M.is_end_tag?M.start_tag_token=this._tag_stack.try_pop(M.tag_name):(this._do_optional_end_element(M)&&(M.is_inline_element||J.print_newline(!1)),this._tag_stack.record_tag(M),(M.tag_name==="script"||M.tag_name==="style")&&!(M.is_unformatted||M.is_content_unformatted)&&(M.custom_beautifier_name=R(M.tag_check,D)))),z(M.tag_check,this._options.extra_liners)&&(J.print_newline(!1),J._output.just_added_blankline()||J.print_newline(!0)),M.is_empty_element){if(M.tag_start_char==="{"&&M.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),M.indent_content=!0;var te=J.current_line_has_match(/{{#if/);te||J.print_newline(!1)}M.tag_name==="!--"&&ae.type===j.TAG_CLOSE&&P.is_end_tag&&M.text.indexOf(`
|
|
`)===-1||(M.is_inline_element||M.is_unformatted||J.print_newline(!1),this._calcluate_parent_multiline(J,M))}else if(M.is_end_tag){var S=!1;S=M.start_tag_token&&M.start_tag_token.multiline_content,S=S||!M.is_inline_element&&!(P.is_inline_element||P.is_unformatted)&&!(ae.type===j.TAG_CLOSE&&M.start_tag_token===P)&&ae.type!=="TK_CONTENT",(M.is_content_unformatted||M.is_unformatted)&&(S=!1),S&&J.print_newline(!1)}else M.indent_content=!M.custom_beautifier_name,M.tag_start_char==="<"&&(M.tag_name==="html"?M.indent_content=this._options.indent_inner_html:M.tag_name==="head"?M.indent_content=this._options.indent_head_inner_html:M.tag_name==="body"&&(M.indent_content=this._options.indent_body_inner_html)),!(M.is_inline_element||M.is_unformatted)&&(ae.type!=="TK_CONTENT"||M.is_content_unformatted)&&J.print_newline(!1),this._calcluate_parent_multiline(J,M)},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 M=J.parent.parent;(!M||$e.indexOf(M.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}},C.exports.Beautifier=ye},function(C,g,v){var E=v(6).Options;function A(O){E.call(this,O,"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,C.exports.Options=A},function(C,g,v){var E=v(9).Tokenizer,A=v(9).TOKEN,O=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 O(/<\!--/,/-->/),w=function(R,z){E.call(this,R,z),this._current_tag_name="";var ne=new j(this._input).read_options(this._options),ie=new V(this._input);if(this.__patterns={word:ne.until(/[\n\r\t <]/),word_control_flow_close_excluded:ne.until(/[\n\r\t <}]/),single_quote:ne.until_after(/'/),double_quote:ne.until_after(/"/),attribute:ne.until(/[\n\r\t =>]|\/>/),element_name:ne.until(/[\n\r\t >\/]/),angular_control_flow_start:ie.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:ie.starting_with(/{{!--/).until_after(/--}}/),handlebars:ie.starting_with(/{{/).until_after(/}}/),handlebars_open:ie.until(/[\n\r\t }]/),handlebars_raw_close:ie.until(/}}/),comment:ie.starting_with(/<!--/).until_after(/-->/),cdata:ie.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:ie.starting_with(/<!\[/).until_after(/]>/),processing:ie.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=ie.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,z){return R.type===L.TAG_CLOSE&&z&&((R.text===">"||R.text==="/>")&&z.text[0]==="<"||R.text==="}}"&&z.text[0]==="{"&&z.text[1]==="{")||R.type===L.CONTROL_FLOW_CLOSE&&R.text==="}"&&z.text.endsWith("{")},w.prototype._reset=function(){this._current_tag_name=""},w.prototype._get_next_token=function(R,z){var ne=null;this._readWhitespace();var ie=this._input.peek();return ie===null?this._create_token(L.EOF,""):(ne=ne||this._read_open_handlebars(ie,z),ne=ne||this._read_attribute(ie,R,z),ne=ne||this._read_close(ie,z),ne=ne||this._read_script_and_style(ie,R),ne=ne||this._read_control_flows(ie,z),ne=ne||this._read_raw_content(ie,R,z),ne=ne||this._read_content_word(ie,z),ne=ne||this._read_comment_or_cdata(ie),ne=ne||this._read_processing(ie),ne=ne||this._read_open(ie,z),ne=ne||this._create_token(L.UNKNOWN,this._input.next()),ne)},w.prototype._read_comment_or_cdata=function(R){var z=null,ne=null,ie=null;if(R==="<"){var ye=this._input.peek(1);ye==="!"&&(ne=this.__patterns.comment.read(),ne?(ie=I.get_directives(ne),ie&&ie.ignore==="start"&&(ne+=I.readIgnored(this._input))):ne=this.__patterns.cdata.read()),ne&&(z=this._create_token(L.COMMENT,ne),z.directives=ie)}return z},w.prototype._read_processing=function(R){var z=null,ne=null,ie=null;if(R==="<"){var ye=this._input.peek(1);(ye==="!"||ye==="?")&&(ne=this.__patterns.conditional_comment.read(),ne=ne||this.__patterns.processing.read()),ne&&(z=this._create_token(L.COMMENT,ne),z.directives=ie)}return z},w.prototype._read_open=function(R,z){var ne=null,ie=null;return(!z||z.type===L.CONTROL_FLOW_OPEN)&&R==="<"&&(ne=this._input.next(),this._input.peek()==="/"&&(ne+=this._input.next()),ne+=this.__patterns.element_name.read(),ie=this._create_token(L.TAG_OPEN,ne)),ie},w.prototype._read_open_handlebars=function(R,z){var ne=null,ie=null;return(!z||z.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)==="!"?(ne=this.__patterns.handlebars_comment.read(),ne=ne||this.__patterns.handlebars.read(),ie=this._create_token(L.COMMENT,ne)):(ne=this.__patterns.handlebars_open.read(),ie=this._create_token(L.TAG_OPEN,ne))),ie},w.prototype._read_control_flows=function(R,z){var ne="",ie=null;if(!this._options.templating.includes("angular"))return ie;if(R==="@"){if(ne=this.__patterns.angular_control_flow_start.read(),ne==="")return ie;for(var ye=ne.endsWith("(")?1:0,De=0;!(ne.endsWith("{")&&ye===De);){var xe=this._input.next();if(xe===null)break;xe==="("?ye++:xe===")"&&De++,ne+=xe}ie=this._create_token(L.CONTROL_FLOW_OPEN,ne)}else R==="}"&&z&&z.type===L.CONTROL_FLOW_OPEN&&(ne=this._input.next(),ie=this._create_token(L.CONTROL_FLOW_CLOSE,ne));return ie},w.prototype._read_close=function(R,z){var ne=null,ie=null;return z&&z.type===L.TAG_OPEN&&(z.text[0]==="<"&&(R===">"||R==="/"&&this._input.peek(1)===">")?(ne=this._input.next(),R==="/"&&(ne+=this._input.next()),ie=this._create_token(L.TAG_CLOSE,ne)):z.text[0]==="{"&&R==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),ie=this._create_token(L.TAG_CLOSE,"}}"))),ie},w.prototype._read_attribute=function(R,z,ne){var ie=null,ye="";if(ne&&ne.text[0]==="<")if(R==="=")ie=this._create_token(L.EQUALS,this._input.next());else if(R==='"'||R==="'"){var De=this._input.next();R==='"'?De+=this.__patterns.double_quote.read():De+=this.__patterns.single_quote.read(),ie=this._create_token(L.VALUE,De)}else ye=this.__patterns.attribute.read(),ye&&(z.type===L.EQUALS?ie=this._create_token(L.VALUE,ye):ie=this._create_token(L.ATTRIBUTE,ye));return ie},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,z,ne){var ie="";if(ne&&ne.text[0]==="{")ie=this.__patterns.handlebars_raw_close.read();else if(z.type===L.TAG_CLOSE&&z.opened.text[0]==="<"&&z.text[0]!=="/"){var ye=z.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ye)&&(ie=this._input.readUntil(new RegExp("</"+ye+"[\\n\\r\\t ]*?>","ig")))}return ie?this._create_token(L.TEXT,ie):null},w.prototype._read_script_and_style=function(R,z){if(z.type===L.TAG_CLOSE&&z.opened.text[0]==="<"&&z.text[0]!=="/"){var ne=z.opened.text.substr(1).toLowerCase();if(ne==="script"||ne==="style"){var ie=this._read_comment_or_cdata(R);if(ie)return ie.type=L.TEXT,ie;var ye=this._input.readUntil(new RegExp("</"+ne+"[\\n\\r\\t ]*?>","ig"));if(ye)return this._create_token(L.TEXT,ye)}}return null},w.prototype._read_content_word=function(R,z){var ne="";return this._options.unformatted_content_delimiter&&R===this._options.unformatted_content_delimiter[0]&&(ne=this.__patterns.unformatted_content_delimiter.read()),ne||(ne=z&&z.type===L.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),ne?this._create_token(L.TEXT,ne):null},C.exports.Tokenizer=w,C.exports.TOKEN=L}],oe={};function l(C){var g=oe[C];if(g!==void 0)return g.exports;var v=oe[C]={exports:{}};return ve[C](v,v.exports,l),v.exports}var Z=l(18);be=Z})();var ce=be;if(1)N=[U,U(58553),U(87804)],me=function(ve){var oe=U(58553),l=U(87804);return{html_beautify:function(Z,C){return ce(Z,C,oe.js_beautify,l.css_beautify)}}}.apply(at,N),me!==void 0&&(Wt.exports=me);else var G,p})()},58553:function(Wt,at){var U,N;(function(){var me;(function(){"use strict";var ce=[function(oe,l,Z){var C=Z(1).Beautifier,g=Z(5).Options;function v(E,A){var O=new C(E,A);return O.beautify()}oe.exports=v,oe.exports.defaultOptions=function(){return new g}},function(oe,l,Z){var C=Z(2).Output,g=Z(3).Token,v=Z(4),E=Z(5).Options,A=Z(7).Tokenizer,O=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 z(b,K){return b&&b.type===V.RESERVED&&L(b.text,K)}var ne=["case","return","do","if","throw","else","await","break","continue","async"],ie=["before-newline","after-newline","preserve-newline"],ye=w(ie),De=[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 M(b){return L(b,[xe.Expression,xe.ForInitializer,xe.Conditional])}function P(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,Fe;le<Ee;le++)if(Fe=b[le],Fe&&Fe.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 C(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 Fe=b.comments_before.next();Fe;)this.handle_whitespace_and_comments(Fe,K),this.handle_token(Fe,K),Fe=b.comments_before.next();if(Ee)for(var et=0;et<le;et+=1)this.print_newline(et>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 Et=1;Et<le;Et+=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 Fe=L(this._flags.last_token.text,j)&&L(this._options.operator_position,De)||L(b.text,j);le=le&&Fe}if(le)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(z(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||z(this._flags.last_token,["get","set"]))},te.prototype.start_of_statement=function(b){var K=!1;return K=K||z(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)&&z(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||z(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,z(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===")"){z(this._flags.last_token,O)&&(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,O)||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);z(le,["async","function"])||le.text==="*"&&z(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])||z(this._flags.last_token,["return","throw","import","default"])?this.set_mode(xe.ObjectLiteral):this.set_mode(xe.BlockStatement),this._flags.last_token&&z(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Ee=!K.comments_before&&K.text==="}",Fe=Ee&&this._flags.last_word==="function"&&this._flags.last_token.type===V.END_EXPR;if(this._options.brace_preserve_inline){var et=0,Et=null;this._flags.inline_frame=!0;do if(et+=1,Et=this._tokens.peek(et-1),Et.newlines){this._flags.inline_frame=!1;break}while(Et.type!==V.EOF&&!(Et.type===V.END_BLOCK&&Et.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&&(Fe||this._flags.last_token.type===V.EQUALS||z(this._flags.last_token,ne)&&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)?z(this._flags.last_token,["var","let","const"])&&b.type===V.WORD&&(this._flags.declaration_statement=!0):b.newlines&&!M(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||!z(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&&z(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?z(this._flags.last_token,["get","set","new","export"])||z(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&&(M(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":z(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&&M(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"),z(b,O)&&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"),z(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"?z(this._flags.last_token,ne)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&z(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||!z(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()):z(b,O)&&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?(M(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==="*"&&(z(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,O)||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,De)&&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 Fe=!0,et=!0,Et=!1;if(b.text===":"?this._flags.ternary_depth===0?Fe=!1:(this._flags.ternary_depth-=1,Et=!0):b.text==="?"&&(this._flags.ternary_depth+=1),!le&&!K&&this._options.preserve_newlines&&L(b.text,j)){var It=b.text===":",Jt=It&&Et,Qe=It&&!Et;switch(this._options.operator_position){case ye.before_newline:this._output.space_before_token=!Qe,this.print_token(b),(!It||Jt)&&this.allow_wrap_or_preserved_newline(b),this._output.space_before_token=!0;return;case ye.after_newline:this._output.space_before_token=!0,!It||Jt?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:Qe||this.allow_wrap_or_preserved_newline(b),Fe=!(this._output.just_added_newline()||Qe),this._output.space_before_token=Fe,this.print_token(b),this._output.space_before_token=!0;return}}if(K){this.allow_wrap_or_preserved_newline(b),Fe=!1;var kt=this._tokens.peek();et=kt&&L(kt.type,[V.WORD,V.RESERVED])}else if(b.text==="...")this.allow_wrap_or_preserved_newline(b),Fe=this._flags.last_token.type===V.START_BLOCK,et=!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),Fe=!1,et=!1,b.newlines&&(b.text==="--"||b.text==="++"||b.text==="~")){var Ye=z(this._flags.last_token,ne)&&b.newlines;Ye&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(Ye,!0)}this._flags.last_token.text===";"&&M(this._flags.mode)&&(Fe=!0),this._flags.last_token.type===V.RESERVED?Fe=!0:this._flags.last_token.type===V.END_EXPR?Fe=!(this._flags.last_token.text==="]"&&(b.text==="--"||b.text==="++")):this._flags.last_token.type===V.OPERATOR&&(Fe=L(b.text,["--","-","++","+"])&&L(this._flags.last_token.text,["--","-","++","+"]),L(b.text,["+","-"])&&L(this._flags.last_token.text,["--","++"])&&(et=!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||Fe,this.print_token(b),this._output.space_before_token=et},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,Fe=!1,et=!1,Et=b.whitespace_before,It=Et.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),Fe=P(le,"*"),et=ae(le,Et),Fe&&(this._flags.alignment=1),Ee=0;Ee<le.length;Ee++)Fe?(this.print_token_line_indentation(b),this._output.add_token(I(le[Ee]))):et&&le[Ee]?(this.print_token_line_indentation(b),this._output.add_token(le[Ee].substring(It))):(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),z(this._flags.last_token,ne)?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 C(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()}C.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},C.prototype.get_line_number=function(){return this.__lines.length},C.prototype.get_indent_string=function(g,v){return this.__indent_cache.get_indent_string(g,v)},C.prototype.get_indent_size=function(g,v){return this.__indent_cache.get_indent_size(g,v)},C.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},C.prototype.add_new_line=function(g){return this.is_empty()||!g&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},C.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},C.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},C.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)},C.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},C.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()},C.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(" "))},C.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()},C.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},C.prototype.just_added_newline=function(){return this.current_line.is_empty()},C.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},C.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=C},function(oe){function l(Z,C,g,v){this.type=Z,this.text=C,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",C="\\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+"])",O="(?:"+E+"|["+C+g+v+"])*";l.identifier=new RegExp(A+O,"g"),l.identifierStart=new RegExp(A),l.identifierMatch=new RegExp("(?:"+E+"|["+C+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 C=Z(6).Options,g=["before-newline","after-newline","preserve-newline"];function v(E){C.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 O=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<O.length;j++)O[j]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=O[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 C,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=C(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 C(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=C,oe.exports.mergeOpts=Z},function(oe,l,Z){var C=Z(8).InputScanner,g=Z(9).Tokenizer,v=Z(9).TOKEN,E=Z(13).Directives,A=Z(4),O=Z(12).Pattern,j=Z(14).TemplatablePattern;function V(P,ae){return ae.indexOf(P)!==-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]/,z=/[^\d\.]/,ne=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),ie=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";ie=ie.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),ie="\\?\\.(?!\\d) "+ie,ie=ie.replace(/ /g,"|");var ye=new RegExp(ie),De="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),xe=De.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(P,ae){g.call(this,P,ae),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var te=new O(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(P){return P.type===L.COMMENT||P.type===L.BLOCK_COMMENT||P.type===L.UNKNOWN},D.prototype._is_opening=function(P){return P.type===L.START_BLOCK||P.type===L.START_EXPR},D.prototype._is_closing=function(P,ae){return(P.type===L.END_BLOCK||P.type===L.END_EXPR)&&ae&&(P.text==="]"&&ae.text==="["||P.text===")"&&ae.text==="("||P.text==="}"&&ae.text==="{")},D.prototype._reset=function(){J=!1},D.prototype._get_next_token=function(P,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(P),te=te||this._read_singles(S),te=te||this._read_comment(S),te=te||this._read_regexp(S,P),te=te||this._read_xml(S,P),te=te||this._read_punctuation(),te=te||this._create_token(L.UNKNOWN,this._input.next()),te)},D.prototype._read_word=function(P){var ae;if(ae=this.__patterns.identifier.read(),ae!=="")return ae=ae.replace(A.allLineBreaks,`
|
|
`),!(P.type===L.DOT||P.type===L.RESERVED&&(P.text==="set"||P.text==="get"))&&$e.test(ae)?(ae==="in"||ae==="of")&&(P.type===L.WORD||P.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(P){var ae=null;return P==="("||P==="["?ae=this._create_token(L.START_EXPR,P):P===")"||P==="]"?ae=this._create_token(L.END_EXPR,P):P==="{"?ae=this._create_token(L.START_BLOCK,P):P==="}"?ae=this._create_token(L.END_BLOCK,P):P===";"?ae=this._create_token(L.SEMICOLON,P):P==="."&&z.test(this._input.peek(1))?ae=this._create_token(L.DOT,P):P===","&&(ae=this._create_token(L.COMMA,P)),ae&&this._input.next(),ae},D.prototype._read_pair=function(P,ae){var te=null;return P==="#"&&ae==="{"&&(te=this._create_token(L.START_BLOCK,P+ae)),te&&(this._input.next(),this._input.next()),te},D.prototype._read_punctuation=function(){var P=this.__patterns.punct.read();if(P!=="")return P==="="?this._create_token(L.EQUALS,P):P==="?."?this._create_token(L.DOT,P):this._create_token(L.OPERATOR,P)},D.prototype._read_non_javascript=function(P){var ae="";if(P==="#"){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()+`
|
|
`);P=this._input.next();var te="#";if(this._input.hasNext()&&this._input.testChar(R)){do P=this._input.next(),te+=P;while(this._input.hasNext()&&P!=="#"&&P!=="=");return P==="#"||(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(P==="<"&&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&&P==="-"&&(ae=this.__patterns.html_comment_end.read(),ae))return J=!1,this._create_token(L.COMMENT,ae);return null},D.prototype._read_comment=function(P){var ae=null;if(P==="/"){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(P){if(P==="`"||P==="'"||P==='"'){var ae=this._input.next();return this.has_char_escapes=!1,P==="`"?ae+=this._read_string_recursive("`",!0,"${"):ae+=this._read_string_recursive(P),this.has_char_escapes&&this._options.unescape_strings&&(ae=M(ae)),this._input.peek()===P&&(ae+=this._input.next()),ae=ae.replace(A.allLineBreaks,`
|
|
`),this._create_token(L.STRING,ae)}return null},D.prototype._allow_regexp_or_xml=function(P){return P.type===L.RESERVED&&V(P.text,["return","case","throw","else","do","typeof","yield"])||P.type===L.END_EXPR&&P.text===")"&&P.opened.previous.type===L.RESERVED&&V(P.opened.previous.text,["if","while","for"])||V(P.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(P,ae){if(P==="/"&&this._allow_regexp_or_xml(ae)){for(var te=this._input.next(),S=!1,b=!1;this._input.hasNext()&&(S||b||this._input.peek()!==P)&&!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()===P&&(te+=this._input.next(),te+=this._input.read(A.identifier)),this._create_token(L.STRING,te)}return null},D.prototype._read_xml=function(P,ae){if(this._options.e4x&&P==="<"&&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],Fe=S[2],et=!!S[S.length-1]||Fe.slice(0,8)==="![CDATA[";if(!et&&(Fe===b||K&&Fe.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 M(P){for(var ae="",te=0,S=new C(P),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 P;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(P,ae,te){var S,b;P==="'"?b=this.__patterns.single_quote:P==='"'?b=this.__patterns.double_quote:P==="`"?b=this.__patterns.template_text:P==="}"&&(b=this.__patterns.template_expression);for(var K=b.read(),le="";this._input.hasNext();){if(le=this._input.next(),le===P||!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&&(P==="`"?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=ne.slice(),oe.exports.line_starters=De.slice()},function(oe){var l=RegExp.prototype.hasOwnProperty("sticky");function Z(C){this.__input=C||"",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 C=null;return this.hasNext()&&(C=this.__input.charAt(this.__position),this.__position+=1),C},Z.prototype.peek=function(C){var g=null;return C=C||0,C+=this.__position,C>=0&&C<this.__input_length&&(g=this.__input.charAt(C)),g},Z.prototype.__match=function(C,g){C.lastIndex=g;var v=C.exec(this.__input);return v&&!(l&&C.sticky)&&v.index!==g&&(v=null),v},Z.prototype.test=function(C,g){return g=g||0,g+=this.__position,g>=0&&g<this.__input_length?!!this.__match(C,g):!1},Z.prototype.testChar=function(C,g){var v=this.peek(g);return C.lastIndex=0,v!==null&&C.test(v)},Z.prototype.match=function(C){var g=this.__match(C,this.__position);return g?this.__position+=g[0].length:g=null,g},Z.prototype.read=function(C,g,v){var E="",A;return C&&(A=this.match(C),A&&(E+=A[0])),g&&(A||!C)&&(E+=this.readUntil(g,v)),E},Z.prototype.readUntil=function(C,g){var v="",E=this.__position;C.lastIndex=this.__position;var A=C.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(C){return this.readUntil(C,!0)},Z.prototype.get_regexp=function(C,g){var v=null,E="g";return g&&l&&(E="y"),typeof C=="string"&&C!==""?v=new RegExp(C,E):C&&(v=new RegExp(C.source,E)),v},Z.prototype.get_literal_regexp=function(C){return RegExp(C.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},Z.prototype.peekUntilAfter=function(C){var g=this.__position,v=this.readUntilAfter(C);return this.__position=g,v},Z.prototype.lookBack=function(C){var g=this.__position-1;return g>=C.length&&this.__input.substring(g-C.length,g).toLowerCase()===C},oe.exports.InputScanner=Z},function(oe,l,Z){var C=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"},O=function(j,V){this._input=new C(j),this._options=V||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new E(this._input)};O.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},O.prototype._is_first_token=function(){return this.__tokens.isEmpty()},O.prototype._reset=function(){},O.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,"")},O.prototype._is_comment=function(j){return!1},O.prototype._is_opening=function(j){return!1},O.prototype._is_closing=function(j,V){return!1},O.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},O.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},oe.exports.Tokenizer=O,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 C=null;return Z=Z||0,Z+=this.__position,Z>=0&&Z<this.__tokens_length&&(C=this.__tokens[Z]),C},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 C=Z(12).Pattern;function g(v,E){C.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 C,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,O=[],j=v.exec(E);j;)O.push(E.substring(A,j.index)),A=j.index+j[0].length,j=v.exec(E);return A<E.length?O.push(E.substring(A,E.length)):O.push(""),O},oe.exports.WhitespacePattern=g},function(oe){function l(Z,C){this._input=Z,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,C&&(this._starting_pattern=this._input.get_regexp(C._starting_pattern,!0),this._match_pattern=this._input.get_regexp(C._match_pattern,!0),this._until_pattern=this._input.get_regexp(C._until_pattern),this._until_after=C._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 C=this._create();return C._until_after=!0,C._until_pattern=this._input.get_regexp(Z),C._update(),C},l.prototype.until=function(Z){var C=this._create();return C._until_after=!1,C._until_pattern=this._input.get_regexp(Z),C._update(),C},l.prototype.starting_with=function(Z){var C=this._create();return C._starting_pattern=this._input.get_regexp(Z,!0),C._update(),C},l.prototype.matching=function(Z){var C=this._create();return C._match_pattern=this._input.get_regexp(Z,!0),C._update(),C},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},oe.exports.Pattern=l},function(oe){function l(Z,C){Z=typeof Z=="string"?Z:Z.source,C=typeof C=="string"?C:C.source,this.__directives_block_pattern=new RegExp(Z+/ beautify( \w+[:]\w+)+ /.source+C,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(Z+/\sbeautify\signore:end\s/.source+C,"g")}l.prototype.get_directives=function(Z){if(!Z.match(this.__directives_block_pattern))return null;var C={};this.__directive_pattern.lastIndex=0;for(var g=this.__directive_pattern.exec(Z);g;)C[g[1]]=g[2],g=this.__directive_pattern.exec(Z);return C},l.prototype.readIgnored=function(Z){return Z.readUntilAfter(this.__directives_end_ignore_pattern)},oe.exports.Directives=l},function(oe,l,Z){var C=Z(12).Pattern,g={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function v(E,A){C.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 O=new C(E);this.__patterns={handlebars_comment:O.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:O.starting_with(/{{{/).until_after(/}}}/),handlebars:O.starting_with(/{{/).until_after(/}}/),php:O.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:O.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:O.starting_with(/{%/).until_after(/%}/),django_value:O.starting_with(/{{/).until_after(/}}/),django_comment:O.starting_with(/{#/).until_after(/#}/),smarty:O.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:O.starting_with(/{\*/).until_after(/\*}/),smarty_literal:O.starting_with(/{literal}/).until_after(/{\/literal}/)}}v.prototype=new C,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 O in g)A._disabled[O]=E.templating.indexOf(O)===-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 O=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&O==="?"&&(E=E||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&O==="%"&&(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 ce[oe](Z,Z.exports,p),Z.exports}var ve=p(0);me=ve})();var be=me;U=[],N=function(){return{js_beautify:be}}.apply(at,U),N!==void 0&&(Wt.exports=N)})()},75918:function(Wt,at,U){"use strict";U.d(at,{Wi:function(){return p},Z0:function(){return ve},aU:function(){return G},eZ:function(){return l},wY:function(){return oe}});var N=U(4348),me=U(69323),be=U(13268),ce=function(Z,C,g,v){function E(A){return A instanceof g?A:new g(function(O){O(A)})}return new(g||(g=Promise))(function(A,O){function j(I){try{L(v.next(I))}catch(w){O(w)}}function V(I){try{L(v.throw(I))}catch(w){O(w)}}function L(I){I.done?A(I.value):E(I.value).then(j,V)}L((v=v.apply(Z,C||[])).next())})};class G extends me.JT{constructor(C,g="",v="",E=!0,A){super(),this._onDidChange=this._register(new N.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=C,this._label=g,this._cssClass=v,this._enabled=E,this._actionCallback=A}get id(){return this._id}get label(){return this._label}set label(C){this._setLabel(C)}_setLabel(C){this._label!==C&&(this._label=C,this._onDidChange.fire({label:C}))}get tooltip(){return this._tooltip||""}set tooltip(C){this._setTooltip(C)}_setTooltip(C){this._tooltip!==C&&(this._tooltip=C,this._onDidChange.fire({tooltip:C}))}get class(){return this._cssClass}set class(C){this._setClass(C)}_setClass(C){this._cssClass!==C&&(this._cssClass=C,this._onDidChange.fire({class:C}))}get enabled(){return this._enabled}set enabled(C){this._setEnabled(C)}_setEnabled(C){this._enabled!==C&&(this._enabled=C,this._onDidChange.fire({enabled:C}))}get checked(){return this._checked}set checked(C){this._setChecked(C)}_setChecked(C){this._checked!==C&&(this._checked=C,this._onDidChange.fire({checked:C}))}run(C,g){return ce(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(C))})}}class p extends me.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new N.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new N.Q5),this.onDidRun=this._onDidRun.event}run(C,g){return ce(this,void 0,void 0,function*(){if(!C.enabled)return;this._onBeforeRun.fire({action:C});let v;try{yield this.runAction(C,g)}catch(E){v=E}this._onDidRun.fire({action:C,error:v})})}runAction(C,g){return ce(this,void 0,void 0,function*(){yield C.run(g)})}}class ve extends G{constructor(C){super(ve.ID,C,C?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ve.ID="vs.actions.separator";class oe{constructor(C,g,v,E){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=C,this.label=g,this.class=E,this._actions=v}get actions(){return this._actions}dispose(){}run(){return ce(this,void 0,void 0,function*(){})}}class l extends G{constructor(){super(l.ID,be.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(Wt,at,U){"use strict";U.d(at,{ok:function(){return N}});function N(me,be){if(!me)throw new Error(be?`Assertion failed (${be})`:"Assertion Failed")}},52615:function(Wt,at,U){"use strict";U.d(at,{CM:function(){return G},JL:function(){return p},dT:function(){return oe},fK:function(){return ce},lA:function(){return ve}});var N=U(4348);class me{constructor(){this._icons=new Map,this._onDidRegister=new N.Q5}add(Z){const C=this._icons.get(Z.id);C?Z.description?C.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 be=new me,ce=be;function G(l,Z){return new ve(l,Z)}function p(l){return l?l.replace(/\$\((.*?)\)/g,(Z,C)=>` ${C} `).trim():""}class ve{constructor(Z,C,g){this.id=Z,this.definition=C,this.description=g,be.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 C(E){if(E instanceof ve)return["codicon","codicon-"+E.id];const A=Z.exec(E.id);if(!A)return C(ve.error);let[,O,j]=A;const V=["codicon","codicon-"+O];return j&&V.push("codicon-modifier-"+j.substr(1)),V}l.asClassNameArray=C;function g(E){return C(E).join(" ")}l.asClassName=g;function v(E){return"."+C(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(Wt,at,U){"use strict";U.d(at,{B8:function(){return C},Cp:function(){return ce},F0:function(){return oe},L6:function(){return Z},VV:function(){return ve},b1:function(){return l},dL:function(){return be},ri:function(){return G}});class N{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 me=new N;function be(g){ve(g)||me.onUnexpectedError(g)}function ce(g){ve(g)||me.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 C extends Error{constructor(v){super("NotSupported"),v&&(this.message=v)}}},4348:function(Wt,at,U){"use strict";U.d(at,{D0:function(){return C},E7:function(){return g},K3:function(){return Z},Q5:function(){return l},ZD:function(){return v},ju:function(){return G}});var N=U(79881),me=U(69323),be=U(34502),ce=U(95830),G;(function(E){E.None=()=>me.JT.None;function A(M){return(P,ae=null,te)=>{let S=!1,b;return b=M(K=>{if(!S)return b?b.dispose():S=!0,P.call(ae,K)},null,te),S&&b.dispose(),b}}E.once=A;function O(M,P){return R((ae,te=null,S)=>M(b=>ae.call(te,P(b)),null,S))}E.map=O;function j(M,P){return R((ae,te=null,S)=>M(b=>{P(b),ae.call(te,b)},null,S))}E.forEach=j;function V(M,P){return R((ae,te=null,S)=>M(b=>P(b)&&ae.call(te,b),null,S))}E.filter=V;function L(M){return M}E.signal=L;function I(...M){return(P,ae=null,te)=>(0,me.F8)(...M.map(S=>S(b=>P.call(ae,b),null,te)))}E.any=I;function w(M,P,ae){let te=ae;return O(M,S=>(te=P(te,S),te))}E.reduce=w;function R(M){let P;const ae=new l({onFirstListenerAdd(){P=M(ae.fire,ae)},onLastListenerRemove(){P.dispose()}});return ae.event}function z(M,P,ae=100,te=!1,S){let b,K,le,Ee=0;const Fe=new l({leakWarningThreshold:S,onFirstListenerAdd(){b=M(et=>{Ee++,K=P(K,et),te&&!le&&(Fe.fire(K),K=void 0),clearTimeout(le),le=setTimeout(()=>{const Et=K;K=void 0,le=void 0,(!te||Ee>1)&&Fe.fire(Et),Ee=0},ae)})},onLastListenerRemove(){b.dispose()}});return Fe.event}E.debounce=z;function ne(M,P=(ae,te)=>ae===te){let ae=!0,te;return V(M,S=>{const b=ae||!P(S,te);return ae=!1,te=S,b})}E.latch=ne;function ie(M,P){return[E.filter(M,P),E.filter(M,ae=>!P(ae))]}E.split=ie;function ye(M,P=!1,ae=[]){let te=ae.slice(),S=M(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=M(le=>K.fire(le)))},onFirstListenerDidAdd(){te&&(P?setTimeout(b):b())},onLastListenerRemove(){S&&S.dispose(),S=null}});return K.event}E.buffer=ye;class De{constructor(P){this.event=P}map(P){return new De(O(this.event,P))}forEach(P){return new De(j(this.event,P))}filter(P){return new De(V(this.event,P))}reduce(P,ae){return new De(w(this.event,P,ae))}latch(){return new De(ne(this.event))}debounce(P,ae=100,te=!1,S){return new De(z(this.event,P,ae,te,S))}on(P,ae,te){return this.event(P,ae,te)}once(P,ae,te){return A(this.event)(P,ae,te)}}function xe(M){return new De(M)}E.chain=xe;function $e(M,P,ae=te=>te){const te=(...le)=>K.fire(ae(...le)),S=()=>M.on(P,te),b=()=>M.removeListener(P,te),K=new l({onFirstListenerAdd:S,onLastListenerRemove:b});return K.event}E.fromNodeEventEmitter=$e;function J(M,P,ae=te=>te){const te=(...le)=>K.fire(ae(...le)),S=()=>M.addEventListener(P,te),b=()=>M.removeEventListener(P,te),K=new l({onFirstListenerAdd:S,onLastListenerRemove:b});return K.event}E.fromDOMEventEmitter=J;function D(M){return new Promise(P=>A(M)(P))}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 ce.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,O=Math.random().toString(18).slice(2,5)){this.customThreshold=A,this.name=O,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(A){let O=ve;if(typeof this.customThreshold=="number"&&(O=this.customThreshold),O<=0||A<O)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=O*.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 O;this._disposed=!1,this._options=A,this._leakageMon=ve>0?new oe(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((O=this._options)===null||O===void 0)&&O._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(A,O,j)=>{var V;this._listeners||(this._listeners=new be.S);const L=this._listeners.isEmpty();L&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const I=this._listeners.push(O?[A,O]:A);L&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,A,O);const w=(V=this._leakageMon)===null||V===void 0?void 0:V.check(this._listeners.size),R=(0,me.OF)(()=>{w&&w(),this._disposed||(I(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return j instanceof me.SL?j.add(R):Array.isArray(j)&&j.push(R),R}),this._event}fire(A){var O,j;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new be.S);for(let V of this._listeners)this._deliveryQueue.push([V,A]);for((O=this._perfMon)===null||O===void 0||O.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,N.dL)(I)}}(j=this._perfMon)===null||j===void 0||j.stop()}}dispose(){var A,O,j,V,L;this._disposed||(this._disposed=!0,(A=this._listeners)===null||A===void 0||A.clear(),(O=this._deliveryQueue)===null||O===void 0||O.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 be.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 C extends Z{constructor(A){var O;super(A),this._delay=(O=A.delay)!==null&&O!==void 0?O: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(O,j,V)=>A(L=>{const I=this.buffers[this.buffers.length-1];I?I.push(()=>O.call(j,L)):O.call(j,L)},void 0,V)}bufferEvents(A){const O=[];this.buffers.push(O);const j=A();return this.buffers.pop(),O.forEach(V=>V()),j}}class v{constructor(){this.listening=!1,this.inputEvent=G.None,this.inputEventListener=me.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(Wt,at,U){"use strict";U.d(at,{I:function(){return N}});function N(me){const be=this;let ce=!1,G;return function(){return ce||(ce=!0,G=me.apply(be,arguments)),G}}},88226:function(Wt,at,U){"use strict";U.d(at,{$:function(){return N}});var N;(function(me){function be(I){return I&&typeof I=="object"&&typeof I[Symbol.iterator]=="function"}me.is=be;const ce=Object.freeze([]);function G(){return ce}me.empty=G;function*p(I){yield I}me.single=p;function ve(I){return I||ce}me.from=ve;function oe(I){return!I||I[Symbol.iterator]().next().done===!0}me.isEmpty=oe;function l(I){return I[Symbol.iterator]().next().value}me.first=l;function Z(I,w){for(const R of I)if(w(R))return!0;return!1}me.some=Z;function C(I,w){for(const R of I)if(w(R))return R}me.find=C;function*g(I,w){for(const R of I)w(R)&&(yield R)}me.filter=g;function*v(I,w){let R=0;for(const z of I)yield w(z,R++)}me.map=v;function*E(...I){for(const w of I)for(const R of w)yield R}me.concat=E;function*A(I){for(const w of I)for(const R of w)yield R}me.concatNested=A;function O(I,w,R){let z=R;for(const ne of I)z=w(z,ne);return z}me.reduce=O;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]}me.slice=j;function V(I,w=Number.POSITIVE_INFINITY){const R=[];if(w===0)return[R,I];const z=I[Symbol.iterator]();for(let ne=0;ne<w;ne++){const ie=z.next();if(ie.done)return[R,me.empty()];R.push(ie.value)}return[R,{[Symbol.iterator](){return z}}]}me.consume=V;function L(I,w,R=(z,ne)=>z===ne){const z=I[Symbol.iterator](),ne=w[Symbol.iterator]();for(;;){const ie=z.next(),ye=ne.next();if(ie.done!==ye.done)return!1;if(ie.done)return!0;if(!R(ie.value,ye.value))return!1}}me.equals=L})(N||(N={}))},69323:function(Wt,at,U){"use strict";U.d(at,{B9:function(){return v},F8:function(){return E},JT:function(){return j},Jz:function(){return L},OF:function(){return A},SL:function(){return O},Wf:function(){return g},XK:function(){return V},dk:function(){return Z}});var N=U(17845),me=U(88226);const be=!1;let ce=null;function G(I){ce=I}if(be){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(z){}}markAsDisposed(w){if(w&&w!==j.None)try{w[I]=!0}catch(R){}}markAsSingleton(w){}})}function p(I){return ce==null||ce.trackDisposable(I),I}function ve(I){ce==null||ce.markAsDisposed(I)}function oe(I,w){ce==null||ce.setParent(I,w)}function l(I,w){if(ce)for(const R of I)ce.setParent(R,w)}function Z(I){return ce==null||ce.markAsSingleton(I),I}class C 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(me.$.is(I)){let w=[];for(const R of I)if(R)try{R.dispose()}catch(z){w.push(z)}if(w.length===1)throw w[0];if(w.length>1)throw new C(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,N.I)(()=>{ve(w),I()})});return w}class O{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?O.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}}O.DISABLE_DISPOSED_WARNING=!1;class j{constructor(){this._store=new O,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(Wt,at,U){"use strict";U.d(at,{S:function(){return me}});class N{constructor(ce){this.element=ce,this.next=N.Undefined,this.prev=N.Undefined}}N.Undefined=new N(void 0);class me{constructor(){this._first=N.Undefined,this._last=N.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===N.Undefined}clear(){let ce=this._first;for(;ce!==N.Undefined;){const G=ce.next;ce.prev=N.Undefined,ce.next=N.Undefined,ce=G}this._first=N.Undefined,this._last=N.Undefined,this._size=0}unshift(ce){return this._insert(ce,!1)}push(ce){return this._insert(ce,!0)}_insert(ce,G){const p=new N(ce);if(this._first===N.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!==N.Undefined){const ce=this._first.element;return this._remove(this._first),ce}}pop(){if(this._last!==N.Undefined){const ce=this._last.element;return this._remove(this._last),ce}}_remove(ce){if(ce.prev!==N.Undefined&&ce.next!==N.Undefined){const G=ce.prev;G.next=ce.next,ce.next.prev=G}else ce.prev===N.Undefined&&ce.next===N.Undefined?(this._first=N.Undefined,this._last=N.Undefined):ce.next===N.Undefined?(this._last=this._last.prev,this._last.next=N.Undefined):ce.prev===N.Undefined&&(this._first=this._first.next,this._first.prev=N.Undefined);this._size-=1}*[Symbol.iterator](){let ce=this._first;for(;ce!==N.Undefined;)yield ce.element,ce=ce.next}}},23345:function(Wt,at,U){"use strict";U.d(at,{$L:function(){return z},ED:function(){return L},IJ:function(){return w},OS:function(){return De},WE:function(){return ie},dz:function(){return I},gn:function(){return ne},li:function(){return A},r:function(){return J},tY:function(){return R},xS:function(){return ye}});var N=U(97671),me;const be="en";let ce=!1,G=!1,p=!1,ve=!1,oe=!1,l=!1,Z=!1,C,g=null,v=null,E;const A=typeof self=="object"?self:typeof U.g=="object"?U.g:{};let O;typeof A.vscode!="undefined"&&typeof A.vscode.process!="undefined"?O=A.vscode.process:typeof N!="undefined"&&(O=N);const j=typeof((me=O==null?void 0:O.versions)===null||me===void 0?void 0:me.electron)=="string"&&O.type==="renderer";if(typeof navigator=="object"&&!j)E=navigator.userAgent,ce=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,C=navigator.language,g=C;else if(typeof O=="object"){ce=O.platform==="win32",G=O.platform==="darwin",p=O.platform==="linux",ve=p&&!!O.env.SNAP&&!!O.env.SNAP_REVISION,C=be,g=be;const D=O.env.VSCODE_NLS_CONFIG;if(D)try{const M=JSON.parse(D),P=M.availableLanguages["*"];C=M.locale,g=P||be,v=M._translationsConfigFile}catch(M){}oe=!0}else console.error("Unable to resolve platform.");let V=0;G?V=1:ce?V=3:p&&(V=2);const L=ce,I=G,w=p,R=oe,z=l,ne=Z,ie=E,ye=function(){if(A.setImmediate)return A.setImmediate.bind(A);if(typeof A.postMessage=="function"&&!A.importScripts){let P=[];A.addEventListener("message",te=>{if(te.data&&te.data.vscodeSetImmediateId)for(let S=0,b=P.length;S<b;S++){const K=P[S];if(K.id===te.data.vscodeSetImmediateId){P.splice(S,1),K.callback();return}}});let ae=0;return te=>{const S=++ae;P.push({id:S,callback:te}),A.postMessage({vscodeSetImmediateId:S},"*")}}if(typeof(O==null?void 0:O.nextTick)=="function")return O.nextTick.bind(O);const M=Promise.resolve();return P=>M.then(P)}(),De=G||Z?2:ce?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(Wt,at,U){"use strict";U.d(at,{G:function(){return be}});var N=U(23345);const me=N.li.performance&&typeof N.li.performance.now=="function";class be{constructor(G){this._highResolution=me&&G,this._startTime=this._now(),this._stopTime=-1}static create(G=!0){return new be(G)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?N.li.performance.now():Date.now()}}},82983:function(Wt,at,U){"use strict";U.d(at,{$i:function(){return Ee},C8:function(){return Jt},GF:function(){return C},HO:function(){return ae},IO:function(){return g},K7:function(){return It},Kw:function(){return Ye},LC:function(){return A},Mh:function(){return ye},P1:function(){return De},PJ:function(){return gt},Qe:function(){return Fe},R1:function(){return Z},RP:function(){return K},S6:function(){return Je},TT:function(){return L},Ut:function(){return S},V8:function(){return O},WU:function(){return be},YK:function(){return $e},YU:function(){return ce},ZG:function(){return xe},ZH:function(){return D},ab:function(){return et},c1:function(){return Qe},df:function(){return z},ec:function(){return G},fi:function(){return Me},fy:function(){return p},j3:function(){return ve},j_:function(){return w},m5:function(){return N},mK:function(){return R},mr:function(){return v},oH:function(){return ee},oL:function(){return oe},ok:function(){return ie},ow:function(){return j},qq:function(){return ne},qu:function(){return V},rL:function(){return J},uS:function(){return kt},un:function(){return l},uq:function(){return E},vH:function(){return P},xe:function(){return Et},zY:function(){return I}});function N(W){return!W||typeof W!="string"?!0:W.trim().length===0}const me=/{(\d+)}/g;function be(W,...Y){return Y.length===0?W:W.replace(me,function(re,X){const $=parseInt(X,10);return isNaN($)||$<0||$>=Y.length?re:Y[$]})}function ce(W){return W.replace(/[<>&]/g,function(Y){switch(Y){case"<":return"<";case">":return">";case"&":return"&";default:return Y}})}function G(W){return W.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(W,Y=" "){const re=ve(W,Y);return oe(re,Y)}function ve(W,Y){if(!W||!Y)return W;const re=Y.length;if(re===0||W.length===0)return W;let X=0;for(;W.indexOf(Y,X)===X;)X=X+re;return W.substring(X)}function oe(W,Y){if(!W||!Y)return W;const re=Y.length,X=W.length;if(re===0||X===0)return W;let $=X,Q=-1;for(;Q=W.lastIndexOf(Y,$-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 C(W,Y,re={}){if(!W)throw new Error("Cannot create regex from empty string");Y||(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 Y=0,re=W.length;Y<re;Y++){const X=W.charCodeAt(Y);if(X!==32&&X!==9)return Y}return-1}function O(W,Y=0,re=W.length){for(let X=Y;X<re;X++){const $=W.charCodeAt(X);if($!==32&&$!==9)return W.substring(Y,X)}return W.substring(Y,re)}function j(W,Y=W.length-1){for(let re=Y;re>=0;re--){const X=W.charCodeAt(re);if(X!==32&&X!==9)return re}return-1}function V(W,Y){return W<Y?-1:W>Y?1:0}function L(W,Y,re=0,X=W.length,$=0,Q=Y.length){for(;re<X&&$<Q;re++,$++){let Ae=W.charCodeAt(re),Xe=Y.charCodeAt($);if(Ae<Xe)return-1;if(Ae>Xe)return 1}const he=X-re,pe=Q-$;return he<pe?-1:he>pe?1:0}function I(W,Y){return w(W,Y,0,W.length,0,Y.length)}function w(W,Y,re=0,X=W.length,$=0,Q=Y.length){for(;re<X&&$<Q;re++,$++){let Ae=W.charCodeAt(re),Xe=Y.charCodeAt($);if(Ae===Xe)continue;if(Ae>=128||Xe>=128)return L(W.toLowerCase(),Y.toLowerCase(),re,X,$,Q);R(Ae)&&(Ae-=32),R(Xe)&&(Xe-=32);const We=Ae-Xe;if(We!==0)return We}const he=X-re,pe=Q-$;return he<pe?-1:he>pe?1:0}function R(W){return W>=97&&W<=122}function z(W){return W>=65&&W<=90}function ne(W,Y){return W.length===Y.length&&w(W,Y)===0}function ie(W,Y){const re=Y.length;return Y.length>W.length?!1:w(W,Y,0,re)===0}function ye(W,Y){let re,X=Math.min(W.length,Y.length);for(re=0;re<X;re++)if(W.charCodeAt(re)!==Y.charCodeAt(re))return re;return X}function De(W,Y){let re,X=Math.min(W.length,Y.length);const $=W.length-1,Q=Y.length-1;for(re=0;re<X;re++)if(W.charCodeAt($-re)!==Y.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,Y){return(W-55296<<10)+(Y-56320)+65536}function D(W,Y,re){const X=W.charCodeAt(re);if(xe(X)&&re+1<Y){const $=W.charCodeAt(re+1);if($e($))return J(X,$)}return X}function M(W,Y){const re=W.charCodeAt(Y-1);if($e(re)&&Y>1){const X=W.charCodeAt(Y-2);if(xe(X))return J(X,re)}return re}function P(W,Y){const re=_e.getInstance(),X=Y,$=W.length,Q=D(W,$,Y);Y+=Q>=65536?2:1;let he=re.getGraphemeBreakType(Q);for(;Y<$;){const pe=D(W,$,Y),Ae=re.getGraphemeBreakType(pe);if(Me(he,Ae))break;Y+=pe>=65536?2:1,he=Ae}return Y-X}function ae(W,Y){const re=_e.getInstance(),X=Y,$=M(W,Y);Y-=$>=65536?2:1;let Q=re.getGraphemeBreakType($);for(;Y>0;){const he=M(W,Y),pe=re.getGraphemeBreakType(he);if(Me(pe,Q))break;Y-=he>=65536?2:1,Q=pe}return X-Y}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 Fe=/[\u2028\u2029]/;function et(W){return Fe.test(W)}function Et(W){for(let Y=0,re=W.length;Y<re;Y++)if(It(W.charCodeAt(Y)))return!0;return!1}function It(W){return W=+W,W>=11904&&W<=55215||W>=63744&&W<=64255||W>=65281&&W<=65374}function Jt(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 Qe="\uFEFF";function kt(W){return!!(W&&W.length>0&&W.charCodeAt(0)===65279)}function Ye(W,Y=!1){return W?(Y&&(W=W.replace(/\\./g,"")),W.toLowerCase()!==W):!1}function gt(W){return W=W%(2*26),W<26?String.fromCharCode(97+W):String.fromCharCode(65+W-26)}function Je(W){return _e.getInstance().getGraphemeBreakType(W)}function Me(W,Y){return W===0?Y!==5&&Y!==7:W===2&&Y===3?!1:W===4||W===2||W===3||Y===4||Y===2||Y===3?!0:!(W===8&&(Y===8||Y===9||Y===11||Y===12)||(W===11||W===9)&&(Y===9||Y===10)||(W===12||W===10)&&Y===10||Y===5||Y===13||Y===7||W===1||W===13&&Y===14||W===6&&Y===6)}class _e{constructor(){this._data=Re()}static getInstance(){return _e._INSTANCE||(_e._INSTANCE=new _e),_e._INSTANCE}getGraphemeBreakType(Y){if(Y<32)return Y===10?3:Y===13?2:4;if(Y<127)return 0;const re=this._data,X=re.length/3;let $=1;for(;$<=X;)if(Y<re[3*$])$=2*$;else if(Y>re[3*$+1])$=2*$+1;else return re[3*$+2];return 0}}_e._INSTANCE=null;function Re(){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,Y){if(W===0)return 0;const re=Le(W,Y);if(re!==void 0)return re;const X=M(Y,W);return W-=we(X),W}function Le(W,Y){let re=M(Y,W);for(W-=we(re);q(re)||re===65039||re===8419;){if(W===0)return;re=M(Y,W),W-=we(re)}if(Jt(re)){if(W>=0){const X=M(Y,W);X===8205&&(W-=we(X))}return W}}function we(W){return W>=65536?2:1}function q(W){return 127995<=W&&W<=127999}},72999:function(Wt,at,U){"use strict";U.d(at,{$E:function(){return A},$K:function(){return ve},D8:function(){return g},HD:function(){return me},IU:function(){return O},Jp:function(){return oe},Kn:function(){return be},cW:function(){return Z},f6:function(){return j},hj:function(){return ce},jn:function(){return G},kJ:function(){return N},mf:function(){return C},o8:function(){return p},p_:function(){return l},vE:function(){return V}});function N(L){return Array.isArray(L)}function me(L){return typeof L=="string"}function be(L){return typeof L=="object"&&L!==null&&!Array.isArray(L)&&!(L instanceof RegExp)&&!(L instanceof Date)}function ce(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 C(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(me(I)){if(typeof L!==I)throw new Error(`argument does not match constraint: typeof ${I}`)}else if(C(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 O(L,I){const w=z=>function(){const ne=Array.prototype.slice.call(arguments,0);return I(z,ne)};let R={};for(const z of L)R[z]=w(z);return R}function j(L){return L===null?void 0:L}function V(L,I="Unreachable"){throw new Error(I)}},13268:function(Wt,at,U){"use strict";U.d(at,{N:function(){return me}});function N(be,ce){let G;return ce.length===0?G=be:G=be.replace(/\{(\d+)\}/g,function(p,ve){const oe=ve[0];return typeof ce[oe]!="undefined"?ce[oe]:p}),G}function me(be,ce,...G){return N(ce,G)}},96236:function(Wt,at,U){"use strict";U.d(at,{BH:function(){return O},NZ:function(){return j},U8:function(){return V},co:function(){return A},eH:function(){return E},vr:function(){return v}});var N=U(75918),me=U(52615),be=U(4348),ce=U(88226),G=U(69323),p=U(34502),ve=U(35884),oe=U(90689),l=U(16925),Z=U(49055),C=function(L,I,w,R){var z=arguments.length,ne=z<3?I:R===null?R=Object.getOwnPropertyDescriptor(I,w):R,ie;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ne=Reflect.decorate(L,I,w,R);else for(var ye=L.length-1;ye>=0;ye--)(ie=L[ye])&&(ne=(z<3?ie(ne):z>3?ie(I,w,ne):ie(I,w))||ne);return z>3&&ne&&Object.defineProperty(I,w,ne),ne},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"),O=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new be.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:L=>L===E.CommandPalette}}addCommand(L){return this.addCommands(ce.$.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(ce.$.single({id:L,item:I}))}appendMenuItems(L){const I=new Set,w=new p.S;for(const{id:R,item:z}of L){let ne=this._menuItems.get(R);ne||(ne=new p.S,this._menuItems.set(R,ne)),w.push(ne.push(z)),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 N.wY{constructor(I,w,R,z){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=z}get actions(){const I=[],w=this._menuService.createMenu(this.item.submenu,this._contextKeyService),R=w.getActions(this._options);w.dispose();for(const[,z]of R)z.length>0&&(I.push(...z),I.push(new N.Z0));return I.length&&I.pop(),I}}let V=class Tl{constructor(I,w,R,z,ne){var ie,ye;if(this._commandService=ne,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:(ie=I.tooltip)===null||ie===void 0?void 0:ie.value)!==null&&ye!==void 0?ye:"",this.enabled=!I.precondition||z.contextMatchesRules(I.precondition),this.checked=void 0,I.toggled){const De=I.toggled.condition?I.toggled:{condition:I.toggled};this.checked=z.contextMatchesRules(De.condition),this.checked&&De.tooltip&&(this.tooltip=typeof De.tooltip=="string"?De.tooltip:De.tooltip.value),De.title&&(this.label=typeof De.title=="string"?De.title:De.title.value)}this.item=I,this.alt=w?new Tl(w,void 0,R,z,ne):void 0,this._options=R,Z.kS.isThemeIcon(I.icon)&&(this.class=me.dT.asClassName(I.icon))}dispose(){}run(...I){var w,R;let z=[];return!((w=this._options)===null||w===void 0)&&w.arg&&(z=[...z,this._options.arg]),!((R=this._options)===null||R===void 0)&&R.shouldForwardArgs&&(z=[...z,...I]),this._commandService.executeCommand(this.id,...z)}};V=C([g(3,oe.i6),g(4,ve.H)],V)},35884:function(Wt,at,U){"use strict";U.d(at,{H:function(){return ve},P:function(){return oe}});var N=U(4348),me=U(88226),be=U(69323),ce=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 N.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 O=l.handler;l.handler=function(j,...V){return(0,G.D8)(V,A),O(j,...V)}}const{id:C}=l;let g=this._commands.get(C);g||(g=new ce.S,this._commands.set(C,g));let v=g.unshift(l),E=(0,be.OF)(()=>{v();const A=this._commands.get(C);A!=null&&A.isEmpty()&&this._commands.delete(C)});return this._onDidRegisterCommand.fire(C),E}registerCommandAlias(l,Z){return oe.registerCommand(l,(C,...g)=>C.get(ve).executeCommand(Z,...g))}getCommand(l){const Z=this._commands.get(l);if(!(!Z||Z.isEmpty()))return me.$.first(Z)}getCommands(){const l=new Map;for(const Z of this._commands.keys()){const C=this.getCommand(Z);C&&l.set(Z,C)}return l}};oe.registerCommand("noop",()=>{})},90689:function(Wt,at,U){"use strict";U.d(at,{Ao:function(){return ve},Eq:function(){return J},Fb:function(){return oe},K8:function(){return P},i6:function(){return $e},uy:function(){return xe}});var N=U(23345),me=U(82983),be=U(16925);let ce=N.WE||"";const G=new Map;G.set("false",!1),G.set("true",!0),G.set("isMac",N.dz),G.set("isLinux",N.IJ),G.set("isWindows",N.ED),G.set("isWeb",N.$L),G.set("isMacNative",N.dz&&!N.$L),G.set("isEdge",ce.indexOf("Edg/")>=0),G.set("isFirefox",ce.indexOf("Firefox")>=0),G.set("isChrome",ce.indexOf("Chrome")>=0),G.set("isSafari",ce.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 z.create(S,b)}static not(S){return j.create(S)}static and(...S){return ye.create(S,null)}static or(...S){return De.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 De.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 O.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 z.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,me.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),Fe=S[le+1]==="i"?"i":"";try{return new RegExp(Ee,Fe)}catch(et){if(b)throw new Error(`bad regexp-value '${S}', parse error: ${et}`);return console.warn(`bad regexp-value '${S}', parse error: ${et}`),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 C.INSTANCE}}Z.INSTANCE=new Z;class C{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}}C.INSTANCE=new C;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?C.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?C.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")?C.INSTANCE:Z.INSTANCE:new v(S,b,K)}cmp(S){return S.type!==this.type?this.type-S.type:M(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?C.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=O.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:M(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 O{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:C.INSTANCE:new O(S,b,K)}cmp(S){return S.type!==this.type?this.type-S.type:M(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:C.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:C.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:C.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:M(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:M(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:M(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:M(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 z{constructor(S,b){this.key=S,this.regexp=b,this.type=7,this.negated=null}static create(S,b){return new z(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=ne.create(this)),this.negated}}class ne{constructor(S){this._actual=S,this.type=8}static create(S){return new ne(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 ie(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=ie(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 C.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 Fe=K.pop(),et=K.length===0,Et=De.create(Ee.expr.map(It=>ye.create([It,Fe],null)),null,et);Et&&(K.push(Et),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=De.create(S,this,!0)}return this.negated}}class De{constructor(S,b){this.expr=S,this.negated=b,this.type=9}static create(S,b,K){return De._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=ie(this.expr);return S===this.expr?this:De.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 Fe=0,et=S.length;Fe<et;Fe++){const Et=S[Fe];if(Et){if(Et.type===0){Ee=!0;continue}if(Et.type===1)return C.INSTANCE;if(Et.type===9){le=le.concat(Et.expr);continue}le.push(Et)}}if(le.length===0&&Ee)return Z.INSTANCE;le.sort(l)}if(le.length!==0){if(le.length===1)return le[0];for(let Fe=1;Fe<le.length;Fe++)le[Fe-1].equals(le[Fe])&&(le.splice(Fe,1),Fe--);if(le.length===1)return le[0];if(K){for(let Fe=0;Fe<le.length;Fe++)for(let et=Fe+1;et<le.length;et++)P(le[Fe],le[et])&&(le.splice(et,1),et--);if(le.length===1)return le[0]}return new De(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 Fe of ae(b))for(const et of ae(K))le.push(ye.create([Fe,et],null));const Ee=S.length===0;S.unshift(De.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,be.yh)("contextKeyService"),J="setContext";function D(te,S){return te<S?-1:te>S?1:0}function M(te,S,b,K){return te<b?-1:te>b?1:S<K?-1:S>K?1:0}function P(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 Fe=K[le].negate();for(let et=le+1;et<K.length;et++){const Et=K[et];if(Fe.equals(Et))return!0}}return!1}function ae(te){return te.type===9?te.expr:[te]}},16925:function(Wt,at,U){"use strict";U.d(at,{I8:function(){return N},TG:function(){return me},jt:function(){return G},yh:function(){return ce}});var N;(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})(N||(N={}));const me=ce("instantiationService");function be(p,ve,oe,l){ve[N.DI_TARGET]===ve?ve[N.DI_DEPENDENCIES].push({id:p,index:oe,optional:l}):(ve[N.DI_DEPENDENCIES]=[{id:p,index:oe,optional:l}],ve[N.DI_TARGET]=ve)}function ce(p){if(N.serviceIds.has(p))return N.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");be(ve,oe,Z,!1)};return ve.toString=()=>p,N.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");be(p,ve,l,!0)}}},44650:function(Wt,at,U){"use strict";U.d(at,{B:function(){return ce}});var N=U(76068),me=U(72999);class be{constructor(){this.data=new Map}add(p,ve){N.ok(me.HD(p)),N.ok(me.Kn(ve)),N.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 ce=new be},66213:function(Wt,at,U){"use strict";U.d(at,{e:function(){return N}});var N;(function(me){me.DARK="dark",me.LIGHT="light",me.HIGH_CONTRAST="hc"})(N||(N={}))},49055:function(Wt,at,U){"use strict";U.d(at,{EN:function(){return l},IP:function(){return g},Ic:function(){return A},XE:function(){return ve},bB:function(){return O},kS:function(){return Z},m6:function(){return C}});var N=U(52615),me=U(4348),be=U(69323),ce=U(16925),G=U(44650),p=U(66213);const ve=(0,ce.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(ne){return ne&&typeof ne=="object"&&typeof ne.id=="string"&&(typeof ne.color=="undefined"||oe.isThemeColor(ne.color))}j.isThemeIcon=V;const L=new RegExp(`^\\$\\((${N.dT.iconNameExpression}(?:${N.dT.iconModifierExpression})?)\\)$`);function I(ne){const ie=L.exec(ne);if(!ie)return;let[,ye]=ie;return{id:ye}}j.fromString=I;function w(ne,ie){let ye=ne.id;const De=ye.lastIndexOf("~");return De!==-1&&(ye=ye.substring(0,De)),ie&&(ye=`${ye}~${ie}`),{id:ye}}j.modify=w;function R(ne,ie){var ye,De;return ne.id===ie.id&&((ye=ne.color)===null||ye===void 0?void 0:ye.id)===((De=ie.color)===null||De===void 0?void 0:De.id)}j.isEqual=R;function z(ne,ie){return{id:ne.id,color:ie?l(ie):void 0}}j.asThemeIcon=z,j.asClassNameArray=N.dT.asClassNameArray,j.asClassName=N.dT.asClassName,j.asCSSSelector=N.dT.asCSSSelector})(Z||(Z={}));function C(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 me.Q5}onColorThemeChange(V){return this.themingParticipants.push(V),this.onThemingParticipantAddedEmitter.fire(V),(0,be.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 O extends be.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(Wt,at,U){"use strict";U.d(at,{Z:function(){return ne}});var N=U(54476),me=U(20068),be=U(42978),ce=U(75931),G=U(65030),p=U(92310),ve=U.n(p),oe=U(8654),l=U(59301),Z=U(10228),C=U(16089),g=Z.Z.ESC,v=Z.Z.TAB;function E(ie){var ye=ie.visible,De=ie.triggerRef,xe=ie.onVisibleChange,$e=ie.autoFocus,J=ie.overlayRef,D=l.useRef(!1),M=function(){if(ye){var S,b;(S=De.current)===null||S===void 0||(b=S.focus)===null||b===void 0||b.call(S),xe==null||xe(!1)}},P=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:M();break;case v:{var b=!1;D.current||(b=P()),b?S.preventDefault():M();break}}};l.useEffect(function(){return ye?(window.addEventListener("keydown",ae),$e&&(0,C.Z)(P,3),function(){window.removeEventListener("keydown",ae),D.current=!1}):function(){D.current=!1}},[ye])}var A=(0,l.forwardRef)(function(ie,ye){var De=ie.overlay,xe=ie.arrow,$e=ie.prefixCls,J=(0,l.useMemo)(function(){var M;return typeof De=="function"?M=De():M=De,M},[De]),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}))}),O=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(ie,ye){var De,xe=ie.arrow,$e=xe===void 0?!1:xe,J=ie.prefixCls,D=J===void 0?"rc-dropdown":J,M=ie.transitionName,P=ie.animation,ae=ie.align,te=ie.placement,S=te===void 0?"bottomLeft":te,b=ie.placements,K=b===void 0?I:b,le=ie.getPopupContainer,Ee=ie.showAction,Fe=ie.hideAction,et=ie.overlayClassName,Et=ie.overlayStyle,It=ie.visible,Jt=ie.trigger,Qe=Jt===void 0?["hover"]:Jt,kt=ie.autoFocus,Ye=ie.overlay,gt=ie.children,Je=ie.onVisibleChange,Me=(0,ce.Z)(ie,w),_e=l.useState(),Re=(0,be.Z)(_e,2),ee=Re[0],Le=Re[1],we="visible"in ie?It:ee,q=l.useRef(null),W=l.useRef(null),Y=l.useRef(null);l.useImperativeHandle(ye,function(){return q.current});var re=function(ze){Le(ze),Je==null||Je(ze)};E({visible:we,triggerRef:Y,onVisibleChange:re,autoFocus:kt,overlayRef:W});var X=function(ze){var Ke=ie.onOverlayClick;Le(!1),Ke&&Ke(ze)},$=function(){return l.createElement(O,{ref:W,overlay:Ye,prefixCls:D,arrow:$e})},Q=function(){return typeof Ye=="function"?$:$()},he=function(){var ze=ie.minOverlayWidthMatchTrigger,Ke=ie.alignPoint;return"minOverlayWidthMatchTrigger"in ie?ze:!Ke},pe=function(){var ze=ie.openClassName;return ze!==void 0?ze:"".concat(D,"-open")},Ae=l.cloneElement(gt,{className:ve()((De=gt.props)===null||De===void 0?void 0:De.className,we&&pe()),ref:(0,oe.Yr)(gt)?(0,oe.sQ)(Y,(0,oe.C4)(gt)):void 0}),Xe=Fe;return!Xe&&Qe.indexOf("contextMenu")!==-1&&(Xe=["click"]),l.createElement(G.Z,(0,N.Z)({builtinPlacements:K},Me,{prefixCls:D,ref:q,popupClassName:ve()(et,(0,me.Z)({},"".concat(D,"-show-arrow"),$e)),popupStyle:Et,action:Qe,showAction:Ee,hideAction:Xe,popupPlacement:S,popupAlign:ae,popupTransitionName:M,popupAnimation:P,popupVisible:we,stretch:he()?"minWidth":"",popup:Q(),onPopupVisibleChange:re,onPopupClick:X,getPopupContainer:le}),Ae)}var z=l.forwardRef(R),ne=z},28321:function(Wt,at,U){"use strict";U.d(at,{iz:function(){return Ot},ck:function(){return ut},BW:function(){return ht},sN:function(){return ut},Wd:function(){return lt},ZP:function(){return mi},Xl:function(){return De}});var N=U(54476),me=U(20068),be=U(33885),ce=U(94480),G=U(42978),p=U(75931),ve=U(92310),oe=U.n(ve),l=U(83836),Z=U(18929),C=U(13697),g=U(48736),v=U(59301),E=U(4676),A=v.createContext(null);function O(Te,Pe){return Te===void 0?null:"".concat(Te,"-").concat(Pe)}function j(Te){var Pe=v.useContext(A);return O(Pe,Te)}var V=U(80547),L=["children","locked"],I=v.createContext(null);function w(Te,Pe){var rt=(0,be.Z)({},Te);return Object.keys(Pe).forEach(function(qe){var Ge=Pe[qe];Ge!==void 0&&(rt[qe]=Ge)}),rt}function R(Te){var Pe=Te.children,rt=Te.locked,qe=(0,p.Z)(Te,L),Ge=v.useContext(I),tt=(0,V.Z)(function(){return w(Ge,qe)},[Ge,qe],function(pt,Ct){return!rt&&(pt[0]!==Ct[0]||!(0,C.Z)(pt[1],Ct[1],!0))});return v.createElement(I.Provider,{value:tt},Pe)}var z=[],ne=v.createContext(null);function ie(){return v.useContext(ne)}var ye=v.createContext(z);function De(Te){var Pe=v.useContext(ye);return v.useMemo(function(){return Te!==void 0?[].concat((0,ce.Z)(Pe),[Te]):Pe},[Pe,Te])}var xe=v.createContext(null),$e=v.createContext({}),J=$e,D=U(29194);function M(Te){var Pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,D.Z)(Te)){var rt=Te.nodeName.toLowerCase(),qe=["input","select","textarea","button"].includes(rt)||Te.isContentEditable||rt==="a"&&!!Te.getAttribute("href"),Ge=Te.getAttribute("tabindex"),tt=Number(Ge),pt=null;return Ge&&!Number.isNaN(tt)?pt=tt:qe&&pt===null&&(pt=0),qe&&Te.disabled&&(pt=null),pt!==null&&(pt>=0||Pe&&pt<0)}return!1}function P(Te){var Pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,rt=(0,ce.Z)(Te.querySelectorAll("*")).filter(function(qe){return M(qe,Pe)});return M(Te,Pe)&&rt.unshift(Te),rt}var ae=null;function te(){ae=document.activeElement}function S(){ae=null}function b(){if(ae)try{ae.focus()}catch(Te){}}function K(Te,Pe){if(Pe.keyCode===9){var rt=P(Te),qe=rt[Pe.shiftKey?0:rt.length-1],Ge=qe===document.activeElement||Te===document.activeElement;if(Ge){var tt=rt[Pe.shiftKey?rt.length-1:0];tt.focus(),Pe.preventDefault()}}}var le=U(10228),Ee=U(16089),Fe=le.Z.LEFT,et=le.Z.RIGHT,Et=le.Z.UP,It=le.Z.DOWN,Jt=le.Z.ENTER,Qe=le.Z.ESC,kt=le.Z.HOME,Ye=le.Z.END,gt=[Et,It,Fe,et];function Je(Te,Pe,rt,qe){var Ge,tt="prev",pt="next",Ct="children",ui="parent";if(Te==="inline"&&qe===Jt)return{inlineTrigger:!0};var qt=(0,me.Z)((0,me.Z)({},Et,tt),It,pt),Si=(0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)({},Fe,rt?pt:tt),et,rt?tt:pt),It,Ct),Jt,Ct),ai=(0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)({},Et,tt),It,pt),Jt,Ct),Qe,ui),Fe,rt?Ct:ui),et,rt?ui:Ct),gi={inline:qt,horizontal:Si,vertical:ai,inlineSub:qt,horizontalSub:ai,verticalSub:ai},bi=(Ge=gi["".concat(Te).concat(Pe?"":"Sub")])===null||Ge===void 0?void 0:Ge[qe];switch(bi){case tt:return{offset:-1,sibling:!0};case pt:return{offset:1,sibling:!0};case ui:return{offset:-1,sibling:!1};case Ct:return{offset:1,sibling:!1};default:return null}}function Me(Te){for(var Pe=Te;Pe;){if(Pe.getAttribute("data-menu-list"))return Pe;Pe=Pe.parentElement}return null}function _e(Te,Pe){for(var rt=Te||document.activeElement;rt;){if(Pe.has(rt))return rt;rt=rt.parentElement}return null}function Re(Te,Pe){var rt=P(Te,!0);return rt.filter(function(qe){return Pe.has(qe)})}function ee(Te,Pe,rt){var qe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Te)return null;var Ge=Re(Te,Pe),tt=Ge.length,pt=Ge.findIndex(function(Ct){return rt===Ct});return qe<0?pt===-1?pt=tt-1:pt-=1:qe>0&&(pt+=1),pt=(pt+tt)%tt,Ge[pt]}var Le=function(Pe,rt){var qe=new Set,Ge=new Map,tt=new Map;return Pe.forEach(function(pt){var Ct=document.querySelector("[data-menu-id='".concat(O(rt,pt),"']"));Ct&&(qe.add(Ct),tt.set(Ct,pt),Ge.set(pt,Ct))}),{elements:qe,key2element:Ge,element2key:tt}};function we(Te,Pe,rt,qe,Ge,tt,pt,Ct,ui,qt){var Si=v.useRef(),ai=v.useRef();ai.current=Pe;var gi=function(){Ee.Z.cancel(Si.current)};return v.useEffect(function(){return function(){gi()}},[]),function(bi){var Li=bi.which;if([].concat(gt,[Jt,Qe,kt,Ye]).includes(Li)){var ki=tt(),fi=Le(ki,qe),yi=fi,wi=yi.elements,Ri=yi.key2element,Ti=yi.element2key,Bi=Ri.get(Pe),Di=_e(Bi,wi),Mi=Ti.get(Di),Yi=Je(Te,pt(Mi,!0).length===1,rt,Li);if(!Yi&&Li!==kt&&Li!==Ye)return;(gt.includes(Li)||[kt,Ye].includes(Li))&&bi.preventDefault();var $i=function(Pi){if(Pi){var ei=Pi,Pt=Pi.querySelector("a");Pt!=null&&Pt.getAttribute("href")&&(ei=Pt);var Yt=Ti.get(Pi);Ct(Yt),gi(),Si.current=(0,Ee.Z)(function(){ai.current===Yt&&ei.focus()})}};if([kt,Ye].includes(Li)||Yi.sibling||!Di){var rn;!Di||Te==="inline"?rn=Ge.current:rn=Me(Di);var Zi,Xi=Re(rn,wi);Li===kt?Zi=Xi[0]:Li===Ye?Zi=Xi[Xi.length-1]:Zi=ee(rn,wi,Di,Yi.offset),$i(Zi)}else if(Yi.inlineTrigger)ui(Mi);else if(Yi.offset>0)ui(Mi,!0),gi(),Si.current=(0,Ee.Z)(function(){fi=Le(ki,qe);var Ii=Di.getAttribute("aria-controls"),Pi=document.getElementById(Ii),ei=ee(Pi,fi.elements);$i(ei)},5);else if(Yi.offset<0){var tn=pt(Mi,!0),nn=tn[tn.length-2],Ji=Ri.get(nn);ui(nn,!1),$i(Ji)}}qt==null||qt(bi)}}function q(Te){Promise.resolve().then(Te)}var W="__RC_UTIL_PATH_SPLIT__",Y=function(Pe){return Pe.join(W)},re=function(Pe){return Pe.split(W)},X="rc-menu-more";function $(){var Te=v.useState({}),Pe=(0,G.Z)(Te,2),rt=Pe[1],qe=(0,v.useRef)(new Map),Ge=(0,v.useRef)(new Map),tt=v.useState([]),pt=(0,G.Z)(tt,2),Ct=pt[0],ui=pt[1],qt=(0,v.useRef)(0),Si=(0,v.useRef)(!1),ai=function(){Si.current||rt({})},gi=(0,v.useCallback)(function(Ri,Ti){var Bi=Y(Ti);Ge.current.set(Bi,Ri),qe.current.set(Ri,Bi),qt.current+=1;var Di=qt.current;q(function(){Di===qt.current&&ai()})},[]),bi=(0,v.useCallback)(function(Ri,Ti){var Bi=Y(Ti);Ge.current.delete(Bi),qe.current.delete(Ri)},[]),Li=(0,v.useCallback)(function(Ri){ui(Ri)},[]),ki=(0,v.useCallback)(function(Ri,Ti){var Bi=qe.current.get(Ri)||"",Di=re(Bi);return Ti&&Ct.includes(Di[0])&&Di.unshift(X),Di},[Ct]),fi=(0,v.useCallback)(function(Ri,Ti){return Ri.filter(function(Bi){return Bi!==void 0}).some(function(Bi){var Di=ki(Bi,!0);return Di.includes(Ti)})},[ki]),yi=function(){var Ti=(0,ce.Z)(qe.current.keys());return Ct.length&&Ti.push(X),Ti},wi=(0,v.useCallback)(function(Ri){var Ti="".concat(qe.current.get(Ri)).concat(W),Bi=new Set;return(0,ce.Z)(Ge.current.keys()).forEach(function(Di){Di.startsWith(Ti)&&Bi.add(Ge.current.get(Di))}),Bi},[]);return v.useEffect(function(){return function(){Si.current=!0}},[]),{registerPath:gi,unregisterPath:bi,refreshOverflowKeys:Li,isSubPathKey:fi,getKeyPath:ki,getKeys:yi,getSubPathKeys:wi}}function Q(Te){var Pe=v.useRef(Te);Pe.current=Te;var rt=v.useCallback(function(){for(var qe,Ge=arguments.length,tt=new Array(Ge),pt=0;pt<Ge;pt++)tt[pt]=arguments[pt];return(qe=Pe.current)===null||qe===void 0?void 0:qe.call.apply(qe,[Pe].concat(tt))},[]);return Te?rt:void 0}var he=Math.random().toFixed(5).toString().slice(2),pe=0;function Ae(Te){var Pe=(0,Z.Z)(Te,{value:Te}),rt=(0,G.Z)(Pe,2),qe=rt[0],Ge=rt[1];return v.useEffect(function(){pe+=1;var tt="".concat(he,"-").concat(pe);Ge("rc-menu-uuid-".concat(tt))},[]),qe}var Xe=U(67732),We=U(83652),ze=U(42403),Ke=U(158),Be=U(2738),mt=U(8654);function Oe(Te,Pe,rt,qe){var Ge=v.useContext(I),tt=Ge.activeKey,pt=Ge.onActive,Ct=Ge.onInactive,ui={active:tt===Te};return Pe||(ui.onMouseEnter=function(qt){rt==null||rt({key:Te,domEvent:qt}),pt(Te)},ui.onMouseLeave=function(qt){qe==null||qe({key:Te,domEvent:qt}),Ct(Te)}),ui}function st(Te){var Pe=v.useContext(I),rt=Pe.mode,qe=Pe.rtl,Ge=Pe.inlineIndent;if(rt!=="inline")return null;var tt=Te;return qe?{paddingRight:tt*Ge}:{paddingLeft:tt*Ge}}function Bt(Te){var Pe=Te.icon,rt=Te.props,qe=Te.children,Ge;return Pe===null||Pe===!1?null:(typeof Pe=="function"?Ge=v.createElement(Pe,(0,be.Z)({},rt)):typeof Pe!="boolean"&&(Ge=Pe),Ge||qe||null)}var yt=["item"];function ft(Te){var Pe=Te.item,rt=(0,p.Z)(Te,yt);return Object.defineProperty(rt,"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."),Pe}}),rt}var jt=["title","attribute","elementRef"],si=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],ti=["active"],Gt=function(Te){(0,ze.Z)(rt,Te);var Pe=(0,Ke.Z)(rt);function rt(){return(0,Xe.Z)(this,rt),Pe.apply(this,arguments)}return(0,We.Z)(rt,[{key:"render",value:function(){var Ge=this.props,tt=Ge.title,pt=Ge.attribute,Ct=Ge.elementRef,ui=(0,p.Z)(Ge,jt),qt=(0,Be.Z)(ui,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,g.ZP)(!pt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),v.createElement(l.Z.Item,(0,N.Z)({},pt,{title:typeof tt=="string"?tt:void 0},qt,{ref:Ct}))}}]),rt}(v.Component),ri=v.forwardRef(function(Te,Pe){var rt=Te.style,qe=Te.className,Ge=Te.eventKey,tt=Te.warnKey,pt=Te.disabled,Ct=Te.itemIcon,ui=Te.children,qt=Te.role,Si=Te.onMouseEnter,ai=Te.onMouseLeave,gi=Te.onClick,bi=Te.onKeyDown,Li=Te.onFocus,ki=(0,p.Z)(Te,si),fi=j(Ge),yi=v.useContext(I),wi=yi.prefixCls,Ri=yi.onItemClick,Ti=yi.disabled,Bi=yi.overflowDisabled,Di=yi.itemIcon,Mi=yi.selectedKeys,Yi=yi.onActive,$i=v.useContext(J),rn=$i._internalRenderMenuItem,Zi="".concat(wi,"-item"),Xi=v.useRef(),tn=v.useRef(),nn=Ti||pt,Ji=(0,mt.x1)(Pe,tn),Ii=De(Ge),Pi=function(an){return{key:Ge,keyPath:(0,ce.Z)(Ii).reverse(),item:Xi.current,domEvent:an}},ei=Ct||Di,Pt=Oe(Ge,nn,Si,ai),Yt=Pt.active,Ni=(0,p.Z)(Pt,ti),Ui=Mi.includes(Ge),qi=st(Ii.length),on=function(an){if(!nn){var fn=Pi(an);gi==null||gi(ft(fn)),Ri(fn)}},ji=function(an){if(bi==null||bi(an),an.which===le.Z.ENTER){var fn=Pi(an);gi==null||gi(ft(fn)),Ri(fn)}},cn=function(an){Yi(Ge),Li==null||Li(an)},Tn={};Te.role==="option"&&(Tn["aria-selected"]=Ui);var hn=v.createElement(Gt,(0,N.Z)({ref:Xi,elementRef:Ji,role:qt===null?"none":qt||"menuitem",tabIndex:pt?null:-1,"data-menu-id":Bi&&fi?null:fi},(0,Be.Z)(ki,["extra"]),Ni,Tn,{component:"li","aria-disabled":pt,style:(0,be.Z)((0,be.Z)({},qi),rt),className:oe()(Zi,(0,me.Z)((0,me.Z)((0,me.Z)({},"".concat(Zi,"-active"),Yt),"".concat(Zi,"-selected"),Ui),"".concat(Zi,"-disabled"),nn),qe),onClick:on,onKeyDown:ji,onFocus:cn}),ui,v.createElement(Bt,{props:(0,be.Z)((0,be.Z)({},Te),{},{isSelected:Ui}),icon:ei}));return rn&&(hn=rn(hn,Te,{selected:Ui})),hn});function Rt(Te,Pe){var rt=Te.eventKey,qe=ie(),Ge=De(rt);return v.useEffect(function(){if(qe)return qe.registerPath(rt,Ge),function(){qe.unregisterPath(rt,Ge)}},[Ge]),qe?null:v.createElement(ri,(0,N.Z)({},Te,{ref:Pe}))}var ut=v.forwardRef(Rt),nt=["className","children"],Mt=function(Pe,rt){var qe=Pe.className,Ge=Pe.children,tt=(0,p.Z)(Pe,nt),pt=v.useContext(I),Ct=pt.prefixCls,ui=pt.mode,qt=pt.rtl;return v.createElement("ul",(0,N.Z)({className:oe()(Ct,qt&&"".concat(Ct,"-rtl"),"".concat(Ct,"-sub"),"".concat(Ct,"-").concat(ui==="inline"?"inline":"vertical"),qe),role:"menu"},tt,{"data-menu-list":!0,ref:rt}),Ge)},Ht=v.forwardRef(Mt);Ht.displayName="SubMenuList";var Tt=Ht,_t=U(11592);function At(Te,Pe){return(0,_t.Z)(Te).map(function(rt,qe){if(v.isValidElement(rt)){var Ge,tt,pt=rt.key,Ct=(Ge=(tt=rt.props)===null||tt===void 0?void 0:tt.eventKey)!==null&&Ge!==void 0?Ge:pt,ui=Ct==null;ui&&(Ct="tmp_key-".concat([].concat((0,ce.Z)(Pe),[qe]).join("-")));var qt={key:Ct,eventKey:Ct};return v.cloneElement(rt,qt)}return rt})}var vi=U(65030),Zt={adjustX:1,adjustY:1},Xt={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}},Dt={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}},Ve=null;function h(Te,Pe,rt){if(Pe)return Pe;if(rt)return rt[Te]||rt.other}var m={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function y(Te){var Pe=Te.prefixCls,rt=Te.visible,qe=Te.children,Ge=Te.popup,tt=Te.popupStyle,pt=Te.popupClassName,Ct=Te.popupOffset,ui=Te.disabled,qt=Te.mode,Si=Te.onVisibleChange,ai=v.useContext(I),gi=ai.getPopupContainer,bi=ai.rtl,Li=ai.subMenuOpenDelay,ki=ai.subMenuCloseDelay,fi=ai.builtinPlacements,yi=ai.triggerSubMenuAction,wi=ai.forceSubMenuRender,Ri=ai.rootClassName,Ti=ai.motion,Bi=ai.defaultMotions,Di=v.useState(!1),Mi=(0,G.Z)(Di,2),Yi=Mi[0],$i=Mi[1],rn=bi?(0,be.Z)((0,be.Z)({},Dt),fi):(0,be.Z)((0,be.Z)({},Xt),fi),Zi=m[qt],Xi=h(qt,Ti,Bi),tn=v.useRef(Xi);qt!=="inline"&&(tn.current=Xi);var nn=(0,be.Z)((0,be.Z)({},tn.current),{},{leavedClassName:"".concat(Pe,"-hidden"),removeOnLeave:!1,motionAppear:!0}),Ji=v.useRef();return v.useEffect(function(){return Ji.current=(0,Ee.Z)(function(){$i(rt)}),function(){Ee.Z.cancel(Ji.current)}},[rt]),v.createElement(vi.Z,{prefixCls:Pe,popupClassName:oe()("".concat(Pe,"-popup"),(0,me.Z)({},"".concat(Pe,"-rtl"),bi),pt,Ri),stretch:qt==="horizontal"?"minWidth":null,getPopupContainer:gi,builtinPlacements:rn,popupPlacement:Zi,popupVisible:Yi,popup:Ge,popupStyle:tt,popupAlign:Ct&&{offset:Ct},action:ui?[]:[yi],mouseEnterDelay:Li,mouseLeaveDelay:ki,onPopupVisibleChange:Si,forceRender:wi,popupMotion:nn,fresh:!0},qe)}var k=U(77900);function H(Te){var Pe=Te.id,rt=Te.open,qe=Te.keyPath,Ge=Te.children,tt="inline",pt=v.useContext(I),Ct=pt.prefixCls,ui=pt.forceSubMenuRender,qt=pt.motion,Si=pt.defaultMotions,ai=pt.mode,gi=v.useRef(!1);gi.current=ai===tt;var bi=v.useState(!gi.current),Li=(0,G.Z)(bi,2),ki=Li[0],fi=Li[1],yi=gi.current?rt:!1;v.useEffect(function(){gi.current&&fi(!1)},[ai]);var wi=(0,be.Z)({},h(tt,qt,Si));qe.length>1&&(wi.motionAppear=!1);var Ri=wi.onVisibleChanged;return wi.onVisibleChanged=function(Ti){return!gi.current&&!Ti&&fi(!0),Ri==null?void 0:Ri(Ti)},ki?null:v.createElement(R,{mode:tt,locked:!gi.current},v.createElement(k.default,(0,N.Z)({visible:yi},wi,{forceRender:ui,removeOnLeave:!1,leavedClassName:"".concat(Ct,"-hidden")}),function(Ti){var Bi=Ti.className,Di=Ti.style;return v.createElement(Tt,{id:Pe,className:Bi,style:Di},Ge)}))}var ge=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],de=["active"],ke=v.forwardRef(function(Te,Pe){var rt=Te.style,qe=Te.className,Ge=Te.title,tt=Te.eventKey,pt=Te.warnKey,Ct=Te.disabled,ui=Te.internalPopupClose,qt=Te.children,Si=Te.itemIcon,ai=Te.expandIcon,gi=Te.popupClassName,bi=Te.popupOffset,Li=Te.popupStyle,ki=Te.onClick,fi=Te.onMouseEnter,yi=Te.onMouseLeave,wi=Te.onTitleClick,Ri=Te.onTitleMouseEnter,Ti=Te.onTitleMouseLeave,Bi=(0,p.Z)(Te,ge),Di=j(tt),Mi=v.useContext(I),Yi=Mi.prefixCls,$i=Mi.mode,rn=Mi.openKeys,Zi=Mi.disabled,Xi=Mi.overflowDisabled,tn=Mi.activeKey,nn=Mi.selectedKeys,Ji=Mi.itemIcon,Ii=Mi.expandIcon,Pi=Mi.onItemClick,ei=Mi.onOpenChange,Pt=Mi.onActive,Yt=v.useContext(J),Ni=Yt._internalRenderSubMenuItem,Ui=v.useContext(xe),qi=Ui.isSubPathKey,on=De(),ji="".concat(Yi,"-submenu"),cn=Zi||Ct,Tn=v.useRef(),hn=v.useRef(),bn=Si!=null?Si:Ji,an=ai!=null?ai:Ii,fn=rn.includes(tt),gn=!Xi&&fn,Mn=qi(nn,tt),dn=Oe(tt,cn,Ri,Ti),_n=dn.active,Dn=(0,p.Z)(dn,de),Bn=v.useState(!1),vn=(0,G.Z)(Bn,2),Hn=vn[0],Un=vn[1],Cn=function(mn){cn||Un(mn)},Jn=function(mn){Cn(!0),fi==null||fi({key:tt,domEvent:mn})},Ei=function(mn){Cn(!1),yi==null||yi({key:tt,domEvent:mn})},Wn=v.useMemo(function(){return _n||($i!=="inline"?Hn||qi([tn],tt):!1)},[$i,_n,tn,Hn,tt,qi]),Sn=st(on.length),es=function(mn){cn||(wi==null||wi({key:tt,domEvent:mn}),$i==="inline"&&ei(tt,!fn))},os=Q(function(en){ki==null||ki(ft(en)),Pi(en)}),ts=function(mn){$i!=="inline"&&ei(tt,mn)},ls=function(){Pt(tt)},Zn=Di&&"".concat(Di,"-popup"),Gi=v.useMemo(function(){return v.createElement(Bt,{icon:$i!=="horizontal"?an:void 0,props:(0,be.Z)((0,be.Z)({},Te),{},{isOpen:gn,isSubMenu:!0})},v.createElement("i",{className:"".concat(ji,"-arrow")}))},[$i,an,Te,gn,ji]),pn=v.createElement("div",(0,N.Z)({role:"menuitem",style:Sn,className:"".concat(ji,"-title"),tabIndex:cn?null:-1,ref:Tn,title:typeof Ge=="string"?Ge:null,"data-menu-id":Xi&&Di?null:Di,"aria-expanded":gn,"aria-haspopup":!0,"aria-controls":Zn,"aria-disabled":cn,onClick:es,onFocus:ls},Dn),Ge,Gi),kn=v.useRef($i);if($i!=="inline"&&on.length>1?kn.current="vertical":kn.current=$i,!Xi){var is=kn.current;pn=v.createElement(y,{mode:is,prefixCls:ji,visible:!ui&&gn&&$i!=="inline",popupClassName:gi,popupOffset:bi,popupStyle:Li,popup:v.createElement(R,{mode:is==="horizontal"?"vertical":is},v.createElement(Tt,{id:Zn,ref:hn},qt)),disabled:cn,onVisibleChange:ts},pn)}var ln=v.createElement(l.Z.Item,(0,N.Z)({ref:Pe,role:"none"},Bi,{component:"li",style:rt,className:oe()(ji,"".concat(ji,"-").concat($i),qe,(0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)({},"".concat(ji,"-open"),gn),"".concat(ji,"-active"),Wn),"".concat(ji,"-selected"),Mn),"".concat(ji,"-disabled"),cn)),onMouseEnter:Jn,onMouseLeave:Ei}),pn,!Xi&&v.createElement(H,{id:Zn,open:gn,keyPath:on},qt));return Ni&&(ln=Ni(ln,Te,{selected:Mn,active:Wn,open:gn,disabled:cn})),v.createElement(R,{onItemClick:os,mode:$i==="horizontal"?"vertical":$i,itemIcon:bn,expandIcon:an},ln)}),He=v.forwardRef(function(Te,Pe){var rt=Te.eventKey,qe=Te.children,Ge=De(rt),tt=At(qe,Ge),pt=ie();v.useEffect(function(){if(pt)return pt.registerPath(rt,Ge),function(){pt.unregisterPath(rt,Ge)}},[Ge]);var Ct;return pt?Ct=tt:Ct=v.createElement(ke,(0,N.Z)({ref:Pe},Te),tt),v.createElement(ye.Provider,{value:Ge},Ct)}),lt=He,Lt=U(76190);function Ot(Te){var Pe=Te.className,rt=Te.style,qe=v.useContext(I),Ge=qe.prefixCls,tt=ie();return tt?null:v.createElement("li",{role:"separator",className:oe()("".concat(Ge,"-item-divider"),Pe),style:rt})}var bt=["className","title","eventKey","children"],Ut=v.forwardRef(function(Te,Pe){var rt=Te.className,qe=Te.title,Ge=Te.eventKey,tt=Te.children,pt=(0,p.Z)(Te,bt),Ct=v.useContext(I),ui=Ct.prefixCls,qt="".concat(ui,"-item-group");return v.createElement("li",(0,N.Z)({ref:Pe,role:"presentation"},pt,{onClick:function(ai){return ai.stopPropagation()},className:oe()(qt,rt)}),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")},tt))}),vt=v.forwardRef(function(Te,Pe){var rt=Te.eventKey,qe=Te.children,Ge=De(rt),tt=At(qe,Ge),pt=ie();return pt?tt:v.createElement(Ut,(0,N.Z)({ref:Pe},(0,Be.Z)(Te,["warnKey"])),tt)}),ht=vt,ot=["label","children","key","type","extra"];function wt(Te,Pe,rt){var qe=Pe.item,Ge=Pe.group,tt=Pe.submenu,pt=Pe.divider;return(Te||[]).map(function(Ct,ui){if(Ct&&(0,Lt.Z)(Ct)==="object"){var qt=Ct,Si=qt.label,ai=qt.children,gi=qt.key,bi=qt.type,Li=qt.extra,ki=(0,p.Z)(qt,ot),fi=gi!=null?gi:"tmp-".concat(ui);return ai||bi==="group"?bi==="group"?v.createElement(Ge,(0,N.Z)({key:fi},ki,{title:Si}),wt(ai,Pe,rt)):v.createElement(tt,(0,N.Z)({key:fi},ki,{title:Si}),wt(ai,Pe,rt)):bi==="divider"?v.createElement(pt,(0,N.Z)({key:fi},ki)):v.createElement(qe,(0,N.Z)({key:fi},ki,{extra:Li}),Si,(!!Li||Li===0)&&v.createElement("span",{className:"".concat(rt,"-item-extra")},Li))}return null}).filter(function(Ct){return Ct})}function St(Te,Pe,rt,qe,Ge){var tt=Te,pt=(0,be.Z)({divider:Ot,item:ut,group:ht,submenu:lt},qe);return Pe&&(tt=wt(Pe,pt,Ge)),At(tt,rt)}var pi=["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"],zt=[],Ft=v.forwardRef(function(Te,Pe){var rt,qe=Te,Ge=qe.prefixCls,tt=Ge===void 0?"rc-menu":Ge,pt=qe.rootClassName,Ct=qe.style,ui=qe.className,qt=qe.tabIndex,Si=qt===void 0?0:qt,ai=qe.items,gi=qe.children,bi=qe.direction,Li=qe.id,ki=qe.mode,fi=ki===void 0?"vertical":ki,yi=qe.inlineCollapsed,wi=qe.disabled,Ri=qe.disabledOverflow,Ti=qe.subMenuOpenDelay,Bi=Ti===void 0?.1:Ti,Di=qe.subMenuCloseDelay,Mi=Di===void 0?.1:Di,Yi=qe.forceSubMenuRender,$i=qe.defaultOpenKeys,rn=qe.openKeys,Zi=qe.activeKey,Xi=qe.defaultActiveFirst,tn=qe.selectable,nn=tn===void 0?!0:tn,Ji=qe.multiple,Ii=Ji===void 0?!1:Ji,Pi=qe.defaultSelectedKeys,ei=qe.selectedKeys,Pt=qe.onSelect,Yt=qe.onDeselect,Ni=qe.inlineIndent,Ui=Ni===void 0?24:Ni,qi=qe.motion,on=qe.defaultMotions,ji=qe.triggerSubMenuAction,cn=ji===void 0?"hover":ji,Tn=qe.builtinPlacements,hn=qe.itemIcon,bn=qe.expandIcon,an=qe.overflowedIndicator,fn=an===void 0?"...":an,gn=qe.overflowedIndicatorPopupClassName,Mn=qe.getPopupContainer,dn=qe.onClick,_n=qe.onOpenChange,Dn=qe.onKeyDown,Bn=qe.openAnimation,vn=qe.openTransitionName,Hn=qe._internalRenderMenuItem,Un=qe._internalRenderSubMenuItem,Cn=qe._internalComponents,Jn=(0,p.Z)(qe,pi),Ei=v.useMemo(function(){return[St(gi,ai,zt,Cn,tt),St(gi,ai,zt,{},tt)]},[gi,ai,Cn]),Wn=(0,G.Z)(Ei,2),Sn=Wn[0],es=Wn[1],os=v.useState(!1),ts=(0,G.Z)(os,2),ls=ts[0],Zn=ts[1],Gi=v.useRef(),pn=Ae(Li),kn=bi==="rtl",is=(0,Z.Z)($i,{value:rn,postState:function(Wi){return Wi||zt}}),ln=(0,G.Z)(is,2),en=ln[0],mn=ln[1],yn=function(Wi){var Qi=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function wn(){mn(Wi),_n==null||_n(Wi)}Qi?(0,E.flushSync)(wn):wn()},Kn=v.useState(en),Pn=(0,G.Z)(Kn,2),us=Pn[0],gs=Pn[1],ns=v.useRef(!1),Rs=v.useMemo(function(){return(fi==="inline"||fi==="vertical")&&yi?["vertical",yi]:[fi,!1]},[fi,yi]),ii=(0,G.Z)(Rs,2),_i=ii[0],Vi=ii[1],Ai=_i==="inline",Ci=v.useState(_i),zn=(0,G.Z)(Ci,2),An=zn[0],cs=zn[1],_s=v.useState(Vi),fr=(0,G.Z)(_s,2),Zr=fr[0],zr=fr[1];v.useEffect(function(){cs(_i),zr(Vi),ns.current&&(Ai?mn(us):yn(zt))},[_i,Vi]);var dr=v.useState(0),Ls=(0,G.Z)(dr,2),Yn=Ls[0],Yr=Ls[1],Ns=Yn>=Sn.length-1||An!=="horizontal"||Ri;v.useEffect(function(){Ai&&gs(en)},[en]),v.useEffect(function(){return ns.current=!0,function(){ns.current=!1}},[]);var vs=$(),zs=vs.registerPath,Ys=vs.unregisterPath,Xr=vs.refreshOverflowKeys,Fs=vs.isSubPathKey,qr=vs.getKeyPath,$n=vs.getKeys,pr=vs.getSubPathKeys,Qr=v.useMemo(function(){return{registerPath:zs,unregisterPath:Ys}},[zs,Ys]),mr=v.useMemo(function(){return{isSubPathKey:Fs}},[Fs]);v.useEffect(function(){Xr(Ns?zt:Sn.slice(Yn+1).map(function(sn){return sn.key}))},[Yn,Ns]);var gr=(0,Z.Z)(Zi||Xi&&((rt=Sn[0])===null||rt===void 0?void 0:rt.key),{value:Zi}),Xs=(0,G.Z)(gr,2),bs=Xs[0],qs=Xs[1],Qs=Q(function(sn){qs(sn)}),_r=Q(function(){qs(void 0)});(0,v.useImperativeHandle)(Pe,function(){return{list:Gi.current,focus:function(Wi){var Qi,wn=$n(),Rn=Le(wn,pn),Bs=Rn.elements,Us=Rn.key2element,Ds=Rn.element2key,xr=Re(Gi.current,Bs),tr=bs!=null?bs:xr[0]?Ds.get(xr[0]):(Qi=Sn.find(function(Tr){return!Tr.props.disabled}))===null||Qi===void 0?void 0:Qi.key,Ss=Us.get(tr);if(tr&&Ss){var ir;Ss==null||(ir=Ss.focus)===null||ir===void 0||ir.call(Ss,Wi)}}}});var vr=(0,Z.Z)(Pi||[],{value:ei,postState:function(Wi){return Array.isArray(Wi)?Wi:Wi==null?zt:[Wi]}}),Xn=(0,G.Z)(vr,2),Is=Xn[0],Js=Xn[1],yr=function(Wi){if(nn){var Qi=Wi.key,wn=Is.includes(Qi),Rn;Ii?wn?Rn=Is.filter(function(Us){return Us!==Qi}):Rn=[].concat((0,ce.Z)(Is),[Qi]):Rn=[Qi],Js(Rn);var Bs=(0,be.Z)((0,be.Z)({},Wi),{},{selectedKeys:Rn});wn?Yt==null||Yt(Bs):Pt==null||Pt(Bs)}!Ii&&en.length&&An!=="inline"&&yn(zt)},Jr=Q(function(sn){dn==null||dn(ft(sn)),yr(sn)}),Er=Q(function(sn,Wi){var Qi=en.filter(function(Rn){return Rn!==sn});if(Wi)Qi.push(sn);else if(An!=="inline"){var wn=pr(sn);Qi=Qi.filter(function(Rn){return!wn.has(Rn)})}(0,C.Z)(en,Qi,!0)||yn(Qi,!0)}),ea=function(Wi,Qi){var wn=Qi!=null?Qi:!en.includes(Wi);Er(Wi,wn)},ta=we(An,bs,kn,pn,Gi,$n,qr,qs,ea,Dn);v.useEffect(function(){Zn(!0)},[]);var br=v.useMemo(function(){return{_internalRenderMenuItem:Hn,_internalRenderSubMenuItem:Un}},[Hn,Un]),Sr=An!=="horizontal"||Ri?Sn:Sn.map(function(sn,Wi){return v.createElement(R,{key:sn.key,overflowDisabled:Wi>Yn},sn)}),er=v.createElement(l.Z,(0,N.Z)({id:Li,ref:Gi,prefixCls:"".concat(tt,"-overflow"),component:"ul",itemComponent:ut,className:oe()(tt,"".concat(tt,"-root"),"".concat(tt,"-").concat(An),ui,(0,me.Z)((0,me.Z)({},"".concat(tt,"-inline-collapsed"),Zr),"".concat(tt,"-rtl"),kn),pt),dir:bi,style:Ct,role:"menu",tabIndex:Si,data:Sr,renderRawItem:function(Wi){return Wi},renderRawRest:function(Wi){var Qi=Wi.length,wn=Qi?Sn.slice(-Qi):null;return v.createElement(lt,{eventKey:X,title:fn,disabled:Ns,internalPopupClose:Qi===0,popupClassName:gn},wn)},maxCount:An!=="horizontal"||Ri?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Wi){Yr(Wi)},onKeyDown:ta},Jn));return v.createElement(J.Provider,{value:br},v.createElement(A.Provider,{value:pn},v.createElement(R,{prefixCls:tt,rootClassName:pt,mode:An,openKeys:en,rtl:kn,disabled:wi,motion:ls?qi:null,defaultMotions:ls?on:null,activeKey:bs,onActive:Qs,onInactive:_r,selectedKeys:Is,inlineIndent:Ui,subMenuOpenDelay:Bi,subMenuCloseDelay:Mi,forceSubMenuRender:Yi,builtinPlacements:Tn,triggerSubMenuAction:cn,getPopupContainer:Mn,itemIcon:hn,expandIcon:bn,onItemClick:Jr,onOpenChange:Er},v.createElement(xe.Provider,{value:mr},er),v.createElement("div",{style:{display:"none"},"aria-hidden":!0},v.createElement(ne.Provider,{value:Qr},es)))))}),xt=Ft,ni=xt;ni.Item=ut,ni.SubMenu=lt,ni.ItemGroup=ht,ni.Divider=Ot;var mi=ni},83836:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return te}});var N=U(54476),me=U(33885),be=U(42978),ce=U(75931),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"],C=void 0;function g(S,b){var K=S.prefixCls,le=S.invalidate,Ee=S.item,Fe=S.renderItem,et=S.responsive,Et=S.responsiveDisabled,It=S.registerSize,Jt=S.itemKey,Qe=S.className,kt=S.style,Ye=S.children,gt=S.display,Je=S.order,Me=S.component,_e=Me===void 0?"div":Me,Re=(0,ce.Z)(S,Z),ee=et&&!gt;function Le(re){It(Jt,re)}G.useEffect(function(){return function(){Le(null)}},[]);var we=Fe&&Ee!==C?Fe(Ee,{index:Je}):Ye,q;le||(q={opacity:ee?0:1,height:ee?0:C,overflowY:ee?"hidden":C,order:et?Je:C,pointerEvents:ee?"none":C,position:ee?"absolute":C});var W={};ee&&(W["aria-hidden"]=!0);var Y=G.createElement(_e,(0,N.Z)({className:ve()(!le&&K,Qe),style:(0,me.Z)((0,me.Z)({},q),kt)},W,Re,{ref:b}),we);return et&&(Y=G.createElement(oe.Z,{onResize:function(X){var $=X.offsetWidth;Le($)},disabled:Et},Y)),Y}var v=G.forwardRef(g);v.displayName="Item";var E=v,A=U(6089),O=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,O.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,be.Z)(K,2),Ee=le[0],Fe=le[1],et=(0,A.Z)(function(Et){S(function(){Fe(Et)})});return[Ee,et]}var w=G.createContext(null),R=["component"],z=["className"],ne=["className"],ie=function(b,K){var le=G.useContext(w);if(!le){var Ee=b.component,Fe=Ee===void 0?"div":Ee,et=(0,ce.Z)(b,R);return G.createElement(Fe,(0,N.Z)({},et,{ref:K}))}var Et=le.className,It=(0,ce.Z)(le,z),Jt=b.className,Qe=(0,ce.Z)(b,ne);return G.createElement(w.Provider,{value:null},G.createElement(E,(0,N.Z)({ref:K,className:ve()(Et,Jt)},It,Qe)))},ye=G.forwardRef(ie);ye.displayName="RawItem";var De=ye,xe=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","prefix","suffix","component","itemComponent","onVisibleChange"],$e="responsive",J="invalidate";function D(S){return"+ ".concat(S.length," ...")}function M(S,b){var K=S.prefixCls,le=K===void 0?"rc-overflow":K,Ee=S.data,Fe=Ee===void 0?[]:Ee,et=S.renderItem,Et=S.renderRawItem,It=S.itemKey,Jt=S.itemWidth,Qe=Jt===void 0?10:Jt,kt=S.ssr,Ye=S.style,gt=S.className,Je=S.maxCount,Me=S.renderRest,_e=S.renderRawRest,Re=S.prefix,ee=S.suffix,Le=S.component,we=Le===void 0?"div":Le,q=S.itemComponent,W=S.onVisibleChange,Y=(0,ce.Z)(S,xe),re=kt==="full",X=L(),$=I(X,null),Q=(0,be.Z)($,2),he=Q[0],pe=Q[1],Ae=he||0,Xe=I(X,new Map),We=(0,be.Z)(Xe,2),ze=We[0],Ke=We[1],Be=I(X,0),mt=(0,be.Z)(Be,2),Oe=mt[0],st=mt[1],Bt=I(X,0),yt=(0,be.Z)(Bt,2),ft=yt[0],jt=yt[1],si=I(X,0),ti=(0,be.Z)(si,2),Gt=ti[0],ri=ti[1],Rt=I(X,0),ut=(0,be.Z)(Rt,2),nt=ut[0],Mt=ut[1],Ht=(0,G.useState)(null),Tt=(0,be.Z)(Ht,2),_t=Tt[0],At=Tt[1],vi=(0,G.useState)(null),Zt=(0,be.Z)(vi,2),Xt=Zt[0],Dt=Zt[1],Ve=G.useMemo(function(){return Xt===null&&re?Number.MAX_SAFE_INTEGER:Xt||0},[Xt,he]),h=(0,G.useState)(!1),m=(0,be.Z)(h,2),y=m[0],k=m[1],H="".concat(le,"-item"),ge=Math.max(Oe,ft),de=Je===$e,ke=Fe.length&&de,He=Je===J,lt=ke||typeof Je=="number"&&Fe.length>Je,Lt=(0,G.useMemo)(function(){var Ge=Fe;return ke?he===null&&re?Ge=Fe:Ge=Fe.slice(0,Math.min(Fe.length,Ae/Qe)):typeof Je=="number"&&(Ge=Fe.slice(0,Je)),Ge},[Fe,Qe,he,Je,ke]),Ot=(0,G.useMemo)(function(){return ke?Fe.slice(Ve+1):Fe.slice(Lt.length)},[Fe,Lt,ke,Ve]),bt=(0,G.useCallback)(function(Ge,tt){var pt;return typeof It=="function"?It(Ge):(pt=It&&(Ge==null?void 0:Ge[It]))!==null&&pt!==void 0?pt:tt},[It]),Ut=(0,G.useCallback)(et||function(Ge){return Ge},[et]);function vt(Ge,tt,pt){Xt===Ge&&(tt===void 0||tt===_t)||(Dt(Ge),pt||(k(Ge<Fe.length-1),W==null||W(Ge)),tt!==void 0&&At(tt))}function ht(Ge,tt){pe(tt.clientWidth)}function ot(Ge,tt){Ke(function(pt){var Ct=new Map(pt);return tt===null?Ct.delete(Ge):Ct.set(Ge,tt),Ct})}function wt(Ge,tt){jt(tt),st(ft)}function St(Ge,tt){ri(tt)}function pi(Ge,tt){Mt(tt)}function zt(Ge){return ze.get(bt(Lt[Ge],Ge))}(0,l.Z)(function(){if(Ae&&typeof ge=="number"&&Lt){var Ge=Gt+nt,tt=Lt.length,pt=tt-1;if(!tt){vt(0,null);return}for(var Ct=0;Ct<tt;Ct+=1){var ui=zt(Ct);if(re&&(ui=ui||0),ui===void 0){vt(Ct-1,void 0,!0);break}if(Ge+=ui,pt===0&&Ge<=Ae||Ct===pt-1&&Ge+zt(pt)<=Ae){vt(pt,null);break}else if(Ge+ge>Ae){vt(Ct-1,Ge-ui-nt+ft);break}}ee&&zt(0)+nt>Ae&&At(null)}},[Ae,ze,ft,Gt,nt,bt,Lt]);var Ft=y&&!!Ot.length,xt={};_t!==null&&ke&&(xt={position:"absolute",left:_t,top:0});var ni={prefixCls:H,responsive:ke,component:q,invalidate:He},mi=Et?function(Ge,tt){var pt=bt(Ge,tt);return G.createElement(w.Provider,{key:pt,value:(0,me.Z)((0,me.Z)({},ni),{},{order:tt,item:Ge,itemKey:pt,registerSize:ot,display:tt<=Ve})},Et(Ge,tt))}:function(Ge,tt){var pt=bt(Ge,tt);return G.createElement(E,(0,N.Z)({},ni,{order:tt,key:pt,item:Ge,renderItem:Ut,itemKey:pt,registerSize:ot,display:tt<=Ve}))},Te={order:Ft?Ve:Number.MAX_SAFE_INTEGER,className:"".concat(H,"-rest"),registerSize:wt,display:Ft},Pe=Me||D,rt=_e?G.createElement(w.Provider,{value:(0,me.Z)((0,me.Z)({},ni),Te)},_e(Ot)):G.createElement(E,(0,N.Z)({},ni,Te),typeof Pe=="function"?Pe(Ot):Pe),qe=G.createElement(we,(0,N.Z)({className:ve()(!He&&le,gt),style:Ye,ref:b},Y),Re&&G.createElement(E,(0,N.Z)({},ni,{responsive:de,responsiveDisabled:!ke,order:-1,className:"".concat(H,"-prefix"),registerSize:St,display:!0}),Re),Lt.map(mi),lt?rt:null,ee&&G.createElement(E,(0,N.Z)({},ni,{responsive:de,responsiveDisabled:!ke,order:Ve,className:"".concat(H,"-suffix"),registerSize:pi,display:!0,style:xt}),ee));return de?G.createElement(oe.Z,{onResize:ht,disabled:!ke},qe):qe}var P=G.forwardRef(M);P.displayName="Overflow",P.Item=De,P.RESPONSIVE=$e,P.INVALIDATE=J;var ae=P,te=ae},738:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return I}});var N=U(54476),me=U(20068),be=U(42978),ce=U(75931),G=U(92310),p=U.n(G),ve=U(18929),oe=U(10228),l=U(26112),Z=U(59301);function C(w,R){var z=w.disabled,ne=w.prefixCls,ie=w.character,ye=w.characterRender,De=w.index,xe=w.count,$e=w.value,J=w.allowHalf,D=w.focused,M=w.onHover,P=w.onClick,ae=function(et){M(et,De)},te=function(et){P(et,De)},S=function(et){et.keyCode===oe.Z.ENTER&&P(et,De)},b=De+1,K=new Set([ne]);$e===0&&De===0&&D?K.add("".concat(ne,"-focused")):J&&$e+.5>=b&&$e<b?(K.add("".concat(ne,"-half")),K.add("".concat(ne,"-active")),D&&K.add("".concat(ne,"-focused"))):(b<=$e?K.add("".concat(ne,"-full")):K.add("".concat(ne,"-zero")),b===$e&&D&&K.add("".concat(ne,"-focused")));var le=typeof ie=="function"?ie(w):ie,Ee=Z.createElement("li",{className:p()(Array.from(K)),ref:R},Z.createElement("div",{onClick:z?null:te,onKeyDown:z?null:S,onMouseMove:z?null:ae,role:"radio","aria-checked":$e>De?"true":"false","aria-posinset":De+1,"aria-setsize":xe,tabIndex:z?-1:0},Z.createElement("div",{className:"".concat(ne,"-first")},le),Z.createElement("div",{className:"".concat(ne,"-second")},le)));return ye&&(Ee=ye(Ee,w)),Ee}var g=Z.forwardRef(C);function v(){var w=Z.useRef({});function R(ne){return w.current[ne]}function z(ne){return function(ie){w.current[ne]=ie}}return[R,z]}function E(w){var R=w.pageXOffset,z="scrollLeft";if(typeof R!="number"){var ne=w.document;R=ne.documentElement[z],typeof R!="number"&&(R=ne.body[z])}return R}function A(w){var R,z,ne=w.ownerDocument,ie=ne.body,ye=ne&&ne.documentElement,De=w.getBoundingClientRect();return R=De.left,z=De.top,R-=ye.clientLeft||ie.clientLeft||0,z-=ye.clientTop||ie.clientTop||0,{left:R,top:z}}function O(w){var R=A(w),z=w.ownerDocument,ne=z.defaultView||z.parentWindow;return R.left+=E(ne),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 z=w.prefixCls,ne=z===void 0?"rc-rate":z,ie=w.className,ye=w.defaultValue,De=w.value,xe=w.count,$e=xe===void 0?5:xe,J=w.allowHalf,D=J===void 0?!1:J,M=w.allowClear,P=M===void 0?!0:M,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,Fe=Ee===void 0?"ltr":Ee,et=w.tabIndex,Et=et===void 0?0:et,It=w.autoFocus,Jt=w.onHoverChange,Qe=w.onChange,kt=w.onFocus,Ye=w.onBlur,gt=w.onKeyDown,Je=w.onMouseLeave,Me=(0,ce.Z)(w,j),_e=v(),Re=(0,be.Z)(_e,2),ee=Re[0],Le=Re[1],we=Z.useRef(null),q=function(){if(!le){var nt;(nt=we.current)===null||nt===void 0||nt.focus()}};Z.useImperativeHandle(R,function(){return{focus:q,blur:function(){if(!le){var nt;(nt=we.current)===null||nt===void 0||nt.blur()}}}});var W=(0,ve.Z)(ye||0,{value:De}),Y=(0,be.Z)(W,2),re=Y[0],X=Y[1],$=(0,ve.Z)(null),Q=(0,be.Z)($,2),he=Q[0],pe=Q[1],Ae=function(nt,Mt){var Ht=Fe==="rtl",Tt=nt+1;if(D){var _t=ee(nt),At=O(_t),vi=_t.clientWidth;(Ht&&Mt-At>vi/2||!Ht&&Mt-At<vi/2)&&(Tt-=.5)}return Tt},Xe=function(nt){X(nt),Qe==null||Qe(nt)},We=Z.useState(!1),ze=(0,be.Z)(We,2),Ke=ze[0],Be=ze[1],mt=function(){Be(!0),kt==null||kt()},Oe=function(){Be(!1),Ye==null||Ye()},st=Z.useState(null),Bt=(0,be.Z)(st,2),yt=Bt[0],ft=Bt[1],jt=function(nt,Mt){var Ht=Ae(Mt,nt.pageX);Ht!==he&&(ft(Ht),pe(null)),Jt==null||Jt(Ht)},si=function(nt){le||(ft(null),pe(null),Jt==null||Jt(void 0)),nt&&(Je==null||Je(nt))},ti=function(nt,Mt){var Ht=Ae(Mt,nt.pageX),Tt=!1;P&&(Tt=Ht===re),si(),Xe(Tt?0:Ht),pe(Tt?Ht:null)},Gt=function(nt){var Mt=nt.keyCode,Ht=Fe==="rtl",Tt=D?.5:1;te&&(Mt===oe.Z.RIGHT&&re<$e&&!Ht?(Xe(re+Tt),nt.preventDefault()):Mt===oe.Z.LEFT&&re>0&&!Ht||Mt===oe.Z.RIGHT&&re>0&&Ht?(Xe(re-Tt),nt.preventDefault()):Mt===oe.Z.LEFT&&re<$e&&Ht&&(Xe(re+Tt),nt.preventDefault())),gt==null||gt(nt)};Z.useEffect(function(){It&&!le&&q()},[]);var ri=new Array($e).fill(0).map(function(ut,nt){return Z.createElement(g,{ref:Le(nt),index:nt,count:$e,disabled:le,prefixCls:"".concat(ne,"-star"),allowHalf:D,value:yt===null?re:yt,onClick:ti,onHover:jt,key:ut||nt,character:b,characterRender:K,focused:Ke})}),Rt=p()(ne,ie,(0,me.Z)((0,me.Z)({},"".concat(ne,"-disabled"),le),"".concat(ne,"-rtl"),Fe==="rtl"));return Z.createElement("ul",(0,N.Z)({className:Rt,onMouseLeave:si,tabIndex:le?-1:Et,onFocus:le?null:mt,onBlur:le?null:Oe,onKeyDown:le?null:Gt,ref:we},(0,l.Z)(Me,{aria:!0,data:!0,attr:!0})),ri)}var L=Z.forwardRef(V),I=L},29301:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return J}});var N=U(54476),me=U(59301),be=U(11592),ce=U(48736),G=U(33885),p=U(76190),ve=U(76846),oe=U(8654),l=me.createContext(null);function Z(D){var M=D.children,P=D.onBatchResize,ae=me.useRef(0),te=me.useRef([]),S=me.useContext(l),b=me.useCallback(function(K,le,Ee){ae.current+=1;var Fe=ae.current;te.current.push({size:K,element:le,data:Ee}),Promise.resolve().then(function(){Fe===ae.current&&(P==null||P(te.current),te.current=[])}),S==null||S(K,le,Ee)},[P,S]);return me.createElement(l.Provider,{value:b},M)}var C=U(76374),g=new Map;function v(D){D.forEach(function(M){var P,ae=M.target;(P=g.get(ae))===null||P===void 0||P.forEach(function(te){return te(ae)})})}var E=new C.Z(v),A=null,O=null;function j(D,M){g.has(D)||(g.set(D,new Set),E.observe(D)),g.get(D).add(M)}function V(D,M){g.has(D)&&(g.get(D).delete(M),g.get(D).size||(E.unobserve(D),g.delete(D)))}var L=U(67732),I=U(83652),w=U(42403),R=U(158),z=function(D){(0,w.Z)(P,D);var M=(0,R.Z)(P);function P(){return(0,L.Z)(this,P),M.apply(this,arguments)}return(0,I.Z)(P,[{key:"render",value:function(){return this.props.children}}]),P}(me.Component);function ne(D,M){var P=D.children,ae=D.disabled,te=me.useRef(null),S=me.useRef(null),b=me.useContext(l),K=typeof P=="function",le=K?P(te):P,Ee=me.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Fe=!K&&me.isValidElement(le)&&(0,oe.Yr)(le),et=Fe?(0,oe.C4)(le):null,Et=(0,oe.x1)(et,te),It=function(){var Ye;return(0,ve.ZP)(te.current)||(te.current&&(0,p.Z)(te.current)==="object"?(0,ve.ZP)((Ye=te.current)===null||Ye===void 0?void 0:Ye.nativeElement):null)||(0,ve.ZP)(S.current)};me.useImperativeHandle(M,function(){return It()});var Jt=me.useRef(D);Jt.current=D;var Qe=me.useCallback(function(kt){var Ye=Jt.current,gt=Ye.onResize,Je=Ye.data,Me=kt.getBoundingClientRect(),_e=Me.width,Re=Me.height,ee=kt.offsetWidth,Le=kt.offsetHeight,we=Math.floor(_e),q=Math.floor(Re);if(Ee.current.width!==we||Ee.current.height!==q||Ee.current.offsetWidth!==ee||Ee.current.offsetHeight!==Le){var W={width:we,height:q,offsetWidth:ee,offsetHeight:Le};Ee.current=W;var Y=ee===Math.round(_e)?_e:ee,re=Le===Math.round(Re)?Re:Le,X=(0,G.Z)((0,G.Z)({},W),{},{offsetWidth:Y,offsetHeight:re});b==null||b(X,kt,Je),gt&&Promise.resolve().then(function(){gt(X,kt)})}},[]);return me.useEffect(function(){var kt=It();return kt&&!ae&&j(kt,Qe),function(){return V(kt,Qe)}},[te.current,ae]),me.createElement(z,{ref:S},Fe?me.cloneElement(le,{ref:Et}):le)}var ie=me.forwardRef(ne),ye=ie,De="rc-observer-key";function xe(D,M){var P=D.children,ae=typeof P=="function"?[P]:(0,be.Z)(P);return ae.map(function(te,S){var b=(te==null?void 0:te.key)||"".concat(De,"-").concat(S);return me.createElement(ye,(0,N.Z)({},D,{key:b,ref:S===0?M:void 0}),te)})}var $e=me.forwardRef(xe);$e.Collection=Z;var J=$e},63158:function(Wt,at,U){"use strict";var N=U(54476),me=U(20068),be=U(42978),ce=U(75931),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"],C=G.forwardRef(function(g,v){var E,A=g.prefixCls,O=A===void 0?"rc-switch":A,j=g.className,V=g.checked,L=g.defaultChecked,I=g.disabled,w=g.loadingIcon,R=g.checkedChildren,z=g.unCheckedChildren,ne=g.onClick,ie=g.onChange,ye=g.onKeyDown,De=(0,ce.Z)(g,Z),xe=(0,oe.Z)(!1,{value:V,defaultValue:L}),$e=(0,be.Z)(xe,2),J=$e[0],D=$e[1];function M(S,b){var K=J;return I||(K=S,D(K),ie==null||ie(K,b)),K}function P(S){S.which===l.Z.LEFT?M(!1,S):S.which===l.Z.RIGHT&&M(!0,S),ye==null||ye(S)}function ae(S){var b=M(!J,S);ne==null||ne(b,S)}var te=ve()(O,j,(E={},(0,me.Z)(E,"".concat(O,"-checked"),J),(0,me.Z)(E,"".concat(O,"-disabled"),I),E));return G.createElement("button",(0,N.Z)({},De,{type:"button",role:"switch","aria-checked":J,disabled:I,className:te,ref:v,onKeyDown:P,onClick:ae}),w,G.createElement("span",{className:"".concat(O,"-inner")},G.createElement("span",{className:"".concat(O,"-inner-checked")},R),G.createElement("span",{className:"".concat(O,"-inner-unchecked")},z)))});C.displayName="Switch",at.Z=C},29125:function(Wt,at,U){"use strict";U.d(at,{G:function(){return ce},Z:function(){return V}});var N=U(92310),me=U.n(N),be=U(59301);function ce(L){var I=L.children,w=L.prefixCls,R=L.id,z=L.overlayInnerStyle,ne=L.bodyClassName,ie=L.className,ye=L.style;return be.createElement("div",{className:me()("".concat(w,"-content"),ie),style:ye},be.createElement("div",{className:me()("".concat(w,"-inner"),ne),id:R,role:"tooltip",style:z},typeof I=="function"?I():I))}var G=U(54476),p=U(33885),ve=U(75931),oe=U(65030),l={shiftX:64,adjustY:1},Z={adjustX:1,shiftY:!0},C=[0,0],g={left:{points:["cr","cl"],overflow:Z,offset:[-4,0],targetOffset:C},right:{points:["cl","cr"],overflow:Z,offset:[4,0],targetOffset:C},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:C},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:C},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:C},leftTop:{points:["tr","tl"],overflow:Z,offset:[-4,0],targetOffset:C},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:C},rightTop:{points:["tl","tr"],overflow:Z,offset:[4,0],targetOffset:C},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:C},rightBottom:{points:["bl","br"],overflow:Z,offset:[4,0],targetOffset:C},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:C},leftBottom:{points:["br","bl"],overflow:Z,offset:[-4,0],targetOffset:C}},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"],O=function(I,w){var R=I.overlayClassName,z=I.trigger,ne=z===void 0?["hover"]:z,ie=I.mouseEnterDelay,ye=ie===void 0?0:ie,De=I.mouseLeaveDelay,xe=De===void 0?.1:De,$e=I.overlayStyle,J=I.prefixCls,D=J===void 0?"rc-tooltip":J,M=I.children,P=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,Fe=Ee===void 0?{}:Ee,et=I.destroyTooltipOnHide,Et=et===void 0?!1:et,It=I.defaultVisible,Jt=I.getTooltipContainer,Qe=I.overlayInnerStyle,kt=I.arrowContent,Ye=I.overlay,gt=I.id,Je=I.showArrow,Me=Je===void 0?!0:Je,_e=I.classNames,Re=I.styles,ee=(0,ve.Z)(I,A),Le=(0,E.Z)(gt),we=(0,be.useRef)(null);(0,be.useImperativeHandle)(w,function(){return we.current});var q=(0,p.Z)({},ee);"visible"in I&&(q.popupVisible=I.visible);var W=function(){return be.createElement(ce,{key:"content",prefixCls:D,id:Le,bodyClassName:_e==null?void 0:_e.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},Qe),Re==null?void 0:Re.body)},Ye)},Y=function(){var X=be.Children.only(M),$=(X==null?void 0:X.props)||{},Q=(0,p.Z)((0,p.Z)({},$),{},{"aria-describedby":Ye?Le:null});return be.cloneElement(M,Q)};return be.createElement(oe.Z,(0,G.Z)({popupClassName:me()(R,_e==null?void 0:_e.root),prefixCls:D,popup:W,action:ne,builtinPlacements:g,popupPlacement:le,ref:we,popupAlign:Fe,getPopupContainer:Jt,onPopupVisibleChange:P,afterPopupVisibleChange:ae,popupTransitionName:te,popupAnimation:S,popupMotion:b,defaultPopupVisible:It,autoDestroy:Et,mouseLeaveDelay:xe,popupStyle:(0,p.Z)((0,p.Z)({},$e),Re==null?void 0:Re.root),mouseEnterDelay:ye,arrow:Me},q),Y())},j=(0,be.forwardRef)(O),V=j},639:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return I}});var N=U(54476),me=U(20068),be=U(33885),ce=U(42978),G=U(75931),p=U(59301),ve=U(92310),oe=U.n(ve),l=U(26112),Z=U(30699),C=function(R){for(var z=R.prefixCls,ne=R.level,ie=R.isStart,ye=R.isEnd,De="".concat(z,"-indent-unit"),xe=[],$e=0;$e<ne;$e+=1)xe.push(p.createElement("span",{key:$e,className:oe()(De,(0,me.Z)((0,me.Z)({},"".concat(De,"-start"),ie[$e]),"".concat(De,"-end"),ye[$e]))}));return p.createElement("span",{"aria-hidden":"true",className:"".concat(z,"-indent")},xe)},g=p.memo(C),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"],O="open",j="close",V="---",L=function(R){var z,ne,ie,ye=R.eventKey,De=R.className,xe=R.style,$e=R.dragOver,J=R.dragOverGapTop,D=R.dragOverGapBottom,M=R.isLeaf,P=R.isStart,ae=R.isEnd,te=R.expanded,S=R.selected,b=R.checked,K=R.halfChecked,le=R.loading,Ee=R.domRef,Fe=R.active,et=R.data,Et=R.onMouseMove,It=R.selectable,Jt=(0,G.Z)(R,A),Qe=p.useContext(Z.k),kt=p.useContext(Z.y),Ye=p.useRef(null),gt=p.useState(!1),Je=(0,ce.Z)(gt,2),Me=Je[0],_e=Je[1],Re=!!(Qe.disabled||R.disabled||(z=kt.nodeDisabled)!==null&&z!==void 0&&z.call(kt,et)),ee=p.useMemo(function(){return!Qe.checkable||R.checkable===!1?!1:Qe.checkable},[Qe.checkable,R.checkable]),Le=function(_t){Re||Qe.onNodeSelect(_t,(0,E.F)(R))},we=function(_t){Re||!ee||R.disableCheckbox||Qe.onNodeCheck(_t,(0,E.F)(R),!b)},q=p.useMemo(function(){return typeof It=="boolean"?It:Qe.selectable},[It,Qe.selectable]),W=function(_t){Qe.onNodeClick(_t,(0,E.F)(R)),q?Le(_t):we(_t)},Y=function(_t){Qe.onNodeDoubleClick(_t,(0,E.F)(R))},re=function(_t){Qe.onNodeMouseEnter(_t,(0,E.F)(R))},X=function(_t){Qe.onNodeMouseLeave(_t,(0,E.F)(R))},$=function(_t){Qe.onNodeContextMenu(_t,(0,E.F)(R))},Q=p.useMemo(function(){return!!(Qe.draggable&&(!Qe.draggable.nodeDraggable||Qe.draggable.nodeDraggable(et)))},[Qe.draggable,et]),he=function(_t){_t.stopPropagation(),_e(!0),Qe.onNodeDragStart(_t,R);try{_t.dataTransfer.setData("text/plain","")}catch(At){}},pe=function(_t){_t.preventDefault(),_t.stopPropagation(),Qe.onNodeDragEnter(_t,R)},Ae=function(_t){_t.preventDefault(),_t.stopPropagation(),Qe.onNodeDragOver(_t,R)},Xe=function(_t){_t.stopPropagation(),Qe.onNodeDragLeave(_t,R)},We=function(_t){_t.stopPropagation(),_e(!1),Qe.onNodeDragEnd(_t,R)},ze=function(_t){_t.preventDefault(),_t.stopPropagation(),_e(!1),Qe.onNodeDrop(_t,R)},Ke=function(_t){le||Qe.onNodeExpand(_t,(0,E.F)(R))},Be=p.useMemo(function(){var Tt=(0,v.Z)(Qe.keyEntities,ye)||{},_t=Tt.children;return!!(_t||[]).length},[Qe.keyEntities,ye]),mt=p.useMemo(function(){return M===!1?!1:M||!Qe.loadData&&!Be||Qe.loadData&&R.loaded&&!Be},[M,Qe.loadData,Be,R.loaded]);p.useEffect(function(){le||typeof Qe.loadData=="function"&&te&&!mt&&!R.loaded&&Qe.onNodeLoad((0,E.F)(R))},[le,Qe.loadData,Qe.onNodeLoad,te,mt,R]);var Oe=p.useMemo(function(){var Tt;return(Tt=Qe.draggable)!==null&&Tt!==void 0&&Tt.icon?p.createElement("span",{className:"".concat(Qe.prefixCls,"-draggable-icon")},Qe.draggable.icon):null},[Qe.draggable]),st=function(_t){var At=R.switcherIcon||Qe.switcherIcon;return typeof At=="function"?At((0,be.Z)((0,be.Z)({},R),{},{isLeaf:_t})):At},Bt=function(){if(mt){var _t=st(!0);return _t!==!1?p.createElement("span",{className:oe()("".concat(Qe.prefixCls,"-switcher"),"".concat(Qe.prefixCls,"-switcher-noop"))},_t):null}var At=st(!1);return At!==!1?p.createElement("span",{onClick:Ke,className:oe()("".concat(Qe.prefixCls,"-switcher"),"".concat(Qe.prefixCls,"-switcher_").concat(te?O:j))},At):null},yt=p.useMemo(function(){if(!ee)return null;var Tt=typeof ee!="boolean"?ee:null;return p.createElement("span",{className:oe()("".concat(Qe.prefixCls,"-checkbox"),(0,me.Z)((0,me.Z)((0,me.Z)({},"".concat(Qe.prefixCls,"-checkbox-checked"),b),"".concat(Qe.prefixCls,"-checkbox-indeterminate"),!b&&K),"".concat(Qe.prefixCls,"-checkbox-disabled"),Re||R.disableCheckbox)),onClick:we,role:"checkbox","aria-checked":K?"mixed":b,"aria-disabled":Re||R.disableCheckbox,"aria-label":"Select ".concat(typeof R.title=="string"?R.title:"tree node")},Tt)},[ee,b,K,Re,R.disableCheckbox,R.title]),ft=p.useMemo(function(){return mt?null:te?O:j},[mt,te]),jt=p.useMemo(function(){return p.createElement("span",{className:oe()("".concat(Qe.prefixCls,"-iconEle"),"".concat(Qe.prefixCls,"-icon__").concat(ft||"docu"),(0,me.Z)({},"".concat(Qe.prefixCls,"-icon_loading"),le))})},[Qe.prefixCls,ft,le]),si=p.useMemo(function(){var Tt=!!Qe.draggable,_t=!R.disabled&&Tt&&Qe.dragOverNodeKey===ye;return _t?Qe.dropIndicatorRender({dropPosition:Qe.dropPosition,dropLevelOffset:Qe.dropLevelOffset,indent:Qe.indent,prefixCls:Qe.prefixCls,direction:Qe.direction}):null},[Qe.dropPosition,Qe.dropLevelOffset,Qe.indent,Qe.prefixCls,Qe.direction,Qe.draggable,Qe.dragOverNodeKey,Qe.dropIndicatorRender]),ti=p.useMemo(function(){var Tt=R.title,_t=Tt===void 0?V:Tt,At="".concat(Qe.prefixCls,"-node-content-wrapper"),vi;if(Qe.showIcon){var Zt=R.icon||Qe.icon;vi=Zt?p.createElement("span",{className:oe()("".concat(Qe.prefixCls,"-iconEle"),"".concat(Qe.prefixCls,"-icon__customize"))},typeof Zt=="function"?Zt(R):Zt):jt}else Qe.loadData&&le&&(vi=jt);var Xt;return typeof _t=="function"?Xt=_t(et):Qe.titleRender?Xt=Qe.titleRender(et):Xt=_t,p.createElement("span",{ref:Ye,title:typeof _t=="string"?_t:"",className:oe()(At,"".concat(At,"-").concat(ft||"normal"),(0,me.Z)({},"".concat(Qe.prefixCls,"-node-selected"),!Re&&(S||Me))),onMouseEnter:re,onMouseLeave:X,onContextMenu:$,onClick:W,onDoubleClick:Y},vi,p.createElement("span",{className:"".concat(Qe.prefixCls,"-title")},Xt),si)},[Qe.prefixCls,Qe.showIcon,R,Qe.icon,jt,Qe.titleRender,et,ft,re,X,$,W,Y]),Gt=(0,l.Z)(Jt,{aria:!0,data:!0}),ri=(0,v.Z)(Qe.keyEntities,ye)||{},Rt=ri.level,ut=ae[ae.length-1],nt=!Re&&Q,Mt=Qe.draggingNodeKey===ye,Ht=It!==void 0?{"aria-selected":!!It}:void 0;return p.createElement("div",(0,N.Z)({ref:Ee,role:"treeitem","aria-expanded":M?void 0:te,className:oe()(De,"".concat(Qe.prefixCls,"-treenode"),(ie={},(0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)(ie,"".concat(Qe.prefixCls,"-treenode-disabled"),Re),"".concat(Qe.prefixCls,"-treenode-switcher-").concat(te?"open":"close"),!M),"".concat(Qe.prefixCls,"-treenode-checkbox-checked"),b),"".concat(Qe.prefixCls,"-treenode-checkbox-indeterminate"),K),"".concat(Qe.prefixCls,"-treenode-selected"),S),"".concat(Qe.prefixCls,"-treenode-loading"),le),"".concat(Qe.prefixCls,"-treenode-active"),Fe),"".concat(Qe.prefixCls,"-treenode-leaf-last"),ut),"".concat(Qe.prefixCls,"-treenode-draggable"),Q),"dragging",Mt),(0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)((0,me.Z)(ie,"drop-target",Qe.dropTargetKey===ye),"drop-container",Qe.dropContainerKey===ye),"drag-over",!Re&&$e),"drag-over-gap-top",!Re&&J),"drag-over-gap-bottom",!Re&&D),"filter-node",(ne=Qe.filterTreeNode)===null||ne===void 0?void 0:ne.call(Qe,(0,E.F)(R))),"".concat(Qe.prefixCls,"-treenode-leaf"),mt))),style:xe,draggable:nt,onDragStart:nt?he:void 0,onDragEnter:Q?pe:void 0,onDragOver:Q?Ae:void 0,onDragLeave:Q?Xe:void 0,onDrop:Q?ze:void 0,onDragEnd:Q?We:void 0,onMouseMove:Et},Ht,Gt),p.createElement(g,{prefixCls:Qe.prefixCls,level:Rt,isStart:P,isEnd:ae}),Oe,Bt(),yt,ti)};L.isTreeNode=1;var I=L},30699:function(Wt,at,U){"use strict";U.d(at,{k:function(){return me},y:function(){return be}});var N=U(59301),me=N.createContext(null),be=N.createContext({})},3741:function(Wt,at,U){"use strict";U.d(at,{OF:function(){return ye.Z},y6:function(){return j.y},ZP:function(){return Re}});var N=U(54476),me=U(76190),be=U(33885),ce=U(94480),G=U(67732),p=U(83652),ve=U(31226),oe=U(42403),l=U(158),Z=U(20068),C=U(92310),g=U.n(C),v=U(10228),E=U(26112),A=U(48736),O=U(59301),j=U(30699),V=function(Le){var we=Le.dropPosition,q=Le.dropLevelOffset,W=Le.indent,Y={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(we){case-1:Y.top=0,Y.left=-q*W;break;case 1:Y.bottom=0,Y.left=-q*W;break;case 0:Y.bottom=0,Y.left=W;break}return O.createElement("div",{style:Y})},L=V;function I(ee){if(ee==null)throw new TypeError("Cannot destructure "+ee)}var w=U(42978),R=U(75931),z=U(34280),ne=U(48911),ie=U(77900),ye=U(639);function De(ee,Le){var we=O.useState(!1),q=(0,w.Z)(we,2),W=q[0],Y=q[1];(0,z.Z)(function(){if(W)return ee(),function(){Le()}},[W]),(0,z.Z)(function(){return Y(!0),function(){Y(!1)}},[])}var xe=De,$e=U(34061),J=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],D=O.forwardRef(function(ee,Le){var we=ee.className,q=ee.style,W=ee.motion,Y=ee.motionNodes,re=ee.motionType,X=ee.onMotionStart,$=ee.onMotionEnd,Q=ee.active,he=ee.treeNodeRequiredProps,pe=(0,R.Z)(ee,J),Ae=O.useState(!0),Xe=(0,w.Z)(Ae,2),We=Xe[0],ze=Xe[1],Ke=O.useContext(j.k),Be=Ke.prefixCls,mt=Y&&re!=="hide";(0,z.Z)(function(){Y&&mt!==We&&ze(mt)},[Y]);var Oe=function(){Y&&X()},st=O.useRef(!1),Bt=function(){Y&&!st.current&&(st.current=!0,$())};xe(Oe,Bt);var yt=function(jt){mt===jt&&Bt()};return Y?O.createElement(ie.default,(0,N.Z)({ref:Le,visible:We},W,{motionAppear:re==="show",onVisibleChanged:yt}),function(ft,jt){var si=ft.className,ti=ft.style;return O.createElement("div",{ref:jt,className:g()("".concat(Be,"-treenode-motion"),si),style:ti},Y.map(function(Gt){var ri=Object.assign({},(I(Gt.data),Gt.data)),Rt=Gt.title,ut=Gt.key,nt=Gt.isStart,Mt=Gt.isEnd;delete ri.children;var Ht=(0,$e.H8)(ut,he);return O.createElement(ye.Z,(0,N.Z)({},ri,Ht,{title:Rt,active:Q,data:Gt.data,key:ut,isStart:nt,isEnd:Mt}))}))}):O.createElement(ye.Z,(0,N.Z)({domRef:Le,className:we,style:q},pe,{active:Q}))}),M=D;function P(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],we=ee.length,q=Le.length;if(Math.abs(we-q)!==1)return{add:!1,key:null};function W(Y,re){var X=new Map;Y.forEach(function(Q){X.set(Q,!0)});var $=re.filter(function(Q){return!X.has(Q)});return $.length===1?$[0]:null}return we<q?{add:!0,key:W(ee,Le)}:{add:!1,key:W(Le,ee)}}function ae(ee,Le,we){var q=ee.findIndex(function(X){return X.key===we}),W=ee[q+1],Y=Le.findIndex(function(X){return X.key===we});if(W){var re=Le.findIndex(function(X){return X.key===W.key});return Le.slice(Y+1,re)}return Le.slice(Y+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]},Fe={parent:null,children:[],pos:Ee.pos,data:le,title:null,key:K,isStart:[],isEnd:[]};function et(ee,Le,we,q){return Le===!1||!we?ee:ee.slice(0,Math.ceil(we/q)+1)}function Et(ee){var Le=ee.key,we=ee.pos;return(0,$e.km)(Le,we)}function It(ee){for(var Le=String(ee.data.key),we=ee;we.parent;)we=we.parent,Le="".concat(we.data.key," > ").concat(Le);return Le}var Jt=O.forwardRef(function(ee,Le){var we=ee.prefixCls,q=ee.data,W=ee.selectable,Y=ee.checkable,re=ee.expandedKeys,X=ee.selectedKeys,$=ee.checkedKeys,Q=ee.loadedKeys,he=ee.loadingKeys,pe=ee.halfCheckedKeys,Ae=ee.keyEntities,Xe=ee.disabled,We=ee.dragging,ze=ee.dragOverNodeKey,Ke=ee.dropPosition,Be=ee.motion,mt=ee.height,Oe=ee.itemHeight,st=ee.virtual,Bt=ee.scrollWidth,yt=ee.focusable,ft=ee.activeItem,jt=ee.focused,si=ee.tabIndex,ti=ee.onKeyDown,Gt=ee.onFocus,ri=ee.onBlur,Rt=ee.onActiveChange,ut=ee.onListChangeStart,nt=ee.onListChangeEnd,Mt=(0,R.Z)(ee,te),Ht=O.useRef(null),Tt=O.useRef(null);O.useImperativeHandle(Le,function(){return{scrollTo:function(St){Ht.current.scrollTo(St)},getIndentWidth:function(){return Tt.current.offsetWidth}}});var _t=O.useState(re),At=(0,w.Z)(_t,2),vi=At[0],Zt=At[1],Xt=O.useState(q),Dt=(0,w.Z)(Xt,2),Ve=Dt[0],h=Dt[1],m=O.useState(q),y=(0,w.Z)(m,2),k=y[0],H=y[1],ge=O.useState([]),de=(0,w.Z)(ge,2),ke=de[0],He=de[1],lt=O.useState(null),Lt=(0,w.Z)(lt,2),Ot=Lt[0],bt=Lt[1],Ut=O.useRef(q);Ut.current=q;function vt(){var wt=Ut.current;h(wt),H(wt),He([]),bt(null),nt()}(0,z.Z)(function(){Zt(re);var wt=P(vi,re);if(wt.key!==null)if(wt.add){var St=Ve.findIndex(function(mi){var Te=mi.key;return Te===wt.key}),pi=et(ae(Ve,q,wt.key),st,mt,Oe),zt=Ve.slice();zt.splice(St+1,0,Fe),H(zt),He(pi),bt("show")}else{var Ft=q.findIndex(function(mi){var Te=mi.key;return Te===wt.key}),xt=et(ae(q,Ve,wt.key),st,mt,Oe),ni=q.slice();ni.splice(Ft+1,0,Fe),H(ni),He(xt),bt("hide")}else Ve!==q&&(h(q),H(q))},[re,q]),O.useEffect(function(){We||vt()},[We]);var ht=Be?k:q,ot={expandedKeys:re,selectedKeys:X,loadedKeys:Q,loadingKeys:he,checkedKeys:$,halfCheckedKeys:pe,dragOverNodeKey:ze,dropPosition:Ke,keyEntities:Ae};return O.createElement(O.Fragment,null,jt&&ft&&O.createElement("span",{style:S,"aria-live":"assertive"},It(ft)),O.createElement("div",null,O.createElement("input",{style:S,disabled:yt===!1||Xe,tabIndex:yt!==!1?si:null,onKeyDown:ti,onFocus:Gt,onBlur:ri,value:"",onChange:b,"aria-label":"for screen reader"})),O.createElement("div",{className:"".concat(we,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},O.createElement("div",{className:"".concat(we,"-indent")},O.createElement("div",{ref:Tt,className:"".concat(we,"-indent-unit")}))),O.createElement(ne.Z,(0,N.Z)({},Mt,{data:ht,itemKey:Et,height:mt,fullHeight:!1,virtual:st,itemHeight:Oe,scrollWidth:Bt,prefixCls:"".concat(we,"-list"),ref:Ht,role:"tree",onVisibleChange:function(St){St.every(function(pi){return Et(pi)!==K})&&vt()}}),function(wt){var St=wt.pos,pi=Object.assign({},(I(wt.data),wt.data)),zt=wt.title,Ft=wt.key,xt=wt.isStart,ni=wt.isEnd,mi=(0,$e.km)(Ft,St);delete pi.key,delete pi.children;var Te=(0,$e.H8)(mi,ot);return O.createElement(M,(0,N.Z)({},pi,Te,{title:zt,active:!!ft&&Ft===ft.key,pos:St,data:wt.data,isStart:xt,isEnd:ni,motion:Be,motionNodes:Ft===K?ke:null,motionType:Ot,onMotionStart:ut,onMotionEnd:vt,treeNodeRequiredProps:ot,onMouseMove:function(){Rt(null)}}))}))}),Qe=Jt,kt=U(82661),Ye=U(34643),gt=U(65065),Je=10,Me=function(ee){(0,oe.Z)(we,ee);var Le=(0,l.Z)(we);function we(){var q;(0,G.Z)(this,we);for(var W=arguments.length,Y=new Array(W),re=0;re<W;re++)Y[re]=arguments[re];return q=Le.call.apply(Le,[this].concat(Y)),(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",O.createRef()),(0,Z.Z)((0,ve.Z)(q),"onNodeDragStart",function(X,$){var Q=q.state,he=Q.expandedKeys,pe=Q.keyEntities,Ae=q.props.onDragStart,Xe=$.eventKey;q.dragNodeProps=$,q.dragStartMousePosition={x:X.clientX,y:X.clientY};var We=(0,kt._5)(he,Xe);q.setState({draggingNodeKey:Xe,dragChildrenKeys:(0,kt.wA)(Xe,pe),indent:q.listRef.current.getIndentWidth()}),q.setExpandedKeys(We),window.addEventListener("dragend",q.onWindowDragEnd),Ae==null||Ae({event:X,node:(0,$e.F)($)})}),(0,Z.Z)((0,ve.Z)(q),"onNodeDragEnter",function(X,$){var Q=q.state,he=Q.expandedKeys,pe=Q.keyEntities,Ae=Q.dragChildrenKeys,Xe=Q.flattenNodes,We=Q.indent,ze=q.props,Ke=ze.onDragEnter,Be=ze.onExpand,mt=ze.allowDrop,Oe=ze.direction,st=$.pos,Bt=$.eventKey;if(q.currentMouseOverDroppableNodeKey!==Bt&&(q.currentMouseOverDroppableNodeKey=Bt),!q.dragNodeProps){q.resetDragState();return}var yt=(0,kt.OM)(X,q.dragNodeProps,$,We,q.dragStartMousePosition,mt,Xe,pe,he,Oe),ft=yt.dropPosition,jt=yt.dropLevelOffset,si=yt.dropTargetKey,ti=yt.dropContainerKey,Gt=yt.dropTargetPos,ri=yt.dropAllowed,Rt=yt.dragOverNodeKey;if(Ae.includes(si)||!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[st]=window.setTimeout(function(){if(q.state.draggingNodeKey!==null){var ut=(0,ce.Z)(he),nt=(0,gt.Z)(pe,$.eventKey);nt&&(nt.children||[]).length&&(ut=(0,kt.L0)(he,$.eventKey)),q.props.hasOwnProperty("expandedKeys")||q.setExpandedKeys(ut),Be==null||Be(ut,{node:(0,$e.F)($),expanded:!0,nativeEvent:X.nativeEvent})}},800)),q.dragNodeProps.eventKey===si&&jt===0){q.resetDragState();return}q.setState({dragOverNodeKey:Rt,dropPosition:ft,dropLevelOffset:jt,dropTargetKey:si,dropContainerKey:ti,dropTargetPos:Gt,dropAllowed:ri}),Ke==null||Ke({event:X,node:(0,$e.F)($),expandedKeys:he})}),(0,Z.Z)((0,ve.Z)(q),"onNodeDragOver",function(X,$){var Q=q.state,he=Q.dragChildrenKeys,pe=Q.flattenNodes,Ae=Q.keyEntities,Xe=Q.expandedKeys,We=Q.indent,ze=q.props,Ke=ze.onDragOver,Be=ze.allowDrop,mt=ze.direction;if(q.dragNodeProps){var Oe=(0,kt.OM)(X,q.dragNodeProps,$,We,q.dragStartMousePosition,Be,pe,Ae,Xe,mt),st=Oe.dropPosition,Bt=Oe.dropLevelOffset,yt=Oe.dropTargetKey,ft=Oe.dropContainerKey,jt=Oe.dropTargetPos,si=Oe.dropAllowed,ti=Oe.dragOverNodeKey;he.includes(yt)||!si||(q.dragNodeProps.eventKey===yt&&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():st===q.state.dropPosition&&Bt===q.state.dropLevelOffset&&yt===q.state.dropTargetKey&&ft===q.state.dropContainerKey&&jt===q.state.dropTargetPos&&si===q.state.dropAllowed&&ti===q.state.dragOverNodeKey||q.setState({dropPosition:st,dropLevelOffset:Bt,dropTargetKey:yt,dropContainerKey:ft,dropTargetPos:jt,dropAllowed:si,dragOverNodeKey:ti}),Ke==null||Ke({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,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,pe=q.state,Ae=pe.dragChildrenKeys,Xe=pe.dropPosition,We=pe.dropTargetKey,ze=pe.dropTargetPos,Ke=pe.dropAllowed;if(Ke){var Be=q.props.onDrop;if(q.setState({dragOverNodeKey:null}),q.cleanDragState(),We!==null){var mt=(0,be.Z)((0,be.Z)({},(0,$e.H8)(We,q.getTreeNodeRequiredProps())),{},{active:((Q=q.getActiveItem())===null||Q===void 0?void 0:Q.key)===We,data:(0,gt.Z)(q.state.keyEntities,We).node}),Oe=Ae.includes(We);(0,A.ZP)(!Oe,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var st=(0,kt.yx)(ze),Bt={event:X,node:(0,$e.F)(mt),dragNode:q.dragNodeProps?(0,$e.F)(q.dragNodeProps):null,dragNodesKeys:[q.dragNodeProps.eventKey].concat(Ae),dropToGap:Xe!==0,dropPosition:Xe+Number(st[st.length-1])};he||Be==null||Be(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,he=Q.expandedKeys,pe=Q.flattenNodes,Ae=$.expanded,Xe=$.key,We=$.isLeaf;if(!(We||X.shiftKey||X.metaKey||X.ctrlKey)){var ze=pe.filter(function(Be){return Be.key===Xe})[0],Ke=(0,$e.F)((0,be.Z)((0,be.Z)({},(0,$e.H8)(Xe,q.getTreeNodeRequiredProps())),{},{data:ze.data}));q.setExpandedKeys(Ae?(0,kt._5)(he,Xe):(0,kt.L0)(he,Xe)),q.onNodeExpand(X,Ke)}}),(0,Z.Z)((0,ve.Z)(q),"onNodeClick",function(X,$){var Q=q.props,he=Q.onClick,pe=Q.expandAction;pe==="click"&&q.triggerExpandActionExpand(X,$),he==null||he(X,$)}),(0,Z.Z)((0,ve.Z)(q),"onNodeDoubleClick",function(X,$){var Q=q.props,he=Q.onDoubleClick,pe=Q.expandAction;pe==="doubleClick"&&q.triggerExpandActionExpand(X,$),he==null||he(X,$)}),(0,Z.Z)((0,ve.Z)(q),"onNodeSelect",function(X,$){var Q=q.state.selectedKeys,he=q.state,pe=he.keyEntities,Ae=he.fieldNames,Xe=q.props,We=Xe.onSelect,ze=Xe.multiple,Ke=$.selected,Be=$[Ae.key],mt=!Ke;mt?ze?Q=(0,kt.L0)(Q,Be):Q=[Be]:Q=(0,kt._5)(Q,Be);var Oe=Q.map(function(st){var Bt=(0,gt.Z)(pe,st);return Bt?Bt.node:null}).filter(Boolean);q.setUncontrolledState({selectedKeys:Q}),We==null||We(Q,{event:"select",selected:mt,node:$,selectedNodes:Oe,nativeEvent:X.nativeEvent})}),(0,Z.Z)((0,ve.Z)(q),"onNodeCheck",function(X,$,Q){var he=q.state,pe=he.keyEntities,Ae=he.checkedKeys,Xe=he.halfCheckedKeys,We=q.props,ze=We.checkStrictly,Ke=We.onCheck,Be=$.key,mt,Oe={event:"check",node:$,checked:Q,nativeEvent:X.nativeEvent};if(ze){var st=Q?(0,kt.L0)(Ae,Be):(0,kt._5)(Ae,Be),Bt=(0,kt._5)(Xe,Be);mt={checked:st,halfChecked:Bt},Oe.checkedNodes=st.map(function(Gt){return(0,gt.Z)(pe,Gt)}).filter(Boolean).map(function(Gt){return Gt.node}),q.setUncontrolledState({checkedKeys:st})}else{var yt=(0,Ye.S)([].concat((0,ce.Z)(Ae),[Be]),!0,pe),ft=yt.checkedKeys,jt=yt.halfCheckedKeys;if(!Q){var si=new Set(ft);si.delete(Be);var ti=(0,Ye.S)(Array.from(si),{checked:!1,halfCheckedKeys:jt},pe);ft=ti.checkedKeys,jt=ti.halfCheckedKeys}mt=ft,Oe.checkedNodes=[],Oe.checkedNodesPositions=[],Oe.halfCheckedKeys=jt,ft.forEach(function(Gt){var ri=(0,gt.Z)(pe,Gt);if(ri){var Rt=ri.node,ut=ri.pos;Oe.checkedNodes.push(Rt),Oe.checkedNodesPositions.push({node:Rt,pos:ut})}}),q.setUncontrolledState({checkedKeys:ft},!1,{halfCheckedKeys:jt})}Ke==null||Ke(mt,Oe)}),(0,Z.Z)((0,ve.Z)(q),"onNodeLoad",function(X){var $,Q=X.key,he=q.state.keyEntities,pe=(0,gt.Z)(he,Q);if(!(pe!=null&&($=pe.children)!==null&&$!==void 0&&$.length)){var Ae=new Promise(function(Xe,We){q.setState(function(ze){var Ke=ze.loadedKeys,Be=Ke===void 0?[]:Ke,mt=ze.loadingKeys,Oe=mt===void 0?[]:mt,st=q.props,Bt=st.loadData,yt=st.onLoad;if(!Bt||Be.includes(Q)||Oe.includes(Q))return null;var ft=Bt(X);return ft.then(function(){var jt=q.state.loadedKeys,si=(0,kt.L0)(jt,Q);yt==null||yt(si,{event:"load",node:X}),q.setUncontrolledState({loadedKeys:si}),q.setState(function(ti){return{loadingKeys:(0,kt._5)(ti.loadingKeys,Q)}}),Xe()}).catch(function(jt){if(q.setState(function(ti){return{loadingKeys:(0,kt._5)(ti.loadingKeys,Q)}}),q.loadingRetryTimes[Q]=(q.loadingRetryTimes[Q]||0)+1,q.loadingRetryTimes[Q]>=Je){var si=q.state.loadedKeys;(0,A.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),q.setUncontrolledState({loadedKeys:(0,kt.L0)(si,Q)}),Xe()}We(jt)}),{loadingKeys:(0,kt.L0)(Oe,Q)}})});return Ae.catch(function(){}),Ae}}),(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($),he=0;he<$;he++)Q[he]=arguments[he];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($),he=0;he<$;he++)Q[he]=arguments[he];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,he=X.loadedKeys,pe=X.loadingKeys,Ae=X.checkedKeys,Xe=X.halfCheckedKeys,We=X.dragOverNodeKey,ze=X.dropPosition,Ke=X.keyEntities;return{expandedKeys:$||[],selectedKeys:Q||[],loadedKeys:he||[],loadingKeys:pe||[],checkedKeys:Ae||[],halfCheckedKeys:Xe||[],dragOverNodeKey:We,dropPosition:ze,keyEntities:Ke}}),(0,Z.Z)((0,ve.Z)(q),"setExpandedKeys",function(X){var $=q.state,Q=$.treeData,he=$.fieldNames,pe=(0,$e.oH)(Q,X,he);q.setUncontrolledState({expandedKeys:X,flattenNodes:pe},!0)}),(0,Z.Z)((0,ve.Z)(q),"onNodeExpand",function(X,$){var Q=q.state.expandedKeys,he=q.state,pe=he.listChanging,Ae=he.fieldNames,Xe=q.props,We=Xe.onExpand,ze=Xe.loadData,Ke=$.expanded,Be=$[Ae.key];if(!pe){var mt=Q.includes(Be),Oe=!Ke;if((0,A.ZP)(Ke&&mt||!Ke&&!mt,"Expand state not sync with index check"),Q=Oe?(0,kt.L0)(Q,Be):(0,kt._5)(Q,Be),q.setExpandedKeys(Q),We==null||We(Q,{node:$,expanded:Oe,nativeEvent:X.nativeEvent}),Oe&&ze){var st=q.onNodeLoad($);st&&st.then(function(){var Bt=(0,$e.oH)(q.state.treeData,Q,Ae);q.setUncontrolledState({flattenNodes:Bt})}).catch(function(){var Bt=q.state.expandedKeys,yt=(0,kt._5)(Bt,Be);q.setExpandedKeys(yt)})}}}),(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,he=Q.onActiveChange,pe=Q.itemScrollOffset,Ae=pe===void 0?0:pe;$!==X&&(q.setState({activeKey:X}),X!==null&&q.scrollTo({key:X,offset:Ae}),he==null||he(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(he){var pe=he.key;return pe===$})||null}),(0,Z.Z)((0,ve.Z)(q),"offsetActiveKey",function(X){var $=q.state,Q=$.flattenNodes,he=$.activeKey,pe=Q.findIndex(function(We){var ze=We.key;return ze===he});pe===-1&&X<0&&(pe=Q.length),pe=(pe+X+Q.length)%Q.length;var Ae=Q[pe];if(Ae){var Xe=Ae.key;q.onActiveChange(Xe)}else q.onActiveChange(null)}),(0,Z.Z)((0,ve.Z)(q),"onKeyDown",function(X){var $=q.state,Q=$.activeKey,he=$.expandedKeys,pe=$.checkedKeys,Ae=$.fieldNames,Xe=q.props,We=Xe.onKeyDown,ze=Xe.checkable,Ke=Xe.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 Be=q.getActiveItem();if(Be&&Be.data){var mt=q.getTreeNodeRequiredProps(),Oe=Be.data.isLeaf===!1||!!(Be.data[Ae.children]||[]).length,st=(0,$e.F)((0,be.Z)((0,be.Z)({},(0,$e.H8)(Q,mt)),{},{data:Be.data,active:!0}));switch(X.which){case v.Z.LEFT:{Oe&&he.includes(Q)?q.onNodeExpand({},st):Be.parent&&q.onActiveChange(Be.parent.key),X.preventDefault();break}case v.Z.RIGHT:{Oe&&!he.includes(Q)?q.onNodeExpand({},st):Be.children&&Be.children.length&&q.onActiveChange(Be.children[0].key),X.preventDefault();break}case v.Z.ENTER:case v.Z.SPACE:{ze&&!st.disabled&&st.checkable!==!1&&!st.disableCheckbox?q.onNodeCheck({},st,!pe.includes(Q)):!ze&&Ke&&!st.disabled&&st.selectable!==!1&&q.onNodeSelect({},st);break}}}We==null||We(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 he=!1,pe=!0,Ae={};Object.keys(X).forEach(function(Xe){if(q.props.hasOwnProperty(Xe)){pe=!1;return}he=!0,Ae[Xe]=X[Xe]}),he&&(!$||pe)&&q.setState((0,be.Z)((0,be.Z)({},Ae),Q))}}),(0,Z.Z)((0,ve.Z)(q),"scrollTo",function(X){q.listRef.current.scrollTo(X)}),q}return(0,p.Z)(we,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var W=this.props,Y=W.activeKey,re=W.itemScrollOffset,X=re===void 0?0:re;Y!==void 0&&Y!==this.state.activeKey&&(this.setState({activeKey:Y}),Y!==null&&this.scrollTo({key:Y,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,Y=W.focused,re=W.flattenNodes,X=W.keyEntities,$=W.draggingNodeKey,Q=W.activeKey,he=W.dropLevelOffset,pe=W.dropContainerKey,Ae=W.dropTargetKey,Xe=W.dropPosition,We=W.dragOverNodeKey,ze=W.indent,Ke=this.props,Be=Ke.prefixCls,mt=Ke.className,Oe=Ke.style,st=Ke.showLine,Bt=Ke.focusable,yt=Ke.tabIndex,ft=yt===void 0?0:yt,jt=Ke.selectable,si=Ke.showIcon,ti=Ke.icon,Gt=Ke.switcherIcon,ri=Ke.draggable,Rt=Ke.checkable,ut=Ke.checkStrictly,nt=Ke.disabled,Mt=Ke.motion,Ht=Ke.loadData,Tt=Ke.filterTreeNode,_t=Ke.height,At=Ke.itemHeight,vi=Ke.scrollWidth,Zt=Ke.virtual,Xt=Ke.titleRender,Dt=Ke.dropIndicatorRender,Ve=Ke.onContextMenu,h=Ke.onScroll,m=Ke.direction,y=Ke.rootClassName,k=Ke.rootStyle,H=(0,E.Z)(this.props,{aria:!0,data:!0}),ge;ri&&((0,me.Z)(ri)==="object"?ge=ri:typeof ri=="function"?ge={nodeDraggable:ri}:ge={});var de={prefixCls:Be,selectable:jt,showIcon:si,icon:ti,switcherIcon:Gt,draggable:ge,draggingNodeKey:$,checkable:Rt,checkStrictly:ut,disabled:nt,keyEntities:X,dropLevelOffset:he,dropContainerKey:pe,dropTargetKey:Ae,dropPosition:Xe,dragOverNodeKey:We,indent:ze,direction:m,dropIndicatorRender:Dt,loadData:Ht,filterTreeNode:Tt,titleRender:Xt,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 O.createElement(j.k.Provider,{value:de},O.createElement("div",{className:g()(Be,mt,y,(0,Z.Z)((0,Z.Z)((0,Z.Z)({},"".concat(Be,"-show-line"),st),"".concat(Be,"-focused"),Y),"".concat(Be,"-active-focused"),Q!==null)),style:k},O.createElement(Qe,(0,N.Z)({ref:this.listRef,prefixCls:Be,style:Oe,data:re,disabled:nt,selectable:jt,checkable:!!Rt,motion:Mt,dragging:$!==null,height:_t,itemHeight:At,virtual:Zt,focusable:Bt,focused:Y,tabIndex:ft,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:Ve,onScroll:h,scrollWidth:vi},this.getTreeNodeRequiredProps(),H))))}}],[{key:"getDerivedStateFromProps",value:function(W,Y){var re=Y.prevProps,X={prevProps:W};function $(ft){return!re&&W.hasOwnProperty(ft)||re&&re[ft]!==W[ft]}var Q,he=Y.fieldNames;if($("fieldNames")&&(he=(0,$e.w$)(W.fieldNames),X.fieldNames=he),$("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 pe=(0,$e.I8)(Q,{fieldNames:he});X.keyEntities=(0,be.Z)((0,Z.Z)({},K,Ee),pe.keyEntities)}var Ae=X.keyEntities||Y.keyEntities;if($("expandedKeys")||re&&$("autoExpandParent"))X.expandedKeys=W.autoExpandParent||!re&&W.defaultExpandParent?(0,kt.r7)(W.expandedKeys,Ae):W.expandedKeys;else if(!re&&W.defaultExpandAll){var Xe=(0,be.Z)({},Ae);delete Xe[K];var We=[];Object.keys(Xe).forEach(function(ft){var jt=Xe[ft];jt.children&&jt.children.length&&We.push(jt.key)}),X.expandedKeys=We}else!re&&W.defaultExpandedKeys&&(X.expandedKeys=W.autoExpandParent||W.defaultExpandParent?(0,kt.r7)(W.defaultExpandedKeys,Ae):W.defaultExpandedKeys);if(X.expandedKeys||delete X.expandedKeys,Q||X.expandedKeys){var ze=(0,$e.oH)(Q||Y.treeData,X.expandedKeys||Y.expandedKeys,he);X.flattenNodes=ze}if(W.selectable&&($("selectedKeys")?X.selectedKeys=(0,kt.BT)(W.selectedKeys,W):!re&&W.defaultSelectedKeys&&(X.selectedKeys=(0,kt.BT)(W.defaultSelectedKeys,W))),W.checkable){var Ke;if($("checkedKeys")?Ke=(0,kt.E6)(W.checkedKeys)||{}:!re&&W.defaultCheckedKeys?Ke=(0,kt.E6)(W.defaultCheckedKeys)||{}:Q&&(Ke=(0,kt.E6)(W.checkedKeys)||{checkedKeys:Y.checkedKeys,halfCheckedKeys:Y.halfCheckedKeys}),Ke){var Be=Ke,mt=Be.checkedKeys,Oe=mt===void 0?[]:mt,st=Be.halfCheckedKeys,Bt=st===void 0?[]:st;if(!W.checkStrictly){var yt=(0,Ye.S)(Oe,!0,Ae);Oe=yt.checkedKeys,Bt=yt.halfCheckedKeys}X.checkedKeys=Oe,X.halfCheckedKeys=Bt}}return $("loadedKeys")&&(X.loadedKeys=W.loadedKeys),X}}]),we}(O.Component);(0,Z.Z)(Me,"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)(Me,"TreeNode",ye.Z);var _e=Me,Re=_e},82661:function(Wt,at,U){"use strict";U.d(at,{BT:function(){return O},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 C}});var N=U(94480),me=U(76190),be=U(48736),ce=U(59301),G=U(639),p=U(65065),ve=U(34061),oe=null;function l(w,R){if(!w)return[];var z=w.slice(),ne=z.indexOf(R);return ne>=0&&z.splice(ne,1),z}function Z(w,R){var z=(w||[]).slice();return z.indexOf(R)===-1&&z.push(R),z}function C(w){return w.split("-")}function g(w,R){var z=[],ne=(0,p.Z)(R,w);function ie(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];ye.forEach(function(De){var xe=De.key,$e=De.children;z.push(xe),ie($e)})}return ie(ne.children),z}function v(w){if(w.parent){var R=C(w.pos);return Number(R[R.length-1])===w.parent.children.length-1}return!1}function E(w){var R=C(w.pos);return Number(R[R.length-1])===0}function A(w,R,z,ne,ie,ye,De,xe,$e,J){var D,M=w.clientX,P=w.clientY,ae=w.target.getBoundingClientRect(),te=ae.top,S=ae.height,b=(J==="rtl"?-1:1)*(((ie==null?void 0:ie.x)||0)-M),K=(b-12)/ne,le=$e.filter(function(Re){var ee;return(ee=xe[Re])===null||ee===void 0||(ee=ee.children)===null||ee===void 0?void 0:ee.length}),Ee=(0,p.Z)(xe,z.eventKey);if(P<te+S/2){var Fe=De.findIndex(function(Re){return Re.key===Ee.key}),et=Fe<=0?0:Fe-1,Et=De[et].key;Ee=(0,p.Z)(xe,Et)}var It=Ee.key,Jt=Ee,Qe=Ee.key,kt=0,Ye=0;if(!le.includes(It))for(var gt=0;gt<K&&v(Ee);gt+=1)Ee=Ee.parent,Ye+=1;var Je=R.data,Me=Ee.node,_e=!0;return E(Ee)&&Ee.level===0&&P<te+S/2&&ye({dragNode:Je,dropNode:Me,dropPosition:-1})&&Ee.key===z.eventKey?kt=-1:(Jt.children||[]).length&&le.includes(Qe)?ye({dragNode:Je,dropNode:Me,dropPosition:0})?kt=0:_e=!1:Ye===0?K>-1.5?ye({dragNode:Je,dropNode:Me,dropPosition:1})?kt=1:_e=!1:ye({dragNode:Je,dropNode:Me,dropPosition:0})?kt=0:ye({dragNode:Je,dropNode:Me,dropPosition:1})?kt=1:_e=!1:ye({dragNode:Je,dropNode:Me,dropPosition:1})?kt=1:_e=!1,{dropPosition:kt,dropLevelOffset:Ye,dropTargetKey:Ee.key,dropTargetPos:Ee.pos,dragOverNodeKey:Qe,dropContainerKey:kt===0?null:((D=Ee.parent)===null||D===void 0?void 0:D.key)||null,dropAllowed:_e}}function O(w,R){if(w){var z=R.multiple;return z?w.slice():w.length?[w[0]]:w}}var j=function(R){return R};function V(w,R){if(!w)return[];var z=R||{},ne=z.processProps,ie=ne===void 0?j:ne,ye=Array.isArray(w)?w:[w];return ye.map(function(De){var xe=De.children,$e=_objectWithoutProperties(De,oe),J=V(xe,R);return React.createElement(TreeNode,_extends({key:$e.key},ie($e)),J)})}function L(w){if(!w)return null;var R;if(Array.isArray(w))R={checkedKeys:w,halfCheckedKeys:void 0};else if((0,me.Z)(w)==="object")R={checkedKeys:w.checked||void 0,halfCheckedKeys:w.halfChecked||void 0};else return(0,be.ZP)(!1,"`checkedKeys` is not an array or an object"),null;return R}function I(w,R){var z=new Set;function ne(ie){if(!z.has(ie)){var ye=(0,p.Z)(R,ie);if(ye){z.add(ie);var De=ye.parent,xe=ye.node;xe.disabled||De&&ne(De.key)}}}return(w||[]).forEach(function(ie){ne(ie)}),(0,N.Z)(z)}},34643:function(Wt,at,U){"use strict";U.d(at,{S:function(){return ve}});var N=U(48736),me=U(65065);function be(oe,l){var Z=new Set;return oe.forEach(function(C){l.has(C)||Z.add(C)}),Z}function ce(oe){var l=oe||{},Z=l.disabled,C=l.disableCheckbox,g=l.checkable;return!!(Z||C)||g===!1}function G(oe,l,Z,C){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,z=R===void 0?[]:R;g.has(I)&&!C(w)&&z.filter(function(ne){return!C(ne.node)}).forEach(function(ne){g.add(ne.key)})})}for(var O=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(!(C(w)||!L.parent||O.has(L.parent.key))){if(C(L.parent.node)){O.add(I.key);return}var R=!0,z=!1;(I.children||[]).filter(function(ne){return!C(ne.node)}).forEach(function(ne){var ie=ne.key,ye=g.has(ie);R&&!ye&&(R=!1),!z&&(ye||v.has(ie))&&(z=!0)}),R&&g.add(I.key),z&&v.add(I.key),O.add(I.key)}})}return{checkedKeys:Array.from(g),halfCheckedKeys:Array.from(be(v,g))}}function p(oe,l,Z,C,g){for(var v=new Set(oe),E=new Set(l),A=0;A<=C;A+=1){var O=Z.get(A)||new Set;O.forEach(function(I){var w=I.key,R=I.node,z=I.children,ne=z===void 0?[]:z;!v.has(w)&&!E.has(w)&&!g(R)&&ne.filter(function(ie){return!g(ie.node)}).forEach(function(ie){v.delete(ie.key)})})}E=new Set;for(var j=new Set,V=C;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 z=!0,ne=!1;(w.children||[]).filter(function(ie){return!g(ie.node)}).forEach(function(ie){var ye=ie.key,De=v.has(ye);z&&!De&&(z=!1),!ne&&(De||E.has(ye))&&(ne=!0)}),z||v.delete(w.key),ne&&E.add(w.key),j.add(w.key)}})}return{checkedKeys:Array.from(v),halfCheckedKeys:Array.from(be(E,v))}}function ve(oe,l,Z,C){var g=[],v;C?v=C:v=ce;var E=new Set(oe.filter(function(V){var L=!!(0,me.Z)(Z,V);return L||g.push(V),L})),A=new Map,O=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),O=Math.max(O,I)}),(0,N.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,O,v):j=p(E,l.halfCheckedKeys,A,O,v),j}},65065:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return N}});function N(me,be){return me[be]}},34061:function(Wt,at,U){"use strict";U.d(at,{F:function(){return I},H8:function(){return L},I8:function(){return V},km:function(){return g},oH:function(){return O},w$:function(){return v},zn:function(){return A}});var N=U(76190),me=U(94480),be=U(33885),ce=U(75931),G=U(11592),p=U(2738),ve=U(48736),oe=U(65065),l=["children"];function Z(w,R){return"".concat(w,"-").concat(R)}function C(w){return w&&w.type&&w.type.isTreeNode}function g(w,R){return w!=null?w:R}function v(w){var R=w||{},z=R.title,ne=R._title,ie=R.key,ye=R.children,De=z||"title";return{title:De,_title:ne||[De],key:ie||"key",children:ye||"children"}}function E(w,R){var z=new Map;function ne(ie){var ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(ie||[]).forEach(function(De){var xe=De[R.key],$e=De[R.children];warning(xe!=null,"Tree node must have a certain key: [".concat(ye).concat(xe,"]"));var J=String(xe);warning(!z.has(J)||xe===null||xe===void 0,"Same 'key' exist in the Tree: ".concat(J)),z.set(J,!0),ne($e,"".concat(ye).concat(J," > "))})}ne(w)}function A(w){function R(z){var ne=(0,G.Z)(z);return ne.map(function(ie){if(!C(ie))return(0,ve.ZP)(!ie,"Tree/TreeNode can only accept TreeNode as children."),null;var ye=ie.key,De=ie.props,xe=De.children,$e=(0,ce.Z)(De,l),J=(0,be.Z)({key:ye},$e),D=R(xe);return D.length&&(J.children=D),J}).filter(function(ie){return ie})}return R(w)}function O(w,R,z){var ne=v(z),ie=ne._title,ye=ne.key,De=ne.children,xe=new Set(R===!0?[]:R),$e=[];function J(D){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return D.map(function(P,ae){for(var te=Z(M?M.pos:"0",ae),S=g(P[ye],te),b,K=0;K<ie.length;K+=1){var le=ie[K];if(P[le]!==void 0){b=P[le];break}}var Ee=Object.assign((0,p.Z)(P,[].concat((0,me.Z)(ie),[ye,De])),{title:b,key:S,parent:M,pos:te,children:null,data:P,isStart:[].concat((0,me.Z)(M?M.isStart:[]),[ae===0]),isEnd:[].concat((0,me.Z)(M?M.isEnd:[]),[ae===D.length-1])});return $e.push(Ee),R===!0||xe.has(S)?Ee.children=J(P[De]||[],Ee):Ee.children=[],Ee})}return J(w),$e}function j(w,R,z){var ne={};(0,N.Z)(z)==="object"?ne=z:ne={externalGetKey:z},ne=ne||{};var ie=ne,ye=ie.childrenPropName,De=ie.externalGetKey,xe=ie.fieldNames,$e=v(xe),J=$e.key,D=$e.children,M=ye||D,P;De?typeof De=="string"?P=function(S){return S[De]}:typeof De=="function"&&(P=function(S){return De(S)}):P=function(S,b){return g(S[J],b)};function ae(te,S,b,K){var le=te?te[M]:w,Ee=te?Z(b.pos,S):"0",Fe=te?[].concat((0,me.Z)(K),[te]):[];if(te){var et=P(te,Ee),Et={node:te,index:S,pos:Ee,key:et,parentPos:b.node?b.pos:null,level:b.level+1,nodes:Fe};R(Et)}le&&le.forEach(function(It,Jt){ae(It,Jt,{node:te,pos:Ee,level:b?b.level+1:-1},Fe)})}ae(null)}function V(w){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=R.initWrapper,ne=R.processEntity,ie=R.onProcessFinished,ye=R.externalGetKey,De=R.childrenPropName,xe=R.fieldNames,$e=arguments.length>2?arguments[2]:void 0,J=ye||$e,D={},M={},P={posEntities:D,keyEntities:M};return z&&(P=z(P)||P),j(w,function(ae){var te=ae.node,S=ae.index,b=ae.pos,K=ae.key,le=ae.parentPos,Ee=ae.level,Fe=ae.nodes,et={node:te,nodes:Fe,index:S,key:K,pos:b,level:Ee},Et=g(K,b);D[b]=et,M[Et]=et,et.parent=D[le],et.parent&&(et.parent.children=et.parent.children||[],et.parent.children.push(et)),ne&&ne(et,P)},{externalGetKey:J,childrenPropName:De,fieldNames:xe}),ie&&ie(P),P}function L(w,R){var z=R.expandedKeys,ne=R.selectedKeys,ie=R.loadedKeys,ye=R.loadingKeys,De=R.checkedKeys,xe=R.halfCheckedKeys,$e=R.dragOverNodeKey,J=R.dropPosition,D=R.keyEntities,M=(0,oe.Z)(D,w),P={eventKey:w,expanded:z.indexOf(w)!==-1,selected:ne.indexOf(w)!==-1,loaded:ie.indexOf(w)!==-1,loading:ye.indexOf(w)!==-1,checked:De.indexOf(w)!==-1,halfChecked:xe.indexOf(w)!==-1,pos:String(M?M.pos:""),dragOver:$e===w&&J===0,dragOverGapTop:$e===w&&J===-1,dragOverGapBottom:$e===w&&J===1};return P}function I(w){var R=w.data,z=w.expanded,ne=w.selected,ie=w.checked,ye=w.loaded,De=w.loading,xe=w.halfChecked,$e=w.dragOver,J=w.dragOverGapTop,D=w.dragOverGapBottom,M=w.pos,P=w.active,ae=w.eventKey,te=(0,be.Z)((0,be.Z)({},R),{},{expanded:z,selected:ne,checked:ie,loaded:ye,loading:De,halfChecked:xe,dragOver:$e,dragOverGapTop:J,dragOverGapBottom:D,pos:M,active:P,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(Wt,at){"use strict";at.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))}},48911:function(Wt,at,U){"use strict";U.d(at,{Z:function(){return Je}});var N=U(54476),me=U(76190),be=U(33885),ce=U(20068),G=U(42978),p=U(75931),ve=U(92310),oe=U.n(ve),l=U(29301),Z=U(70425),C=U(34280),g=U(59301),v=U(4676),E=g.forwardRef(function(Me,_e){var Re=Me.height,ee=Me.offsetY,Le=Me.offsetX,we=Me.children,q=Me.prefixCls,W=Me.onInnerResize,Y=Me.innerProps,re=Me.rtl,X=Me.extra,$={},Q={display:"flex",flexDirection:"column"};return ee!==void 0&&($={height:Re,position:"relative",overflow:"hidden"},Q=(0,be.Z)((0,be.Z)({},Q),{},(0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)((0,ce.Z)({transform:"translateY(".concat(ee,"px)")},re?"marginRight":"marginLeft",-Le),"position","absolute"),"left",0),"right",0),"top",0))),g.createElement("div",{style:$},g.createElement(l.Z,{onResize:function(pe){var Ae=pe.offsetHeight;Ae&&W&&W()}},g.createElement("div",(0,N.Z)({style:Q,className:oe()((0,ce.Z)({},"".concat(q,"-holder-inner"),q)),ref:_e},Y),we,X)))});E.displayName="Filler";var A=E;function O(Me){var _e=Me.children,Re=Me.setRef,ee=g.useCallback(function(Le){Re(Le)},[]);return g.cloneElement(_e,{ref:ee})}function j(Me,_e,Re,ee,Le,we,q,W){var Y=W.getKey;return Me.slice(_e,Re+1).map(function(re,X){var $=_e+X,Q=q(re,$,{style:{width:ee},offsetX:Le}),he=Y(re);return g.createElement(O,{key:he,setRef:function(Ae){return we(re,Ae)}},Q)})}function V(Me,_e,Re,ee){var Le=Re-Me,we=_e-Re,q=Math.min(Le,we)*2;if(ee<=q){var W=Math.floor(ee/2);return ee%2?Re+W+1:Re-W}return Le>we?Re-(ee-we):Re+(ee-Le)}function L(Me,_e,Re){var ee=Me.length,Le=_e.length,we,q;if(ee===0&&Le===0)return null;ee<Le?(we=Me,q=_e):(we=_e,q=Me);var W={__EMPTY_ITEM__:!0};function Y(pe){return pe!==void 0?Re(pe):W}for(var re=null,X=Math.abs(ee-Le)!==1,$=0;$<q.length;$+=1){var Q=Y(we[$]),he=Y(q[$]);if(Q!==he){re=$,X=X||Q!==Y(q[$+1]);break}}return re===null?null:{index:re,multiple:X}}function I(Me,_e,Re){var ee=g.useState(Me),Le=(0,G.Z)(ee,2),we=Le[0],q=Le[1],W=g.useState(null),Y=(0,G.Z)(W,2),re=Y[0],X=Y[1];return g.useEffect(function(){var $=L(we||[],Me||[],_e);($==null?void 0:$.index)!==void 0&&(Re==null||Re($.index),X(Me[$.index])),q(Me)},[Me]),[re]}var w=U(16089),R=(typeof navigator=="undefined"?"undefined":(0,me.Z)(navigator))==="object"&&/Firefox/i.test(navigator.userAgent),z=R,ne=function(Me,_e,Re,ee){var Le=(0,g.useRef)(!1),we=(0,g.useRef)(null);function q(){clearTimeout(we.current),Le.current=!0,we.current=setTimeout(function(){Le.current=!1},50)}var W=(0,g.useRef)({top:Me,bottom:_e,left:Re,right:ee});return W.current.top=Me,W.current.bottom=_e,W.current.left=Re,W.current.right=ee,function(Y,re){var X=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,$=Y?re<0&&W.current.left||re>0&&W.current.right:re<0&&W.current.top||re>0&&W.current.bottom;return X&&$?(clearTimeout(we.current),Le.current=!1):(!$||Le.current)&&q(),!Le.current&&$}};function ie(Me,_e,Re,ee,Le,we,q){var W=(0,g.useRef)(0),Y=(0,g.useRef)(null),re=(0,g.useRef)(null),X=(0,g.useRef)(!1),$=ne(_e,Re,ee,Le);function Q(ze,Ke){if(w.Z.cancel(Y.current),!$(!1,Ke)){var Be=ze;if(!Be._virtualHandled)Be._virtualHandled=!0;else return;W.current+=Ke,re.current=Ke,z||Be.preventDefault(),Y.current=(0,w.Z)(function(){var mt=X.current?10:1;q(W.current*mt,!1),W.current=0})}}function he(ze,Ke){q(Ke,!0),z||ze.preventDefault()}var pe=(0,g.useRef)(null),Ae=(0,g.useRef)(null);function Xe(ze){if(Me){w.Z.cancel(Ae.current),Ae.current=(0,w.Z)(function(){pe.current=null},2);var Ke=ze.deltaX,Be=ze.deltaY,mt=ze.shiftKey,Oe=Ke,st=Be;(pe.current==="sx"||!pe.current&&mt&&Be&&!Ke)&&(Oe=Be,st=0,pe.current="sx");var Bt=Math.abs(Oe),yt=Math.abs(st);pe.current===null&&(pe.current=we&&Bt>yt?"x":"y"),pe.current==="y"?Q(ze,st):he(ze,Oe)}}function We(ze){Me&&(X.current=ze.detail===re.current)}return[Xe,We]}function ye(Me,_e,Re,ee){var Le=g.useMemo(function(){return[new Map,[]]},[Me,Re.id,ee]),we=(0,G.Z)(Le,2),q=we[0],W=we[1],Y=function(X){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:X,Q=q.get(X),he=q.get($);if(Q===void 0||he===void 0)for(var pe=Me.length,Ae=W.length;Ae<pe;Ae+=1){var Xe,We=Me[Ae],ze=_e(We);q.set(ze,Ae);var Ke=(Xe=Re.get(ze))!==null&&Xe!==void 0?Xe:ee;if(W[Ae]=(W[Ae-1]||0)+Ke,ze===X&&(Q=Ae),ze===$&&(he=Ae),Q!==void 0&&he!==void 0)break}return{top:W[Q-1]||0,bottom:W[he]}};return Y}var De=U(67732),xe=U(83652),$e=function(){function Me(){(0,De.Z)(this,Me),(0,ce.Z)(this,"maps",void 0),(0,ce.Z)(this,"id",0),(0,ce.Z)(this,"diffRecords",new Map),this.maps=Object.create(null)}return(0,xe.Z)(Me,[{key:"set",value:function(Re,ee){this.diffRecords.set(Re,this.maps[Re]),this.maps[Re]=ee,this.id+=1}},{key:"get",value:function(Re){return this.maps[Re]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),Me}(),J=$e;function D(Me){var _e=parseFloat(Me);return isNaN(_e)?0:_e}function M(Me,_e,Re){var ee=g.useState(0),Le=(0,G.Z)(ee,2),we=Le[0],q=Le[1],W=(0,g.useRef)(new Map),Y=(0,g.useRef)(new J),re=(0,g.useRef)(0);function X(){re.current+=1}function $(){var he=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;X();var pe=function(){var We=!1;W.current.forEach(function(ze,Ke){if(ze&&ze.offsetParent){var Be=ze.offsetHeight,mt=getComputedStyle(ze),Oe=mt.marginTop,st=mt.marginBottom,Bt=D(Oe),yt=D(st),ft=Be+Bt+yt;Y.current.get(Ke)!==ft&&(Y.current.set(Ke,ft),We=!0)}}),We&&q(function(ze){return ze+1})};if(he)pe();else{re.current+=1;var Ae=re.current;Promise.resolve().then(function(){Ae===re.current&&pe()})}}function Q(he,pe){var Ae=Me(he),Xe=W.current.get(Ae);pe?(W.current.set(Ae,pe),$()):W.current.delete(Ae),!Xe!=!pe&&(pe?_e==null||_e(he):Re==null||Re(he))}return(0,g.useEffect)(function(){return X},[]),[Q,$,Y.current,we]}var P=14/15;function ae(Me,_e,Re){var ee=(0,g.useRef)(!1),Le=(0,g.useRef)(0),we=(0,g.useRef)(0),q=(0,g.useRef)(null),W=(0,g.useRef)(null),Y,re=function(he){if(ee.current){var pe=Math.ceil(he.touches[0].pageX),Ae=Math.ceil(he.touches[0].pageY),Xe=Le.current-pe,We=we.current-Ae,ze=Math.abs(Xe)>Math.abs(We);ze?Le.current=pe:we.current=Ae;var Ke=Re(ze,ze?Xe:We,!1,he);Ke&&he.preventDefault(),clearInterval(W.current),Ke&&(W.current=setInterval(function(){ze?Xe*=P:We*=P;var Be=Math.floor(ze?Xe:We);(!Re(ze,Be,!0)||Math.abs(Be)<=.1)&&clearInterval(W.current)},16))}},X=function(){ee.current=!1,Y()},$=function(he){Y(),he.touches.length===1&&!ee.current&&(ee.current=!0,Le.current=Math.ceil(he.touches[0].pageX),we.current=Math.ceil(he.touches[0].pageY),q.current=he.target,q.current.addEventListener("touchmove",re,{passive:!1}),q.current.addEventListener("touchend",X,{passive:!0}))};Y=function(){q.current&&(q.current.removeEventListener("touchmove",re),q.current.removeEventListener("touchend",X))},(0,C.Z)(function(){return Me&&_e.current.addEventListener("touchstart",$,{passive:!0}),function(){var Q;(Q=_e.current)===null||Q===void 0||Q.removeEventListener("touchstart",$),Y(),clearInterval(W.current)}},[Me])}function te(Me){return Math.floor(Math.pow(Me,.5))}function S(Me,_e){var Re="touches"in Me?Me.touches[0]:Me;return Re[_e?"pageX":"pageY"]-window[_e?"scrollX":"scrollY"]}function b(Me,_e,Re){g.useEffect(function(){var ee=_e.current;if(Me&&ee){var Le=!1,we,q,W=function(){w.Z.cancel(we)},Y=function Q(){W(),we=(0,w.Z)(function(){Re(q),Q()})},re=function(){Le=!1,W()},X=function(he){if(!(he.target.draggable||he.button!==0)){var pe=he;pe._virtualHandled||(pe._virtualHandled=!0,Le=!0)}},$=function(he){if(Le){var pe=S(he,!1),Ae=ee.getBoundingClientRect(),Xe=Ae.top,We=Ae.bottom;if(pe<=Xe){var ze=Xe-pe;q=-te(ze),Y()}else if(pe>=We){var Ke=pe-We;q=te(Ke),Y()}else W()}};return ee.addEventListener("mousedown",X),ee.ownerDocument.addEventListener("mouseup",re),ee.ownerDocument.addEventListener("mousemove",$),ee.ownerDocument.addEventListener("dragend",re),function(){ee.removeEventListener("mousedown",X),ee.ownerDocument.removeEventListener("mouseup",re),ee.ownerDocument.removeEventListener("mousemove",$),ee.ownerDocument.removeEventListener("dragend",re),W()}}},[Me])}var K=10;function le(Me,_e,Re,ee,Le,we,q,W){var Y=g.useRef(),re=g.useState(null),X=(0,G.Z)(re,2),$=X[0],Q=X[1];return(0,C.Z)(function(){if($&&$.times<K){if(!Me.current){Q(function(Mt){return(0,be.Z)({},Mt)});return}we();var he=$.targetAlign,pe=$.originAlign,Ae=$.index,Xe=$.offset,We=Me.current.clientHeight,ze=!1,Ke=he,Be=null;if(We){for(var mt=he||pe,Oe=0,st=0,Bt=0,yt=Math.min(_e.length-1,Ae),ft=0;ft<=yt;ft+=1){var jt=Le(_e[ft]);st=Oe;var si=Re.get(jt);Bt=st+(si===void 0?ee:si),Oe=Bt}for(var ti=mt==="top"?Xe:We-Xe,Gt=yt;Gt>=0;Gt-=1){var ri=Le(_e[Gt]),Rt=Re.get(ri);if(Rt===void 0){ze=!0;break}if(ti-=Rt,ti<=0)break}switch(mt){case"top":Be=st-Xe;break;case"bottom":Be=Bt-We+Xe;break;default:{var ut=Me.current.scrollTop,nt=ut+We;st<ut?Ke="top":Bt>nt&&(Ke="bottom")}}Be!==null&&q(Be),Be!==$.lastTop&&(ze=!0)}ze&&Q((0,be.Z)((0,be.Z)({},$),{},{times:$.times+1,targetAlign:Ke,lastTop:Be}))}},[$,Me.current]),function(he){if(he==null){W();return}if(w.Z.cancel(Y.current),typeof he=="number")q(he);else if(he&&(0,me.Z)(he)==="object"){var pe,Ae=he.align;"index"in he?pe=he.index:pe=_e.findIndex(function(ze){return Le(ze)===he.key});var Xe=he.offset,We=Xe===void 0?0:Xe;Q({times:0,index:pe,offset:We,originAlign:Ae})}}}var Ee=g.forwardRef(function(Me,_e){var Re=Me.prefixCls,ee=Me.rtl,Le=Me.scrollOffset,we=Me.scrollRange,q=Me.onStartMove,W=Me.onStopMove,Y=Me.onScroll,re=Me.horizontal,X=Me.spinSize,$=Me.containerSize,Q=Me.style,he=Me.thumbStyle,pe=Me.showScrollBar,Ae=g.useState(!1),Xe=(0,G.Z)(Ae,2),We=Xe[0],ze=Xe[1],Ke=g.useState(null),Be=(0,G.Z)(Ke,2),mt=Be[0],Oe=Be[1],st=g.useState(null),Bt=(0,G.Z)(st,2),yt=Bt[0],ft=Bt[1],jt=!ee,si=g.useRef(),ti=g.useRef(),Gt=g.useState(pe),ri=(0,G.Z)(Gt,2),Rt=ri[0],ut=ri[1],nt=g.useRef(),Mt=function(){pe===!0||pe===!1||(clearTimeout(nt.current),ut(!0),nt.current=setTimeout(function(){ut(!1)},3e3))},Ht=we-$||0,Tt=$-X||0,_t=g.useMemo(function(){if(Le===0||Ht===0)return 0;var y=Le/Ht;return y*Tt},[Le,Ht,Tt]),At=function(k){k.stopPropagation(),k.preventDefault()},vi=g.useRef({top:_t,dragging:We,pageY:mt,startTop:yt});vi.current={top:_t,dragging:We,pageY:mt,startTop:yt};var Zt=function(k){ze(!0),Oe(S(k,re)),ft(vi.current.top),q(),k.stopPropagation(),k.preventDefault()};g.useEffect(function(){var y=function(de){de.preventDefault()},k=si.current,H=ti.current;return k.addEventListener("touchstart",y,{passive:!1}),H.addEventListener("touchstart",Zt,{passive:!1}),function(){k.removeEventListener("touchstart",y),H.removeEventListener("touchstart",Zt)}},[]);var Xt=g.useRef();Xt.current=Ht;var Dt=g.useRef();Dt.current=Tt,g.useEffect(function(){if(We){var y,k=function(de){var ke=vi.current,He=ke.dragging,lt=ke.pageY,Lt=ke.startTop;w.Z.cancel(y);var Ot=si.current.getBoundingClientRect(),bt=$/(re?Ot.width:Ot.height);if(He){var Ut=(S(de,re)-lt)*bt,vt=Lt;!jt&&re?vt-=Ut:vt+=Ut;var ht=Xt.current,ot=Dt.current,wt=ot?vt/ot:0,St=Math.ceil(wt*ht);St=Math.max(St,0),St=Math.min(St,ht),y=(0,w.Z)(function(){Y(St,re)})}},H=function(){ze(!1),W()};return window.addEventListener("mousemove",k,{passive:!0}),window.addEventListener("touchmove",k,{passive:!0}),window.addEventListener("mouseup",H,{passive:!0}),window.addEventListener("touchend",H,{passive:!0}),function(){window.removeEventListener("mousemove",k),window.removeEventListener("touchmove",k),window.removeEventListener("mouseup",H),window.removeEventListener("touchend",H),w.Z.cancel(y)}}},[We]),g.useEffect(function(){return Mt(),function(){clearTimeout(nt.current)}},[Le]),g.useImperativeHandle(_e,function(){return{delayHidden:Mt}});var Ve="".concat(Re,"-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,ce.Z)({height:"100%",width:X},jt?"left":"right",_t))):(Object.assign(h,(0,ce.Z)({width:8,top:0,bottom:0},jt?"right":"left",0)),Object.assign(m,{width:"100%",height:X,top:_t})),g.createElement("div",{ref:si,className:oe()(Ve,(0,ce.Z)((0,ce.Z)((0,ce.Z)({},"".concat(Ve,"-horizontal"),re),"".concat(Ve,"-vertical"),!re),"".concat(Ve,"-visible"),Rt)),style:(0,be.Z)((0,be.Z)({},h),Q),onMouseDown:At,onMouseMove:Mt},g.createElement("div",{ref:ti,className:oe()("".concat(Ve,"-thumb"),(0,ce.Z)({},"".concat(Ve,"-thumb-moving"),We)),style:(0,be.Z)((0,be.Z)({},m),he),onMouseDown:Zt}))}),Fe=Ee,et=20;function Et(){var Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,_e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,Re=Me/_e*Me;return isNaN(Re)&&(Re=0),Re=Math.max(Re,et),Math.floor(Re)}var It=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],Jt=[],Qe={overflowY:"auto",overflowAnchor:"none"};function kt(Me,_e){var Re=Me.prefixCls,ee=Re===void 0?"rc-virtual-list":Re,Le=Me.className,we=Me.height,q=Me.itemHeight,W=Me.fullHeight,Y=W===void 0?!0:W,re=Me.style,X=Me.data,$=Me.children,Q=Me.itemKey,he=Me.virtual,pe=Me.direction,Ae=Me.scrollWidth,Xe=Me.component,We=Xe===void 0?"div":Xe,ze=Me.onScroll,Ke=Me.onVirtualScroll,Be=Me.onVisibleChange,mt=Me.innerProps,Oe=Me.extraRender,st=Me.styles,Bt=Me.showScrollBar,yt=Bt===void 0?"optional":Bt,ft=(0,p.Z)(Me,It),jt=g.useCallback(function(ei){return typeof Q=="function"?Q(ei):ei==null?void 0:ei[Q]},[Q]),si=M(jt,null,null),ti=(0,G.Z)(si,4),Gt=ti[0],ri=ti[1],Rt=ti[2],ut=ti[3],nt=!!(he!==!1&&we&&q),Mt=g.useMemo(function(){return Object.values(Rt.maps).reduce(function(ei,Pt){return ei+Pt},0)},[Rt.id,Rt.maps]),Ht=nt&&X&&(Math.max(q*X.length,Mt)>we||!!Ae),Tt=pe==="rtl",_t=oe()(ee,(0,ce.Z)({},"".concat(ee,"-rtl"),Tt),Le),At=X||Jt,vi=(0,g.useRef)(),Zt=(0,g.useRef)(),Xt=(0,g.useRef)(),Dt=(0,g.useState)(0),Ve=(0,G.Z)(Dt,2),h=Ve[0],m=Ve[1],y=(0,g.useState)(0),k=(0,G.Z)(y,2),H=k[0],ge=k[1],de=(0,g.useState)(!1),ke=(0,G.Z)(de,2),He=ke[0],lt=ke[1],Lt=function(){lt(!0)},Ot=function(){lt(!1)},bt={getKey:jt};function Ut(ei){m(function(Pt){var Yt;typeof ei=="function"?Yt=ei(Pt):Yt=ei;var Ni=Si(Yt);return vi.current.scrollTop=Ni,Ni})}var vt=(0,g.useRef)({start:0,end:At.length}),ht=(0,g.useRef)(),ot=I(At,jt),wt=(0,G.Z)(ot,1),St=wt[0];ht.current=St;var pi=g.useMemo(function(){if(!nt)return{scrollHeight:void 0,start:0,end:At.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:At.length-1,offset:void 0}}for(var Pt=0,Yt,Ni,Ui,qi=At.length,on=0;on<qi;on+=1){var ji=At[on],cn=jt(ji),Tn=Rt.get(cn),hn=Pt+(Tn===void 0?q:Tn);hn>=h&&Yt===void 0&&(Yt=on,Ni=Pt),hn>h+we&&Ui===void 0&&(Ui=on),Pt=hn}return Yt===void 0&&(Yt=0,Ni=0,Ui=Math.ceil(we/q)),Ui===void 0&&(Ui=At.length-1),Ui=Math.min(Ui+1,At.length-1),{scrollHeight:Pt,start:Yt,end:Ui,offset:Ni}},[Ht,nt,h,At,ut,we]),zt=pi.scrollHeight,Ft=pi.start,xt=pi.end,ni=pi.offset;vt.current.start=Ft,vt.current.end=xt,g.useLayoutEffect(function(){var ei=Rt.getRecord();if(ei.size===1){var Pt=Array.from(ei.keys())[0],Yt=ei.get(Pt),Ni=At[Ft];if(Ni&&Yt===void 0){var Ui=jt(Ni);if(Ui===Pt){var qi=Rt.get(Pt),on=qi-q;Ut(function(ji){return ji+on})}}}Rt.resetRecord()},[zt]);var mi=g.useState({width:0,height:we}),Te=(0,G.Z)(mi,2),Pe=Te[0],rt=Te[1],qe=function(Pt){rt({width:Pt.offsetWidth,height:Pt.offsetHeight})},Ge=(0,g.useRef)(),tt=(0,g.useRef)(),pt=g.useMemo(function(){return Et(Pe.width,Ae)},[Pe.width,Ae]),Ct=g.useMemo(function(){return Et(Pe.height,zt)},[Pe.height,zt]),ui=zt-we,qt=(0,g.useRef)(ui);qt.current=ui;function Si(ei){var Pt=ei;return Number.isNaN(qt.current)||(Pt=Math.min(Pt,qt.current)),Pt=Math.max(Pt,0),Pt}var ai=h<=0,gi=h>=ui,bi=H<=0,Li=H>=Ae,ki=ne(ai,gi,bi,Li),fi=function(){return{x:Tt?-H:H,y:h}},yi=(0,g.useRef)(fi()),wi=(0,Z.zX)(function(ei){if(Ke){var Pt=(0,be.Z)((0,be.Z)({},fi()),ei);(yi.current.x!==Pt.x||yi.current.y!==Pt.y)&&(Ke(Pt),yi.current=Pt)}});function Ri(ei,Pt){var Yt=ei;Pt?((0,v.flushSync)(function(){ge(Yt)}),wi()):Ut(Yt)}function Ti(ei){var Pt=ei.currentTarget.scrollTop;Pt!==h&&Ut(Pt),ze==null||ze(ei),wi()}var Bi=function(Pt){var Yt=Pt,Ni=Ae?Ae-Pe.width:0;return Yt=Math.max(Yt,0),Yt=Math.min(Yt,Ni),Yt},Di=(0,Z.zX)(function(ei,Pt){Pt?((0,v.flushSync)(function(){ge(function(Yt){var Ni=Yt+(Tt?-ei:ei);return Bi(Ni)})}),wi()):Ut(function(Yt){var Ni=Yt+ei;return Ni})}),Mi=ie(nt,ai,gi,bi,Li,!!Ae,Di),Yi=(0,G.Z)(Mi,2),$i=Yi[0],rn=Yi[1];ae(nt,vi,function(ei,Pt,Yt,Ni){var Ui=Ni;return ki(ei,Pt,Yt)?!1:!Ui||!Ui._virtualHandled?(Ui&&(Ui._virtualHandled=!0),$i({preventDefault:function(){},deltaX:ei?Pt:0,deltaY:ei?0:Pt}),!0):!1}),b(Ht,vi,function(ei){Ut(function(Pt){return Pt+ei})}),(0,C.Z)(function(){function ei(Yt){var Ni=ai&&Yt.detail<0,Ui=gi&&Yt.detail>0;nt&&!Ni&&!Ui&&Yt.preventDefault()}var Pt=vi.current;return Pt.addEventListener("wheel",$i,{passive:!1}),Pt.addEventListener("DOMMouseScroll",rn,{passive:!0}),Pt.addEventListener("MozMousePixelScroll",ei,{passive:!1}),function(){Pt.removeEventListener("wheel",$i),Pt.removeEventListener("DOMMouseScroll",rn),Pt.removeEventListener("MozMousePixelScroll",ei)}},[nt,ai,gi]),(0,C.Z)(function(){if(Ae){var ei=Bi(H);ge(ei),wi({x:ei})}},[Pe.width,Ae]);var Zi=function(){var Pt,Yt;(Pt=Ge.current)===null||Pt===void 0||Pt.delayHidden(),(Yt=tt.current)===null||Yt===void 0||Yt.delayHidden()},Xi=le(vi,At,Rt,q,jt,function(){return ri(!0)},Ut,Zi);g.useImperativeHandle(_e,function(){return{nativeElement:Xt.current,getScrollInfo:fi,scrollTo:function(Pt){function Yt(Ni){return Ni&&(0,me.Z)(Ni)==="object"&&("left"in Ni||"top"in Ni)}Yt(Pt)?(Pt.left!==void 0&&ge(Bi(Pt.left)),Xi(Pt.top)):Xi(Pt)}}}),(0,C.Z)(function(){if(Be){var ei=At.slice(Ft,xt+1);Be(ei,At)}},[Ft,xt,At]);var tn=ye(At,jt,Rt,q),nn=Oe==null?void 0:Oe({start:Ft,end:xt,virtual:Ht,offsetX:H,offsetY:ni,rtl:Tt,getSize:tn}),Ji=j(At,Ft,xt,Ae,H,Gt,$,bt),Ii=null;we&&(Ii=(0,be.Z)((0,ce.Z)({},Y?"height":"maxHeight",we),Qe),nt&&(Ii.overflowY="hidden",Ae&&(Ii.overflowX="hidden"),He&&(Ii.pointerEvents="none")));var Pi={};return Tt&&(Pi.dir="rtl"),g.createElement("div",(0,N.Z)({ref:Xt,style:(0,be.Z)((0,be.Z)({},re),{},{position:"relative"}),className:_t},Pi,ft),g.createElement(l.Z,{onResize:qe},g.createElement(We,{className:"".concat(ee,"-holder"),style:Ii,ref:vi,onScroll:Ti,onMouseEnter:Zi},g.createElement(A,{prefixCls:ee,height:zt,offsetX:H,offsetY:ni,scrollWidth:Ae,onInnerResize:ri,ref:Zt,innerProps:mt,rtl:Tt,extra:nn},Ji))),Ht&&zt>we&&g.createElement(Fe,{ref:Ge,prefixCls:ee,scrollOffset:h,scrollRange:zt,rtl:Tt,onScroll:Ri,onStartMove:Lt,onStopMove:Ot,spinSize:Ct,containerSize:Pe.height,style:st==null?void 0:st.verticalScrollBar,thumbStyle:st==null?void 0:st.verticalScrollBarThumb,showScrollBar:yt}),Ht&&Ae>Pe.width&&g.createElement(Fe,{ref:tt,prefixCls:ee,scrollOffset:H,scrollRange:Ae,rtl:Tt,onScroll:Ri,onStartMove:Lt,onStopMove:Ot,spinSize:pt,containerSize:Pe.width,horizontal:!0,style:st==null?void 0:st.horizontalScrollBar,thumbStyle:st==null?void 0:st.horizontalScrollBarThumb,showScrollBar:yt}))}var Ye=g.forwardRef(kt);Ye.displayName="List";var gt=Ye,Je=gt},83145:function(Wt,at,U){"use strict";Object.defineProperty(at,"__esModule",{value:!0}),at.CopyToClipboard=void 0;var N=be(U(59301)),me=be(U(25769));function be(L){return L&&L.__esModule?L:{default:L}}function ce(L){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ce=function(w){return typeof w}:ce=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},ce(L)}function G(L,I){var w=Object.keys(L);if(Object.getOwnPropertySymbols){var R=Object.getOwnPropertySymbols(L);I&&(R=R.filter(function(z){return Object.getOwnPropertyDescriptor(L,z).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,z;if(Object.getOwnPropertySymbols){var ne=Object.getOwnPropertySymbols(L);for(z=0;z<ne.length;z++)R=ne[z],!(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),z,ne;for(ne=0;ne<R.length;ne++)z=R[ne],!(I.indexOf(z)>=0)&&(w[z]=L[z]);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 C(L,I,w){return I&&Z(L.prototype,I),w&&Z(L,w),L}function g(L,I){return I&&(ce(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&&O(L,I)}function O(L,I){return O=Object.setPrototypeOf||function(R,z){return R.__proto__=z,R},O(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 z=arguments.length,ne=new Array(z),ie=0;ie<z;ie++)ne[ie]=arguments[ie];return R=g(this,(w=v(I)).call.apply(w,[this].concat(ne))),j(E(R),"onClick",function(ye){var De=R.props,xe=De.text,$e=De.onCopy,J=De.children,D=De.options,M=N.default.Children.only(J),P=(0,me.default)(xe,D);$e&&$e(xe,P),M&&M.props&&typeof M.props.onClick=="function"&&M.props.onClick(ye)}),R}return C(I,[{key:"render",value:function(){var R=this.props,z=R.text,ne=R.onCopy,ie=R.options,ye=R.children,De=ve(R,["text","onCopy","options","children"]),xe=N.default.Children.only(ye);return N.default.cloneElement(xe,p({},De,{onClick:this.onClick}))}}]),I}(N.default.PureComponent);at.CopyToClipboard=V,j(V,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Wt,at,U){"use strict";var N=U(83145),me=N.CopyToClipboard;me.CopyToClipboard=me,Wt.exports=me},76374:function(Wt,at,U){"use strict";var N=function(){if(typeof Map!="undefined")return Map;function J(D,M){var P=-1;return D.some(function(ae,te){return ae[0]===M?(P=te,!0):!1}),P}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(M){var P=J(this.__entries__,M),ae=this.__entries__[P];return ae&&ae[1]},D.prototype.set=function(M,P){var ae=J(this.__entries__,M);~ae?this.__entries__[ae][1]=P:this.__entries__.push([M,P])},D.prototype.delete=function(M){var P=this.__entries__,ae=J(P,M);~ae&&P.splice(ae,1)},D.prototype.has=function(M){return!!~J(this.__entries__,M)},D.prototype.clear=function(){this.__entries__.splice(0)},D.prototype.forEach=function(M,P){P===void 0&&(P=null);for(var ae=0,te=this.__entries__;ae<te.length;ae++){var S=te[ae];M.call(P,S[1],S[0])}},D}()}(),me=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,be=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")()}(),ce=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(be):function(J){return setTimeout(function(){return J(Date.now())},1e3/60)}}(),G=2;function p(J,D){var M=!1,P=!1,ae=0;function te(){M&&(M=!1,J()),P&&b()}function S(){ce(te)}function b(){var K=Date.now();if(M){if(K-ae<G)return;P=!0}else M=!0,P=!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 M=this.observers_,P=M.indexOf(D);~P&&M.splice(P,1),!M.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(M){return M.gatherActive(),M.hasActive()});return D.forEach(function(M){return M.broadcastActive()}),D.length>0},J.prototype.connect_=function(){!me||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(){!me||!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 M=D.propertyName,P=M===void 0?"":M,ae=oe.some(function(te){return!!~P.indexOf(te)});ae&&this.refresh()},J.getInstance=function(){return this.instance_||(this.instance_=new J),this.instance_},J.instance_=null,J}(),C=function(J,D){for(var M=0,P=Object.keys(D);M<P.length;M++){var ae=P[M];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||be},v=z(0,0,0,0);function E(J){return parseFloat(J)||0}function A(J){for(var D=[],M=1;M<arguments.length;M++)D[M-1]=arguments[M];return D.reduce(function(P,ae){var te=J["border-"+ae+"-width"];return P+E(te)},0)}function O(J){for(var D=["top","right","bottom","left"],M={},P=0,ae=D;P<ae.length;P++){var te=ae[P],S=J["padding-"+te];M[te]=E(S)}return M}function j(J){var D=J.getBBox();return z(0,0,D.width,D.height)}function V(J){var D=J.clientWidth,M=J.clientHeight;if(!D&&!M)return v;var P=g(J).getComputedStyle(J),ae=O(P),te=ae.left+ae.right,S=ae.top+ae.bottom,b=E(P.width),K=E(P.height);if(P.boxSizing==="border-box"&&(Math.round(b+te)!==D&&(b-=A(P,"left","right")+te),Math.round(K+S)!==M&&(K-=A(P,"top","bottom")+S)),!I(J)){var le=Math.round(b+te)-D,Ee=Math.round(K+S)-M;Math.abs(le)!==1&&(b-=le),Math.abs(Ee)!==1&&(K-=Ee)}return z(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 me?L(J)?j(J):V(J):v}function R(J){var D=J.x,M=J.y,P=J.width,ae=J.height,te=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,S=Object.create(te.prototype);return C(S,{x:D,y:M,width:P,height:ae,top:M,right:D+P,bottom:ae+M,left:D}),S}function z(J,D,M,P){return{x:J,y:D,width:M,height:P}}var ne=function(){function J(D){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=z(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}(),ie=function(){function J(D,M){var P=R(M);C(this,{target:D,contentRect:P})}return J}(),ye=function(){function J(D,M,P){if(this.activeObservations_=[],this.observations_=new N,typeof D!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=D,this.controller_=M,this.callbackCtx_=P}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 M=this.observations_;M.has(D)||(M.set(D,new ne(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 M=this.observations_;M.has(D)&&(M.delete(D),M.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(M){M.isActive()&&D.activeObservations_.push(M)})},J.prototype.broadcastActive=function(){if(this.hasActive()){var D=this.callbackCtx_,M=this.activeObservations_.map(function(P){return new ie(P.target,P.broadcastRect())});this.callback_.call(D,M,D),this.clearActive()}},J.prototype.clearActive=function(){this.activeObservations_.splice(0)},J.prototype.hasActive=function(){return this.activeObservations_.length>0},J}(),De=typeof WeakMap!="undefined"?new WeakMap:new N,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 M=Z.getInstance(),P=new ye(D,M,this);De.set(this,P)}return J}();["observe","unobserve","disconnect"].forEach(function(J){xe.prototype[J]=function(){var D;return(D=De.get(this))[J].apply(D,arguments)}});var $e=function(){return typeof be.ResizeObserver!="undefined"?be.ResizeObserver:xe}();at.Z=$e},98040:function(Wt){Wt.exports=function(){var at=document.getSelection();if(!at.rangeCount)return function(){};for(var U=document.activeElement,N=[],me=0;me<at.rangeCount;me++)N.push(at.getRangeAt(me));switch(U.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":U.blur();break;default:U=null;break}return at.removeAllRanges(),function(){at.type==="Caret"&&at.removeAllRanges(),at.rangeCount||N.forEach(function(be){at.addRange(be)}),U&&U.focus()}}},82059:function(Wt){var at=arguments[3],U=arguments[4],N=arguments[5],me=JSON.stringify;Wt.exports=function(be,ce){for(var G,p=Object.keys(N),ve=0,oe=p.length;ve<oe;ve++){var l=p[ve],Z=N[l].exports;if(Z===be||Z&&Z.default===be){G=l;break}}if(!G){G=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var C={},ve=0,oe=p.length;ve<oe;ve++){var l=p[ve];C[l]=l}U[G]=["function(require,module,exports){"+be+"(self); }",C]}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("+me(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 z=U[w][1][R];E[z]||A(z)}}var O="("+at+")({"+Object.keys(E).map(function(w){return me(w)+":["+U[w][0]+","+me(U[w][1])+"]"}).join(",")+"},{},["+me(g)+"])",j=window.URL||window.webkitURL||window.mozURL||window.msURL,V=new Blob([O],{type:"text/javascript"});if(ce&&ce.bare)return V;var L=j.createObjectURL(V),I=new Worker(L);return I.objectURL=L,I}},93314:function(Wt){"use strict";Wt.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=="},80360:function(Wt,at,U){"use strict";U.d(at,{ZP:function(){return ws}});const N=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},me=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=be},be=Number.MAX_SAFE_INTEGER||9007199254740991;let ce=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 C(a,e,t){return(e=O(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){C(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 O(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 z=I();function ne(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.13`)}catch(s){return I()}n.forEach(s=>{z[s]=R(s,a)})}else g(z,i);return i}const ie=z;function ye(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function De(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 M(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var P={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 F=x.path,se=F.substring(0,F.lastIndexOf("/")+1)+_.path;B.path=o.normalizePath(se)}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})()}(P)),P.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,It(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 Fe 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(N(e)&&N(t))return t-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const i=Object.keys(t);if(i.length===1){const n=this._decryptdata=t[i[0]]||null;n&&(this._decryptdata=n.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=N(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(!N(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){const t=this.levelkeys;if(t){var i;const n=t[e];n&&!((i=this._decryptdata)!=null&&i.keyId)&&(this._decryptdata=n.getDecryptData(this.sn,t))}}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 et 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 Et(a,e){const t=Object.getPrototypeOf(a);if(t){const i=Object.getOwnPropertyDescriptor(t,e);return i||Et(t,e)}}function It(a,e){const t=Et(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const Jt=Math.pow(2,32)-1,Qe=[].push,kt={video:1,audio:2,id3:3,text:4};function Ye(a){return String.fromCharCode.apply(null,a)}function gt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function Je(a,e){const t=_e(a,e);return t<0?4294967296+t:t}function Me(a,e){let t=Je(a,e);return t*=Math.pow(2,32),t+=Je(a,e+4),t}function _e(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function Re(a){const e=a.byteLength;for(let t=0;t<e;){const i=Je(a,t);if(i>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=i>1?t+i:e}return!1}function ee(a,e){const t=[];if(!e.length)return t;const i=a.byteLength;for(let n=0;n<i;){const s=Je(a,n),r=Ye(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&&Qe.apply(t,c)}n=o}return t}function Le(a){const e=[],t=a[0];let i=8;const n=Je(a,i);i+=4;let s=0,r=0;t===0?(s=Je(a,i),r=Je(a,i+4),i+=8):(s=Me(a,i),r=Me(a,i+8),i+=16),i+=2;let o=a.length+r;const c=gt(a,i);i+=2;for(let u=0;u<c;u++){let f=i;const d=Je(a,f);f+=4;const _=d&2147483647;if((d&2147483648)>>>31===1)return ie.warn("SIDX has hierarchical references (not supported)"),null;const T=Je(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 we(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=Je(r,o===0?12:20),u=ee(s,["mdia","mdhd"])[0];if(u){o=u[0];const f=Je(u,o===0?12:20),d=ee(s,["mdia","hdlr"])[0];if(d){const _=Ye(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=Je(n,4),r=e[s];r&&(r.default={duration:Je(n,12),flags:Je(n,20)})}),e}function q(a){const e=a.subarray(8),t=e.subarray(86),i=Ye(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=Ye(_.subarray(4,8));if(x==="cbcs"||x==="cenc"){const T=ee(d,["frma"])[0];T&&(n=Ye(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,_=Je(c,2),x=(u&32)>>5?"H":"L",T=c[12],B=c.subarray(6,12);n+="."+f+d,n+="."+Y(_).toString(16).toUpperCase(),n+="."+x+T;let F="";for(let se=B.length;se--;){const ue=B[se];(ue||F)&&(F="."+ue.toString(16).toUpperCase()+F)}n+=F}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,F=(c[2]&8)>>3,se=(c[2]&4)>>2,ue=c[2]&3;n+="."+u+"."+$(f)+d+"."+$(T)+"."+B+"."+F+se+ue+"."+$(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 Y(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&&pe(a,(i,n)=>{const s=i.subarray(8,24);s.some(r=>r!==0)||(ie.log(`[eme] Patching keyId in 'enc${n?"a":"v"}>sinf>>tenc' box: ${J(s)} -> ${J(t)}`),i.set(t,8))})}function he(a){const e=[];return pe(a,t=>e.push(t.subarray(8,24))),e}function pe(a,e){ee(a,["moov","trak"]).forEach(i=>{const n=ee(i,["mdia","minf","stbl","stsd"])[0];if(!n)return;const s=n.subarray(8);let r=ee(s,["enca"]);const o=r.length>0;o||(r=ee(s,["encv"])),r.forEach(c=>{const u=o?c.subarray(28):c.subarray(78);ee(u,["sinf"]).forEach(d=>{const _=Ae(d);_&&e(_,o)})})})}function Ae(a){const e=ee(a,["schm"])[0];if(e){const t=Ye(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const i=ee(a,["schi","tenc"])[0];if(i)return i}}}function Xe(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=Je(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 fe=d[0];let Se=Je(d,4);fe===1&&(Se===Jt?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Se*=Jt+1,Se+=Je(d,8))),N(Se)&&(!N(f.start)||Se<f.start)&&(f.start=Se)}const _=u.default,x=Je(o,0)|(_==null?void 0:_.flags);let T=(_==null?void 0:_.duration)||0;x&8&&(x&2?T=Je(o,12):T=Je(o,8));const B=ee(r,["trun"]);let F=f.start||0,se=0,ue=T;for(let fe=0;fe<B.length;fe++){const Se=B[fe],Ie=Je(Se,4),it=f.sampleCount;f.sampleCount+=Ie;const Ce=Se[3]&1,Ze=Se[3]&4,je=Se[2]&1,Ne=Se[2]&2,dt=Se[2]&4,Vt=Se[2]&8;let oi=8,di=Ie;for(Ce&&(oi+=4),Ze&&Ie&&(!(Se[oi+1]&1)&&f.keyFrameIndex===void 0&&(f.keyFrameIndex=it),oi+=4,je?(ue=Je(Se,oi),oi+=4):ue=T,Ne&&(oi+=4),Vt&&(oi+=4),F+=ue,se+=ue,di--);di--;)je?(ue=Je(Se,oi),oi+=4):ue=T,Ne&&(oi+=4),dt&&(Se[oi+1]&1||f.keyFrameIndex===void 0&&(f.keyFrameIndex=f.sampleCount-(di+1),f.keyFrameStart=F),oi+=4),Vt&&(oi+=4),F+=ue,se+=ue;!se&&T&&(se+=T*Ie)}f.duration+=se}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=Le(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&&N(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 ze(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function Ke(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=Je(x,4);return T===1&&(B*=Math.pow(2,32),B+=Je(x,8)),B/n})[0];return _!==void 0&&(a=_),ee(d,["tfhd"]).map(x=>{const T=Je(x,4),B=Je(x,0)&16777215,F=(B&1)!==0,se=(B&2)!==0,ue=(B&8)!==0;let fe=0;const Se=(B&16)!==0;let Ie=0;const it=(B&32)!==0;let Ce=8;T===s&&(F&&(Ce+=8),se&&(Ce+=4),ue&&(fe=Je(x,Ce),Ce+=4),Se&&(Ie=Je(x,Ce),Ce+=4),it&&(Ce+=4),e.type==="video"&&(r=Be(e.codec)),ee(d,["trun"]).map(Ze=>{const je=Ze[0],Ne=Je(Ze,0)&16777215,dt=(Ne&1)!==0;let Vt=0;const oi=(Ne&4)!==0,di=(Ne&256)!==0;let li=0;const Nt=(Ne&512)!==0;let ci=0;const Qt=(Ne&1024)!==0,hi=(Ne&2048)!==0;let xi=0;const Kt=Je(Ze,4);let $t=8;dt&&(Vt=Je(Ze,$t),$t+=4),oi&&($t+=4);let Oi=Vt+u;for(let zi=0;zi<Kt;zi++){if(di?(li=Je(Ze,$t),$t+=4):li=fe,Nt?(ci=Je(Ze,$t),$t+=4):ci=Ie,Qt&&($t+=4),hi&&(je===0?xi=Je(Ze,$t):xi=_e(Ze,$t),$t+=4),e.type===K.VIDEO){let Fi=0;for(;Fi<ci;){const Ki=Je(i,Oi);if(Oi+=4,mt(r,i[Oi])){const Ln=i.subarray(Oi,Oi+Ki);Oe(Ln,r?2:1,a+xi/n,t)}Oi+=Ki,Fi+=Ki+4}}a+=li/n}}))})})}),t}function Be(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function mt(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Oe(a,e,t,i){const n=st(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){ie.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(r===4){if(n[f++]===181){const _=gt(n,f);if(f+=2,_===49){const x=Je(n,f);if(f+=4,x===1195456820){const T=n[f++];if(T===3){const B=n[f++],F=31&B,se=64&B,ue=se?2+F*3:0,fe=new Uint8Array(ue);if(se){fe[0]=B;for(let Se=1;Se<ue;Se++)fe[Se]=n[f++]}i.push({type:T,payloadType:r,pts:t,bytes:fe})}}}}}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 st(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 Bt(a){const e=a[0];let t="",i="",n=0,s=0,r=0,o=0,c=0,u=0;if(e===0){for(;Ye(a.subarray(u,u+1))!=="\0";)t+=Ye(a.subarray(u,u+1)),u+=1;for(t+=Ye(a.subarray(u,u+1)),u+=1;Ye(a.subarray(u,u+1))!=="\0";)i+=Ye(a.subarray(u,u+1)),u+=1;i+=Ye(a.subarray(u,u+1)),u+=1,n=Je(a,12),s=Je(a,16),o=Je(a,20),c=Je(a,24),u=28}else if(e===1){u+=4,n=Je(a,u),u+=4;const d=Je(a,u);u+=4;const _=Je(a,u);for(u+=4,r=Sl(2,32)*d+_,me(r)||(r=Number.MAX_SAFE_INTEGER,ie.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Je(a,u),u+=4,c=Je(a,u),u+=4;Ye(a.subarray(u,u+1))!=="\0";)t+=Ye(a.subarray(u,u+1)),u+=1;for(t+=Ye(a.subarray(u,u+1)),u+=1;Ye(a.subarray(u,u+1))!=="\0";)i+=Ye(a.subarray(u,u+1)),u+=1;i+=Ye(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 yt(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 ft(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),yt([112,115,115,104],new Uint8Array([i,0,0,0]),a,s,n,r,t)}function jt(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let i=0;for(;i+32<t;){const n=new DataView(a,i),s=si(n);e.push(s),i+=s.size}}return e}function si(a){const e=a.getUint32(0),t=a.byteOffset,i=a.byteLength;if(i<e)return{offset:t,size:i};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const s=a.getUint32(8)>>>24;if(s!==0&&s!==1)return{offset:t,size:e};const r=a.buffer,o=J(new Uint8Array(r,t+12,16));let c=null,u=null,f=0;if(s===0)f=28;else{const _=a.getUint32(28);if(!_||i<32+_*16)return{offset:t,size:e};c=[];for(let x=0;x<_;x++)c.push(new Uint8Array(r,t+32+x*16,16));f=32+_*16}if(!f)return{offset:t,size:e};const d=a.getUint32(f);return e-32<d?{offset:t,size:e}:(u=new Uint8Array(r,t+f+4,d),{version:s,systemId:o,kids:c,data:u,offset:t,size:e})}const ti=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Gt={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 ri(a,e){const t=Gt[e];return!!t&&!!t[a.slice(0,4)]}function Rt(a,e,t=!0){return!a.split(",").some(i=>!ut(i,e,t))}function ut(a,e,t=!0){var i;const n=ye(t);return(i=n==null?void 0:n.isTypeSupported(nt(a,e)))!=null?i:!1}function nt(a,e){return`${e}/mp4;codecs=${a}`}function Mt(a){if(a){const e=a.substring(0,4);return Gt.video[e]}return 2}function Ht(a){const e=ti();return a.split(",").reduce((t,i)=>{const s=e&&Be(i)?9:Gt.video[i];return s?(s*2+t)/(t?3:2):(Gt.audio[i]+t)/(t?2:1)},0)}const Tt={};function _t(a,e=!0){if(Tt[a])return Tt[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(ut(t[n],"audio",e))return Tt[a]=t[n],t[n];if(t[n]==="mp3"&&(i=ye(e))!=null&&i.isTypeSupported("audio/mpeg"))return""}return a}const At=/flac|opus|mp4a\.40\.34/i;function vi(a,e=!0){return a.replace(At,t=>_t(t.toLowerCase(),e))}function Zt(a,e){const t=[];if(a){const i=a.split(",");for(let n=0;n<i.length;n++)ri(i[n],"video")||t.push(i[n])}return e&&t.push(e),t.join(",")}function Xt(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(Dt(a,"audio")||Dt(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 Dt(a,e){return ri(a,e)&&ut(a,e)}function Ve(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 h(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 m(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 y(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const k={supported:!0,powerEfficient:!0,smooth:!0},H={supported:!1,smooth:!1,powerEfficient:!1},ge={supported:!0,configurations:[],decodingInfoResults:[k]};function de(a,e){return{supported:!1,configurations:e,decodingInfoResults:[H],error:a}}function ke(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(_=>Be(_))||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&&N(f)&&Object.keys(d).some(_=>parseInt(_)>f)}function He(a,e,t,i={}){const n=a.videoCodec;if(!n&&!a.audioCodec||!t)return Promise.resolve(ge);const s=[],r=lt(a),o=r.length,c=Lt(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=>Be(d))&&ti())return Promise.resolve(de(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${f})`),s))}return Promise.all(s.map(f=>{const d=Ut(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 lt(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),i=bt(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:nt(h(c),"video"),width:n,height:s,bitrate:i,framerate:r};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function Lt(a,e,t){var i;const n=(i=a.audioCodec)==null?void 0:i.split(","),s=bt(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:nt(x,"audio"),bitrate:t?Ot(x,s):s};_&&(T.channels=""+_),f.push(T)})}return f},r):r},[]):[]}function Ot(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 bt(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function Ut(a){let e="";const{audio:t,video:i}=a;if(i){const n=y(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=y(t.contentType);e+=`${i?"_":""}${n}_c${t.channels}`}return e}const vt=["NONE","TYPE-0","TYPE-1",null];function ht(a){return vt.indexOf(a)>-1}const ot=["SDR","PQ","HLG"];function wt(a){return!!a&&ot.indexOf(a)>-1}var St={No:"",Yes:"YES",v2:"v2"};function pi(a){const{canSkipUntil:e,canSkipDateRanges:t,age:i}=a,n=i<e/2;return e&&n?t?St.v2:St.Yes:St.No}class zt{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 Ft{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 xt(this._audioGroups,e)}hasSubtitleGroup(e){return xt(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 xt(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function ni(){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 mi(a,e){let t=!1,i=[];if(a&&(t=a!=="SDR",i=[a]),e){i=e.allowedVideoRanges||ot.slice(0);const n=i.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:n&&ni(),t||(i=["SDR"])}return{preferHDR:t,allowedVideoRanges:i}}const Te=a=>{const e=new WeakSet;return(t,i)=>{if(a&&(i=a(t,i)),typeof i=="object"&&i!==null){if(e.has(i))return;e.add(i)}return i}},Pe=(a,e)=>JSON.stringify(a,Te(e));function rt(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,F=0,se=[];const{preferHDR:ue,allowedVideoRanges:fe}=mi(e,n);for(let Ze=s.length;Ze--;){const je=a[s[Ze]];f||(f=je.channels[2]>0),_=Math.min(_,je.minHeight),x=Math.min(x,je.minFramerate),T=Math.min(T,je.minBitrate),fe.filter(dt=>je.videoRanges[dt]>0).length>0&&(d=!0)}_=N(_)?_:0,x=N(x)?x:0;const Se=Math.max(1080,_),Ie=Math.max(30,x);T=N(T)?T:t,t=Math.max(T,t),d||(e=void 0);const it=s.length>1;return{codecSet:s.reduce((Ze,je)=>{const Ne=a[je];if(je===Ze)return Ze;if(se=d?fe.filter(dt=>Ne.videoRanges[dt]>0):[],it){if(Ne.minBitrate>t)return qe(je,`min bitrate of ${Ne.minBitrate} > current estimate of ${t}`),Ze;if(!Ne.hasDefaultAudio)return qe(je,"no renditions with default or auto-select sound found"),Ze;if(o&&je.indexOf(o.substring(0,4))%5!==0)return qe(je,`audio codec preference "${o}" not found`),Ze;if(r&&!u){if(!Ne.channels[r])return qe(je,`no renditions with ${r} channel sound found (channels options: ${Object.keys(Ne.channels)})`),Ze}else if((!o||u)&&f&&Ne.channels[2]===0)return qe(je,"no renditions with stereo sound found"),Ze;if(Ne.minHeight>Se)return qe(je,`min resolution of ${Ne.minHeight} > maximum of ${Se}`),Ze;if(Ne.minFramerate>Ie)return qe(je,`min framerate of ${Ne.minFramerate} > maximum of ${Ie}`),Ze;if(!se.some(dt=>Ne.videoRanges[dt]>0))return qe(je,`no variants with VIDEO-RANGE of ${Pe(se)} found`),Ze;if(c&&je.indexOf(c.substring(0,4))%5!==0)return qe(je,`video codec preference "${c}" not found`),Ze;if(Ne.maxScore<F)return qe(je,`max score of ${Ne.maxScore} < selected max of ${F}`),Ze}return Ze&&(Ht(je)>=Ht(Ze)||Ne.fragmentError>a[Ze].fragmentError)?Ze:(B=Ne.minIndex,F=Ne.maxScore,je)},void 0),videoRanges:se,preferHDR:ue,minFramerate:x,minBitrate:T,minIndex:B}}function qe(a,e){ie.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function Ge(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 tt(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 pt(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 Ct(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(ui(a,n,t))return i}return-1}function ui(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||qt(s,e.lang))&&(s===void 0||e.assocLang===r)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||Si(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function qt(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function Si(a,e=""){const t=a.split(","),i=e.split(",");return t.length===i.length&&!t.some(n=>i.indexOf(n)===-1)}function ai(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 gi(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=bi(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 Ct(a,T,n)>-1});return d>-1?d:bi(e,i,_=>{const x=_.audioGroups,T=t.filter(B=>!x||x.indexOf(B.groupId)!==-1);return Ct(a,T,n)>-1})}function bi(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 Li(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class ki 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 F=B>-1&&B!==T,se=!!t||F;if(!se&&(c.paused||!c.playbackRate||!c.readyState))return;const ue=r.mainForwardBufferInfo;if(!se&&ue===null)return;const fe=this.bwEstimator.getEstimateTTFB(),Se=Math.abs(c.playbackRate);if(_<=Math.max(fe,1e3*(d/(Se*2))))return;const Ie=ue?ue.len/Se:0,it=f.loading.first?f.loading.first-f.loading.start:-1,Ce=f.loaded&&it>-1,Ze=this.getBwEstimate(),je=r.levels,Ne=je[T],dt=Math.max(f.loaded,Math.round(d*(n.bitrate||Ne.averageBitrate)/8));let Vt=Ce?_-it:_;Vt<1&&Ce&&(Vt=Math.min(_,f.loaded*8/Ze));const oi=Ce?f.loaded*1e3/Vt:0,di=fe/1e3,li=oi?(dt-f.loaded)/oi:dt*8/Ze+di;if(li<=Ie)return;const Nt=oi?oi*8:Ze,ci=((i=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:i.live)===!0,Qt=this.hls.config.abrBandWidthUpFactor;let hi=Number.POSITIVE_INFINITY,xi;for(xi=T-1;xi>x;xi--){const zi=je[xi].maxBitrate,Fi=!je[xi].details||ci;if(hi=this.getTimeToLoadFrag(di,Nt,d*zi,Fi),hi<Math.min(Ie,d+di))break}if(hi>=li||hi>d*10)return;Ce?this.bwEstimator.sample(_-Math.min(fe,it),f.loaded):this.bwEstimator.sampleTTFB(_);const Kt=je[xi].maxBitrate;this.getBwEstimate()*Qt>Kt&&this.resetEstimator(Kt);const $t=this.findBestLevel(Kt,x,xi,0,Ie,1,1);$t>-1&&(xi=$t),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: ${Ie.toFixed(3)} s
|
|
Estimated load time for current fragment: ${li.toFixed(3)} s
|
|
Estimated load time for down switch fragment: ${hi.toFixed(3)} s
|
|
TTFB estimate: ${it|0} ms
|
|
Current BW estimate: ${N(Ze)?Ze|0:"Unknown"} bps
|
|
New BW estimate: ${this.getBwEstimate()|0} bps
|
|
Switching to level ${xi} @ ${Kt|0} bps`),r.nextLoadLevel=r.nextAutoLevel=xi,this.clearTimer();const Oi=()=>{if(this.clearTimer(),this.fragCurrent===n&&this.hls.loadLevel===xi&&xi>0){const zi=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${xi>0?"and switching down":""}
|
|
Fragment duration: ${n.duration.toFixed(3)} s
|
|
Time to underbuffer: ${zi.toFixed(3)} s`),n.abortRequests(),this.fragCurrent=this.partCurrent=null,xi>x){let Fi=this.findBestLevel(this.hls.levels[x].bitrate,x,xi,0,zi,1,1);Fi===-1&&(Fi=x),this.hls.nextLoadLevel=this.hls.nextAutoLevel=Fi,this.resetEstimator(this.hls.levels[Fi].bitrate)}}};F||li>hi*2?Oi():this.timer=self.setInterval(Oi,hi*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;N(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 F=this.findBestLevel(c,r,n,u,0,f,d);if(F>=0)return this.rebufferNotice=-1,F}let _=o?Math.min(o,s.maxStarvationDelay):s.maxStarvationDelay;if(!u){const F=this.bitrateTestDelay;F&&(_=(o?Math.min(o,s.maxLoadingDelay):s.maxLoadingDelay)-F,this.info(`bitrate test took ${Math.round(1e3*F)}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:F,config:se}=this.hls;if(T.length===1)return 0;const ue=T[d],fe=!!((c=this.hls.latestLevelDetails)!=null&&c.live),Se=F===-1||f===-1;let Ie,it="SDR",Ce=(ue==null?void 0:ue.frameRate)||0;const{audioPreference:Ze,videoPreference:je}=se,Ne=this.audioTracksByGroup||(this.audioTracksByGroup=Ge(B));let dt=-1;if(Se){if(this.firstSelection!==-1)return this.firstSelection;const Nt=this.codecTiers||(this.codecTiers=tt(T,Ne,t,i)),ci=rt(Nt,it,e,Ze,je),{codecSet:Qt,videoRanges:hi,minFramerate:xi,minBitrate:Kt,minIndex:$t,preferHDR:Oi}=ci;dt=$t,Ie=Qt,it=Oi?hi[hi.length-1]:hi[0],Ce=xi,e=Math.max(e,Kt),this.log(`picked start tier ${Pe(ci)}`)}else Ie=ue==null?void 0:ue.codecSet,it=ue==null?void 0:ue.videoRange;const Vt=x?x.duration:_?_.duration:0,oi=this.bwEstimator.getEstimateTTFB()/1e3,di=[];for(let Nt=i;Nt>=t;Nt--){var li;const ci=T[Nt],Qt=Nt>d;if(!ci)continue;if(se.useMediaCapabilities&&!ci.supportedResult&&!ci.supportedPromise){const Fi=navigator.mediaCapabilities;typeof(Fi==null?void 0:Fi.decodingInfo)=="function"&&ke(ci,Ne,it,Ce,e,Ze)?(ci.supportedPromise=He(ci,Ne,Fi,this.supportedCache),ci.supportedPromise.then(Ki=>{if(!this.hls)return;ci.supportedResult=Ki;const Ln=this.hls.levels,xn=Ln.indexOf(ci);Ki.error?this.warn(`MediaCapabilities decodingInfo error: "${Ki.error}" for level ${xn} ${Pe(Ki)}`):Ki.supported?Ki.decodingInfoResults.some(qn=>qn.smooth===!1||qn.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${xn} not smooth or powerEfficient: ${Pe(Ki)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${xn} ${Pe(Ki)}`),xn>-1&&Ln.length>1&&(this.log(`Removing unsupported level ${xn}`),this.hls.removeLevel(xn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(Ki=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${Ki}`)})):ci.supportedResult=ge}if((Ie&&ci.codecSet!==Ie||it&&ci.videoRange!==it||Qt&&Ce>ci.frameRate||!Qt&&Ce>0&&Ce<ci.frameRate||(li=ci.supportedResult)!=null&&(li=li.decodingInfoResults)!=null&&li.some(Fi=>Fi.smooth===!1))&&(!Se||Nt!==dt)){di.push(Nt);continue}const hi=ci.details,xi=(x?hi==null?void 0:hi.partTarget:hi==null?void 0:hi.averagetargetduration)||Vt;let Kt;Qt?Kt=o*e:Kt=r*e;const $t=Vt&&n>=Vt*2&&s===0?ci.averageBitrate:ci.maxBitrate,Oi=this.getTimeToLoadFrag(oi,Kt,$t*xi,hi===void 0);if(Kt>=$t&&(Nt===f||ci.loadError===0&&ci.fragmentError===0)&&(Oi<=oi||!N(Oi)||fe&&!this.bitrateTestDelay||Oi<u)){const Fi=this.forcedAutoLevel;return Nt!==F&&(Fi===-1||Fi!==F)&&(di.length&&this.trace(`Skipped level(s) ${di.join(",")} of ${i} max with CODECS and VIDEO-RANGE:"${T[di[0]].codecs}" ${T[di[0]].videoRange}; not compatible with "${Ie}" ${it}`),this.info(`switch candidate:${d}->${Nt} adjustedbw(${Math.round(Kt)})-bitrate=${Math.round(Kt-$t)} ttfb:${oi.toFixed(1)} avgDuration:${xi.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${Oi.toFixed(1)} firstSelection:${Se} codecSet:${ci.codecSet} videoRange:${ci.videoRange} hls.loadLevel:${F}`)),Se&&(this.firstSelection=Nt),Nt}}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 fi={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 yi(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!N(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(Bi(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)&&Ti(t,i,s)===0||Ri(s,a,Math.min(n,i))))return s;const r=fi.search(e,Ti.bind(null,t,i));return r&&(r!==a||!s)?r:s}function Ri(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 Ti(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 Bi(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 fi.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 Mi(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 Yi(a){return a.details.startsWith("key")}function $i(a){return Yi(a)&&!!a.frag&&!a.frag.decryptdata}function rn(a,e){const t=Mi(e);return a.default[`${t?"timeout":"error"}Retry`]}function Zi(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function Xi(a){return E(E({},a),{errorRetry:null,timeoutRetry:null})}function tn(a,e,t,i){if(!a)return!1;const n=i==null?void 0:i.code,s=e<a.maxNumRetry&&(nn(n)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,i,s):s}function nn(a){return Ji(a)||!!a&&(a<400||a>499)}function Ji(a){return a===0&&navigator.onLine===!1}var Ii={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Pi={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class ei 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=Pt();return}case G.FRAG_GAP:case G.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=Ii.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=Ii.SendAlternateToPenaltyBox,t.errorAction.flags=Pi.MoveAllAlternatesMatchingHost;return}}return;case G.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:Ii.SendAlternateToPenaltyBox,flags:Pi.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:Ii.SendAlternateToPenaltyBox,flags:Pi.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=Pt();return}t.type===ce.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=Pt())}getPlaylistRetryOrSwitchAction(e,t){const i=this.hls,n=rn(i.config.playlistLoadPolicy,e),s=this.playlistError++;if(tn(n,s,Mi(e),e.response))return{action:Ii.RetryRequest,flags:Pi.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=rn(Yi(e)?r:s,e),c=t.levels.reduce((f,d)=>f+d.fragmentError,0);if(n&&(e.details!==G.FRAG_GAP&&n.fragmentError++,!$i(e)&&tn(o,c,Mi(e),e.response)))return{action:Ii.RetryRequest,flags:Pi.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,se=(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:it})=>n.audioCodec!==it),fe=e.sourceBufferName==="video"&&(u===G.BUFFER_ADD_CODEC_ERROR||u===G.BUFFER_APPEND_ERROR)&&d.some(({codecSet:it,audioCodec:Ce})=>n.codecSet!==it&&n.audioCodec===Ce),{type:Se,groupId:Ie}=(r=e.context)!=null?r:{};for(let it=d.length;it--;){const Ce=(it+_)%d.length;if(Ce!==_&&Ce>=x&&Ce<=T&&d[Ce].loadError===0){var o,c;const Ze=d[Ce];if(u===G.FRAG_GAP&&B===oe.MAIN&&e.frag){const je=d[Ce].details;if(je){const Ne=wi(e.frag,je.fragments,e.frag.start);if(Ne!=null&&Ne.gap)continue}}else{if(Se===ve.AUDIO_TRACK&&Ze.hasAudioGroup(Ie)||Se===ve.SUBTITLE_TRACK&&Ze.hasSubtitleGroup(Ie))continue;if(B===oe.AUDIO&&(o=n.audioGroups)!=null&&o.some(je=>Ze.hasAudioGroup(je))||B===oe.SUBTITLE&&(c=n.subtitleGroups)!=null&&c.some(je=>Ze.hasSubtitleGroup(je))||se&&n.audioCodec===Ze.audioCodec||fe&&n.codecSet===Ze.codecSet||!se&&n.codecSet!==Ze.codecSet)continue}f=Ce;break}}if(f>-1&&i.loadLevel!==f)return e.levelRetry=!0,this.playlistError=0,{action:Ii.SendAlternateToPenaltyBox,flags:Pi.None,nextAutoLevel:f}}return{action:Ii.SendAlternateToPenaltyBox,flags:Pi.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i;switch((i=t.errorAction)==null?void 0:i.action){case Ii.DoNothing:break;case Ii.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 Ii.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 Pi.None:this.switchLevel(e,s);break;case Pi.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==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(f){t.maxHdcpLevel=vt[vt.indexOf(f)-1],i.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case Pi.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const u=this.hls.levels,f=u.length;for(let _=f;_--;)if(this.variantHasKey(u[_],c)){var r,o;this.log(`Banned key found in level ${_} (${u[_].bitrate}bps) or audio group "${(r=u[_].audioGroups)==null?void 0:r.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${J(c.keyId||[])}`),u[_].fragmentError++,u[_].loadError++,this.log(`Removing level ${_} with key error (${e.error})`),this.hls.removeLevel(_)}const d=e.frag;if(this.hls.levels.length<f)i.resolved=!0;else if(d&&d.type!==oe.MAIN){const _=d.decryptdata;_&&!c.matches(_)&&(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=y(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 Pt(a){const e={action:Ii.DoNothing,flags:Pi.None};return a&&(e.resolved=!0),e}var Yt={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Ni{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=qi(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),Ui(s)||this.removeParts(i.sn-1,i.type)):this.removeFragment(s.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=on(i,n=>n.fragment.sn>=e))}fragBuffered(e,t){const i=qi(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&&Ui(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||Ui(t))}getState(e){const t=qi(e),i=this.fragments[t];return i?i.buffered?Ui(i)?Yt.PARTIAL:Yt.OK:Yt.APPENDING:Yt.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=qi(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=qi(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=qi(e);e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const n=e.sn;this.activePartLists[e.type]=on(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 Ui(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 qi(a){return`${a.type}_${a.level}_${a.sn}`}function on(a,e){return a.filter(t=>{const i=e(t);return i||t.clearElementaryStreamInfo(),i})}var ji={cbc:0,ctr:1};class cn{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 ji.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case ji.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 Tn(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class hn{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,F=0;for(F=0;F<256;F++)F<128?x[F]=F<<1:x[F]=F<<1^283;for(F=0;F<256;F++){let se=B^B<<1^B<<2^B<<3^B<<4;se=se>>>8^se&255^99,e[T]=se,t[se]=T;const ue=x[T],fe=x[ue],Se=x[fe];let Ie=x[se]*257^se*16843008;n[T]=Ie<<24|Ie>>>8,s[T]=Ie<<16|Ie>>>16,r[T]=Ie<<8|Ie>>>24,o[T]=Ie,Ie=Se*16843009^fe*65537^ue*257^T*16843008,u[se]=Ie<<24|Ie>>>8,f[se]=Ie<<16|Ie>>>16,d[se]=Ie<<8|Ie>>>24,_[se]=Ie,T?(T=ue^x[x[x[Se^ue]]],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],F=x[2],se=x[3];let ue,fe;for(o=0;o<r;o++){if(o<s){ue=u[o]=t[o];continue}fe=ue,o%s===0?(fe=fe<<8|fe>>>24,fe=d[fe>>>24]<<24|d[fe>>>16&255]<<16|d[fe>>>8&255]<<8|d[fe&255],fe^=_[o/s|0]<<24):s>6&&o%s===4&&(fe=d[fe>>>24]<<24|d[fe>>>16&255]<<16|d[fe>>>8&255]<<8|d[fe&255]),u[o]=ue=(u[o-s]^fe)>>>0}for(c=0;c<r;c++)o=r-c,c&3?fe=u[o]:fe=u[o-4],c<4||o<=4?f[c]=fe:f[c]=T[d[fe>>>24]]^B[d[fe>>>16&255]]^F[d[fe>>>8&255]]^se[d[fe&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],F=_[3];const se=new Int32Array(e),ue=new Int32Array(se.length);let fe,Se,Ie,it,Ce,Ze,je,Ne,dt,Vt,oi,di,li,Nt;const ci=this.networkToHostOrderSwap;for(;t<se.length;){for(dt=ci(se[t]),Vt=ci(se[t+1]),oi=ci(se[t+2]),di=ci(se[t+3]),Ce=dt^s[0],Ze=di^s[1],je=oi^s[2],Ne=Vt^s[3],li=4,Nt=1;Nt<n;Nt++)fe=c[Ce>>>24]^u[Ze>>16&255]^f[je>>8&255]^d[Ne&255]^s[li],Se=c[Ze>>>24]^u[je>>16&255]^f[Ne>>8&255]^d[Ce&255]^s[li+1],Ie=c[je>>>24]^u[Ne>>16&255]^f[Ce>>8&255]^d[Ze&255]^s[li+2],it=c[Ne>>>24]^u[Ce>>16&255]^f[Ze>>8&255]^d[je&255]^s[li+3],Ce=fe,Ze=Se,je=Ie,Ne=it,li=li+4;fe=r[Ce>>>24]<<24^r[Ze>>16&255]<<16^r[je>>8&255]<<8^r[Ne&255]^s[li],Se=r[Ze>>>24]<<24^r[je>>16&255]<<16^r[Ne>>8&255]<<8^r[Ce&255]^s[li+1],Ie=r[je>>>24]<<24^r[Ne>>16&255]<<16^r[Ce>>8&255]<<8^r[Ze&255]^s[li+2],it=r[Ne>>>24]<<24^r[Ce>>16&255]<<16^r[Ze>>8&255]<<8^r[je&255]^s[li+3],ue[t]=ci(fe^x),ue[t+1]=ci(it^T),ue[t+2]=ci(Ie^B),ue[t+3]=ci(Se^F),x=dt,T=Vt,B=oi,F=di,t=t+4}return ue.buffer}}class bn{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=an(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function an(a){switch(a){case ji.cbc:return"AES-CBC";case ji.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const fn=16;class gn{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?Tn(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!==ji.cbc||t.byteLength!==16)return ie.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=ze(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 hn),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 bn(this.subtle,t,n)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new cn(this.subtle,new Uint8Array(i),n).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(ie.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%fn;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(ie.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Mn=Math.pow(2,17);class dn{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 vn({type:ce.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(Dn(e));return}else e.gap=!1;const u=this.loader=s?new s(n):new r(n),f=_n(e);e.loader=u;const d=Xi(n.fragLoadPolicy.default),_={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:Mn};e.stats=u.stats;const x={onSuccess:(T,B,F,se)=>{this.resetLoader(e,u);let ue=T.data;F.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(ue.slice(0,16)),ue=ue.slice(16)),o({frag:e,part:null,payload:ue,networkDetails:se})},onError:(T,B,F,se)=>{this.resetLoader(e,u),c(new vn({type:ce.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:F,stats:se}))},onAbort:(T,B,F)=>{this.resetLoader(e,u),c(new vn({type:ce.NETWORK_ERROR,details:G.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:F,stats:T}))},onTimeout:(T,B,F)=>{this.resetLoader(e,u),c(new vn({type:ce.NETWORK_ERROR,details:G.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${_.timeout}ms`),networkDetails:F,stats:T}))}};t&&(x.onProgress=(T,B,F,se)=>t({frag:e,part:null,payload:F,networkDetails:se})),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(Dn(e,t));return}const u=this.loader=s?new s(n):new r(n),f=_n(e,t);e.loader=u;const d=Xi(n.fragLoadPolicy.default),_={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Mn};t.stats=u.stats,u.load(f,_,{onSuccess:(x,T,B,F)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const se={frag:e,part:t,payload:x.data,networkDetails:F};i(se),o(se)},onError:(x,T,B,F)=>{this.resetLoader(e,u),c(new vn({type:ce.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:F}))},onAbort:(x,T,B)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new vn({type:ce.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 vn({type:ce.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 _n(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(N(n)&&N(s)){var r;let o=n,c=s;if(a.sn==="initSegment"&&Bn((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 Dn(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),i={type:ce.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 vn(i)}function Bn(a){return a==="AES-128"||a==="AES-256"}class vn extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Hn 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 Un{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=Cn(),this.buffering={audio:Cn(),video:Cn(),audiovideo:Cn()},this.level=e,this.sn=t,this.id=i,this.size=n,this.part=s,this.partial=r}}function Cn(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Jn={length:0,start:()=>0,end:()=>0};class Ei{static isBuffered(e,t){if(e){const i=Ei.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=Ei.getBuffered(e);return Ei.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=Ei.bufferedRanges(e);if(n.length)return Ei.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||Jn}catch(t){return ie.log("failed to get media.buffered",t),Jn}}}const Wn=/\{\$([a-zA-Z0-9-_]+)\}/g;function Sn(a){return Wn.test(a)}function es(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(Wn,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 os(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 ts(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 ls=/^(\d+)x(\d+)$/,Zn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Gi{constructor(e,t){typeof e=="string"&&(e=Gi.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=ls.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(Zn.lastIndex=0;(i=Zn.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=es(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":ie.warn(`${e}: attribute ${r} is missing quotes`)}n[r]=o}return n}}const pn="com.apple.hls.interstitial";function kn(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function is(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class ln{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]){ie.warn(`DATERANGE tag attribute: "${r}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=r;break}e=g(new Gi({}),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"]);N(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?(ie.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(N(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===pn}get isValid(){return!!this.id&&!this._badValueForSameId&&N(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 en=10;class mn{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?N(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||en}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 yn(a,e){return a.length===e.length?!a.some((t,i)=>t!==e[i]):!1}function Kn(a,e){return!a&&!e?!0:!a||!e?!1:yn(a,e)}function Pn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function us(a){switch(a){case"AES-128":case"AES-256":return ji.cbc;case"AES-256-CTR":return ji.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function gs(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function ns(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function Rs(a){const e=ns(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function ii(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 _i(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=gs(r)):t=Rs(r)}}return t}const Vi=typeof self!="undefined"?self:void 0;var Ai={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Ci={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function zn(a){switch(a){case Ci.FAIRPLAY:return Ai.FAIRPLAY;case Ci.PLAYREADY:return Ai.PLAYREADY;case Ci.WIDEVINE:return Ai.WIDEVINE;case Ci.CLEARKEY:return Ai.CLEARKEY}}function An(a){switch(a){case Ai.FAIRPLAY:return Ci.FAIRPLAY;case Ai.PLAYREADY:return Ci.PLAYREADY;case Ai.WIDEVINE:return Ci.WIDEVINE;case Ai.CLEARKEY:return Ci.CLEARKEY}}function cs(a){const{drmSystems:e,widevineLicenseUrl:t}=a,i=e?[Ai.FAIRPLAY,Ai.WIDEVINE,Ai.PLAYREADY,Ai.CLEARKEY].filter(n=>!!e[n]):[];return!i[Ai.WIDEVINE]&&t&&i.push(Ai.WIDEVINE),i}const _s=function(a){return Vi!=null&&(a=Vi.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function fr(a,e,t,i){let n;switch(a){case Ai.FAIRPLAY:n=["cenc","sinf"];break;case Ai.WIDEVINE:case Ai.PLAYREADY:n=["cenc"];break;case Ai.CLEARKEY:n=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return Zr(n,e,t,i)}function Zr(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 zr(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function dr(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=gs(o).subarray(0,16);return ii(c),c}}return null}let Ls={};class Yn{static clearKeyUriToKeyIdMap(){Ls={}}static setKeyIdForUri(e,t){Ls[e]=t}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&&!Pn(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&&yn(e.keyFormatVersions,this.keyFormatVersions)&&Kn(e.iv,this.iv)&&Kn(e.keyId,this.keyId)}isSupported(){if(this.method){if(Pn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Ci.FAIRPLAY:case Ci.WIDEVINE:case Ci.PLAYREADY:case Ci.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,t){if(!this.encrypted||!this.uri)return null;if(Pn(this.method)){let s=this.iv;return s||(typeof e!="number"&&(ie.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),s=vs(e)),new Yn(this.method,this.uri,"identity",this.keyFormatVersions,s)}if(this.keyId){const s=Ls[this.uri];if(s&&!yn(this.keyId,s)&&Yn.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const i=_i(this.uri);if(i)switch(this.keyFormat){case Ci.WIDEVINE:if(this.pssh=i,!this.keyId){const s=jt(i.buffer);if(s.length){var n;const r=s[0];this.keyId=(n=r.kids)!=null&&n.length?r.kids[0]:null}}this.keyId||(this.keyId=Ns(t));break;case Ci.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=ft(s,null,i),this.keyId=dr(i);break}default:{let s=i.subarray(0,16);if(s.length!==16){const r=new Uint8Array(16);r.set(s,16-s.length),s=r}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s;s=Yr(t),s||(s=Ns(t),s||(s=Ls[this.uri])),s&&(this.keyId=s,Yn.setKeyIdForUri(this.uri,s))}return this}}function Yr(a){const e=a==null?void 0:a[Ci.WIDEVINE];return e?e.keyId:null}function Ns(a){const e=a==null?void 0:a[Ci.PLAYREADY];if(e){const t=_i(e.uri);if(t)return dr(t)}return null}function vs(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const zs=/#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,Ys=/#EXT-X-MEDIA:(.*)/g,Xr=/^#EXT(?:INF|-X-TARGETDURATION):/m,Fs=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),qr=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 $n{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 Xr.test(e)}static parseMasterPlaylist(e,t){const i=Sn(e),n={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},s=[];if(zs.lastIndex=0,!e.startsWith("#EXTM3U"))return n.playlistParsingError=new Error("no EXTM3U delimiter"),n;let r;for(;(r=zs.exec(e))!=null;)if(r[1]){var o;const u=new Gi(r[1],n),f=es(n,r[2]),d={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:$n.resolve(f,t)},_=u.decimalResolution("RESOLUTION");_&&(d.width=_.width,d.height=_.height),Xs(u.CODECS,d);const x=u["SUPPLEMENTAL-CODECS"];x&&(d.supplemental={},Xs(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 Gi(f,n),_=d["DATA-ID"];_&&(n.sessionData===null&&(n.sessionData={}),n.sessionData[_]=d);break}case"SESSION-KEY":{const d=mr(f,t,n);d.encrypted&&d.isSupported()?(n.sessionKeys===null&&(n.sessionKeys=[]),n.sessionKeys.push(d)):ie.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${f}"`);break}case"DEFINE":{{const d=new Gi(f,n);os(n,d,t)}break}case"CONTENT-STEERING":{const d=new Gi(f,n);n.contentSteering={uri:$n.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{n.startTimeOffset=gr(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(Ys.lastIndex=0;(n=Ys.exec(e))!==null;){const u=new Gi(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,F=u.CHARACTERISTICS,se=u["INSTREAM-ID"],ue={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?$n.resolve(u.URI,t):""};if(T&&(ue.assocLang=T),B&&(ue.channels=B),F&&(ue.characteristics=F),se&&(ue.instreamId=se),d!=null&&d.length){const fe=$n.findGroup(d,ue.groupId)||d[0];bs(ue,fe,"audioCodec"),bs(ue,fe,"textCodec")}_.push(ue)}}return s}static parseLevelPlaylist(e,t,i,n,s,r){var o;const c={url:t},u=new mn(t),f=u.fragments,d=[];let _=null,x=0,T=0,B=0,F=0,se=0,ue=null,fe=new Fe(n,c),Se,Ie,it,Ce=-1,Ze=!1,je=null,Ne;if(Fs.lastIndex=0,u.m3u8=e,u.hasVariableRefs=Sn(e),((o=Fs.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(Se=Fs.exec(e))!==null;){Ze&&(Ze=!1,fe=new Fe(n,c),fe.playlistOffset=B,fe.setStart(B),fe.sn=x,fe.cc=F,se&&(fe.bitrate=se),fe.level=i,_&&(fe.initSegment=_,_.rawProgramDateTime&&(fe.rawProgramDateTime=_.rawProgramDateTime,_.rawProgramDateTime=null),je&&(fe.setByteRange(je),je=null)));const di=Se[1];if(di){fe.duration=parseFloat(di);const li=(" "+Se[2]).slice(1);fe.title=li||null,fe.tagList.push(li?["INF",di,li]:["INF",di])}else if(Se[3]){if(N(fe.duration)){fe.playlistOffset=B,fe.setStart(B),it&&vr(fe,it,u),fe.sn=x,fe.level=i,fe.cc=F,f.push(fe);const li=(" "+Se[3]).slice(1);fe.relurl=es(u,li),Qs(fe,ue,d),ue=fe,B+=fe.duration,x++,T=0,Ze=!0}}else{if(Se=Se[0].match(qr),!Se){ie.warn("No matches on slow regex match for level playlist!");continue}for(Ie=1;Ie<Se.length&&Se[Ie]===void 0;Ie++);const li=(" "+Se[Ie]).slice(1),Nt=(" "+Se[Ie+1]).slice(1),ci=Se[Ie+2]?(" "+Se[Ie+2]).slice(1):null;switch(li){case"BYTERANGE":ue?fe.setByteRange(Nt,ue):fe.setByteRange(Nt);break;case"PROGRAM-DATE-TIME":fe.rawProgramDateTime=Nt,fe.tagList.push(["PROGRAM-DATE-TIME",Nt]),Ce===-1&&(Ce=f.length);break;case"PLAYLIST-TYPE":u.type&&Xn(u,li,Se),u.type=Nt.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Xn(u,li,Se):f.length>0&&Is(u,li,Se),x=u.startSN=parseInt(Nt);break;case"SKIP":{u.skippedSegments&&Xn(u,li,Se);const Qt=new Gi(Nt,u),hi=Qt.decimalInteger("SKIPPED-SEGMENTS");if(N(hi)){u.skippedSegments+=hi;for(let Kt=hi;Kt--;)f.push(null);x+=hi}const xi=Qt.enumeratedString("RECENTLY-REMOVED-DATERANGES");xi&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(xi.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Xn(u,li,Se),u.targetduration=Math.max(parseInt(Nt),1);break;case"VERSION":u.version!==null&&Xn(u,li,Se),u.version=parseInt(Nt);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Xn(u,li,Se),u.live=!1;break;case"#":(Nt||ci)&&fe.tagList.push(ci?[Nt,ci]:[Nt]);break;case"DISCONTINUITY":F++,fe.tagList.push(["DIS"]);break;case"GAP":fe.gap=!0,fe.tagList.push([li]);break;case"BITRATE":fe.tagList.push([li,Nt]),se=parseInt(Nt)*1e3,N(se)?fe.bitrate=se:se=0;break;case"DATERANGE":{const Qt=new Gi(Nt,u),hi=new ln(Qt,u.dateRanges[Qt.ID],u.dateRangeTagCount);u.dateRangeTagCount++,hi.isValid||u.skippedSegments?u.dateRanges[hi.id]=hi:ie.warn(`Ignoring invalid DATERANGE tag: "${Nt}"`),fe.tagList.push(["EXT-X-DATERANGE",Nt]);break}case"DEFINE":{{const Qt=new Gi(Nt,u);"IMPORT"in Qt?ts(u,Qt,r):os(u,Qt,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?Xn(u,li,Se):f.length>0&&Is(u,li,Se),u.startCC=F=parseInt(Nt);break;case"KEY":{const Qt=mr(Nt,t,u);if(Qt.isSupported()){if(Qt.method==="NONE"){it=void 0;break}it||(it={});const hi=it[Qt.keyFormat];hi!=null&&hi.matches(Qt)||(hi&&(it=g({},it)),it[Qt.keyFormat]=Qt)}else ie.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${Nt}"`);break}case"START":u.startTimeOffset=gr(Nt);break;case"MAP":{const Qt=new Gi(Nt,u);if(fe.duration){const hi=new Fe(n,c);_r(hi,Qt,i,it),_=hi,fe.initSegment=_,_.rawProgramDateTime&&!fe.rawProgramDateTime&&(fe.rawProgramDateTime=_.rawProgramDateTime)}else{const hi=fe.byteRangeEndOffset;if(hi){const xi=fe.byteRangeStartOffset;je=`${hi-xi}@${xi}`}else je=null;_r(fe,Qt,i,it),_=fe,Ze=!0}_.cc=F;break}case"SERVER-CONTROL":{Ne&&Xn(u,li,Se),Ne=new Gi(Nt),u.canBlockReload=Ne.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Ne.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Ne.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Ne.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Ne.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&Xn(u,li,Se);const Qt=new Gi(Nt);u.partTarget=Qt.decimalFloatingPoint("PART-TARGET");break}case"PART":{let Qt=u.partList;Qt||(Qt=u.partList=[]);const hi=T>0?Qt[Qt.length-1]:void 0,xi=T++,Kt=new Gi(Nt,u),$t=new et(Kt,fe,c,xi,hi);Qt.push($t),fe.duration+=$t.duration;break}case"PRELOAD-HINT":{const Qt=new Gi(Nt,u);u.preloadHint=Qt;break}case"RENDITION-REPORT":{const Qt=new Gi(Nt,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(Qt);break}default:ie.warn(`line parsed but not handled: ${Se}`);break}}}ue&&!ue.relurl?(f.pop(),B-=ue.duration,u.partList&&(u.fragmentHint=ue)):u.partList&&(Qs(fe,ue,d),fe.cc=F,u.fragmentHint=fe,it&&vr(fe,it,u)),u.targetduration||(u.playlistParsingError=new Error("Missing Target Duration"));const dt=f.length,Vt=f[0],oi=f[dt-1];if(B+=u.skippedSegments*u.targetduration,B>0&&dt&&oi){u.averagetargetduration=B/dt;const di=oi.sn;u.endSN=di!=="initSegment"?di:0,u.live||(oi.endList=!0),Ce>0&&(qs(f,Ce),Vt&&d.unshift(Vt))}return u.fragmentHint&&(B+=u.fragmentHint.duration),u.totalduration=B,d.length&&u.dateRangeTagCount&&Vt&&pr(d,u),u.endCC=F,u}}function pr(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=Qr(e,u,a,f,n);if(d!==-1){c.tagAnchor=e.fragments[d].ref;break}}}}function Qr(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 mr(a,e,t){var i,n;const s=new Gi(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&&ie.error(`Invalid IV: ${s.IV}`);const d=o?$n.resolve(o,e):"",_=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Yn(r,d,f,_,c,s.KEYID)}function gr(a){const t=new Gi(a).decimalFloatingPoint("TIME-OFFSET");return N(t)?t:null}function Xs(a,e){let t=(a||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{const n=t.filter(s=>ri(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 bs(a,e,t){const i=e[t];i&&(a[t]=i)}function qs(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 Qs(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function _r(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 vr(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 Xn(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Is(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function Js(a,e){const t=e.startPTS;if(N(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 yr(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(N(f)){const se=Math.abs(f-t);a&&se>a.totalduration?r.warn(`media timestamps and playlist times differ by ${se}s for level ${e.level} ${a.url}`):N(e.deltaPTS)?e.deltaPTS=Math.max(se,e.deltaPTS):e.deltaPTS=se,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,F=a.fragments;for(F[B]=e,T=B;T>0;T--)Js(F[T],F[T-1]);for(T=B;T<F.length-1;T++)Js(F[T],F[T+1]);return a.fragmentHint&&Js(F[F.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,_}function Jr(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;ta(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}N(f.startPTS)&&N(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=Er(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&&Qs(o[d],o[d-1],f);pr(f,e)}e.endCC=r[r.length-1].cc}if(!e.startCC){var c;const f=Wi(a,e.startSN-1);e.startCC=(c=f==null?void 0:f.cc)!=null?c:r[0].cc}ea(a.partList,e.partList,(f,d)=>{d.elementaryStreams=f.elementaryStreams,d.stats=f.stats}),s?yr(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS,t):Sr(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 Er(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 ln(i[c].attr,u);f.isValid?(s[c]=f,u||(f.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Pe(i[c].attr)}"`)}),s):i}function ea(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 ta(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(_&&Bs(_,x)){e.playlistParsingError=br(`media sequence mismatch ${d.sn}:`,a,e,f,d);return}else if(f.cc!==d.cc){e.playlistParsingError=br(`discontinuity sequence mismatch (${f.cc}!=${d.cc})`,a,e,f,d);return}}}}function br(a,e,t,i,n){return new Error(`${a} ${n.url}
|
|
Playlist starting @${e.startSN}
|
|
${e.m3u8}
|
|
|
|
Playlist starting @${t.startSN}
|
|
${t.m3u8}`)}function Sr(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 sn(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 Wi(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 Qi(a,e,t){return a?wn(a.partList,e,t):null}function wn(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 Rn(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 Bs(a,e){return a!==e&&e?Us(a)!==Us(e):!1}function Us(a){return a.replace(/\?[^?]*$/,"")}function Ds(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 xr(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function tr(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function Ss(a,e){const t=e.fragments;for(let i=0,n=t.length;i<n;i++)tr(t[i],a);e.fragmentHint&&tr(e.fragmentHint,a),e.alignedSliding=!0}function ir(a,e){a&&(Tr(e,a),e.alignedSliding||Ar(e,a),!e.alignedSliding&&!e.skippedSegments&&Sr(a,e,!1))}function Tr(a,e){if(!xr(e,a))return;const t=Math.min(e.endCC,a.endCC),i=Ds(e.fragments,t),n=Ds(a.fragments,t);if(!i||!n)return;ie.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const s=i.start-n.start;Ss(s,a)}function Ar(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=Ds(i,r),s=Ds(t,r)),(!n||!s)&&(n=i[Math.floor(i.length/2)],s=Ds(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);Ss(u,a)}function On(a,e,t){Nn(a,e,t),a.addEventListener(e,t)}function Nn(a,e,t){a.removeEventListener(e,t)}const Al={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}},ct={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 ia extends Hn{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=ct.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,_=Ei.bufferInfo(u||c,d,r.maxBufferHole),x=!_.len;if(this.log(`Media seeking to ${N(d)?d.toFixed(3):d}, state: ${f}, ${x?"out of":"in"} buffer`),this.state===ct.ENDED)this.resetLoadingState();else if(o){const T=r.maxFragLookUpTolerance,B=o.start-T,F=o.start+o.duration+T;if(x||F<_.start||B>_.end){const se=d>F;(d<B||se)&&(se&&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),F=this.shouldLoadParts(this.getLevelDetails(),B);F&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${B.toFixed(2)}`),this.loadingParts=F)}}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===ct.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 dn(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new gn(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===ct.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=ct.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=Ei.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 Ei.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;On(i,"seeking",this.onMediaSeeking),On(i,"ended",this.onMediaEnded);const n=this.config;this.levels&&n.autoStartLoad&&this.state===ct.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),Nn(n,"seeking",this.onMediaSeeking),Nn(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=ct.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===ct.FRAG_LOADING||!this.fragCurrent&&r===ct.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=ct.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===ct.STOPPED||this.state===ct.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)===Yt.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)===Yt.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&&Pn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(r),o.key.buffer,o.iv.buffer,us(o.method)).catch(u=>{throw n.trigger(p.ERROR,{type:ce.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===ct.STOPPED||this.state===ct.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!==ct.STOPPED&&(this.state=ct.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:ce.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?Al.toString(Ei.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=ct.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=ct.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 Un(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=ct.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(_=>{if(!this.fragContextChanged(_.frag))return this.hls.trigger(p.KEY_LOADED,_),this.state===ct.KEY_LOADING&&(this.state=ct.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=ct.FRAG_LOADING;let B;return o?B=o.then(F=>!F||this.fragContextChanged(F.frag)?null:this.doFragPartsLoad(e,T,t,n)).catch(F=>this.handleFragLoadError(F)):B=this.doFragPartsLoad(e,T,t,n).catch(F=>this.handleFragLoadError(F)),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))}`),N(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ct.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=Qi(i.details,e.sn,d.index+1)||wn(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===ce.KEY_SYSTEM_ERROR?(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)):this.hls.trigger(p.ERROR,t)}else this.hls.trigger(p.ERROR,{type:ce.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!==ct.PARSING){!this.fragCurrent&&this.state!==ct.STOPPED&&this.state!==ct.ERROR&&(this.state=ct.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?Qi(c,s,r):null,f=u?u.fragment:Wi(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!==ct.PARSING)return;const{data1:r,data2:o}=e;let c=r;if(o&&(c=ze(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(!Ei.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const i=t.currentTime,n=Ei.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(!N(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=Ei.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 Ei.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===Yt.OK||i===Yt.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(Ha(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(Ha(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=yi(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===Yt.OK||B===Yt.PARTIAL&&_.gap)&&(s=_),s&&_.sn===s.sn&&(!d||f[0].fragment.sn>_.sn||!i.live)&&_.level===s.level){const se=r[T+1];_.sn<o&&this.fragmentTracker.getState(se)!==Yt.OK?_=se:_=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&&N(s);if(r||!o&&!s){ir(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&&N(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!==ct.FRAG_LOADING_WAITING_RETRY)&&(this.state=ct.IDLE)}onFragmentOrKeyLoadError(e,t){var i;if(t.chunkMeta&&!t.frag){const se=this.getCurrentContext(t.chunkMeta);se&&(t.frag=se.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=ct.ERROR;return}const{action:c,flags:u,retryCount:f=0,retryConfig:d}=o,_=!!d,x=_&&c===Ii.RetryRequest,T=_&&!o.resolved&&u===Pi.MoveAllAlternatesMatchingHost,B=(i=this.hls.latestLevelDetails)==null?void 0:i.live;if(!x&&T&&Ee(n)&&!n.endList&&B&&!$i(t))this.resetFragmentErrors(e),this.treatAsGap(n),o.resolved=!0;else if((x||T)&&f<d.maxNumRetry){var F;const se=Ji((F=t.response)==null?void 0:F.code),ue=Zi(d,f);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+ue,this.state=ct.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,se){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 ${ue}ms`)}else if(d)if(this.resetFragmentErrors(e),f<d.maxNumRetry)!r&&c!==Ii.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${f})`);return}else c===Ii.SendAlternateToPenaltyBox?this.state=ct.WAITING_LEVEL:this.state=ct.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!Ji(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=ct.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===ct.PARSING||this.state===ct.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!==ct.STOPPED&&(this.state=ct.IDLE)}afterBufferFlushed(e,t,i){if(!e)return;const n=Ei.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,n,i),this.state===ct.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==ct.STOPPED&&(this.state=ct.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:yr(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:ce.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=ct.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 Ha(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class Wa{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=wl(e,t);else return new Uint8Array(0);return this.reset(),i}reset(){this.chunks.length=0,this.dataLength=0}}function wl(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 na={exports:{}},Za;function Rl(){return Za||(Za=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 F=this._events[B],se=arguments.length,ue,fe;if(F.fn){switch(F.once&&this.removeListener(u,F.fn,void 0,!0),se){case 1:return F.fn.call(F.context),!0;case 2:return F.fn.call(F.context,f),!0;case 3:return F.fn.call(F.context,f,d),!0;case 4:return F.fn.call(F.context,f,d,_),!0;case 5:return F.fn.call(F.context,f,d,_,x),!0;case 6:return F.fn.call(F.context,f,d,_,x,T),!0}for(fe=1,ue=new Array(se-1);fe<se;fe++)ue[fe-1]=arguments[fe];F.fn.apply(F.context,ue)}else{var Se=F.length,Ie;for(fe=0;fe<Se;fe++)switch(F[fe].once&&this.removeListener(u,F[fe].fn,void 0,!0),se){case 1:F[fe].fn.call(F[fe].context);break;case 2:F[fe].fn.call(F[fe].context,f);break;case 3:F[fe].fn.call(F[fe].context,f,d);break;case 4:F[fe].fn.call(F[fe].context,f,d,_);break;default:if(!ue)for(Ie=1,ue=new Array(se-1);Ie<se;Ie++)ue[Ie-1]=arguments[Ie];F[fe].fn.apply(F[fe].context,ue)}}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,F=[],se=T.length;B<se;B++)(T[B].fn!==f||_&&!T[B].once||d&&T[B].context!==d)&&F.push(T[B]);F.length?this._events[x]=F.length===1?F[0]:F: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}(na)),na.exports}var Ll=Rl(),sa=M(Ll);const nr="1.6.13",Ks={};function Il(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Dl(){const a=Ks[nr];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 Ks[nr]=n,n}function Cl(a){const e=Ks[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 Ks[a]=n,n}function kl(a){const e=Ks[a||nr];if(e&&e.clientCount--===1){const{worker:i,objectURL:n}=e;delete Ks[a||nr],n&&self.URL.revokeObjectURL(n),i.terminate()}}function za(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 ra(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 wr(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 sr(a,e){const t=e;let i=0;for(;ra(a,e);){i+=10;const n=wr(a,e+6);i+=n,za(a,e+10)&&(i+=10),e+=i}if(i>0)return a.subarray(t,t+i)}function Pl(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:ce.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 ie.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 Ya(a,e){return a[e]===255&&(a[e+1]&246)===240}function Xa(a,e){return a[e+1]&1?7:9}function aa(a,e){return(a[e+3]&3)<<11|a[e+4]<<3|(a[e+5]&224)>>>5}function Ol(a,e){return e+5<a.length}function Rr(a,e){return e+1<a.length&&Ya(a,e)}function Ml(a,e){return Ol(a,e)&&Ya(a,e)&&aa(a,e)<=a.length-e}function Nl(a,e){if(Rr(a,e)){const t=Xa(a,e);if(e+t>=a.length)return!1;const i=aa(a,e);if(i<=t)return!1;const n=e+i;return n===a.length||Rr(a,n)}return!1}function qa(a,e,t,i,n){if(!a.samplerate){const s=Pl(e,t,i,n);if(!s)return;g(a,s)}}function Qa(a){return 1024*9e4/a}function Fl(a,e){const t=Xa(a,e);if(e+t<=a.length){const i=aa(a,e)-t;if(i>0)return{headerLength:t,frameLength:i}}}function Ja(a,e,t,i,n){const s=Qa(a.samplerate),r=i+n*s,o=Fl(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 Bl(a,e){return ra(a,e)&&wr(a,e+6)+10<=a.length-e}function Ul(a){return a instanceof ArrayBuffer?a:a.byteOffset==0&&a.byteLength==a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer}function oa(a,e=0,t=1/0){return Kl(a,e,t,Uint8Array)}function Kl(a,e,t,i){const n=$l(a);let s=1;"BYTES_PER_ELEMENT"in i&&(s=i.BYTES_PER_ELEMENT);const r=Gl(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 $l(a){return a instanceof ArrayBuffer?a:a.buffer}function Gl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function Vl(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(oa(a.data,1,i)),s=a.data[2+i],r=a.data.subarray(3+i).indexOf(0);if(r===-1)return;const o=$e(oa(a.data,3+i,r));let c;return n==="-->"?c=$e(oa(a.data,4+i+r)):c=Ul(a.data.subarray(4+i+r)),e.mimeType=n,e.pictureType=s,e.description=o,e.data=c,e}function jl(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 Hl(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 Wl(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 Zl(a){return a.type==="PRIV"?jl(a):a.type[0]==="W"?Wl(a):a.type==="APIC"?Vl(a):Hl(a)}function zl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=wr(a,4),i=10;return{type:e,size:t,data:a.subarray(i,i+t)}}const Lr=10,Yl=10;function eo(a){let e=0;const t=[];for(;ra(a,e);){const i=wr(a,e+6);a[e+5]>>6&1&&(e+=Lr),e+=Lr;const n=e+i;for(;e+Yl<n;){const s=zl(a.subarray(e)),r=Zl(s);r&&t.push(r),e+=s.size+Lr}za(a,e)&&(e+=Lr)}return t}function to(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function Xl(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 la(a){const e=eo(a);for(let t=0;t<e.length;t++){const i=e[t];if(to(i))return Xl(i)}}let Gn=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 hs(a="",e=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ua{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=ze(this.cachedData,e),this.cachedData=null);let i=sr(e,0),n=i?i.length:0,s;const r=this._audioTrack,o=this._id3Track,c=i?la(i):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&N(c))&&(this.basePTS=ql(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:Gn.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 Bl(e,n)?(i=sr(e,n),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Gn.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=ze(this.cachedData,f):this.cachedData=f}}return{audioTrack:r,videoTrack:hs(),id3Track:o,textTrack:hs()}}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:hs(),id3Track:this._id3Track,textTrack:hs()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const ql=(a,e,t)=>{if(N(a))return a*90;const i=t?t.baseTime*9e4/t.timescale:0;return e*9e4+i};let Ir=null;const Ql=[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],Jl=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],eu=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],tu=[0,1,1,4];function io(a,e,t,i,n){if(t+24>e.length)return;const s=no(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 no(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=Ql[c*14+n-1]*1e3,d=Jl[(t===3?0:t===2?1:2)*3+s],_=o===3?1:2,x=eu[t][i],T=tu[i],B=x*8*T,F=Math.floor(x*u/d+r)*T;if(Ir===null){const fe=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ir=fe?parseInt(fe[1]):0}return!!Ir&&Ir<=87&&i===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:d,channelCount:_,frameLength:F,samplesPerFrame:B}}}function ca(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function so(a,e){return e+1<a.length&&ca(a,e)}function iu(a,e){return ca(a,e)&&4<=a.length-e}function ro(a,e){if(e+1<a.length&&ca(a,e)){const i=no(a,e);let n=4;i!=null&&i.frameLength&&(n=i.frameLength);const s=e+n;return s===a.length||so(a,s)}return!1}class nu extends ua{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=sr(e,0);let n=(i==null?void 0:i.length)||0;if(ro(e,n))return!1;for(let s=e.length;n<s;n++)if(Nl(e,n))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Ml(e,t)}appendFrame(e,t,i){qa(e,this.observer,t,i,e.manifestCodec);const n=Ja(e,t,i,this.basePTS,this.frameIndex);if(n&&n.missing===0)return n}}const ao=(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 su extends ua{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=oo(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=sr(e,0);if(!t)return!1;const i=t.length;return e[i]===11&&e[i+1]===119&&la(t)!==void 0&&ao(e,i)<16}}function oo(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,F=e[t+5]>>3,se=e[t+5]&7,ue=new Uint8Array([s<<6|F<<1|se>>2,(se&3)<<6|d<<3|x<<2|c>>4,c<<4&224]),fe=1536/o*9e4,Se=i+n*fe,Ie=e.subarray(t,t+f);return a.config=ue,a.channelCount=B,a.samplerate=o,a.samples.push({unit:Ie,pts:Se}),f}class ru extends ua{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=sr(e,0);let i=(t==null?void 0:t.length)||0;if(t&&e[i]===11&&e[i+1]===119&&la(t)!==void 0&&ao(e,i)<=16)return!1;for(let n=e.length;i<n;i++)if(ro(e,i))return ie.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return iu(e,t)}appendFrame(e,t,i){if(this.basePTS!==null)return io(e,t,i,this.basePTS,this.frameIndex)}}const au=/\/emsg[-/]ID3/i;class ou{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=hs("video",1),r=this.audioTrack=hs("audio",1),o=this.txtTrack=hs("text",1);if(this.id3Track=hs("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=we(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=kt.text,s.sampleDuration=0,s.duration=r.duration=n}resetContiguity(){this.remainderData=null}static probe(e){return Re(e)}demux(e,t){this.timeOffset=t;let i=e;const n=this.videoTrack,s=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=ze(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=Ke(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=Ke(e,t),{videoTrack:t,audioTrack:hs(),id3Track:n,textTrack:hs()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const n=ee(e.samples,["emsg"]);n&&n.forEach(s=>{const r=Bt(s);if(au.test(r.schemeIdUri)){const o=lo(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:Gn.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&r.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=lo(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:o,pts:o,type:Gn.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 lo(a,e){return N(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class lu{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new gn(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,ji.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=st(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 uo{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=ze(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=ze(T.data,t))}return e.naluState=s,o}}class rr{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&&ie.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 uu extends uo{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 F=u.data;if(c&&F.length>4){const se=this.readSliceType(F);(se===2||se===4||se===7||se===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,Oe(u.data,1,i.pts,t.samples);break}case 7:{var x,T;o=!0,c=!0;const B=u.data,F=this.readSPS(B);if(!e.sps||e.width!==F.width||e.height!==F.height||((x=e.pixelRatio)==null?void 0:x[0])!==F.pixelRatio[0]||((T=e.pixelRatio)==null?void 0:T[1])!==F.pixelRatio[1]){e.width=F.width,e.height=F.height,e.pixelRatio=F.pixelRatio,e.sps=[B];const se=B.subarray(1,4);let ue="avc1.";for(let fe=0;fe<3;fe++){let Se=se[fe].toString(16);Se.length<2&&(Se="0"+Se),ue+=Se}e.codec=ue}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 rr(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 rr(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),F=t.skipUEG.bind(t),se=this.skipScalingList.bind(this);f();const ue=f();if(d(5),T(3),f(),F(),ue===100||ue===110||ue===122||ue===244||ue===44||ue===83||ue===86||ue===118||ue===128){const Ze=_();if(Ze===3&&T(1),F(),F(),T(1),x())for(c=Ze!==3?8:12,u=0;u<c;u++)x()&&(u<6?se(16,t):se(64,t))}F();const fe=_();if(fe===0)_();else if(fe===1)for(T(1),B(),B(),o=_(),u=0;u<o;u++)B();F(),T(1);const Se=_(),Ie=_(),it=d(1);it===0&&T(1),T(1),x()&&(i=_(),n=_(),s=_(),r=_());let Ce=[1,1];if(x()&&x())switch(f()){case 1:Ce=[1,1];break;case 2:Ce=[12,11];break;case 3:Ce=[10,11];break;case 4:Ce=[16,11];break;case 5:Ce=[40,33];break;case 6:Ce=[24,11];break;case 7:Ce=[20,11];break;case 8:Ce=[32,11];break;case 9:Ce=[80,33];break;case 10:Ce=[18,11];break;case 11:Ce=[15,11];break;case 12:Ce=[64,33];break;case 13:Ce=[160,99];break;case 14:Ce=[4,3];break;case 15:Ce=[3,2];break;case 16:Ce=[2,1];break;case 255:{Ce=[f()<<8|f(),f()<<8|f()];break}}return{width:Math.ceil((Se+1)*16-i*2-n*2),height:(2-it)*(Ie+1)*16-(it?2:4)*(s+r),pixelRatio:Ce}}}class cu extends uo{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,Oe(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 rr(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 rr(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(),F=t.readUByte(),se=t.readUByte(),ue=[],fe=[];for(let Hi=0;Hi<i;Hi++)ue.push(t.readBoolean()),fe.push(t.readBoolean());if(i>0)for(let Hi=i;Hi<8;Hi++)t.readBits(2);for(let Hi=0;Hi<i;Hi++)ue[Hi]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),fe[Hi]&&t.readUByte();t.readUEG();const Se=t.readUEG();Se==3&&t.skipBits(1);const Ie=t.readUEG(),it=t.readUEG(),Ce=t.readBoolean();let Ze=0,je=0,Ne=0,dt=0;Ce&&(Ze+=t.readUEG(),je+=t.readUEG(),Ne+=t.readUEG(),dt+=t.readUEG());const Vt=t.readUEG(),oi=t.readUEG(),di=t.readUEG(),li=t.readBoolean();for(let Hi=li?0:i;Hi<=i;Hi++)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 In=0;In<4;In++)for(let Qn=0;Qn<(In===3?2:6);Qn++)if(!t.readBoolean())t.readUEG();else{const as=Math.min(64,1<<4+(In<<1));In>1&&t.readEG();for(let Zs=0;Zs<as;Zs++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const Qt=t.readUEG();let hi=0;for(let Hi=0;Hi<Qt;Hi++){let In=!1;if(Hi!==0&&(In=t.readBoolean()),In){Hi===Qt&&t.readUEG(),t.readBoolean(),t.readUEG();let Qn=0;for(let Os=0;Os<=hi;Os++){const as=t.readBoolean();let Zs=!1;as||(Zs=t.readBoolean()),(as||Zs)&&Qn++}hi=Qn}else{const Qn=t.readUEG(),Os=t.readUEG();hi=Qn+Os;for(let as=0;as<Qn;as++)t.readUEG(),t.readBoolean();for(let as=0;as<Os;as++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const Hi=t.readUEG();for(let In=0;In<Hi;In++){for(let Qn=0;Qn<di+4;Qn++)t.readBits(1);t.readBits(1)}}let Kt=0,$t=1,Oi=1,zi=!0,Fi=1,Ki=0;t.readBoolean(),t.readBoolean();let Ln=!1;if(t.readBoolean()){if(t.readBoolean()){const Ms=t.readUByte(),_l=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Wr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Ms>0&&Ms<16?($t=_l[Ms-1],Oi=Wr[Ms-1]):Ms===255&&($t=t.readBits(16),Oi=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(),Ln=t.readBoolean(),Ln&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(Fi=t.readBits(32),Ki=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const Wr=t.readBoolean(),vl=t.readBoolean();let cr=!1;(Wr||vl)&&(cr=t.readBoolean(),cr&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),cr&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let yl=0;yl<=i;yl++){zi=t.readBoolean();const jh=zi||t.readBoolean();let El=!1;jh?t.readEG():El=t.readBoolean();const bl=El?1:t.readUEG()+1;if(Wr)for(let hr=0;hr<bl;hr++)t.readUEG(),t.readUEG(),cr&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(vl)for(let hr=0;hr<bl;hr++)t.readUEG(),t.readUEG(),cr&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),Kt=t.readUEG())}let qn=Ie,ms=it;if(Ce){let Hi=1,In=1;Se===1?Hi=In=2:Se==2&&(Hi=2),qn=Ie-Hi*je-Hi*Ze,ms=it-In*dt-In*Ne}const Ps=n?["A","B","C"][n]:"",Vh=o<<24|c<<16|u<<8|f;let Va=0;for(let Hi=0;Hi<32;Hi++)Va=(Va|(Vh>>Hi&1)<<31-Hi)>>>0;let ja=Va.toString(16);return r===1&&ja==="2"&&(ja="6"),{codecString:`hvc1.${Ps}${r}.${ja}.${s?"H":"L"}${se}.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,F],general_level_idc:se,bit_depth:Vt+8,bit_depth_luma_minus8:Vt,bit_depth_chroma_minus8:oi,min_spatial_segmentation_idc:Kt,chroma_format_idc:Se,frame_rate:{fixed:zi,fps:Ki/Fi}},width:qn,height:ms,pixelRatio:[$t,Oi]}}readPPS(e){const t=new rr(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 En=188;class xs{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=xs.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(En*5,t-En)+1,n=0;for(;n<i;){let s=!1,r=-1,o=0;for(let c=n;c<t;c+=En)if(e[c]===71&&(t-c===En||e[c+En]===71)){if(o++,r===-1&&(r=c,r!==0&&(i=Math.min(r+En*99,e.length-En)+1)),s||(s=ha(e,c)===0),s&&o>1&&(r===0&&o>2||c+En>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:kt[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=xs.createTrack("video"),this._videoTrack.duration=n,this._audioTrack=xs.createTrack("audio",n),this._id3Track=xs.createTrack("id3"),this._txtTrack=xs.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,F=null,se=this.pmtParsed,ue=this._pmtId,fe=e.length;if(this.remainderData&&(e=ze(this.remainderData,e),fe=e.length,this.remainderData=null),fe<En&&!n)return this.remainderData=e,{audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};const Se=Math.max(0,xs.syncOffset(e));fe-=(fe-Se)%En,fe<e.byteLength&&!n&&(this.remainderData=new Uint8Array(e.buffer,fe,e.buffer.byteLength-fe));let Ie=0;for(let Ce=Se;Ce<fe;Ce+=En)if(e[Ce]===71){const Ze=!!(e[Ce+1]&64),je=ha(e,Ce),Ne=(e[Ce+3]&48)>>4;let dt;if(Ne>1){if(dt=Ce+5+e[Ce+4],dt===Ce+En)continue}else dt=Ce+4;switch(je){case f:Ze&&(d&&(s=$s(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(dt,Ce+En)),d.size+=Ce+En-dt);break;case _:if(Ze){if(T&&(s=$s(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(dt,Ce+En)),T.size+=Ce+En-dt);break;case x:Ze&&(B&&(s=$s(B,this.logger))&&this.parseID3PES(c,s),B={data:[],size:0}),B&&(B.data.push(e.subarray(dt,Ce+En)),B.size+=Ce+En-dt);break;case 0:Ze&&(dt+=e[dt]+1),ue=this._pmtId=hu(e,dt);break;case ue:{Ze&&(dt+=e[dt]+1);const Vt=fu(e,dt,this.typeSupported,i,this.observer,this.logger);f=Vt.videoPid,f>0&&(r.pid=f,r.segmentCodec=Vt.segmentVideoCodec),_=Vt.audioPid,_>0&&(o.pid=_,o.segmentCodec=Vt.segmentAudioCodec),x=Vt.id3Pid,x>0&&(c.pid=x),F!==null&&!se&&(this.logger.warn(`MPEG-TS PMT found at ${Ce} after unknown PID '${F}'. Backtracking to sync byte @${Se} to parse all TS packets.`),F=null,Ce=Se-188),se=this.pmtParsed=!0;break}case 17:case 8191:break;default:F=je;break}}else Ie++;Ie>0&&fa(this.observer,new Error(`Found ${Ie} TS packet/s that do not start with 0x47`),void 0,this.logger),r.pesData=d,o.pesData=T,c.pesData=B;const it={audioTrack:o,videoTrack:r,id3Track:c,textTrack:u};return n&&this.extractRemainingSamples(it),it}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=$s(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=$s(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=$s(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 lu(this.observer,this.config,t);return this.decrypt(n,s)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new uu:e==="hevc"&&(this.videoParser=new cu))}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=ze(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&&!Rr(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",fa(this.observer,new Error(d),_,this.logger),!_)return}qa(e,this.observer,s,r,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(n){const d=Qa(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=Ja(e,s,r,c,u),r+=f.length,f.missing){this.aacOverFlow=f;break}else for(u++;r<o-1&&!Rr(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(so(i,r)){const c=io(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=oo(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?Gn.emsg:Gn.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function ha(a,e){return((a[e+1]&31)<<8)+a[e+2]}function hu(a,e){return(a[e+10]&31)<<8|a[e+11]}function fu(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=ha(a,e),d=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!i){da("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){da("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){da("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 fa(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 fa(a,e,t,i){i.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:ce.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function da(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function $s(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]=ze(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 du{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 Ts=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/(Ts+1)),n=Math.floor(t%(Ts+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/(Ts+1)),n=Math.floor(t%(Ts+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/(Ts+1)),o=Math.floor(i%(Ts+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/(Ts+1)),r=Math.floor(t%(Ts+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 ze(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 co=9e4;function pa(a,e,t=1,i=!1){const n=a*e*t;return i?Math.round(n):n}function pu(a,e,t=1,i=!1){return pa(a,e,1/t,i)}function ar(a,e=!1){return pa(a,1e3,1/co,e)}function mu(a,e=1){return pa(a,co,1/e)}function ho(a){const{baseTime:e,timescale:t,trackId:i}=a;return`${e/t} (${e}/${t}) trackId: ${i}`}const gu=10*1e3,_u=1024,vu=1152,yu=1536;let Gs=null,ma=null;function fo(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 Dr 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,Gs===null){const r=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Gs=r?parseInt(r[1]):0}if(ma===null){const s=navigator.userAgent.match(/Safari\/(\d+)/i);ma=s?parseInt(s[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const t=this._initPTS;(!t||!e||e.trackId!==t.trackId||e.baseTime!==t.baseTime||e.timescale!==t.timescale)&&this.log(`Reset initPTS: ${t&&ho(t)} > ${e&&ho(e)}`),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=Vn(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,F=s;const se=e.pid>-1,ue=t.pid>-1,fe=t.samples.length,Se=e.samples.length>0,Ie=o&&fe>0||fe>1;if((!se||Se)&&(!ue||Ie)||this.ISGenerated||o){if(this.ISGenerated){var Ce,Ze,je,Ne;const di=this.videoTrackConfig;(di&&(t.width!==di.width||t.height!==di.height||((Ce=t.pixelRatio)==null?void 0:Ce[0])!==((Ze=di.pixelRatio)==null?void 0:Ze[0])||((je=t.pixelRatio)==null?void 0:je[1])!==((Ne=di.pixelRatio)==null?void 0:Ne[1]))||!di&&Ie||this.nextAudioTs===null&&Se)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,s,r));const dt=this.isVideoContiguous;let Vt=-1,oi;if(Ie&&(Vt=Eu(t.samples),!dt&&this.config.forceKeyFrameOnDiscontinuity))if(T=!0,Vt>0){this.warn(`Dropped ${Vt} out of ${fe} video samples due to a missing keyframe`);const di=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(Vt),t.dropped+=Vt,F+=(t.samples[0].pts-di)/t.inputTimeScale,oi=F}else Vt===-1&&(this.warn(`No keyframe found out of ${fe} video samples`),T=!1);if(this.ISGenerated){if(Se&&Ie){const di=this.getVideoStartPts(t.samples),Nt=(Vn(e.samples[0].pts,di)-di)/t.inputTimeScale;B+=Math.max(0,Nt),F+=Math.max(0,-Nt)}if(Se){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,ue||Ie||c===oe.AUDIO?F:void 0),Ie){const di=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,F,dt,di)}}else Ie&&(u=this.remuxVideo(t,F,dt,0));u&&(u.firstKeyFrame=Vt,u.independent=Vt!==-1,u.firstKeyFramePTS=oi)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(x=po(i,s,this._initPTS,this._initDTS)),n.samples.length&&(_=mo(n,s,this._initPTS))),{audio:f,video:u,initSegment:d,independent:T,text:_,id3:x}}computeInitPts(e,t,i,n){const s=Math.round(i*t);let r=Vn(e,s);if(r<s+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(s-r)/t} ${n}`);r<s+t;)r+=8589934592;return r-s}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=this.computeInitPts(s[0].pts,T,i,"audio"):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 F=this.getVideoStartPts(r),se=Vn(r[0].dts,F),ue=this.computeInitPts(se,T,i,"video"),fe=this.computeInitPts(F,T,i,"video");x=Math.min(x,ue),_=Math.min(_,fe)}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,F=Number.POSITIVE_INFINITY,se=Number.NEGATIVE_INFINITY,ue=!1;if(!i||d===null){const Kt=f+t*s,$t=r[0].pts-Vn(r[0].dts,r[0].pts);Gs&&d!==null&&Math.abs(Kt-$t-(d+f))<15e3?i=!0:d=Kt-$t-f}const fe=d+f;for(let Kt=0;Kt<c;Kt++){const $t=r[Kt];$t.pts=Vn($t.pts,fe),$t.dts=Vn($t.dts,fe),$t.dts<r[Kt>0?Kt-1:Kt].dts&&(ue=!0)}ue&&r.sort(function(Kt,$t){const Oi=Kt.dts-$t.dts,zi=Kt.pts-$t.pts;return Oi||zi}),T=r[0].dts,B=r[r.length-1].dts;const Se=B-T,Ie=Se?Math.round(Se/(c-1)):x||e.inputTimeScale/30;if(i){const Kt=T-fe,$t=Kt>Ie,Oi=Kt<-1;if(($t||Oi)&&($t?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ar(Kt,!0)} ms (${Kt}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ar(-Kt,!0)} ms (${Kt}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!Oi||fe>=r[0].pts||Gs)){T=fe;const zi=r[0].pts-Kt;if($t)r[0].dts=T,r[0].pts=zi;else{let Fi=!0;for(let Ki=0;Ki<r.length&&!(r[Ki].dts>zi&&Fi);Ki++){const Ln=r[Ki].pts;if(r[Ki].dts-=Kt,r[Ki].pts-=Kt,Ki<r.length-1){const xn=r[Ki+1].pts,qn=r[Ki].pts,ms=xn<=qn,Ps=xn<=Ln;Fi=ms==Ps}}}this.log(`Video: Initial PTS/DTS adjusted: ${ar(zi,!0)}/${ar(T,!0)}, delta: ${ar(Kt,!0)} ms`)}}T=Math.max(0,T);let it=0,Ce=0,Ze=T;for(let Kt=0;Kt<c;Kt++){const $t=r[Kt],Oi=$t.units,zi=Oi.length;let Fi=0;for(let Ki=0;Ki<zi;Ki++)Fi+=Oi[Ki].data.length;Ce+=Fi,it+=zi,$t.length=Fi,$t.dts<Ze?($t.dts=Ze,Ze+=Ie/4|0||1):Ze=$t.dts,F=Math.min($t.pts,F),se=Math.max($t.pts,se)}B=r[c-1].dts;const je=Ce+4*it+8;let Ne;try{Ne=new Uint8Array(je)}catch(Kt){this.observer.emit(p.ERROR,p.ERROR,{type:ce.MUX_ERROR,details:G.REMUX_ALLOC_ERROR,fatal:!1,error:Kt,bytes:je,reason:`fail allocating video mdat ${je}`});return}const dt=new DataView(Ne.buffer);dt.setUint32(0,je),Ne.set(Ue.types.mdat,4);let Vt=!1,oi=Number.POSITIVE_INFINITY,di=Number.POSITIVE_INFINITY,li=Number.NEGATIVE_INFINITY,Nt=Number.NEGATIVE_INFINITY;for(let Kt=0;Kt<c;Kt++){const $t=r[Kt],Oi=$t.units;let zi=0;for(let Ln=0,xn=Oi.length;Ln<xn;Ln++){const qn=Oi[Ln],ms=qn.data,Ps=qn.data.byteLength;dt.setUint32(_,Ps),_+=4,Ne.set(ms,_),_+=Ps,zi+=4+Ps}let Fi;if(Kt<c-1)x=r[Kt+1].dts-$t.dts,Fi=r[Kt+1].pts-$t.pts;else{const Ln=this.config,xn=Kt>0?$t.dts-r[Kt-1].dts:Ie;if(Fi=Kt>0?$t.pts-r[Kt-1].pts:Ie,Ln.stretchShortVideoTrack&&this.nextAudioTs!==null){const qn=Math.floor(Ln.maxBufferHole*s),ms=(n?F+n*s:this.nextAudioTs+f)-$t.pts;ms>qn?(x=ms-xn,x<0?x=xn:Vt=!0,this.log(`It is approximately ${ms/90} ms to the next segment; using duration ${x/90} ms for the last video frame.`)):x=xn}else x=xn}const Ki=Math.round($t.pts-$t.dts);oi=Math.min(oi,x),li=Math.max(li,x),di=Math.min(di,Fi),Nt=Math.max(Nt,Fi),o.push(fo($t.key,x,zi,Ki))}if(o.length){if(Gs){if(Gs<70){const Kt=o[0].flags;Kt.dependsOn=2,Kt.isNonSync=0}}else if(ma&&Nt-di<li-oi&&Ie/li<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Kt=T;for(let $t=0,Oi=o.length;$t<Oi;$t++){const zi=Kt+o[$t].duration,Fi=Kt+o[$t].cts;if($t<Oi-1){const Ki=zi+o[$t+1].cts;o[$t].duration=Ki-Fi}else o[$t].duration=$t?o[$t-1].duration:Ie;o[$t].cts=0,Kt=zi}}}x=Vt||!x?Ie:x;const ci=B+x;this.nextVideoTs=d=ci-f,this.videoSampleDuration=x,this.isVideoContiguous=!0;const xi={data1:Ue.moof(e.sequenceNumber++,T,g(e,{samples:o})),data2:Ne,startPTS:(F-f)/s,endPTS:(se+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 vu;case"ac3":return yu;default:return _u}}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,F=_?0:8,se=this.nextAudioTs||-1;const ue=d.baseTime*r/d.timescale,fe=ue+t*r;if(this.isAudioContiguous=i=i||B.length&&se>0&&(n&&Math.abs(fe-(se+ue))<9e3||Math.abs(Vn(B[0].pts,fe)-(se+ue))<20*f),B.forEach(function(Nt){Nt.pts=Vn(Nt.pts,fe)}),!i||se<0){const Nt=B.length;if(B=B.filter(ci=>ci.pts>=0),Nt!==B.length&&this.warn(`Removed ${B.length-Nt} of ${Nt} samples (initPTS ${ue} / ${r})`),!B.length)return;s===0?se=0:n&&!T?se=Math.max(0,fe-ue):se=B[0].pts-ue}if(e.segmentCodec==="aac"){const Nt=this.config.maxAudioFramesDrift;for(let ci=0,Qt=se+ue;ci<B.length;ci++){const hi=B[ci],xi=hi.pts,Kt=xi-Qt,$t=Math.abs(1e3*Kt/r);if(Kt<=-Nt*f&&T)ci===0&&(this.warn(`Audio frame @ ${(xi/r).toFixed(3)}s overlaps marker by ${Math.round(1e3*Kt/r)} ms.`),this.nextAudioTs=se=xi-ue,Qt=xi);else if(Kt>=Nt*f&&$t<gu&&T){let Oi=Math.round(Kt/f);for(Qt=xi-Oi*f;Qt<0&&Oi&&f;)Oi--,Qt+=f;ci===0&&(this.nextAudioTs=se=Qt-ue),this.warn(`Injecting ${Oi} audio frames @ ${((Qt-ue)/r).toFixed(3)}s due to ${Math.round(1e3*Kt/r)} ms gap.`);for(let zi=0;zi<Oi;zi++){let Fi=du.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);Fi||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),Fi=hi.unit.subarray()),B.splice(ci,0,{unit:Fi,pts:Qt}),Qt+=f,ci++}}hi.pts=Qt,Qt+=f}}let Se=null,Ie=null,it,Ce=0,Ze=B.length;for(;Ze--;)Ce+=B[Ze].unit.byteLength;for(let Nt=0,ci=B.length;Nt<ci;Nt++){const Qt=B[Nt],hi=Qt.unit;let xi=Qt.pts;if(Ie!==null){const $t=x[Nt-1];$t.duration=Math.round((xi-Ie)/c)}else if(i&&e.segmentCodec==="aac"&&(xi=se+ue),Se=xi,Ce>0){Ce+=F;try{it=new Uint8Array(Ce)}catch($t){this.observer.emit(p.ERROR,p.ERROR,{type:ce.MUX_ERROR,details:G.REMUX_ALLOC_ERROR,fatal:!1,error:$t,bytes:Ce,reason:`fail allocating audio mdat ${Ce}`});return}_||(new DataView(it.buffer).setUint32(0,Ce),it.set(Ue.types.mdat,4))}else return;it.set(hi,F);const Kt=hi.byteLength;F+=Kt,x.push(fo(!0,u,Kt,0)),Ie=xi}const je=x.length;if(!je)return;const Ne=x[x.length-1];se=Ie-ue,this.nextAudioTs=se+c*Ne.duration;const dt=_?new Uint8Array(0):Ue.moof(e.sequenceNumber++,Se/c,g({},e,{samples:x}));e.samples=[];const Vt=(Se-ue)/r,oi=se/r,li={data1:dt,data2:it,startPTS:Vt,endPTS:oi,startDTS:Vt,endDTS:oi,type:"audio",hasAudio:!0,hasVideo:!1,nb:je};return this.isAudioContiguous=!0,li}}function Vn(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 Eu(a){for(let e=0;e<a.length;e++)if(a[e].key)return e;return-1}function po(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=Vn(c.pts-t.baseTime*s/t.timescale,e*s)/s,c.dts=Vn(c.dts-i.baseTime*s/i.timescale,e*s)/s}const r=a.samples;return a.samples=[],{samples:r}}function mo(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=Vn(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 bu 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=we(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=go(s,K.AUDIO,this)),r&&(n=go(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};N(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=Xe(_,T,this),F=T.audio?B[T.audio.id]:null,se=T.video?B[T.video.id]:null,ue=Cr(se,1/0),fe=Cr(F,1/0),Se=Cr(se,0,!0),Ie=Cr(F,0,!0);let it=s,Ce=0;const Ze=F&&(!se||!u&&fe<ue||u&&u.trackId===T.audio.id),je=Ze?F:se;if(je){const Qt=je.timescale,hi=je.start-s*Qt,xi=Ze?T.audio.id:T.video.id;it=je.start/Qt,Ce=Ze?Ie-fe:Se-ue,(r||!u)&&(Su(u,it,s,Ce)||Qt!==u.timescale)&&(u&&this.warn(`Timestamps at playlist time: ${r?"":"~"}${s} ${hi/Qt} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${it-s} (${hi}/${Qt}) trackId: ${xi}`),u=null,x.initPTS=hi,x.timescale=Qt,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=it,x.timescale=1,x.trackId=-1),this.initPTS=u={baseTime:x.initPTS,timescale:x.timescale,trackId:x.trackId});const Ne=it-u.baseTime/u.timescale,dt=Ne+Ce;Ce>0?this.lastEndTime=dt:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Vt=!!T.audio,oi=!!T.video;let di="";Vt&&(di+="audio"),oi&&(di+="video");const li=(T.audio?T.audio.encrypted:!1)||(T.video?T.video.encrypted:!1),Nt={data1:_,startPTS:Ne,startDTS:Ne,endPTS:dt,endDTS:dt,type:di,hasAudio:Vt,hasVideo:oi,nb:1,dropped:0,encrypted:li};d.audio=Vt&&!oi?Nt:void 0,d.video=oi?Nt:void 0;const ci=se==null?void 0:se.sampleCount;if(ci){const Qt=se.keyFrameIndex,hi=Qt!==-1;Nt.nb=ci,Nt.dropped=Qt===0||this.isVideoContiguous?0:hi?Qt:ci,Nt.independent=hi,Nt.firstKeyFrame=Qt,hi&&se.keyFrameStart&&(Nt.firstKeyFramePTS=(se.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(d.independent=hi),this.isVideoContiguous||(this.isVideoContiguous=hi),Nt.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${Qt}/${ci} dropped: ${Nt.dropped} start: ${Nt.firstKeyFramePTS||"NA"}`)}return d.initSegment=x,d.id3=po(i,s,u,u),n.samples.length&&(d.text=mo(n,s,u)),d}}function Cr(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function Su(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 go(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"?vi(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 ys;try{ys=self.performance.now.bind(self.performance)}catch(a){ys=Date.now}const kr=[{demux:ou,remux:bu},{demux:xs,remux:Dr},{demux:nu,remux:Dr},{demux:ru,remux:Dr}];kr.splice(2,0,{demux:su,remux:Dr});class _o{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=ys();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:F,defaultInitPts:se,duration:ue,initSegmentData:fe}=c,Se=xu(r,t);if(Se&&Pn(Se.method)){const Ze=this.getDecrypter(),je=us(Se.method);if(Ze.isSync()){let Ne=Ze.softwareDecrypt(r,Se.key.buffer,Se.iv.buffer,je);if(i.part>-1){const Vt=Ze.flush();Ne=Vt&&Vt.buffer}if(!Ne)return s.executeEnd=ys(),ga(i);r=new Uint8Array(Ne)}else return this.asyncResult=!0,this.decryptionPromise=Ze.webCryptoDecrypt(r,Se.key.buffer,Se.iv.buffer,je).then(Ne=>{const dt=this.push(Ne,null,i);return this.decryptionPromise=null,dt}),this.decryptionPromise}const Ie=this.needsProbing(f,d);if(Ie){const Ze=this.configureTransmuxer(r);if(Ze)return this.logger.warn(`[transmuxer] ${Ze.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:ce.MEDIA_ERROR,details:G.FRAG_PARSING_ERROR,fatal:!1,error:Ze,reason:Ze.message}),s.executeEnd=ys(),ga(i)}(f||d||T||Ie)&&this.resetInitSegment(fe,B,F,ue,t),(f||T||Ie)&&this.resetInitialTimestamp(se),u||this.resetContiguity();const it=this.transmux(r,Se,x,_,i);this.asyncResult=or(it);const Ce=this.currentTransmuxState;return Ce.contiguous=!0,Ce.discontinuity=!1,Ce.trackSwitch=!1,s.executeEnd=ys(),it}flush(e){const t=e.transmuxing;t.executeStart=ys();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=ys();const d=[ga(e)];return this.asyncResult?Promise.resolve(d):d}const f=c.flush(o);return or(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=ys()}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,_=kr.length;d<_;d++){var r;if((r=kr[d].demux)!=null&&r.probe(e,this.logger)){s=kr[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 gn(this.config)),e}}function xu(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 ga=a=>({remuxResult:{},chunkMeta:a});function or(a){return"then"in a&&a.then instanceof Function}class Tu{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 Au{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 vo=0;class yo{constructor(e,t,i,n){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=vo++,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:ce.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 sa,this.observer.on(p.FRAG_DECRYPTED,r),this.observer.on(p.ERROR,r);const o=m(s.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(s.workerPath||Il()){try{s.workerPath?(c.log(`loading Web Worker ${s.workerPath} for "${t}"`),this.workerContext=Cl(s.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=Dl());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:Pe(s)})}catch(f){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.terminateWorker(),this.error=null,this.transmuxer=new _o(this.observer,o,s,"",t,e.logger)}return}}this.transmuxer=new _o(this.observer,o,s,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=vo++;const t=this.hls.config,i=m(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,config:Pe(t)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),kl(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,F=s.decryptdata,se=this.frag,ue=!(se&&s.cc===se.cc),fe=!(se&&u.level===se.level),Se=se?u.sn-se.sn:-1,Ie=this.part?u.part-this.part.index:-1,it=Se===0&&u.id>1&&u.id===(se==null?void 0:se.stats.chunkCount),Ce=!fe&&(Se===1||Se===0&&(Ie===1||it&&Ie<=0)),Ze=self.performance.now();(fe||Se||s.stats.parsing.start===0)&&(s.stats.parsing.start=Ze),r&&(Ie||!Ce)&&(r.stats.parsing.start=Ze);const je=!(se&&((d=s.initSegment)==null?void 0:d.url)===((_=se.initSegment)==null?void 0:_.url)),Ne=new Au(ue,Ce,c,fe,B,je);if(!Ce||ue||je){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: ${ue}
|
|
trackSwitch: ${fe}
|
|
contiguous: ${Ce}
|
|
accurateTimeOffset: ${c}
|
|
timeOffset: ${B}
|
|
initSegmentChange: ${je}`);const dt=new Tu(i,n,t,o,f);this.configureTransmuxer(dt)}if(this.frag=s,this.part=r,this.workerContext)this.workerContext.worker.postMessage({instanceNo:x,cmd:"demux",data:e,decryptdata:F,chunkMeta:u,state:Ne},e instanceof ArrayBuffer?[e]:[]);else if(T){const dt=T.push(e,F,u,Ne);or(dt)?dt.then(Vt=>{this.handleTransmuxComplete(Vt)}).catch(Vt=>{this.transmuxerError(Vt,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(dt)}}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);or(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:ce.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 Eo=100;class wu extends ia{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===ct.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===ct.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===ct.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=ct.STOPPED;return}const i=this.lastCurrentTime;this.stopLoad(),this.setInterval(Eo),i>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${i.toFixed(3)}`),e=i,this.state=ct.IDLE):this.state=ct.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case ct.IDLE:this.doTickIdle();break;case ct.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=ct.WAITING_INIT_PTS}break}case ct.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case ct.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=ct.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=ct.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=ct.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=ct.ENDED;return}const d=f.len,_=t.maxBufferLength,x=c.fragments,T=x[0].start,B=this.getLoadPosition(),F=this.flushing?B:f.end;if(this.switchingTrack&&n){const fe=B;c.PTSKnown&&fe<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&&F<x[x.length-1].start)return;let se=this.getNextFragment(F,c);if(se&&this.isLoopLoading(se,F)&&(se=this.getNextFragmentLoopLoading(se,c,f,oe.MAIN,_)),!se){this.bufferFlushed=!0;return}let ue=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&ue&&Ee(se)&&!se.endList&&(!c.live||!this.loadingParts&&F<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(ue)===Yt.OK&&(this.mainFragLoading=ue=null),ue&&Ee(ue))){if(se.start>ue.end){const Se=this.fragmentTracker.getFragAtPos(F,oe.MAIN);Se&&Se.end>ue.end&&(ue=Se,this.mainFragLoading={frag:Se,targetBufferTime:null})}if(se.start>ue.end)return}this.loadFragment(se,o,F)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(i=>new Ft(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!==ct.STOPPED&&(this.setInterval(Eo),this.state=ct.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!==ct.STOPPED&&(this.state=ct.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||(Tr(s,u),s.alignedSliding||Ar(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===ct.WAITING_TRACK&&!this.waitForCdnTuneIn(s)&&(this.state=ct.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 yo(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 F=n?n.index:-1,se=F!==-1,ue=new Un(i.level,i.sn,i.stats.chunkCount,s.byteLength,F,se);_.push(s,T,d,"",i,n,f.totalduration,!1,ue,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 Wa,complete:!1};B.push(new Uint8Array(s)),this.state!==ct.STOPPED&&(this.state=ct.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===ct.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=ct.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===ct.WAITING_TRACK&&((i=t.context)==null?void 0:i.type)===ve.AUDIO_TRACK&&(this.state=ct.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===ct.ENDED&&(this.state=ct.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=ct.PARSING,this.switchingTrack&&_&&this.completeAudioSwitch(this.switchingTrack),B!=null&&B.tracks){const F=c.initSegment||c;if(this.unhandledEncryptionError(B,c))return;this._bufferInitSegment(f,B.tracks,F,r),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:i,tracks:B.tracks})}if(_){const{startPTS:F,endPTS:se,startDTS:ue,endDTS:fe}=_;u&&(u.elementaryStreams[K.AUDIO]={startPTS:F,endPTS:se,startDTS:ue,endDTS:fe}),c.setElementaryStreamInfo(K.AUDIO,F,se,ue,fe),this.bufferFragmentData(_,c,u,r)}if(T!=null&&(t=T.samples)!=null&&t.length){const F=g({id:i,frag:c,details:d},T);n.trigger(p.FRAG_PARSING_METADATA,F)}if(x){const F=g({id:i,frag:c,details:d},x);n.trigger(p.FRAG_PARSING_USERDATA,F)}}_bufferInitSegment(e,t,i,n){if(this.state!==ct.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===Yt.NOT_LOADED||n===Yt.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=ct.WAITING_INIT_PTS;const r=this.mainDetails;r&&r.fragmentStart!==t.details.fragmentStart&&Ar(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;ui({name:t,lang:i,assocLang:n,characteristics:s,audioCodec:r,channels:o},e,ai)||(Li(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 _a 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&&pi(i);return new zt(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){Jr(i,n,this);const ue=n.playlistParsingError;if(ue){this.warn(ue);const fe=this.hls;if(!fe.config.ignorePlaylistParsingErrors){var u;const{networkDetails:Se}=t;fe.trigger(p.ERROR,{type:ce.NETWORK_ERROR,details:G.LEVEL_PARSING_ERROR,fatal:!1,url:n.url,error:ue,reason:ue.message,level:t.level||void 0,parent:(u=n.fragments[0])==null?void 0:u.type,networkDetails:Se,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=sn(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,F,se;if(n.canBlockReload&&n.endSN&&n.advanced){const ue=this.hls.config.lowLatencyMode,fe=n.lastPartSn,Se=n.endSN,Ie=n.lastPartIndex,it=Ie!==-1,Ce=fe===Se;it?Ce?(F=Se+1,se=ue?0:Ie):(F=fe,se=ue?Ie+1:n.maxPartIndex):F=Se+1;const Ze=n.age,je=Ze+n.ageHeader;let Ne=Math.min(je-n.partTarget,n.targetduration*1.5);if(Ne>0){if(je>n.targetduration*3)this.log(`Playlist last advanced ${Ze.toFixed(2)}s ago. Omitting segment and part directives.`),F=void 0,se=void 0;else if(i!=null&&i.tuneInGoal&&je-n.partTarget>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${Ne} with playlist age: ${n.age}`),Ne=0;else{const dt=Math.floor(Ne/n.targetduration);if(F+=dt,se!==void 0){const Vt=Math.round(Ne%n.targetduration/n.partTarget);se+=Vt}this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${Ze.toFixed(2)}s goal: ${Ne} skip sn ${dt} to part ${se}`)}n.tuneInGoal=Ne}if(B=this.getDeliveryDirectives(n,t.deliveryDirectives,F,se),ue||!Ce){n.requestScheduled=r,this.loadingPlaylist(f,B);return}}else(n.canBlockReload||n.canSkipUntil)&&(B=this.getDeliveryDirectives(n,t.deliveryDirectives,F,se));B&&F!==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=pi(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,n=t.part,s=St.No),new zt(i,n,s)}checkRetry(e){const t=e.details,i=Mi(e),n=e.errorAction,{action:s,retryCount:r=0,retryConfig:o}=n||{},c=!!n&&!!o&&(s===Ii.RetryRequest||!n.resolved&&s===Ii.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=Zi(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 bo(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!lr(a[t].attrs,e[t].attrs))return!1;return!0}function lr(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 va(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class Ru extends _a{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 _=Ct(c,o,ai);if(_>-1)s=o[_];else{const x=Ct(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:ce.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&&ui(e,n,ai))return n;const s=Ct(e,this.tracksInGroup,ai);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=gi(e,t.levels,i,r,ai);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const r=Ct(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||ui(e,n,ai)))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(ui({name:i,lang:n,assocLang:s,characteristics:r,audioCodec:o,channels:c},f,ai))return u}for(let u=0;u<t.length;u++){const f=t[u];if(lr(e.attrs,f.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const f=t[u];if(lr(e.attrs,f.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&Li(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 Lu{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 So=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,xo="HlsJsTrackRemovedError";class Iu extends Error{constructor(e){super(e),this.name=xo}}class Du 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=De(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,To(i),Cu(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: ${Pe(i,(c,u)=>c==="initSegment"?void 0:u)};
|
|
transfer tracks: ${Pe(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 F=Ei.getBuffered(d);_.detectEvictedFragments(u,F,x,null,!0)}const T=ya(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&&To(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[ya(e)]=[null,null];const t=this.tracks[e];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new Lu(this.tracks)}onBufferCodecs(e,t){var i;const n=this.tracks,s=Object.keys(t);this.log(`BUFFER_CODECS: "${s}" (current SB count ${this.sourceBufferCount})`);const r="audiovideo"in t&&(n.audio||n.video)||n.audiovideo&&("audio"in t||"video"in t),o=!r&&this.sourceBufferCount&&this.media&&s.some(c=>!n[c]);if(r||o){this.warn(`Unsupported transition between "${Object.keys(n)}" and "${s}" SourceBuffers`);return}s.forEach(c=>{var u,f;const d=t[c],{id:_,codec:x,levelCodec:T,container:B,metadata:F,supplemental:se}=d;let ue=n[c];const fe=(u=this.transferData)==null||(u=u.tracks)==null?void 0:u[c],Se=fe!=null&&fe.buffer?fe:ue,Ie=(Se==null?void 0:Se.pendingCodec)||(Se==null?void 0:Se.codec),it=Se==null?void 0:Se.levelCodec;ue||(ue=n[c]={buffer:void 0,listeners:[],codec:x,supplemental:se,container:B,levelCodec:T,metadata:F,id:_});const Ce=Xt(Ie,it),Ze=Ce==null?void 0:Ce.replace(So,"$1");let je=Xt(x,T);const Ne=(f=je)==null?void 0:f.replace(So,"$1");je&&Ce&&Ze!==Ne&&(c.slice(0,5)==="audio"&&(je=vi(je,this.appendSource)),this.log(`switching codec ${Ie} to ${je}`),je!==(ue.pendingCodec||ue.codec)&&(ue.pendingCodec=je),ue.container=B,this.appendChangeType(c,B,je))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((i=t.audio)==null?void 0:i.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),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&&Ei.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,F=c?c.stats.buffering:null;B.start===0&&(B.start=T),F&&F.start===0&&(F.start=T);const se=i.audio;let ue=!1;s==="audio"&&(se==null?void 0:se.container)==="audio/mpeg"&&(ue=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const fe=i.video,Se=fe==null?void 0:fe.buffer;if(Se&&_!=="initSegment"){const Ce=c||o,Ze=this.blockedAudioAppend;if(s==="audio"&&r!=="main"&&!this.blockedAudioAppend&&!(fe.ending||fe.ended)){const Ne=Ce.start+Ce.duration*.05,dt=Se.buffered,Vt=this.currentOp("video");!dt.length&&!Vt?this.blockAudio(Ce):!Vt&&!Ei.isBuffered(Se,Ne)&&this.lastVideoAppendEnd<Ne&&this.blockAudio(Ce)}else if(s==="video"){const je=Ce.end;if(Ze){const Ne=Ze.frag.start;(je>Ne||je<this.lastVideoAppendEnd||Ei.isBuffered(Se,Ne))&&this.unblockAudio()}this.lastVideoAppendEnd=je}}const Ie=(c||o).start,it={label:`append-${s}`,execute:()=>{var Ce;d.executeStart=self.performance.now();const Ze=(Ce=this.tracks[s])==null?void 0:Ce.buffer;Ze&&(ue?this.updateTimestampOffset(Ze,Ie,.1,s,_,x):f!==void 0&&N(f)&&this.updateTimestampOffset(Ze,f,1e-6,s,_,x)),this.appendExecutor(n,s)},onStart:()=>{},onComplete:()=>{const Ce=self.performance.now();d.executeEnd=d.end=Ce,B.first===0&&(B.first=Ce),F&&F.first===0&&(F.first=Ce);const Ze={};this.sourceBuffers.forEach(([je,Ne])=>{je&&(Ze[je]=Ei.getBuffered(Ne))}),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:Ze})},onError:Ce=>{var Ze;const je={type:ce.MEDIA_ERROR,parent:o.type,details:G.BUFFER_APPEND_ERROR,sourceBufferName:s,frag:o,part:c,chunkMeta:u,error:Ce,err:Ce,fatal:!1},Ne=(Ze=this.media)==null?void 0:Ze.error;if(Ce.code===DOMException.QUOTA_EXCEEDED_ERR||Ce.name=="QuotaExceededError"||"quota"in Ce)je.details=G.BUFFER_FULL_ERROR;else if(Ce.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Ne)je.errorAction=Pt(!0);else if(Ce.name===xo&&this.sourceBufferCount===0)je.errorAction=Pt(!0);else{const dt=++this.appendErrors[s];this.warn(`Failed ${dt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer (${Ne||"no media error"})`),(dt>=this.hls.config.appendErrorMaxRetry||Ne)&&(je.fatal=!0)}this.hls.trigger(p.ERROR,je)}};this.log(`queuing "${s}" append sn: ${_}${c?" p: "+c.index:""} of ${o.type===oe.MAIN?"level":"track"} ${o.level} cc: ${x}`),this.append(it,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;N(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(N(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(N(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=Ei.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=Ei.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 N(s)?{duration:s}:null;const r=this.media.duration,o=N(i.duration)?i.duration:0;return n>o&&n>r||!N(r)?{duration:n}:null}updateMediaSource({duration:e,start:t,end:i}){const n=this.mediaSource;!this.media||!n||n.readyState!=="open"||(n.duration!==e&&(N(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}) ${Pe(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:ce.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":""} ${Pe(o)}`);try{const f=i.addSourceBuffer(u),d=ya(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:ce.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")&&Rt(i,"video")&&(n=Zt(n,i));const s=Xt(n,e.levelCodec);return s?t.slice(0,5)==="audio"?vi(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:ce.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=N(n.duration)?n.duration:1/0,u=N(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 Iu(`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 To(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function Cu(a,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,a.appendChild(t)}function ya(a){return a==="audio"?1:0}class Ea{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&&N(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,Ea.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 Fn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},ku={HLS:"h"};class fs{constructor(e,t){Array.isArray(e)&&(e=e.map(i=>i instanceof fs?i:new fs(i))),this.value=e,this.params=t}}const Pu="Dict";function Ou(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 Mu(a,e,t,i){return new Error(`failed to ${a} "${Ou(e)}" as ${t}`,{cause:i})}function ds(a,e,t){return Mu("serialize",a,e,t)}class Ao{constructor(e){this.description=e}}const wo="Bare Item",Nu="Boolean";function Fu(a){if(typeof a!="boolean")throw ds(a,Nu);return a?"?1":"?0"}function Bu(a){return btoa(String.fromCharCode(...a))}const Uu="Byte Sequence";function Ku(a){if(ArrayBuffer.isView(a)===!1)throw ds(a,Uu);return`:${Bu(a)}:`}const $u="Integer";function Gu(a){return a<-999999999999999||999999999999999<a}function Ro(a){if(Gu(a))throw ds(a,$u);return a.toString()}function Vu(a){return`@${Ro(a.getTime()/1e3)}`}function Lo(a,e){if(a<0)return-Lo(-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 ju="Decimal";function Hu(a){const e=Lo(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw ds(a,ju);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Wu="String",Zu=/[\x00-\x1f\x7f]+/;function zu(a){if(Zu.test(a))throw ds(a,Wu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Yu(a){return a.description||a.toString().slice(7,-1)}const Xu="Token";function Io(a){const e=Yu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw ds(e,Xu);return e}function ba(a){switch(typeof a){case"number":if(!N(a))throw ds(a,wo);return Number.isInteger(a)?Ro(a):Hu(a);case"string":return zu(a);case"symbol":return Io(a);case"boolean":return Fu(a);case"object":if(a instanceof Date)return Vu(a);if(a instanceof Uint8Array)return Ku(a);if(a instanceof Ao)return Io(a);default:throw ds(a,wo)}}const qu="Key";function Sa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw ds(a,qu);return a}function xa(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${Sa(e)}`:`;${Sa(e)}=${ba(t)}`).join("")}function Do(a){return a instanceof fs?`${ba(a.value)}${xa(a.params)}`:ba(a)}function Qu(a){return`(${a.value.map(Do).join(" ")})${xa(a.params)}`}function Ju(a,e={whitespace:!0}){if(typeof a!="object"||a==null)throw ds(a,Pu);const t=a instanceof Map?a.entries():Object.entries(a),i=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([n,s])=>{s instanceof fs||(s=new fs(s));let r=Sa(n);return s.value===!0?r+=xa(s.params):(r+="=",Array.isArray(s.value)?r+=Qu(s):r+=Do(s)),r}).join(`,${i}`)}function Co(a,e){return Ju(a,e)}const ps="CMCD-Object",un="CMCD-Request",Cs="CMCD-Session",As="CMCD-Status",ec={br:ps,ab:ps,d:ps,ot:ps,tb:ps,tpb:ps,lb:ps,tab:ps,lab:ps,url:ps,pb:un,bl:un,tbl:un,dl:un,ltc:un,mtp:un,nor:un,nrr:un,rc:un,sn:un,sta:un,su:un,ttfb:un,ttfbb:un,ttlb:un,cmsdd:un,cmsds:un,smrt:un,df:un,cs:un,ts:un,cid:Cs,pr:Cs,sf:Cs,sid:Cs,st:Cs,v:Cs,msd:Cs,bs:As,bsd:As,cdn:As,rtp:As,bg:As,pt:As,ec:As,e:As},tc={REQUEST:un};function ic(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 nc(a,e){const t={};if(!a)return t;const i=Object.keys(a),n=e?ic(e):{};return i.reduce((s,r)=>{var o;const c=ec[r]||n[r]||tc.REQUEST,u=(o=s[c])!==null&&o!==void 0?o:s[c]={};return u[r]=a[r],s},t)}function sc(a){return["ot","sf","st","e","sta"].includes(a)}function rc(a){return typeof a=="number"?N(a):a!=null&&a!==""&&a!==!1}const ko="event";function ac(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 Pr=a=>Math.round(a),Ta=(a,e)=>Array.isArray(a)?a.map(t=>Ta(t,e)):a instanceof fs&&typeof a.value=="string"?new fs(Ta(a.value,e),a.params):(e.baseUrl&&(a=ac(a,e.baseUrl)),e.version===1?encodeURIComponent(a):a),Or=a=>Pr(a/100)*100,oc={br:Pr,d:Pr,bl:Or,dl:Or,mtp:Or,nor:(a,e)=>{let t=a;return e.version>=2&&(a instanceof fs&&typeof a.value=="string"?t=new fs([a]):typeof a=="string"&&(t=[a])),Ta(t,e)},rtp:Or,tb:Pr},Po="request",Oo="response",Aa=["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"],lc=["e"],uc=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Mr(a){return uc.test(a)}function cc(a){return Aa.includes(a)||lc.includes(a)||Mr(a)}const Mo=["d","dl","nor","ot","rtp","su"];function hc(a){return Aa.includes(a)||Mo.includes(a)||Mr(a)}const fc=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function dc(a){return Aa.includes(a)||Mo.includes(a)||fc.includes(a)||Mr(a)}const pc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function mc(a){return pc.includes(a)||Mr(a)}const gc={[Oo]:dc,[ko]:cc,[Po]:hc};function No(a,e={}){const t={};if(a==null||typeof a!="object")return t;const i=e.version||a.v||1,n=e.reportingMode||Po,s=i===1?mc:gc[n];let r=Object.keys(a).filter(s);const o=e.filter;typeof o=="function"&&(r=r.filter(o));const c=n===Oo||n===ko;c&&!r.includes("ts")&&r.push("ts"),i>1&&!r.includes("v")&&r.push("v");const u=g({},oc,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"&&!N(_)&&(_=Date.now()),rc(_)&&(sc(d)&&typeof _=="string"&&(_=new Ao(_)),t[d]=_))}),t}function _c(a,e={}){const t={};if(!a)return t;const i=No(a,e),n=nc(i,e==null?void 0:e.customHeaderMap);return Object.entries(n).reduce((s,[r,o])=>{const c=Co(o,{whitespace:!1});return c&&(s[r]=c),s},t)}function vc(a,e,t){return g(a,_c(e,t))}const yc="CMCD";function Ec(a,e={}){return a?Co(No(a,e),{whitespace:!1}):""}function bc(a,e={}){if(!a)return"";const t=Ec(a,e);return encodeURIComponent(t)}function Sc(a,e={}){if(!a)return"";const t=bc(a,e);return`${yc}=${t}`}const Fo=/CMCD=[^&#]+/;function xc(a,e,t){const i=Sc(e,t);if(!i)return a;if(Fo.test(a))return a.replace(Fo,i);const n=a.includes("?")?"&":"?";return`${a}${n}${i}`}class Tc{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:Fn.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===Fn.VIDEO||c===Fn.AUDIO||c==Fn.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:ku.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===Fn.INIT||t.ot===Fn.VIDEO||t.ot===Fn.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={}),vc(e.headers,t,s)):e.url=xc(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 Fn.TIMED_TEXT;if(e.sn==="initSegment")return Fn.INIT;if(t==="audio")return Fn.AUDIO;if(t==="main")return this.hls.audioTracks.length?Fn.VIDEO:Fn.MUXED}getTopBandwidth(e){let t=0,i;const n=this.hls;if(e===Fn.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===Fn.AUDIO?this.audioBuffer:this.videoBuffer;return!i||!t?NaN:Ei.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 Ac=3e5;class wc 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)===Ii.SendAlternateToPenaltyBox&&i.flags===Pi.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: ${Pe(s)} penalized: ${Pe(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]>Ac&&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,Rn(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 Gi(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=Uo(f.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),B=new Ft({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 F=1;F<f.audioGroups.length;F++)B.addGroupId("audio",`${f.audioGroups[F]}_clone_${r}`);if(f.subtitleGroups)for(let F=1;F<f.subtitleGroups.length;F++)B.addGroupId("text",`${f.subtitleGroups[F]}_clone_${r}`);return B});t.push(...u),Bo(this.audioTracks,i,c,r),Bo(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":F,"PATHWAY-PRIORITY":se}=T;if(B)try{this.uri=new self.URL(B,n).href}catch(fe){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${B}`);return}this.scheduleRefresh(this.uri||_.url),F&&this.clonePathways(F);const ue={steeringManifest:T,url:n.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,ue),se&&this.updatePathwayPriority(se)},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 F=B.getResponseHeader("Retry-After");F&&(T=parseFloat(F)*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 Bo(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 Gi(o.attrs),o.url=o.attrs.URI=Uo(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 Uo(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 Vs 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=Vs.CDMCleanupPromise?[Vs.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=cs(this.config));const o=r.map(An).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(r=>{const o=zn(r);if(i!=="sinf"||o!==Ai.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${i}" for selected key-system ${o}`);return}let c;try{const x=Ye(new Uint8Array(n)),T=gs(JSON.parse(x).sinf),B=Ae(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 F=J(B.keyId);if(yn(c,B.keyId)||B.uri.replace(/-/g,"").indexOf(u)!==-1){if(_=f[F],!_)continue;if(B.pssh)break;delete f[F],B.pssh=new Uint8Array(n),B.keyId=c,_=f[u]=_.then(()=>this.generateRequestWithPreferredKeySession(T,i,n,"encrypted-event-key-match")),_.catch(se=>this.handleError(se));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===Ai.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 jn?o(d):o(new jn({type:ce.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 _s===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=fr(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: ${Pe(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||[])} keyUri: ${e.uri}`);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=Nr(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)}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})=>An(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=An(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=cs(this.config),i=e.map(zn).filter(n=>!!n&&t.indexOf(n)!==-1);return this.selectKeySystem(i)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let i=0;i<t.length;i++){const n=Rc(e,t[i]);if(n)return n}}loadKey(e){const t=e.keyInfo.decryptdata,i=Nr(t),n=this.bannedKeyIds[i];if(n||this.getKeyStatus(t)==="internal-error"){const o=Ko(n||"internal-error",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.catch(o=>{if(o instanceof jn){const c=E({},o.data);this.getKeyStatus(t)==="internal-error"&&(c.decryptdata=t);const u=new jn(c,o.message);this.handleError(u,e.frag)}}),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof jn){t&&(e.data.frag=t);const i=e.data.decryptdata;this.error(`${e.message}${i?` (${J(i.keyId||[])})`:""}`),this.hls.trigger(p.ERROR,e.data)}else this.error(e.message),this.hls.trigger(p.ERROR,{type:ce.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=Nr(e),i=this.keyIdToKeySessionPromise[t];if(!i){const n=zn(e.keyFormat),s=n?[n]:cs(this.config);return this.attemptKeySystemAccess(s)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=cs(this.config)),e.length===0)throw new jn({type:ce.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Pe({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 T=r.call(this.hls,t,i,e);if(!T)throw new Error("Invalid response from configured generateRequest filter");t=T.initDataType,i=T.initData?T.initData:null,e.decryptdata.pssh=i?new Uint8Array(i):null}catch(T){if(this.warn(T.message),this.hls&&this.hls.config.debug)throw T}if(i===null)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(e);const o=Nr(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${n}" keyId: ${o} URI: ${c} (init data type: ${t} length: ${i.byteLength})`);const u=new sa,f=e._onmessage=T=>{const B=e.mediaKeysSession;if(!B){u.emit("error",new Error("invalid state"));return}const{messageType:F,message:se}=T;this.log(`"${F}" message event for session "${B.sessionId}" message size: ${se.byteLength}`),F==="license-request"||F==="license-renewal"?this.renewLicense(e,se).catch(ue=>{u.eventNames().length?u.emit("error",ue):this.handleError(ue)}):F==="license-release"?e.keySystem===Ai.FAIRPLAY&&this.updateKeySession(e,ns("acknowledged")).then(()=>this.removeSession(e)).catch(ue=>this.handleError(ue)):this.warn(`unhandled media key message type "${F}"`)},d=(T,B)=>{B.keyStatus=T;let F;T.startsWith("usable")?u.emit("resolved"):T==="internal-error"||T==="output-restricted"||T==="output-downscaled"?F=Ko(T,B.decryptdata):T==="expired"?F=new Error(`key expired (keyId: ${o})`):T==="released"?F=new Error("key released"):T==="status-pending"||this.warn(`unhandled key status change "${T}" (keyId: ${o})`),F&&(u.eventNames().length?u.emit("error",F):this.handleError(F))},_=e._onkeystatuseschange=T=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}const F=this.getKeyStatuses(e);if(!Object.keys(F).some(Se=>F[Se]!=="status-pending"))return;if(F[o]==="expired"){this.log(`Expired key ${Pe(F)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let ue=F[o];if(ue)d(ue,e);else{var fe;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(fe=e.keyStatusTimeouts)[o]||(fe[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const Ie=this.getKeyStatus(e.decryptdata);if(Ie&&Ie!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${Ie} from other session.`),d(Ie,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),ue="internal-error",d(ue,e)},1e3)),this.log(`No status for keyId ${o} (${Pe(F)}).`)}};On(e.mediaKeysSession,"message",f),On(e.mediaKeysSession,"keystatuseschange",_);const x=new Promise((T,B)=>{u.on("error",B),u.on("resolved",T)});return e.mediaKeysSession.generateRequest(t,i).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${c}`)}).catch(T=>{throw new jn({type:ce.KEY_SYSTEM_ERROR,details:G.KEY_SYSTEM_NO_SESSION,error:T,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${T}`)}).then(()=>x).catch(T=>(u.removeAllListeners(),this.removeSession(e).then(()=>{throw T}))).then(()=>(u.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((i,n)=>{if(typeof n=="string"&&typeof i=="object"){const o=n;n=i,i=o}const s="buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n);e.keySystem===Ai.PLAYREADY&&s.length===16&&ii(s);const r=J(s);i==="internal-error"&&(this.bannedKeyIds[r]=i),this.log(`key status change "${i}" for keyStatuses keyId: ${r} key-session "${e.mediaKeysSession.sessionId}"`),t[r]=i}),t}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 jn({type:ce.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 jn({type:ce.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 jn({type:ce.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 jn({type:ce.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 ns(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 jn({type:ce.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==Ai.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,On(i,"encrypted",this.onMediaEncrypted),On(i,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(Nn(e,"encrypted",this.onMediaEncrypted),Nn(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,Yn.clearKeyUriToKeyIdMap();const n=i.length;Vs.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:ce.OTHER_ERROR,details:G.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${s}`)})}))||Promise.resolve())).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`),this.hls&&this.hls.trigger(p.ERROR,{type:ce.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{keyStatusTimeouts:r}=e;r&&Object.keys(r).forEach(u=>self.clearTimeout(r[u]));const{drmSystemOptions:o}=this.config;return(zr(o)?new Promise((u,f)=>{self.setTimeout(()=>f(new Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(u).catch(f)}):Promise.resolve()).catch(u=>{this.log(`Could not remove session: ${u}`),this.hls&&this.hls.trigger(p.ERROR,{type:ce.OTHER_ERROR,details:G.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${u}`)})}).then(()=>t.close()).catch(u=>{this.log(`Could not close session: ${u}`),this.hls&&this.hls.trigger(p.ERROR,{type:ce.OTHER_ERROR,details:G.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${u}`)})})}return Promise.resolve()}}Vs.CDMCleanupPromise=void 0;function Nr(a){if(!a)throw new Error("Could not read keyId of undefined decryptdata");if(a.keyId===null)throw new Error("keyId is null");return J(a.keyId)}function Rc(a,e){if(a.keyId&&e.mediaKeysSession.keyStatuses.has(a.keyId))return e.mediaKeysSession.keyStatuses.get(a.keyId);if(a.matches(e.decryptdata))return e.keyStatus}class jn 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 Ko(a,e){const t=a==="output-restricted",i=t?G.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:G.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new jn({type:ce.KEY_SYSTEM_ERROR,details:i,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${a}"`)}class Lc{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 $o(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 Go(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){ie.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){ie.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${n}`)}}t==="disabled"&&(a.mode=t)}function js(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 wa(a,e,t,i){const n=a.mode;if(n==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const s=Dc(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 Ic(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 Dc(a,e,t){const i=[],n=Ic(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 Fr(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 Cc extends _a{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=Fr(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;Fr(i.textTracks).forEach(r=>{js(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=Ct(o,r);if(f>-1)s=r[f];else{const d=Ct(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||ui(s,e)))return n}if(e){for(let n=0;n<t.length;n++){const s=t[n];if(lr(e.attrs,s.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return n}for(let n=0;n<t.length;n++){const s=t[n];if(lr(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(va(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&&ui(e,i))return i;const n=Ct(e,this.tracksInGroup);if(n>-1){const s=this.tracksInGroup[n];return this.setSubtitleTrack(n),s}else{if(i)return null;{const s=Ct(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=Fr(e.textTracks),i=this.currentTrack;let n;if(i&&(n=t.filter(s=>va(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||!N(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 kc(){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 ur(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const Hs=.025;let Br=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Pc(a,e,t){return`${a.identifier}-${t+1}-${ur(e)}`}class Oc{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 Ra(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=Ra(t,e);return t-i<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=N(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 Ra(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)<Hs))}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"?Br.Range:Br.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 Mc(this)}}function Ra(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<Hs)?e.start:e.start+e.duration}function Vo(a,e,t){const i=new self.URL(a,t);return i.protocol!=="data:"&&i.searchParams.set("_HLS_primary_id",e),i}function La(a,e){for(;(t=a.assetList[++e])!=null&&t.error;)var t;return e}function Mc(a){return`["${a.identifier}" ${a.cue.pre?"<pre>":a.cue.post?"<post>":""}${a.timelineStart.toFixed(2)}-${a.resumeTime.toFixed(2)}]`}function Ws(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Nc{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=Vo(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=Ei.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=Ei.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: ${Ws(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const jo=.033;class Fc 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,F=f.startTime;if(B!==F)return B-F}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 Oc(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,F=x?s:f.startOffset,se=f.duration,ue=f.timelineOccupancy===Br.Range?se:0,fe=f.resumptionOffset,Se=(T==null?void 0:T.startTime)===F,Ie=F+f.cumulativeDuration;let it=B?Ie+se:F+fe;if(_||!x&&F<=0){const Ze=u;u+=ue,f.timelineStart=Ie;const je=r;r+=se,i.push({event:f,start:Ie,end:it,playout:{start:je,end:r},integrated:{start:Ze,end:u}})}else if(F<=s){if(!Se){const Ne=F-c;if(Ne>jo){const dt=c,Vt=u;u+=Ne;const oi=r;r+=Ne;const di={previousEvent:e[d-1]||null,nextEvent:f,start:dt,end:dt+Ne,playout:{start:oi,end:r},integrated:{start:Vt,end:u}};i.push(di)}else Ne>0&&T&&(T.cumulativeDuration+=Ne,i[i.length-1].end=F)}x&&(it=Ie),f.timelineStart=Ie;const Ze=u;u+=ue;const je=r;r+=se,i.push({event:f,start:Ie,end:it,playout:{start:je,end:r},integrated:{start:Ze,end:u}})}else return;const Ce=f.resumeTime;x||Ce>s?c=s:c=Ce}),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<jo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const x=N(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)>Hs?(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)<Hs+f||Math.abs(u.end-i)<Hs+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 ss(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class Bc{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,t){const i=e.assetListUrl;let n;try{n=Vo(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 F=_.data,se=F==null?void 0:F.ASSETS;if(!Array.isArray(se)){const ue=this.assignAssetListError(e,G.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),T.url,x,B);this.hls.trigger(p.ERROR,ue);return}e.assetListResponse=F,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:F,networkDetails:B})},onError:(_,x,T,B)=>{const F=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,F)},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:ce.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:n,error:i,networkDetails:r,stats:s}}}function Ho(a){a==null||a.play().catch(()=>{})}function Ur(a,e){return`[${a}] Advancing timeline position to ${e}`}class Uc 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=>ss(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(F=>{this.clearAssetPlayer(F.identifier,null)})}),this.playerQueue.forEach(B=>{if(B.interstitial.appendInPlace){const F=B.assetItem.timelineStart,se=B.timelineOffset-F;if(se)try{B.timelineOffset=F}catch(ue){Math.abs(se)>Hs&&this.warn(`${ue} ("${B.assetId}" ${B.timelineOffset}->${F})`)}}}),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 Bc(e),this.schedule=new Fc(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){Nn(e,"play",this.onPlay),Nn(e,"pause",this.onPause),Nn(e,"seeking",this.onSeeking),Nn(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const i=this.media=t.media;On(i,"seeking",this.onSeeking),On(i,"timeupdate",this.onTimeupdate),On(i,"play",this.onPlay),On(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 F=d[_].start;const se=d.event;if(se){if(_==="playout"||se.timelineOccupancy!==Br.Point){const ue=i(x);(ue==null?void 0:ue.interstitial)===se&&(F+=ue.assetItem.startOffset+ue[B])}}else{const ue=T==="bufferedPos"?r():e[T];F+=ue-d.start}return F}return 0},s=(d,_)=>{var x;if(d!==0&&_!=="primary"&&(x=e.schedule)!=null&&x.length){var T;const B=e.schedule.findItemIndexAtTime(d),F=(T=e.schedule.items)==null?void 0:T[B];if(F){const se=F[_].start-F.start;return d+se}}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 F=e.effectivePlayingItem,se=e.schedule.findItemIndexAtTime(d,_),ue=(T=e.schedule.items)==null?void 0:T[se],fe=e.getBufferingPlayer(),Se=fe==null?void 0:fe.interstitial,Ie=Se==null?void 0:Se.appendInPlace,it=F&&e.itemsMatch(F,ue);if(F&&(Ie||it)){const Ce=i(e.playingAsset),Ze=(Ce==null?void 0:Ce.media)||e.primaryMedia;if(Ze){const je=_==="primary"?Ze.currentTime:n(F,_,e.playingAsset,"timelinePos","currentTime"),Ne=d-je,dt=(Ie?je:Ze.currentTime)+Ne;if(dt>=0&&(!Ce||Ie||dt<=Ce.duration)){Ze.currentTime=dt;return}}}if(ue){let Ce=d;if(_!=="primary"){const je=ue[_].start,Ne=d-je;Ce=ue.start+Ne}const Ze=!e.isInterstitial(ue);if((!e.isInterstitial(F)||F.event.appendInPlace)&&(Ze||ue.event.appendInPlace)){const je=e.media||(Ie?fe==null?void 0:fe.media:null);je&&(je.currentTime=Ce)}else if(F){const je=e.findItemIndex(F);if(se>je){const dt=e.schedule.findJumpRestrictedIndex(je+1,se);if(dt>je){e.setSchedulePosition(dt);return}}let Ne=0;if(Ze)e.timelinePos=Ce,e.checkBuffer();else{const dt=ue.event.assetList,Vt=d-(ue[_]||ue).start;for(let oi=dt.length;oi--;){const di=dt[oi];if(di.duration&&Vt>=di.startOffset&&Vt<di.startOffset+di.duration){Ne=oi;break}}}e.setSchedulePosition(se,Ne)}}},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||!N(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} ${Pe(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 ${Pe(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 F=B.interstitial;this.clearInterstitial(B.interstitial,null),F.appendInPlace=!1,F.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${F}`)}}),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(Ur("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=La(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=La(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(Ur("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&&ss(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} ${Ws(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} ${ss(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=La(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 ${ss(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&&Ho(_.media)}else o?(this.resumePrimary(o,e,n),this.shouldPlay&&Ho(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 ${ss(e)}`),!((n=this.detachedData)!=null&&n.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(Ur("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 ${ss(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:Ei.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(Ur("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];if(!i.details)return;const 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=pt(t);this.playerQueue.forEach(({hls:n})=>n&&(n.setAudioOption(t)||n.setAudioOption(i)))}onSubtitleTrackSwitch(e,t){const i=pt(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=Ei.bufferInfo(this.primaryMedia,i,0);(n.end>i||(n.nextStart||0)>i)&&(this.log(`trim buffered interstitial ${ss(e)} (was ${ss(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=Ei.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 ${ss(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:Pc(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 Se=this.timelinePos-t.timelineStart;if(Se>1){const Ie=t.duration;Ie&&Se<Ie&&(f=Se)}}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:ur(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const T=new Nc(this.HlsPlayerClass,_,e,t);this.playerQueue.push(T),e.assetList[i]=t;let B=!0;const F=Se=>{if(Se.live){var Ie;const Ze=new Error(`Interstitials MUST be VOD assets ${e}`),je={fatal:!0,type:ce.OTHER_ERROR,details:G.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ze},Ne=((Ie=this.schedule)==null?void 0:Ie.findEventIndex(e.identifier))||-1;this.handleAssetItemError(je,e,Ne,i,Ze.message);return}const it=Se.edge-Se.fragmentStart,Ce=t.duration;(B||Ce===null||it>Ce)&&(B=!1,this.log(`Interstitial asset "${d}" duration change ${Ce} > ${it}`),t.duration=it,this.updateSchedule())};T.on(p.LEVEL_UPDATED,(Se,{details:Ie})=>F(Ie)),T.on(p.LEVEL_PTS_UPDATED,(Se,{details:Ie})=>F(Ie)),T.on(p.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const se=(Se,Ie)=>{const it=this.getAssetPlayer(d);if(it&&Ie.tracks){it.off(p.BUFFER_CODECS,se),it.tracks=Ie.tracks;const Ce=this.primaryMedia;this.bufferingAsset===it.assetItem&&Ce&&!it.media&&this.bufferAssetPlayer(it,Ce)}};T.on(p.BUFFER_CODECS,se);const ue=()=>{var Se;const Ie=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${Ie}`),!Ie||!this.schedule)return;const it=this.schedule.findEventIndex(e.identifier),Ce=(Se=this.schedule.items)==null?void 0:Se[it];this.isInterstitial(Ce)&&this.advanceAssetBuffering(Ce,t)};T.on(p.BUFFERED_TO_END,ue);const fe=Se=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const it=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,it,Se)};return T.once(p.MEDIA_ENDED,fe(i)),T.once(p.PLAYOUT_LIMIT_REACHED,fe(1/0)),T.on(p.ERROR,(Se,Ie)=>{if(!this.schedule)return;const it=this.getAssetPlayer(d);if(Ie.details===G.BUFFER_STALLED_ERROR){if(it!=null&&it.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(Ie,e,this.schedule.findEventIndex(e.identifier),i,`Asset player error ${Ie.error} ${e}`)}),T.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const Ie=new Error(`Asset player destroyed unexpectedly ${d}`),it={fatal:!0,type:ce.OTHER_ERROR,details:G.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ie};this.handleAssetItemError(it,e,this.schedule.findEventIndex(e.identifier),i,Ie.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${Ws(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&&ss(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} ${Ws(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 ${Ws(r)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),x={fatal:!0,type:ce.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&&Ws(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:Pt(!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: ${ss(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,F)=>{const se=parseFloat(B.DURATION);this.createAsset(s,F,f,c+f,se,B.URI),f+=se}),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),F=(T=this.schedule.items)==null?void 0:T[B];if(F){if(!this.playingItem&&this.timelinePos>F.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(F)}this.setSchedulePosition(B)}else if((x==null?void 0:x.identifier)===r){const B=s.assetList[0];if(B){const F=this.getAssetPlayer(B.identifier);if(x.appendInPlace){const se=this.primaryMedia;F&&se&&this.bufferAssetPlayer(F,se)}else F&&F.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 Wo=500;class Kc extends ia{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=ct.IDLE,this.setInterval(Wo),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=ct.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!==ct.STOPPED&&(this.state=ct.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&bo(this.levels,t)){this.levels=t.map(i=>new Ft(i));return}this.tracksBuffered=[],this.levels=t.map(i=>{const n=new Ft(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!==ct.STOPPED&&this.setInterval(Wo)}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?(Ar(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===ct.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&&Pn(n.method)){const r=performance.now();this.decrypter.decrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer,us(n.method)).catch(o=>{throw s.trigger(p.ERROR,{type:ce.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=ct.IDLE})}}doTick(){if(!this.media){this.state=ct.IDLE;return}if(this.state===ct.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=Ei.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 ue=n.maxFragLookUpTolerance,fe=o>x-ue?0:ue;T=wi(B,d,Math.max(d[0].start,o),fe),!T&&B&&B.start<d[0].start&&(T=d[0])}else T=d[_-1];if(T=this.filterReplacedPrimary(T,i.details),!T)return;const F=T.sn-u.startSN,se=d[F-1];if(se&&se.cc===T.cc&&this.fragmentTracker.getState(se)===Yt.NOT_LOADED&&(T=se),this.fragmentTracker.getState(T)===Yt.NOT_LOADED){const ue=this.mapToInitFragWhenRequired(T);ue&&this.loadFragment(ue,i,o)}}}loadFragment(e,t,i){Ee(e)?super.loadFragment(e,t,i):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new $c(this.tracksBuffered[this.currentTrackId]||[])}}class $c{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 Gc={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},Zo=a=>String.fromCharCode(Gc[a]||a),rs=15,Es=100,Vc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},jc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Hc={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Wc={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Zc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class zc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i=typeof t=="function"?t():t;ie.log(`${this.time} [${e}] ${i}`)}}}const ks=function(e){const t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t};class zo{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 Yc{constructor(){this.uchar=" ",this.penState=new zo}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 Xc{constructor(e){this.chars=[],this.pos=0,this.currPenState=new zo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Es;t++)this.chars.push(new Yc);this.logger=e}equals(e){for(let t=0;t<Es;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Es;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Es;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>Es&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Es)}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=Zo(e);if(this.pos>=Es){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<Es;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<Es;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 Ia{constructor(e){this.rows=[],this.currRow=rs-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<rs;t++)this.rows.push(new Xc(e));this.logger=e}reset(){for(let e=0;e<rs;e++)this.rows[e].clear();this.currRow=rs-1}equals(e){let t=!0;for(let i=0;i<rs;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<rs;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<rs;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 = "+Pe(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<rs;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 = "+Pe(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<rs;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 Yo{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 Ia(i),this.nonDisplayedMemory=new Ia(i),this.lastOutputScreen=new Ia(i),this.currRollUpRow=this.displayedMemory.rows[rs-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[rs-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: "+Pe(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 Xo{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Qc(),this.logger=void 0;const n=this.logger=new zc;this.channels=[null,new Yo(e,t,n),new Yo(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,()=>"["+ks([t[i],t[i+1]])+"] -> ("+ks([n,s])+")");const c=this.cmdHistory;if(n>=16&&n<=31){if(qc(n,s,c)){Kr(null,null,c),this.logger.log(3,()=>"Repeated command ("+ks([n,s])+") is dropped");continue}Kr(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 Kr(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 "+ks([n,s])+" orig: "+ks([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 ("+ks([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?Vc[e]:Hc[e]:i=r===1?jc[e]:Wc[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 '"+Zo(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 = "+ks(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=Zc[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()}Kr(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 Kr(a,e,t){t.a=a,t.b=e}function qc(a,e,t){return t.a===a&&t.b===e}function Qc(){return{a:null,b:null}}var Da=function(){if(Vi!=null&&Vi.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,F=u,se=null,ue="",fe=!0,Se="auto",Ie="start",it=50,Ce="middle",Ze=50,je="middle";Object.defineProperty(f,"id",s({},d,{get:function(){return _},set:function(Ne){_=""+Ne}})),Object.defineProperty(f,"pauseOnExit",s({},d,{get:function(){return x},set:function(Ne){x=!!Ne}})),Object.defineProperty(f,"startTime",s({},d,{get:function(){return T},set:function(Ne){if(typeof Ne!="number")throw new TypeError("Start time must be set to a number.");T=Ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",s({},d,{get:function(){return B},set:function(Ne){if(typeof Ne!="number")throw new TypeError("End time must be set to a number.");B=Ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",s({},d,{get:function(){return F},set:function(Ne){F=""+Ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",s({},d,{get:function(){return se},set:function(Ne){se=Ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",s({},d,{get:function(){return ue},set:function(Ne){const dt=i(Ne);if(dt===!1)throw new SyntaxError("An invalid or illegal string was specified.");ue=dt,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",s({},d,{get:function(){return fe},set:function(Ne){fe=!!Ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",s({},d,{get:function(){return Se},set:function(Ne){if(typeof Ne!="number"&&Ne!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Se=Ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",s({},d,{get:function(){return Ie},set:function(Ne){const dt=n(Ne);if(!dt)throw new SyntaxError("An invalid or illegal string was specified.");Ie=dt,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",s({},d,{get:function(){return it},set:function(Ne){if(Ne<0||Ne>100)throw new Error("Position must be between 0 and 100.");it=Ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",s({},d,{get:function(){return Ce},set:function(Ne){const dt=n(Ne);if(!dt)throw new SyntaxError("An invalid or illegal string was specified.");Ce=dt,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",s({},d,{get:function(){return Ze},set:function(Ne){if(Ne<0||Ne>100)throw new Error("Size must be between 0 and 100.");Ze=Ne,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",s({},d,{get:function(){return je},set:function(Ne){const dt=n(Ne);if(!dt)throw new SyntaxError("An invalid or illegal string was specified.");je=dt,this.hasBeenReset=!0}})),f.displayState=void 0}return r.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},r}();class Jc{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function qo(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 eh{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 Qo(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 Ca=new Da(0,0,""),$r=Ca.align==="middle"?"middle":"center";function th(a,e,t){const i=a;function n(){const o=qo(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 eh;Qo(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",$r,"end"]);break;case"position":T=x.split(","),u.percent(_,T[0]),T.length===2&&u.alt("positionAlign",T[1],["start",$r,"end","line-left","line-right","auto"]);break;case"size":u.percent(_,x);break;case"align":u.alt(_,x,["start",$r,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let f=u.get("line","auto");f==="auto"&&Ca.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",$r);let d=u.get("position","auto");d==="auto"&&Ca.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 ih{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Jc,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){Qo(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 Da(0,0,""),t.state="CUE",s.indexOf("-->")===-1){t.cue.id=s;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{th(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 nh=/\r\n|\n\r|\n|\r/g,ka=function(e,t,i=0){return e.slice(i,i+t.length)===t},sh=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(!N(t)||!N(i)||!N(n)||!N(s))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=60*1e3*n,t+=60*60*1e3*s,t};function Pa(a,e,t){return ur(a.toString())+ur(e.toString())+ur(t)}const rh=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 ah(a,e,t,i,n,s,r){const o=new ih,c=$e(new Uint8Array(a)).trim().replace(nh,`
|
|
`).split(`
|
|
`),u=[],f=e?mu(e.baseTime,e.timescale):0;let d="00:00.000",_=0,x=0,T,B=!0;o.oncue=function(F){const se=t[i];let ue=t.ccOffset;const fe=(_-f)/9e4;if(se!=null&&se.new&&(x!==void 0?ue=t.ccOffset=se.start:rh(t,i,fe)),fe){if(!e){T=new Error("Missing initPTS for VTT MPEGTS");return}ue=fe-t.presentationOffset}const Se=F.endTime-F.startTime,Ie=Vn((F.startTime+ue-x)*9e4,n*9e4)/9e4;F.startTime=Math.max(Ie,0),F.endTime=Math.max(Ie+Se,0);const it=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(it)),F.id||(F.id=Pa(F.startTime,F.endTime,it)),F.endTime>0&&u.push(F)},o.onparsingerror=function(F){T=F},o.onflush=function(){if(T){r(T);return}s(u)},c.forEach(F=>{if(B)if(ka(F,"X-TIMESTAMP-MAP=")){B=!1,F.slice(16).split(",").forEach(se=>{ka(se,"LOCAL:")?d=se.slice(6):ka(se,"MPEGTS:")&&(_=parseInt(se.slice(7)))});try{x=sh(d)/1e3}catch(se){T=se}return}else F===""&&(B=!1);o.parse(F+`
|
|
`)}),o.flush()}const Oa="stpp.ttml.im1t",el=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,tl=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,oh={left:"start",center:"center",right:"end",start:"start",end:"end"};function il(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=pu(e.baseTime,1,e.timescale);try{s.forEach(o=>t(lh(o,r)))}catch(o){i(o)}}function lh(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=nl(Ma(n,"styling","style")),u=nl(Ma(n,"layout","region")),f=Ma(n,"body","[begin]");return[].map.call(f,d=>{const _=sl(d,o);if(!_||!d.hasAttribute("begin"))return null;const x=Fa(d.getAttribute("begin"),r),T=Fa(d.getAttribute("dur"),r);let B=Fa(d.getAttribute("end"),r);if(x===null)throw rl(d);if(B===null){if(T===null)throw rl(d);B=x+T}const F=new Da(x-e,B-e,_);F.id=Pa(F.startTime,F.endTime,F.text);const se=u[d.getAttribute("region")],ue=c[d.getAttribute("style")],fe=uh(se,ue,c),{textAlign:Se}=fe;if(Se){const Ie=oh[Se];Ie&&(F.lineAlign=Ie),F.align=Se}return g(F,fe),F}).filter(d=>d!==null)}function Ma(a,e,t){const i=a.getElementsByTagName(e)[0];return i?[].slice.call(i.querySelectorAll(t)):[]}function nl(a){return a.reduce((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function sl(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?sl(i,e):e?t+i.textContent.trim().replace(/\s+/g," "):t+i.textContent},"")}function uh(a,e,t){const i="http://www.w3.org/ns/ttml#styling";let 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=Na(e,i,c)||Na(a,i,c)||Na(n,i,c);return u&&(o[c]=u),o},{})}function Na(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function rl(a){return new Error(`Could not parse ttml timestamp ${a}`)}function Fa(a,e){if(!a)return null;let t=qo(a);return t===null&&(el.test(a)?t=ch(a,e):tl.test(a)&&(t=hh(a,e))),t}function ch(a,e){const t=el.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 hh(a,e){const t=tl.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 Gr{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 fh{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=ll(),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 Gr(this,"textTrack1"),t=new Gr(this,"textTrack2"),i=new Gr(this,"textTrack3"),n=new Gr(this,"textTrack4");this.cea608Parser1=new Xo(1,e,t),this.cea608Parser2=new Xo(3,i,n)}addCues(e,t,i,n,s){let r=!1;for(let o=s.length;o--;){const c=s[o],u=dh(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(ol(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,js(i[e]),$o(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=>{js(n[s]),delete n[s]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=ll(),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++)js(t[i])}onSubtitleTracksUpdated(e,t){const i=t.subtitleTracks||[],n=i.some(s=>s.textCodec===Oa);if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(bo(this.tracks,i)){this.tracks=i;return}if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const r=this.media,o=r?Fr(r.textTracks):null;if(this.tracks.forEach((c,u)=>{let f;if(o){let d=null;for(let _=0;_<o.length;_++)if(o[_]&&ol(o[_],c)){d=o[_],o[_]=null;break}d&&(f=d)}if(f)js(f);else{const d=al(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===Oa?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;il(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?ze(i.initSegment.data,new Uint8Array(n)).buffer:n;ah(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||il(t,this.initPTS[e.cc],()=>{i.textCodec=Oa,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=>Go(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=>wa(o[c],t,i))}if(this.config.renderTextTracksNatively&&t===0&&n!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>wa(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 al(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function ol(a,e){return!!a&&a.kind===al(e)&&va(e,a)}function dh(a,e,t,i){return Math.min(e,i)-Math.max(a,t)}function ll(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const ph=/\s/,mh={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++)ph.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=Pa(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(_=>Go(a,_))),n}};function gh(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const _h=/(\d+)-(\d+)\/(\d+)/;class ul{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||bh,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=vh(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&&N(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(n,e,this.response))},t.timeout),(or(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:F}=d;throw new Sh(F||"fetch, bad network response",B,d)}n.loading.first=x,n.total=Eh(d.headers)||n.total;const T=(_=this.callbacks)==null?void 0:_.onProgress;return T&&N(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 F={url:T.url,data:d,code:T.status},se=(_=this.callbacks)==null?void 0:_.onProgress;se&&!N(t.highWaterMark)&&se(n,e,d,T),(x=this.callbacks)==null||x.onSuccess(F,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 Wa,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 vh(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 yh(a){const e=_h.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Eh(a){const e=a.get("Content-Range");if(e){const i=yh(e);if(N(i))return i}const t=a.get("Content-Length");if(t)return parseInt(t)}function bh(a,e){return new self.Request(a.url,e)}class Sh extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const xh=/^age:\s*[\d.]+\s*$/im;class cl{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&&N(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 F=(r=this.callbacks)==null?void 0:r.onProgress;F&&F(i,e,T,t);const se={url:t.responseURL,data:T,code:u};(o=this.callbacks)==null||o.onSuccess(se,i,e,t);return}}const d=s.loadPolicy.errorRetry,_=i.retry,x={url:e.url,data:void 0,code:u};if(tn(d,_,!1,x))this.retry(d);else{var c;ie.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(tn(e,t,!0))this.retry(e);else{var i;ie.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=Zi(e,i.retry),i.retry++,ie.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&&xh.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 Th={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Ah=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:cl,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:ki,bufferController:Du,capLevelController:Ea,errorController:ei,fpsController:Lc,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:_s,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:Th},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},wh()),{},{subtitleStreamController:Kc,subtitleTrackController:Cc,timelineController:fh,audioStreamController:wu,audioTrackController:Ru,emeController:Vs,cmcdController:Tc,contentSteeringController:wc,interstitialsController:Uc});function wh(){return{cueHandler:mh,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 Rh(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=Ba(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}": ${Pe(e[o])}`)}),E(E({},i),e)}function Ba(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(Ba):Object.keys(a).reduce((e,t)=>(e[t]=Ba(a[t]),e),{}):a}function Lh(a,e){const t=a.loader;t!==ul&&t!==cl?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):gh()&&(a.loader=ul,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Vr=2,Ih=.1,Dh=.05,Ch=100;class kh extends Hn{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(Ch),this.mediaSource=t.mediaSource;const i=this.media=t.media;On(i,"playing",this.onMediaPlaying),On(i,"waiting",this.onMediaWaiting),On(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:i}=this;i&&(Nn(i,"playing",this.onMediaPlaying),Nn(i,"waiting",this.onMediaWaiting),Nn(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(!Ei.getBuffered(r).length){this.nudgeRetry=0;return}const d=Ei.bufferInfo(r,e,0),_=d.nextStart||0,x=this.fragmentTracker;if(o&&x&&this.hls){const it=hl(this.hls.inFlightFragments,e),Ce=d.len>Vr,Ze=!_||it||_-e>Vr&&!x.getPartialFragment(e);if(Ce||Ze)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 Ce=Math.max(_,d.start||0)-e,je=!!(T!=null&&T.live)?T.targetduration*2:Vr,Ne=jr(e,x);if(Ce>0&&(Ce<=je||Ne)){r.paused||this._trySkipBufferHole(Ne);return}}const B=s.detectStallWithCurrentTimeMs,F=self.performance.now(),se=this.waiting;let ue=this.stalled;if(ue===null)if(se>0&&F-se<B)ue=this.stalled=se;else{this.stalled=F;return}const fe=F-ue;if(!o&&(fe>=B||se)&&this.hls){var Se;if(((Se=this.mediaSource)==null?void 0:Se.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 Ie=Ei.bufferInfo(r,e,s.maxBufferHole);this._tryFixBufferStall(Ie,fe,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=Ei.bufferedInfo(Ei.timeRangesToArray(this.buffered.audio),e,0);if(s.len>1&&t>=s.start){const r=Ei.timeRangesToArray(n),o=Ei.bufferedInfo(r,t,0).bufferedIndex;if(o>-1&&o<r.length-1){const c=Ei.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 _=jr(e,this.fragmentTracker);_&&"fragment"in _?_=_.fragment:_||(_=void 0);const x=Ei.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:ce.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=jr(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 (${Pe(e)})`);this.warn(r.message),t.trigger(p.ERROR,{type:ce.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=Ei.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)||hl(this.hls.inFlightFragments,c))return 0;let F=!1,se=e.end;for(;se<c;){const ue=jr(se,i);if(ue)se+=ue.duration;else{F=!0;break}}if(F)return 0}}const x=Math.max(c+Dh,r+Ih);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:ce.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:ce.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:ce.MEDIA_ERROR,details:G.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function hl(a,e){const t=fl(a.main);if(t&&t.start<=e)return t;const i=fl(a.audio);return i&&i.start<=e?i:null}function fl(a){if(!a)return null;switch(a.state){case ct.IDLE:case ct.STOPPED:case ct.ENDED:case ct.ERROR:return null}return a.frag}function jr(a,e){return e.getAppendedFrag(a,oe.MAIN)||e.getPartialFragment(a)}const Ph=.25;function Ua(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function Ka(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,Pe(n?E({type:n},i):i))}return s}const Hr=(()=>{const a=Ua();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Oh{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&&js(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 $o(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=Ua();if(r)for(let o=0;o<s.length;o++){const c=s[o].type;if(c===Gn.emsg&&!i||!n)continue;const u=eo(s[o].data),f=s[o].pts;let d=f+s[o].duration;d>Hr&&(d=Hr),d-f<=0&&(d=f+Ph);for(let x=0;x<u.length;x++){const T=u[x];if(!to(T)){this.updateId3CueEnds(f,c);const B=Ka(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===Hr&&(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===Gn.audioId3&&c:n==="video"?u=f=>f.type===Gn.emsg&&o:u=f=>f.type===Gn.audioId3&&c||f.type===Gn.emsg&&o,wa(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=Ua();if(i&&n&&!r){const{fragmentStart:B,fragmentEnd:F}=e;let se=this.assetCue;se?(se.startTime=B,se.endTime=F):o&&(se=this.assetCue=Ka(o,B,F,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),se&&(se.id=i,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(se),se.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(F=>!f.includes(F));for(let F=B.length;F--;){var x;const se=B[F],ue=(x=d[se])==null?void 0:x.cues;delete d[se],ue&&Object.keys(ue).forEach(fe=>{const Se=ue[fe];if(Se){Se.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(Se)}catch(Ie){}}})}}else d=this.dateRangeCuesAppended={}}const T=e.fragments[e.fragments.length-1];if(!(f.length===0||!N(T==null?void 0:T.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let B=0;B<f.length;B++){const F=f[B],se=u[F],ue=se.startTime,fe=d[F],Se=(fe==null?void 0:fe.cues)||{};let Ie=(fe==null?void 0:fe.durationKnown)||!1,it=Hr;const{duration:Ce,endDate:Ze}=se;if(Ze&&Ce!==null)it=ue+Ce,Ie=!0;else if(se.endOnNext&&!Ie){const Ne=f.reduce((dt,Vt)=>{if(Vt!==se.id){const oi=u[Vt];if(oi.class===se.class&&oi.startDate>se.startDate&&(!dt||se.startDate<dt.startDate))return oi}return dt},null);Ne&&(it=Ne.startTime,Ie=!0)}const je=Object.keys(se.attr);for(let Ne=0;Ne<je.length;Ne++){const dt=je[Ne];if(!kn(dt))continue;const Vt=Se[dt];if(Vt)Ie&&!(fe!=null&&fe.durationKnown)?Vt.endTime=it:Math.abs(Vt.startTime-ue)>.01&&(Vt.startTime=ue,Vt.endTime=it);else if(o){let oi=se.attr[dt];is(dt)&&(oi=D(oi));const li=Ka(o,ue,it,{key:dt,data:oi},Gn.dateRange);li&&(li.id=F,this.id3Track.addCue(li),Se[dt]=li,r&&(dt==="X-ASSET-LIST"||dt==="X-ASSET-URL")&&li.addEventListener("enter",this.onEventCueEnter))}}d[F]={cues:Se,dateRange:se,durationKnown:Ie}}}}}class Mh{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 Nh extends _a{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=_=vi(_,i)||void 0),x&&(x=f.videoCodec=Ve(x));const{width:T,height:B,unknownCodecs:F}=f,se=(F==null?void 0:F.length)||0;if(o||(o=!!(T&&B)),c||(c=!!x),u||(u=!!_),se||_&&!this.isAudioSupported(_)||x&&!this.isVideoSupported(x)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:ue,"FRAME-RATE":fe,"HDCP-LEVEL":Se,"PATHWAY-ID":Ie,RESOLUTION:it,"VIDEO-RANGE":Ce}=d,je=`${`${Ie||"."}-`}${f.bitrate}-${it}-${fe}-${ue}-${Ce}-${Se}`;if(s[je])if(s[je].uri!==f.url&&!f.attrs["PATHWAY-ID"]){const Ne=r[je]+=1;f.attrs["PATHWAY-ID"]=new Array(Ne+1).join(".");const dt=this.createLevel(f);s[je]=dt,n.push(dt)}else s[je].addGroupId("audio",d.AUDIO),s[je].addGroupId("text",d.SUBTITLES);else{const Ne=this.createLevel(f);s[je]=Ne,r[je]=1,n.push(Ne)}}),this.filterAndSortMediaOptions(n,t,o,c,u)}createLevel(e){const t=new Ft(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=de(n,[])}return t}isAudioSupported(e){return Rt(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Rt(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,i,n,s){var r;let o=[],c=[],u=e;const f=((r=t.stats)==null?void 0:r.parsing)||{};if((i||n)&&s&&(u=u.filter(({videoCodec:ue,videoRange:fe,width:Se,height:Ie})=>(!!ue||!!(Se&&Ie))&&wt(fe))),u.length===0){Promise.resolve().then(()=>{if(this.hls){let ue="no level with compatible codecs found in manifest",fe=ue;t.levels.length&&(fe=`one or more CODECS in variant not supported: ${Pe(t.levels.map(Ie=>Ie.attrs.CODECS).filter((Ie,it,Ce)=>Ce.indexOf(Ie)===it))}`,this.warn(fe),ue+=` (${fe})`);const Se=new Error(ue);this.hls.trigger(p.ERROR,{type:ce.MEDIA_ERROR,details:G.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:Se,reason:fe})}}),f.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(ue=>!ue.audioCodec||this.isAudioSupported(ue.audioCodec)),dl(o)),t.subtitles&&(c=t.subtitles,dl(c));const d=u.slice(0);u.sort((ue,fe)=>{if(ue.attrs["HDCP-LEVEL"]!==fe.attrs["HDCP-LEVEL"])return(ue.attrs["HDCP-LEVEL"]||"")>(fe.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&ue.height!==fe.height)return ue.height-fe.height;if(ue.frameRate!==fe.frameRate)return ue.frameRate-fe.frameRate;if(ue.videoRange!==fe.videoRange)return ot.indexOf(ue.videoRange)-ot.indexOf(fe.videoRange);if(ue.videoCodec!==fe.videoCodec){const Se=Mt(ue.videoCodec),Ie=Mt(fe.videoCodec);if(Se!==Ie)return Ie-Se}if(ue.uri===fe.uri&&ue.codecSet!==fe.codecSet){const Se=Ht(ue.codecSet),Ie=Ht(fe.codecSet);if(Se!==Ie)return Ie-Se}return ue.averageBitrate!==fe.averageBitrate?ue.averageBitrate-fe.averageBitrate:0});let _=d[0];if(this.steering&&(u=this.steering.filterParsedLevels(u),u.length!==d.length)){for(let ue=0;ue<d.length;ue++)if(d[ue].pathwayId===u[0].pathwayId){_=d[ue];break}}this._levels=u;for(let ue=0;ue<u.length;ue++)if(u[ue]===_){var x;this._firstLevel=ue;const fe=_.bitrate,Se=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${u.length} level(s) found, first bitrate: ${fe}`),((x=this.hls.userConfig)==null?void 0:x.abrEwmaDefaultEstimate)===void 0){const Ie=Math.min(fe,this.hls.config.abrEwmaDefaultEstimateMax);Ie>Se&&Se===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=Ie)}break}const T=s&&!n,B=this.hls.config,F=!!(B.audioStreamController&&B.audioTrackController),se={levels:u,audioTracks:o,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:n,altAudio:F&&!T&&o.some(ue=>!!ue.url)};f.end=performance.now(),this.hls.trigger(p.MANIFEST_PARSED,se)}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:ce.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));Rn(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 dl(a){const e={};a.forEach(t=>{const i=t.groupId||"";t.id=e[i]=e[i]||0,e[i]++})}function pl(){return self.SourceBuffer||self.WebKitSourceBuffer}function ml(){if(!ye())return!1;const e=pl();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Fh(){if(!ml())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(nt(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(nt(e,"audio"))))}function Bh(){var a;const e=pl();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const Uh=100;class Kh extends ia{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||!N(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(Uh),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=ct.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=ct.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case ct.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=ct.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=ct.IDLE;break}break}case ct.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===ct.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=ct.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===ct.WAITING_LEVEL||this.waitForLive(r)){this.level=s,this.state=ct.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)!==Yt.OK){var T;const F=((T=this.backtrackFragment)!=null?T:x).sn-u.startSN,se=u.fragments[F-1];se&&x.cc===se.cc&&(x=se,this.fragmentTracker.removeFragment(se))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(x&&this.isLoopLoading(x,_)){if(!x.gap){const F=this.audioOnly&&!this.altAudio?K.AUDIO:K.VIDEO,se=(F===K.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;se&&this.afterBufferFlushed(se,F,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===Yt.NOT_LOADED||n===Yt.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 ct.KEY_LOADING:case ct.FRAG_LOADING:case ct.FRAG_LOADING_WAITING_RETRY:case ct.PARSING:case ct.PARSED:this.state=ct.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;On(i,"playing",this.onMediaPlaying),On(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:i}=this;i&&(Nn(i,"playing",this.onMediaPlaying),Nn(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&&!Bh(),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!==ct.IDLE)return;const n=t.levelInfo;(!n.details||n.details.live&&(this.levelLastLoaded!==n||n.details.expired)||this.waitForCdnTuneIn(n.details))&&(this.state=ct.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===ct.FRAG_LOADING||this.state===ct.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===ct.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=ct.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=Ei.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}=Ei.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 yo(this.hls,oe.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),T=n?n.index:-1,B=T!==-1,F=new Un(i.level,i.sn,i.stats.chunkCount,s.byteLength,T,B),se=this.initPTS[i.cc];x.push(s,d,_,u,i,n,c.totalduration,f,F,se)}onAudioTrackSwitching(e,t){const i=this.hls,n=this.altAudio===2;if(Li(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=Li(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===ct.PARSED&&(this.state=ct.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&&Ei.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=ct.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===ct.WAITING_LEVEL&&((i=t.context)==null?void 0:i.type)===ve.LEVEL&&(this.state=ct.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=ct.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=Ei.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=ct.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===ct.STOPPED||this.state===ct.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=ct.PARSING,x){const F=x.tracks;if(F){const Se=o.initSegment||o;if(this.unhandledEncryptionError(x,o))return;this._bufferInitSegment(u,F,Se,s),i.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:Se,id:t,tracks:F})}const se=x.initPTS,ue=x.timescale,fe=this.initPTS[o.cc];if(N(se)&&(!fe||fe.baseTime!==se||fe.timescale!==ue)){const Se=x.trackId;this.initPTS[o.cc]={baseTime:se,timescale:ue,trackId:Se},i.trigger(p.INIT_PTS_FOUND,{frag:o,id:t,initPTS:se,timescale:ue,trackId:Se})}}if(f&&T){B&&f.type==="audiovideo"&&this.logMuxedErr(o);const F=T.fragments[o.sn-1-T.startSN],se=o.sn===T.startSN,ue=!F||o.cc>F.cc;if(n.independent!==!1){const{startPTS:fe,endPTS:Se,startDTS:Ie,endDTS:it}=f;if(c)c.elementaryStreams[f.type]={startPTS:fe,endPTS:Se,startDTS:Ie,endDTS:it};else if(f.firstKeyFrame&&f.independent&&s.id===1&&!ue&&(this.couldBacktrack=!0),f.dropped&&f.independent){const Ce=this.getMainFwdBufferInfo(),Ze=(Ce?Ce.end:this.getLoadPosition())+this.config.maxBufferHole,je=f.firstKeyFramePTS?f.firstKeyFramePTS:fe;if(!se&&Ze<je-this.config.maxBufferHole&&!ue){this.backtrack(o);return}else ue&&(o.gap=!0);o.setElementaryStreamInfo(f.type,o.start,Se,o.start,it,!0)}else se&&fe-(T.appliedTimelineOffset||0)>Vr&&(o.gap=!0);o.setElementaryStreamInfo(f.type,fe,Se,Ie,it),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(f,o,c,s,se||ue)}else if(se||ue)o.gap=!0;else{this.backtrack(o);return}}if(B){const{startPTS:F,endPTS:se,startDTS:ue,endDTS:fe}=B;c&&(c.elementaryStreams[K.AUDIO]={startPTS:F,endPTS:se,startDTS:ue,endDTS:fe}),o.setElementaryStreamInfo(K.AUDIO,F,se,ue,fe),this.bufferFragmentData(B,o,c,s)}if(T&&_!=null&&_.samples.length){const F={id:t,frag:o,details:T,samples:_.samples};i.trigger(p.FRAG_PARSING_METADATA,F)}if(T&&d){const F={id:t,frag:o,details:T,samples:d.samples};i.trigger(p.FRAG_PARSING_USERDATA,F)}}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!==ct.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=Xt(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=ct.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const i=e.currentTime;if(Ei.isBuffered(e,i)?t=this.getAppendedFrag(i):Ei.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 N(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(N(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 $h 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 vn({type:ce.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=zn(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const n=cs(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 u=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,G.KEY_LOAD_ERROR,u))}const r=s.uri;if(!r)return Promise.reject(this.createKeyLoadError(e,G.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const o=$a(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(this.emeController&&(n=c)!=null&&n.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case"usable":case"usable-in-future":return c.keyLoadPromise.then(f=>{const{keyInfo:d}=f;return s.key=d.decryptdata.key,{frag:e,keyInfo:d}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${s.keyId?" keyId: "+J(s.keyId):""} URI: ${s.uri} 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){var n;if(!e.decryptdata.keyId&&(n=t.initSegment)!=null&&n.data){const r=he(t.initSegment.data);if(r.length){const o=r[0];o.some(c=>c!==0)&&(this.log(`Using keyId found in init segment ${J(o)}`),e.decryptdata.keyId=o,Yn.setKeyIdForUri(e.decryptdata.uri,o))}}const s=this.emeController.loadKey(i);return(e.keyLoadPromise=s.then(r=>(e.mediaKeySessionContext=r,i))).catch(r=>{throw e.keyLoadPromise=null,"data"in r&&(r.data.frag=t),r})}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:F,keyInfo:se}=T,ue=$a(se.decryptdata);if(!F.decryptdata||se!==this.keyIdToKeyInfo[ue])return o(this.createKeyLoadError(F,G.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),B));se.decryptdata.key=F.decryptdata.key=new Uint8Array(_.data),F.keyLoader=null,se.loader=null,r({frag:F,keyInfo:se})},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=$a(i.decryptdata)||n;delete this.keyIdToKeyInfo[r],s&&s.destroy()}}function $a(a){if(a.keyFormat!==Ci.FAIRPLAY){const e=a.keyId;if(e)return J(e)}return a.uri}function gl(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 Ga(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Gh{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),N((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;f.parsing.start=performance.now(),$n.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=Ga(e,i),c=$n.parseMasterPlaylist(r,o);if(c.playlistParsingError){t.parsing.end=performance.now(),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,f.forEach(ue=>{const{unknownCodecs:fe}=ue;if(fe){const{preferManagedMediaSource:Se}=this.hls.config;let{audioCodec:Ie,videoCodec:it}=ue;for(let Ce=fe.length;Ce--;){const Ze=fe[Ce];Rt(Ze,"audio",Se)?(ue.audioCodec=Ie=Ie?`${Ie},${Ze}`:Ze,Gt.audio[Ie.substring(0,4)]=2,fe.splice(Ce,1)):Rt(Ze,"video",Se)&&(ue.videoCodec=it=it?`${it},${Ze}`:Ze,Gt.video[it.substring(0,4)]=2,fe.splice(Ce,1))}}});const{AUDIO:B=[],SUBTITLES:F,"CLOSED-CAPTIONS":se}=$n.parseMasterPlaylistMedia(r,o,c);B.length&&!B.some(fe=>!fe.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 Gi({}),bitrate:0,url:""})),s.trigger(p.MANIFEST_LOADED,{levels:f,audioTracks:B,subtitles:F,captions:se,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=Ga(e,i),d=N(c)?c:N(o)?o:0,_=gl(i),x=$n.parseLevelPlaylist(e.data,f,d,_,0,this.variableList);if(u===ve.MANIFEST){const T={attrs:new Gi({}),bitrate:0,details:x,name:"",url:f};x.requestScheduled=t.loading.start+sn(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:ce.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:ce.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,levelOrTrack:f,id:d,groupId:_,deliveryDirectives:x}=n,T=Ga(t,n),B=gl(n);let F=typeof n.level=="number"&&B===oe.MAIN?u:void 0;const se=e.playlistParsingError;if(se){if(this.hls.logger.warn(`${se} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:ce.NETWORK_ERROR,details:G.LEVEL_PARSING_ERROR,fatal:!1,url:T,error:se,reason:se.message,response:t,context:n,level:F,parent:B,networkDetails:s,stats:i});return}e.playlistParsingError=null}if(!e.fragments.length){const ue=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:ce.NETWORK_ERROR,details:G.LEVEL_EMPTY_ERROR,fatal:!1,url:T,error:ue,reason:ue.message,response:t,context:n,level:F,parent:B,networkDetails:s,stats:i});return}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:if(F){if(!f)F=0;else if(f!==o.levels[F]){const ue=o.levels.indexOf(f);ue>-1&&(F=ue)}}o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:f||o.levels[0],level:F||0,id:d||0,stats:i,networkDetails:s,deliveryDirectives:x,withoutMultiVariant:c===ve.MANIFEST});break;case ve.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:f,id:d||0,groupId:_||"",stats:i,networkDetails:s,deliveryDirectives:x});break;case ve.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:f,id:d||0,groupId:_||"",stats:i,networkDetails:s,deliveryDirectives:x});break}}}class ws{static get version(){return nr}static isMSESupported(){return ml()}static isSupported(){return Fh()}static getMediaSource(){return ye()}static get Events(){return p}static get MetadataSchema(){return Gn}static get ErrorTypes(){return ce}static get ErrorDetails(){return G}static get DefaultConfig(){return ws.defaultConfig?ws.defaultConfig:Ah}static set DefaultConfig(e){ws.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 sa,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=ne(e.debug||!1,"Hls instance",e.assetPlayerId),i=this.config=Rh(ws.DefaultConfig,e,t);this.userConfig=e,i.progressive&&Lh(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 Ni(this),_=i.interstitialsController,x=_?this.interstitialsController=new _(this,ws):null,T=this.bufferController=new s(this,d),B=this.capLevelController=new r(this),F=new c(this),se=new Gh(this),ue=i.contentSteeringController,fe=ue?new ue(this):null,Se=this.levelController=new Nh(this,fe),Ie=new Oh(this),it=new $h(this.config,this.logger),Ce=this.streamController=new Kh(this,d,it),Ze=this.gapController=new kh(this,d);B.setStreamController(Ce),F.setStreamController(Ce);const je=[se,Se,Ce];x&&je.splice(1,0,x),fe&&je.splice(1,0,fe),this.networkControllers=je;const Ne=[f,T,Ze,B,F,Ie,d];this.audioTrackController=this.createController(i.audioTrackController,je);const dt=i.audioStreamController;dt&&je.push(this.audioStreamController=new dt(this,d,it)),this.subtitleTrackController=this.createController(i.subtitleTrackController,je);const Vt=i.subtitleStreamController;Vt&&je.push(this.subtititleStreamController=new Vt(this,d,it)),this.createController(i.timelineController,Ne),it.emeController=this.emeController=this.createController(i.emeController,Ne),this.cmcdController=this.createController(i.cmcdController,Ne),this.latencyController=this.createController(Mh,Ne),this.coreComponents=Ne,je.push(u);const oi=u.onErrorOut;typeof oi=="function"&&this.on(p.ERROR,oi,u),this.on(p.MANIFEST_LOADED,se.onManifestLoaded,se)}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:ce.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:ce.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=kc()),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){ht(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=Ge(t);return He(e,i,navigator.mediaCapabilities)}}ws.defaultConfig=void 0}}]);
|
|
}()); |