You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__RestFul__index.9494ddfc....

1038 lines
1.1 MiB

!(function(){var xl=Math.pow;(self.webpackChunk=self.webpackChunk||[]).push([[1006],{65030:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return ze}});var L=w(33885),fe=w(42978),Te=w(75931),ue=w(43403),$=w(92310),p=w.n($),ge=w(29301),le=w(76846),l=w(96452),x=w(6089),A=w(80402),h=w(34280),m=w(49658),y=w(59301),S=w(54476),F=w(77900),Z=w(8654);function W(ye){var me=ye.prefixCls,B=ye.align,xe=ye.arrow,Le=ye.arrowPos,K=xe||{},R=K.className,ie=K.content,be=Le.x,k=be===void 0?0:be,Y=Le.y,J=Y===void 0?0:Y,se=y.useRef();if(!B||!B.points)return null;var ee={position:"absolute"};if(B.autoArrow!==!1){var ne=B.points[0],Ee=B.points[1],Be=ne[0],Ce=ne[1],De=Ee[0],oe=Ee[1];Be===De||!["t","b"].includes(Be)?ee.top=J:Be==="t"?ee.top=0:ee.bottom=0,Ce===oe||!["l","r"].includes(Ce)?ee.left=k:Ce==="l"?ee.left=0:ee.right=0}return y.createElement("div",{ref:se,className:p()("".concat(me,"-arrow"),R),style:ee},ie)}function I(ye){var me=ye.prefixCls,B=ye.open,xe=ye.zIndex,Le=ye.mask,K=ye.motion;return Le?y.createElement(F.default,(0,S.Z)({},K,{motionAppear:!0,visible:B,removeOnLeave:!0}),function(R){var ie=R.className;return y.createElement("div",{style:{zIndex:xe},className:p()("".concat(me,"-mask"),ie)})}):null}var N=y.memo(function(ye){var me=ye.children;return me},function(ye,me){return me.cache}),T=N,D=y.forwardRef(function(ye,me){var B=ye.popup,xe=ye.className,Le=ye.prefixCls,K=ye.style,R=ye.target,ie=ye.onVisibleChanged,be=ye.open,k=ye.keepDom,Y=ye.fresh,J=ye.onClick,se=ye.mask,ee=ye.arrow,ne=ye.arrowPos,Ee=ye.align,Be=ye.motion,Ce=ye.maskMotion,De=ye.forceRender,oe=ye.getPopupContainer,Ge=ye.autoDestroy,Ue=ye.portal,Fe=ye.zIndex,lt=ye.onMouseEnter,ut=ye.onMouseLeave,it=ye.onPointerEnter,Ct=ye.onPointerDownCapture,zt=ye.ready,ct=ye.offsetX,Ut=ye.offsetY,Ne=ye.offsetR,Se=ye.offsetB,Ie=ye.onAlign,U=ye.onPrepare,z=ye.stretch,pe=ye.targetWidth,de=ye.targetHeight,ve=typeof B=="function"?B():B,je=be||k,tt=(oe==null?void 0:oe.length)>0,yt=y.useState(!oe||!tt),It=(0,fe.Z)(yt,2),qt=It[0],gn=It[1];if((0,h.Z)(function(){!qt&&tt&&R&&gn(!0)},[qt,tt,R]),!qt)return null;var en="auto",nn={left:"-1000vw",top:"-1000vh",right:en,bottom:en};if(zt||!be){var wn,zn=Ee.points,kn=Ee.dynamicInset||((wn=Ee._experimental)===null||wn===void 0?void 0:wn.dynamicInset),Nn=kn&&zn[0][1]==="r",Lt=kn&&zn[0][0]==="b";Nn?(nn.right=Ne,nn.left=en):(nn.left=ct,nn.right=en),Lt?(nn.bottom=Se,nn.top=en):(nn.top=Ut,nn.bottom=en)}var ht={};return z&&(z.includes("height")&&de?ht.height=de:z.includes("minHeight")&&de&&(ht.minHeight=de),z.includes("width")&&pe?ht.width=pe:z.includes("minWidth")&&pe&&(ht.minWidth=pe)),be||(ht.pointerEvents="none"),y.createElement(Ue,{open:De||je,getContainer:oe&&function(){return oe(R)},autoDestroy:Ge},y.createElement(I,{prefixCls:Le,open:be,zIndex:Fe,mask:se,motion:Ce}),y.createElement(ge.Z,{onResize:Ie,disabled:!be},function(Zt){return y.createElement(F.default,(0,S.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:De,leavedClassName:"".concat(Le,"-hidden")},Be,{onAppearPrepare:U,onEnterPrepare:U,visible:be,onVisibleChanged:function(Hn){var Me;Be==null||(Me=Be.onVisibleChanged)===null||Me===void 0||Me.call(Be,Hn),ie(Hn)}}),function(yn,Hn){var Me=yn.className,ke=yn.style,St=p()(Le,Me,xe);return y.createElement("div",{ref:(0,Z.sQ)(Zt,me,Hn),className:St,style:(0,L.Z)((0,L.Z)((0,L.Z)((0,L.Z)({"--arrow-x":"".concat(ne.x||0,"px"),"--arrow-y":"".concat(ne.y||0,"px")},nn),ht),ke),{},{boxSizing:"border-box",zIndex:Fe},K),onMouseEnter:lt,onMouseLeave:ut,onPointerEnter:it,onClick:J,onPointerDownCapture:Ct},ee&&y.createElement(W,{prefixCls:Le,arrow:ee,arrowPos:ne,align:Ee}),y.createElement(T,{cache:!be&&!Y},ve))})}))}),q=D,te=y.forwardRef(function(ye,me){var B=ye.children,xe=ye.getTriggerDOMNode,Le=(0,Z.Yr)(B),K=y.useCallback(function(ie){(0,Z.mH)(me,xe?xe(ie):ie)},[xe]),R=(0,Z.x1)(K,(0,Z.C4)(B));return Le?y.cloneElement(B,{ref:R}):B}),X=te,ce=y.createContext(null),we=ce;function Pe(ye){return ye?Array.isArray(ye)?ye:[ye]:[]}function Ve(ye,me,B,xe){return y.useMemo(function(){var Le=Pe(B!=null?B:me),K=Pe(xe!=null?xe:me),R=new Set(Le),ie=new Set(K);return ye&&(R.has("hover")&&(R.delete("hover"),R.add("click")),ie.has("hover")&&(ie.delete("hover"),ie.add("click"))),[R,ie]},[ye,me,B,xe])}var V=w(29194);function C(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],B=arguments.length>2?arguments[2]:void 0;return B?ye[0]===me[0]:ye[0]===me[0]&&ye[1]===me[1]}function G(ye,me,B,xe){for(var Le=B.points,K=Object.keys(ye),R=0;R<K.length;R+=1){var ie,be=K[R];if(C((ie=ye[be])===null||ie===void 0?void 0:ie.points,Le,xe))return"".concat(me,"-placement-").concat(be)}return""}function H(ye,me,B,xe){return me||(B?{motionName:"".concat(ye,"-").concat(B)}:xe?{motionName:xe}:null)}function Q(ye){return ye.ownerDocument.defaultView}function j(ye){for(var me=[],B=ye==null?void 0:ye.parentElement,xe=["hidden","scroll","clip","auto"];B;){var Le=Q(B).getComputedStyle(B),K=Le.overflowX,R=Le.overflowY,ie=Le.overflow;[K,R,ie].some(function(be){return xe.includes(be)})&&me.push(B),B=B.parentElement}return me}function _(ye){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(ye)?me:ye}function v(ye){return _(parseFloat(ye),0)}function P(ye,me){var B=(0,L.Z)({},ye);return(me||[]).forEach(function(xe){if(!(xe instanceof HTMLBodyElement||xe instanceof HTMLHtmlElement)){var Le=Q(xe).getComputedStyle(xe),K=Le.overflow,R=Le.overflowClipMargin,ie=Le.borderTopWidth,be=Le.borderBottomWidth,k=Le.borderLeftWidth,Y=Le.borderRightWidth,J=xe.getBoundingClientRect(),se=xe.offsetHeight,ee=xe.clientHeight,ne=xe.offsetWidth,Ee=xe.clientWidth,Be=v(ie),Ce=v(be),De=v(k),oe=v(Y),Ge=_(Math.round(J.width/ne*1e3)/1e3),Ue=_(Math.round(J.height/se*1e3)/1e3),Fe=(ne-Ee-De-oe)*Ge,lt=(se-ee-Be-Ce)*Ue,ut=Be*Ue,it=Ce*Ue,Ct=De*Ge,zt=oe*Ge,ct=0,Ut=0;if(K==="clip"){var Ne=v(R);ct=Ne*Ge,Ut=Ne*Ue}var Se=J.x+Ct-ct,Ie=J.y+ut-Ut,U=Se+J.width+2*ct-Ct-zt-Fe,z=Ie+J.height+2*Ut-ut-it-lt;B.left=Math.max(B.left,Se),B.top=Math.max(B.top,Ie),B.right=Math.min(B.right,U),B.bottom=Math.min(B.bottom,z)}}),B}function re(ye){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,B="".concat(me),xe=B.match(/^(.*)\%$/);return xe?ye*(parseFloat(xe[1])/100):parseFloat(B)}function Oe(ye,me){var B=me||[],xe=(0,fe.Z)(B,2),Le=xe[0],K=xe[1];return[re(ye.width,Le),re(ye.height,K)]}function Ze(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[ye[0],ye[1]]}function Ye(ye,me){var B=me[0],xe=me[1],Le,K;return B==="t"?K=ye.y:B==="b"?K=ye.y+ye.height:K=ye.y+ye.height/2,xe==="l"?Le=ye.x:xe==="r"?Le=ye.x+ye.width:Le=ye.x+ye.width/2,{x:Le,y:K}}function qe(ye,me){var B={t:"b",b:"t",l:"r",r:"l"};return ye.map(function(xe,Le){return Le===me?B[xe]||"c":xe}).join("")}function ft(ye,me,B,xe,Le,K,R){var ie=y.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:Le[xe]||{}}),be=(0,fe.Z)(ie,2),k=be[0],Y=be[1],J=y.useRef(0),se=y.useMemo(function(){return me?j(me):[]},[me]),ee=y.useRef({}),ne=function(){ee.current={}};ye||ne();var Ee=(0,x.Z)(function(){if(me&&B&&ye){let ar=function(kr,Sn){var Gn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Et,Dn=je.x+kr,Un=je.y+Sn,lr=Dn+Lt,Er=Un+Nn,jr=Math.max(Dn,Gn.left),dn=Math.max(Un,Gn.top),Ln=Math.min(lr,Gn.right),qn=Math.min(Er,Gn.bottom);return Math.max(0,(Ln-jr)*(qn-dn))},Rr=function(){_r=je.y+Wt,ur=_r+Nn,On=je.x+Bt,sn=On+Lt};var De,oe,Ge,Ue,Fe=me,lt=Fe.ownerDocument,ut=Q(Fe),it=ut.getComputedStyle(Fe),Ct=it.position,zt=Fe.style.left,ct=Fe.style.top,Ut=Fe.style.right,Ne=Fe.style.bottom,Se=Fe.style.overflow,Ie=(0,L.Z)((0,L.Z)({},Le[xe]),K),U=lt.createElement("div");(De=Fe.parentElement)===null||De===void 0||De.appendChild(U),U.style.left="".concat(Fe.offsetLeft,"px"),U.style.top="".concat(Fe.offsetTop,"px"),U.style.position=Ct,U.style.height="".concat(Fe.offsetHeight,"px"),U.style.width="".concat(Fe.offsetWidth,"px"),Fe.style.left="0",Fe.style.top="0",Fe.style.right="auto",Fe.style.bottom="auto",Fe.style.overflow="hidden";var z;if(Array.isArray(B))z={x:B[0],y:B[1],width:0,height:0};else{var pe,de,ve=B.getBoundingClientRect();ve.x=(pe=ve.x)!==null&&pe!==void 0?pe:ve.left,ve.y=(de=ve.y)!==null&&de!==void 0?de:ve.top,z={x:ve.x,y:ve.y,width:ve.width,height:ve.height}}var je=Fe.getBoundingClientRect(),tt=ut.getComputedStyle(Fe),yt=tt.height,It=tt.width;je.x=(oe=je.x)!==null&&oe!==void 0?oe:je.left,je.y=(Ge=je.y)!==null&&Ge!==void 0?Ge:je.top;var qt=lt.documentElement,gn=qt.clientWidth,en=qt.clientHeight,nn=qt.scrollWidth,wn=qt.scrollHeight,zn=qt.scrollTop,kn=qt.scrollLeft,Nn=je.height,Lt=je.width,ht=z.height,Zt=z.width,yn={left:0,top:0,right:gn,bottom:en},Hn={left:-kn,top:-zn,right:nn-kn,bottom:wn-zn},Me=Ie.htmlRegion,ke="visible",St="visibleFirst";Me!=="scroll"&&Me!==St&&(Me=ke);var st=Me===St,xt=P(Hn,se),Tt=P(yn,se),Et=Me===ke?Tt:xt,kt=st?Tt:Et;Fe.style.left="auto",Fe.style.top="auto",Fe.style.right="0",Fe.style.bottom="0";var jt=Fe.getBoundingClientRect();Fe.style.left=zt,Fe.style.top=ct,Fe.style.right=Ut,Fe.style.bottom=Ne,Fe.style.overflow=Se,(Ue=Fe.parentElement)===null||Ue===void 0||Ue.removeChild(U);var At=_(Math.round(Lt/parseFloat(It)*1e3)/1e3),Pt=_(Math.round(Nn/parseFloat(yt)*1e3)/1e3);if(At===0||Pt===0||(0,le.Sh)(B)&&!(0,V.Z)(B))return;var Gt=Ie.offset,Ft=Ie.targetOffset,dt=Oe(je,Gt),Re=(0,fe.Z)(dt,2),$e=Re[0],Qe=Re[1],Xe=Oe(z,Ft),gt=(0,fe.Z)(Xe,2),pt=gt[0],Rt=gt[1];z.x-=pt,z.y-=Rt;var Kt=Ie.points||[],Ht=(0,fe.Z)(Kt,2),tn=Ht[0],$n=Ht[1],Vt=Ze($n),un=Ze(tn),rn=Ye(z,Vt),fn=Ye(je,un),Yt=(0,L.Z)({},Ie),Bt=rn.x-fn.x+$e,Wt=rn.y-fn.y+Qe,Jt=ar(Bt,Wt),an=ar(Bt,Wt,Tt),cn=Ye(z,["t","l"]),En=Ye(je,["t","l"]),mn=Ye(z,["b","r"]),on=Ye(je,["b","r"]),jn=Ie.overflow||{},Qn=jn.adjustX,or=jn.adjustY,Vn=jn.shiftX,ir=jn.shiftY,Jn=function(Sn){return typeof Sn=="boolean"?Sn:Sn>=0},_r,ur,On,sn;Rr();var Dt=Jn(or),bt=un[0]===Vt[0];if(Dt&&un[0]==="t"&&(ur>kt.bottom||ee.current.bt)){var $t=Wt;bt?$t-=Nn-ht:$t=cn.y-on.y-Qe;var Qt=ar(Bt,$t),bn=ar(Bt,$t,Tt);Qt>Jt||Qt===Jt&&(!st||bn>=an)?(ee.current.bt=!0,Wt=$t,Qe=-Qe,Yt.points=[qe(un,0),qe(Vt,0)]):ee.current.bt=!1}if(Dt&&un[0]==="b"&&(_r<kt.top||ee.current.tb)){var Kn=Wt;bt?Kn+=Nn-ht:Kn=mn.y-En.y-Qe;var tr=ar(Bt,Kn),Xt=ar(Bt,Kn,Tt);tr>Jt||tr===Jt&&(!st||Xt>=an)?(ee.current.tb=!0,Wt=Kn,Qe=-Qe,Yt.points=[qe(un,0),qe(Vt,0)]):ee.current.tb=!1}var Tn=Jn(Qn),Bn=un[1]===Vt[1];if(Tn&&un[1]==="l"&&(sn>kt.right||ee.current.rl)){var Zn=Bt;Bn?Zn-=Lt-Zt:Zn=cn.x-on.x-$e;var pr=ar(Zn,Wt),An=ar(Zn,Wt,Tt);pr>Jt||pr===Jt&&(!st||An>=an)?(ee.current.rl=!0,Bt=Zn,$e=-$e,Yt.points=[qe(un,1),qe(Vt,1)]):ee.current.rl=!1}if(Tn&&un[1]==="r"&&(On<kt.left||ee.current.lr)){var Yn=Bt;Bn?Yn+=Lt-Zt:Yn=mn.x-En.x-$e;var Xn=ar(Yn,Wt),cr=ar(Yn,Wt,Tt);Xn>Jt||Xn===Jt&&(!st||cr>=an)?(ee.current.lr=!0,Bt=Yn,$e=-$e,Yt.points=[qe(un,1),qe(Vt,1)]):ee.current.lr=!1}Rr();var sr=Vn===!0?0:Vn;typeof sr=="number"&&(On<Tt.left&&(Bt-=On-Tt.left-$e,z.x+Zt<Tt.left+sr&&(Bt+=z.x-Tt.left+Zt-sr)),sn>Tt.right&&(Bt-=sn-Tt.right-$e,z.x>Tt.right-sr&&(Bt+=z.x-Tt.right+sr)));var gr=ir===!0?0:ir;typeof gr=="number"&&(_r<Tt.top&&(Wt-=_r-Tt.top-Qe,z.y+ht<Tt.top+gr&&(Wt+=z.y-Tt.top+ht-gr)),ur>Tt.bottom&&(Wt-=ur-Tt.bottom-Qe,z.y>Tt.bottom-gr&&(Wt+=z.y-Tt.bottom+gr)));var fr=je.x+Bt,Ar=fr+Lt,Sr=je.y+Wt,Or=Sr+Nn,br=z.x,yr=br+Zt,Vr=z.y,In=Vr+ht,zr=Math.max(fr,br),Dr=Math.min(Ar,yr),ii=(zr+Dr)/2,si=ii-fr,Xr=Math.max(Sr,Vr),ui=Math.min(Or,In),Wr=(Xr+ui)/2,mr=Wr-Sr;R==null||R(me,Yt);var Lr=jt.right-je.x-(Bt+je.width),Br=jt.bottom-je.y-(Wt+je.height);At===1&&(Bt=Math.round(Bt),Lr=Math.round(Lr)),Pt===1&&(Wt=Math.round(Wt),Br=Math.round(Br));var Hr={ready:!0,offsetX:Bt/At,offsetY:Wt/Pt,offsetR:Lr/At,offsetB:Br/Pt,arrowX:si/At,arrowY:mr/Pt,scaleX:At,scaleY:Pt,align:Yt};Y(Hr)}}),Be=function(){J.current+=1;var oe=J.current;Promise.resolve().then(function(){J.current===oe&&Ee()})},Ce=function(){Y(function(oe){return(0,L.Z)((0,L.Z)({},oe),{},{ready:!1})})};return(0,h.Z)(Ce,[xe]),(0,h.Z)(function(){ye||Ce()},[ye]),[k.ready,k.offsetX,k.offsetY,k.offsetR,k.offsetB,k.arrowX,k.arrowY,k.scaleX,k.scaleY,k.align,Be]}var vt=w(94480);function Ae(ye,me,B,xe,Le){(0,h.Z)(function(){if(ye&&me&&B){let J=function(){xe(),Le()};var K=me,R=B,ie=j(K),be=j(R),k=Q(R),Y=new Set([k].concat((0,vt.Z)(ie),(0,vt.Z)(be)));return Y.forEach(function(se){se.addEventListener("scroll",J,{passive:!0})}),k.addEventListener("resize",J,{passive:!0}),xe(),function(){Y.forEach(function(se){se.removeEventListener("scroll",J),k.removeEventListener("resize",J)})}}},[ye,me,B])}var wt=w(48736);function rt(ye,me,B,xe,Le,K,R,ie){var be=y.useRef(ye);be.current=ye;var k=y.useRef(!1);y.useEffect(function(){if(me&&xe&&(!Le||K)){var J=function(){k.current=!1},se=function(Ge){var Ue;be.current&&!R(((Ue=Ge.composedPath)===null||Ue===void 0||(Ue=Ue.call(Ge))===null||Ue===void 0?void 0:Ue[0])||Ge.target)&&!k.current&&ie(!1)},ee=Q(xe);ee.addEventListener("pointerdown",J,!0),ee.addEventListener("mousedown",se,!0),ee.addEventListener("contextmenu",se,!0);var ne=(0,l.A)(B);if(ne&&(ne.addEventListener("mousedown",se,!0),ne.addEventListener("contextmenu",se,!0)),0)var Ee,Be,Ce,De;return function(){ee.removeEventListener("pointerdown",J,!0),ee.removeEventListener("mousedown",se,!0),ee.removeEventListener("contextmenu",se,!0),ne&&(ne.removeEventListener("mousedown",se,!0),ne.removeEventListener("contextmenu",se,!0))}}},[me,B,xe,Le,K]);function Y(){k.current=!0}return Y}var Mt=["prefixCls","children","action","showAction","hideAction","popupVisible","defaultPopupVisible","onPopupVisibleChange","afterPopupVisibleChange","mouseEnterDelay","mouseLeaveDelay","focusDelay","blurDelay","mask","maskClosable","getPopupContainer","forceRender","autoDestroy","destroyPopupOnHide","popup","popupClassName","popupStyle","popupPlacement","builtinPlacements","popupAlign","zIndex","stretch","getPopupClassNameFromAlign","fresh","alignPoint","onPopupClick","onPopupAlign","arrow","popupMotion","maskMotion","popupTransitionName","popupAnimation","maskTransitionName","maskAnimation","className","getTriggerDOMNode"];function et(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ue.Z,me=y.forwardRef(function(B,xe){var Le=B.prefixCls,K=Le===void 0?"rc-trigger-popup":Le,R=B.children,ie=B.action,be=ie===void 0?"hover":ie,k=B.showAction,Y=B.hideAction,J=B.popupVisible,se=B.defaultPopupVisible,ee=B.onPopupVisibleChange,ne=B.afterPopupVisibleChange,Ee=B.mouseEnterDelay,Be=B.mouseLeaveDelay,Ce=Be===void 0?.1:Be,De=B.focusDelay,oe=B.blurDelay,Ge=B.mask,Ue=B.maskClosable,Fe=Ue===void 0?!0:Ue,lt=B.getPopupContainer,ut=B.forceRender,it=B.autoDestroy,Ct=B.destroyPopupOnHide,zt=B.popup,ct=B.popupClassName,Ut=B.popupStyle,Ne=B.popupPlacement,Se=B.builtinPlacements,Ie=Se===void 0?{}:Se,U=B.popupAlign,z=B.zIndex,pe=B.stretch,de=B.getPopupClassNameFromAlign,ve=B.fresh,je=B.alignPoint,tt=B.onPopupClick,yt=B.onPopupAlign,It=B.arrow,qt=B.popupMotion,gn=B.maskMotion,en=B.popupTransitionName,nn=B.popupAnimation,wn=B.maskTransitionName,zn=B.maskAnimation,kn=B.className,Nn=B.getTriggerDOMNode,Lt=(0,Te.Z)(B,Mt),ht=it||Ct||!1,Zt=y.useState(!1),yn=(0,fe.Z)(Zt,2),Hn=yn[0],Me=yn[1];(0,h.Z)(function(){Me((0,m.Z)())},[]);var ke=y.useRef({}),St=y.useContext(we),st=y.useMemo(function(){return{registerSubPopup:function(Ln,qn){ke.current[Ln]=qn,St==null||St.registerSubPopup(Ln,qn)}}},[St]),xt=(0,A.Z)(),Tt=y.useState(null),Et=(0,fe.Z)(Tt,2),kt=Et[0],jt=Et[1],At=y.useRef(null),Pt=(0,x.Z)(function(dn){At.current=dn,(0,le.Sh)(dn)&&kt!==dn&&jt(dn),St==null||St.registerSubPopup(xt,dn)}),Gt=y.useState(null),Ft=(0,fe.Z)(Gt,2),dt=Ft[0],Re=Ft[1],$e=y.useRef(null),Qe=(0,x.Z)(function(dn){(0,le.Sh)(dn)&&dt!==dn&&(Re(dn),$e.current=dn)}),Xe=y.Children.only(R),gt=(Xe==null?void 0:Xe.props)||{},pt={},Rt=(0,x.Z)(function(dn){var Ln,qn,Wn=dt;return(Wn==null?void 0:Wn.contains(dn))||((Ln=(0,l.A)(Wn))===null||Ln===void 0?void 0:Ln.host)===dn||dn===Wn||(kt==null?void 0:kt.contains(dn))||((qn=(0,l.A)(kt))===null||qn===void 0?void 0:qn.host)===dn||dn===kt||Object.values(ke.current).some(function(er){return(er==null?void 0:er.contains(dn))||dn===er})}),Kt=H(K,qt,nn,en),Ht=H(K,gn,zn,wn),tn=y.useState(se||!1),$n=(0,fe.Z)(tn,2),Vt=$n[0],un=$n[1],rn=J!=null?J:Vt,fn=(0,x.Z)(function(dn){J===void 0&&un(dn)});(0,h.Z)(function(){un(J||!1)},[J]);var Yt=y.useRef(rn);Yt.current=rn;var Bt=y.useRef([]);Bt.current=[];var Wt=(0,x.Z)(function(dn){var Ln;fn(dn),((Ln=Bt.current[Bt.current.length-1])!==null&&Ln!==void 0?Ln:rn)!==dn&&(Bt.current.push(dn),ee==null||ee(dn))}),Jt=y.useRef(),an=function(){clearTimeout(Jt.current)},cn=function(Ln){var qn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;an(),qn===0?Wt(Ln):Jt.current=setTimeout(function(){Wt(Ln)},qn*1e3)};y.useEffect(function(){return an},[]);var En=y.useState(!1),mn=(0,fe.Z)(En,2),on=mn[0],jn=mn[1];(0,h.Z)(function(dn){(!dn||rn)&&jn(!0)},[rn]);var Qn=y.useState(null),or=(0,fe.Z)(Qn,2),Vn=or[0],ir=or[1],Jn=y.useState(null),_r=(0,fe.Z)(Jn,2),ur=_r[0],On=_r[1],sn=function(Ln){On([Ln.clientX,Ln.clientY])},Dt=ft(rn,kt,je&&ur!==null?ur:dt,Ne,Ie,U,yt),bt=(0,fe.Z)(Dt,11),$t=bt[0],Qt=bt[1],bn=bt[2],Kn=bt[3],tr=bt[4],Xt=bt[5],Tn=bt[6],Bn=bt[7],Zn=bt[8],pr=bt[9],An=bt[10],Yn=Ve(Hn,be,k,Y),Xn=(0,fe.Z)(Yn,2),cr=Xn[0],sr=Xn[1],gr=cr.has("click"),fr=sr.has("click")||sr.has("contextMenu"),Ar=(0,x.Z)(function(){on||An()}),Sr=function(){Yt.current&&je&&fr&&cn(!1)};Ae(rn,dt,kt,Ar,Sr),(0,h.Z)(function(){Ar()},[ur,Ne]),(0,h.Z)(function(){rn&&!(Ie!=null&&Ie[Ne])&&Ar()},[JSON.stringify(U)]);var Or=y.useMemo(function(){var dn=G(Ie,K,pr,je);return p()(dn,de==null?void 0:de(pr))},[pr,de,Ie,K,je]);y.useImperativeHandle(xe,function(){return{nativeElement:$e.current,popupElement:At.current,forceAlign:Ar}});var br=y.useState(0),yr=(0,fe.Z)(br,2),Vr=yr[0],In=yr[1],zr=y.useState(0),Dr=(0,fe.Z)(zr,2),ii=Dr[0],si=Dr[1],Xr=function(){if(pe&&dt){var Ln=dt.getBoundingClientRect();In(Ln.width),si(Ln.height)}},ui=function(){Xr(),Ar()},Wr=function(Ln){jn(!1),An(),ne==null||ne(Ln)},mr=function(){return new Promise(function(Ln){Xr(),ir(function(){return Ln})})};(0,h.Z)(function(){Vn&&(An(),Vn(),ir(null))},[Vn]);function Lr(dn,Ln,qn,Wn){pt[dn]=function(er){var Qr;Wn==null||Wn(er),cn(Ln,qn);for(var Ur=arguments.length,Jr=new Array(Ur>1?Ur-1:0),$r=1;$r<Ur;$r++)Jr[$r-1]=arguments[$r];(Qr=gt[dn])===null||Qr===void 0||Qr.call.apply(Qr,[gt,er].concat(Jr))}}(gr||fr)&&(pt.onClick=function(dn){var Ln;Yt.current&&fr?cn(!1):!Yt.current&&gr&&(sn(dn),cn(!0));for(var qn=arguments.length,Wn=new Array(qn>1?qn-1:0),er=1;er<qn;er++)Wn[er-1]=arguments[er];(Ln=gt.onClick)===null||Ln===void 0||Ln.call.apply(Ln,[gt,dn].concat(Wn))});var Br=rt(rn,fr,dt,kt,Ge,Fe,Rt,cn),Hr=cr.has("hover"),ar=sr.has("hover"),Rr,kr;Hr&&(Lr("onMouseEnter",!0,Ee,function(dn){sn(dn)}),Lr("onPointerEnter",!0,Ee,function(dn){sn(dn)}),Rr=function(Ln){(rn||on)&&kt!==null&&kt!==void 0&&kt.contains(Ln.target)&&cn(!0,Ee)},je&&(pt.onMouseMove=function(dn){var Ln;(Ln=gt.onMouseMove)===null||Ln===void 0||Ln.call(gt,dn)})),ar&&(Lr("onMouseLeave",!1,Ce),Lr("onPointerLeave",!1,Ce),kr=function(){cn(!1,Ce)}),cr.has("focus")&&Lr("onFocus",!0,De),sr.has("focus")&&Lr("onBlur",!1,oe),cr.has("contextMenu")&&(pt.onContextMenu=function(dn){var Ln;Yt.current&&sr.has("contextMenu")?cn(!1):(sn(dn),cn(!0)),dn.preventDefault();for(var qn=arguments.length,Wn=new Array(qn>1?qn-1:0),er=1;er<qn;er++)Wn[er-1]=arguments[er];(Ln=gt.onContextMenu)===null||Ln===void 0||Ln.call.apply(Ln,[gt,dn].concat(Wn))}),kn&&(pt.className=p()(gt.className,kn));var Sn=y.useRef(!1);Sn.current||(Sn.current=ut||rn||on);var Gn=(0,L.Z)((0,L.Z)({},gt),pt),Dn={},Un=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Un.forEach(function(dn){Lt[dn]&&(Dn[dn]=function(){for(var Ln,qn=arguments.length,Wn=new Array(qn),er=0;er<qn;er++)Wn[er]=arguments[er];(Ln=Gn[dn])===null||Ln===void 0||Ln.call.apply(Ln,[Gn].concat(Wn)),Lt[dn].apply(Lt,Wn)})});var lr=y.cloneElement(Xe,(0,L.Z)((0,L.Z)({},Gn),Dn)),Er={x:Xt,y:Tn},jr=It?(0,L.Z)({},It!==!0?It:{}):null;return y.createElement(y.Fragment,null,y.createElement(ge.Z,{disabled:!rn,ref:Qe,onResize:ui},y.createElement(X,{getTriggerDOMNode:Nn},lr)),Sn.current&&y.createElement(we.Provider,{value:st},y.createElement(q,{portal:ye,ref:Pt,prefixCls:K,popup:zt,className:p()(ct,Or),style:Ut,target:dt,onMouseEnter:Rr,onMouseLeave:kr,onPointerEnter:Rr,zIndex:z,open:rn,keepDom:on,fresh:ve,onClick:tt,onPointerDownCapture:Br,mask:Ge,motion:Kt,maskMotion:Ht,onVisibleChanged:Wr,onPrepare:mr,forceRender:ut,autoDestroy:ht,getPopupContainer:lt,align:pr,arrow:jr,arrowPos:Er,ready:$t,offsetX:Qt,offsetY:bn,offsetR:Kn,offsetB:tr,onAlign:Ar,stretch:pe,targetWidth:Vr/Bn,targetHeight:ii/Zn})))});return me}var ze=et(ue.Z)},59243:function(_n,_t,w){"use strict";var L=w(59301),fe=w(93314),Te=w(7939),ue=Object.defineProperty,$=Object.defineProperties,p=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,x=(y,S,F)=>S in y?ue(y,S,{enumerable:!0,configurable:!0,writable:!0,value:F}):y[S]=F,A=(y,S)=>{for(var F in S||(S={}))le.call(S,F)&&x(y,F,S[F]);if(ge)for(var F of ge(S))l.call(S,F)&&x(y,F,S[F]);return y},h=(y,S)=>$(y,p(S));const m=({img:y,buttonProps:S={},styles:F={},customText:Z,ButtonText:W,ButtonClick:I,Buttonclass:N,ButtonTwo:T,imgStyles:D,loading:q=!1,className:te=""})=>L.createElement("section",{className:`tc animated fadeIn ${te}`,style:A({color:"#999",margin:"100px auto",visibility:q?"hidden":"visible"},F)},L.createElement("img",{src:y||fe,style:h(A({},D),{pointerEvents:"none",userSelect:"none"})}),L.createElement("p",{className:"mt20 font14"},Z||"\u6682\u65F6\u8FD8\u6CA1\u6709\u76F8\u5173\u6570\u636E\u54E6!"),W&&L.createElement(Te.ZP,A({className:N,onClick:I},S),W),T&&T);_t.Z=m},47199:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return N}});var L=w(59301),fe={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},Te=w(7939),ue=w(70557),$=w(58478),p=w(25399),ge=w(31735),le=w(22167),l=w(59243),x=w(26869),A=w(38609),h=w(59301),m=Object.defineProperty,y=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,Z=(T,D,q)=>D in T?m(T,D,{enumerable:!0,configurable:!0,writable:!0,value:q}):T[D]=q,W=(T,D)=>{for(var q in D||(D={}))S.call(D,q)&&Z(T,q,D[q]);if(y)for(var q of y(D))F.call(D,q)&&Z(T,q,D[q]);return T},I=(T,D,q)=>new Promise((te,X)=>{var ce=Ve=>{try{Pe(q.next(Ve))}catch(V){X(V)}},we=Ve=>{try{Pe(q.throw(Ve))}catch(V){X(V)}},Pe=Ve=>Ve.done?te(Ve.value):Promise.resolve(Ve.value).then(ce,we);Pe((q=q.apply(T,D)).next())}),N=({editOffice:T="view",data:D,issaver:q,onSaver:te,theme:X,type:ce,filename:we,monacoEditor:Pe,className:Ve,style:V,close:C,onClose:G,hasMask:H,disabledDownload:Q,onImgDimensions:j,showNodata:_,recordInfo:v})=>{const[P,re]=(0,L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),[Oe,Ze]=(0,L.useState)(""),[Ye,qe]=(0,L.useState)(),ft=window.ENV==="build"?"/react/build":"",vt=location.host.startsWith("localhost")?x.Z.PROXY_SERVER:x.Z.API_SERVER,wt=10*(1024*1024),rt=(0,L.useRef)();D!=null&&D.startsWith("/api")&&ce!=="txt"&&(D=x.Z.API_SERVER+D);const Mt=B=>B.substring(B.lastIndexOf("/")+1).split(".").pop();we&&Pe&&(Pe.filename=we),(0,L.useEffect)(()=>{var B,xe;const Le=(xe=(B=document.cookie)==null?void 0:B.replace(/\s/g,""))==null?void 0:xe.split(";");Le==null||Le.map(K=>{let R=K.split("=");R[0]==="_educoder_session"&&Ze(R[1])})},[]),(0,L.useEffect)(()=>{ce==="office"&&(D.indexOf("bigfilescdn.")>-1||D.indexOf("bigfiles1")>-1?qe({url:D,fileType:Mt(D),model:D.indexOf("model=edit")?"edit":"view"}):ze())},[ce,D]);function et(B){return I(this,null,function*(){B.data.type==="pdfdata"&&(te(B.data.data),window.removeEventListener("message",et,!1)),console.log("mess---:",B.data)})}const ze=()=>I(void 0,null,function*(){console.log("data:",D);let B=D;D.startsWith("http")||(B=location.origin+B);let xe=new URL(B).pathname.split("/").pop();const Le=yield(0,le.gJ)({attachment_id:xe});Le.url=vt+Le.url,qe(Le)}),ye=()=>{if(D.startsWith("http")||D.startsWith("blob:")){me();return}(0,ge.Sv)(we||"educoder",D,we)},me=()=>{v&&(0,A.fc)({id:v==null?void 0:v.id,watch_type:1,course_id:v==null?void 0:v.course_id}),(0,ge.Nd)(we||"educoder",decodeURIComponent(D))};return h.createElement("div",{style:W({},V||{}),className:`${H&&fe.bgBlack} ${ce?fe.wrp:"hide"}`},C&&h.createElement("div",{className:fe.close,ref:rt},!!j&&h.createElement(p.Z,{title:"\u70B9\u51FB\u5BF9\u56FE\u7247\u8FDB\u884C\u6279\u6CE8",getPopupContainer:()=>rt.current},h.createElement("span",{onClick:()=>{G(),j()}},h.createElement("i",{className:"icon-yulanpizhu"}))),!Q&&h.createElement(p.Z,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:()=>rt.current},h.createElement("span",{onClick:me},h.createElement("i",{className:"icon-quxiaozhiding"}))),q&&h.createElement(p.Z,{title:"\u4FDD\u5B58pdf\u5E76\u9000\u51FA",getPopupContainer:()=>rt.current},h.createElement("span",{className:"",onClick:()=>{const B=document.getElementById("pdfiframe");window.addEventListener("message",et,!1),setTimeout(()=>{B.contentWindow.postMessage("getData","*")},300)}},h.createElement("i",{className:"icon-baocun"}))),h.createElement(p.Z,{title:"\u5173\u95ED",getPopupContainer:()=>rt.current},h.createElement("span",{className:"",onClick:()=>{G()}},h.createElement("i",{className:"icon-guanbi1"})))),h.createElement("div",{className:`${fe[Ve]} ${Ve} ${fe.monaco} ${ce==="txt"?"show":"hide"}`},ce==="txt"&&h.createElement(h.Fragment,null,h.createElement($.ZP,W({},Pe)))),ce==="audio"&&h.createElement("audio",{src:`${(D==null?void 0:D.indexOf("http://"))>-1||(D==null?void 0:D.indexOf("https://"))>-1?"":"data:audio/mp3;base64,"}${D}`,autoPlay:!0}),ce==="video"&&h.createElement(h.Fragment,null,(D==null?void 0:D.indexOf("http"))>-1?h.createElement("video",{controls:!0,src:`${D}`,autoPlay:!0}):h.createElement("video",{controls:!0,src:`data:video/mp4;base64,${D}`,autoPlay:!0})),ce==="office"&&Ye&&h.createElement("iframe",{src:`${ft}/office.html?key=${Ye.key}&url=${btoa(Ye.url)}&callbackUrl=${vt+(Ye.callbackUrl||"")}&fileType=${Ye.fileType}&title=${Ye.title||""}&model=${T}&officeServer=${x.Z.ONLYOFFICE}&disabledDownload=${!!Q}`}),ce==="html"&&h.createElement("iframe",{src:D+"&disposition=inline"}),ce==="pdf"&&q&&h.createElement("iframe",{id:"pdfiframe",src:`${ft}/js/pdfview/index.html?filename=${we||"educoder.pdf"}&url=${encodeURIComponent(D)}&disabledDownload=${!!Q}&model=${T}`}),ce==="pdf"&&!q&&h.createElement("embed",{className:fe.embed,src:D+"#toolbar=0&statusbar=0&navpanes=0&scrollbars=0"}),ce==="image"&&h.createElement("img",{src:`${(D==null?void 0:D.indexOf("http://"))>-1||(D==null?void 0:D.indexOf("https://"))>-1?"":"data:image/png;base64,"}${D}`}),(ce==="other"||ce==="download")&&h.createElement(h.Fragment,null,_?h.createElement(l.Z,{customText:"\u5F53\u524D\u6587\u4EF6\u4E0D\u652F\u6301\u9884\u89C8\uFF0C\u53EF\u70B9\u51FB\u4E0B\u8F7D\u67E5\u770B",ButtonTwo:h.createElement(Te.ZP,{icon:h.createElement("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:ye,disabled:Q},"\u4E0B\u8F7D")}):h.createElement(Te.ZP,{type:"primary",size:"middle",onClick:ye,disabled:Q},h.createElement(ue.Z,null),"\u70B9\u51FB\u4E0B\u8F7D")),ce==="flowChart"&&h.createElement("div",{className:"embed"},h.createElement("iframe",{src:`/drawio/src/main/webapp/viewer.html?id=${D||""}&gapi=0&od=0&db=0&gh=0&gl=0`,width:"100%",height:"100%",frameBorder:"0"})))}},59944:function(_n,_t,w){"use strict";w.d(_t,{z:function(){return Pe},Z:function(){return Ve}});var L=w(59301),fe=w(54196),Te=w(58489),ue=w(64018),$=w(80360),p=w(26869),ge=w(31735),le=w(15342),l=w(44104),x=w(7939),A=w(1012),h=w(47199),m=w(59301),S=({html:V})=>{const C=(0,L.useRef)(null),G=(0,L.useRef)(null),H=`.markdown-body p {
margin: 0 0 16px 0 !important;
line-height: 28px;
white-space: pre-wrap;
}
ol,
ul,
li {
list-style-type: none
}
ol,
ul,
dl {
margin-bottom: 0px;
}
.markdown-body {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
color: #333;
overflow: hidden;
font-family: "Microsoft YaHei", Helvetica, "Meiryo UI", "Malgun Gothic", "Segoe UI", "Trebuchet MS", "Monaco", monospace, Tahoma, STXihei, "\u534E\u6587\u7EC6\u9ED1", STHeiti, "Helvetica Neue", "Droid Sans", "wenquanyi micro hei", FreeSans, Arimo, Arial, SimSun, "\u5B8B\u4F53", Heiti, "\u9ED1\u4F53", sans-serif;
word-break: break-word;
font-size: 16px;
line-height: 1.6;
white-space: normal;
word-wrap: break-word;
position: relative;
}
.markdown-body ul>li {
list-style-type: disc;
}
.markdown-body ol>li {
list-style-type: decimal;
}
.markdown-body a {
background: transparent;
}
.markdown-body a:active,
.markdown-body a:hover {
outline: 0;
}
.markdown-body strong {
font-weight: bold;
}
.markdown-body h1 {
font-size: 2em;
margin: 0.67em 0;
}
.markdown-body img {
border: 0;
}
.markdown-body hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
.markdown-body pre {
overflow: auto;
}
.markdown-body code,
.markdown-body kbd,
.markdown-body pre {
font-family: "Meiryo UI", "YaHei Consolas Hybrid", Consolas, "Malgun Gothic", "Segoe UI", "Trebuchet MS", Helvetica, monospace, monospace;
font-size: 1em;
}
.markdown-body input {
color: inherit;
font: inherit;
margin: 0;
}
.markdown-body html input[disabled] {
cursor: default;
}
.markdown-body input {
line-height: normal;
}
.markdown-body input[type="checkbox"] {
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
.markdown-body table {
border-collapse: collapse;
border-spacing: 0;
}
.markdown-body td,
.markdown-body th {
padding: 0;
}
.markdown-body * {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.markdown-body input {
font: 13px/1.4 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
}
.markdown-body a {
color: #4183c4;
text-decoration: none;
}
.markdown-body a:hover,
.markdown-body a:active {
text-decoration: underline;
}
.markdown-body hr {
height: 0;
margin: 15px 0;
overflow: hidden;
background: transparent;
border: 0;
border-bottom: 1px solid #ddd;
}
.markdown-body hr:before {
display: table;
content: "";
}
.markdown-body hr:after {
display: table;
clear: both;
content: "";
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 15px;
margin-bottom: 15px;
line-height: 1.1;
}
.markdown-body h1 {
font-size: 30px;
}
.markdown-body h2 {
font-size: 21px;
}
.markdown-body h3 {
font-size: 16px;
}
.markdown-body h4 {
font-size: 14px;
}
.markdown-body h5 {
font-size: 12px;
}
.markdown-body h6 {
font-size: 11px;
}
.markdown-body blockquote {
margin: 0;
}
.markdown-body ul,
.markdown-body ol {
padding: 0;
margin-top: 0;
margin-bottom: 0;
}
ul.linenums,
ol.linenums {
padding: 16px 0 0 56px !important;
}
.markdown-body ul,
.markdown-body ol {
padding-left: 2em;
}
.markdown-body ol ol,
.markdown-body ul ol {
list-style-type: lower-roman;
}
.markdown-body ul ul ol,
.markdown-body ul ol ol,
.markdown-body ol ul ol,
.markdown-body ol ol ol {
list-style-type: lower-alpha;
}
.markdown-body dd {
margin-left: 0;
}
.markdown-body code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-size: 12px;
}
.markdown-body pre {
margin-top: 0;
margin-bottom: 0;
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
.markdown-body .octicon {
font: normal normal 16px octicons-anchor;
line-height: 1;
display: inline-block;
text-decoration: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.markdown-body .octicon-link:before {
content: '\f05c';
}
.markdown-body>*:first-child {
margin-top: 0 !important;
}
.markdown-body>*:last-child {
margin-bottom: 0 !important;
}
.markdown-body .anchor {
position: absolute;
top: 0;
left: 0;
display: block;
padding-right: 6px;
padding-left: 30px;
margin-left: -30px;
}
.markdown-body .anchor:focus {
outline: none;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
position: relative;
margin-top: 1em;
margin-bottom: 16px;
font-weight: bold;
line-height: 1.4;
}
.markdown-body h1 .octicon-link,
.markdown-body h2 .octicon-link,
.markdown-body h3 .octicon-link,
.markdown-body h4 .octicon-link,
.markdown-body h5 .octicon-link,
.markdown-body h6 .octicon-link {
display: none;
color: #000;
vertical-align: middle;
}
.markdown-body h1:hover .anchor,
.markdown-body h2:hover .anchor,
.markdown-body h3:hover .anchor,
.markdown-body h4:hover .anchor,
.markdown-body h5:hover .anchor,
.markdown-body h6:hover .anchor {
padding-left: 8px;
margin-left: -30px;
text-decoration: none;
}
.markdown-body h1:hover .anchor .octicon-link,
.markdown-body h2:hover .anchor .octicon-link,
.markdown-body h3:hover .anchor .octicon-link,
.markdown-body h4:hover .anchor .octicon-link,
.markdown-body h5:hover .anchor .octicon-link,
.markdown-body h6:hover .anchor .octicon-link {
display: inline-block;
}
.markdown-body h1 {
padding-bottom: 0.3em;
font-size: 2.25em;
line-height: 1.2;
border-bottom: 1px solid #eee;
}
.markdown-body h1 .anchor {
line-height: 1;
}
.markdown-body h2 {
padding-bottom: 0.3em;
font-size: 1.75em;
line-height: 1.225;
border-bottom: 1px solid #eee;
}
.markdown-body h2 .anchor {
line-height: 1;
}
.markdown-body h3 {
font-size: 1.5em;
line-height: 1.43;
}
.markdown-body h3 .anchor {
line-height: 1.2;
}
.markdown-body h4 {
font-size: 1.25em;
}
.markdown-body h4 .anchor {
line-height: 1.2;
}
.markdown-body h5 {
font-size: 1em;
}
.markdown-body h5 .anchor {
line-height: 1.1;
}
.markdown-body h6 {
font-size: 1em;
color: #777;
}
.markdown-body h6 .anchor {
line-height: 1.1;
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
}
.markdown-body ul ul,
.markdown-body ul ol,
.markdown-body ol ol,
.markdown-body ol ul {
margin-top: 0;
margin-bottom: 0;
}
.markdown-body li>p {
margin-top: 16px;
}
.markdown-body dl {
padding: 0;
}
.markdown-body dl dt {
padding: 0;
margin-top: 16px;
font-size: 1em;
font-style: italic;
font-weight: bold;
}
.markdown-body dl dd {
padding: 0 16px;
margin-bottom: 16px;
}
.markdown-body blockquote {
padding: 0 15px;
color: #777;
border-left: 4px solid #ddd;
}
.markdown-body blockquote> :first-child {
margin-top: 0;
}
.markdown-body blockquote> :last-child {
margin-bottom: 0;
}
.markdown-body table {
display: block;
width: 100%;
overflow: auto;
word-break: normal;
word-break: keep-all;
}
.markdown-body table th {
font-weight: bold;
text-align: revert;
}
.markdown-body table th,
.markdown-body table td {
padding: 6px 13px;
border: 1px solid #ddd;
}
.markdown-body table tr {
background-color: #fff;
border-top: 1px solid #ccc;
}
.markdown-body table tr:nth-child(2n) {
background-color: #f8f8f8;
}
.markdown-body img {
max-width: 100%;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.markdown-body code {
padding: 0;
padding-top: 0.2em;
padding-bottom: 0.2em;
margin: 0;
font-size: 85%;
background-color: rgba(0, 0, 0, 0.04);
border-radius: 3px;
}
.markdown-body code:has(.katex) {
background-color: transparent;
}
.markdown-body code:before,
.markdown-body code:after {
letter-spacing: -0.2em;
content: "\\00a0";
}
.markdown-body pre>code {
padding: 0;
margin: 0;
font-size: 100%;
word-break: normal;
white-space: pre;
background: transparent;
border: 0;
}
.markdown-body .highlight {
margin-bottom: 16px;
}
.markdown-body .highlight pre,
.markdown-body pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f7f7f7;
border-radius: 3px;
}
.markdown-body .highlight pre {
margin-bottom: 0;
word-break: normal;
}
.markdown-body pre {
word-wrap: normal;
}
.markdown-body pre code {
display: inline;
max-width: initial;
padding: 0;
margin: 0;
overflow: initial;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
}
.markdown-body pre code:before,
.markdown-body pre code:after {
content: normal;
}
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body .pl-c {
color: #969896;
}
.markdown-body .pl-c1,
.markdown-body .pl-mdh,
.markdown-body .pl-mm,
.markdown-body .pl-mp,
.markdown-body .pl-mr,
.markdown-body .pl-s1 .pl-v,
.markdown-body .pl-s3,
.markdown-body .pl-sc,
.markdown-body .pl-sv {
color: #0086b3;
}
.markdown-body .pl-e,
.markdown-body .pl-en {
color: #795da3;
}
.markdown-body .pl-s1 .pl-s2,
.markdown-body .pl-smi,
.markdown-body .pl-smp,
.markdown-body .pl-stj,
.markdown-body .pl-vo,
.markdown-body .pl-vpf {
color: #333;
}
.markdown-body .pl-ent {
color: #63a35c;
}
.markdown-body .pl-k,
.markdown-body .pl-s,
.markdown-body .pl-st {
color: #a71d5d;
}
.markdown-body .pl-pds,
.markdown-body .pl-s1,
.markdown-body .pl-s1 .pl-pse .pl-s2,
.markdown-body .pl-sr,
.markdown-body .pl-sr .pl-cce,
.markdown-body .pl-sr .pl-sra,
.markdown-body .pl-sr .pl-sre,
.markdown-body .pl-src {
color: #df5000;
}
.markdown-body .pl-mo,
.markdown-body .pl-v {
color: #1d3e81;
}
.markdown-body .pl-id {
color: #b52a1d;
}
.markdown-body .pl-ii {
background-color: #b52a1d;
color: #f8f8f8;
}
.markdown-body .pl-sr .pl-cce {
color: #63a35c;
font-weight: bold;
}
.markdown-body .pl-ml {
color: #693a17;
}
.markdown-body .pl-mh,
.markdown-body .pl-mh .pl-en,
.markdown-body .pl-ms {
color: #1d3e81;
font-weight: bold;
}
.markdown-body .pl-mq {
color: #008080;
}
.markdown-body .pl-mi {
color: #333;
font-style: italic;
}
.markdown-body .pl-mb {
color: #333;
font-weight: bold;
}
.markdown-body .pl-md,
.markdown-body .pl-mdhf {
background-color: #ffecec;
color: #bd2c00;
}
.markdown-body .pl-mdht,
.markdown-body .pl-mi1 {
background-color: #eaffea;
color: #55a532;
}
.markdown-body .pl-mdr {
color: #795da3;
font-weight: bold;
}
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
line-height: 10px;
color: #555;
vertical-align: middle;
background-color: #fcfcfc;
border: solid 1px #ccc;
border-bottom-color: #bbb;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
}
.markdown-body .task-list-item {
list-style-type: none;
}
.markdown-body .task-list-item+.task-list-item {
margin-top: 3px;
}
.markdown-body .task-list-item input {
float: left;
margin: 0.3em 0 0.25em -1.6em;
vertical-align: middle;
}
.markdown-body :checked+.radio-label {
z-index: 1;
position: relative;
border-color: #4183c4;
}
/*! Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
.pln {
color: #000
}
/* plain text */
@media screen {
.str {
color: #080
}
/* string content */
.kwd {
color: #008
}
/* a keyword */
.com {
color: #800
}
/* a comment */
.typ {
color: #606
}
/* a type name */
.lit {
color: #066
}
/* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun,
.opn,
.clo {
color: #660
}
.tag {
color: #008
}
/* a markup tag name */
.atn {
color: #606
}
/* a markup attribute name */
.atv {
color: #080
}
/* a markup attribute value */
.dec,
.var {
color: #606
}
/* a declaration; a variable name */
.fun {
color: red
}
/* a function name */
}
/* Use higher contrast and text-weight for printable form. */
@media print,
projection {
.str {
color: #060
}
.kwd {
color: #006;
font-weight: bold
}
.com {
color: #600;
font-style: italic
}
.typ {
color: #404;
font-weight: bold
}
.lit {
color: #044
}
.pun,
.opn,
.clo {
color: #440
}
.tag {
color: #006;
font-weight: bold
}
.atn {
color: #404
}
.atv {
color: #060
}
}
/* Put a border around prettyprinted code snippets. */
pre.prettyprint {
padding: 2px;
/* border: 1px solid #888 */
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums {
margin-top: 0;
margin-bottom: 0
}
/* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 {
list-style-type: none
}
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 {
background: #eee
}
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
}`;return(0,L.useEffect)(()=>{const Q=C.current.attachShadow({mode:"open"});G.current=document.createElement("div"),G.current.className="markdown-body",G.current.innerHTML=V,Q.appendChild(G.current);const j=document.createElement("style");return j.textContent=H,Q.appendChild(j),()=>{Q.innerHTML=""}},[]),(0,L.useEffect)(()=>{G.current&&(G.current.innerHTML=V)},[V]),m.createElement("div",{ref:C})};function F(V){const C=["onabort","onanimationend","onanimationiteration","onanimationstart","onauxclick","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncopy","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","ongotpointercapture","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onlostpointercapture","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onpaste","onpause","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointermove","onpointerout","onpointerover","onpointerup","onprogress","onratechange","onreset","onresize","onscroll","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onsubmit","onsuspend","ontimeupdate","ontoggle","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontransitionend","onvolumechange","onwaiting","onwheel"],G=new RegExp(`\\b(${C.join("|")})\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s>]*)`,"gi");return V.replace(G,"").trim()}var Z={mdBody:"mdBody___raKXb",button:"button___Ch5Pc",previewFlowChart:"previewFlowChart___vY1dq"},W=Object.defineProperty,I=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,D=(V,C,G)=>C in V?W(V,C,{enumerable:!0,configurable:!0,writable:!0,value:G}):V[C]=G,q=(V,C)=>{for(var G in C||(C={}))N.call(C,G)&&D(V,G,C[G]);if(I)for(var G of I(C))T.call(C,G)&&D(V,G,C[G]);return V};const te="@\u2581\u2581@",X="@\u2581@",ce=/<pre[^>]*>/g;function we(V){let C=document.createElement("div");return C.innerHTML=V,C.childNodes.length===0?"":C.childNodes[0].nodeValue}const Pe=(V,C)=>{V=V||"";const G=/(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?\)|(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,H=/\"(?:https?:\/\/[^\/]+)?\/api\/attachments\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,Q=/\(\s+(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?|\"(?:https?:\/\/[^\/]+)?\/files\/uploads\/([A-Za-z0-9+/=]+)(\?.*?)?\//g,j=/(?:https?:\/\/[^\/]+)?\/attachments\/download\/([A-Za-z0-9+/=]+)(\?.*?)?\//g;return C?V.replaceAll("https://www.educoder.net","").replaceAll("https://www-cdn.educoder.net","").replaceAll("//api/attachments","/api/attachments").replace(G,(_,v,P,re,Oe,Ze,Ye)=>{const qe=v||re||Ze,ft=P||Oe||Ye||"?";return p.Z.API_SERVER+"/api/attachments/"+qe+ft+"&t="+(0,ge.Jn)(qe,Date.now())+(_.indexOf(")")>-1?")":"&")}).replaceAll('src="(','src="').replaceAll("src='(",'src="'):(V=V.replace(j,(_,v,P,re,Oe,Ze,Ye)=>{const qe=v||re||Ze,ft=P||Oe||Ye||"?";return p.Z.API_SERVER+"/attachments/download/"+qe+ft+"&t="+(0,ge.Jn)(qe,Date.now())+(_.indexOf(")")>-1?")":"&")}).replace(G,(_,v,P,re,Oe,Ze,Ye)=>{const qe=v||re||Ze,ft=P||Oe||Ye||"?";return p.Z.API_SERVER+"/api/attachments/"+qe+ft+"&t="+(0,ge.Jn)(qe,Date.now())+(_.indexOf(")")>-1?")":"&")}).replace(H,(_,v,P,re,Oe)=>{const Ze=v||re,Ye=P||Oe||"";return'"'+p.Z.API_SERVER+"/api/attachments/"+Ze+Ye+Ze+Ye+"&t="+(0,ge.Jn)(Ze,Date.now())}).replace(Q,(_,v,P,re,Oe)=>{const Ze=v||re,Ye=P||Oe||"";return"("+p.Z.API_SERVER+"/files/uploads/"+Ze+Ye+Ze+Ye+"&t="+(0,ge.Jn)(Ze,Date.now())}).replaceAll('src="(','src="').replaceAll("src='(",'src="').replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),V)};var Ve=({value:V="",edit:C=!1,className:G,showTextOnly:H,showLines:Q,style:j={},stylesPrev:_={},highlightKeywords:v,showProgramFill:P,isProgramFill:re,disabledFill:Oe=!1,programFillValue:Ze,openEditor:Ye=()=>{},onFillChange:qe=Ae=>{},onFillBlur:ft=()=>{},onFillFocus:vt=()=>{}})=>{let Ae=F(String(V||""));const wt=(0,L.useRef)(),rt=(0,L.useRef)(),[Mt,et]=(0,L.useState)(""),[ze,ye]=(0,L.useState)("office"),[me,B]=(0,L.useState)([]),xe=(0,L.useRef)("a"+(0,A.Z)()),Le={},K=oe=>/<style[\s\S]*?>/i.test(oe||""),R=(oe,Ge,Ue)=>{const Fe=document.createElement(oe===X?"input":"textarea");Fe.style.width="100%",Fe.style.height=oe===X?"40px":"151px",Fe.rows=5,Fe.spellcheck=!1,Fe.name="edu-program-fill",Fe.placeholder="\u8BF7\u8F93\u5165",Fe.dataset.id=Ge;const lt=Object.keys(Le).length;return Le[lt]=Fe,`<span class="edu-program-fill-wrap ${oe===X?"":"show"}" style="width:${oe===X?"600px":"100%"}" title=${Ue||""}><span>${Fe.outerHTML}<span class="edu-program-fill-score" style="margin:0 6px"></span></span></span>`};function ie(oe){return oe=oe.replace(/!\[.*?\]\(.*?\)/g,""),oe=oe.replace(/\[.*?\]\(.*?\)/g,""),oe=oe.replace(new RegExp("<iframe.*?<\\/iframe>","gs"),""),oe=oe.replace(/<embed.*?>/g,""),oe=oe.replace(/<img.*?>/g,""),oe=oe.replace(new RegExp("<video.*?>.*?<\\/video>","gs"),""),oe=oe.replace(new RegExp("<audio.*?>.*?<\\/audio>","gs"),""),oe=oe.replace(new RegExp("<style.*?>.*?<\\/style>","gs"),""),oe=oe.replace(new RegExp("<script.*?>.*?<\\/script>","gs"),""),oe}const be=oe=>!H&&K(Ae)?oe:oe.replace(/<style.*?>([\s\S]+?)<\/style>/gim,function(Ge,Ue){let Fe=Ue.replace(/(\n|\r)/g,"").split("}"),lt=[];return Fe.map(ut=>{ut!=""&&lt.push(`.${xe.current} ${ut}`)}),`<style>${lt.join("}")}</style>`}),k=(0,L.useMemo)(()=>{try{const Fe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\//g,lt=/\"\/api\/attachments\/|\"\/attachments\/download\//g,ut=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g,it=/\(\/attachments\/download\//g;Ae=Ae.replace(it,"("+p.Z.API_SERVER+"/attachments/download/").replace(Fe,"("+p.Z.API_SERVER+"/api/attachments/").replace(lt,'"'+p.Z.API_SERVER+"/api/attachments/").replace(ut,'"'+p.Z.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
`),wt.current.style.display="none"}catch(Fe){}if(P){let Fe=-1;return Ae=Ae.replaceAll("<","&lt;").replaceAll(">","&gt;").replace(/(@▁▁@|@▁@)/g,function(lt,ut,it){var Ct;return++Fe,R(lt,Fe,(Ct=Ze==null?void 0:Ze[Fe])==null?void 0:Ct.value.replaceAll("<","&lt;").replaceAll(">","&gt;"))}),`<pre style="background:#fff;padding:4px">${be(Ae||"")}</pre>`}let oe=be(Ae);oe=(0,Te.ZP)(oe);const Ge=(0,Te.ez)();Ae.match(/\[TOC\]/)&&(oe=oe.replace("<p>[TOC]</p>",(0,Te.Qv)()),(0,Te.Iy)()),oe=oe.replace(/(__special_katext_id_\d+__)/g,(Fe,lt)=>{const{type:ut,expression:it}=Ge[lt];return(0,le.renderToString)(we(it)||"",{displayMode:ut==="block",throwOnError:!1,output:"html"})}),oe=oe.replace(/▁/g,"\u2581\u2581\u2581\u2581\u2581"),(0,Te.AL)();const Ue=document.createElement("div");if(Ue.innerHTML=oe,H)return Ue.innerText;if(v){const Fe=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return ee(Ue,Fe),Ue.innerHTML}return setTimeout(()=>Be(),500),Ue.innerHTML},[Ae,v]);(0,L.useEffect)(()=>{ne.current&&ne.current.querySelectorAll(["input","textarea"]).forEach(Ge=>{Ge.oninput=Y,Ge.onblur=J,Ge.onfocus=se})},[me]),(0,L.useEffect)(()=>{var oe,Ge,Ue,Fe,lt;if(Ze!=null&&Ze.length)try{const ut=ne.current.querySelectorAll(".edu-program-fill-score"),it=ne.current.querySelectorAll('[name="edu-program-fill"]');for(const[Ct,zt]of it.entries())zt.value=((oe=Ze==null?void 0:Ze[Ct])==null?void 0:oe.value)||"",((Ge=Ze==null?void 0:Ze[Ct])==null?void 0:Ge.type)==="warning"?zt.className="program-fill-warning":((Ue=Ze==null?void 0:Ze[Ct])==null?void 0:Ue.type)==="success"?zt.className="program-fill-success":zt.className="";for(const[Ct,zt]of ut.entries())zt.innerHTML=(Fe=Ze==null?void 0:Ze[Ct])!=null&&Fe.score?`${(lt=Ze==null?void 0:Ze[Ct])==null?void 0:lt.score}\u5206`:"";B(Ze)}catch(ut){console.log(ut,"error")}},[Ze]);const Y=oe=>{me[oe.target.dataset.id]=me[oe.target.dataset.id]||{},me[oe.target.dataset.id].value=oe.target.value,B([...me]),qe(me,oe.target.dataset.id)},J=oe=>{me[oe.target.dataset.id]=me[oe.target.dataset.id]||{},me[oe.target.dataset.id].value=oe.target.value,B([...me]),ft(me,oe.target.dataset.id)},se=oe=>{me[oe.target.dataset.id]=me[oe.target.dataset.id]||{},me[oe.target.dataset.id].value=oe.target.value,B([...me]),vt(me,oe.target.dataset.id)};function ee(oe,Ge){return oe.childNodes.forEach(Ue=>{var Fe;if(Ue.childNodes.length>0)ee(Ue,Ge);else if(Ue.nodeName!=="IMG")if(Ue.innerHTML)Ue.innerHTML=(Fe=Ue.innerHTML)==null?void 0:Fe.replace(new RegExp(Ge,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>');else{const lt=document.createElement("span");lt.innerHTML=Ue.textContent.replace(new RegExp(Ge,"gi"),'<span style="color:#0152d9;background-color:#1890ff33">$&</span>'),Ue.replaceWith(lt)}})}const ne=(0,L.useRef)();Te.jb.WebkitLineClamp=Q,Q&&(j=q(q({},j),Te.jb));function Ee(oe){let Ge=oe.target;if(Ge.tagName.toUpperCase()==="A"){let Ue=Ge.getAttribute("href");if(Ue.indexOf("office")>-1)oe.preventDefault(),et(Ue),ye("office");else if(Ue.indexOf("application/pdf")>-1)oe.preventDefault(),et(Ue),ye("pdf");else if(Ue.indexOf("text/html")>-1)oe.preventDefault(),et(Ue),ye("html");else if(Ue.startsWith("#")){oe.preventDefault();let Fe=document.getElementById(Ue.replace("#",""));Fe&&Fe.scrollIntoView(!0)}}}const Be=()=>{var oe;const Ge=(oe=ne.current)==null?void 0:oe.querySelectorAll("video");Ge==null||Ge.forEach(Ue=>{if(Ue.oncontextmenu=()=>!1,Ue.src.indexOf(".m3u8")>-1&&!Ue.canPlayType("application/vnd.apple.mpegurl")){if($.ZP.isSupported()){var Fe=new $.ZP;Fe.loadSource(Ue.src),Fe.attachMedia(Ue)}}})};(0,L.useEffect)(()=>{if(ne.current&&k&&k.match(ce)&&window.PR.prettyPrint(),ne.current)return ne.current.addEventListener("click",Ee),()=>{var oe;(oe=ne.current)==null||oe.removeEventListener("click",Ee),(0,Te.AL)(),(0,Te.Iy)()}},[k,ne.current,Ee]);const Ce=oe=>{oe.target.nodeName==="IMG"&&oe.target.className.indexOf("draw-flowchart")>-1?(wt.current.style.zIndex=1,wt.current.style.display="flex",wt.current.style.width=oe.target.clientWidth+"px",wt.current.style.height=oe.target.clientHeight+"px",wt.current.style.top=oe.target.offsetTop+"px",wt.current.style.left=oe.target.offsetLeft+"px",oe.target.id&&(rt.current=oe.target.id)):wt.current.style.display="none"},De=()=>{wt.current.style.display="none"};return(0,L.useEffect)(()=>{var oe;const Ge=Ue=>{Ue.preventDefault(),Ue.clipboardData.setData("text",window.getSelection().toString())};return(oe=ne.current)==null||oe.addEventListener("copy",Ge),()=>{var Ue;(Ue=ne.current)==null||Ue.removeEventListener("copy",Ge)}},[ne.current]),L.createElement("div",{style:{position:"relative"},onMouseLeave:De},H&&L.createElement("div",{ref:ne,className:`${Z.mdBody} `},k),!H&&!K(k)&&L.createElement("div",{ref:ne,style:q({},j),onMouseOver:Ce,className:`${G||""} ${Oe?"disabled-fill":""} markdown-body ${Z.mdBody} ${xe.current}`,dangerouslySetInnerHTML:{__html:k}}),!H&&K(k)&&L.createElement(S,{html:k}),L.createElement("div",{ref:wt,className:`${Z.button} ${C?"":Z.previewFlowChart}`},L.createElement(l.Z,null,L.createElement(x.ZP,{onClick:()=>{C?Ye(rt.current):(et(rt.current),ye("flowChart"))}},C?"\u7F16\u8F91":"\u9884\u89C8"))),L.createElement(h.Z,{close:!0,data:Mt,type:Mt!=null&&Mt.length?ze:"",style:q({},_),onClose:()=>et("")}))}},58478:function(_n,_t,w){"use strict";w.d(_t,{SV:function(){return wt},ZP:function(){return Ae}});var L=w(59301),fe=w(76374);const Te={keywords:["print","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while"]},ue={quickKey:[{label:"main",content:["public static void main(String[] args) {"," $0","}"].join(`
`)},{label:"System.out.println",content:["System.out.println($0)"].join(`
`)},{label:"System.out.print",content:["System.out.print($0)"].join(`
`)}],keywords:["abstract","continue","for","new","switch","assert","default","goto","package","synchronized","boolean","do","if","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","true","false"]},$={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(`
`)}]},ge={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 le=w(53184),l=w.n(le),x=(rt,Mt,et)=>new Promise((ze,ye)=>{var me=Le=>{try{xe(et.next(Le))}catch(K){ye(K)}},B=Le=>{try{xe(et.throw(Le))}catch(K){ye(K)}},xe=Le=>Le.done?ze(Le.value):Promise.resolve(Le.value).then(me,B);xe((et=et.apply(rt,Mt)).next())});const A={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"]}},h=(rt,Mt,et,ze)=>{const ye=Mt.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:et.lineNumber,endColumn:et.column});return Array.from(new Set(ye.match(/\b\w{2,}\b/g)||[])).map(B=>({label:B,kind:rt.languages.CompletionItemKind.Text,insertText:B,range:ze}))},m=(rt,Mt,et,ze)=>{rt.languages.registerCompletionItemProvider(Mt,{provideCompletionItems(ye,me){const B=ye.getWordUntilPosition(me),xe={startLineNumber:me.lineNumber,endLineNumber:me.lineNumber,startColumn:B.startColumn,endColumn:B.endColumn},Le=ye.getLineContent(me.lineNumber).substring(B.startColumn-2,B.endColumn);return{suggestions:[...h(rt,ye,me,xe),...et.map(R=>({label:R,kind:rt.languages.CompletionItemKind.Keyword,documentation:R,insertText:R,insertTextRules:rt.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:xe})),...ze.map(R=>({label:R.label,kind:rt.languages.CompletionItemKind.Snippet,documentation:R.content,insertText:Le.startsWith("#")?R.content.replace(/#/,""):R.content,insertTextRules:rt.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:xe}))]}}})};var y=rt=>{A.languages.forEach(Mt=>{rt.languages.registerDocumentFormattingEditProvider(Mt,{provideDocumentFormattingEdits(et){return x(this,null,function*(){const ze=l()(et.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:et.getFullModelRange(),text:ze}]})}})}),m(rt,"java",ue.keywords,ue.quickKey),m(rt,"cpp",$.keywords,$.quickKey),m(rt,"c",Te.keywords,[]),m(rt,"python",p.keywords,p.quickKey),m(rt,"scala",ge.keywords,ge.quickKey)};const S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002";var F=Object.defineProperty,Z=(rt,Mt,et)=>Mt in rt?F(rt,Mt,{enumerable:!0,configurable:!0,writable:!0,value:et}):rt[Mt]=et,W=(rt,Mt,et)=>Z(rt,typeof Mt!="symbol"?Mt+"":Mt,et);const I=class Sl{constructor(Mt,et,ze){this.placeholder=Mt,this.editor=et,this.monaco=ze,et.onDidChangeModelContent(()=>this.onDidChangeModelContent()),this.onDidChangeModelContent()}onDidChangeModelContent(){this.editor.getValue()===""?this.editor.addContentWidget(this):this.editor.removeContentWidget(this)}getId(){return Sl.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)}};W(I,"ID","editor.widget.placeholderHint");var T=I,D=w(96236),q=w(6767),te=w(25399),X=w(89392),ce=w(94276),we=w(56102),Pe=Object.defineProperty,Ve=Object.defineProperties,V=Object.getOwnPropertyDescriptors,C=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable,Q=(rt,Mt,et)=>Mt in rt?Pe(rt,Mt,{enumerable:!0,configurable:!0,writable:!0,value:et}):rt[Mt]=et,j=(rt,Mt)=>{for(var et in Mt||(Mt={}))G.call(Mt,et)&&Q(rt,et,Mt[et]);if(C)for(var et of C(Mt))H.call(Mt,et)&&Q(rt,et,Mt[et]);return rt},_=(rt,Mt)=>Ve(rt,V(Mt)),v=(rt,Mt)=>{var et={};for(var ze in rt)G.call(rt,ze)&&Mt.indexOf(ze)<0&&(et[ze]=rt[ze]);if(rt!=null&&C)for(var ze of C(rt))Mt.indexOf(ze)<0&&H.call(rt,ze)&&(et[ze]=rt[ze]);return et},P=(rt,Mt,et)=>new Promise((ze,ye)=>{var me=Le=>{try{xe(et.next(Le))}catch(K){ye(K)}},B=Le=>{try{xe(et.throw(Le))}catch(K){ye(K)}},xe=Le=>Le.done?ze(Le.value):Promise.resolve(Le.value).then(me,B);xe((et=et.apply(rt,Mt)).next())});function re(rt){return/^\d+$/.test(rt)?`${rt}px`:rt}function Oe(){}let Ze=!1;const Ye={"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 qe(rt=[]){let Mt=rt;if(Array.isArray(rt)){for(let et=0;et<rt.length;et++){let ze=Ye[rt[et]];if(ze)return ze}return Mt[0]}return Ye[Mt]||Mt}let ft=null;const vt=()=>P(void 0,null,function*(){try{yield navigator.clipboard.writeText(" "),console.log("\u5185\u5BB9\u5DF2\u81EA\u52A8\u590D\u5236\u5230\u526A\u8D34\u677F:")}catch(rt){console.error("\u81EA\u52A8\u590D\u5236\u5931\u8D25:",rt)}});var Ae=rt=>{var Mt=rt,{width:et="100%",height:ze="100%",value:ye,language:me="javascript",style:B={},options:xe={},overrideServices:Le={},theme:K="vs-dark",onEditBlur:R,isCopy:ie=!1,onSave:be,autoHeight:k=!1,forbidCopy:Y=!1,onChange:J=Oe,editorDidMount:se=Oe,onFocus:ee=Oe,onBreakPoint:ne=Oe,breakPointValue:Ee=[],filename:Be="educoder.txt",errorLine:Ce,errorContent:De="",highlightLine:oe,openBreakPoint:Ge=!1,placeholder:Ue="",showMiniMap:Fe=!0}=Mt,lt=v(Mt,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","isCopy","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","onBreakPoint","breakPointValue","filename","errorLine","errorContent","highlightLine","openBreakPoint","placeholder","showMiniMap"]);const ut=(0,L.useRef)(),it=(0,L.useRef)({}),Ct=(0,L.useRef)(),zt=(0,L.useRef)(),ct=(0,L.useRef)([]),Ut=(0,L.useRef)(!1),Ne=(0,L.useRef)(),Se=(0,L.useRef)(),Ie=(0,L.useRef)(!1),[U,z]=(0,L.useState)(!1);function pe(){let Lt;return ut.current&&(Lt=new fe.Z(ht=>{for(let Zt of ht)(Zt.target.offsetHeight>0||Zt.target.offsetWidth>0)&&it.current.instance.layout()}),Lt.observe(ut.current)),Lt}function de(){q.ZP.warning({content:decodeURIComponent(S),key:"monaco-editor-tip"})}const ve=()=>{let Lt=it.current.instance;if(ye!=null&&Lt&&U){const ht=Lt.getModel();ht&&ye!==ht.getValue()&&(Ze=!0,ht.setValue(ye),Lt.layout(),Ze=!1)}};(0,L.useEffect)(()=>{const Lt=ce.Z.subscribe("formatDocument",ht=>{var Zt;let yn=it.current.instance;(Zt=yn==null?void 0:yn.getAction)==null||Zt.call(yn,"editor.action.formatDocument").run()});return window.updateMonacoValue=ht=>{J(ht)},Lt},[]),(0,L.useEffect)(()=>{var Lt;let ht=it.current.instance;zt.current&&clearTimeout(zt.current),zt.current=setTimeout(()=>{ve()},500),ye&&(ye!=null&&ye.length)&&((Lt=ht==null?void 0:ht.updateOptions)==null||Lt.call(ht,{lineNumbersMinChars:Math.max(Math.floor(Math.log10(ye.split(/\r\n|\r|\n/g).length))+3,5)}))},[ye,U,it.current]),(0,L.useEffect)(()=>{if(Ce&&it.current&&it.current.instance){let ht=it.current.instance;ht.changeViewZones(function(Zt){var yn=document.createElement("div");yn.style.padding="10px 20px",yn.style.width="calc(100% - 20px)",yn.className="my-error-line-wrp",yn.innerHTML=De,Zt.addZone({afterLineNumber:Ce||11,heightInLines:3,domNode:yn})});var Lt={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}};ht.addOverlayWidget(Lt),ht.revealPositionInCenter({lineNumber:20,column:1})}},[Ce,it.current,U]);const je=(Lt="",ht)=>{if(!Lt||Lt.trim()==="")return!0;const yn=it.current.instance.getModel().getLineTokens(ht);let Hn=!1;for(let Me=0;Me<2;Me++)yn.getStandardTokenType(Me)===1&&(Hn=!0);return Hn};(0,L.useEffect)(()=>{var Lt;const ht=(Lt=it.current)==null?void 0:Lt.instance;if(ht&&U&&Y){const Zt=ht.onDidBlurEditorWidget(()=>{Ie.current=!1}),yn=ht.onDidFocusEditorText(()=>{Ie.current=!0});return()=>{Zt.dispose(),yn.dispose()}}},[it.current,U,Y]),(0,L.useEffect)(()=>{var Lt;if((Lt=it.current)!=null&&Lt.instance&&U&&Ge){let ht=it.current.instance,Zt=ht.getModel();if(!Zt)return;(()=>{var At;let Pt=[],Gt=[];const Ft=Zt.getAllDecorations();for(let Re of Ft)Re.options.className==="highlighted-line"&&(Pt.push((At=Re==null?void 0:Re.range)==null?void 0:At.startLineNumber),Gt.push(Re==null?void 0:Re.id));if(oe===Pt[0])return;Zt.deltaDecorations(Gt,[]);const dt=Zt.getLineCount();oe&&oe<=dt&&(ht.deltaDecorations([],[{range:new ft.Range(oe,1,oe,Zt.getLineMaxColumn(oe)),options:{isWholeLine:!0,className:"highlighted-line"}}]),ht.revealLineInCenter(oe))})();const Hn=(At=!1)=>{var Pt;let Gt=[],Ft=[];const dt=Zt.getAllDecorations();for(let Re of dt)Re.options.linesDecorationsClassName==="breakpoints-select"&&(Gt.push((Pt=Re==null?void 0:Re.range)==null?void 0:Pt.startLineNumber),Ft.push(Re==null?void 0:Re.id));if(At)return{lines:Gt,ids:Ft};ne(Gt)},Me=At=>P(void 0,null,function*(){let Pt={range:new ft.Range(At,1,At,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}};yield Zt.deltaDecorations([],[Pt]),Hn()}),ke=At=>P(void 0,null,function*(){let Pt=[];const Gt=ht.getLineDecorations(At);for(let Ft of Gt)Ft.options.linesDecorationsClassName==="breakpoints-select"&&Pt.push(Ft.id);yield Zt.deltaDecorations(Pt,[]),Hn()}),St=At=>{let Pt=ht.getLineDecorations(At);for(let Gt of Pt)if(Gt.options.linesDecorationsClassName==="breakpoints-select")return!0;return!1};if(!(0,X.isEqual)(Ee,Hn(!0).lines)){Zt.deltaDecorations(Hn(!0).ids,[]);const At=Ee.map(Pt=>({range:new ft.Range(Pt,1,Pt,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-select"}}));Zt.deltaDecorations([],At)}const st=ht.onDidChangeModelContent(At=>{let Pt=ht.getPosition();if(Pt){let Gt=Pt.lineNumber;clearTimeout(Se.current),Se.current=setTimeout(()=>{je(Zt.getLineContent(Gt),Gt)?ke(Gt):St(Gt)?(ke(Gt),Me(Gt)):Hn()},100)}}),xt=ht.onMouseDown(At=>{var Pt,Gt,Ft;if(At.target.detail&&((Ft=(Gt=(Pt=At.target)==null?void 0:Pt.element)==null?void 0:Gt.className)!=null&&Ft.includes("line-numbers"))){let dt=At.target.position.lineNumber;if(je(Zt.getLineContent(dt),dt))return;St(dt)?ke(dt):Me(dt)}}),Tt=At=>{let Pt={range:new ft.Range(At,1,At,1),options:{isWholeLine:!1,linesDecorationsClassName:"breakpoints-fake"}};ct.current=ht.deltaDecorations(ct.current,[Pt])},Et=()=>{ct.current=ht.deltaDecorations(ct.current,[])},kt=ht.onMouseMove(At=>{var Pt,Gt,Ft;if(Et(),At.target.detail&&((Ft=(Gt=(Pt=At.target)==null?void 0:Pt.element)==null?void 0:Gt.className)!=null&&Ft.includes("line-numbers"))){let dt=At.target.position.lineNumber;if(je(Zt.getLineContent(dt),dt))return;Tt(dt)}}),jt=ht.onMouseLeave(()=>{Et()});return()=>{st.dispose(),xt.dispose(),kt.dispose(),jt.dispose()}}},[it.current,U,Ee,oe,Ge,me]),(0,L.useEffect)(()=>{var Lt;(Lt=it.current)!=null&&Lt.instance&&Ge&&it.current.instance.setPosition({lineNumber:0,column:0})},[oe]);function tt(){let Lt=it.current.instance;if(Lt){const ht=Lt.getSelection(),Zt=it.current.pastePos||{},yn=new ft.Range(Zt.startLineNumber||ht.endLineNumber,Zt.startColumn||ht.endColumn,Zt.endLineNumber||ht.endLineNumber,Zt.endColumn||ht.endColumn);setTimeout(()=>{Lt.executeEdits("",[{range:yn,text:""}])},300)}}function yt(Lt){(window.navigator.platform.match("Mac")?Lt.metaKey:Lt.ctrlKey)&&Lt.keyCode==83&&(Lt.preventDefault(),be())}const It=()=>{if(k&&it.current.instance){const Lt=it.current.instance.getContentHeight();kn(Lt<ze?ze:Lt)}else kn(ze)};function qt(Lt){var ht=document.createEvent("MouseEvents");ht.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Lt.dispatchEvent(ht)}const gn=Lt=>{if(!Ie.current)return;const{keyCode:ht,ctrlKey:Zt,metaKey:yn,target:Hn,type:Me}=Lt;return(Me==="paste"||(ht===67||ht===86)&&(yn||Zt))&&Hn.nodeName==="TEXTAREA"&&(de(),Lt.preventDefault()),!1};function en(Lt,ht){var Zt=window.URL||window.webkitURL||window,yn=new Blob([ht]),Hn=document.createElementNS("http://www.w3.org/1999/xhtml","a");Hn.href=Zt.createObjectURL(yn),Hn.download=Lt,qt(Hn)}(0,L.useEffect)(()=>{It()},[It]),(0,L.useEffect)(()=>{ut.current&&!U&&Promise.all([w.e(8909),w.e(4474)]).then(w.bind(w,71448)).then(Lt=>{try{ft=Lt,it.current.instance=ft.editor.create(ut.current,{value:ye,language:qe(me),theme:K,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0,autoIndent:!0,contextmenu:!0,formatOnType:!0,minimap:{enabled:Fe||!1}},Le);const ht=it.current.instance;let Hn=[...D.BH._menuItems].find(st=>st[0]._debugName=="EditorContext")[1],Me=["editor.action.clipboardCopyWithSyntaxHighlightingAction","editor.action.quickCommand","editor.action.clipboardCopyAction","editor.action.clipboardPasteAction","editor.action.clipboardCutAction"],ke=(st,xt)=>{var Tt,Et;let kt=st._first;do xt.includes((Et=(Tt=kt.element)==null?void 0:Tt.command)==null?void 0:Et.id)&&st._remove(kt);while(kt=kt.next)};if(se(ht,ft),setTimeout(()=>{It(),it.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:()=>{en(Be||"educoder.txt",ht.getValue())}})},500),it.current.subscription=ht.onDidChangeModelContent(st=>{Ut.current?clearTimeout(Ne.current):(It(),J(ht.getValue(),st)),Ne.current=setTimeout(()=>{Ut.current=!1},500)}),window.Monaco||y(ft,qe(me)),Y&&(ke(Hn,Me),ut.current.classList.add("noCopyPaste"),window.removeEventListener("keydown",gn),window.removeEventListener("paste",gn),window.addEventListener("keydown",gn),window.addEventListener("paste",gn)),window.Monaco=ft,R&&ht.onDidBlurEditorWidget(()=>{R(ht.getValue())}),ee&&ht.onDidFocusEditorText(()=>{Y&&vt(),ee(ht.getValue())}),Y){vt();try{ht.onDidPaste(st=>{const xt=ht.getSelection(),Tt=it.current.pastePos||{},Et=new ft.Range(Tt.startLineNumber||xt.endLineNumber,Tt.startColumn||xt.endColumn,Tt.endLineNumber||xt.endLineNumber,Tt.endColumn||xt.endColumn);ht.executeEdits("",[{range:st.range,text:""}])})}catch(st){}}let St=pe();return Ue&&typeof Ue=="string"&&new T(Ue,ht,ft),z(!0),()=>{const st=it.current.instance;st.dispose();const xt=st.getModel();xt&&xt.dispose(),it.current.subscription&&it.current.subscription.dispose(),St.unobserve(ut.current)}}catch(ht){}})},[]),(0,L.useEffect)(()=>{if(it.current.instance&&U)return document.addEventListener("keydown",yt,!1),()=>{document.removeEventListener("keydown",yt)}},[be,U]),(0,L.useEffect)(()=>{let Lt=it.current.instance;if(Lt&&U){let ht=qe(me);ft.editor.setModelLanguage(Lt.getModel(),ht)}},[me,U]),(0,L.useEffect)(()=>{it.current.instance&&U&&ft.editor.setTheme(K)},[K,U]),(0,L.useEffect)(()=>{let Lt=it.current.instance;Ct.current=xe,Lt&&U&&(Lt.updateOptions(j({},xe)),setTimeout(()=>{Lt.getModel().updateOptions(j({},xe))},200))},[JSON.stringify(xe),U]),(0,L.useEffect)(()=>{let Lt=it.current.instance;Lt&&U&&Lt.layout()},[et,ze,U]);const[nn,wn]=(0,L.useState)(re(et)),[zn,kn]=(0,L.useState)(re(ze)),Nn=_(j({},B),{width:nn,height:zn,position:"relative"});return L.createElement("div",{className:"my-monaco-editor",ref:ut,style:Nn,onFocus:()=>{Y&&vt()}},ie&&L.createElement(we.CopyToClipboard,{text:ye,onCopy:()=>q.ZP.success("\u590D\u5236\u6210\u529F")},L.createElement(te.Z,{title:"\u590D\u5236\u4EE3\u7801"},L.createElement("div",{style:{position:"absolute",top:0,right:10,cursor:"pointer",zIndex:10,color:"#165DFF"}},L.createElement("i",{className:"iconfont icon-fuzhi8",style:{fontSize:14}})," \u590D\u5236\u4EE3\u7801"))))};function wt({width:rt="100%",height:Mt="100%",original:et,modified:ze,language:ye,options:me={}}){const B=(0,L.useRef)(),[xe,Le]=(0,L.useState)(null);function K(k){let Y;return B.current&&(Y=new fe.Z(J=>{for(let se of J)(se.target.offsetHeight>0||se.target.offsetWidth>0)&&k.layout()}),Y.observe(B.current)),Y}(0,L.useEffect)(()=>(B.current&&Promise.all([w.e(8909),w.e(9404)]).then(w.bind(w,2550)).then(k=>{ft=k;const Y=ft.editor.createDiffEditor(B.current,_(j({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},me),{wordWrap:!0}));Le(Y);let J=K(Y);return()=>{Y.dispose();const se=Y.getModel();se&&se.dispose(),J.unobserve(B.current)}}),()=>{window.removeEventListener("keydown",checkPaste),window.removeEventListener("paste",checkPaste)}),[]),(0,L.useEffect)(()=>{xe&&xe.setModel({original:ft.editor.createModel(et,ye),modified:ft.editor.createModel(ze,ye)})},[et,ze,ye,xe]);const R=re(rt),ie=re(Mt),be={width:R,height:ie};return L.createElement("div",{className:"my-diff-editor",ref:B,style:be})}},89402:function(_n,_t,w){"use strict";w.r(_t),w.d(_t,{default:function(){return J}});var L=w(59301),fe=w(58106),Te=w(91882),ue=w(77019),$=w(5269),p=w(25399),ge=w(59944),le=w(11968),l={flex_box_center:"flex_box_center___iOjMJ",flex_space_between:"flex_space_between___aidWN",flex_box_vertical_center:"flex_box_vertical_center___z01Y6",flex_box_center_end:"flex_box_center_end___bizdK",flex_box_column:"flex_box_column___T3eUo",info:"info___PTCcN",bar:"bar___F2ZHD"},x=w(37568),A=w(18287),h=w(28284),m=w(62957),y=w(6767),S=w(37639),F=w(69219),Z=w(97013),W=Object.defineProperty,I=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,D=(se,ee,ne)=>ee in se?W(se,ee,{enumerable:!0,configurable:!0,writable:!0,value:ne}):se[ee]=ne,q=(se,ee)=>{for(var ne in ee||(ee={}))N.call(ee,ne)&&D(se,ne,ee[ne]);if(I)for(var ne of I(ee))T.call(ee,ne)&&D(se,ne,ee[ne]);return se},te=(se,ee,ne)=>new Promise((Ee,Be)=>{var Ce=Ge=>{try{oe(ne.next(Ge))}catch(Ue){Be(Ue)}},De=Ge=>{try{oe(ne.throw(Ge))}catch(Ue){Be(Ue)}},oe=Ge=>Ge.done?Ee(Ge.value):Promise.resolve(Ge.value).then(Ce,De);oe((ne=ne.apply(se,ee)).next())});const{TreeNode:X}=F.default,ce=({restful:se,loading:ee,dispatch:ne})=>{const Ee=(0,fe.useParams)(),Be=(0,fe.useLocation)(),[Ce,De]=(0,L.useState)(!1),[oe,Ge]=(0,L.useState)(),{actionTabs:Ue}=se,[Fe]=h.default.useForm();return(0,L.useEffect)(()=>{se.actionTabs.key=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"&&Fe.resetFields()},[se.actionTabs.key]),se.actionTabs.key!=="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"?null:L.createElement(m.default,{centered:!0,title:"\u65B0\u5EFA\u76EE\u5F55",open:se.actionTabs.key==="\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:Ce,onOk:()=>te(void 0,null,function*(){yield Fe.validateFields();const lt=Fe.getFieldValue();De(!0),(yield(0,Z.ZP)("/api/restfuls.json",{method:"post",body:q({file_type:1},lt)})).status===0&&(y.ZP.success("\u6DFB\u52A0\u6210\u529F"),ne({type:"restful/setActionTabs",payload:{}}),ne({type:"restful/getRestful"})),De(!1)}),onCancel:()=>{ne({type:"restful/setActionTabs",payload:{}})}},L.createElement("div",{className:"pl30 pr30"},L.createElement(h.default,{form:Fe,initialValues:{name:""}},L.createElement(h.default.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},L.createElement(ue.Z,{className:"mt30"},L.createElement($.Z,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),L.createElement($.Z,{flex:"1"},L.createElement(x.default,{placeholder:`\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26
`,maxLength:60})))))))};var we=(0,fe.connect)(({restful:se,loading:ee})=>({restful:se,loading:ee}))(ce),Pe=Object.defineProperty,Ve=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,G=(se,ee,ne)=>ee in se?Pe(se,ee,{enumerable:!0,configurable:!0,writable:!0,value:ne}):se[ee]=ne,H=(se,ee)=>{for(var ne in ee||(ee={}))V.call(ee,ne)&&G(se,ne,ee[ne]);if(Ve)for(var ne of Ve(ee))C.call(ee,ne)&&G(se,ne,ee[ne]);return se},Q=(se,ee,ne)=>new Promise((Ee,Be)=>{var Ce=Ge=>{try{oe(ne.next(Ge))}catch(Ue){Be(Ue)}},De=Ge=>{try{oe(ne.throw(Ge))}catch(Ue){Be(Ue)}},oe=Ge=>Ge.done?Ee(Ge.value):Promise.resolve(Ge.value).then(Ce,De);oe((ne=ne.apply(se,ee)).next())});const{TreeNode:j}=F.default,_=({restful:se,loading:ee,dispatch:ne})=>{const Ee=(0,fe.useParams)(),Be=(0,fe.useLocation)(),[Ce,De]=(0,L.useState)(!1),[oe,Ge]=(0,L.useState)(),{actionTabs:Ue}=se,[Fe]=h.default.useForm();return(0,L.useEffect)(()=>{se.actionTabs.key=="\u91CD\u547D\u540D"&&(Fe.resetFields(),Fe.setFieldsValue({name:se.actionTabs.data.title}))},[se.actionTabs.key]),se.actionTabs.key!=="\u91CD\u547D\u540D"?null:L.createElement(m.default,{centered:!0,title:"\u91CD\u547D\u540D",open:se.actionTabs.key==="\u91CD\u547D\u540D",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",bodyStyle:{minHeight:150},confirmLoading:Ce,onOk:()=>Q(void 0,null,function*(){yield Fe.validateFields();const lt=Fe.getFieldValue();De(!0);let ut=`/api/restfuls/${se.actionTabs.data.id}.json`;(yield(0,Z.ZP)(ut,{method:"put",body:H({file_type:1},lt)})).status===0&&(y.ZP.success("\u4FEE\u6539\u6210\u529F"),ne({type:"restful/setActionTabs",payload:{}}),ne({type:"restful/getRestful"})),De(!1)}),onCancel:()=>{ne({type:"restful/setActionTabs",payload:{}})}},L.createElement("div",{className:"pl30 pr30"},L.createElement(h.default,{form:Fe,initialValues:{name:""}},L.createElement(ue.Z,{className:"mt30"},L.createElement($.Z,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),L.createElement($.Z,{flex:"1"},L.createElement(h.default.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u65B0\u540D\u79F0"}]},L.createElement(x.default,{placeholder:`\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26
`,maxLength:60})))))))};var v=(0,fe.connect)(({restful:se,loading:ee})=>({restful:se,loading:ee}))(_),P=w(30241),re={flex_box_center:"flex_box_center___EW6x1",flex_space_between:"flex_space_between___aSZFN",flex_box_vertical_center:"flex_box_vertical_center___MsqeW",flex_box_center_end:"flex_box_center_end___YMP0b",flex_box_column:"flex_box_column___KXrxt",tree:"tree___Zx4EL",actions:"actions___zwp8u"},Oe=Object.defineProperty,Ze=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,qe=Object.getOwnPropertySymbols,ft=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable,Ae=(se,ee,ne)=>ee in se?Oe(se,ee,{enumerable:!0,configurable:!0,writable:!0,value:ne}):se[ee]=ne,wt=(se,ee)=>{for(var ne in ee||(ee={}))ft.call(ee,ne)&&Ae(se,ne,ee[ne]);if(qe)for(var ne of qe(ee))vt.call(ee,ne)&&Ae(se,ne,ee[ne]);return se},rt=(se,ee)=>Ze(se,Ye(ee)),Mt=(se,ee,ne)=>new Promise((Ee,Be)=>{var Ce=Ge=>{try{oe(ne.next(Ge))}catch(Ue){Be(Ue)}},De=Ge=>{try{oe(ne.throw(Ge))}catch(Ue){Be(Ue)}},oe=Ge=>Ge.done?Ee(Ge.value):Promise.resolve(Ge.value).then(Ce,De);oe((ne=ne.apply(se,ee)).next())});const{Search:et}=x.default,{DirectoryTree:ze}=A.default,ye=({user:se,globalSetting:ee,loading:ne,dispatch:Ee,restful:Be})=>{const Ce=(0,fe.useParams)(),[De,oe]=(0,L.useState)(!0),[Ge]=h.default.useForm(),[Ue,Fe]=(0,L.useState)(""),[lt]=(0,L.useState)([{id:1,name:"\u65B0\u5EFA\u6587\u4EF6"},{id:2,name:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"},{id:3,name:"\u91CD\u547D\u540D"},{id:4,name:"\u7F16\u8F91"},{id:5,name:"\u5220\u9664"}]),[ut,it]=(0,L.useState)([]),[Ct,zt]=(0,L.useState)([]),[ct,Ut]=(0,L.useState)(!1),[Ne,Se]=(0,L.useState)([]);(0,L.useEffect)(()=>{var je,tt,yt,It;if((je=Be.restful)!=null&&je.data){Se([...(tt=Be.restful)==null?void 0:tt.data]);let qt=0,gn;if((It=(yt=Be.restful)==null?void 0:yt.data)==null||It.map(en=>{var nn;en.id==Ce.id&&(qt=en.id),en.file_type==0&&!gn&&(gn=en.id),(nn=en==null?void 0:en.children)==null||nn.map(wn=>{gn||(gn=wn.id),wn.id==Ce.id&&(qt=en.id)}),!en.children&&!gn&&(gn=en.id)}),!Ce.id&&gn){fe.history.push(`/ch/rest/${gn}`);return}qt&&setTimeout(()=>{it([qt]),zt([Number(Ce.id||gn)])},200)}},[Be.restful]);const Ie=(je,tt)=>{tt.node.file_type===0?fe.history.push(`/ch/rest/${je[0]}`):zt([...je]),console.log("Trigger Select",je,tt)},U=je=>{it(je),console.log("Trigger Expand",je)},z=je=>L.createElement("div",null,lt.map((tt,yt)=>L.createElement("p",{key:tt.id,className:"current",onClick:()=>{switch(tt.id){case 1:fe.history.push(`/ch/rest/edit/${je.id}/0`);break;case 2:case 3:Ee({type:"restful/setActionTabs",payload:{key:tt.name,data:je}});break;case 4:document.location.href=`/ch/rest/edit/${je.pid||0}/${je.id}`;break;case 5:m.default.confirm({title:"\u63D0\u793A",content:"\u662F\u5426\u786E\u5B9A\u5220\u9664\uFF1F",onOk:()=>Mt(void 0,null,function*(){const It=yield(0,P.E1)({id:je.id});(It==null?void 0:It.status)==0&&(y.ZP.success("\u5220\u9664\u6210\u529F"),Ee({type:"restful/getRestful"}))})});break}}},tt.name)).filter(tt=>!!tt).filter(tt=>je.pid||je.file_type==0?tt.key>3:tt.key!=4)),pe=je=>je.map(tt=>{var yt;const It=tt.title.indexOf(Ue),qt=tt.title.substr(0,It),gn=tt.title.substr(It+Ue.length),en=L.createElement("span",null,qt,L.createElement("span",{className:"c-blue"},Ue),gn,(0,le.ag)()&&L.createElement(S.Z,{placement:"right",title:Ue,content:()=>z(tt),trigger:"hover"},L.createElement("span",{className:`iconfont icon-sandian ${re.actions}`})));return Ue!==""&&It===-1&&!((yt=tt.children)!=null&&yt.length)?null:tt.children&&tt.file_type===1?rt(wt({},tt),{title:en,key:tt.key,children:pe(tt.children)}):rt(wt({},tt),{title:en,key:tt.key,isLeaf:!0})}).filter(tt=>!!tt),de=(je,tt)=>{let yt;for(let It=0;It<tt.length;It++){const qt=tt[It];qt.children&&(qt.children.some(gn=>gn.key===je)?yt=qt.key:de(je,qt.children)&&(yt=de(je,qt.children)))}return yt},ve=je=>{const{value:tt}=je.target,yt=Ne.map(It=>{var qt;return It!=null&&It.children&&(qt=It==null?void 0:It.children.filter(gn=>gn.title.indexOf(tt)>-1))!=null&&qt.length?It.id:null});Fe(tt),Ut(!0),console.log("expandedKeys:",yt),it(yt)};return console.log("loop(treeData):",pe(Ne)),L.createElement("div",{className:re.tree},L.createElement(et,{style:{marginBottom:8},placeholder:"\u8F93\u5165\u5173\u952E\u5B57\u68C0\u7D22",onChange:ve}),L.createElement(ze,{multiple:!0,defaultExpandAll:!0,onSelect:Ie,onExpand:U,expandedKeys:ut,selectedKeys:Ct,autoExpandParent:ct,treeData:pe(Ne)}),L.createElement(we,null),L.createElement(v,null))};var me=(0,fe.connect)(({user:se,loading:ee,globalSetting:ne,restful:Ee})=>({user:se,globalSetting:ne,restful:Ee,loading:ee.models.index}))(ye),B=Object.defineProperty,xe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,R=(se,ee,ne)=>ee in se?B(se,ee,{enumerable:!0,configurable:!0,writable:!0,value:ne}):se[ee]=ne,ie=(se,ee)=>{for(var ne in ee||(ee={}))Le.call(ee,ne)&&R(se,ne,ee[ne]);if(xe)for(var ne of xe(ee))K.call(ee,ne)&&R(se,ne,ee[ne]);return se},be=(se,ee)=>{var ne={};for(var Ee in se)Le.call(se,Ee)&&ee.indexOf(Ee)<0&&(ne[Ee]=se[Ee]);if(se!=null&&xe)for(var Ee of xe(se))ee.indexOf(Ee)<0&&K.call(se,Ee)&&(ne[Ee]=se[Ee]);return ne},k=(se,ee,ne)=>new Promise((Ee,Be)=>{var Ce=Ge=>{try{oe(ne.next(Ge))}catch(Ue){Be(Ue)}},De=Ge=>{try{oe(ne.throw(Ge))}catch(Ue){Be(Ue)}},oe=Ge=>Ge.done?Ee(Ge.value):Promise.resolve(Ge.value).then(Ce,De);oe((ne=ne.apply(se,ee)).next())});const Y=se=>{var ee=se,{user:ne,globalSetting:Ee,loading:Be,dispatch:Ce,restful:De}=ee,oe=be(ee,["user","globalSetting","loading","dispatch","restful"]),Ge,Ue;const Fe=(0,fe.useParams)(),[lt,ut]=(0,L.useState)(!0),it=()=>k(void 0,null,function*(){Ce({type:"restful/getRestful"}),Fe.id&&Ce({type:"restful/getRestfulDetail",payload:ie({},Fe)})});(0,L.useEffect)(()=>{ut(!0),it()},[Fe.id]);const Ct=()=>{Ce({type:"restful/setActionTabs",payload:{key:"\u65B0\u5EFA\u540C\u7EA7\u76EE\u5F55"}})},zt=()=>{var ct,Ut,Ne;if((ct=De.restful)!=null&&ct.data){let Se=0;return(Ne=(Ut=De.restful)==null?void 0:Ut.data)==null||Ne.map(Ie=>{var U;(U=Ie==null?void 0:Ie.children)==null||U.map(z=>{z.id==Fe.id&&(Se=Ie.id)}),!Ie.children&&!Se&&(Se=Ie.id)}),Se}return 0};return L.createElement("section",null,L.createElement("aside",{className:"edu-container mt20"},L.createElement(Te.Z,null,L.createElement(Te.Z.Item,null,L.createElement(fe.Link,{to:"/"},"\u9996\u9875")),L.createElement(Te.Z.Item,null,L.createElement(fe.Link,{to:"/ch/rest"},"API\u6587\u6863"))),L.createElement("div",{className:"mt20"},L.createElement(ue.Z,{gutter:[20,20]},L.createElement($.Z,{flex:"300px"},L.createElement(me,ie({},oe))),L.createElement($.Z,{flex:"1"},L.createElement("div",{className:l.info},L.createElement("h1",{style:{fontSize:28,paddingBottom:15,borderBottom:"1px solid #eaeaea",textAlign:"center"}},(Ge=De.restfulDetail)==null?void 0:Ge.name),L.createElement(ge.Z,{value:(Ue=De.restfulDetail)==null?void 0:Ue.description}))))),(0,le.ag)()&&L.createElement("div",{className:l.bar},L.createElement(ue.Z,null,!!zt()&&L.createElement($.Z,null,L.createElement(p.Z,{title:"\u7F16\u8F91\u6587\u4EF6"},L.createElement(fe.Link,{to:`/ch/rest/edit/${zt()}/${Fe.id}`,className:"icon-zhongmingming current"}))),L.createElement($.Z,null,L.createElement(p.Z,{title:"\u6DFB\u52A0\u6587\u4EF6"},L.createElement(fe.Link,{to:`/ch/rest/edit/${zt()}/0`,className:"icon-tianjiatimu current"}))),L.createElement($.Z,null,L.createElement(p.Z,{title:"\u65B0\u5EFA\u6587\u4EF6\u5939"},L.createElement("span",{className:"icon-wenjianjia1 current",onClick:Ct})))))))};var J=(0,fe.connect)(({user:se,loading:ee,globalSetting:ne,restful:Ee})=>({user:se,globalSetting:ne,restful:Ee,loading:ee.models.index}))(Y)},58489:function(_n,_t,w){"use strict";w.d(_t,{AL:function(){return T},Iy:function(){return A},Qv:function(){return y},ez:function(){return N},jb:function(){return h}});var L=w(32834),fe=w.n(L),Te=w(11690),ue=w.n(Te);let $=1;function p(ce,we){const Pe=ce.match(/^(\s+)(?:```)/);if(Pe===null)return we;const Ve=Pe[1];return we.split(`
`).map(V=>{const C=V.match(/^\s+/);if(C===null)return V;const[G]=C;return G.length>=Ve.length?V.slice(Ve.length):V}).join(`
`)}let ge=[],le=["<ul>"];const l=new(fe()).Renderer,x=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function A(){ge.length=0,le=["<ul>"]}const h={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(ce,we,Pe,Ve){if(we>=ce.length||ce[we].level<=Pe)return we;var V=ce[we];Ve.push("<li><a href='#"+$+V.anchor+"'>"+V.text+"</a>"),we++;var C=[];return we=m(ce,we,V.level,C),C.length>0&&(Ve.push("<ul>"),C.forEach(function(G){Ve.push(G)}),Ve.push("</ul>")),Ve.push("</li>"),we=m(ce,we,Pe,Ve),we}function y(){return m(ge,0,0,le),le.push("</ul>"),le.join("")}const S={heading(ce){const we=x.exec(ce);if($+=1,we)return{type:"heading",raw:we[0],depth:we[1].length,text:we[2]}},fences(ce){const we=this.rules.block.fences.exec(ce);if(we){const Pe=we[0];let Ve=p(Pe,we[3]||"");const V=we[2]?we[2].trim():we[2];if(["latex","katex","math"].indexOf(V)>=0){const C=W(),G=Ve;Ve=C,I[C]={type:"block",expression:G}}return{type:"code",raw:Pe,lang:V,text:Ve}}}},F=/(?:\${2})([^\n`]+?)(?:\${2})/gi;let Z=0;const W=()=>`__special_katext_id_${Z++}__`;let I={};function N(){return I}function T(){Z=0,I={}}function D(ce){return ce=ce.replace(F,(we,Pe)=>{const Ve=W();return I[Ve]={type:"inline",expression:Pe},Ve}),ce}const q=l.listitem;l.listitem=function(ce){return q(D(ce))};const te=l.paragraph;l.paragraph=function(ce){return te(D(ce))};const X=l.tablecell;l.tablecell=function(ce,we){return X(D(ce),we)},l.code=function(ce,we,Pe){const Ve=(we||"").match(/\S*/)[0];return Ve?["latex","katex","math"].indexOf(Ve)>=0?`<p class='editormd-tex'>${ce}</p>`:`<pre class="prettyprint linenums"><code class="language-${we}">${Pe?ce:(0,Te.escape)(ce,!0)}</code></pre>
`:'<pre class="prettyprint linenums"><code>'+(Pe?ce:(0,Te.escape)(ce,!0))+"</code></pre>"},l.heading=function(ce,we,Pe){let Ve=this.options.headerPrefix+Pe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return ge.push({anchor:Ve,level:we,text:ce}),"<h"+we+' id="'+$+Ve+'">'+ce+"</h"+we+">"},fe().setOptions({silent:!0,gfm:!0,pedantic:!1}),fe().use({tokenizer:S,renderer:l}),_t.ZP=fe()},64018:function(){var _n,_t,w,L=!1,fe,Te;window.PR_SHOULD_USE_CONTINUATION=!0;var ue,$;(function(){var p=window,ge=["break,continue,do,else,for,if,return,while"],le=[ge,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],l=[le,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],x=[l,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],A=[l,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],h=[l,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],m="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",y=[l,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],S="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",F=[ge,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],Z=[ge,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[ge,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],I=[x,h,A,y,S,F,Z,W],N=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,T="str",D="kwd",q="com",te="typ",X="lit",ce="pun",we="pln",Pe="tag",Ve="dec",V="src",C="atn",G="atv",H="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(me){for(var B=0,xe=!1,Le=!1,K=0,R=me.length;K<R;++K){var ie=me[K];if(ie.ignoreCase)Le=!0;else if(/[a-z]/i.test(ie.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){xe=!0,Le=!1;break}}var be={b:8,t:9,n:10,v:11,f:12,r:13};function k(ne){var Ee=ne.charCodeAt(0);if(Ee!==92)return Ee;var Be=ne.charAt(1);return Ee=be[Be],Ee||("0"<=Be&&Be<="7"?parseInt(ne.substring(1),8):Be==="u"||Be==="x"?parseInt(ne.substring(2),16):ne.charCodeAt(1))}function Y(ne){if(ne<32)return(ne<16?"\\x0":"\\x")+ne.toString(16);var Ee=String.fromCharCode(ne);return Ee==="\\"||Ee==="-"||Ee==="]"||Ee==="^"?"\\"+Ee:Ee}function J(ne){var Ee=ne.substring(1,ne.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Be=[],Ce=Ee[0]==="^",De=["["];Ce&&De.push("^");for(var oe=Ce?1:0,Ge=Ee.length;oe<Ge;++oe){var Ue=Ee[oe];if(/\\[bdsw]/i.test(Ue))De.push(Ue);else{var Fe=k(Ue),lt;oe+2<Ge&&Ee[oe+1]==="-"?(lt=k(Ee[oe+2]),oe+=2):lt=Fe,Be.push([Fe,lt]),lt<65||Fe>122||(lt<65||Fe>90||Be.push([Math.max(65,Fe)|32,Math.min(lt,90)|32]),lt<97||Fe>122||Be.push([Math.max(97,Fe)&-33,Math.min(lt,122)&-33]))}}Be.sort(function(zt,ct){return zt[0]-ct[0]||ct[1]-zt[1]});for(var ut=[],it=[],oe=0;oe<Be.length;++oe){var Ct=Be[oe];Ct[0]<=it[1]+1?it[1]=Math.max(it[1],Ct[1]):ut.push(it=Ct)}for(var oe=0;oe<ut.length;++oe){var Ct=ut[oe];De.push(Y(Ct[0])),Ct[1]>Ct[0]&&(Ct[1]+1>Ct[0]&&De.push("-"),De.push(Y(Ct[1])))}return De.push("]"),De.join("")}function se(ne){for(var Ee=ne.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Be=Ee.length,Ce=[],De=0,oe=0;De<Be;++De){var Ge=Ee[De];if(Ge==="(")++oe;else if(Ge.charAt(0)==="\\"){var Ue=+Ge.substring(1);Ue&&(Ue<=oe?Ce[Ue]=-1:Ee[De]=Y(Ue))}}for(var De=1;De<Ce.length;++De)Ce[De]===-1&&(Ce[De]=++B);for(var De=0,oe=0;De<Be;++De){var Ge=Ee[De];if(Ge==="(")++oe,Ce[oe]||(Ee[De]="(?:");else if(Ge.charAt(0)==="\\"){var Ue=+Ge.substring(1);Ue&&Ue<=oe&&(Ee[De]="\\"+Ce[Ue])}}for(var De=0;De<Be;++De)Ee[De]==="^"&&Ee[De+1]!=="^"&&(Ee[De]="");if(ne.ignoreCase&&xe)for(var De=0;De<Be;++De){var Ge=Ee[De],Fe=Ge.charAt(0);Ge.length>=2&&Fe==="["?Ee[De]=J(Ge):Fe!=="\\"&&(Ee[De]=Ge.replace(/[a-zA-Z]/g,function(it){var Ct=it.charCodeAt(0);return"["+String.fromCharCode(Ct&-33,Ct|32)+"]"}))}return Ee.join("")}for(var ee=[],K=0,R=me.length;K<R;++K){var ie=me[K];if(ie.global||ie.multiline)throw new Error(""+ie);ee.push("(?:"+se(ie)+")")}return new RegExp(ee.join("|"),Le?"gi":"g")}function _(me,B){var xe=/(?:^|\s)nocode(?:\s|$)/,Le=[],K=0,R=[],ie=0;function be(k){var Y=k.nodeType;if(Y==1){if(xe.test(k.className))return;for(var J=k.firstChild;J;J=J.nextSibling)be(J);var se=k.nodeName.toLowerCase();(se==="br"||se==="li")&&(Le[ie]=`
`,R[ie<<1]=K++,R[ie++<<1|1]=k)}else if(Y==3||Y==4){var ee=k.nodeValue;ee.length&&(B?ee=ee.replace(/\r\n?/g,`
`):ee=ee.replace(/[ \t\r\n]+/g," "),Le[ie]=ee,R[ie<<1]=K,K+=ee.length,R[ie++<<1|1]=k)}}return be(me),{sourceCode:Le.join("").replace(/\n$/,""),spans:R}}function v(me,B,xe,Le,K){if(xe){var R={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:xe,spans:null,basePos:B,decorations:null};Le(R),K.push.apply(K,R.decorations)}}var P=/\S/;function re(me){for(var B=void 0,xe=me.firstChild;xe;xe=xe.nextSibling){var Le=xe.nodeType;B=Le===1?B?me:xe:Le===3&&P.test(xe.nodeValue)?me:B}return B===me?void 0:B}function Oe(me,B){var xe={},Le;(function(){for(var ie=me.concat(B),be=[],k={},Y=0,J=ie.length;Y<J;++Y){var se=ie[Y],ee=se[3];if(ee)for(var ne=ee.length;--ne>=0;)xe[ee.charAt(ne)]=se;var Ee=se[1],Be=""+Ee;k.hasOwnProperty(Be)||(be.push(Ee),k[Be]=null)}be.push(/[\0-\uffff]/),Le=j(be)})();var K=B.length,R=function(ie){for(var be=ie.sourceCode,k=ie.basePos,Y=ie.sourceNode,J=[k,we],se=0,ee=be.match(Le)||[],ne={},Ee=0,Be=ee.length;Ee<Be;++Ee){var Ce=ee[Ee],De=ne[Ce],oe=void 0,Ge;if(typeof De=="string")Ge=!1;else{var Ue=xe[Ce.charAt(0)];if(Ue)oe=Ce.match(Ue[1]),De=Ue[0];else{for(var Fe=0;Fe<K;++Fe)if(Ue=B[Fe],oe=Ce.match(Ue[1]),oe){De=Ue[0];break}oe||(De=we)}Ge=De.length>=5&&De.substring(0,5)==="lang-",Ge&&!(oe&&typeof oe[1]=="string")&&(Ge=!1,De=V),Ge||(ne[Ce]=De)}var lt=se;if(se+=Ce.length,!Ge)J.push(k+lt,De);else{var ut=oe[1],it=Ce.indexOf(ut),Ct=it+ut.length;oe[2]&&(Ct=Ce.length-oe[2].length,it=Ct-ut.length);var zt=De.substring(5);v(Y,k+lt,Ce.substring(0,it),R,J),v(Y,k+lt+it,ut,wt(zt,ut),J),v(Y,k+lt+Ct,Ce.substring(Ct),R,J)}}ie.decorations=J};return R}function Ze(me){var B=[],xe=[];me.tripleQuotedStrings?B.push([T,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?B.push([T,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):B.push([T,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&xe.push([T,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Le=me.hashComments;Le&&(me.cStyleComments?(Le>1?B.push([q,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):B.push([q,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),xe.push([T,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):B.push([q,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(xe.push([q,/^\/\/[^\r\n]*/,null]),xe.push([q,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var K=me.regexLiterals;if(K){var R=K>1?"":`
\r`,ie=R?".":"[\\S\\s]",be="/(?=[^/*"+R+"])(?:[^/\\x5B\\x5C"+R+"]|\\x5C"+ie+"|\\x5B(?:[^\\x5C\\x5D"+R+"]|\\x5C"+ie+")*(?:\\x5D|$))+/";xe.push(["lang-regex",RegExp("^"+Q+"("+be+")")])}var k=me.types;k&&xe.push([te,k]);var Y=(""+me.keywords).replace(/^ | $/g,"");Y.length&&xe.push([D,new RegExp("^(?:"+Y.replace(/[\s,]+/g,"|")+")\\b"),null]),B.push([we,/^\s+/,null,` \r
\xA0`]);var J="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(J+="(?!s*/)"),xe.push([X,/^@[a-z_$][a-z_$@0-9]*/i,null],[te,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[we,/^[a-z_$][a-z_$@0-9]*/i,null],[X,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[we,/^\\[\s\S]?/,null],[ce,new RegExp(J),null]),Oe(B,xe)}var Ye=Ze({keywords:I,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function qe(me,B,xe){for(var Le=/(?:^|\s)nocode(?:\s|$)/,K=/\r\n?|\n/,R=me.ownerDocument,ie=R.createElement("li");me.firstChild;)ie.appendChild(me.firstChild);var be=[ie];function k(Ee){var Be=Ee.nodeType;if(Be==1&&!Le.test(Ee.className))if(Ee.nodeName==="br")Y(Ee),Ee.parentNode&&Ee.parentNode.removeChild(Ee);else for(var Ce=Ee.firstChild;Ce;Ce=Ce.nextSibling)k(Ce);else if((Be==3||Be==4)&&xe){var De=Ee.nodeValue,oe=De.match(K);if(oe){var Ge=De.substring(0,oe.index);Ee.nodeValue=Ge;var Ue=De.substring(oe.index+oe[0].length);if(Ue){var Fe=Ee.parentNode;Fe.insertBefore(R.createTextNode(Ue),Ee.nextSibling)}Y(Ee),Ge||Ee.parentNode.removeChild(Ee)}}}function Y(Ee){for(;!Ee.nextSibling;)if(Ee=Ee.parentNode,!Ee)return;function Be(oe,Ge){var Ue=Ge?oe.cloneNode(!1):oe,Fe=oe.parentNode;if(Fe){var lt=Be(Fe,1),ut=oe.nextSibling;lt.appendChild(Ue);for(var it=ut;it;it=ut)ut=it.nextSibling,lt.appendChild(it)}return Ue}for(var Ce=Be(Ee.nextSibling,0),De;(De=Ce.parentNode)&&De.nodeType===1;)Ce=De;be.push(Ce)}for(var J=0;J<be.length;++J)k(be[J]);B===(B|0)&&be[0].setAttribute("value",B);var se=R.createElement("ol");se.className="linenums";for(var ee=Math.max(0,B-1|0)||0,J=0,ne=be.length;J<ne;++J)ie=be[J],ie.className="L"+(J+ee)%10,ie.firstChild||ie.appendChild(R.createTextNode("\xA0")),se.appendChild(ie);me.appendChild(se)}function ft(me){var B=/\bMSIE\s(\d+)/.exec(navigator.userAgent);B=B&&+B[1]<=8;var xe=/\n/g,Le=me.sourceCode,K=Le.length,R=0,ie=me.spans,be=ie.length,k=0,Y=me.decorations,J=Y.length,se=0;Y[J]=K;var ee,ne;for(ne=ee=0;ne<J;)Y[ne]!==Y[ne+2]?(Y[ee++]=Y[ne++],Y[ee++]=Y[ne++]):ne+=2;for(J=ee,ne=ee=0;ne<J;){for(var Ee=Y[ne],Be=Y[ne+1],Ce=ne+2;Ce+2<=J&&Y[Ce+1]===Be;)Ce+=2;Y[ee++]=Ee,Y[ee++]=Be,ne=Ce}J=Y.length=ee;var De=me.sourceNode,oe="";De&&(oe=De.style.display,De.style.display="none");try{for(var Ge=null;k<be;){var Ue=ie[k],Fe=ie[k+2]||K,lt=Y[se+2]||K,Ce=Math.min(Fe,lt),ut=ie[k+1],it;if(ut.nodeType!==1&&(it=Le.substring(R,Ce))){B&&(it=it.replace(xe,"\r")),ut.nodeValue=it;var Ct=ut.ownerDocument,zt=Ct.createElement("span");zt.className=Y[se+1];var ct=ut.parentNode;ct.replaceChild(zt,ut),zt.appendChild(ut),R<Fe&&(ie[k+1]=ut=Ct.createTextNode(Le.substring(Ce,Fe)),ct.insertBefore(ut,zt.nextSibling))}R=Ce,R>=Fe&&(k+=2),R>=lt&&(se+=2)}}finally{De&&(De.style.display=oe)}}var vt={};function Ae(me,B){for(var xe=B.length;--xe>=0;){var Le=B[xe];vt.hasOwnProperty(Le)?p.console&&console.warn("cannot override language handler %s",Le):vt[Le]=me}}function wt(me,B){return me&&vt.hasOwnProperty(me)||(me=/^\s*</.test(B)?"default-markup":"default-code"),vt[me]}Ae(Ye,["default-code"]),Ae(Oe([],[[we,/^[^<?]+/],[Ve,/^<!\w[^>]*(?:>|$)/],[q,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[ce,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),Ae(Oe([[we,/^[\s]+/,null,` \r
`],[G,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[Pe,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[C,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[ce,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),Ae(Oe([],[[G,/^[\s\S]+/]]),["uq.val"]),Ae(Ze({keywords:x,hashComments:!0,cStyleComments:!0,types:N}),["c","cc","cpp","cxx","cyc","m"]),Ae(Ze({keywords:"null,true,false"}),["json"]),Ae(Ze({keywords:h,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:N}),["cs"]),Ae(Ze({keywords:A,cStyleComments:!0}),["java"]),Ae(Ze({keywords:W,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),Ae(Ze({keywords:F,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),Ae(Ze({keywords:S,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),Ae(Ze({keywords:Z,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),Ae(Ze({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),Ae(Ze({keywords:m,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),Ae(Oe([],[[T,/^[\s\S]+/]]),["regex"]);function rt(me){var B=me.langExtension;try{var xe=_(me.sourceNode,me.pre),Le=xe.sourceCode;me.sourceCode=Le,me.spans=xe.spans,me.basePos=0,wt(B,Le)(me),ft(me)}catch(K){p.console&&console.log(K&&K.stack||K)}}function Mt(me,B,xe){var Le=xe||!1,K=B||null,R=document.createElement("div");R.innerHTML="<pre>"+me+"</pre>",R=R.firstChild,Le&&qe(R,Le,!0);var ie={langExtension:K,numberLines:Le,sourceNode:R,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return rt(ie),R.innerHTML}function et(me,B){var xe=B||document.body,Le=xe.ownerDocument||document;function K(Ue){return xe.getElementsByTagName(Ue)}for(var R=[K("pre"),K("code"),K("xmp")],ie=[],be=0;be<R.length;++be)for(var k=0,Y=R[be].length;k<Y;++k)ie.push(R[be][k]);R=null;var J=Date;J.now||(J={now:function(){return+new Date}});var se=0,ee=/\blang(?:uage)?-([\w.]+)(?!\S)/,ne=/\bprettyprint\b/,Ee=/\bprettyprinted\b/,Be=/pre|xmp/i,Ce=/^code$/i,De=/^(?:pre|code|xmp)$/i,oe={};function Ge(){for(var Ue=p.PR_SHOULD_USE_CONTINUATION?J.now()+250:1/0;se<ie.length&&J.now()<Ue;se++){for(var Fe=ie[se],lt=oe,ut=Fe;ut=ut.previousSibling;){var it=ut.nodeType,Ct=(it===7||it===8)&&ut.nodeValue;if(Ct?!/^\??prettify\b/.test(Ct):it!==3||/\S/.test(ut.nodeValue))break;if(Ct){lt={},Ct.replace(/\b(\w+)=([\w:.%+-]+)/g,function(tt,yt,It){lt[yt]=It});break}}var zt=Fe.className;if((lt!==oe||ne.test(zt))&&!Ee.test(zt)){for(var ct=!1,Ut=Fe.parentNode;Ut;Ut=Ut.parentNode){var Ne=Ut.tagName;if(De.test(Ne)&&Ut.className&&ne.test(Ut.className)){ct=!0;break}}if(!ct){Fe.className+=" prettyprinted";var Se=lt.lang;if(!Se){Se=zt.match(ee);var Ie;!Se&&(Ie=re(Fe))&&Ce.test(Ie.tagName)&&(Se=Ie.className.match(ee)),Se&&(Se=Se[1])}var U;if(Be.test(Fe.tagName))U=1;else{var z=Fe.currentStyle,pe=Le.defaultView,de=z?z.whiteSpace:pe&&pe.getComputedStyle?pe.getComputedStyle(Fe,null).getPropertyValue("white-space"):0;U=de&&de.substring(0,3)==="pre"}var ve=lt.linenums;(ve=ve==="true"||+ve)||(ve=zt.match(/\blinenums\b(?::(\d+))?/),ve=ve?ve[1]&&ve[1].length?+ve[1]:!0:!1),ve&&qe(Fe,ve,U);var je={langExtension:Se,sourceNode:Fe,numberLines:ve,pre:U,sourceCode:null,basePos:null,spans:null,decorations:null};rt(je)}}}se<ie.length?p.setTimeout(Ge,250):typeof me=="function"&&me()}Ge()}var ze=p.PR={createSimpleLexer:Oe,registerLangHandler:Ae,sourceDecorator:Ze,PR_ATTRIB_NAME:C,PR_ATTRIB_VALUE:G,PR_COMMENT:q,PR_DECLARATION:Ve,PR_KEYWORD:D,PR_LITERAL:X,PR_NOCODE:H,PR_PLAIN:we,PR_PUNCTUATION:ce,PR_SOURCE:V,PR_STRING:T,PR_TAG:Pe,PR_TYPE:te,prettyPrintOne:L?p.prettyPrintOne=Mt:ue=Mt,prettyPrint:$=L?p.prettyPrint=et:$=et},ye=p.define;typeof ye=="function"&&ye.amd&&ye("google-code-prettify",[],function(){return ze})})()},25769:function(_n,_t,w){"use strict";var L=w(98040),fe={"text/plain":"Text","text/html":"Url",default:"Text"},Te="Copy to clipboard: #{key}, Enter";function ue(p){var ge=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return p.replace(/#{\s*key\s*}/g,ge)}function $(p,ge){var le,l,x,A,h,m,y=!1;ge||(ge={}),le=ge.debug||!1;try{x=L(),A=document.createRange(),h=document.getSelection(),m=document.createElement("span"),m.textContent=p,m.ariaHidden="true",m.style.all="unset",m.style.position="fixed",m.style.top=0,m.style.clip="rect(0, 0, 0, 0)",m.style.whiteSpace="pre",m.style.webkitUserSelect="text",m.style.MozUserSelect="text",m.style.msUserSelect="text",m.style.userSelect="text",m.addEventListener("copy",function(F){if(F.stopPropagation(),ge.format)if(F.preventDefault(),typeof F.clipboardData=="undefined"){le&&console.warn("unable to use e.clipboardData"),le&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var Z=fe[ge.format]||fe.default;window.clipboardData.setData(Z,p)}else F.clipboardData.clearData(),F.clipboardData.setData(ge.format,p);ge.onCopy&&(F.preventDefault(),ge.onCopy(F.clipboardData))}),document.body.appendChild(m),A.selectNodeContents(m),h.addRange(A);var S=document.execCommand("copy");if(!S)throw new Error("copy command was unsuccessful");y=!0}catch(F){le&&console.error("unable to copy using execCommand: ",F),le&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(ge.format||"text",p),ge.onCopy&&ge.onCopy(window.clipboardData),y=!0}catch(Z){le&&console.error("unable to copy using clipboardData: ",Z),le&&console.error("falling back to prompt"),l=ue("message"in ge?ge.message:Te),window.prompt(l,p)}}finally{h&&(typeof h.removeRange=="function"?h.removeRange(A):h.removeAllRanges()),m&&document.body.removeChild(m),x()}return y}_n.exports=$},53184:function(_n,_t,w){"use strict";var L,fe;function Te(ue,$,p){var ge=function(le,l){return ue.js_beautify(le,l)};return ge.js=ue.js_beautify,ge.css=$.css_beautify,ge.html=p.html_beautify,ge.js_beautify=ue.js_beautify,ge.css_beautify=$.css_beautify,ge.html_beautify=p.html_beautify,ge}L=[w(58553),w(87804),w(40998)],fe=function(ue,$,p){return Te(ue,$,p)}.apply(_t,L),fe!==void 0&&(_n.exports=fe)},87804:function(_n,_t){var w,L;(function(){var fe;(function(){"use strict";var ue=[,,function(le){function l(h){this.__parent=h,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 h=new l(this.__parent);return h.set_indent(this.__indent_count,this.__alignment_count),h},l.prototype.item=function(h){return h<0?this.__items[this.__items.length+h]:this.__items[h]},l.prototype.has_match=function(h){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(h))return!0;return!1},l.prototype.set_indent=function(h,m){this.is_empty()&&(this.__indent_count=h||0,this.__alignment_count=m||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 h=this.__parent.current_line;return h.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),h.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),h.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,h.__items[0]===" "&&(h.__items.splice(0,1),h.__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(h){this.__items.push(h);var m=h.lastIndexOf(`
`);m!==-1?this.__character_count=h.length-m:this.__character_count+=h.length},l.prototype.pop=function(){var h=null;return this.is_empty()||(h=this.__items.pop(),this.__character_count-=h.length),h},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 h="";return this.is_empty()?this.__parent.indent_empty_lines&&(h=this.__parent.get_indent_string(this.__indent_count)):(h=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),h+=this.__items.join("")),h};function x(h,m){this.__cache=[""],this.__indent_size=h.indent_size,this.__indent_string=h.indent_char,h.indent_with_tabs||(this.__indent_string=new Array(h.indent_size+1).join(h.indent_char)),m=m||"",h.indent_level>0&&(m=new Array(h.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}x.prototype.get_indent_size=function(h,m){var y=this.__base_string_length;return m=m||0,h<0&&(y=0),y+=h*this.__indent_size,y+=m,y},x.prototype.get_indent_string=function(h,m){var y=this.__base_string;return m=m||0,h<0&&(h=0,y=""),m+=h*this.__indent_size,this.__ensure_cache(m),y+=this.__cache[m],y},x.prototype.__ensure_cache=function(h){for(;h>=this.__cache.length;)this.__add_column()},x.prototype.__add_column=function(){var h=this.__cache.length,m=0,y="";this.__indent_size&&h>=this.__indent_size&&(m=Math.floor(h/this.__indent_size),h-=m*this.__indent_size,y=new Array(m+1).join(this.__indent_string)),h&&(y+=new Array(h+1).join(" ")),this.__cache.push(y)};function A(h,m){this.__indent_cache=new x(h,m),this.raw=!1,this._end_with_newline=h.end_with_newline,this.indent_size=h.indent_size,this.wrap_line_length=h.wrap_line_length,this.indent_empty_lines=h.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()}A.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},A.prototype.get_line_number=function(){return this.__lines.length},A.prototype.get_indent_string=function(h,m){return this.__indent_cache.get_indent_string(h,m)},A.prototype.get_indent_size=function(h,m){return this.__indent_cache.get_indent_size(h,m)},A.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},A.prototype.add_new_line=function(h){return this.is_empty()||!h&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},A.prototype.get_code=function(h){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var y=this.__lines.join(`
`);return h!==`
`&&(y=y.replace(/[\n]/g,h)),y},A.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},A.prototype.set_indent=function(h,m){return h=h||0,m=m||0,this.next_line.set_indent(h,m),this.__lines.length>1?(this.current_line.set_indent(h,m),!0):(this.current_line.set_indent(),!1)},A.prototype.add_raw_token=function(h){for(var m=0;m<h.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(h.whitespace_before),this.current_line.push(h.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},A.prototype.add_token=function(h){this.__add_space_before_token(),this.current_line.push(h),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},A.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(" "))},A.prototype.remove_indent=function(h){for(var m=this.__lines.length;h<m;)this.__lines[h]._remove_indent(),h++;this.current_line._remove_wrap_indent()},A.prototype.trim=function(h){for(h=h===void 0?!1:h,this.current_line.trim();h&&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},A.prototype.just_added_newline=function(){return this.current_line.is_empty()},A.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},A.prototype.ensure_empty_line_above=function(h,m){for(var y=this.__lines.length-2;y>=0;){var S=this.__lines[y];if(S.is_empty())break;if(S.item(0).indexOf(h)!==0&&S.item(-1)!==m){this.__lines.splice(y+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}y--}},le.exports.Output=A},,,,function(le){function l(h,m){this.raw_options=x(h,m),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(h,m){var y=this.raw_options[h],S=m||[];return typeof y=="object"?y!==null&&typeof y.concat=="function"&&(S=y.concat()):typeof y=="string"&&(S=y.split(/[^a-zA-Z0-9_\/\-]+/)),S},l.prototype._get_boolean=function(h,m){var y=this.raw_options[h],S=y===void 0?!!m:!!y;return S},l.prototype._get_characters=function(h,m){var y=this.raw_options[h],S=m||"";return typeof y=="string"&&(S=y.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),S},l.prototype._get_number=function(h,m){var y=this.raw_options[h];m=parseInt(m,10),isNaN(m)&&(m=0);var S=parseInt(y,10);return isNaN(S)&&(S=m),S},l.prototype._get_selection=function(h,m,y){var S=this._get_selection_list(h,m,y);if(S.length!==1)throw new Error("Invalid Option Value: The option '"+h+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[h]+"'");return S[0]},l.prototype._get_selection_list=function(h,m,y){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(y=y||[m[0]],!this._is_valid_selection(y,m))throw new Error("Invalid Default Value!");var S=this._get_array(h,y);if(!this._is_valid_selection(S,m))throw new Error("Invalid Option Value: The option '"+h+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[h]+"'");return S},l.prototype._is_valid_selection=function(h,m){return h.length&&m.length&&!h.some(function(y){return m.indexOf(y)===-1})};function x(h,m){var y={};h=A(h);var S;for(S in h)S!==m&&(y[S]=h[S]);if(m&&h[m])for(S in h[m])y[S]=h[m][S];return y}function A(h){var m={},y;for(y in h){var S=y.replace(/-/g,"_");m[S]=h[y]}return m}le.exports.Options=l,le.exports.normalizeOpts=A,le.exports.mergeOpts=x},,function(le){var l=RegExp.prototype.hasOwnProperty("sticky");function x(A){this.__input=A||"",this.__input_length=this.__input.length,this.__position=0}x.prototype.restart=function(){this.__position=0},x.prototype.back=function(){this.__position>0&&(this.__position-=1)},x.prototype.hasNext=function(){return this.__position<this.__input_length},x.prototype.next=function(){var A=null;return this.hasNext()&&(A=this.__input.charAt(this.__position),this.__position+=1),A},x.prototype.peek=function(A){var h=null;return A=A||0,A+=this.__position,A>=0&&A<this.__input_length&&(h=this.__input.charAt(A)),h},x.prototype.__match=function(A,h){A.lastIndex=h;var m=A.exec(this.__input);return m&&!(l&&A.sticky)&&m.index!==h&&(m=null),m},x.prototype.test=function(A,h){return h=h||0,h+=this.__position,h>=0&&h<this.__input_length?!!this.__match(A,h):!1},x.prototype.testChar=function(A,h){var m=this.peek(h);return A.lastIndex=0,m!==null&&A.test(m)},x.prototype.match=function(A){var h=this.__match(A,this.__position);return h?this.__position+=h[0].length:h=null,h},x.prototype.read=function(A,h,m){var y="",S;return A&&(S=this.match(A),S&&(y+=S[0])),h&&(S||!A)&&(y+=this.readUntil(h,m)),y},x.prototype.readUntil=function(A,h){var m="",y=this.__position;A.lastIndex=this.__position;var S=A.exec(this.__input);return S?(y=S.index,h&&(y+=S[0].length)):y=this.__input_length,m=this.__input.substring(this.__position,y),this.__position=y,m},x.prototype.readUntilAfter=function(A){return this.readUntil(A,!0)},x.prototype.get_regexp=function(A,h){var m=null,y="g";return h&&l&&(y="y"),typeof A=="string"&&A!==""?m=new RegExp(A,y):A&&(m=new RegExp(A.source,y)),m},x.prototype.get_literal_regexp=function(A){return RegExp(A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},x.prototype.peekUntilAfter=function(A){var h=this.__position,m=this.readUntilAfter(A);return this.__position=h,m},x.prototype.lookBack=function(A){var h=this.__position-1;return h>=A.length&&this.__input.substring(h-A.length,h).toLowerCase()===A},le.exports.InputScanner=x},,,,,function(le){function l(x,A){x=typeof x=="string"?x:x.source,A=typeof A=="string"?A:A.source,this.__directives_block_pattern=new RegExp(x+/ beautify( \w+[:]\w+)+ /.source+A,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(x+/\sbeautify\signore:end\s/.source+A,"g")}l.prototype.get_directives=function(x){if(!x.match(this.__directives_block_pattern))return null;var A={};this.__directive_pattern.lastIndex=0;for(var h=this.__directive_pattern.exec(x);h;)A[h[1]]=h[2],h=this.__directive_pattern.exec(x);return A},l.prototype.readIgnored=function(x){return x.readUntilAfter(this.__directives_end_ignore_pattern)},le.exports.Directives=l},,function(le,l,x){var A=x(16).Beautifier,h=x(17).Options;function m(y,S){var F=new A(y,S);return F.beautify()}le.exports=m,le.exports.defaultOptions=function(){return new h}},function(le,l,x){var A=x(17).Options,h=x(2).Output,m=x(8).InputScanner,y=x(13).Directives,S=new y(/\/\*/,/\*\//),F=/\r\n|[\r\n]/,Z=/\r\n|[\r\n]/g,W=/\s/,I=/(?:\s|\n)+/g,N=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,T=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function D(q,te){this._source_text=q||"",this._options=new A(te),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"]}D.prototype.eatString=function(q){var te="";for(this._ch=this._input.next();this._ch;){if(te+=this._ch,this._ch==="\\")te+=this._input.next();else if(q.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return te},D.prototype.eatWhitespace=function(q){for(var te=W.test(this._input.peek()),X=0;W.test(this._input.peek());)this._ch=this._input.next(),q&&this._ch===`
`&&(X===0||X<this._options.max_preserve_newlines)&&(X++,this._output.add_new_line(!0));return te},D.prototype.foundNestedPseudoClass=function(){for(var q=0,te=1,X=this._input.peek(te);X;){if(X==="{")return!0;if(X==="(")q+=1;else if(X===")"){if(q===0)return!1;q-=1}else if(X===";"||X==="}")return!1;te++,X=this._input.peek(te)}return!1},D.prototype.print_string=function(q){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(q)},D.prototype.preserveSingleSpace=function(q){q&&(this._output.space_before_token=!0)},D.prototype.indent=function(){this._indentLevel++},D.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},D.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var q=this._source_text,te=this._options.eol;te==="auto"&&(te=`
`,q&&F.test(q||"")&&(te=q.match(F)[0])),q=q.replace(Z,`
`);var X=q.match(/^[\t ]*/)[0];this._output=new h(this._options,X),this._input=new m(q),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var ce=0,we=!1,Pe=!1,Ve=!1,V=!1,C=!1,G=this._ch,H=!1,Q,j,_;Q=this._input.read(I),j=Q!=="",_=G,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),G=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var v=this._input.read(N),P=S.get_directives(v);P&&P.ignore==="start"&&(v+=S.readIgnored(this._input)),this.print_string(v),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(T)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(j),this.print_string(this._ch);var re=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);re.match(/[ :]$/)&&(re=this.eatString(": ").replace(/\s+$/,""),this.print_string(re),this._output.space_before_token=!0),ce===0&&re.indexOf(":")!==-1&&(Pe=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(j),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var Oe=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);Oe.match(/[ :]$/)&&(Oe=this.eatString(": ").replace(/\s+$/,""),this.print_string(Oe),this._output.space_before_token=!0),ce===0&&Oe.indexOf(":")!==-1?(Pe=!0,this.indent()):Oe in this.NESTED_AT_RULE?(this._nestedLevel+=1,Oe in this.CONDITIONAL_GROUP_RULE&&(Ve=!0)):ce===0&&!Pe&&(V=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(j),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")Pe&&(Pe=!1,this.outdent()),V=!1,Ve?(Ve=!1,we=this._indentLevel>=this._nestedLevel):we=this._indentLevel>=this._nestedLevel-1,this._options.newline_between_rules&&we&&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)):(_==="("?this._output.space_before_token=!1:_!==","&&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(),_==="{"&&this._output.trim(!0),Pe&&(this.outdent(),Pe=!1),this.print_string(this._ch),we=!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 Ze=0;Ze<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;Ze++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[Ze])){H=!0;break}(we||Ve)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!V&&ce===0?(this.print_string(":"),Pe||(Pe=!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 Ye=_==='"'||_==="'";this.preserveSingleSpace(Ye||j),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")H=!1,ce===0?(Pe&&(this.outdent(),Pe=!1),V=!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(),ce++,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(")")),ce&&(ce--,this.outdent()));else{var qe=!1;this._input.lookBack("with")&&(qe=!0),this.preserveSingleSpace(j||qe),this.print_string(this._ch),Pe&&_==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),C=!0):(this.eatWhitespace(),ce++,this.indent())}else if(this._ch===")")ce&&(ce--,this.outdent()),C&&this._input.peek()===";"&&this._options.selector_separator_newline&&(C=!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&&(!Pe||C)&&ce===0&&!V?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Pe&&ce===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&&W.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(j),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),W.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 ft=_==='"'||_==="'";this.preserveSingleSpace(ft||j),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&H&&this._output.add_new_line()}var vt=this._output.get_code(te);return vt},le.exports.Beautifier=D},function(le,l,x){var A=x(6).Options;function h(m){A.call(this,m,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var y=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||y;var S=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var F=0;F<S.length;F++)S[F]!=="expand"?this.brace_style="collapse":this.brace_style=S[F]}h.prototype=new A,le.exports.Options=h}],$={};function p(le){var l=$[le];if(l!==void 0)return l.exports;var x=$[le]={exports:{}};return ue[le](x,x.exports,p),x.exports}var ge=p(15);fe=ge})();var Te=fe;w=[],L=function(){return{css_beautify:Te}}.apply(_t,w),L!==void 0&&(_n.exports=L)})()},40998:function(_n,_t,w){var L,fe;(function(){var Te;(function(){"use strict";var ge=[,,function(A){function h(S){this.__parent=S,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=[]}h.prototype.clone_empty=function(){var S=new h(this.__parent);return S.set_indent(this.__indent_count,this.__alignment_count),S},h.prototype.item=function(S){return S<0?this.__items[this.__items.length+S]:this.__items[S]},h.prototype.has_match=function(S){for(var F=this.__items.length-1;F>=0;F--)if(this.__items[F].match(S))return!0;return!1},h.prototype.set_indent=function(S,F){this.is_empty()&&(this.__indent_count=S||0,this.__alignment_count=F||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},h.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)},h.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},h.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var S=this.__parent.current_line;return S.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),S.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),S.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,S.__items[0]===" "&&(S.__items.splice(0,1),S.__character_count-=1),!0}return!1},h.prototype.is_empty=function(){return this.__items.length===0},h.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},h.prototype.push=function(S){this.__items.push(S);var F=S.lastIndexOf(`
`);F!==-1?this.__character_count=S.length-F:this.__character_count+=S.length},h.prototype.pop=function(){var S=null;return this.is_empty()||(S=this.__items.pop(),this.__character_count-=S.length),S},h.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},h.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},h.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},h.prototype.toString=function(){var S="";return this.is_empty()?this.__parent.indent_empty_lines&&(S=this.__parent.get_indent_string(this.__indent_count)):(S=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),S+=this.__items.join("")),S};function m(S,F){this.__cache=[""],this.__indent_size=S.indent_size,this.__indent_string=S.indent_char,S.indent_with_tabs||(this.__indent_string=new Array(S.indent_size+1).join(S.indent_char)),F=F||"",S.indent_level>0&&(F=new Array(S.indent_level+1).join(this.__indent_string)),this.__base_string=F,this.__base_string_length=F.length}m.prototype.get_indent_size=function(S,F){var Z=this.__base_string_length;return F=F||0,S<0&&(Z=0),Z+=S*this.__indent_size,Z+=F,Z},m.prototype.get_indent_string=function(S,F){var Z=this.__base_string;return F=F||0,S<0&&(S=0,Z=""),F+=S*this.__indent_size,this.__ensure_cache(F),Z+=this.__cache[F],Z},m.prototype.__ensure_cache=function(S){for(;S>=this.__cache.length;)this.__add_column()},m.prototype.__add_column=function(){var S=this.__cache.length,F=0,Z="";this.__indent_size&&S>=this.__indent_size&&(F=Math.floor(S/this.__indent_size),S-=F*this.__indent_size,Z=new Array(F+1).join(this.__indent_string)),S&&(Z+=new Array(S+1).join(" ")),this.__cache.push(Z)};function y(S,F){this.__indent_cache=new m(S,F),this.raw=!1,this._end_with_newline=S.end_with_newline,this.indent_size=S.indent_size,this.wrap_line_length=S.wrap_line_length,this.indent_empty_lines=S.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new h(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}y.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},y.prototype.get_line_number=function(){return this.__lines.length},y.prototype.get_indent_string=function(S,F){return this.__indent_cache.get_indent_string(S,F)},y.prototype.get_indent_size=function(S,F){return this.__indent_cache.get_indent_size(S,F)},y.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},y.prototype.add_new_line=function(S){return this.is_empty()||!S&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},y.prototype.get_code=function(S){this.trim(!0);var F=this.current_line.pop();F&&(F[F.length-1]===`
`&&(F=F.replace(/\n+$/g,"")),this.current_line.push(F)),this._end_with_newline&&this.__add_outputline();var Z=this.__lines.join(`
`);return S!==`
`&&(Z=Z.replace(/[\n]/g,S)),Z},y.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},y.prototype.set_indent=function(S,F){return S=S||0,F=F||0,this.next_line.set_indent(S,F),this.__lines.length>1?(this.current_line.set_indent(S,F),!0):(this.current_line.set_indent(),!1)},y.prototype.add_raw_token=function(S){for(var F=0;F<S.newlines;F++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(S.whitespace_before),this.current_line.push(S.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},y.prototype.add_token=function(S){this.__add_space_before_token(),this.current_line.push(S),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},y.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(" "))},y.prototype.remove_indent=function(S){for(var F=this.__lines.length;S<F;)this.__lines[S]._remove_indent(),S++;this.current_line._remove_wrap_indent()},y.prototype.trim=function(S){for(S=S===void 0?!1:S,this.current_line.trim();S&&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},y.prototype.just_added_newline=function(){return this.current_line.is_empty()},y.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},y.prototype.ensure_empty_line_above=function(S,F){for(var Z=this.__lines.length-2;Z>=0;){var W=this.__lines[Z];if(W.is_empty())break;if(W.item(0).indexOf(S)!==0&&W.item(-1)!==F){this.__lines.splice(Z+1,0,new h(this)),this.previous_line=this.__lines[this.__lines.length-2];break}Z--}},A.exports.Output=y},function(A){function h(m,y,S,F){this.type=m,this.text=y,this.comments_before=null,this.newlines=S||0,this.whitespace_before=F||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}A.exports.Token=h},,,function(A){function h(S,F){this.raw_options=m(S,F),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"])}h.prototype._get_array=function(S,F){var Z=this.raw_options[S],W=F||[];return typeof Z=="object"?Z!==null&&typeof Z.concat=="function"&&(W=Z.concat()):typeof Z=="string"&&(W=Z.split(/[^a-zA-Z0-9_\/\-]+/)),W},h.prototype._get_boolean=function(S,F){var Z=this.raw_options[S],W=Z===void 0?!!F:!!Z;return W},h.prototype._get_characters=function(S,F){var Z=this.raw_options[S],W=F||"";return typeof Z=="string"&&(W=Z.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),W},h.prototype._get_number=function(S,F){var Z=this.raw_options[S];F=parseInt(F,10),isNaN(F)&&(F=0);var W=parseInt(Z,10);return isNaN(W)&&(W=F),W},h.prototype._get_selection=function(S,F,Z){var W=this._get_selection_list(S,F,Z);if(W.length!==1)throw new Error("Invalid Option Value: The option '"+S+`' can only be one of the following values:
`+F+`
You passed in: '`+this.raw_options[S]+"'");return W[0]},h.prototype._get_selection_list=function(S,F,Z){if(!F||F.length===0)throw new Error("Selection list cannot be empty.");if(Z=Z||[F[0]],!this._is_valid_selection(Z,F))throw new Error("Invalid Default Value!");var W=this._get_array(S,Z);if(!this._is_valid_selection(W,F))throw new Error("Invalid Option Value: The option '"+S+`' can contain only the following values:
`+F+`
You passed in: '`+this.raw_options[S]+"'");return W},h.prototype._is_valid_selection=function(S,F){return S.length&&F.length&&!S.some(function(Z){return F.indexOf(Z)===-1})};function m(S,F){var Z={};S=y(S);var W;for(W in S)W!==F&&(Z[W]=S[W]);if(F&&S[F])for(W in S[F])Z[W]=S[F][W];return Z}function y(S){var F={},Z;for(Z in S){var W=Z.replace(/-/g,"_");F[W]=S[Z]}return F}A.exports.Options=h,A.exports.normalizeOpts=y,A.exports.mergeOpts=m},,function(A){var h=RegExp.prototype.hasOwnProperty("sticky");function m(y){this.__input=y||"",this.__input_length=this.__input.length,this.__position=0}m.prototype.restart=function(){this.__position=0},m.prototype.back=function(){this.__position>0&&(this.__position-=1)},m.prototype.hasNext=function(){return this.__position<this.__input_length},m.prototype.next=function(){var y=null;return this.hasNext()&&(y=this.__input.charAt(this.__position),this.__position+=1),y},m.prototype.peek=function(y){var S=null;return y=y||0,y+=this.__position,y>=0&&y<this.__input_length&&(S=this.__input.charAt(y)),S},m.prototype.__match=function(y,S){y.lastIndex=S;var F=y.exec(this.__input);return F&&!(h&&y.sticky)&&F.index!==S&&(F=null),F},m.prototype.test=function(y,S){return S=S||0,S+=this.__position,S>=0&&S<this.__input_length?!!this.__match(y,S):!1},m.prototype.testChar=function(y,S){var F=this.peek(S);return y.lastIndex=0,F!==null&&y.test(F)},m.prototype.match=function(y){var S=this.__match(y,this.__position);return S?this.__position+=S[0].length:S=null,S},m.prototype.read=function(y,S,F){var Z="",W;return y&&(W=this.match(y),W&&(Z+=W[0])),S&&(W||!y)&&(Z+=this.readUntil(S,F)),Z},m.prototype.readUntil=function(y,S){var F="",Z=this.__position;y.lastIndex=this.__position;var W=y.exec(this.__input);return W?(Z=W.index,S&&(Z+=W[0].length)):Z=this.__input_length,F=this.__input.substring(this.__position,Z),this.__position=Z,F},m.prototype.readUntilAfter=function(y){return this.readUntil(y,!0)},m.prototype.get_regexp=function(y,S){var F=null,Z="g";return S&&h&&(Z="y"),typeof y=="string"&&y!==""?F=new RegExp(y,Z):y&&(F=new RegExp(y.source,Z)),F},m.prototype.get_literal_regexp=function(y){return RegExp(y.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},m.prototype.peekUntilAfter=function(y){var S=this.__position,F=this.readUntilAfter(y);return this.__position=S,F},m.prototype.lookBack=function(y){var S=this.__position-1;return S>=y.length&&this.__input.substring(S-y.length,S).toLowerCase()===y},A.exports.InputScanner=m},function(A,h,m){var y=m(8).InputScanner,S=m(3).Token,F=m(10).TokenStream,Z=m(11).WhitespacePattern,W={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},I=function(N,T){this._input=new y(N),this._options=T||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new Z(this._input)};I.prototype.tokenize=function(){this._input.restart(),this.__tokens=new F,this._reset();for(var N,T=new S(W.START,""),D=null,q=[],te=new F;T.type!==W.EOF;){for(N=this._get_next_token(T,D);this._is_comment(N);)te.add(N),N=this._get_next_token(T,D);te.isEmpty()||(N.comments_before=te,te=new F),N.parent=D,this._is_opening(N)?(q.push(D),D=N):D&&this._is_closing(N,D)&&(N.opened=D,D.closed=N,D=q.pop(),N.parent=D),N.previous=T,T.next=N,this.__tokens.add(N),T=N}return this.__tokens},I.prototype._is_first_token=function(){return this.__tokens.isEmpty()},I.prototype._reset=function(){},I.prototype._get_next_token=function(N,T){this._readWhitespace();var D=this._input.read(/.+/g);return D?this._create_token(W.RAW,D):this._create_token(W.EOF,"")},I.prototype._is_comment=function(N){return!1},I.prototype._is_opening=function(N){return!1},I.prototype._is_closing=function(N,T){return!1},I.prototype._create_token=function(N,T){var D=new S(N,T,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return D},I.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},A.exports.Tokenizer=I,A.exports.TOKEN=W},function(A){function h(m){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=m}h.prototype.restart=function(){this.__position=0},h.prototype.isEmpty=function(){return this.__tokens_length===0},h.prototype.hasNext=function(){return this.__position<this.__tokens_length},h.prototype.next=function(){var m=null;return this.hasNext()&&(m=this.__tokens[this.__position],this.__position+=1),m},h.prototype.peek=function(m){var y=null;return m=m||0,m+=this.__position,m>=0&&m<this.__tokens_length&&(y=this.__tokens[m]),y},h.prototype.add=function(m){this.__parent_token&&(m.parent=this.__parent_token),this.__tokens.push(m),this.__tokens_length+=1},A.exports.TokenStream=h},function(A,h,m){var y=m(12).Pattern;function S(F,Z){y.call(this,F,Z),Z?this._line_regexp=this._input.get_regexp(Z._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}S.prototype=new y,S.prototype.__set_whitespace_patterns=function(F,Z){F+="\\t ",Z+="\\n\\r",this._match_pattern=this._input.get_regexp("["+F+Z+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+Z+"]")},S.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var F=this._input.read(this._match_pattern);if(F===" ")this.whitespace_before_token=" ";else if(F){var Z=this.__split(this._newline_regexp,F);this.newline_count=Z.length-1,this.whitespace_before_token=Z[this.newline_count]}return F},S.prototype.matching=function(F,Z){var W=this._create();return W.__set_whitespace_patterns(F,Z),W._update(),W},S.prototype._create=function(){return new S(this._input,this)},S.prototype.__split=function(F,Z){F.lastIndex=0;for(var W=0,I=[],N=F.exec(Z);N;)I.push(Z.substring(W,N.index)),W=N.index+N[0].length,N=F.exec(Z);return W<Z.length?I.push(Z.substring(W,Z.length)):I.push(""),I},A.exports.WhitespacePattern=S},function(A){function h(m,y){this._input=m,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,y&&(this._starting_pattern=this._input.get_regexp(y._starting_pattern,!0),this._match_pattern=this._input.get_regexp(y._match_pattern,!0),this._until_pattern=this._input.get_regexp(y._until_pattern),this._until_after=y._until_after)}h.prototype.read=function(){var m=this._input.read(this._starting_pattern);return(!this._starting_pattern||m)&&(m+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),m},h.prototype.read_match=function(){return this._input.match(this._match_pattern)},h.prototype.until_after=function(m){var y=this._create();return y._until_after=!0,y._until_pattern=this._input.get_regexp(m),y._update(),y},h.prototype.until=function(m){var y=this._create();return y._until_after=!1,y._until_pattern=this._input.get_regexp(m),y._update(),y},h.prototype.starting_with=function(m){var y=this._create();return y._starting_pattern=this._input.get_regexp(m,!0),y._update(),y},h.prototype.matching=function(m){var y=this._create();return y._match_pattern=this._input.get_regexp(m,!0),y._update(),y},h.prototype._create=function(){return new h(this._input,this)},h.prototype._update=function(){},A.exports.Pattern=h},function(A){function h(m,y){m=typeof m=="string"?m:m.source,y=typeof y=="string"?y:y.source,this.__directives_block_pattern=new RegExp(m+/ beautify( \w+[:]\w+)+ /.source+y,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(m+/\sbeautify\signore:end\s/.source+y,"g")}h.prototype.get_directives=function(m){if(!m.match(this.__directives_block_pattern))return null;var y={};this.__directive_pattern.lastIndex=0;for(var S=this.__directive_pattern.exec(m);S;)y[S[1]]=S[2],S=this.__directive_pattern.exec(m);return y},h.prototype.readIgnored=function(m){return m.readUntilAfter(this.__directives_end_ignore_pattern)},A.exports.Directives=h},function(A,h,m){var y=m(12).Pattern,S={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function F(Z,W){y.call(this,Z,W),this.__template_pattern=null,this._disabled=Object.assign({},S),this._excluded=Object.assign({},S),W&&(this.__template_pattern=this._input.get_regexp(W.__template_pattern),this._excluded=Object.assign(this._excluded,W._excluded),this._disabled=Object.assign(this._disabled,W._disabled));var I=new y(Z);this.__patterns={handlebars_comment:I.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:I.starting_with(/{{{/).until_after(/}}}/),handlebars:I.starting_with(/{{/).until_after(/}}/),php:I.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:I.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:I.starting_with(/{%/).until_after(/%}/),django_value:I.starting_with(/{{/).until_after(/}}/),django_comment:I.starting_with(/{#/).until_after(/#}/),smarty:I.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:I.starting_with(/{\*/).until_after(/\*}/),smarty_literal:I.starting_with(/{literal}/).until_after(/{\/literal}/)}}F.prototype=new y,F.prototype._create=function(){return new F(this._input,this)},F.prototype._update=function(){this.__set_templated_pattern()},F.prototype.disable=function(Z){var W=this._create();return W._disabled[Z]=!0,W._update(),W},F.prototype.read_options=function(Z){var W=this._create();for(var I in S)W._disabled[I]=Z.templating.indexOf(I)===-1;return W._update(),W},F.prototype.exclude=function(Z){var W=this._create();return W._excluded[Z]=!0,W._update(),W},F.prototype.read=function(){var Z="";this._match_pattern?Z=this._input.read(this._starting_pattern):Z=this._input.read(this._starting_pattern,this.__template_pattern);for(var W=this._read_template();W;)this._match_pattern?W+=this._input.read(this._match_pattern):W+=this._input.readUntil(this.__template_pattern),Z+=W,W=this._read_template();return this._until_after&&(Z+=this._input.readUntilAfter(this._until_pattern)),Z},F.prototype.__set_templated_pattern=function(){var Z=[];this._disabled.php||Z.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||Z.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||Z.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||Z.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(Z.push(this.__patterns.django._starting_pattern.source),Z.push(this.__patterns.django_value._starting_pattern.source),Z.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||Z.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&Z.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+Z.join("|")+")")},F.prototype._read_template=function(){var Z="",W=this._input.peek();if(W==="<"){var I=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&I==="?"&&(Z=Z||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&I==="%"&&(Z=Z||this.__patterns.erb.read())}else W==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(Z=Z||this.__patterns.handlebars_comment.read(),Z=Z||this.__patterns.handlebars_unescaped.read(),Z=Z||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(Z=Z||this.__patterns.django_value.read()),this._excluded.django||(Z=Z||this.__patterns.django_comment.read(),Z=Z||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(Z=Z||this.__patterns.smarty_comment.read(),Z=Z||this.__patterns.smarty_literal.read(),Z=Z||this.__patterns.smarty.read()));return Z},A.exports.TemplatablePattern=F},,,,function(A,h,m){var y=m(19).Beautifier,S=m(20).Options;function F(Z,W,I,N){var T=new y(Z,W,I,N);return T.beautify()}A.exports=F,A.exports.defaultOptions=function(){return new S}},function(A,h,m){var y=m(20).Options,S=m(2).Output,F=m(21).Tokenizer,Z=m(21).TOKEN,W=/\r\n|[\r\n]/,I=/\r\n|[\r\n]/g,N=function(V,C){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=V.max_preserve_newlines,this.preserve_newlines=V.preserve_newlines,this._output=new S(V,C)};N.prototype.current_line_has_match=function(V){return this._output.current_line.has_match(V)},N.prototype.set_space_before_token=function(V,C){this._output.space_before_token=V,this._output.non_breaking_space=C},N.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},N.prototype.add_raw_token=function(V){this._output.add_raw_token(V)},N.prototype.print_preserved_newlines=function(V){var C=0;V.type!==Z.TEXT&&V.previous.type!==Z.TEXT&&(C=V.newlines?1:0),this.preserve_newlines&&(C=V.newlines<this.max_preserve_newlines+1?V.newlines:this.max_preserve_newlines+1);for(var G=0;G<C;G++)this.print_newline(G>0);return C!==0},N.prototype.traverse_whitespace=function(V){return V.whitespace_before||V.newlines?(this.print_preserved_newlines(V)||(this._output.space_before_token=!0),!0):!1},N.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},N.prototype.print_newline=function(V){this._output.add_new_line(V)},N.prototype.print_token=function(V){V.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(V.text))},N.prototype.indent=function(){this.indent_level++},N.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},N.prototype.get_full_indent=function(V){return V=this.indent_level+(V||0),V<1?"":this._output.get_indent_string(V)};var T=function(V){for(var C=null,G=V.next;G.type!==Z.EOF&&V.closed!==G;){if(G.type===Z.ATTRIBUTE&&G.text==="type"){G.next&&G.next.type===Z.EQUALS&&G.next.next&&G.next.next.type===Z.VALUE&&(C=G.next.next.text);break}G=G.next}return C},D=function(V,C){var G=null,H=null;return C.closed?(V==="script"?G="text/javascript":V==="style"&&(G="text/css"),G=T(C)||G,G.search("text/css")>-1?H="css":G.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?H="javascript":G.search(/(text|application|dojo)\/(x-)?(html)/)>-1?H="html":G.search(/test\/null/)>-1&&(H="null"),H):null};function q(V,C){return C.indexOf(V)!==-1}function te(V,C,G){this.parent=V||null,this.tag=C?C.tag_name:"",this.indent_level=G||0,this.parser_token=C||null}function X(V){this._printer=V,this._current_frame=null}X.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},X.prototype.record_tag=function(V){var C=new te(this._current_frame,V,this._printer.indent_level);this._current_frame=C},X.prototype._try_pop_frame=function(V){var C=null;return V&&(C=V.parser_token,this._printer.indent_level=V.indent_level,this._current_frame=V.parent),C},X.prototype._get_frame=function(V,C){for(var G=this._current_frame;G&&V.indexOf(G.tag)===-1;){if(C&&C.indexOf(G.tag)!==-1){G=null;break}G=G.parent}return G},X.prototype.try_pop=function(V,C){var G=this._get_frame([V],C);return this._try_pop_frame(G)},X.prototype.indent_to_tag=function(V){var C=this._get_frame(V);C&&(this._printer.indent_level=C.indent_level)};function ce(V,C,G,H){this._source_text=V||"",C=C||{},this._js_beautify=G,this._css_beautify=H,this._tag_stack=null;var Q=new y(C,"html");this._options=Q,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"}ce.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var V=this._source_text,C=this._options.eol;this._options.eol==="auto"&&(C=`
`,V&&W.test(V)&&(C=V.match(W)[0])),V=V.replace(I,`
`);var G=V.match(/^[\t ]*/)[0],H={text:"",type:""},Q=new we(this._options),j=new N(this._options,G),_=new F(V,this._options).tokenize();this._tag_stack=new X(j);for(var v=null,P=_.next();P.type!==Z.EOF;)P.type===Z.TAG_OPEN||P.type===Z.COMMENT?(v=this._handle_tag_open(j,P,Q,H,_),Q=v):P.type===Z.ATTRIBUTE||P.type===Z.EQUALS||P.type===Z.VALUE||P.type===Z.TEXT&&!Q.tag_complete?v=this._handle_inside_tag(j,P,Q,H):P.type===Z.TAG_CLOSE?v=this._handle_tag_close(j,P,Q):P.type===Z.TEXT?v=this._handle_text(j,P,Q):P.type===Z.CONTROL_FLOW_OPEN?v=this._handle_control_flow_open(j,P):P.type===Z.CONTROL_FLOW_CLOSE?v=this._handle_control_flow_close(j,P):j.add_raw_token(P),H=v,P=_.next();var re=j._output.get_code(C);return re},ce.prototype._handle_control_flow_open=function(V,C){var G={text:C.text,type:C.type};return V.set_space_before_token(C.newlines||C.whitespace_before!=="",!0),C.newlines?V.print_preserved_newlines(C):V.set_space_before_token(C.newlines||C.whitespace_before!=="",!0),V.print_token(C),V.indent(),G},ce.prototype._handle_control_flow_close=function(V,C){var G={text:C.text,type:C.type};return V.deindent(),C.newlines?V.print_preserved_newlines(C):V.set_space_before_token(C.newlines||C.whitespace_before!=="",!0),V.print_token(C),G},ce.prototype._handle_tag_close=function(V,C,G){var H={text:C.text,type:C.type};return V.alignment_size=0,G.tag_complete=!0,V.set_space_before_token(C.newlines||C.whitespace_before!=="",!0),G.is_unformatted?V.add_raw_token(C):(G.tag_start_char==="<"&&(V.set_space_before_token(C.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&G.has_wrapped_attrs&&V.print_newline(!1)),V.print_token(C)),G.indent_content&&!(G.is_unformatted||G.is_content_unformatted)&&(V.indent(),G.indent_content=!1),!G.is_inline_element&&!(G.is_unformatted||G.is_content_unformatted)&&V.set_wrap_point(),H},ce.prototype._handle_inside_tag=function(V,C,G,H){var Q=G.has_wrapped_attrs,j={text:C.text,type:C.type};return V.set_space_before_token(C.newlines||C.whitespace_before!=="",!0),G.is_unformatted?V.add_raw_token(C):G.tag_start_char==="{"&&C.type===Z.TEXT?V.print_preserved_newlines(C)?(C.newlines=0,V.add_raw_token(C)):V.print_token(C):(C.type===Z.ATTRIBUTE?V.set_space_before_token(!0):(C.type===Z.EQUALS||C.type===Z.VALUE&&C.previous.type===Z.EQUALS)&&V.set_space_before_token(!1),C.type===Z.ATTRIBUTE&&G.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(V.traverse_whitespace(C),Q=Q||C.newlines!==0),this._is_wrap_attributes_force&&G.attr_count>=this._options.wrap_attributes_min_attrs&&(H.type!==Z.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(V.print_newline(!1),Q=!0)),V.print_token(C),Q=Q||V.previous_token_wrapped(),G.has_wrapped_attrs=Q),j},ce.prototype._handle_text=function(V,C,G){var H={text:C.text,type:"TK_CONTENT"};return G.custom_beautifier_name?this._print_custom_beatifier_text(V,C,G):G.is_unformatted||G.is_content_unformatted?V.add_raw_token(C):(V.traverse_whitespace(C),V.print_token(C)),H},ce.prototype._print_custom_beatifier_text=function(V,C,G){var H=this;if(C.text!==""){var Q=C.text,j,_=1,v="",P="";G.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?j=this._js_beautify:G.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?j=this._css_beautify:G.custom_beautifier_name==="html"&&(j=function(ft,vt){var Ae=new ce(ft,vt,H._js_beautify,H._css_beautify);return Ae.beautify()}),this._options.indent_scripts==="keep"?_=0:this._options.indent_scripts==="separate"&&(_=-V.indent_level);var re=V.get_full_indent(_);if(Q=Q.replace(/\n[ \t]*$/,""),G.custom_beautifier_name!=="html"&&Q[0]==="<"&&Q.match(/^(<!--|<!\[CDATA\[)/)){var Oe=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(Q);if(!Oe){V.add_raw_token(C);return}v=re+Oe[1]+`
`,Q=Oe[4],Oe[5]&&(P=re+Oe[5]),Q=Q.replace(/\n[ \t]*$/,""),(Oe[2]||Oe[3].indexOf(`
`)!==-1)&&(Oe=Oe[3].match(/[ \t]+$/),Oe&&(C.whitespace_before=Oe[0]))}if(Q)if(j){var Ze=function(){this.eol=`
`};Ze.prototype=this._options.raw_options;var Ye=new Ze;Q=j(re+Q,Ye)}else{var qe=C.whitespace_before;qe&&(Q=Q.replace(new RegExp(`
(`+qe+")?","g"),`
`)),Q=re+Q.replace(/\n/g,`
`+re)}v&&(Q?Q=v+Q+`
`+P:Q=v+P),V.print_newline(!1),Q&&(C.text=Q,C.whitespace_before="",C.newlines=0,V.add_raw_token(C),V.print_newline(!0))}},ce.prototype._handle_tag_open=function(V,C,G,H,Q){var j=this._get_tag_open_token(C);if((G.is_unformatted||G.is_content_unformatted)&&!G.is_empty_element&&C.type===Z.TAG_OPEN&&!j.is_start_tag?(V.add_raw_token(C),j.start_tag_token=this._tag_stack.try_pop(j.tag_name)):(V.traverse_whitespace(C),this._set_tag_position(V,C,j,G,H),j.is_inline_element||V.set_wrap_point(),V.print_token(C)),j.is_start_tag&&this._is_wrap_attributes_force){var _=0,v;do v=Q.peek(_),v.type===Z.ATTRIBUTE&&(j.attr_count+=1),_+=1;while(v.type!==Z.EOF&&v.type!==Z.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(j.alignment_size=C.text.length+1),!j.tag_complete&&!j.is_unformatted&&(V.alignment_size=j.alignment_size),j};var we=function(V,C,G){if(this.parent=C||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="",!G)this.tag_complete=!0;else{var H;this.tag_start_char=G.text[0],this.text=G.text,this.tag_start_char==="<"?(H=G.text.match(/^<([^\s>]*)/),this.tag_check=H?H[1]:""):(H=G.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=H?H[1]:"",(G.text.startsWith("{{#>")||G.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&G.next!==null?this.tag_check=G.next.text.split(" ")[0]:this.tag_check=G.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),G.type===Z.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||G.closed&&G.closed.text==="/>";var Q=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(Q=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!V.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(Q)))}};ce.prototype._get_tag_open_token=function(V){var C=new we(this._options,this._tag_stack.get_parser_token(),V);return C.alignment_size=this._options.wrap_attributes_indent_size,C.is_end_tag=C.is_end_tag||q(C.tag_check,this._options.void_elements),C.is_empty_element=C.tag_complete||C.is_start_tag&&C.is_end_tag,C.is_unformatted=!C.tag_complete&&q(C.tag_check,this._options.unformatted),C.is_content_unformatted=!C.is_empty_element&&q(C.tag_check,this._options.content_unformatted),C.is_inline_element=q(C.tag_name,this._options.inline)||this._options.inline_custom_elements&&C.tag_name.includes("-")||C.tag_start_char==="{",C},ce.prototype._set_tag_position=function(V,C,G,H,Q){if(G.is_empty_element||(G.is_end_tag?G.start_tag_token=this._tag_stack.try_pop(G.tag_name):(this._do_optional_end_element(G)&&(G.is_inline_element||V.print_newline(!1)),this._tag_stack.record_tag(G),(G.tag_name==="script"||G.tag_name==="style")&&!(G.is_unformatted||G.is_content_unformatted)&&(G.custom_beautifier_name=D(G.tag_check,C)))),q(G.tag_check,this._options.extra_liners)&&(V.print_newline(!1),V._output.just_added_blankline()||V.print_newline(!0)),G.is_empty_element){if(G.tag_start_char==="{"&&G.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),G.indent_content=!0;var j=V.current_line_has_match(/{{#if/);j||V.print_newline(!1)}G.tag_name==="!--"&&Q.type===Z.TAG_CLOSE&&H.is_end_tag&&G.text.indexOf(`
`)===-1||(G.is_inline_element||G.is_unformatted||V.print_newline(!1),this._calcluate_parent_multiline(V,G))}else if(G.is_end_tag){var _=!1;_=G.start_tag_token&&G.start_tag_token.multiline_content,_=_||!G.is_inline_element&&!(H.is_inline_element||H.is_unformatted)&&!(Q.type===Z.TAG_CLOSE&&G.start_tag_token===H)&&Q.type!=="TK_CONTENT",(G.is_content_unformatted||G.is_unformatted)&&(_=!1),_&&V.print_newline(!1)}else G.indent_content=!G.custom_beautifier_name,G.tag_start_char==="<"&&(G.tag_name==="html"?G.indent_content=this._options.indent_inner_html:G.tag_name==="head"?G.indent_content=this._options.indent_head_inner_html:G.tag_name==="body"&&(G.indent_content=this._options.indent_body_inner_html)),!(G.is_inline_element||G.is_unformatted)&&(Q.type!=="TK_CONTENT"||G.is_content_unformatted)&&V.print_newline(!1),this._calcluate_parent_multiline(V,G)},ce.prototype._calcluate_parent_multiline=function(V,C){C.parent&&V._output.just_added_newline()&&!((C.is_inline_element||C.is_unformatted)&&C.parent.is_inline_element)&&(C.parent.multiline_content=!0)};var Pe=["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"],Ve=["a","audio","del","ins","map","noscript","video"];ce.prototype._do_optional_end_element=function(V){var C=null;if(!(V.is_empty_element||!V.is_start_tag||!V.parent)){if(V.tag_name==="body")C=C||this._tag_stack.try_pop("head");else if(V.tag_name==="li")C=C||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(V.tag_name==="dd"||V.tag_name==="dt")C=C||this._tag_stack.try_pop("dt",["dl"]),C=C||this._tag_stack.try_pop("dd",["dl"]);else if(V.parent.tag_name==="p"&&Pe.indexOf(V.tag_name)!==-1){var G=V.parent.parent;(!G||Ve.indexOf(G.tag_name)===-1)&&(C=C||this._tag_stack.try_pop("p"))}else V.tag_name==="rp"||V.tag_name==="rt"?(C=C||this._tag_stack.try_pop("rt",["ruby","rtc"]),C=C||this._tag_stack.try_pop("rp",["ruby","rtc"])):V.tag_name==="optgroup"?C=C||this._tag_stack.try_pop("optgroup",["select"]):V.tag_name==="option"?C=C||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):V.tag_name==="colgroup"?C=C||this._tag_stack.try_pop("caption",["table"]):V.tag_name==="thead"?(C=C||this._tag_stack.try_pop("caption",["table"]),C=C||this._tag_stack.try_pop("colgroup",["table"])):V.tag_name==="tbody"||V.tag_name==="tfoot"?(C=C||this._tag_stack.try_pop("caption",["table"]),C=C||this._tag_stack.try_pop("colgroup",["table"]),C=C||this._tag_stack.try_pop("thead",["table"]),C=C||this._tag_stack.try_pop("tbody",["table"])):V.tag_name==="tr"?(C=C||this._tag_stack.try_pop("caption",["table"]),C=C||this._tag_stack.try_pop("colgroup",["table"]),C=C||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(V.tag_name==="th"||V.tag_name==="td")&&(C=C||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),C=C||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return V.parent=this._tag_stack.get_parser_token(),C}},A.exports.Beautifier=ce},function(A,h,m){var y=m(6).Options;function S(F){y.call(this,F,"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"])}S.prototype=new y,A.exports.Options=S},function(A,h,m){var y=m(9).Tokenizer,S=m(9).TOKEN,F=m(13).Directives,Z=m(14).TemplatablePattern,W=m(12).Pattern,I={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:S.START,RAW:S.RAW,EOF:S.EOF},N=new F(/<\!--/,/-->/),T=function(D,q){y.call(this,D,q),this._current_tag_name="";var te=new Z(this._input).read_options(this._options),X=new W(this._input);if(this.__patterns={word:te.until(/[\n\r\t <]/),word_control_flow_close_excluded:te.until(/[\n\r\t <}]/),single_quote:te.until_after(/'/),double_quote:te.until_after(/"/),attribute:te.until(/[\n\r\t =>]|\/>/),element_name:te.until(/[\n\r\t >\/]/),angular_control_flow_start:X.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:X.starting_with(/{{!--/).until_after(/--}}/),handlebars:X.starting_with(/{{/).until_after(/}}/),handlebars_open:X.until(/[\n\r\t }]/),handlebars_raw_close:X.until(/}}/),comment:X.starting_with(/<!--/).until_after(/-->/),cdata:X.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:X.starting_with(/<!\[/).until_after(/]>/),processing:X.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 ce=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=X.matching(ce).until_after(ce)}};T.prototype=new y,T.prototype._is_comment=function(D){return!1},T.prototype._is_opening=function(D){return D.type===I.TAG_OPEN||D.type===I.CONTROL_FLOW_OPEN},T.prototype._is_closing=function(D,q){return D.type===I.TAG_CLOSE&&q&&((D.text===">"||D.text==="/>")&&q.text[0]==="<"||D.text==="}}"&&q.text[0]==="{"&&q.text[1]==="{")||D.type===I.CONTROL_FLOW_CLOSE&&D.text==="}"&&q.text.endsWith("{")},T.prototype._reset=function(){this._current_tag_name=""},T.prototype._get_next_token=function(D,q){var te=null;this._readWhitespace();var X=this._input.peek();return X===null?this._create_token(I.EOF,""):(te=te||this._read_open_handlebars(X,q),te=te||this._read_attribute(X,D,q),te=te||this._read_close(X,q),te=te||this._read_script_and_style(X,D),te=te||this._read_control_flows(X,q),te=te||this._read_raw_content(X,D,q),te=te||this._read_content_word(X,q),te=te||this._read_comment_or_cdata(X),te=te||this._read_processing(X),te=te||this._read_open(X,q),te=te||this._create_token(I.UNKNOWN,this._input.next()),te)},T.prototype._read_comment_or_cdata=function(D){var q=null,te=null,X=null;if(D==="<"){var ce=this._input.peek(1);ce==="!"&&(te=this.__patterns.comment.read(),te?(X=N.get_directives(te),X&&X.ignore==="start"&&(te+=N.readIgnored(this._input))):te=this.__patterns.cdata.read()),te&&(q=this._create_token(I.COMMENT,te),q.directives=X)}return q},T.prototype._read_processing=function(D){var q=null,te=null,X=null;if(D==="<"){var ce=this._input.peek(1);(ce==="!"||ce==="?")&&(te=this.__patterns.conditional_comment.read(),te=te||this.__patterns.processing.read()),te&&(q=this._create_token(I.COMMENT,te),q.directives=X)}return q},T.prototype._read_open=function(D,q){var te=null,X=null;return(!q||q.type===I.CONTROL_FLOW_OPEN)&&D==="<"&&(te=this._input.next(),this._input.peek()==="/"&&(te+=this._input.next()),te+=this.__patterns.element_name.read(),X=this._create_token(I.TAG_OPEN,te)),X},T.prototype._read_open_handlebars=function(D,q){var te=null,X=null;return(!q||q.type===I.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&D==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(te=this.__patterns.handlebars_comment.read(),te=te||this.__patterns.handlebars.read(),X=this._create_token(I.COMMENT,te)):(te=this.__patterns.handlebars_open.read(),X=this._create_token(I.TAG_OPEN,te))),X},T.prototype._read_control_flows=function(D,q){var te="",X=null;if(!this._options.templating.includes("angular"))return X;if(D==="@"){if(te=this.__patterns.angular_control_flow_start.read(),te==="")return X;for(var ce=te.endsWith("(")?1:0,we=0;!(te.endsWith("{")&&ce===we);){var Pe=this._input.next();if(Pe===null)break;Pe==="("?ce++:Pe===")"&&we++,te+=Pe}X=this._create_token(I.CONTROL_FLOW_OPEN,te)}else D==="}"&&q&&q.type===I.CONTROL_FLOW_OPEN&&(te=this._input.next(),X=this._create_token(I.CONTROL_FLOW_CLOSE,te));return X},T.prototype._read_close=function(D,q){var te=null,X=null;return q&&q.type===I.TAG_OPEN&&(q.text[0]==="<"&&(D===">"||D==="/"&&this._input.peek(1)===">")?(te=this._input.next(),D==="/"&&(te+=this._input.next()),X=this._create_token(I.TAG_CLOSE,te)):q.text[0]==="{"&&D==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),X=this._create_token(I.TAG_CLOSE,"}}"))),X},T.prototype._read_attribute=function(D,q,te){var X=null,ce="";if(te&&te.text[0]==="<")if(D==="=")X=this._create_token(I.EQUALS,this._input.next());else if(D==='"'||D==="'"){var we=this._input.next();D==='"'?we+=this.__patterns.double_quote.read():we+=this.__patterns.single_quote.read(),X=this._create_token(I.VALUE,we)}else ce=this.__patterns.attribute.read(),ce&&(q.type===I.EQUALS?X=this._create_token(I.VALUE,ce):X=this._create_token(I.ATTRIBUTE,ce));return X},T.prototype._is_content_unformatted=function(D){return this._options.void_elements.indexOf(D)===-1&&(this._options.content_unformatted.indexOf(D)!==-1||this._options.unformatted.indexOf(D)!==-1)},T.prototype._read_raw_content=function(D,q,te){var X="";if(te&&te.text[0]==="{")X=this.__patterns.handlebars_raw_close.read();else if(q.type===I.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var ce=q.opened.text.substr(1).toLowerCase();this._is_content_unformatted(ce)&&(X=this._input.readUntil(new RegExp("</"+ce+"[\\n\\r\\t ]*?>","ig")))}return X?this._create_token(I.TEXT,X):null},T.prototype._read_script_and_style=function(D,q){if(q.type===I.TAG_CLOSE&&q.opened.text[0]==="<"&&q.text[0]!=="/"){var te=q.opened.text.substr(1).toLowerCase();if(te==="script"||te==="style"){var X=this._read_comment_or_cdata(D);if(X)return X.type=I.TEXT,X;var ce=this._input.readUntil(new RegExp("</"+te+"[\\n\\r\\t ]*?>","ig"));if(ce)return this._create_token(I.TEXT,ce)}}return null},T.prototype._read_content_word=function(D,q){var te="";return this._options.unformatted_content_delimiter&&D===this._options.unformatted_content_delimiter[0]&&(te=this.__patterns.unformatted_content_delimiter.read()),te||(te=q&&q.type===I.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),te?this._create_token(I.TEXT,te):null},A.exports.Tokenizer=T,A.exports.TOKEN=I}],le={};function l(A){var h=le[A];if(h!==void 0)return h.exports;var m=le[A]={exports:{}};return ge[A](m,m.exports,l),m.exports}var x=l(18);Te=x})();var ue=Te;if(1)L=[w,w(58553),w(87804)],fe=function(ge){var le=w(58553),l=w(87804);return{html_beautify:function(x,A){return ue(x,A,le.js_beautify,l.css_beautify)}}}.apply(_t,L),fe!==void 0&&(_n.exports=fe);else var $,p})()},58553:function(_n,_t){var w,L;(function(){var fe;(function(){"use strict";var ue=[function(le,l,x){var A=x(1).Beautifier,h=x(5).Options;function m(y,S){var F=new A(y,S);return F.beautify()}le.exports=m,le.exports.defaultOptions=function(){return new h}},function(le,l,x){var A=x(2).Output,h=x(3).Token,m=x(4),y=x(5).Options,S=x(7).Tokenizer,F=x(7).line_starters,Z=x(7).positionable_operators,W=x(7).TOKEN;function I(v,P){return P.indexOf(v)!==-1}function N(v){return v.replace(/^\s+/g,"")}function T(v){for(var P={},re=0;re<v.length;re++)P[v[re].replace(/-/g,"_")]=v[re];return P}function D(v,P){return v&&v.type===W.RESERVED&&v.text===P}function q(v,P){return v&&v.type===W.RESERVED&&I(v.text,P)}var te=["case","return","do","if","throw","else","await","break","continue","async"],X=["before-newline","after-newline","preserve-newline"],ce=T(X),we=[ce.before_newline,ce.preserve_newline],Pe={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Ve(v,P){P.multiline_frame||P.mode===Pe.ForInitializer||P.mode===Pe.Conditional||v.remove_indent(P.start_line_index)}function V(v){v=v.replace(m.allLineBreaks,`
`);for(var P=[],re=v.indexOf(`
`);re!==-1;)P.push(v.substring(0,re)),v=v.substring(re+1),re=v.indexOf(`
`);return v.length&&P.push(v),P}function C(v){return v===Pe.ArrayLiteral}function G(v){return I(v,[Pe.Expression,Pe.ForInitializer,Pe.Conditional])}function H(v,P){for(var re=0;re<v.length;re++){var Oe=v[re].trim();if(Oe.charAt(0)!==P)return!1}return!0}function Q(v,P){for(var re=0,Oe=v.length,Ze;re<Oe;re++)if(Ze=v[re],Ze&&Ze.indexOf(P)!==0)return!1;return!0}function j(v,P){P=P||{},this._source_text=v||"",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 y(P)}j.prototype.create_flags=function(v,P){var re=0;v&&(re=v.indentation_level,!this._output.just_added_newline()&&v.line_indent_level>re&&(re=v.line_indent_level));var Oe={mode:P,parent:v,last_token:v?v.last_token:new h(W.START_BLOCK,""),last_word:v?v.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:re,alignment:0,line_indent_level:v?v.line_indent_level:re,start_line_index:this._output.get_line_number(),ternary_depth:0};return Oe},j.prototype._reset=function(v){var P=v.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new A(this._options,P),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Pe.BlockStatement);var re=new S(v,this._options);return this._tokens=re.tokenize(),v},j.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var v,P=this._reset(this._source_text),re=this._options.eol;this._options.eol==="auto"&&(re=`
`,P&&m.lineBreak.test(P||"")&&(re=P.match(m.lineBreak)[0]));for(var Oe=this._tokens.next();Oe;)this.handle_token(Oe),this._last_last_text=this._flags.last_token.text,this._flags.last_token=Oe,Oe=this._tokens.next();return v=this._output.get_code(re),v},j.prototype.handle_token=function(v,P){v.type===W.START_EXPR?this.handle_start_expr(v):v.type===W.END_EXPR?this.handle_end_expr(v):v.type===W.START_BLOCK?this.handle_start_block(v):v.type===W.END_BLOCK?this.handle_end_block(v):v.type===W.WORD?this.handle_word(v):v.type===W.RESERVED?this.handle_word(v):v.type===W.SEMICOLON?this.handle_semicolon(v):v.type===W.STRING?this.handle_string(v):v.type===W.EQUALS?this.handle_equals(v):v.type===W.OPERATOR?this.handle_operator(v):v.type===W.COMMA?this.handle_comma(v):v.type===W.BLOCK_COMMENT?this.handle_block_comment(v,P):v.type===W.COMMENT?this.handle_comment(v,P):v.type===W.DOT?this.handle_dot(v):v.type===W.EOF?this.handle_eof(v):v.type===W.UNKNOWN?this.handle_unknown(v,P):this.handle_unknown(v,P)},j.prototype.handle_whitespace_and_comments=function(v,P){var re=v.newlines,Oe=this._options.keep_array_indentation&&C(this._flags.mode);if(v.comments_before)for(var Ze=v.comments_before.next();Ze;)this.handle_whitespace_and_comments(Ze,P),this.handle_token(Ze,P),Ze=v.comments_before.next();if(Oe)for(var Ye=0;Ye<re;Ye+=1)this.print_newline(Ye>0,P);else if(this._options.max_preserve_newlines&&re>this._options.max_preserve_newlines&&(re=this._options.max_preserve_newlines),this._options.preserve_newlines&&re>1){this.print_newline(!1,P);for(var qe=1;qe<re;qe+=1)this.print_newline(!0,P)}};var _=["async","break","continue","return","throw","yield"];j.prototype.allow_wrap_or_preserved_newline=function(v,P){if(P=P===void 0?!1:P,!this._output.just_added_newline()){var re=this._options.preserve_newlines&&v.newlines||P,Oe=I(this._flags.last_token.text,Z)||I(v.text,Z);if(Oe){var Ze=I(this._flags.last_token.text,Z)&&I(this._options.operator_position,we)||I(v.text,Z);re=re&&Ze}if(re)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(q(this._flags.last_token,_))return;this._output.set_wrap_point()}}},j.prototype.print_newline=function(v,P){if(!P&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==W.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var re=this._tokens.peek();this._flags.mode===Pe.Statement&&!(this._flags.if_block&&D(re,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(v)&&(this._flags.multiline_frame=!0)},j.prototype.print_token_line_indentation=function(v){this._output.just_added_newline()&&(this._options.keep_array_indentation&&v.newlines&&(v.text==="["||C(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(v.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))},j.prototype.print_token=function(v){if(this._output.raw){this._output.add_raw_token(v);return}if(this._options.comma_first&&v.previous&&v.previous.type===W.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var P=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(P),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(v),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(v),this._output.non_breaking_space=!0,this._output.add_token(v.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},j.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.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))},j.prototype.set_mode=function(v){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,v),this._flags=this.create_flags(this._previous_flags,v),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},j.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Pe.Statement&&Ve(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},j.prototype.start_of_object_property=function(){return this._flags.parent.mode===Pe.ObjectLiteral&&this._flags.mode===Pe.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"]))},j.prototype.start_of_statement=function(v){var P=!1;return P=P||q(this._flags.last_token,["var","let","const"])&&v.type===W.WORD,P=P||D(this._flags.last_token,"do"),P=P||!(this._flags.parent.mode===Pe.ObjectLiteral&&this._flags.mode===Pe.Statement)&&q(this._flags.last_token,_)&&!v.newlines,P=P||D(this._flags.last_token,"else")&&!(D(v,"if")&&!v.comments_before),P=P||this._flags.last_token.type===W.END_EXPR&&(this._previous_flags.mode===Pe.ForInitializer||this._previous_flags.mode===Pe.Conditional),P=P||this._flags.last_token.type===W.WORD&&this._flags.mode===Pe.BlockStatement&&!this._flags.in_case&&!(v.text==="--"||v.text==="++")&&this._last_last_text!=="function"&&v.type!==W.WORD&&v.type!==W.RESERVED,P=P||this._flags.mode===Pe.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||q(this._flags.last_token,["get","set"])),P?(this.set_mode(Pe.Statement),this.indent(),this.handle_whitespace_and_comments(v,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v,q(v,["do","for","if","while"])),!0):!1},j.prototype.handle_start_expr=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v);var P=Pe.Expression;if(v.text==="["){if(this._flags.last_token.type===W.WORD||this._flags.last_token.text===")"){q(this._flags.last_token,F)&&(this._output.space_before_token=!0),this.print_token(v),this.set_mode(P),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}P=Pe.ArrayLiteral,C(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()),I(this._flags.last_token.type,[W.START_EXPR,W.END_EXPR,W.WORD,W.OPERATOR,W.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===W.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,P=Pe.ForInitializer):I(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,P=Pe.Conditional):I(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&v.whitespace_before===""?this._output.space_before_token=!1:(I(this._flags.last_token.text,F)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===W.EQUALS||this._flags.last_token.type===W.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v);else if(this._flags.last_token.type===W.WORD){this._output.space_before_token=!1;var re=this._tokens.peek(-3);if(this._options.space_after_named_function&&re){var Oe=this._tokens.peek(-4);q(re,["async","function"])||re.text==="*"&&q(Oe,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Pe.ObjectLiteral?(re.text==="{"||re.text===","||re.text==="*"&&(Oe.text==="{"||Oe.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(v);(this._flags.last_token.type===W.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===Pe.ObjectLiteral&&I(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===W.START_BLOCK?this.print_newline():(this._flags.last_token.type===W.END_EXPR||this._flags.last_token.type===W.START_EXPR||this._flags.last_token.type===W.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===W.COMMA)&&this.allow_wrap_or_preserved_newline(v,v.newlines),this.print_token(v),this.set_mode(P),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},j.prototype.handle_end_expr=function(v){for(;this._flags.mode===Pe.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(v,v.text==="]"&&C(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===W.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(v),this.restore_mode(),Ve(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Pe.Conditional&&(this._previous_flags.mode=Pe.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},j.prototype.handle_start_block=function(v){this.handle_whitespace_and_comments(v);var P=this._tokens.peek(),re=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===W.END_EXPR?(this.set_mode(Pe.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Pe.BlockStatement):re&&(I(re.text,[":",","])&&I(P.type,[W.STRING,W.WORD,W.RESERVED])||I(P.text,["get","set","..."])&&I(re.type,[W.WORD,W.RESERVED]))?I(this._last_last_text,["class","interface"])&&!I(re.text,[":",","])?this.set_mode(Pe.BlockStatement):this.set_mode(Pe.ObjectLiteral):this._flags.last_token.type===W.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Pe.BlockStatement):I(this._flags.last_token.type,[W.EQUALS,W.START_EXPR,W.COMMA,W.OPERATOR])||q(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Pe.ObjectLiteral):this.set_mode(Pe.BlockStatement),this._flags.last_token&&q(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var Oe=!P.comments_before&&P.text==="}",Ze=Oe&&this._flags.last_word==="function"&&this._flags.last_token.type===W.END_EXPR;if(this._options.brace_preserve_inline){var Ye=0,qe=null;this._flags.inline_frame=!0;do if(Ye+=1,qe=this._tokens.peek(Ye-1),qe.newlines){this._flags.inline_frame=!1;break}while(qe.type!==W.EOF&&!(qe.type===W.END_BLOCK&&qe.opened===v))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==W.OPERATOR&&(Ze||this._flags.last_token.type===W.EQUALS||q(this._flags.last_token,te)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(C(this._previous_flags.mode)&&(this._flags.last_token.type===W.START_EXPR||this._flags.last_token.type===W.COMMA)&&((this._flags.last_token.type===W.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===W.COMMA||this._flags.last_token.type===W.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(v),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==W.OPERATOR&&this._flags.last_token.type!==W.START_EXPR&&(I(this._flags.last_token.type,[W.START_BLOCK,W.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(v),this.indent(),!Oe&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},j.prototype.handle_end_block=function(v){for(this.handle_whitespace_and_comments(v);this._flags.mode===Pe.Statement;)this.restore_mode();var P=this._flags.last_token.type===W.START_BLOCK;this._flags.inline_frame&&!P?this._output.space_before_token=!0:this._options.brace_style==="expand"?P||this.print_newline():P||(C(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(v)},j.prototype.handle_word=function(v){if(v.type===W.RESERVED){if(I(v.text,["set","get"])&&this._flags.mode!==Pe.ObjectLiteral)v.type=W.WORD;else if(v.text==="import"&&I(this._tokens.peek().text,["(","."]))v.type=W.WORD;else if(I(v.text,["as","from"])&&!this._flags.import_block)v.type=W.WORD;else if(this._flags.mode===Pe.ObjectLiteral){var P=this._tokens.peek();P.text===":"&&(v.type=W.WORD)}}if(this.start_of_statement(v)?q(this._flags.last_token,["var","let","const"])&&v.type===W.WORD&&(this._flags.declaration_statement=!0):v.newlines&&!G(this._flags.mode)&&(this._flags.last_token.type!==W.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==W.EQUALS&&(this._options.preserve_newlines||!q(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(v),this.print_newline()):this.handle_whitespace_and_comments(v),this._flags.do_block&&!this._flags.do_while)if(D(v,"while")){this._output.space_before_token=!0,this.print_token(v),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&&D(v,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Pe.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&q(v,["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(v),this._flags.in_case=!0;return}if((this._flags.last_token.type===W.COMMA||this._flags.last_token.type===W.START_EXPR||this._flags.last_token.type===W.EQUALS||this._flags.last_token.type===W.OPERATOR)&&!this.start_of_object_property()&&!(I(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===Pe.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(v),D(v,"function")){(I(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(I(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===W.OPERATOR))&&!this._output.just_added_blankline()&&!v.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===W.RESERVED||this._flags.last_token.type===W.WORD?q(this._flags.last_token,["get","set","new","export"])||q(this._flags.last_token,_)?this._output.space_before_token=!0:D(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===W.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(G(this._flags.mode)||C(this._flags.mode))||this.print_newline(),this.print_token(v),this._flags.last_word=v.text;return}var re="NONE";if(this._flags.last_token.type===W.END_BLOCK?this._previous_flags.inline_frame?re="SPACE":q(v,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines?re="NEWLINE":(re="SPACE",this._output.space_before_token=!0):re="NEWLINE":this._flags.last_token.type===W.SEMICOLON&&this._flags.mode===Pe.BlockStatement?re="NEWLINE":this._flags.last_token.type===W.SEMICOLON&&G(this._flags.mode)?re="SPACE":this._flags.last_token.type===W.STRING?re="NEWLINE":this._flags.last_token.type===W.RESERVED||this._flags.last_token.type===W.WORD||this._flags.last_token.text==="*"&&(I(this._last_last_text,["function","yield"])||this._flags.mode===Pe.ObjectLiteral&&I(this._last_last_text,["{",","]))?re="SPACE":this._flags.last_token.type===W.START_BLOCK?this._flags.inline_frame?re="SPACE":re="NEWLINE":this._flags.last_token.type===W.END_EXPR&&(this._output.space_before_token=!0,re="NEWLINE"),q(v,F)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?re="SPACE":re="NEWLINE"),q(v,["else","catch","finally"]))if((!(this._flags.last_token.type===W.END_BLOCK&&this._previous_flags.mode===Pe.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&v.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var Oe=this._output.current_line;Oe.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else re==="NEWLINE"?q(this._flags.last_token,te)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&q(v,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==W.END_EXPR?(this._flags.last_token.type!==W.START_EXPR||!q(v,["var","let","const"]))&&this._flags.last_token.text!==":"&&(D(v,"if")&&D(v.previous,"else")?this._output.space_before_token=!0:this.print_newline()):q(v,F)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&C(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():re==="SPACE"&&(this._output.space_before_token=!0);v.previous&&(v.previous.type===W.WORD||v.previous.type===W.RESERVED)&&(this._output.space_before_token=!0),this.print_token(v),this._flags.last_word=v.text,v.type===W.RESERVED&&(v.text==="do"?this._flags.do_block=!0:v.text==="if"?this._flags.if_block=!0:v.text==="import"?this._flags.import_block=!0:this._flags.import_block&&D(v,"from")&&(this._flags.import_block=!1))},j.prototype.handle_semicolon=function(v){this.start_of_statement(v)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(v);for(var P=this._tokens.peek();this._flags.mode===Pe.Statement&&!(this._flags.if_block&&D(P,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(v)},j.prototype.handle_string=function(v){v.text.startsWith("`")&&v.newlines===0&&v.whitespace_before===""&&(v.previous.text===")"||this._flags.last_token.type===W.WORD)||(this.start_of_statement(v)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(v),this._flags.last_token.type===W.RESERVED||this._flags.last_token.type===W.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===W.COMMA||this._flags.last_token.type===W.START_EXPR||this._flags.last_token.type===W.EQUALS||this._flags.last_token.type===W.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(v):v.text.startsWith("`")&&this._flags.last_token.type===W.END_EXPR&&(v.previous.text==="]"||v.previous.text===")")&&v.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(v)},j.prototype.handle_equals=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0},j.prototype.handle_comma=function(v){this.handle_whitespace_and_comments(v,!0),this.print_token(v),this._output.space_before_token=!0,this._flags.declaration_statement?(G(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(v)):this._flags.mode===Pe.ObjectLiteral||this._flags.mode===Pe.Statement&&this._flags.parent.mode===Pe.ObjectLiteral?(this._flags.mode===Pe.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(v)},j.prototype.handle_operator=function(v){var P=v.text==="*"&&(q(this._flags.last_token,["function","yield"])||I(this._flags.last_token.type,[W.START_BLOCK,W.COMMA,W.END_BLOCK,W.SEMICOLON])),re=I(v.text,["-","+"])&&(I(this._flags.last_token.type,[W.START_BLOCK,W.START_EXPR,W.EQUALS,W.OPERATOR])||I(this._flags.last_token.text,F)||this._flags.last_token.text===",");if(!this.start_of_statement(v)){var Oe=!P;this.handle_whitespace_and_comments(v,Oe)}if(v.text==="*"&&this._flags.last_token.type===W.DOT){this.print_token(v);return}if(v.text==="::"){this.print_token(v);return}if(I(v.text,["-","+"])&&this.start_of_object_property()){this.print_token(v);return}if(this._flags.last_token.type===W.OPERATOR&&I(this._options.operator_position,we)&&this.allow_wrap_or_preserved_newline(v),v.text===":"&&this._flags.in_case){this.print_token(v),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==W.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 Ze=!0,Ye=!0,qe=!1;if(v.text===":"?this._flags.ternary_depth===0?Ze=!1:(this._flags.ternary_depth-=1,qe=!0):v.text==="?"&&(this._flags.ternary_depth+=1),!re&&!P&&this._options.preserve_newlines&&I(v.text,Z)){var ft=v.text===":",vt=ft&&qe,Ae=ft&&!qe;switch(this._options.operator_position){case ce.before_newline:this._output.space_before_token=!Ae,this.print_token(v),(!ft||vt)&&this.allow_wrap_or_preserved_newline(v),this._output.space_before_token=!0;return;case ce.after_newline:this._output.space_before_token=!0,!ft||vt?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(v):this._output.space_before_token=!1,this.print_token(v),this._output.space_before_token=!0;return;case ce.preserve_newline:Ae||this.allow_wrap_or_preserved_newline(v),Ze=!(this._output.just_added_newline()||Ae),this._output.space_before_token=Ze,this.print_token(v),this._output.space_before_token=!0;return}}if(P){this.allow_wrap_or_preserved_newline(v),Ze=!1;var wt=this._tokens.peek();Ye=wt&&I(wt.type,[W.WORD,W.RESERVED])}else if(v.text==="...")this.allow_wrap_or_preserved_newline(v),Ze=this._flags.last_token.type===W.START_BLOCK,Ye=!1;else if(I(v.text,["--","++","!","~"])||re){if((this._flags.last_token.type===W.COMMA||this._flags.last_token.type===W.START_EXPR)&&this.allow_wrap_or_preserved_newline(v),Ze=!1,Ye=!1,v.newlines&&(v.text==="--"||v.text==="++"||v.text==="~")){var rt=q(this._flags.last_token,te)&&v.newlines;rt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(rt,!0)}this._flags.last_token.text===";"&&G(this._flags.mode)&&(Ze=!0),this._flags.last_token.type===W.RESERVED?Ze=!0:this._flags.last_token.type===W.END_EXPR?Ze=!(this._flags.last_token.text==="]"&&(v.text==="--"||v.text==="++")):this._flags.last_token.type===W.OPERATOR&&(Ze=I(v.text,["--","-","++","+"])&&I(this._flags.last_token.text,["--","-","++","+"]),I(v.text,["+","-"])&&I(this._flags.last_token.text,["--","++"])&&(Ye=!0)),(this._flags.mode===Pe.BlockStatement&&!this._flags.inline_frame||this._flags.mode===Pe.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||Ze,this.print_token(v),this._output.space_before_token=Ye},j.prototype.handle_block_comment=function(v,P){if(this._output.raw){this._output.add_raw_token(v),v.directives&&v.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(v.directives){this.print_newline(!1,P),this.print_token(v),v.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!m.newline.test(v.text)&&!v.newlines){this._output.space_before_token=!0,this.print_token(v),this._output.space_before_token=!0;return}else this.print_block_commment(v,P)},j.prototype.print_block_commment=function(v,P){var re=V(v.text),Oe,Ze=!1,Ye=!1,qe=v.whitespace_before,ft=qe.length;if(this.print_newline(!1,P),this.print_token_line_indentation(v),this._output.add_token(re[0]),this.print_newline(!1,P),re.length>1){for(re=re.slice(1),Ze=H(re,"*"),Ye=Q(re,qe),Ze&&(this._flags.alignment=1),Oe=0;Oe<re.length;Oe++)Ze?(this.print_token_line_indentation(v),this._output.add_token(N(re[Oe]))):Ye&&re[Oe]?(this.print_token_line_indentation(v),this._output.add_token(re[Oe].substring(ft))):(this._output.current_line.set_indent(-1),this._output.add_token(re[Oe])),this.print_newline(!1,P);this._flags.alignment=0}},j.prototype.handle_comment=function(v,P){v.newlines?this.print_newline(!1,P):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(v),this.print_newline(!1,P)},j.prototype.handle_dot=function(v){this.start_of_statement(v)||this.handle_whitespace_and_comments(v,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),q(this._flags.last_token,te)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(v,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(v)},j.prototype.handle_unknown=function(v,P){this.print_token(v),v.text[v.text.length-1]===`
`&&this.print_newline(!1,P)},j.prototype.handle_eof=function(v){for(;this._flags.mode===Pe.Statement;)this.restore_mode();this.handle_whitespace_and_comments(v)},le.exports.Beautifier=j},function(le){function l(h){this.__parent=h,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 h=new l(this.__parent);return h.set_indent(this.__indent_count,this.__alignment_count),h},l.prototype.item=function(h){return h<0?this.__items[this.__items.length+h]:this.__items[h]},l.prototype.has_match=function(h){for(var m=this.__items.length-1;m>=0;m--)if(this.__items[m].match(h))return!0;return!1},l.prototype.set_indent=function(h,m){this.is_empty()&&(this.__indent_count=h||0,this.__alignment_count=m||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 h=this.__parent.current_line;return h.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),h.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),h.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,h.__items[0]===" "&&(h.__items.splice(0,1),h.__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(h){this.__items.push(h);var m=h.lastIndexOf(`
`);m!==-1?this.__character_count=h.length-m:this.__character_count+=h.length},l.prototype.pop=function(){var h=null;return this.is_empty()||(h=this.__items.pop(),this.__character_count-=h.length),h},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 h="";return this.is_empty()?this.__parent.indent_empty_lines&&(h=this.__parent.get_indent_string(this.__indent_count)):(h=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),h+=this.__items.join("")),h};function x(h,m){this.__cache=[""],this.__indent_size=h.indent_size,this.__indent_string=h.indent_char,h.indent_with_tabs||(this.__indent_string=new Array(h.indent_size+1).join(h.indent_char)),m=m||"",h.indent_level>0&&(m=new Array(h.indent_level+1).join(this.__indent_string)),this.__base_string=m,this.__base_string_length=m.length}x.prototype.get_indent_size=function(h,m){var y=this.__base_string_length;return m=m||0,h<0&&(y=0),y+=h*this.__indent_size,y+=m,y},x.prototype.get_indent_string=function(h,m){var y=this.__base_string;return m=m||0,h<0&&(h=0,y=""),m+=h*this.__indent_size,this.__ensure_cache(m),y+=this.__cache[m],y},x.prototype.__ensure_cache=function(h){for(;h>=this.__cache.length;)this.__add_column()},x.prototype.__add_column=function(){var h=this.__cache.length,m=0,y="";this.__indent_size&&h>=this.__indent_size&&(m=Math.floor(h/this.__indent_size),h-=m*this.__indent_size,y=new Array(m+1).join(this.__indent_string)),h&&(y+=new Array(h+1).join(" ")),this.__cache.push(y)};function A(h,m){this.__indent_cache=new x(h,m),this.raw=!1,this._end_with_newline=h.end_with_newline,this.indent_size=h.indent_size,this.wrap_line_length=h.wrap_line_length,this.indent_empty_lines=h.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()}A.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},A.prototype.get_line_number=function(){return this.__lines.length},A.prototype.get_indent_string=function(h,m){return this.__indent_cache.get_indent_string(h,m)},A.prototype.get_indent_size=function(h,m){return this.__indent_cache.get_indent_size(h,m)},A.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},A.prototype.add_new_line=function(h){return this.is_empty()||!h&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},A.prototype.get_code=function(h){this.trim(!0);var m=this.current_line.pop();m&&(m[m.length-1]===`
`&&(m=m.replace(/\n+$/g,"")),this.current_line.push(m)),this._end_with_newline&&this.__add_outputline();var y=this.__lines.join(`
`);return h!==`
`&&(y=y.replace(/[\n]/g,h)),y},A.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},A.prototype.set_indent=function(h,m){return h=h||0,m=m||0,this.next_line.set_indent(h,m),this.__lines.length>1?(this.current_line.set_indent(h,m),!0):(this.current_line.set_indent(),!1)},A.prototype.add_raw_token=function(h){for(var m=0;m<h.newlines;m++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(h.whitespace_before),this.current_line.push(h.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},A.prototype.add_token=function(h){this.__add_space_before_token(),this.current_line.push(h),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},A.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(" "))},A.prototype.remove_indent=function(h){for(var m=this.__lines.length;h<m;)this.__lines[h]._remove_indent(),h++;this.current_line._remove_wrap_indent()},A.prototype.trim=function(h){for(h=h===void 0?!1:h,this.current_line.trim();h&&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},A.prototype.just_added_newline=function(){return this.current_line.is_empty()},A.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},A.prototype.ensure_empty_line_above=function(h,m){for(var y=this.__lines.length-2;y>=0;){var S=this.__lines[y];if(S.is_empty())break;if(S.item(0).indexOf(h)!==0&&S.item(-1)!==m){this.__lines.splice(y+1,0,new l(this)),this.previous_line=this.__lines[this.__lines.length-2];break}y--}},le.exports.Output=A},function(le){function l(x,A,h,m){this.type=x,this.text=A,this.comments_before=null,this.newlines=h||0,this.whitespace_before=m||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}le.exports.Token=l},function(le,l){var x="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",A="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",h="\\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",m="\\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",y="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",S="(?:"+y+"|["+x+h+"])",F="(?:"+y+"|["+A+h+m+"])*";l.identifier=new RegExp(S+F,"g"),l.identifierStart=new RegExp(S),l.identifierMatch=new RegExp("(?:"+y+"|["+A+h+m+"])+");var Z=/[\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(le,l,x){var A=x(6).Options,h=["before-newline","after-newline","preserve-newline"];function m(y){A.call(this,y,"js");var S=this.raw_options.brace_style||null;S==="expand-strict"?this.raw_options.brace_style="expand":S==="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 F=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var Z=0;Z<F.length;Z++)F[Z]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=F[Z];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",h),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}m.prototype=new A,le.exports.Options=m},function(le){function l(h,m){this.raw_options=x(h,m),this.disabled=this._get_boolean("disabled"),this.eol=this._get_characters("eol","auto"),this.end_with_newline=this._get_boolean("end_with_newline"),this.indent_size=this._get_number("indent_size",4),this.indent_char=this._get_characters("indent_char"," "),this.indent_level=this._get_number("indent_level"),this.preserve_newlines=this._get_boolean("preserve_newlines",!0),this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786),this.preserve_newlines||(this.max_preserve_newlines=0),this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char===" "),this.indent_with_tabs&&(this.indent_char=" ",this.indent_size===1&&(this.indent_size=4)),this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char")),this.indent_empty_lines=this._get_boolean("indent_empty_lines"),this.templating=this._get_selection_list("templating",["auto","none","angular","django","erb","handlebars","php","smarty"],["auto"])}l.prototype._get_array=function(h,m){var y=this.raw_options[h],S=m||[];return typeof y=="object"?y!==null&&typeof y.concat=="function"&&(S=y.concat()):typeof y=="string"&&(S=y.split(/[^a-zA-Z0-9_\/\-]+/)),S},l.prototype._get_boolean=function(h,m){var y=this.raw_options[h],S=y===void 0?!!m:!!y;return S},l.prototype._get_characters=function(h,m){var y=this.raw_options[h],S=m||"";return typeof y=="string"&&(S=y.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),S},l.prototype._get_number=function(h,m){var y=this.raw_options[h];m=parseInt(m,10),isNaN(m)&&(m=0);var S=parseInt(y,10);return isNaN(S)&&(S=m),S},l.prototype._get_selection=function(h,m,y){var S=this._get_selection_list(h,m,y);if(S.length!==1)throw new Error("Invalid Option Value: The option '"+h+`' can only be one of the following values:
`+m+`
You passed in: '`+this.raw_options[h]+"'");return S[0]},l.prototype._get_selection_list=function(h,m,y){if(!m||m.length===0)throw new Error("Selection list cannot be empty.");if(y=y||[m[0]],!this._is_valid_selection(y,m))throw new Error("Invalid Default Value!");var S=this._get_array(h,y);if(!this._is_valid_selection(S,m))throw new Error("Invalid Option Value: The option '"+h+`' can contain only the following values:
`+m+`
You passed in: '`+this.raw_options[h]+"'");return S},l.prototype._is_valid_selection=function(h,m){return h.length&&m.length&&!h.some(function(y){return m.indexOf(y)===-1})};function x(h,m){var y={};h=A(h);var S;for(S in h)S!==m&&(y[S]=h[S]);if(m&&h[m])for(S in h[m])y[S]=h[m][S];return y}function A(h){var m={},y;for(y in h){var S=y.replace(/-/g,"_");m[S]=h[y]}return m}le.exports.Options=l,le.exports.normalizeOpts=A,le.exports.mergeOpts=x},function(le,l,x){var A=x(8).InputScanner,h=x(9).Tokenizer,m=x(9).TOKEN,y=x(13).Directives,S=x(4),F=x(12).Pattern,Z=x(14).TemplatablePattern;function W(H,Q){return Q.indexOf(H)!==-1}var I={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:m.START,RAW:m.RAW,EOF:m.EOF},N=new y(/\/\*/,/\*\//),T=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,D=/[0-9]/,q=/[^\d\.]/,te=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),X=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";X=X.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),X="\\?\\.(?!\\d) "+X,X=X.replace(/ /g,"|");var ce=new RegExp(X),we="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Pe=we.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Ve=new RegExp("^(?:"+Pe.join("|")+")$"),V,C=function(H,Q){h.call(this,H,Q),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var j=new F(this._input),_=new Z(this._input).read_options(this._options);this.__patterns={template:_,identifier:_.starting_with(S.identifier).matching(S.identifierMatch),number:j.matching(T),punct:j.matching(ce),comment:j.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:j.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:j.matching(/<!--/),html_comment_end:j.matching(/-->/),include:j.starting_with(/#include/).until_after(S.lineBreak),shebang:j.starting_with(/#!/).until_after(S.lineBreak),xml:j.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:_.until(/['\\\n\r\u2028\u2029]/),double_quote:_.until(/["\\\n\r\u2028\u2029]/),template_text:_.until(/[`\\$]/),template_expression:_.until(/[`}\\]/)}};C.prototype=new h,C.prototype._is_comment=function(H){return H.type===I.COMMENT||H.type===I.BLOCK_COMMENT||H.type===I.UNKNOWN},C.prototype._is_opening=function(H){return H.type===I.START_BLOCK||H.type===I.START_EXPR},C.prototype._is_closing=function(H,Q){return(H.type===I.END_BLOCK||H.type===I.END_EXPR)&&Q&&(H.text==="]"&&Q.text==="["||H.text===")"&&Q.text==="("||H.text==="}"&&Q.text==="{")},C.prototype._reset=function(){V=!1},C.prototype._get_next_token=function(H,Q){var j=null;this._readWhitespace();var _=this._input.peek();return _===null?this._create_token(I.EOF,""):(j=j||this._read_non_javascript(_),j=j||this._read_string(_),j=j||this._read_pair(_,this._input.peek(1)),j=j||this._read_word(H),j=j||this._read_singles(_),j=j||this._read_comment(_),j=j||this._read_regexp(_,H),j=j||this._read_xml(_,H),j=j||this._read_punctuation(),j=j||this._create_token(I.UNKNOWN,this._input.next()),j)},C.prototype._read_word=function(H){var Q;if(Q=this.__patterns.identifier.read(),Q!=="")return Q=Q.replace(S.allLineBreaks,`
`),!(H.type===I.DOT||H.type===I.RESERVED&&(H.text==="set"||H.text==="get"))&&Ve.test(Q)?(Q==="in"||Q==="of")&&(H.type===I.WORD||H.type===I.STRING)?this._create_token(I.OPERATOR,Q):this._create_token(I.RESERVED,Q):this._create_token(I.WORD,Q);if(Q=this.__patterns.number.read(),Q!=="")return this._create_token(I.WORD,Q)},C.prototype._read_singles=function(H){var Q=null;return H==="("||H==="["?Q=this._create_token(I.START_EXPR,H):H===")"||H==="]"?Q=this._create_token(I.END_EXPR,H):H==="{"?Q=this._create_token(I.START_BLOCK,H):H==="}"?Q=this._create_token(I.END_BLOCK,H):H===";"?Q=this._create_token(I.SEMICOLON,H):H==="."&&q.test(this._input.peek(1))?Q=this._create_token(I.DOT,H):H===","&&(Q=this._create_token(I.COMMA,H)),Q&&this._input.next(),Q},C.prototype._read_pair=function(H,Q){var j=null;return H==="#"&&Q==="{"&&(j=this._create_token(I.START_BLOCK,H+Q)),j&&(this._input.next(),this._input.next()),j},C.prototype._read_punctuation=function(){var H=this.__patterns.punct.read();if(H!=="")return H==="="?this._create_token(I.EQUALS,H):H==="?."?this._create_token(I.DOT,H):this._create_token(I.OPERATOR,H)},C.prototype._read_non_javascript=function(H){var Q="";if(H==="#"){if(this._is_first_token()&&(Q=this.__patterns.shebang.read(),Q))return this._create_token(I.UNKNOWN,Q.trim()+`
`);if(Q=this.__patterns.include.read(),Q)return this._create_token(I.UNKNOWN,Q.trim()+`
`);H=this._input.next();var j="#";if(this._input.hasNext()&&this._input.testChar(D)){do H=this._input.next(),j+=H;while(this._input.hasNext()&&H!=="#"&&H!=="=");return H==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(j+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(j+="{}",this._input.next(),this._input.next())),this._create_token(I.WORD,j)}this._input.back()}else if(H==="<"&&this._is_first_token()){if(Q=this.__patterns.html_comment_start.read(),Q){for(;this._input.hasNext()&&!this._input.testChar(S.newline);)Q+=this._input.next();return V=!0,this._create_token(I.COMMENT,Q)}}else if(V&&H==="-"&&(Q=this.__patterns.html_comment_end.read(),Q))return V=!1,this._create_token(I.COMMENT,Q);return null},C.prototype._read_comment=function(H){var Q=null;if(H==="/"){var j="";if(this._input.peek(1)==="*"){j=this.__patterns.block_comment.read();var _=N.get_directives(j);_&&_.ignore==="start"&&(j+=N.readIgnored(this._input)),j=j.replace(S.allLineBreaks,`
`),Q=this._create_token(I.BLOCK_COMMENT,j),Q.directives=_}else this._input.peek(1)==="/"&&(j=this.__patterns.comment.read(),Q=this._create_token(I.COMMENT,j))}return Q},C.prototype._read_string=function(H){if(H==="`"||H==="'"||H==='"'){var Q=this._input.next();return this.has_char_escapes=!1,H==="`"?Q+=this._read_string_recursive("`",!0,"${"):Q+=this._read_string_recursive(H),this.has_char_escapes&&this._options.unescape_strings&&(Q=G(Q)),this._input.peek()===H&&(Q+=this._input.next()),Q=Q.replace(S.allLineBreaks,`
`),this._create_token(I.STRING,Q)}return null},C.prototype._allow_regexp_or_xml=function(H){return H.type===I.RESERVED&&W(H.text,["return","case","throw","else","do","typeof","yield"])||H.type===I.END_EXPR&&H.text===")"&&H.opened.previous.type===I.RESERVED&&W(H.opened.previous.text,["if","while","for"])||W(H.type,[I.COMMENT,I.START_EXPR,I.START_BLOCK,I.START,I.END_BLOCK,I.OPERATOR,I.EQUALS,I.EOF,I.SEMICOLON,I.COMMA])},C.prototype._read_regexp=function(H,Q){if(H==="/"&&this._allow_regexp_or_xml(Q)){for(var j=this._input.next(),_=!1,v=!1;this._input.hasNext()&&(_||v||this._input.peek()!==H)&&!this._input.testChar(S.newline);)j+=this._input.peek(),_?_=!1:(_=this._input.peek()==="\\",this._input.peek()==="["?v=!0:this._input.peek()==="]"&&(v=!1)),this._input.next();return this._input.peek()===H&&(j+=this._input.next(),j+=this._input.read(S.identifier)),this._create_token(I.STRING,j)}return null},C.prototype._read_xml=function(H,Q){if(this._options.e4x&&H==="<"&&this._allow_regexp_or_xml(Q)){var j="",_=this.__patterns.xml.read_match();if(_){for(var v=_[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),P=v.indexOf("{")===0,re=0;_;){var Oe=!!_[1],Ze=_[2],Ye=!!_[_.length-1]||Ze.slice(0,8)==="![CDATA[";if(!Ye&&(Ze===v||P&&Ze.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(Oe?--re:++re),j+=_[0],re<=0)break;_=this.__patterns.xml.read_match()}return _||(j+=this._input.match(/[\s\S]*/g)[0]),j=j.replace(S.allLineBreaks,`
`),this._create_token(I.STRING,j)}}return null};function G(H){for(var Q="",j=0,_=new A(H),v=null;_.hasNext();)if(v=_.match(/([\s]|[^\\]|\\\\)+/g),v&&(Q+=v[0]),_.peek()==="\\"){if(_.next(),_.peek()==="x")v=_.match(/x([0-9A-Fa-f]{2})/g);else if(_.peek()==="u")v=_.match(/u([0-9A-Fa-f]{4})/g),v||(v=_.match(/u\{([0-9A-Fa-f]+)\}/g));else{Q+="\\",_.hasNext()&&(Q+=_.next());continue}if(!v||(j=parseInt(v[1],16),j>126&&j<=255&&v[0].indexOf("x")===0))return H;j>=0&&j<32||j>1114111?Q+="\\"+v[0]:j===34||j===39||j===92?Q+="\\"+String.fromCharCode(j):Q+=String.fromCharCode(j)}return Q}C.prototype._read_string_recursive=function(H,Q,j){var _,v;H==="'"?v=this.__patterns.single_quote:H==='"'?v=this.__patterns.double_quote:H==="`"?v=this.__patterns.template_text:H==="}"&&(v=this.__patterns.template_expression);for(var P=v.read(),re="";this._input.hasNext();){if(re=this._input.next(),re===H||!Q&&S.newline.test(re)){this._input.back();break}else re==="\\"&&this._input.hasNext()?(_=this._input.peek(),_==="x"||_==="u"?this.has_char_escapes=!0:_==="\r"&&this._input.peek(1)===`
`&&this._input.next(),re+=this._input.next()):j&&(j==="${"&&re==="$"&&this._input.peek()==="{"&&(re+=this._input.next()),j===re&&(H==="`"?re+=this._read_string_recursive("}",Q,"`"):re+=this._read_string_recursive("`",Q,"${"),this._input.hasNext()&&(re+=this._input.next())));re+=v.read(),P+=re}return P},le.exports.Tokenizer=C,le.exports.TOKEN=I,le.exports.positionable_operators=te.slice(),le.exports.line_starters=we.slice()},function(le){var l=RegExp.prototype.hasOwnProperty("sticky");function x(A){this.__input=A||"",this.__input_length=this.__input.length,this.__position=0}x.prototype.restart=function(){this.__position=0},x.prototype.back=function(){this.__position>0&&(this.__position-=1)},x.prototype.hasNext=function(){return this.__position<this.__input_length},x.prototype.next=function(){var A=null;return this.hasNext()&&(A=this.__input.charAt(this.__position),this.__position+=1),A},x.prototype.peek=function(A){var h=null;return A=A||0,A+=this.__position,A>=0&&A<this.__input_length&&(h=this.__input.charAt(A)),h},x.prototype.__match=function(A,h){A.lastIndex=h;var m=A.exec(this.__input);return m&&!(l&&A.sticky)&&m.index!==h&&(m=null),m},x.prototype.test=function(A,h){return h=h||0,h+=this.__position,h>=0&&h<this.__input_length?!!this.__match(A,h):!1},x.prototype.testChar=function(A,h){var m=this.peek(h);return A.lastIndex=0,m!==null&&A.test(m)},x.prototype.match=function(A){var h=this.__match(A,this.__position);return h?this.__position+=h[0].length:h=null,h},x.prototype.read=function(A,h,m){var y="",S;return A&&(S=this.match(A),S&&(y+=S[0])),h&&(S||!A)&&(y+=this.readUntil(h,m)),y},x.prototype.readUntil=function(A,h){var m="",y=this.__position;A.lastIndex=this.__position;var S=A.exec(this.__input);return S?(y=S.index,h&&(y+=S[0].length)):y=this.__input_length,m=this.__input.substring(this.__position,y),this.__position=y,m},x.prototype.readUntilAfter=function(A){return this.readUntil(A,!0)},x.prototype.get_regexp=function(A,h){var m=null,y="g";return h&&l&&(y="y"),typeof A=="string"&&A!==""?m=new RegExp(A,y):A&&(m=new RegExp(A.source,y)),m},x.prototype.get_literal_regexp=function(A){return RegExp(A.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},x.prototype.peekUntilAfter=function(A){var h=this.__position,m=this.readUntilAfter(A);return this.__position=h,m},x.prototype.lookBack=function(A){var h=this.__position-1;return h>=A.length&&this.__input.substring(h-A.length,h).toLowerCase()===A},le.exports.InputScanner=x},function(le,l,x){var A=x(8).InputScanner,h=x(3).Token,m=x(10).TokenStream,y=x(11).WhitespacePattern,S={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},F=function(Z,W){this._input=new A(Z),this._options=W||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new y(this._input)};F.prototype.tokenize=function(){this._input.restart(),this.__tokens=new m,this._reset();for(var Z,W=new h(S.START,""),I=null,N=[],T=new m;W.type!==S.EOF;){for(Z=this._get_next_token(W,I);this._is_comment(Z);)T.add(Z),Z=this._get_next_token(W,I);T.isEmpty()||(Z.comments_before=T,T=new m),Z.parent=I,this._is_opening(Z)?(N.push(I),I=Z):I&&this._is_closing(Z,I)&&(Z.opened=I,I.closed=Z,I=N.pop(),Z.parent=I),Z.previous=W,W.next=Z,this.__tokens.add(Z),W=Z}return this.__tokens},F.prototype._is_first_token=function(){return this.__tokens.isEmpty()},F.prototype._reset=function(){},F.prototype._get_next_token=function(Z,W){this._readWhitespace();var I=this._input.read(/.+/g);return I?this._create_token(S.RAW,I):this._create_token(S.EOF,"")},F.prototype._is_comment=function(Z){return!1},F.prototype._is_opening=function(Z){return!1},F.prototype._is_closing=function(Z,W){return!1},F.prototype._create_token=function(Z,W){var I=new h(Z,W,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return I},F.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},le.exports.Tokenizer=F,le.exports.TOKEN=S},function(le){function l(x){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=x}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 x=null;return this.hasNext()&&(x=this.__tokens[this.__position],this.__position+=1),x},l.prototype.peek=function(x){var A=null;return x=x||0,x+=this.__position,x>=0&&x<this.__tokens_length&&(A=this.__tokens[x]),A},l.prototype.add=function(x){this.__parent_token&&(x.parent=this.__parent_token),this.__tokens.push(x),this.__tokens_length+=1},le.exports.TokenStream=l},function(le,l,x){var A=x(12).Pattern;function h(m,y){A.call(this,m,y),y?this._line_regexp=this._input.get_regexp(y._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}h.prototype=new A,h.prototype.__set_whitespace_patterns=function(m,y){m+="\\t ",y+="\\n\\r",this._match_pattern=this._input.get_regexp("["+m+y+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+y+"]")},h.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var m=this._input.read(this._match_pattern);if(m===" ")this.whitespace_before_token=" ";else if(m){var y=this.__split(this._newline_regexp,m);this.newline_count=y.length-1,this.whitespace_before_token=y[this.newline_count]}return m},h.prototype.matching=function(m,y){var S=this._create();return S.__set_whitespace_patterns(m,y),S._update(),S},h.prototype._create=function(){return new h(this._input,this)},h.prototype.__split=function(m,y){m.lastIndex=0;for(var S=0,F=[],Z=m.exec(y);Z;)F.push(y.substring(S,Z.index)),S=Z.index+Z[0].length,Z=m.exec(y);return S<y.length?F.push(y.substring(S,y.length)):F.push(""),F},le.exports.WhitespacePattern=h},function(le){function l(x,A){this._input=x,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,A&&(this._starting_pattern=this._input.get_regexp(A._starting_pattern,!0),this._match_pattern=this._input.get_regexp(A._match_pattern,!0),this._until_pattern=this._input.get_regexp(A._until_pattern),this._until_after=A._until_after)}l.prototype.read=function(){var x=this._input.read(this._starting_pattern);return(!this._starting_pattern||x)&&(x+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),x},l.prototype.read_match=function(){return this._input.match(this._match_pattern)},l.prototype.until_after=function(x){var A=this._create();return A._until_after=!0,A._until_pattern=this._input.get_regexp(x),A._update(),A},l.prototype.until=function(x){var A=this._create();return A._until_after=!1,A._until_pattern=this._input.get_regexp(x),A._update(),A},l.prototype.starting_with=function(x){var A=this._create();return A._starting_pattern=this._input.get_regexp(x,!0),A._update(),A},l.prototype.matching=function(x){var A=this._create();return A._match_pattern=this._input.get_regexp(x,!0),A._update(),A},l.prototype._create=function(){return new l(this._input,this)},l.prototype._update=function(){},le.exports.Pattern=l},function(le){function l(x,A){x=typeof x=="string"?x:x.source,A=typeof A=="string"?A:A.source,this.__directives_block_pattern=new RegExp(x+/ beautify( \w+[:]\w+)+ /.source+A,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(x+/\sbeautify\signore:end\s/.source+A,"g")}l.prototype.get_directives=function(x){if(!x.match(this.__directives_block_pattern))return null;var A={};this.__directive_pattern.lastIndex=0;for(var h=this.__directive_pattern.exec(x);h;)A[h[1]]=h[2],h=this.__directive_pattern.exec(x);return A},l.prototype.readIgnored=function(x){return x.readUntilAfter(this.__directives_end_ignore_pattern)},le.exports.Directives=l},function(le,l,x){var A=x(12).Pattern,h={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function m(y,S){A.call(this,y,S),this.__template_pattern=null,this._disabled=Object.assign({},h),this._excluded=Object.assign({},h),S&&(this.__template_pattern=this._input.get_regexp(S.__template_pattern),this._excluded=Object.assign(this._excluded,S._excluded),this._disabled=Object.assign(this._disabled,S._disabled));var F=new A(y);this.__patterns={handlebars_comment:F.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:F.starting_with(/{{{/).until_after(/}}}/),handlebars:F.starting_with(/{{/).until_after(/}}/),php:F.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:F.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:F.starting_with(/{%/).until_after(/%}/),django_value:F.starting_with(/{{/).until_after(/}}/),django_comment:F.starting_with(/{#/).until_after(/#}/),smarty:F.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:F.starting_with(/{\*/).until_after(/\*}/),smarty_literal:F.starting_with(/{literal}/).until_after(/{\/literal}/)}}m.prototype=new A,m.prototype._create=function(){return new m(this._input,this)},m.prototype._update=function(){this.__set_templated_pattern()},m.prototype.disable=function(y){var S=this._create();return S._disabled[y]=!0,S._update(),S},m.prototype.read_options=function(y){var S=this._create();for(var F in h)S._disabled[F]=y.templating.indexOf(F)===-1;return S._update(),S},m.prototype.exclude=function(y){var S=this._create();return S._excluded[y]=!0,S._update(),S},m.prototype.read=function(){var y="";this._match_pattern?y=this._input.read(this._starting_pattern):y=this._input.read(this._starting_pattern,this.__template_pattern);for(var S=this._read_template();S;)this._match_pattern?S+=this._input.read(this._match_pattern):S+=this._input.readUntil(this.__template_pattern),y+=S,S=this._read_template();return this._until_after&&(y+=this._input.readUntilAfter(this._until_pattern)),y},m.prototype.__set_templated_pattern=function(){var y=[];this._disabled.php||y.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||y.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||y.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||y.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(y.push(this.__patterns.django._starting_pattern.source),y.push(this.__patterns.django_value._starting_pattern.source),y.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||y.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&y.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+y.join("|")+")")},m.prototype._read_template=function(){var y="",S=this._input.peek();if(S==="<"){var F=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&F==="?"&&(y=y||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&F==="%"&&(y=y||this.__patterns.erb.read())}else S==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(y=y||this.__patterns.handlebars_comment.read(),y=y||this.__patterns.handlebars_unescaped.read(),y=y||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(y=y||this.__patterns.django_value.read()),this._excluded.django||(y=y||this.__patterns.django_comment.read(),y=y||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(y=y||this.__patterns.smarty_comment.read(),y=y||this.__patterns.smarty_literal.read(),y=y||this.__patterns.smarty.read()));return y},le.exports.TemplatablePattern=m}],$={};function p(le){var l=$[le];if(l!==void 0)return l.exports;var x=$[le]={exports:{}};return ue[le](x,x.exports,p),x.exports}var ge=p(0);fe=ge})();var Te=fe;w=[],L=function(){return{js_beautify:Te}}.apply(_t,w),L!==void 0&&(_n.exports=L)})()},32834:function(_n){(function(_t,w){_n.exports=w()})(this,function(){"use strict";function _t(Ne,Se){for(var Ie=0;Ie<Se.length;Ie++){var U=Se[Ie];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(Ne,U.key,U)}}function w(Ne,Se,Ie){return Se&&_t(Ne.prototype,Se),Ie&&_t(Ne,Ie),Ne}function L(Ne,Se){if(Ne){if(typeof Ne=="string")return fe(Ne,Se);var Ie=Object.prototype.toString.call(Ne).slice(8,-1);if(Ie==="Object"&&Ne.constructor&&(Ie=Ne.constructor.name),Ie==="Map"||Ie==="Set")return Array.from(Ne);if(Ie==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ie))return fe(Ne,Se)}}function fe(Ne,Se){(Se==null||Se>Ne.length)&&(Se=Ne.length);for(var Ie=0,U=new Array(Se);Ie<Se;Ie++)U[Ie]=Ne[Ie];return U}function Te(Ne,Se){var Ie=typeof Symbol!="undefined"&&Ne[Symbol.iterator]||Ne["@@iterator"];if(Ie)return(Ie=Ie.call(Ne)).next.bind(Ie);if(Array.isArray(Ne)||(Ie=L(Ne))||Se&&Ne&&typeof Ne.length=="number"){Ie&&(Ne=Ie);var U=0;return function(){return U>=Ne.length?{done:!0}:{done:!1,value:Ne[U++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ue={exports:{}};function $(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function p(Ne){ue.exports.defaults=Ne}ue.exports={defaults:$(),getDefaults:$,changeDefaults:p};var ge=/[&<>"']/,le=/[&<>"']/g,l=/[<>"']|&(?!#?\w+;)/,x=/[<>"']|&(?!#?\w+;)/g,A={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},h=function(Se){return A[Se]};function m(Ne,Se){if(Se){if(ge.test(Ne))return Ne.replace(le,h)}else if(l.test(Ne))return Ne.replace(x,h);return Ne}var y=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function S(Ne){return Ne.replace(y,function(Se,Ie){return Ie=Ie.toLowerCase(),Ie==="colon"?":":Ie.charAt(0)==="#"?Ie.charAt(1)==="x"?String.fromCharCode(parseInt(Ie.substring(2),16)):String.fromCharCode(+Ie.substring(1)):""})}var F=/(^|[^\[])\^/g;function Z(Ne,Se){Ne=Ne.source||Ne,Se=Se||"";var Ie={replace:function(z,pe){return pe=pe.source||pe,pe=pe.replace(F,"$1"),Ne=Ne.replace(z,pe),Ie},getRegex:function(){return new RegExp(Ne,Se)}};return Ie}var W=/[^\w:]/g,I=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function N(Ne,Se,Ie){if(Ne){var U;try{U=decodeURIComponent(S(Ie)).replace(W,"").toLowerCase()}catch(z){return null}if(U.indexOf("javascript:")===0||U.indexOf("vbscript:")===0||U.indexOf("data:")===0)return null}Se&&!I.test(Ie)&&(Ie=X(Se,Ie));try{Ie=encodeURI(Ie).replace(/%25/g,"%")}catch(z){return null}return Ie}var T={},D=/^[^:]+:\/*[^/]*$/,q=/^([^:]+:)[\s\S]*$/,te=/^([^:]+:\/*[^/]*)[\s\S]*$/;function X(Ne,Se){T[" "+Ne]||(D.test(Ne)?T[" "+Ne]=Ne+"/":T[" "+Ne]=Ve(Ne,"/",!0)),Ne=T[" "+Ne];var Ie=Ne.indexOf(":")===-1;return Se.substring(0,2)==="//"?Ie?Se:Ne.replace(q,"$1")+Se:Se.charAt(0)==="/"?Ie?Se:Ne.replace(te,"$1")+Se:Ne+Se}var ce={exec:function(){}};function we(Ne){for(var Se=1,Ie,U;Se<arguments.length;Se++){Ie=arguments[Se];for(U in Ie)Object.prototype.hasOwnProperty.call(Ie,U)&&(Ne[U]=Ie[U])}return Ne}function Pe(Ne,Se){var Ie=Ne.replace(/\|/g,function(pe,de,ve){for(var je=!1,tt=de;--tt>=0&&ve[tt]==="\\";)je=!je;return je?"|":" |"}),U=Ie.split(/ \|/),z=0;if(U.length>Se)U.splice(Se);else for(;U.length<Se;)U.push("");for(;z<U.length;z++)U[z]=U[z].trim().replace(/\\\|/g,"|");return U}function Ve(Ne,Se,Ie){var U=Ne.length;if(U===0)return"";for(var z=0;z<U;){var pe=Ne.charAt(U-z-1);if(pe===Se&&!Ie)z++;else if(pe!==Se&&Ie)z++;else break}return Ne.substr(0,U-z)}function V(Ne,Se){if(Ne.indexOf(Se[1])===-1)return-1;for(var Ie=Ne.length,U=0,z=0;z<Ie;z++)if(Ne[z]==="\\")z++;else if(Ne[z]===Se[0])U++;else if(Ne[z]===Se[1]&&(U--,U<0))return z;return-1}function C(Ne){Ne&&Ne.sanitize&&!Ne.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function G(Ne,Se){if(Se<1)return"";for(var Ie="";Se>1;)Se&1&&(Ie+=Ne),Se>>=1,Ne+=Ne;return Ie+Ne}var H={escape:m,unescape:S,edit:Z,cleanUrl:N,resolveUrl:X,noopTest:ce,merge:we,splitCells:Pe,rtrim:Ve,findClosingBracket:V,checkSanitizeDeprecation:C,repeatString:G},Q=ue.exports.defaults,j=H.rtrim,_=H.splitCells,v=H.escape,P=H.findClosingBracket;function re(Ne,Se,Ie){var U=Se.href,z=Se.title?v(Se.title):null,pe=Ne[1].replace(/\\([\[\]])/g,"$1");return Ne[0].charAt(0)!=="!"?{type:"link",raw:Ie,href:U,title:z,text:pe}:{type:"image",raw:Ie,href:U,title:z,text:v(pe)}}function Oe(Ne,Se){var Ie=Ne.match(/^(\s+)(?:```)/);if(Ie===null)return Se;var U=Ie[1];return Se.split(`
`).map(function(z){var pe=z.match(/^\s+/);if(pe===null)return z;var de=pe[0];return de.length>=U.length?z.slice(U.length):z}).join(`
`)}var Ze=function(){function Ne(Ie){this.options=Ie||Q}var Se=Ne.prototype;return Se.space=function(U){var z=this.rules.block.newline.exec(U);if(z)return z[0].length>1?{type:"space",raw:z[0]}:{raw:`
`}},Se.code=function(U){var z=this.rules.block.code.exec(U);if(z){var pe=z[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:z[0],codeBlockStyle:"indented",text:this.options.pedantic?pe:j(pe,`
`)}}},Se.fences=function(U){var z=this.rules.block.fences.exec(U);if(z){var pe=z[0],de=Oe(pe,z[3]||"");return{type:"code",raw:pe,lang:z[2]?z[2].trim():z[2],text:de}}},Se.heading=function(U){var z=this.rules.block.heading.exec(U);if(z){var pe=z[2].trim();if(/#$/.test(pe)){var de=j(pe,"#");(this.options.pedantic||!de||/ $/.test(de))&&(pe=de.trim())}return{type:"heading",raw:z[0],depth:z[1].length,text:pe}}},Se.nptable=function(U){var z=this.rules.block.nptable.exec(U);if(z){var pe={type:"table",header:_(z[1].replace(/^ *| *\| *$/g,"")),align:z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:z[3]?z[3].replace(/\n$/,"").split(`
`):[],raw:z[0]};if(pe.header.length===pe.align.length){var de=pe.align.length,ve;for(ve=0;ve<de;ve++)/^ *-+: *$/.test(pe.align[ve])?pe.align[ve]="right":/^ *:-+: *$/.test(pe.align[ve])?pe.align[ve]="center":/^ *:-+ *$/.test(pe.align[ve])?pe.align[ve]="left":pe.align[ve]=null;for(de=pe.cells.length,ve=0;ve<de;ve++)pe.cells[ve]=_(pe.cells[ve],pe.header.length);return pe}}},Se.hr=function(U){var z=this.rules.block.hr.exec(U);if(z)return{type:"hr",raw:z[0]}},Se.blockquote=function(U){var z=this.rules.block.blockquote.exec(U);if(z){var pe=z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:z[0],text:pe}}},Se.list=function(U){var z=this.rules.block.list.exec(U);if(z){var pe=z[0],de=z[2],ve=de.length>1,je={type:"list",raw:pe,ordered:ve,start:ve?+de.slice(0,-1):"",loose:!1,items:[]},tt=z[0].match(this.rules.block.item),yt=!1,It,qt,gn,en,nn,wn,zn,kn,Nn,Lt=tt.length;gn=this.rules.block.listItemStart.exec(tt[0]);for(var ht=0;ht<Lt;ht++){if(It=tt[ht],pe=It,this.options.pedantic||(Nn=It.match(new RegExp("\\n\\s*\\n {0,"+(gn[0].length-1)+"}\\S")),Nn&&(nn=It.length-Nn.index+tt.slice(ht+1).join(`
`).length,je.raw=je.raw.substring(0,je.raw.length-nn),It=It.substring(0,Nn.index),pe=It,Lt=ht+1)),ht!==Lt-1){if(en=this.rules.block.listItemStart.exec(tt[ht+1]),this.options.pedantic?en[1].length>gn[1].length:en[1].length>=gn[0].length||en[1].length>3){tt.splice(ht,2,tt[ht]+(!this.options.pedantic&&en[1].length<gn[0].length&&!tt[ht].match(/\n$/)?"":`
`)+tt[ht+1]),ht--,Lt--;continue}else(!this.options.pedantic||this.options.smartLists?en[2][en[2].length-1]!==de[de.length-1]:ve===(en[2].length===1))&&(nn=tt.slice(ht+1).join(`
`).length,je.raw=je.raw.substring(0,je.raw.length-nn),ht=Lt-1);gn=en}qt=It.length,It=It.replace(/^ *([*+-]|\d+[.)]) ?/,""),~It.indexOf(`
`)&&(qt-=It.length,It=this.options.pedantic?It.replace(/^ {1,4}/gm,""):It.replace(new RegExp("^ {1,"+qt+"}","gm"),"")),It=j(It,`
`),ht!==Lt-1&&(pe=pe+`
`),wn=yt||/\n\n(?!\s*$)/.test(pe),ht!==Lt-1&&(yt=pe.slice(-2)===`
`,wn||(wn=yt)),wn&&(je.loose=!0),this.options.gfm&&(zn=/^\[[ xX]\] /.test(It),kn=void 0,zn&&(kn=It[1]!==" ",It=It.replace(/^\[[ xX]\] +/,""))),je.items.push({type:"list_item",raw:pe,task:zn,checked:kn,loose:wn,text:It})}return je}},Se.html=function(U){var z=this.rules.block.html.exec(U);if(z)return{type:this.options.sanitize?"paragraph":"html",raw:z[0],pre:!this.options.sanitizer&&(z[1]==="pre"||z[1]==="script"||z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(z[0]):v(z[0]):z[0]}},Se.def=function(U){var z=this.rules.block.def.exec(U);if(z){z[3]&&(z[3]=z[3].substring(1,z[3].length-1));var pe=z[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:pe,raw:z[0],href:z[2],title:z[3]}}},Se.table=function(U){var z=this.rules.block.table.exec(U);if(z){var pe={type:"table",header:_(z[1].replace(/^ *| *\| *$/g,"")),align:z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:z[3]?z[3].replace(/\n$/,"").split(`
`):[]};if(pe.header.length===pe.align.length){pe.raw=z[0];var de=pe.align.length,ve;for(ve=0;ve<de;ve++)/^ *-+: *$/.test(pe.align[ve])?pe.align[ve]="right":/^ *:-+: *$/.test(pe.align[ve])?pe.align[ve]="center":/^ *:-+ *$/.test(pe.align[ve])?pe.align[ve]="left":pe.align[ve]=null;for(de=pe.cells.length,ve=0;ve<de;ve++)pe.cells[ve]=_(pe.cells[ve].replace(/^ *\| *| *\| *$/g,""),pe.header.length);return pe}}},Se.lheading=function(U){var z=this.rules.block.lheading.exec(U);if(z)return{type:"heading",raw:z[0],depth:z[2].charAt(0)==="="?1:2,text:z[1]}},Se.paragraph=function(U){var z=this.rules.block.paragraph.exec(U);if(z)return{type:"paragraph",raw:z[0],text:z[1].charAt(z[1].length-1)===`
`?z[1].slice(0,-1):z[1]}},Se.text=function(U){var z=this.rules.block.text.exec(U);if(z)return{type:"text",raw:z[0],text:z[0]}},Se.escape=function(U){var z=this.rules.inline.escape.exec(U);if(z)return{type:"escape",raw:z[0],text:v(z[1])}},Se.tag=function(U,z,pe){var de=this.rules.inline.tag.exec(U);if(de)return!z&&/^<a /i.test(de[0])?z=!0:z&&/^<\/a>/i.test(de[0])&&(z=!1),!pe&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?pe=!0:pe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(pe=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:z,inRawBlock:pe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):v(de[0]):de[0]}},Se.link=function(U){var z=this.rules.inline.link.exec(U);if(z){var pe=z[2].trim();if(!this.options.pedantic&&/^</.test(pe)){if(!/>$/.test(pe))return;var de=j(pe.slice(0,-1),"\\");if((pe.length-de.length)%2===0)return}else{var ve=P(z[2],"()");if(ve>-1){var je=z[0].indexOf("!")===0?5:4,tt=je+z[1].length+ve;z[2]=z[2].substring(0,ve),z[0]=z[0].substring(0,tt).trim(),z[3]=""}}var yt=z[2],It="";if(this.options.pedantic){var qt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(yt);qt&&(yt=qt[1],It=qt[3])}else It=z[3]?z[3].slice(1,-1):"";return yt=yt.trim(),/^</.test(yt)&&(this.options.pedantic&&!/>$/.test(pe)?yt=yt.slice(1):yt=yt.slice(1,-1)),re(z,{href:yt&&yt.replace(this.rules.inline._escapes,"$1"),title:It&&It.replace(this.rules.inline._escapes,"$1")},z[0])}},Se.reflink=function(U,z){var pe;if((pe=this.rules.inline.reflink.exec(U))||(pe=this.rules.inline.nolink.exec(U))){var de=(pe[2]||pe[1]).replace(/\s+/g," ");if(de=z[de.toLowerCase()],!de||!de.href){var ve=pe[0].charAt(0);return{type:"text",raw:ve,text:ve}}return re(pe,de,pe[0])}},Se.emStrong=function(U,z,pe){pe===void 0&&(pe="");var de=this.rules.inline.emStrong.lDelim.exec(U);if(de&&!(de[3]&&pe.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\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\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\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\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\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-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\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\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var ve=de[1]||de[2]||"";if(!ve||ve&&(pe===""||this.rules.inline.punctuation.exec(pe))){var je=de[0].length-1,tt,yt,It=je,qt=0,gn=de[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(gn.lastIndex=0,z=z.slice(-1*U.length+je);(de=gn.exec(z))!=null;)if(tt=de[1]||de[2]||de[3]||de[4]||de[5]||de[6],!!tt){if(yt=tt.length,de[3]||de[4]){It+=yt;continue}else if((de[5]||de[6])&&je%3&&!((je+yt)%3)){qt+=yt;continue}if(It-=yt,!(It>0))return yt=Math.min(yt,yt+It+qt),Math.min(je,yt)%2?{type:"em",raw:U.slice(0,je+de.index+yt+1),text:U.slice(1,je+de.index+yt)}:{type:"strong",raw:U.slice(0,je+de.index+yt+1),text:U.slice(2,je+de.index+yt-1)}}}}},Se.codespan=function(U){var z=this.rules.inline.code.exec(U);if(z){var pe=z[2].replace(/\n/g," "),de=/[^ ]/.test(pe),ve=/^ /.test(pe)&&/ $/.test(pe);return de&&ve&&(pe=pe.substring(1,pe.length-1)),pe=v(pe,!0),{type:"codespan",raw:z[0],text:pe}}},Se.br=function(U){var z=this.rules.inline.br.exec(U);if(z)return{type:"br",raw:z[0]}},Se.del=function(U){var z=this.rules.inline.del.exec(U);if(z)return{type:"del",raw:z[0],text:z[2]}},Se.autolink=function(U,z){var pe=this.rules.inline.autolink.exec(U);if(pe){var de,ve;return pe[2]==="@"?(de=v(this.options.mangle?z(pe[1]):pe[1]),ve="mailto:"+de):(de=v(pe[1]),ve=de),{type:"link",raw:pe[0],text:de,href:ve,tokens:[{type:"text",raw:de,text:de}]}}},Se.url=function(U,z){var pe;if(pe=this.rules.inline.url.exec(U)){var de,ve;if(pe[2]==="@")de=v(this.options.mangle?z(pe[0]):pe[0]),ve="mailto:"+de;else{var je;do je=pe[0],pe[0]=this.rules.inline._backpedal.exec(pe[0])[0];while(je!==pe[0]);de=v(pe[0]),pe[1]==="www."?ve="http://"+de:ve=de}return{type:"link",raw:pe[0],text:de,href:ve,tokens:[{type:"text",raw:de,text:de}]}}},Se.inlineText=function(U,z,pe){var de=this.rules.inline.text.exec(U);if(de){var ve;return z?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):v(de[0]):de[0]:ve=v(this.options.smartypants?pe(de[0]):de[0]),{type:"text",raw:de[0],text:ve}}},Ne}(),Ye=H.noopTest,qe=H.edit,ft=H.merge,vt={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:Ye,table:Ye,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};vt._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,vt._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,vt.def=qe(vt.def).replace("label",vt._label).replace("title",vt._title).getRegex(),vt.bullet=/(?:[*+-]|\d{1,9}[.)])/,vt.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,vt.item=qe(vt.item,"gm").replace(/bull/g,vt.bullet).getRegex(),vt.listItemStart=qe(/^( *)(bull) */).replace("bull",vt.bullet).getRegex(),vt.list=qe(vt.list).replace(/bull/g,vt.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+vt.def.source+")").getRegex(),vt._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",vt._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,vt.html=qe(vt.html,"i").replace("comment",vt._comment).replace("tag",vt._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vt.paragraph=qe(vt._paragraph).replace("hr",vt.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",vt._tag).getRegex(),vt.blockquote=qe(vt.blockquote).replace("paragraph",vt.paragraph).getRegex(),vt.normal=ft({},vt),vt.gfm=ft({},vt.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),vt.gfm.nptable=qe(vt.gfm.nptable).replace("hr",vt.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",vt._tag).getRegex(),vt.gfm.table=qe(vt.gfm.table).replace("hr",vt.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",vt._tag).getRegex(),vt.pedantic=ft({},vt.normal,{html:qe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",vt._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ye,paragraph:qe(vt.normal._paragraph).replace("hr",vt.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",vt.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var Ae={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ye,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/\_\_[^_*]*?\*[^_*]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/\*\*[^_*]*?\_[^_*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Ye,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};Ae._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",Ae.punctuation=qe(Ae.punctuation).replace(/punctuation/g,Ae._punctuation).getRegex(),Ae.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,Ae.escapedEmSt=/\\\*|\\_/g,Ae._comment=qe(vt._comment).replace("(?:-->|$)","-->").getRegex(),Ae.emStrong.lDelim=qe(Ae.emStrong.lDelim).replace(/punct/g,Ae._punctuation).getRegex(),Ae.emStrong.rDelimAst=qe(Ae.emStrong.rDelimAst,"g").replace(/punct/g,Ae._punctuation).getRegex(),Ae.emStrong.rDelimUnd=qe(Ae.emStrong.rDelimUnd,"g").replace(/punct/g,Ae._punctuation).getRegex(),Ae._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,Ae._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,Ae._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,Ae.autolink=qe(Ae.autolink).replace("scheme",Ae._scheme).replace("email",Ae._email).getRegex(),Ae._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,Ae.tag=qe(Ae.tag).replace("comment",Ae._comment).replace("attribute",Ae._attribute).getRegex(),Ae._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Ae._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,Ae._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,Ae.link=qe(Ae.link).replace("label",Ae._label).replace("href",Ae._href).replace("title",Ae._title).getRegex(),Ae.reflink=qe(Ae.reflink).replace("label",Ae._label).getRegex(),Ae.reflinkSearch=qe(Ae.reflinkSearch,"g").replace("reflink",Ae.reflink).replace("nolink",Ae.nolink).getRegex(),Ae.normal=ft({},Ae),Ae.pedantic=ft({},Ae.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:qe(/^!?\[(label)\]\((.*?)\)/).replace("label",Ae._label).getRegex(),reflink:qe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ae._label).getRegex()}),Ae.gfm=ft({},Ae.normal,{escape:qe(Ae.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),Ae.gfm.url=qe(Ae.gfm.url,"i").replace("email",Ae.gfm._extended_email).getRegex(),Ae.breaks=ft({},Ae.gfm,{br:qe(Ae.br).replace("{2,}","*").getRegex(),text:qe(Ae.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var wt={block:vt,inline:Ae},rt=Ze,Mt=ue.exports.defaults,et=wt.block,ze=wt.inline,ye=H.repeatString;function me(Ne){return Ne.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function B(Ne){var Se="",Ie,U,z=Ne.length;for(Ie=0;Ie<z;Ie++)U=Ne.charCodeAt(Ie),Math.random()>.5&&(U="x"+U.toString(16)),Se+="&#"+U+";";return Se}var xe=function(){function Ne(Ie){this.tokens=[],this.tokens.links=Object.create(null),this.options=Ie||Mt,this.options.tokenizer=this.options.tokenizer||new rt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var U={block:et.normal,inline:ze.normal};this.options.pedantic?(U.block=et.pedantic,U.inline=ze.pedantic):this.options.gfm&&(U.block=et.gfm,this.options.breaks?U.inline=ze.breaks:U.inline=ze.gfm),this.tokenizer.rules=U}Ne.lex=function(U,z){var pe=new Ne(z);return pe.lex(U)},Ne.lexInline=function(U,z){var pe=new Ne(z);return pe.inlineTokens(U)};var Se=Ne.prototype;return Se.lex=function(U){return U=U.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(U,this.tokens,!0),this.inline(this.tokens),this.tokens},Se.blockTokens=function(U,z,pe){z===void 0&&(z=[]),pe===void 0&&(pe=!0),this.options.pedantic&&(U=U.replace(/^ +$/gm,""));for(var de,ve,je,tt;U;){if(de=this.tokenizer.space(U)){U=U.substring(de.raw.length),de.type&&z.push(de);continue}if(de=this.tokenizer.code(U)){U=U.substring(de.raw.length),tt=z[z.length-1],tt&&tt.type==="paragraph"?(tt.raw+=`
`+de.raw,tt.text+=`
`+de.text):z.push(de);continue}if(de=this.tokenizer.fences(U)){U=U.substring(de.raw.length),z.push(de);continue}if(de=this.tokenizer.heading(U)){U=U.substring(de.raw.length),z.push(de);continue}if(de=this.tokenizer.nptable(U)){U=U.substring(de.raw.length),z.push(de);continue}if(de=this.tokenizer.hr(U)){U=U.substring(de.raw.length),z.push(de);continue}if(de=this.tokenizer.blockquote(U)){U=U.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],pe),z.push(de);continue}if(de=this.tokenizer.list(U)){for(U=U.substring(de.raw.length),je=de.items.length,ve=0;ve<je;ve++)de.items[ve].tokens=this.blockTokens(de.items[ve].text,[],!1);z.push(de);continue}if(de=this.tokenizer.html(U)){U=U.substring(de.raw.length),z.push(de);continue}if(pe&&(de=this.tokenizer.def(U))){U=U.substring(de.raw.length),this.tokens.links[de.tag]||(this.tokens.links[de.tag]={href:de.href,title:de.title});continue}if(de=this.tokenizer.table(U)){U=U.substring(de.raw.length),z.push(de);continue}if(de=this.tokenizer.lheading(U)){U=U.substring(de.raw.length),z.push(de);continue}if(pe&&(de=this.tokenizer.paragraph(U))){U=U.substring(de.raw.length),z.push(de);continue}if(de=this.tokenizer.text(U)){U=U.substring(de.raw.length),tt=z[z.length-1],tt&&tt.type==="text"?(tt.raw+=`
`+de.raw,tt.text+=`
`+de.text):z.push(de);continue}if(U){var yt="Infinite loop on byte: "+U.charCodeAt(0);if(this.options.silent){console.error(yt);break}else throw new Error(yt)}}return z},Se.inline=function(U){var z,pe,de,ve,je,tt,yt=U.length;for(z=0;z<yt;z++)switch(tt=U[z],tt.type){case"paragraph":case"text":case"heading":{tt.tokens=[],this.inlineTokens(tt.text,tt.tokens);break}case"table":{for(tt.tokens={header:[],cells:[]},ve=tt.header.length,pe=0;pe<ve;pe++)tt.tokens.header[pe]=[],this.inlineTokens(tt.header[pe],tt.tokens.header[pe]);for(ve=tt.cells.length,pe=0;pe<ve;pe++)for(je=tt.cells[pe],tt.tokens.cells[pe]=[],de=0;de<je.length;de++)tt.tokens.cells[pe][de]=[],this.inlineTokens(je[de],tt.tokens.cells[pe][de]);break}case"blockquote":{this.inline(tt.tokens);break}case"list":{for(ve=tt.items.length,pe=0;pe<ve;pe++)this.inline(tt.items[pe].tokens);break}}return U},Se.inlineTokens=function(U,z,pe,de){z===void 0&&(z=[]),pe===void 0&&(pe=!1),de===void 0&&(de=!1);var ve,je,tt=U,yt,It,qt;if(this.tokens.links){var gn=Object.keys(this.tokens.links);if(gn.length>0)for(;(yt=this.tokenizer.rules.inline.reflinkSearch.exec(tt))!=null;)gn.includes(yt[0].slice(yt[0].lastIndexOf("[")+1,-1))&&(tt=tt.slice(0,yt.index)+"["+ye("a",yt[0].length-2)+"]"+tt.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(yt=this.tokenizer.rules.inline.blockSkip.exec(tt))!=null;)tt=tt.slice(0,yt.index)+"["+ye("a",yt[0].length-2)+"]"+tt.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(yt=this.tokenizer.rules.inline.escapedEmSt.exec(tt))!=null;)tt=tt.slice(0,yt.index)+"++"+tt.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;U;){if(It||(qt=""),It=!1,ve=this.tokenizer.escape(U)){U=U.substring(ve.raw.length),z.push(ve);continue}if(ve=this.tokenizer.tag(U,pe,de)){U=U.substring(ve.raw.length),pe=ve.inLink,de=ve.inRawBlock;var en=z[z.length-1];en&&ve.type==="text"&&en.type==="text"?(en.raw+=ve.raw,en.text+=ve.text):z.push(ve);continue}if(ve=this.tokenizer.link(U)){U=U.substring(ve.raw.length),ve.type==="link"&&(ve.tokens=this.inlineTokens(ve.text,[],!0,de)),z.push(ve);continue}if(ve=this.tokenizer.reflink(U,this.tokens.links)){U=U.substring(ve.raw.length);var nn=z[z.length-1];ve.type==="link"?(ve.tokens=this.inlineTokens(ve.text,[],!0,de),z.push(ve)):nn&&ve.type==="text"&&nn.type==="text"?(nn.raw+=ve.raw,nn.text+=ve.text):z.push(ve);continue}if(ve=this.tokenizer.emStrong(U,tt,qt)){U=U.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],pe,de),z.push(ve);continue}if(ve=this.tokenizer.codespan(U)){U=U.substring(ve.raw.length),z.push(ve);continue}if(ve=this.tokenizer.br(U)){U=U.substring(ve.raw.length),z.push(ve);continue}if(ve=this.tokenizer.del(U)){U=U.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],pe,de),z.push(ve);continue}if(ve=this.tokenizer.autolink(U,B)){U=U.substring(ve.raw.length),z.push(ve);continue}if(!pe&&(ve=this.tokenizer.url(U,B))){U=U.substring(ve.raw.length),z.push(ve);continue}if(ve=this.tokenizer.inlineText(U,de,me)){U=U.substring(ve.raw.length),ve.raw.slice(-1)!=="_"&&(qt=ve.raw.slice(-1)),It=!0,je=z[z.length-1],je&&je.type==="text"?(je.raw+=ve.raw,je.text+=ve.text):z.push(ve);continue}if(U){var wn="Infinite loop on byte: "+U.charCodeAt(0);if(this.options.silent){console.error(wn);break}else throw new Error(wn)}}return z},w(Ne,null,[{key:"rules",get:function(){return{block:et,inline:ze}}}]),Ne}(),Le=ue.exports.defaults,K=H.cleanUrl,R=H.escape,ie=function(){function Ne(Ie){this.options=Ie||Le}var Se=Ne.prototype;return Se.code=function(U,z,pe){var de=(z||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight(U,de);ve!=null&&ve!==U&&(pe=!0,U=ve)}return U=U.replace(/\n$/,"")+`
`,de?'<pre><code class="'+this.options.langPrefix+R(de,!0)+'">'+(pe?U:R(U,!0))+`</code></pre>
`:"<pre><code>"+(pe?U:R(U,!0))+`</code></pre>
`},Se.blockquote=function(U){return`<blockquote>
`+U+`</blockquote>
`},Se.html=function(U){return U},Se.heading=function(U,z,pe,de){return this.options.headerIds?"<h"+z+' id="'+this.options.headerPrefix+de.slug(pe)+'">'+U+"</h"+z+`>
`:"<h"+z+">"+U+"</h"+z+`>
`},Se.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},Se.list=function(U,z,pe){var de=z?"ol":"ul",ve=z&&pe!==1?' start="'+pe+'"':"";return"<"+de+ve+`>
`+U+"</"+de+`>
`},Se.listitem=function(U){return"<li>"+U+`</li>
`},Se.checkbox=function(U){return"<input "+(U?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},Se.paragraph=function(U){return"<p>"+U+`</p>
`},Se.table=function(U,z){return z&&(z="<tbody>"+z+"</tbody>"),`<table>
<thead>
`+U+`</thead>
`+z+`</table>
`},Se.tablerow=function(U){return`<tr>
`+U+`</tr>
`},Se.tablecell=function(U,z){var pe=z.header?"th":"td",de=z.align?"<"+pe+' align="'+z.align+'">':"<"+pe+">";return de+U+"</"+pe+`>
`},Se.strong=function(U){return"<strong>"+U+"</strong>"},Se.em=function(U){return"<em>"+U+"</em>"},Se.codespan=function(U){return"<code>"+U+"</code>"},Se.br=function(){return this.options.xhtml?"<br/>":"<br>"},Se.del=function(U){return"<del>"+U+"</del>"},Se.link=function(U,z,pe){if(U=K(this.options.sanitize,this.options.baseUrl,U),U===null)return pe;var de='<a href="'+R(U)+'"';return z&&(de+=' title="'+z+'"'),de+=">"+pe+"</a>",de},Se.image=function(U,z,pe){if(U=K(this.options.sanitize,this.options.baseUrl,U),U===null)return pe;var de='<img src="'+U+'" alt="'+pe+'"';return z&&(de+=' title="'+z+'"'),de+=this.options.xhtml?"/>":">",de},Se.text=function(U){return U},Ne}(),be=function(){function Ne(){}var Se=Ne.prototype;return Se.strong=function(U){return U},Se.em=function(U){return U},Se.codespan=function(U){return U},Se.del=function(U){return U},Se.html=function(U){return U},Se.text=function(U){return U},Se.link=function(U,z,pe){return""+pe},Se.image=function(U,z,pe){return""+pe},Se.br=function(){return""},Ne}(),k=function(){function Ne(){this.seen={}}var Se=Ne.prototype;return Se.serialize=function(U){return U.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},Se.getNextSafeSlug=function(U,z){var pe=U,de=0;if(this.seen.hasOwnProperty(pe)){de=this.seen[U];do de++,pe=U+"-"+de;while(this.seen.hasOwnProperty(pe))}return z||(this.seen[U]=de,this.seen[pe]=0),pe},Se.slug=function(U,z){z===void 0&&(z={});var pe=this.serialize(U);return this.getNextSafeSlug(pe,z.dryrun)},Ne}(),Y=ie,J=be,se=k,ee=ue.exports.defaults,ne=H.unescape,Ee=function(){function Ne(Ie){this.options=Ie||ee,this.options.renderer=this.options.renderer||new Y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new J,this.slugger=new se}Ne.parse=function(U,z){var pe=new Ne(z);return pe.parse(U)},Ne.parseInline=function(U,z){var pe=new Ne(z);return pe.parseInline(U)};var Se=Ne.prototype;return Se.parse=function(U,z){z===void 0&&(z=!0);var pe="",de,ve,je,tt,yt,It,qt,gn,en,nn,wn,zn,kn,Nn,Lt,ht,Zt,yn,Hn=U.length;for(de=0;de<Hn;de++)switch(nn=U[de],nn.type){case"space":continue;case"hr":{pe+=this.renderer.hr();continue}case"heading":{pe+=this.renderer.heading(this.parseInline(nn.tokens),nn.depth,ne(this.parseInline(nn.tokens,this.textRenderer)),this.slugger);continue}case"code":{pe+=this.renderer.code(nn.text,nn.lang,nn.escaped);continue}case"table":{for(gn="",qt="",tt=nn.header.length,ve=0;ve<tt;ve++)qt+=this.renderer.tablecell(this.parseInline(nn.tokens.header[ve]),{header:!0,align:nn.align[ve]});for(gn+=this.renderer.tablerow(qt),en="",tt=nn.cells.length,ve=0;ve<tt;ve++){for(It=nn.tokens.cells[ve],qt="",yt=It.length,je=0;je<yt;je++)qt+=this.renderer.tablecell(this.parseInline(It[je]),{header:!1,align:nn.align[je]});en+=this.renderer.tablerow(qt)}pe+=this.renderer.table(gn,en);continue}case"blockquote":{en=this.parse(nn.tokens),pe+=this.renderer.blockquote(en);continue}case"list":{for(wn=nn.ordered,zn=nn.start,kn=nn.loose,tt=nn.items.length,en="",ve=0;ve<tt;ve++)Lt=nn.items[ve],ht=Lt.checked,Zt=Lt.task,Nn="",Lt.task&&(yn=this.renderer.checkbox(ht),kn?Lt.tokens.length>0&&Lt.tokens[0].type==="text"?(Lt.tokens[0].text=yn+" "+Lt.tokens[0].text,Lt.tokens[0].tokens&&Lt.tokens[0].tokens.length>0&&Lt.tokens[0].tokens[0].type==="text"&&(Lt.tokens[0].tokens[0].text=yn+" "+Lt.tokens[0].tokens[0].text)):Lt.tokens.unshift({type:"text",text:yn}):Nn+=yn),Nn+=this.parse(Lt.tokens,kn),en+=this.renderer.listitem(Nn,Zt,ht);pe+=this.renderer.list(en,wn,zn);continue}case"html":{pe+=this.renderer.html(nn.text);continue}case"paragraph":{pe+=this.renderer.paragraph(this.parseInline(nn.tokens));continue}case"text":{for(en=nn.tokens?this.parseInline(nn.tokens):nn.text;de+1<Hn&&U[de+1].type==="text";)nn=U[++de],en+=`
`+(nn.tokens?this.parseInline(nn.tokens):nn.text);pe+=z?this.renderer.paragraph(en):en;continue}default:{var Me='Token with "'+nn.type+'" type was not found.';if(this.options.silent){console.error(Me);return}else throw new Error(Me)}}return pe},Se.parseInline=function(U,z){z=z||this.renderer;var pe="",de,ve,je=U.length;for(de=0;de<je;de++)switch(ve=U[de],ve.type){case"escape":{pe+=z.text(ve.text);break}case"html":{pe+=z.html(ve.text);break}case"link":{pe+=z.link(ve.href,ve.title,this.parseInline(ve.tokens,z));break}case"image":{pe+=z.image(ve.href,ve.title,ve.text);break}case"strong":{pe+=z.strong(this.parseInline(ve.tokens,z));break}case"em":{pe+=z.em(this.parseInline(ve.tokens,z));break}case"codespan":{pe+=z.codespan(ve.text);break}case"br":{pe+=z.br();break}case"del":{pe+=z.del(this.parseInline(ve.tokens,z));break}case"text":{pe+=z.text(ve.text);break}default:{var tt='Token with "'+ve.type+'" type was not found.';if(this.options.silent){console.error(tt);return}else throw new Error(tt)}}return pe},Ne}(),Be=xe,Ce=Ee,De=Ze,oe=ie,Ge=be,Ue=k,Fe=H.merge,lt=H.checkSanitizeDeprecation,ut=H.escape,it=ue.exports.getDefaults,Ct=ue.exports.changeDefaults,zt=ue.exports.defaults;function ct(Ne,Se,Ie){if(typeof Ne=="undefined"||Ne===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ne!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ne)+", string expected");if(typeof Se=="function"&&(Ie=Se,Se=null),Se=Fe({},ct.defaults,Se||{}),lt(Se),Ie){var U=Se.highlight,z;try{z=Be.lex(Ne,Se)}catch(je){return Ie(je)}var pe=function(tt){var yt;if(!tt)try{Se.walkTokens&&ct.walkTokens(z,Se.walkTokens),yt=Ce.parse(z,Se)}catch(It){tt=It}return Se.highlight=U,tt?Ie(tt):Ie(null,yt)};if(!U||U.length<3||(delete Se.highlight,!z.length))return pe();var de=0;ct.walkTokens(z,function(je){je.type==="code"&&(de++,setTimeout(function(){U(je.text,je.lang,function(tt,yt){if(tt)return pe(tt);yt!=null&&yt!==je.text&&(je.text=yt,je.escaped=!0),de--,de===0&&pe()})},0))}),de===0&&pe();return}try{var ve=Be.lex(Ne,Se);return Se.walkTokens&&ct.walkTokens(ve,Se.walkTokens),Ce.parse(ve,Se)}catch(je){if(je.message+=`
Please report this to https://github.com/markedjs/marked.`,Se.silent)return"<p>An error occurred:</p><pre>"+ut(je.message+"",!0)+"</pre>";throw je}}ct.options=ct.setOptions=function(Ne){return Fe(ct.defaults,Ne),Ct(ct.defaults),ct},ct.getDefaults=it,ct.defaults=zt,ct.use=function(Ne){var Se=Fe({},Ne);if(Ne.renderer&&function(){var U=ct.defaults.renderer||new oe,z=function(ve){var je=U[ve];U[ve]=function(){for(var tt=arguments.length,yt=new Array(tt),It=0;It<tt;It++)yt[It]=arguments[It];var qt=Ne.renderer[ve].apply(U,yt);return qt===!1&&(qt=je.apply(U,yt)),qt}};for(var pe in Ne.renderer)z(pe);Se.renderer=U}(),Ne.tokenizer&&function(){var U=ct.defaults.tokenizer||new De,z=function(ve){var je=U[ve];U[ve]=function(){for(var tt=arguments.length,yt=new Array(tt),It=0;It<tt;It++)yt[It]=arguments[It];var qt=Ne.tokenizer[ve].apply(U,yt);return qt===!1&&(qt=je.apply(U,yt)),qt}};for(var pe in Ne.tokenizer)z(pe);Se.tokenizer=U}(),Ne.walkTokens){var Ie=ct.defaults.walkTokens;Se.walkTokens=function(U){Ne.walkTokens(U),Ie&&Ie(U)}}ct.setOptions(Se)},ct.walkTokens=function(Ne,Se){for(var Ie=Te(Ne),U;!(U=Ie()).done;){var z=U.value;switch(Se(z),z.type){case"table":{for(var pe=Te(z.tokens.header),de;!(de=pe()).done;){var ve=de.value;ct.walkTokens(ve,Se)}for(var je=Te(z.tokens.cells),tt;!(tt=je()).done;)for(var yt=tt.value,It=Te(yt),qt;!(qt=It()).done;){var gn=qt.value;ct.walkTokens(gn,Se)}break}case"list":{ct.walkTokens(z.items,Se);break}default:z.tokens&&ct.walkTokens(z.tokens,Se)}}},ct.parseInline=function(Ne,Se){if(typeof Ne=="undefined"||Ne===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof Ne!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(Ne)+", string expected");Se=Fe({},ct.defaults,Se||{}),lt(Se);try{var Ie=Be.lexInline(Ne,Se);return Se.walkTokens&&ct.walkTokens(Ie,Se.walkTokens),Ce.parseInline(Ie,Se)}catch(U){if(U.message+=`
Please report this to https://github.com/markedjs/marked.`,Se.silent)return"<p>An error occurred:</p><pre>"+ut(U.message+"",!0)+"</pre>";throw U}},ct.Parser=Ce,ct.parser=Ce.parse,ct.Renderer=oe,ct.TextRenderer=Ge,ct.Lexer=Be,ct.lexer=Be.lex,ct.Tokenizer=De,ct.Slugger=Ue,ct.parse=ct;var Ut=ct;return Ut})},11690:function(_n){const _t=/[&<>"']/,w=/[&<>"']/g,L=/[<>"']|&(?!#?\w+;)/,fe=/[<>"']|&(?!#?\w+;)/g,Te={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ue=X=>Te[X];function $(X,ce){if(ce){if(_t.test(X))return X.replace(w,ue)}else if(L.test(X))return X.replace(fe,ue);return X}const p=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function ge(X){return X.replace(p,(ce,we)=>(we=we.toLowerCase(),we==="colon"?":":we.charAt(0)==="#"?we.charAt(1)==="x"?String.fromCharCode(parseInt(we.substring(2),16)):String.fromCharCode(+we.substring(1)):""))}const le=/(^|[^\[])\^/g;function l(X,ce){X=X.source||X,ce=ce||"";const we={replace:(Pe,Ve)=>(Ve=Ve.source||Ve,Ve=Ve.replace(le,"$1"),X=X.replace(Pe,Ve),we),getRegex:()=>new RegExp(X,ce)};return we}const x=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function h(X,ce,we){if(X){let Pe;try{Pe=decodeURIComponent(ge(we)).replace(x,"").toLowerCase()}catch(Ve){return null}if(Pe.indexOf("javascript:")===0||Pe.indexOf("vbscript:")===0||Pe.indexOf("data:")===0)return null}ce&&!A.test(we)&&(we=Z(ce,we));try{we=encodeURI(we).replace(/%25/g,"%")}catch(Pe){return null}return we}const m={},y=/^[^:]+:\/*[^/]*$/,S=/^([^:]+:)[\s\S]*$/,F=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Z(X,ce){m[" "+X]||(y.test(X)?m[" "+X]=X+"/":m[" "+X]=T(X,"/",!0)),X=m[" "+X];const we=X.indexOf(":")===-1;return ce.substring(0,2)==="//"?we?ce:X.replace(S,"$1")+ce:ce.charAt(0)==="/"?we?ce:X.replace(F,"$1")+ce:X+ce}const W={exec:function(){}};function I(X){let ce=1,we,Pe;for(;ce<arguments.length;ce++){we=arguments[ce];for(Pe in we)Object.prototype.hasOwnProperty.call(we,Pe)&&(X[Pe]=we[Pe])}return X}function N(X,ce){const we=X.replace(/\|/g,(V,C,G)=>{let H=!1,Q=C;for(;--Q>=0&&G[Q]==="\\";)H=!H;return H?"|":" |"}),Pe=we.split(/ \|/);let Ve=0;if(Pe.length>ce)Pe.splice(ce);else for(;Pe.length<ce;)Pe.push("");for(;Ve<Pe.length;Ve++)Pe[Ve]=Pe[Ve].trim().replace(/\\\|/g,"|");return Pe}function T(X,ce,we){const Pe=X.length;if(Pe===0)return"";let Ve=0;for(;Ve<Pe;){const V=X.charAt(Pe-Ve-1);if(V===ce&&!we)Ve++;else if(V!==ce&&we)Ve++;else break}return X.substr(0,Pe-Ve)}function D(X,ce){if(X.indexOf(ce[1])===-1)return-1;const we=X.length;let Pe=0,Ve=0;for(;Ve<we;Ve++)if(X[Ve]==="\\")Ve++;else if(X[Ve]===ce[0])Pe++;else if(X[Ve]===ce[1]&&(Pe--,Pe<0))return Ve;return-1}function q(X){X&&X.sanitize&&!X.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function te(X,ce){if(ce<1)return"";let we="";for(;ce>1;)ce&1&&(we+=X),ce>>=1,X+=X;return we+X}_n.exports={escape:$,unescape:ge,edit:l,cleanUrl:h,resolveUrl:Z,noopTest:W,merge:I,splitCells:N,rtrim:T,findClosingBracket:D,checkSanitizeDeprecation:q,repeatString:te}},75918:function(_n,_t,w){"use strict";w.d(_t,{Wi:function(){return p},Z0:function(){return ge},aU:function(){return $},eZ:function(){return l},wY:function(){return le}});var L=w(4348),fe=w(69323),Te=w(13268),ue=function(x,A,h,m){function y(S){return S instanceof h?S:new h(function(F){F(S)})}return new(h||(h=Promise))(function(S,F){function Z(N){try{I(m.next(N))}catch(T){F(T)}}function W(N){try{I(m.throw(N))}catch(T){F(T)}}function I(N){N.done?S(N.value):y(N.value).then(Z,W)}I((m=m.apply(x,A||[])).next())})};class $ extends fe.JT{constructor(A,h="",m="",y=!0,S){super(),this._onDidChange=this._register(new L.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=A,this._label=h,this._cssClass=m,this._enabled=y,this._actionCallback=S}get id(){return this._id}get label(){return this._label}set label(A){this._setLabel(A)}_setLabel(A){this._label!==A&&(this._label=A,this._onDidChange.fire({label:A}))}get tooltip(){return this._tooltip||""}set tooltip(A){this._setTooltip(A)}_setTooltip(A){this._tooltip!==A&&(this._tooltip=A,this._onDidChange.fire({tooltip:A}))}get class(){return this._cssClass}set class(A){this._setClass(A)}_setClass(A){this._cssClass!==A&&(this._cssClass=A,this._onDidChange.fire({class:A}))}get enabled(){return this._enabled}set enabled(A){this._setEnabled(A)}_setEnabled(A){this._enabled!==A&&(this._enabled=A,this._onDidChange.fire({enabled:A}))}get checked(){return this._checked}set checked(A){this._setChecked(A)}_setChecked(A){this._checked!==A&&(this._checked=A,this._onDidChange.fire({checked:A}))}run(A,h){return ue(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(A))})}}class p extends fe.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new L.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new L.Q5),this.onDidRun=this._onDidRun.event}run(A,h){return ue(this,void 0,void 0,function*(){if(!A.enabled)return;this._onBeforeRun.fire({action:A});let m;try{yield this.runAction(A,h)}catch(y){m=y}this._onDidRun.fire({action:A,error:m})})}runAction(A,h){return ue(this,void 0,void 0,function*(){yield A.run(h)})}}class ge extends ${constructor(A){super(ge.ID,A,A?"separator text":"separator"),this.checked=!1,this.enabled=!1}}ge.ID="vs.actions.separator";class le{constructor(A,h,m,y){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=A,this.label=h,this.class=y,this._actions=m}get actions(){return this._actions}dispose(){}run(){return ue(this,void 0,void 0,function*(){})}}class l extends ${constructor(){super(l.ID,Te.N("submenu.empty","(empty)"),void 0,!1)}}l.ID="vs.actions.empty"},76068:function(_n,_t,w){"use strict";w.d(_t,{ok:function(){return L}});function L(fe,Te){if(!fe)throw new Error(Te?`Assertion failed (${Te})`:"Assertion Failed")}},52615:function(_n,_t,w){"use strict";w.d(_t,{CM:function(){return $},JL:function(){return p},dT:function(){return le},fK:function(){return ue},lA:function(){return ge}});var L=w(4348);class fe{constructor(){this._icons=new Map,this._onDidRegister=new L.Q5}add(x){const A=this._icons.get(x.id);A?x.description?A.description=x.description:console.error(`Duplicate registration of codicon ${x.id}`):(this._icons.set(x.id,x),this._onDidRegister.fire(x))}get(x){return this._icons.get(x)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Te=new fe,ue=Te;function $(l,x){return new ge(l,x)}function p(l){return l?l.replace(/\$\((.*?)\)/g,(x,A)=>` ${A} `).trim():""}class ge{constructor(x,A,h){this.id=x,this.definition=A,this.description=h,Te.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var le;(function(l){l.iconNameSegment="[A-Za-z0-9]+",l.iconNameExpression="[A-Za-z0-9\\-]+",l.iconModifierExpression="~[A-Za-z]+";const x=new RegExp(`^(${l.iconNameExpression})(${l.iconModifierExpression})?$`);function A(y){if(y instanceof ge)return["codicon","codicon-"+y.id];const S=x.exec(y.id);if(!S)return A(ge.error);let[,F,Z]=S;const W=["codicon","codicon-"+F];return Z&&W.push("codicon-modifier-"+Z.substr(1)),W}l.asClassNameArray=A;function h(y){return A(y).join(" ")}l.asClassName=h;function m(y){return"."+A(y).join(".")}l.asCSSSelector=m})(le||(le={})),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"})}(ge||(ge={}))},79881:function(_n,_t,w){"use strict";w.d(_t,{B8:function(){return A},Cp:function(){return ue},F0:function(){return le},L6:function(){return x},VV:function(){return ge},b1:function(){return l},dL:function(){return Te},ri:function(){return $}});class L{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(m){setTimeout(()=>{throw m.stack?new Error(m.message+`
`+m.stack):m},0)}}emit(m){this.listeners.forEach(y=>{y(m)})}onUnexpectedError(m){this.unexpectedErrorHandler(m),this.emit(m)}onUnexpectedExternalError(m){this.unexpectedErrorHandler(m)}}const fe=new L;function Te(h){ge(h)||fe.onUnexpectedError(h)}function ue(h){ge(h)||fe.onUnexpectedExternalError(h)}function $(h){if(h instanceof Error){let{name:m,message:y}=h;const S=h.stacktrace||h.stack;return{$isError:!0,name:m,message:y,stack:S}}return h}const p="Canceled";function ge(h){return h instanceof Error&&h.name===p&&h.message===p}function le(){const h=new Error(p);return h.name=h.message,h}function l(h){return h?new Error(`Illegal argument: ${h}`):new Error("Illegal argument")}function x(h){return h?new Error(`Illegal state: ${h}`):new Error("Illegal state")}class A extends Error{constructor(m){super("NotSupported"),m&&(this.message=m)}}},4348:function(_n,_t,w){"use strict";w.d(_t,{D0:function(){return A},E7:function(){return h},K3:function(){return x},Q5:function(){return l},ZD:function(){return m},ju:function(){return $}});var L=w(79881),fe=w(69323),Te=w(34502),ue=w(95830),$;(function(y){y.None=()=>fe.JT.None;function S(G){return(H,Q=null,j)=>{let _=!1,v;return v=G(P=>{if(!_)return v?v.dispose():_=!0,H.call(Q,P)},null,j),_&&v.dispose(),v}}y.once=S;function F(G,H){return D((Q,j=null,_)=>G(v=>Q.call(j,H(v)),null,_))}y.map=F;function Z(G,H){return D((Q,j=null,_)=>G(v=>{H(v),Q.call(j,v)},null,_))}y.forEach=Z;function W(G,H){return D((Q,j=null,_)=>G(v=>H(v)&&Q.call(j,v),null,_))}y.filter=W;function I(G){return G}y.signal=I;function N(...G){return(H,Q=null,j)=>(0,fe.F8)(...G.map(_=>_(v=>H.call(Q,v),null,j)))}y.any=N;function T(G,H,Q){let j=Q;return F(G,_=>(j=H(j,_),j))}y.reduce=T;function D(G){let H;const Q=new l({onFirstListenerAdd(){H=G(Q.fire,Q)},onLastListenerRemove(){H.dispose()}});return Q.event}function q(G,H,Q=100,j=!1,_){let v,P,re,Oe=0;const Ze=new l({leakWarningThreshold:_,onFirstListenerAdd(){v=G(Ye=>{Oe++,P=H(P,Ye),j&&!re&&(Ze.fire(P),P=void 0),clearTimeout(re),re=setTimeout(()=>{const qe=P;P=void 0,re=void 0,(!j||Oe>1)&&Ze.fire(qe),Oe=0},Q)})},onLastListenerRemove(){v.dispose()}});return Ze.event}y.debounce=q;function te(G,H=(Q,j)=>Q===j){let Q=!0,j;return W(G,_=>{const v=Q||!H(_,j);return Q=!1,j=_,v})}y.latch=te;function X(G,H){return[y.filter(G,H),y.filter(G,Q=>!H(Q))]}y.split=X;function ce(G,H=!1,Q=[]){let j=Q.slice(),_=G(re=>{j?j.push(re):P.fire(re)});const v=()=>{j&&j.forEach(re=>P.fire(re)),j=null},P=new l({onFirstListenerAdd(){_||(_=G(re=>P.fire(re)))},onFirstListenerDidAdd(){j&&(H?setTimeout(v):v())},onLastListenerRemove(){_&&_.dispose(),_=null}});return P.event}y.buffer=ce;class we{constructor(H){this.event=H}map(H){return new we(F(this.event,H))}forEach(H){return new we(Z(this.event,H))}filter(H){return new we(W(this.event,H))}reduce(H,Q){return new we(T(this.event,H,Q))}latch(){return new we(te(this.event))}debounce(H,Q=100,j=!1,_){return new we(q(this.event,H,Q,j,_))}on(H,Q,j){return this.event(H,Q,j)}once(H,Q,j){return S(this.event)(H,Q,j)}}function Pe(G){return new we(G)}y.chain=Pe;function Ve(G,H,Q=j=>j){const j=(...re)=>P.fire(Q(...re)),_=()=>G.on(H,j),v=()=>G.removeListener(H,j),P=new l({onFirstListenerAdd:_,onLastListenerRemove:v});return P.event}y.fromNodeEventEmitter=Ve;function V(G,H,Q=j=>j){const j=(...re)=>P.fire(Q(...re)),_=()=>G.addEventListener(H,j),v=()=>G.removeEventListener(H,j),P=new l({onFirstListenerAdd:_,onLastListenerRemove:v});return P.event}y.fromDOMEventEmitter=V;function C(G){return new Promise(H=>S(G)(H))}y.toPromise=C})($||($={}));class p{constructor(S){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${S}_${p._idPool++}`}start(S){this._stopWatch=new ue.G(!0),this._listenerCount=S}stop(){if(this._stopWatch){const S=this._stopWatch.elapsed();this._elapsedOverall+=S,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${S.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}p._idPool=0;let ge=-1;class le{constructor(S,F=Math.random().toString(18).slice(2,5)){this.customThreshold=S,this.name=F,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(S){let F=ge;if(typeof this.customThreshold=="number"&&(F=this.customThreshold),F<=0||S<F)return;this._stacks||(this._stacks=new Map);const Z=new Error().stack.split(`
`).slice(3).join(`
`),W=this._stacks.get(Z)||0;if(this._stacks.set(Z,W+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=F*.5;let I,N=0;for(const[T,D]of this._stacks)(!I||N<D)&&(I=T,N=D);console.warn(`[${this.name}] potential listener LEAK detected, having ${S} listeners already. MOST frequent listener (${N}):`),console.warn(I)}return()=>{const I=this._stacks.get(Z)||0;this._stacks.set(Z,I-1)}}}class l{constructor(S){var F;this._disposed=!1,this._options=S,this._leakageMon=ge>0?new le(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((F=this._options)===null||F===void 0)&&F._profName?new p(this._options._profName):void 0}get event(){return this._event||(this._event=(S,F,Z)=>{var W;this._listeners||(this._listeners=new Te.S);const I=this._listeners.isEmpty();I&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const N=this._listeners.push(F?[S,F]:S);I&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,S,F);const T=(W=this._leakageMon)===null||W===void 0?void 0:W.check(this._listeners.size),D=(0,fe.OF)(()=>{T&&T(),this._disposed||(N(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return Z instanceof fe.SL?Z.add(D):Array.isArray(Z)&&Z.push(D),D}),this._event}fire(S){var F,Z;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Te.S);for(let W of this._listeners)this._deliveryQueue.push([W,S]);for((F=this._perfMon)===null||F===void 0||F.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[W,I]=this._deliveryQueue.shift();try{typeof W=="function"?W.call(void 0,I):W[0].call(W[1],I)}catch(N){(0,L.dL)(N)}}(Z=this._perfMon)===null||Z===void 0||Z.stop()}}dispose(){var S,F,Z,W,I;this._disposed||(this._disposed=!0,(S=this._listeners)===null||S===void 0||S.clear(),(F=this._deliveryQueue)===null||F===void 0||F.clear(),(W=(Z=this._options)===null||Z===void 0?void 0:Z.onLastListenerRemove)===null||W===void 0||W.call(Z),(I=this._leakageMon)===null||I===void 0||I.dispose())}}class x extends l{constructor(S){super(S),this._isPaused=0,this._eventQueue=new Te.S,this._mergeFn=S==null?void 0:S.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const S=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(S))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(S){this._listeners&&(this._isPaused!==0?this._eventQueue.push(S):super.fire(S))}}class A extends x{constructor(S){var F;super(S),this._delay=(F=S.delay)!==null&&F!==void 0?F:100}fire(S){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(S)}}class h{constructor(){this.buffers=[]}wrapEvent(S){return(F,Z,W)=>S(I=>{const N=this.buffers[this.buffers.length-1];N?N.push(()=>F.call(Z,I)):F.call(Z,I)},void 0,W)}bufferEvents(S){const F=[];this.buffers.push(F);const Z=S();return this.buffers.pop(),F.forEach(W=>W()),Z}}class m{constructor(){this.listening=!1,this.inputEvent=$.None,this.inputEventListener=fe.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(S){this.inputEvent=S,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=S(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(_n,_t,w){"use strict";w.d(_t,{I:function(){return L}});function L(fe){const Te=this;let ue=!1,$;return function(){return ue||(ue=!0,$=fe.apply(Te,arguments)),$}}},88226:function(_n,_t,w){"use strict";w.d(_t,{$:function(){return L}});var L;(function(fe){function Te(N){return N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}fe.is=Te;const ue=Object.freeze([]);function $(){return ue}fe.empty=$;function*p(N){yield N}fe.single=p;function ge(N){return N||ue}fe.from=ge;function le(N){return!N||N[Symbol.iterator]().next().done===!0}fe.isEmpty=le;function l(N){return N[Symbol.iterator]().next().value}fe.first=l;function x(N,T){for(const D of N)if(T(D))return!0;return!1}fe.some=x;function A(N,T){for(const D of N)if(T(D))return D}fe.find=A;function*h(N,T){for(const D of N)T(D)&&(yield D)}fe.filter=h;function*m(N,T){let D=0;for(const q of N)yield T(q,D++)}fe.map=m;function*y(...N){for(const T of N)for(const D of T)yield D}fe.concat=y;function*S(N){for(const T of N)for(const D of T)yield D}fe.concatNested=S;function F(N,T,D){let q=D;for(const te of N)q=T(q,te);return q}fe.reduce=F;function*Z(N,T,D=N.length){for(T<0&&(T+=N.length),D<0?D+=N.length:D>N.length&&(D=N.length);T<D;T++)yield N[T]}fe.slice=Z;function W(N,T=Number.POSITIVE_INFINITY){const D=[];if(T===0)return[D,N];const q=N[Symbol.iterator]();for(let te=0;te<T;te++){const X=q.next();if(X.done)return[D,fe.empty()];D.push(X.value)}return[D,{[Symbol.iterator](){return q}}]}fe.consume=W;function I(N,T,D=(q,te)=>q===te){const q=N[Symbol.iterator](),te=T[Symbol.iterator]();for(;;){const X=q.next(),ce=te.next();if(X.done!==ce.done)return!1;if(X.done)return!0;if(!D(X.value,ce.value))return!1}}fe.equals=I})(L||(L={}))},69323:function(_n,_t,w){"use strict";w.d(_t,{B9:function(){return m},F8:function(){return y},JT:function(){return Z},Jz:function(){return I},OF:function(){return S},SL:function(){return F},Wf:function(){return h},XK:function(){return W},dk:function(){return x}});var L=w(17845),fe=w(88226);const Te=!1;let ue=null;function $(N){ue=N}if(Te){const N="__is_disposable_tracked__";$(new class{trackDisposable(T){const D=new Error("Potentially leaked disposable").stack;setTimeout(()=>{T[N]||console.log(D)},3e3)}setParent(T,D){if(T&&T!==Z.None)try{T[N]=!0}catch(q){}}markAsDisposed(T){if(T&&T!==Z.None)try{T[N]=!0}catch(D){}}markAsSingleton(T){}})}function p(N){return ue==null||ue.trackDisposable(N),N}function ge(N){ue==null||ue.markAsDisposed(N)}function le(N,T){ue==null||ue.setParent(N,T)}function l(N,T){if(ue)for(const D of N)ue.setParent(D,T)}function x(N){return ue==null||ue.markAsSingleton(N),N}class A extends Error{constructor(T){super(`Encountered errors while disposing of store. Errors: [${T.join(", ")}]`),this.errors=T}}function h(N){return typeof N.dispose=="function"&&N.dispose.length===0}function m(N){if(fe.$.is(N)){let T=[];for(const D of N)if(D)try{D.dispose()}catch(q){T.push(q)}if(T.length===1)throw T[0];if(T.length>1)throw new A(T);return Array.isArray(N)?[]:N}else if(N)return N.dispose(),N}function y(...N){const T=S(()=>m(N));return l(N,T),T}function S(N){const T=p({dispose:(0,L.I)(()=>{ge(T),N()})});return T}class F{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(ge(this),this._isDisposed=!0,this.clear())}clear(){try{m(this._toDispose.values())}finally{this._toDispose.clear()}}add(T){if(!T)return T;if(T===this)throw new Error("Cannot register a disposable on itself!");return le(T,this),this._isDisposed?F.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(T),T}}F.DISABLE_DISPOSED_WARNING=!1;class Z{constructor(){this._store=new F,p(this),le(this._store,this)}dispose(){ge(this),this._store.dispose()}_register(T){if(T===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(T)}}Z.None=Object.freeze({dispose(){}});class W{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(T){var D;this._isDisposed||T===this._value||((D=this._value)===null||D===void 0||D.dispose(),T&&le(T,this),this._value=T)}clear(){this.value=void 0}dispose(){var T;this._isDisposed=!0,ge(this),(T=this._value)===null||T===void 0||T.dispose(),this._value=void 0}clearAndLeak(){const T=this._value;return this._value=void 0,T&&le(T,null),T}}class I{constructor(T){this.object=T}dispose(){}}},34502:function(_n,_t,w){"use strict";w.d(_t,{S:function(){return fe}});class L{constructor(ue){this.element=ue,this.next=L.Undefined,this.prev=L.Undefined}}L.Undefined=new L(void 0);class fe{constructor(){this._first=L.Undefined,this._last=L.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===L.Undefined}clear(){let ue=this._first;for(;ue!==L.Undefined;){const $=ue.next;ue.prev=L.Undefined,ue.next=L.Undefined,ue=$}this._first=L.Undefined,this._last=L.Undefined,this._size=0}unshift(ue){return this._insert(ue,!1)}push(ue){return this._insert(ue,!0)}_insert(ue,$){const p=new L(ue);if(this._first===L.Undefined)this._first=p,this._last=p;else if($){const le=this._last;this._last=p,p.prev=le,le.next=p}else{const le=this._first;this._first=p,p.next=le,le.prev=p}this._size+=1;let ge=!1;return()=>{ge||(ge=!0,this._remove(p))}}shift(){if(this._first!==L.Undefined){const ue=this._first.element;return this._remove(this._first),ue}}pop(){if(this._last!==L.Undefined){const ue=this._last.element;return this._remove(this._last),ue}}_remove(ue){if(ue.prev!==L.Undefined&&ue.next!==L.Undefined){const $=ue.prev;$.next=ue.next,ue.next.prev=$}else ue.prev===L.Undefined&&ue.next===L.Undefined?(this._first=L.Undefined,this._last=L.Undefined):ue.next===L.Undefined?(this._last=this._last.prev,this._last.next=L.Undefined):ue.prev===L.Undefined&&(this._first=this._first.next,this._first.prev=L.Undefined);this._size-=1}*[Symbol.iterator](){let ue=this._first;for(;ue!==L.Undefined;)yield ue.element,ue=ue.next}}},23345:function(_n,_t,w){"use strict";w.d(_t,{$L:function(){return q},ED:function(){return I},IJ:function(){return T},OS:function(){return we},WE:function(){return X},dz:function(){return N},gn:function(){return te},li:function(){return S},r:function(){return V},tY:function(){return D},xS:function(){return ce}});var L=w(97671),fe;const Te="en";let ue=!1,$=!1,p=!1,ge=!1,le=!1,l=!1,x=!1,A,h=null,m=null,y;const S=typeof self=="object"?self:typeof w.g=="object"?w.g:{};let F;typeof S.vscode!="undefined"&&typeof S.vscode.process!="undefined"?F=S.vscode.process:typeof L!="undefined"&&(F=L);const Z=typeof((fe=F==null?void 0:F.versions)===null||fe===void 0?void 0:fe.electron)=="string"&&F.type==="renderer";if(typeof navigator=="object"&&!Z)y=navigator.userAgent,ue=y.indexOf("Windows")>=0,$=y.indexOf("Macintosh")>=0,x=(y.indexOf("Macintosh")>=0||y.indexOf("iPad")>=0||y.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,p=y.indexOf("Linux")>=0,l=!0,A=navigator.language,h=A;else if(typeof F=="object"){ue=F.platform==="win32",$=F.platform==="darwin",p=F.platform==="linux",ge=p&&!!F.env.SNAP&&!!F.env.SNAP_REVISION,A=Te,h=Te;const C=F.env.VSCODE_NLS_CONFIG;if(C)try{const G=JSON.parse(C),H=G.availableLanguages["*"];A=G.locale,h=H||Te,m=G._translationsConfigFile}catch(G){}le=!0}else console.error("Unable to resolve platform.");let W=0;$?W=1:ue?W=3:p&&(W=2);const I=ue,N=$,T=p,D=le,q=l,te=x,X=y,ce=function(){if(S.setImmediate)return S.setImmediate.bind(S);if(typeof S.postMessage=="function"&&!S.importScripts){let H=[];S.addEventListener("message",j=>{if(j.data&&j.data.vscodeSetImmediateId)for(let _=0,v=H.length;_<v;_++){const P=H[_];if(P.id===j.data.vscodeSetImmediateId){H.splice(_,1),P.callback();return}}});let Q=0;return j=>{const _=++Q;H.push({id:_,callback:j}),S.postMessage({vscodeSetImmediateId:_},"*")}}if(typeof(F==null?void 0:F.nextTick)=="function")return F.nextTick.bind(F);const G=Promise.resolve();return H=>G.then(H)}(),we=$||x?2:ue?1:3;let Pe=!0,Ve=!1;function V(){if(!Ve){Ve=!0;const C=new Uint8Array(2);C[0]=1,C[1]=2,Pe=new Uint16Array(C.buffer)[0]===513}return Pe}},95830:function(_n,_t,w){"use strict";w.d(_t,{G:function(){return Te}});var L=w(23345);const fe=L.li.performance&&typeof L.li.performance.now=="function";class Te{constructor($){this._highResolution=fe&&$,this._startTime=this._now(),this._stopTime=-1}static create($=!0){return new Te($)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?L.li.performance.now():Date.now()}}},82983:function(_n,_t,w){"use strict";w.d(_t,{$i:function(){return Oe},C8:function(){return vt},GF:function(){return A},HO:function(){return Q},IO:function(){return h},K7:function(){return ft},Kw:function(){return rt},LC:function(){return S},Mh:function(){return ce},P1:function(){return we},PJ:function(){return Mt},Qe:function(){return Ze},R1:function(){return x},RP:function(){return P},S6:function(){return et},TT:function(){return I},Ut:function(){return _},V8:function(){return F},WU:function(){return Te},YK:function(){return Ve},YU:function(){return ue},ZG:function(){return Pe},ZH:function(){return C},ab:function(){return Ye},c1:function(){return Ae},df:function(){return q},ec:function(){return $},fi:function(){return ze},fy:function(){return p},j3:function(){return ge},j_:function(){return T},m5:function(){return L},mK:function(){return D},mr:function(){return m},oH:function(){return B},oL:function(){return le},ok:function(){return X},ow:function(){return Z},qq:function(){return te},qu:function(){return W},rL:function(){return V},uS:function(){return wt},un:function(){return l},uq:function(){return y},vH:function(){return H},xe:function(){return qe},zY:function(){return N}});function L(R){return!R||typeof R!="string"?!0:R.trim().length===0}const fe=/{(\d+)}/g;function Te(R,...ie){return ie.length===0?R:R.replace(fe,function(be,k){const Y=parseInt(k,10);return isNaN(Y)||Y<0||Y>=ie.length?be:ie[Y]})}function ue(R){return R.replace(/[<>&]/g,function(ie){switch(ie){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return ie}})}function $(R){return R.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function p(R,ie=" "){const be=ge(R,ie);return le(be,ie)}function ge(R,ie){if(!R||!ie)return R;const be=ie.length;if(be===0||R.length===0)return R;let k=0;for(;R.indexOf(ie,k)===k;)k=k+be;return R.substring(k)}function le(R,ie){if(!R||!ie)return R;const be=ie.length,k=R.length;if(be===0||k===0)return R;let Y=k,J=-1;for(;J=R.lastIndexOf(ie,Y-1),!(J===-1||J+be!==Y);){if(J===0)return"";Y=J}return R.substring(0,Y)}function l(R){return R.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function x(R){return R.replace(/\*/g,"")}function A(R,ie,be={}){if(!R)throw new Error("Cannot create regex from empty string");ie||(R=$(R)),be.wholeWord&&(/\B/.test(R.charAt(0))||(R="\\b"+R),/\B/.test(R.charAt(R.length-1))||(R=R+"\\b"));let k="";return be.global&&(k+="g"),be.matchCase||(k+="i"),be.multiline&&(k+="m"),be.unicode&&(k+="u"),new RegExp(R,k)}function h(R){return R.source==="^"||R.source==="^$"||R.source==="$"||R.source==="^\\s*$"?!1:!!(R.exec("")&&R.lastIndex===0)}function m(R){return(R.global?"g":"")+(R.ignoreCase?"i":"")+(R.multiline?"m":"")+(R.unicode?"u":"")}function y(R){return R.split(/\r\n|\r|\n/)}function S(R){for(let ie=0,be=R.length;ie<be;ie++){const k=R.charCodeAt(ie);if(k!==32&&k!==9)return ie}return-1}function F(R,ie=0,be=R.length){for(let k=ie;k<be;k++){const Y=R.charCodeAt(k);if(Y!==32&&Y!==9)return R.substring(ie,k)}return R.substring(ie,be)}function Z(R,ie=R.length-1){for(let be=ie;be>=0;be--){const k=R.charCodeAt(be);if(k!==32&&k!==9)return be}return-1}function W(R,ie){return R<ie?-1:R>ie?1:0}function I(R,ie,be=0,k=R.length,Y=0,J=ie.length){for(;be<k&&Y<J;be++,Y++){let ne=R.charCodeAt(be),Ee=ie.charCodeAt(Y);if(ne<Ee)return-1;if(ne>Ee)return 1}const se=k-be,ee=J-Y;return se<ee?-1:se>ee?1:0}function N(R,ie){return T(R,ie,0,R.length,0,ie.length)}function T(R,ie,be=0,k=R.length,Y=0,J=ie.length){for(;be<k&&Y<J;be++,Y++){let ne=R.charCodeAt(be),Ee=ie.charCodeAt(Y);if(ne===Ee)continue;if(ne>=128||Ee>=128)return I(R.toLowerCase(),ie.toLowerCase(),be,k,Y,J);D(ne)&&(ne-=32),D(Ee)&&(Ee-=32);const Be=ne-Ee;if(Be!==0)return Be}const se=k-be,ee=J-Y;return se<ee?-1:se>ee?1:0}function D(R){return R>=97&&R<=122}function q(R){return R>=65&&R<=90}function te(R,ie){return R.length===ie.length&&T(R,ie)===0}function X(R,ie){const be=ie.length;return ie.length>R.length?!1:T(R,ie,0,be)===0}function ce(R,ie){let be,k=Math.min(R.length,ie.length);for(be=0;be<k;be++)if(R.charCodeAt(be)!==ie.charCodeAt(be))return be;return k}function we(R,ie){let be,k=Math.min(R.length,ie.length);const Y=R.length-1,J=ie.length-1;for(be=0;be<k;be++)if(R.charCodeAt(Y-be)!==ie.charCodeAt(J-be))return be;return k}function Pe(R){return 55296<=R&&R<=56319}function Ve(R){return 56320<=R&&R<=57343}function V(R,ie){return(R-55296<<10)+(ie-56320)+65536}function C(R,ie,be){const k=R.charCodeAt(be);if(Pe(k)&&be+1<ie){const Y=R.charCodeAt(be+1);if(Ve(Y))return V(k,Y)}return k}function G(R,ie){const be=R.charCodeAt(ie-1);if(Ve(be)&&ie>1){const k=R.charCodeAt(ie-2);if(Pe(k))return V(k,be)}return be}function H(R,ie){const be=ye.getInstance(),k=ie,Y=R.length,J=C(R,Y,ie);ie+=J>=65536?2:1;let se=be.getGraphemeBreakType(J);for(;ie<Y;){const ee=C(R,Y,ie),ne=be.getGraphemeBreakType(ee);if(ze(se,ne))break;ie+=ee>=65536?2:1,se=ne}return ie-k}function Q(R,ie){const be=ye.getInstance(),k=ie,Y=G(R,ie);ie-=Y>=65536?2:1;let J=be.getGraphemeBreakType(Y);for(;ie>0;){const se=G(R,ie),ee=be.getGraphemeBreakType(se);if(ze(ee,J))break;ie-=se>=65536?2:1,J=ee}return k-ie}const j=/(?:[\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 _(R){return j.test(R)}const v=/(?:[\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 P(R){return v.test(R)}const re=/^[\t\n\r\x20-\x7E]*$/;function Oe(R){return re.test(R)}const Ze=/[\u2028\u2029]/;function Ye(R){return Ze.test(R)}function qe(R){for(let ie=0,be=R.length;ie<be;ie++)if(ft(R.charCodeAt(ie)))return!0;return!1}function ft(R){return R=+R,R>=11904&&R<=55215||R>=63744&&R<=64255||R>=65281&&R<=65374}function vt(R){return R>=127462&&R<=127487||R===8986||R===8987||R===9200||R===9203||R>=9728&&R<=10175||R===11088||R===11093||R>=127744&&R<=128591||R>=128640&&R<=128764||R>=128992&&R<=129003||R>=129280&&R<=129535||R>=129648&&R<=129750}const Ae="\uFEFF";function wt(R){return!!(R&&R.length>0&&R.charCodeAt(0)===65279)}function rt(R,ie=!1){return R?(ie&&(R=R.replace(/\\./g,"")),R.toLowerCase()!==R):!1}function Mt(R){return R=R%(2*26),R<26?String.fromCharCode(97+R):String.fromCharCode(65+R-26)}function et(R){return ye.getInstance().getGraphemeBreakType(R)}function ze(R,ie){return R===0?ie!==5&&ie!==7:R===2&&ie===3?!1:R===4||R===2||R===3||ie===4||ie===2||ie===3?!0:!(R===8&&(ie===8||ie===9||ie===11||ie===12)||(R===11||R===9)&&(ie===9||ie===10)||(R===12||R===10)&&ie===10||ie===5||ie===13||ie===7||R===1||R===13&&ie===14||R===6&&ie===6)}class ye{constructor(){this._data=me()}static getInstance(){return ye._INSTANCE||(ye._INSTANCE=new ye),ye._INSTANCE}getGraphemeBreakType(ie){if(ie<32)return ie===10?3:ie===13?2:4;if(ie<127)return 0;const be=this._data,k=be.length/3;let Y=1;for(;Y<=k;)if(ie<be[3*Y])Y=2*Y;else if(ie>be[3*Y+1])Y=2*Y+1;else return be[3*Y+2];return 0}}ye._INSTANCE=null;function me(){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 B(R,ie){if(R===0)return 0;const be=xe(R,ie);if(be!==void 0)return be;const k=G(ie,R);return R-=Le(k),R}function xe(R,ie){let be=G(ie,R);for(R-=Le(be);K(be)||be===65039||be===8419;){if(R===0)return;be=G(ie,R),R-=Le(be)}if(vt(be)){if(R>=0){const k=G(ie,R);k===8205&&(R-=Le(k))}return R}}function Le(R){return R>=65536?2:1}function K(R){return 127995<=R&&R<=127999}},72999:function(_n,_t,w){"use strict";w.d(_t,{$E:function(){return S},$K:function(){return ge},D8:function(){return h},HD:function(){return fe},IU:function(){return F},Jp:function(){return le},Kn:function(){return Te},cW:function(){return x},f6:function(){return Z},hj:function(){return ue},jn:function(){return $},kJ:function(){return L},mf:function(){return A},o8:function(){return p},p_:function(){return l},vE:function(){return W}});function L(I){return Array.isArray(I)}function fe(I){return typeof I=="string"}function Te(I){return typeof I=="object"&&I!==null&&!Array.isArray(I)&&!(I instanceof RegExp)&&!(I instanceof Date)}function ue(I){return typeof I=="number"&&!isNaN(I)}function $(I){return I===!0||I===!1}function p(I){return typeof I=="undefined"}function ge(I){return!le(I)}function le(I){return p(I)||I===null}function l(I,N){if(!I)throw new Error(N?`Unexpected type, expected '${N}'`:"Unexpected type")}function x(I){if(le(I))throw new Error("Assertion Failed: argument is undefined or null");return I}function A(I){return typeof I=="function"}function h(I,N){const T=Math.min(I.length,N.length);for(let D=0;D<T;D++)m(I[D],N[D])}function m(I,N){if(fe(N)){if(typeof I!==N)throw new Error(`argument does not match constraint: typeof ${N}`)}else if(A(N)){try{if(I instanceof N)return}catch(T){}if(!le(I)&&I.constructor===N||N.length===1&&N.call(void 0,I)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function y(I){let N=[],T=Object.getPrototypeOf(I);for(;Object.prototype!==T;)N=N.concat(Object.getOwnPropertyNames(T)),T=Object.getPrototypeOf(T);return N}function S(I){const N=[];for(const T of y(I))typeof I[T]=="function"&&N.push(T);return N}function F(I,N){const T=q=>function(){const te=Array.prototype.slice.call(arguments,0);return N(q,te)};let D={};for(const q of I)D[q]=T(q);return D}function Z(I){return I===null?void 0:I}function W(I,N="Unreachable"){throw new Error(N)}},13268:function(_n,_t,w){"use strict";w.d(_t,{N:function(){return fe}});function L(Te,ue){let $;return ue.length===0?$=Te:$=Te.replace(/\{(\d+)\}/g,function(p,ge){const le=ge[0];return typeof ue[le]!="undefined"?ue[le]:p}),$}function fe(Te,ue,...$){return L(ue,$)}},96236:function(_n,_t,w){"use strict";w.d(_t,{BH:function(){return F},NZ:function(){return Z},U8:function(){return W},co:function(){return S},eH:function(){return y},vr:function(){return m}});var L=w(75918),fe=w(52615),Te=w(4348),ue=w(88226),$=w(69323),p=w(34502),ge=w(35884),le=w(90689),l=w(16925),x=w(49055),A=function(I,N,T,D){var q=arguments.length,te=q<3?N:D===null?D=Object.getOwnPropertyDescriptor(N,T):D,X;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")te=Reflect.decorate(I,N,T,D);else for(var ce=I.length-1;ce>=0;ce--)(X=I[ce])&&(te=(q<3?X(te):q>3?X(N,T,te):X(N,T))||te);return q>3&&te&&Object.defineProperty(N,T,te),te},h=function(I,N){return function(T,D){N(T,D,I)}};function m(I){return I.command!==void 0}class y{constructor(N){this.id=y._idPool++,this._debugName=N}}y._idPool=0,y.CommandPalette=new y("CommandPalette"),y.EditorContext=new y("EditorContext"),y.SimpleEditorContext=new y("SimpleEditorContext"),y.EditorContextCopy=new y("EditorContextCopy"),y.EditorContextPeek=new y("EditorContextPeek"),y.MenubarEditMenu=new y("MenubarEditMenu"),y.MenubarCopy=new y("MenubarCopy"),y.MenubarGoMenu=new y("MenubarGoMenu"),y.MenubarSelectionMenu=new y("MenubarSelectionMenu"),y.InlineCompletionsActions=new y("InlineCompletionsActions");const S=(0,l.yh)("menuService"),F=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Te.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:I=>I===y.CommandPalette}}addCommand(I){return this.addCommands(ue.$.single(I))}addCommands(I){for(const N of I)this._commands.set(N.id,N);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,$.OF)(()=>{let N=!1;for(const T of I)N=this._commands.delete(T.id)||N;N&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(I){return this._commands.get(I)}getCommands(){const I=new Map;return this._commands.forEach((N,T)=>I.set(T,N)),I}appendMenuItem(I,N){return this.appendMenuItems(ue.$.single({id:I,item:N}))}appendMenuItems(I){const N=new Set,T=new p.S;for(const{id:D,item:q}of I){let te=this._menuItems.get(D);te||(te=new p.S,this._menuItems.set(D,te)),T.push(te.push(q)),N.add(D)}return this._onDidChangeMenu.fire(N),(0,$.OF)(()=>{if(T.size>0){for(let D of T)D();this._onDidChangeMenu.fire(N),T.clear()}})}getMenuItems(I){let N;return this._menuItems.has(I)?N=[...this._menuItems.get(I)]:N=[],I===y.CommandPalette&&this._appendImplicitItems(N),N}_appendImplicitItems(I){const N=new Set;for(const T of I)m(T)&&(N.add(T.command.id),T.alt&&N.add(T.alt.id));this._commands.forEach((T,D)=>{N.has(D)||I.push({command:T})})}};class Z extends L.wY{constructor(N,T,D,q){super(`submenuitem.${N.submenu.id}`,typeof N.title=="string"?N.title:N.title.value,[],"submenu"),this.item=N,this._menuService=T,this._contextKeyService=D,this._options=q}get actions(){const N=[],T=this._menuService.createMenu(this.item.submenu,this._contextKeyService),D=T.getActions(this._options);T.dispose();for(const[,q]of D)q.length>0&&(N.push(...q),N.push(new L.Z0));return N.length&&N.pop(),N}}let W=class Tl{constructor(N,T,D,q,te){var X,ce;if(this._commandService=te,this.id=N.id,this.label=D!=null&&D.renderShortTitle&&N.shortTitle?typeof N.shortTitle=="string"?N.shortTitle:N.shortTitle.value:typeof N.title=="string"?N.title:N.title.value,this.tooltip=(ce=typeof N.tooltip=="string"?N.tooltip:(X=N.tooltip)===null||X===void 0?void 0:X.value)!==null&&ce!==void 0?ce:"",this.enabled=!N.precondition||q.contextMatchesRules(N.precondition),this.checked=void 0,N.toggled){const we=N.toggled.condition?N.toggled:{condition:N.toggled};this.checked=q.contextMatchesRules(we.condition),this.checked&&we.tooltip&&(this.tooltip=typeof we.tooltip=="string"?we.tooltip:we.tooltip.value),we.title&&(this.label=typeof we.title=="string"?we.title:we.title.value)}this.item=N,this.alt=T?new Tl(T,void 0,D,q,te):void 0,this._options=D,x.kS.isThemeIcon(N.icon)&&(this.class=fe.dT.asClassName(N.icon))}dispose(){}run(...N){var T,D;let q=[];return!((T=this._options)===null||T===void 0)&&T.arg&&(q=[...q,this._options.arg]),!((D=this._options)===null||D===void 0)&&D.shouldForwardArgs&&(q=[...q,...N]),this._commandService.executeCommand(this.id,...q)}};W=A([h(3,le.i6),h(4,ge.H)],W)},35884:function(_n,_t,w){"use strict";w.d(_t,{H:function(){return ge},P:function(){return le}});var L=w(4348),fe=w(88226),Te=w(69323),ue=w(34502),$=w(72999),p=w(16925);const ge=(0,p.yh)("commandService"),le=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new L.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(l,x){if(!l)throw new Error("invalid command");if(typeof l=="string"){if(!x)throw new Error("invalid command");return this.registerCommand({id:l,handler:x})}if(l.description){const S=[];for(let Z of l.description.args)S.push(Z.constraint);const F=l.handler;l.handler=function(Z,...W){return(0,$.D8)(W,S),F(Z,...W)}}const{id:A}=l;let h=this._commands.get(A);h||(h=new ue.S,this._commands.set(A,h));let m=h.unshift(l),y=(0,Te.OF)(()=>{m();const S=this._commands.get(A);S!=null&&S.isEmpty()&&this._commands.delete(A)});return this._onDidRegisterCommand.fire(A),y}registerCommandAlias(l,x){return le.registerCommand(l,(A,...h)=>A.get(ge).executeCommand(x,...h))}getCommand(l){const x=this._commands.get(l);if(!(!x||x.isEmpty()))return fe.$.first(x)}getCommands(){const l=new Map;for(const x of this._commands.keys()){const A=this.getCommand(x);A&&l.set(x,A)}return l}};le.registerCommand("noop",()=>{})},90689:function(_n,_t,w){"use strict";w.d(_t,{Ao:function(){return ge},Eq:function(){return V},Fb:function(){return le},K8:function(){return H},i6:function(){return Ve},uy:function(){return Pe}});var L=w(23345),fe=w(82983),Te=w(16925);let ue=L.WE||"";const $=new Map;$.set("false",!1),$.set("true",!0),$.set("isMac",L.dz),$.set("isLinux",L.IJ),$.set("isWindows",L.ED),$.set("isWeb",L.$L),$.set("isMacNative",L.dz&&!L.$L),$.set("isEdge",ue.indexOf("Edg/")>=0),$.set("isFirefox",ue.indexOf("Firefox")>=0),$.set("isChrome",ue.indexOf("Chrome")>=0),$.set("isSafari",ue.indexOf("Safari")>=0);const p=Object.prototype.hasOwnProperty;class ge{static has(_){return h.create(_)}static equals(_,v){return m.create(_,v)}static regex(_,v){return q.create(_,v)}static not(_){return Z.create(_)}static and(..._){return ce.create(_,null)}static or(..._){return we.create(_,null,!0)}static deserialize(_,v=!1){if(_)return this._deserializeOrExpression(_,v)}static _deserializeOrExpression(_,v){let P=_.split("||");return we.create(P.map(re=>this._deserializeAndExpression(re,v)),null,!0)}static _deserializeAndExpression(_,v){let P=_.split("&&");return ce.create(P.map(re=>this._deserializeOne(re,v)),null)}static _deserializeOne(_,v){if(_=_.trim(),_.indexOf("!=")>=0){let P=_.split("!=");return F.create(P[0].trim(),this._deserializeValue(P[1],v))}if(_.indexOf("==")>=0){let P=_.split("==");return m.create(P[0].trim(),this._deserializeValue(P[1],v))}if(_.indexOf("=~")>=0){let P=_.split("=~");return q.create(P[0].trim(),this._deserializeRegexValue(P[1],v))}if(_.indexOf(" in ")>=0){let P=_.split(" in ");return y.create(P[0].trim(),P[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(_)){const P=_.split(">=");return N.create(P[0].trim(),P[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(_)){const P=_.split(">");return I.create(P[0].trim(),P[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(_)){const P=_.split("<=");return D.create(P[0].trim(),P[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(_)){const P=_.split("<");return T.create(P[0].trim(),P[1].trim())}return/^\!\s*/.test(_)?Z.create(_.substr(1).trim()):h.create(_)}static _deserializeValue(_,v){if(_=_.trim(),_==="true")return!0;if(_==="false")return!1;let P=/^'([^']*)'$/.exec(_);return P?P[1].trim():_}static _deserializeRegexValue(_,v){if((0,fe.m5)(_)){if(v)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let P=_.indexOf("/"),re=_.lastIndexOf("/");if(P===re||P<0){if(v)throw new Error(`bad regexp-value '${_}', missing /-enclosure`);return console.warn(`bad regexp-value '${_}', missing /-enclosure`),null}let Oe=_.slice(P+1,re),Ze=_[re+1]==="i"?"i":"";try{return new RegExp(Oe,Ze)}catch(Ye){if(v)throw new Error(`bad regexp-value '${_}', parse error: ${Ye}`);return console.warn(`bad regexp-value '${_}', parse error: ${Ye}`),null}}}function le(j,_){const v=j?j.substituteConstants():void 0,P=_?_.substituteConstants():void 0;return!v&&!P?!0:!v||!P?!1:v.equals(P)}function l(j,_){return j.cmp(_)}class x{constructor(){this.type=0}cmp(_){return this.type-_.type}equals(_){return _.type===this.type}substituteConstants(){return this}evaluate(_){return!1}serialize(){return"false"}keys(){return[]}negate(){return A.INSTANCE}}x.INSTANCE=new x;class A{constructor(){this.type=1}cmp(_){return this.type-_.type}equals(_){return _.type===this.type}substituteConstants(){return this}evaluate(_){return!0}serialize(){return"true"}keys(){return[]}negate(){return x.INSTANCE}}A.INSTANCE=new A;class h{constructor(_,v){this.key=_,this.negated=v,this.type=2}static create(_,v=null){const P=$.get(_);return typeof P=="boolean"?P?A.INSTANCE:x.INSTANCE:new h(_,v)}cmp(_){return _.type!==this.type?this.type-_.type:C(this.key,_.key)}equals(_){return _.type===this.type?this.key===_.key:!1}substituteConstants(){const _=$.get(this.key);return typeof _=="boolean"?_?A.INSTANCE:x.INSTANCE:this}evaluate(_){return!!_.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=Z.create(this.key,this)),this.negated}}class m{constructor(_,v,P){this.key=_,this.value=v,this.negated=P,this.type=4}static create(_,v,P=null){if(typeof v=="boolean")return v?h.create(_,P):Z.create(_,P);const re=$.get(_);return typeof re=="boolean"?v===(re?"true":"false")?A.INSTANCE:x.INSTANCE:new m(_,v,P)}cmp(_){return _.type!==this.type?this.type-_.type:G(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){const _=$.get(this.key);if(typeof _=="boolean"){const v=_?"true":"false";return this.value===v?A.INSTANCE:x.INSTANCE}return this}evaluate(_){return _.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=F.create(this.key,this.value,this)),this.negated}}class y{constructor(_,v){this.key=_,this.valueKey=v,this.type=10,this.negated=null}static create(_,v){return new y(_,v)}cmp(_){return _.type!==this.type?this.type-_.type:G(this.key,this.valueKey,_.key,_.valueKey)}equals(_){return _.type===this.type?this.key===_.key&&this.valueKey===_.valueKey:!1}substituteConstants(){return this}evaluate(_){const v=_.getValue(this.valueKey),P=_.getValue(this.key);return Array.isArray(v)?v.indexOf(P)>=0:typeof P=="string"&&typeof v=="object"&&v!==null?p.call(v,P):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=S.create(this)),this.negated}}class S{constructor(_){this._actual=_,this.type=11}static create(_){return new S(_)}cmp(_){return _.type!==this.type?this.type-_.type:this._actual.cmp(_._actual)}equals(_){return _.type===this.type?this._actual.equals(_._actual):!1}substituteConstants(){return this}evaluate(_){return!this._actual.evaluate(_)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class F{constructor(_,v,P){this.key=_,this.value=v,this.negated=P,this.type=5}static create(_,v,P=null){if(typeof v=="boolean")return v?Z.create(_,P):h.create(_,P);const re=$.get(_);return typeof re=="boolean"?v===(re?"true":"false")?x.INSTANCE:A.INSTANCE:new F(_,v,P)}cmp(_){return _.type!==this.type?this.type-_.type:G(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){const _=$.get(this.key);if(typeof _=="boolean"){const v=_?"true":"false";return this.value===v?x.INSTANCE:A.INSTANCE}return this}evaluate(_){return _.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=m.create(this.key,this.value,this)),this.negated}}class Z{constructor(_,v){this.key=_,this.negated=v,this.type=3}static create(_,v=null){const P=$.get(_);return typeof P=="boolean"?P?x.INSTANCE:A.INSTANCE:new Z(_,v)}cmp(_){return _.type!==this.type?this.type-_.type:C(this.key,_.key)}equals(_){return _.type===this.type?this.key===_.key:!1}substituteConstants(){const _=$.get(this.key);return typeof _=="boolean"?_?x.INSTANCE:A.INSTANCE:this}evaluate(_){return!_.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=h.create(this.key,this)),this.negated}}function W(j,_){if(typeof j=="string"){const v=parseFloat(j);isNaN(v)||(j=v)}return typeof j=="string"||typeof j=="number"?_(j):x.INSTANCE}class I{constructor(_,v,P){this.key=_,this.value=v,this.negated=P,this.type=12}static create(_,v,P=null){return W(v,re=>new I(_,re,P))}cmp(_){return _.type!==this.type?this.type-_.type:G(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=D.create(this.key,this.value,this)),this.negated}}class N{constructor(_,v,P){this.key=_,this.value=v,this.negated=P,this.type=13}static create(_,v,P=null){return W(v,re=>new N(_,re,P))}cmp(_){return _.type!==this.type?this.type-_.type:G(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=T.create(this.key,this.value,this)),this.negated}}class T{constructor(_,v,P){this.key=_,this.value=v,this.negated=P,this.type=14}static create(_,v,P=null){return W(v,re=>new T(_,re,P))}cmp(_){return _.type!==this.type?this.type-_.type:G(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=N.create(this.key,this.value,this)),this.negated}}class D{constructor(_,v,P){this.key=_,this.value=v,this.negated=P,this.type=15}static create(_,v,P=null){return W(v,re=>new D(_,re,P))}cmp(_){return _.type!==this.type?this.type-_.type:G(this.key,this.value,_.key,_.value)}equals(_){return _.type===this.type?this.key===_.key&&this.value===_.value:!1}substituteConstants(){return this}evaluate(_){return typeof this.value=="string"?!1:parseFloat(_.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 q{constructor(_,v){this.key=_,this.regexp=v,this.type=7,this.negated=null}static create(_,v){return new q(_,v)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.key<_.key)return-1;if(this.key>_.key)return 1;const v=this.regexp?this.regexp.source:"",P=_.regexp?_.regexp.source:"";return v<P?-1:v>P?1:0}equals(_){if(_.type===this.type){const v=this.regexp?this.regexp.source:"",P=_.regexp?_.regexp.source:"";return this.key===_.key&&v===P}return!1}substituteConstants(){return this}evaluate(_){let v=_.getValue(this.key);return this.regexp?this.regexp.test(v):!1}serialize(){const _=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${_}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=te.create(this)),this.negated}}class te{constructor(_){this._actual=_,this.type=8}static create(_){return new te(_)}cmp(_){return _.type!==this.type?this.type-_.type:this._actual.cmp(_._actual)}equals(_){return _.type===this.type?this._actual.equals(_._actual):!1}substituteConstants(){return this}evaluate(_){return!this._actual.evaluate(_)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function X(j){let _=null;for(let v=0,P=j.length;v<P;v++){const re=j[v].substituteConstants();if(j[v]!==re&&_===null){_=[];for(let Oe=0;Oe<v;Oe++)_[Oe]=j[Oe]}_!==null&&(_[v]=re)}return _===null?j:_}class ce{constructor(_,v){this.expr=_,this.negated=v,this.type=6}static create(_,v){return ce._normalizeArr(_,v)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.expr.length<_.expr.length)return-1;if(this.expr.length>_.expr.length)return 1;for(let v=0,P=this.expr.length;v<P;v++){const re=l(this.expr[v],_.expr[v]);if(re!==0)return re}return 0}equals(_){if(_.type===this.type){if(this.expr.length!==_.expr.length)return!1;for(let v=0,P=this.expr.length;v<P;v++)if(!this.expr[v].equals(_.expr[v]))return!1;return!0}return!1}substituteConstants(){const _=X(this.expr);return _===this.expr?this:ce.create(_,this.negated)}evaluate(_){for(let v=0,P=this.expr.length;v<P;v++)if(!this.expr[v].evaluate(_))return!1;return!0}static _normalizeArr(_,v){const P=[];let re=!1;for(const Oe of _)if(Oe){if(Oe.type===1){re=!0;continue}if(Oe.type===0)return x.INSTANCE;if(Oe.type===6){P.push(...Oe.expr);continue}P.push(Oe)}if(P.length===0&&re)return A.INSTANCE;if(P.length!==0){if(P.length===1)return P[0];P.sort(l);for(let Oe=1;Oe<P.length;Oe++)P[Oe-1].equals(P[Oe])&&(P.splice(Oe,1),Oe--);if(P.length===1)return P[0];for(;P.length>1;){const Oe=P[P.length-1];if(Oe.type!==9)break;P.pop();const Ze=P.pop(),Ye=P.length===0,qe=we.create(Oe.expr.map(ft=>ce.create([ft,Ze],null)),null,Ye);qe&&(P.push(qe),P.sort(l))}return P.length===1?P[0]:new ce(P,v)}}serialize(){return this.expr.map(_=>_.serialize()).join(" && ")}keys(){const _=[];for(let v of this.expr)_.push(...v.keys());return _}negate(){if(!this.negated){const _=[];for(let v of this.expr)_.push(v.negate());this.negated=we.create(_,this,!0)}return this.negated}}class we{constructor(_,v){this.expr=_,this.negated=v,this.type=9}static create(_,v,P){return we._normalizeArr(_,v,P)}cmp(_){if(_.type!==this.type)return this.type-_.type;if(this.expr.length<_.expr.length)return-1;if(this.expr.length>_.expr.length)return 1;for(let v=0,P=this.expr.length;v<P;v++){const re=l(this.expr[v],_.expr[v]);if(re!==0)return re}return 0}equals(_){if(_.type===this.type){if(this.expr.length!==_.expr.length)return!1;for(let v=0,P=this.expr.length;v<P;v++)if(!this.expr[v].equals(_.expr[v]))return!1;return!0}return!1}substituteConstants(){const _=X(this.expr);return _===this.expr?this:we.create(_,this.negated,!1)}evaluate(_){for(let v=0,P=this.expr.length;v<P;v++)if(this.expr[v].evaluate(_))return!0;return!1}static _normalizeArr(_,v,P){let re=[],Oe=!1;if(_){for(let Ze=0,Ye=_.length;Ze<Ye;Ze++){const qe=_[Ze];if(qe){if(qe.type===0){Oe=!0;continue}if(qe.type===1)return A.INSTANCE;if(qe.type===9){re=re.concat(qe.expr);continue}re.push(qe)}}if(re.length===0&&Oe)return x.INSTANCE;re.sort(l)}if(re.length!==0){if(re.length===1)return re[0];for(let Ze=1;Ze<re.length;Ze++)re[Ze-1].equals(re[Ze])&&(re.splice(Ze,1),Ze--);if(re.length===1)return re[0];if(P){for(let Ze=0;Ze<re.length;Ze++)for(let Ye=Ze+1;Ye<re.length;Ye++)H(re[Ze],re[Ye])&&(re.splice(Ye,1),Ye--);if(re.length===1)return re[0]}return new we(re,v)}}serialize(){return this.expr.map(_=>_.serialize()).join(" || ")}keys(){const _=[];for(let v of this.expr)_.push(...v.keys());return _}negate(){if(!this.negated){let _=[];for(let v of this.expr)_.push(v.negate());for(;_.length>1;){const v=_.shift(),P=_.shift(),re=[];for(const Ze of Q(v))for(const Ye of Q(P))re.push(ce.create([Ze,Ye],null));const Oe=_.length===0;_.unshift(we.create(re,null,Oe))}this.negated=_[0]}return this.negated}}class Pe extends h{constructor(_,v,P){super(_,null),this._defaultValue=v,typeof P=="object"?Pe._info.push(Object.assign(Object.assign({},P),{key:_})):P!==!0&&Pe._info.push({key:_,description:P,type:v!=null?typeof v:void 0})}static all(){return Pe._info.values()}bindTo(_){return _.createKey(this.key,this._defaultValue)}getValue(_){return _.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(_){return m.create(this.key,_)}}Pe._info=[];const Ve=(0,Te.yh)("contextKeyService"),V="setContext";function C(j,_){return j<_?-1:j>_?1:0}function G(j,_,v,P){return j<v?-1:j>v?1:_<P?-1:_>P?1:0}function H(j,_){if(_.type===6&&j.type!==9&&j.type!==6){for(const re of _.expr)if(j.equals(re))return!0}const v=j.negate(),P=Q(v).concat(Q(_));P.sort(l);for(let re=0;re<P.length;re++){const Ze=P[re].negate();for(let Ye=re+1;Ye<P.length;Ye++){const qe=P[Ye];if(Ze.equals(qe))return!0}}return!1}function Q(j){return j.type===9?j.expr:[j]}},16925:function(_n,_t,w){"use strict";w.d(_t,{I8:function(){return L},TG:function(){return fe},jt:function(){return $},yh:function(){return ue}});var L;(function(p){p.serviceIds=new Map,p.DI_TARGET="$di$target",p.DI_DEPENDENCIES="$di$dependencies";function ge(le){return le[p.DI_DEPENDENCIES]||[]}p.getServiceDependencies=ge})(L||(L={}));const fe=ue("instantiationService");function Te(p,ge,le,l){ge[L.DI_TARGET]===ge?ge[L.DI_DEPENDENCIES].push({id:p,index:le,optional:l}):(ge[L.DI_DEPENDENCIES]=[{id:p,index:le,optional:l}],ge[L.DI_TARGET]=ge)}function ue(p){if(L.serviceIds.has(p))return L.serviceIds.get(p);const ge=function(le,l,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Te(ge,le,x,!1)};return ge.toString=()=>p,L.serviceIds.set(p,ge),ge}function $(p){return function(ge,le,l){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Te(p,ge,l,!0)}}},44650:function(_n,_t,w){"use strict";w.d(_t,{B:function(){return ue}});var L=w(76068),fe=w(72999);class Te{constructor(){this.data=new Map}add(p,ge){L.ok(fe.HD(p)),L.ok(fe.Kn(ge)),L.ok(!this.data.has(p),"There is already an extension with this id"),this.data.set(p,ge)}as(p){return this.data.get(p)||null}}const ue=new Te},66213:function(_n,_t,w){"use strict";w.d(_t,{e:function(){return L}});var L;(function(fe){fe.DARK="dark",fe.LIGHT="light",fe.HIGH_CONTRAST="hc"})(L||(L={}))},49055:function(_n,_t,w){"use strict";w.d(_t,{EN:function(){return l},IP:function(){return h},Ic:function(){return S},XE:function(){return ge},bB:function(){return F},kS:function(){return x},m6:function(){return A}});var L=w(52615),fe=w(4348),Te=w(69323),ue=w(16925),$=w(44650),p=w(66213);const ge=(0,ue.yh)("themeService");var le;(function(Z){function W(I){return I&&typeof I=="object"&&typeof I.id=="string"}Z.isThemeColor=W})(le||(le={}));function l(Z){return{id:Z}}var x;(function(Z){function W(te){return te&&typeof te=="object"&&typeof te.id=="string"&&(typeof te.color=="undefined"||le.isThemeColor(te.color))}Z.isThemeIcon=W;const I=new RegExp(`^\\$\\((${L.dT.iconNameExpression}(?:${L.dT.iconModifierExpression})?)\\)$`);function N(te){const X=I.exec(te);if(!X)return;let[,ce]=X;return{id:ce}}Z.fromString=N;function T(te,X){let ce=te.id;const we=ce.lastIndexOf("~");return we!==-1&&(ce=ce.substring(0,we)),X&&(ce=`${ce}~${X}`),{id:ce}}Z.modify=T;function D(te,X){var ce,we;return te.id===X.id&&((ce=te.color)===null||ce===void 0?void 0:ce.id)===((we=X.color)===null||we===void 0?void 0:we.id)}Z.isEqual=D;function q(te,X){return{id:te.id,color:X?l(X):void 0}}Z.asThemeIcon=q,Z.asClassNameArray=L.dT.asClassNameArray,Z.asClassName=L.dT.asClassName,Z.asCSSSelector=L.dT.asCSSSelector})(x||(x={}));function A(Z){switch(Z){case p.e.DARK:return"vs-dark";case p.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const h={ThemingContribution:"base.contributions.theming"};class m{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new fe.Q5}onColorThemeChange(W){return this.themingParticipants.push(W),this.onThemingParticipantAddedEmitter.fire(W),(0,Te.OF)(()=>{const I=this.themingParticipants.indexOf(W);this.themingParticipants.splice(I,1)})}getThemingParticipants(){return this.themingParticipants}}let y=new m;$.B.add(h.ThemingContribution,y);function S(Z){return y.onColorThemeChange(Z)}class F extends Te.JT{constructor(W){super(),this.themeService=W,this.theme=W.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(I=>this.onThemeChange(I)))}onThemeChange(W){this.theme=W,this.updateStyles()}updateStyles(){}}},96478:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return te}});var L=w(54476),fe=w(20068),Te=w(42978),ue=w(75931),$=w(65030),p=w(92310),ge=w.n(p),le=w(8654),l=w(59301),x=w(10228),A=w(16089),h=x.Z.ESC,m=x.Z.TAB;function y(X){var ce=X.visible,we=X.triggerRef,Pe=X.onVisibleChange,Ve=X.autoFocus,V=X.overlayRef,C=l.useRef(!1),G=function(){if(ce){var _,v;(_=we.current)===null||_===void 0||(v=_.focus)===null||v===void 0||v.call(_),Pe==null||Pe(!1)}},H=function(){var _;return(_=V.current)!==null&&_!==void 0&&_.focus?(V.current.focus(),C.current=!0,!0):!1},Q=function(_){switch(_.keyCode){case h:G();break;case m:{var v=!1;C.current||(v=H()),v?_.preventDefault():G();break}}};l.useEffect(function(){return ce?(window.addEventListener("keydown",Q),Ve&&(0,A.Z)(H,3),function(){window.removeEventListener("keydown",Q),C.current=!1}):function(){C.current=!1}},[ce])}var S=(0,l.forwardRef)(function(X,ce){var we=X.overlay,Pe=X.arrow,Ve=X.prefixCls,V=(0,l.useMemo)(function(){var G;return typeof we=="function"?G=we():G=we,G},[we]),C=(0,le.sQ)(ce,(0,le.C4)(V));return l.createElement(l.Fragment,null,Pe&&l.createElement("div",{className:"".concat(Ve,"-arrow")}),l.cloneElement(V,{ref:(0,le.Yr)(V)?C:void 0}))}),F=S,Z={adjustX:1,adjustY:1},W=[0,0],I={topLeft:{points:["bl","tl"],overflow:Z,offset:[0,-4],targetOffset:W},top:{points:["bc","tc"],overflow:Z,offset:[0,-4],targetOffset:W},topRight:{points:["br","tr"],overflow:Z,offset:[0,-4],targetOffset:W},bottomLeft:{points:["tl","bl"],overflow:Z,offset:[0,4],targetOffset:W},bottom:{points:["tc","bc"],overflow:Z,offset:[0,4],targetOffset:W},bottomRight:{points:["tr","br"],overflow:Z,offset:[0,4],targetOffset:W}},N=I,T=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function D(X,ce){var we,Pe=X.arrow,Ve=Pe===void 0?!1:Pe,V=X.prefixCls,C=V===void 0?"rc-dropdown":V,G=X.transitionName,H=X.animation,Q=X.align,j=X.placement,_=j===void 0?"bottomLeft":j,v=X.placements,P=v===void 0?N:v,re=X.getPopupContainer,Oe=X.showAction,Ze=X.hideAction,Ye=X.overlayClassName,qe=X.overlayStyle,ft=X.visible,vt=X.trigger,Ae=vt===void 0?["hover"]:vt,wt=X.autoFocus,rt=X.overlay,Mt=X.children,et=X.onVisibleChange,ze=(0,ue.Z)(X,T),ye=l.useState(),me=(0,Te.Z)(ye,2),B=me[0],xe=me[1],Le="visible"in X?ft:B,K=l.useRef(null),R=l.useRef(null),ie=l.useRef(null);l.useImperativeHandle(ce,function(){return K.current});var be=function(Ce){xe(Ce),et==null||et(Ce)};y({visible:Le,triggerRef:ie,onVisibleChange:be,autoFocus:wt,overlayRef:R});var k=function(Ce){var De=X.onOverlayClick;xe(!1),De&&De(Ce)},Y=function(){return l.createElement(F,{ref:R,overlay:rt,prefixCls:C,arrow:Ve})},J=function(){return typeof rt=="function"?Y:Y()},se=function(){var Ce=X.minOverlayWidthMatchTrigger,De=X.alignPoint;return"minOverlayWidthMatchTrigger"in X?Ce:!De},ee=function(){var Ce=X.openClassName;return Ce!==void 0?Ce:"".concat(C,"-open")},ne=l.cloneElement(Mt,{className:ge()((we=Mt.props)===null||we===void 0?void 0:we.className,Le&&ee()),ref:(0,le.Yr)(Mt)?(0,le.sQ)(ie,(0,le.C4)(Mt)):void 0}),Ee=Ze;return!Ee&&Ae.indexOf("contextMenu")!==-1&&(Ee=["click"]),l.createElement($.Z,(0,L.Z)({builtinPlacements:P},ze,{prefixCls:C,ref:K,popupClassName:ge()(Ye,(0,fe.Z)({},"".concat(C,"-show-arrow"),Ve)),popupStyle:qe,action:Ae,showAction:Oe,hideAction:Ee,popupPlacement:_,popupAlign:Q,popupTransitionName:G,popupAnimation:H,popupVisible:Le,stretch:se()?"minWidth":"",popup:J(),onPopupVisibleChange:be,onPopupClick:k,getPopupContainer:re}),ne)}var q=l.forwardRef(D),te=q},66003:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return ge}});var L=w(75931),fe=w(33885),Te=w(76190),ue=w(59301),$=["show"];function p(le,l){if(!l.max)return!0;var x=l.strategy(le);return x<=l.max}function ge(le,l){return ue.useMemo(function(){var x={};l&&(x.show=(0,Te.Z)(l)==="object"&&l.formatter?l.formatter:!!l),x=(0,fe.Z)((0,fe.Z)({},x),le);var A=x,h=A.show,m=(0,L.Z)(A,$);return(0,fe.Z)((0,fe.Z)({},m),{},{show:!!h,showFormatter:typeof h=="function"?h:void 0,strategy:m.strategy||function(y){return y.length}})},[le,l])}},36901:function(_n,_t,w){"use strict";w.r(_t),w.d(_t,{BaseInput:function(){return x},default:function(){return N}});var L=w(33885),fe=w(54476),Te=w(20068),ue=w(76190),$=w(92310),p=w.n($),ge=w(59301),le=w(30292),l=ge.forwardRef(function(T,D){var q,te,X,ce=T.inputElement,we=T.children,Pe=T.prefixCls,Ve=T.prefix,V=T.suffix,C=T.addonBefore,G=T.addonAfter,H=T.className,Q=T.style,j=T.disabled,_=T.readOnly,v=T.focused,P=T.triggerFocus,re=T.allowClear,Oe=T.value,Ze=T.handleReset,Ye=T.hidden,qe=T.classes,ft=T.classNames,vt=T.dataAttrs,Ae=T.styles,wt=T.components,rt=T.onClear,Mt=we!=null?we:ce,et=(wt==null?void 0:wt.affixWrapper)||"span",ze=(wt==null?void 0:wt.groupWrapper)||"span",ye=(wt==null?void 0:wt.wrapper)||"span",me=(wt==null?void 0:wt.groupAddon)||"span",B=(0,ge.useRef)(null),xe=function(Ge){var Ue;(Ue=B.current)!==null&&Ue!==void 0&&Ue.contains(Ge.target)&&(P==null||P())},Le=(0,le.X3)(T),K=(0,ge.cloneElement)(Mt,{value:Oe,className:p()((q=Mt.props)===null||q===void 0?void 0:q.className,!Le&&(ft==null?void 0:ft.variant))||null}),R=(0,ge.useRef)(null);if(ge.useImperativeHandle(D,function(){return{nativeElement:R.current||B.current}}),Le){var ie=null;if(re){var be=!j&&!_&&Oe,k="".concat(Pe,"-clear-icon"),Y=(0,ue.Z)(re)==="object"&&re!==null&&re!==void 0&&re.clearIcon?re.clearIcon:"\u2716";ie=ge.createElement("button",{type:"button",tabIndex:-1,onClick:function(Ge){Ze==null||Ze(Ge),rt==null||rt()},onMouseDown:function(Ge){return Ge.preventDefault()},className:p()(k,(0,Te.Z)((0,Te.Z)({},"".concat(k,"-hidden"),!be),"".concat(k,"-has-suffix"),!!V))},Y)}var J="".concat(Pe,"-affix-wrapper"),se=p()(J,(0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)({},"".concat(Pe,"-disabled"),j),"".concat(J,"-disabled"),j),"".concat(J,"-focused"),v),"".concat(J,"-readonly"),_),"".concat(J,"-input-with-clear-btn"),V&&re&&Oe),qe==null?void 0:qe.affixWrapper,ft==null?void 0:ft.affixWrapper,ft==null?void 0:ft.variant),ee=(V||re)&&ge.createElement("span",{className:p()("".concat(Pe,"-suffix"),ft==null?void 0:ft.suffix),style:Ae==null?void 0:Ae.suffix},ie,V);K=ge.createElement(et,(0,fe.Z)({className:se,style:Ae==null?void 0:Ae.affixWrapper,onClick:xe},vt==null?void 0:vt.affixWrapper,{ref:B}),Ve&&ge.createElement("span",{className:p()("".concat(Pe,"-prefix"),ft==null?void 0:ft.prefix),style:Ae==null?void 0:Ae.prefix},Ve),K,ee)}if((0,le.He)(T)){var ne="".concat(Pe,"-group"),Ee="".concat(ne,"-addon"),Be="".concat(ne,"-wrapper"),Ce=p()("".concat(Pe,"-wrapper"),ne,qe==null?void 0:qe.wrapper,ft==null?void 0:ft.wrapper),De=p()(Be,(0,Te.Z)({},"".concat(Be,"-disabled"),j),qe==null?void 0:qe.group,ft==null?void 0:ft.groupWrapper);K=ge.createElement(ze,{className:De,ref:R},ge.createElement(ye,{className:Ce},C&&ge.createElement(me,{className:Ee},C),K,G&&ge.createElement(me,{className:Ee},G)))}return ge.cloneElement(K,{className:p()((te=K.props)===null||te===void 0?void 0:te.className,H)||null,style:(0,L.Z)((0,L.Z)({},(X=K.props)===null||X===void 0?void 0:X.style),Q),hidden:Ye})}),x=l,A=w(94480),h=w(42978),m=w(75931),y=w(18929),S=w(2738),F=w(66003),Z=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],W=(0,ge.forwardRef)(function(T,D){var q=T.autoComplete,te=T.onChange,X=T.onFocus,ce=T.onBlur,we=T.onPressEnter,Pe=T.onKeyDown,Ve=T.onKeyUp,V=T.prefixCls,C=V===void 0?"rc-input":V,G=T.disabled,H=T.htmlSize,Q=T.className,j=T.maxLength,_=T.suffix,v=T.showCount,P=T.count,re=T.type,Oe=re===void 0?"text":re,Ze=T.classes,Ye=T.classNames,qe=T.styles,ft=T.onCompositionStart,vt=T.onCompositionEnd,Ae=(0,m.Z)(T,Z),wt=(0,ge.useState)(!1),rt=(0,h.Z)(wt,2),Mt=rt[0],et=rt[1],ze=(0,ge.useRef)(!1),ye=(0,ge.useRef)(!1),me=(0,ge.useRef)(null),B=(0,ge.useRef)(null),xe=function(Ut){me.current&&(0,le.nH)(me.current,Ut)},Le=(0,y.Z)(T.defaultValue,{value:T.value}),K=(0,h.Z)(Le,2),R=K[0],ie=K[1],be=R==null?"":String(R),k=(0,ge.useState)(null),Y=(0,h.Z)(k,2),J=Y[0],se=Y[1],ee=(0,F.Z)(P,v),ne=ee.max||j,Ee=ee.strategy(be),Be=!!ne&&Ee>ne;(0,ge.useImperativeHandle)(D,function(){var ct;return{focus:xe,blur:function(){var Ne;(Ne=me.current)===null||Ne===void 0||Ne.blur()},setSelectionRange:function(Ne,Se,Ie){var U;(U=me.current)===null||U===void 0||U.setSelectionRange(Ne,Se,Ie)},select:function(){var Ne;(Ne=me.current)===null||Ne===void 0||Ne.select()},input:me.current,nativeElement:((ct=B.current)===null||ct===void 0?void 0:ct.nativeElement)||me.current}}),(0,ge.useEffect)(function(){ye.current&&(ye.current=!1),et(function(ct){return ct&&G?!1:ct})},[G]);var Ce=function(Ut,Ne,Se){var Ie=Ne;if(!ze.current&&ee.exceedFormatter&&ee.max&&ee.strategy(Ne)>ee.max){if(Ie=ee.exceedFormatter(Ne,{max:ee.max}),Ne!==Ie){var U,z;se([((U=me.current)===null||U===void 0?void 0:U.selectionStart)||0,((z=me.current)===null||z===void 0?void 0:z.selectionEnd)||0])}}else if(Se.source==="compositionEnd")return;ie(Ie),me.current&&(0,le.rJ)(me.current,Ut,te,Ie)};(0,ge.useEffect)(function(){if(J){var ct;(ct=me.current)===null||ct===void 0||ct.setSelectionRange.apply(ct,(0,A.Z)(J))}},[J]);var De=function(Ut){Ce(Ut,Ut.target.value,{source:"change"})},oe=function(Ut){ze.current=!1,Ce(Ut,Ut.currentTarget.value,{source:"compositionEnd"}),vt==null||vt(Ut)},Ge=function(Ut){we&&Ut.key==="Enter"&&!ye.current&&(ye.current=!0,we(Ut)),Pe==null||Pe(Ut)},Ue=function(Ut){Ut.key==="Enter"&&(ye.current=!1),Ve==null||Ve(Ut)},Fe=function(Ut){et(!0),X==null||X(Ut)},lt=function(Ut){ye.current&&(ye.current=!1),et(!1),ce==null||ce(Ut)},ut=function(Ut){ie(""),xe(),me.current&&(0,le.rJ)(me.current,Ut,te)},it=Be&&"".concat(C,"-out-of-range"),Ct=function(){var Ut=(0,S.Z)(T,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return ge.createElement("input",(0,fe.Z)({autoComplete:q},Ut,{onChange:De,onFocus:Fe,onBlur:lt,onKeyDown:Ge,onKeyUp:Ue,className:p()(C,(0,Te.Z)({},"".concat(C,"-disabled"),G),Ye==null?void 0:Ye.input),style:qe==null?void 0:qe.input,ref:me,size:H,type:Oe,onCompositionStart:function(Se){ze.current=!0,ft==null||ft(Se)},onCompositionEnd:oe}))},zt=function(){var Ut=Number(ne)>0;if(_||ee.show){var Ne=ee.showFormatter?ee.showFormatter({value:be,count:Ee,maxLength:ne}):"".concat(Ee).concat(Ut?" / ".concat(ne):"");return ge.createElement(ge.Fragment,null,ee.show&&ge.createElement("span",{className:p()("".concat(C,"-show-count-suffix"),(0,Te.Z)({},"".concat(C,"-show-count-has-suffix"),!!_),Ye==null?void 0:Ye.count),style:(0,L.Z)({},qe==null?void 0:qe.count)},Ne),_)}return null};return ge.createElement(x,(0,fe.Z)({},Ae,{prefixCls:C,className:p()(Q,it),handleReset:ut,value:be,focused:Mt,triggerFocus:xe,suffix:zt(),disabled:G,classes:Ze,classNames:Ye,styles:qe}),Ct())}),I=W,N=I},30292:function(_n,_t,w){"use strict";w.d(_t,{He:function(){return L},X3:function(){return fe},nH:function(){return $},rJ:function(){return ue}});function L(p){return!!(p.addonBefore||p.addonAfter)}function fe(p){return!!(p.prefix||p.suffix||p.allowClear)}function Te(p,ge,le){var l=ge.cloneNode(!0),x=Object.create(p,{target:{value:l},currentTarget:{value:l}});return l.value=le,typeof ge.selectionStart=="number"&&typeof ge.selectionEnd=="number"&&(l.selectionStart=ge.selectionStart,l.selectionEnd=ge.selectionEnd),l.setSelectionRange=function(){ge.setSelectionRange.apply(ge,arguments)},x}function ue(p,ge,le,l){if(le){var x=ge;if(ge.type==="click"){x=Te(ge,p,""),le(x);return}if(p.type!=="file"&&l!==void 0){x=Te(ge,p,l),le(x);return}le(x)}}function $(p,ge){if(p){p.focus(ge);var le=ge||{},l=le.cursor;if(l){var x=p.value.length;switch(l){case"start":p.setSelectionRange(0,0);break;case"end":p.setSelectionRange(x,x);break;default:p.setSelectionRange(0,x)}}}}},28321:function(_n,_t,w){"use strict";w.d(_t,{iz:function(){return Me},ck:function(){return Ie},BW:function(){return xt},sN:function(){return Ie},Wd:function(){return yn},ZP:function(){return dt},Xl:function(){return we}});var L=w(54476),fe=w(20068),Te=w(33885),ue=w(94480),$=w(42978),p=w(75931),ge=w(92310),le=w.n(ge),l=w(11780),x=w(18929),A=w(13697),h=w(48736),m=w(59301),y=w(4676),S=m.createContext(null);function F(Re,$e){return Re===void 0?null:"".concat(Re,"-").concat($e)}function Z(Re){var $e=m.useContext(S);return F($e,Re)}var W=w(80547),I=["children","locked"],N=m.createContext(null);function T(Re,$e){var Qe=(0,Te.Z)({},Re);return Object.keys($e).forEach(function(Xe){var gt=$e[Xe];gt!==void 0&&(Qe[Xe]=gt)}),Qe}function D(Re){var $e=Re.children,Qe=Re.locked,Xe=(0,p.Z)(Re,I),gt=m.useContext(N),pt=(0,W.Z)(function(){return T(gt,Xe)},[gt,Xe],function(Rt,Kt){return!Qe&&(Rt[0]!==Kt[0]||!(0,A.Z)(Rt[1],Kt[1],!0))});return m.createElement(N.Provider,{value:pt},$e)}var q=[],te=m.createContext(null);function X(){return m.useContext(te)}var ce=m.createContext(q);function we(Re){var $e=m.useContext(ce);return m.useMemo(function(){return Re!==void 0?[].concat((0,ue.Z)($e),[Re]):$e},[$e,Re])}var Pe=m.createContext(null),Ve=m.createContext({}),V=Ve,C=w(29194);function G(Re){var $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,C.Z)(Re)){var Qe=Re.nodeName.toLowerCase(),Xe=["input","select","textarea","button"].includes(Qe)||Re.isContentEditable||Qe==="a"&&!!Re.getAttribute("href"),gt=Re.getAttribute("tabindex"),pt=Number(gt),Rt=null;return gt&&!Number.isNaN(pt)?Rt=pt:Xe&&Rt===null&&(Rt=0),Xe&&Re.disabled&&(Rt=null),Rt!==null&&(Rt>=0||$e&&Rt<0)}return!1}function H(Re){var $e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Qe=(0,ue.Z)(Re.querySelectorAll("*")).filter(function(Xe){return G(Xe,$e)});return G(Re,$e)&&Qe.unshift(Re),Qe}var Q=null;function j(){Q=document.activeElement}function _(){Q=null}function v(){if(Q)try{Q.focus()}catch(Re){}}function P(Re,$e){if($e.keyCode===9){var Qe=H(Re),Xe=Qe[$e.shiftKey?0:Qe.length-1],gt=Xe===document.activeElement||Re===document.activeElement;if(gt){var pt=Qe[$e.shiftKey?Qe.length-1:0];pt.focus(),$e.preventDefault()}}}var re=w(10228),Oe=w(16089),Ze=re.Z.LEFT,Ye=re.Z.RIGHT,qe=re.Z.UP,ft=re.Z.DOWN,vt=re.Z.ENTER,Ae=re.Z.ESC,wt=re.Z.HOME,rt=re.Z.END,Mt=[qe,ft,Ze,Ye];function et(Re,$e,Qe,Xe){var gt,pt="prev",Rt="next",Kt="children",Ht="parent";if(Re==="inline"&&Xe===vt)return{inlineTrigger:!0};var tn=(0,fe.Z)((0,fe.Z)({},qe,pt),ft,Rt),$n=(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)({},Ze,Qe?Rt:pt),Ye,Qe?pt:Rt),ft,Kt),vt,Kt),Vt=(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)({},qe,pt),ft,Rt),vt,Kt),Ae,Ht),Ze,Qe?Kt:Ht),Ye,Qe?Ht:Kt),un={inline:tn,horizontal:$n,vertical:Vt,inlineSub:tn,horizontalSub:Vt,verticalSub:Vt},rn=(gt=un["".concat(Re).concat($e?"":"Sub")])===null||gt===void 0?void 0:gt[Xe];switch(rn){case pt:return{offset:-1,sibling:!0};case Rt:return{offset:1,sibling:!0};case Ht:return{offset:-1,sibling:!1};case Kt:return{offset:1,sibling:!1};default:return null}}function ze(Re){for(var $e=Re;$e;){if($e.getAttribute("data-menu-list"))return $e;$e=$e.parentElement}return null}function ye(Re,$e){for(var Qe=Re||document.activeElement;Qe;){if($e.has(Qe))return Qe;Qe=Qe.parentElement}return null}function me(Re,$e){var Qe=H(Re,!0);return Qe.filter(function(Xe){return $e.has(Xe)})}function B(Re,$e,Qe){var Xe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Re)return null;var gt=me(Re,$e),pt=gt.length,Rt=gt.findIndex(function(Kt){return Qe===Kt});return Xe<0?Rt===-1?Rt=pt-1:Rt-=1:Xe>0&&(Rt+=1),Rt=(Rt+pt)%pt,gt[Rt]}var xe=function($e,Qe){var Xe=new Set,gt=new Map,pt=new Map;return $e.forEach(function(Rt){var Kt=document.querySelector("[data-menu-id='".concat(F(Qe,Rt),"']"));Kt&&(Xe.add(Kt),pt.set(Kt,Rt),gt.set(Rt,Kt))}),{elements:Xe,key2element:gt,element2key:pt}};function Le(Re,$e,Qe,Xe,gt,pt,Rt,Kt,Ht,tn){var $n=m.useRef(),Vt=m.useRef();Vt.current=$e;var un=function(){Oe.Z.cancel($n.current)};return m.useEffect(function(){return function(){un()}},[]),function(rn){var fn=rn.which;if([].concat(Mt,[vt,Ae,wt,rt]).includes(fn)){var Yt=pt(),Bt=xe(Yt,Xe),Wt=Bt,Jt=Wt.elements,an=Wt.key2element,cn=Wt.element2key,En=an.get($e),mn=ye(En,Jt),on=cn.get(mn),jn=et(Re,Rt(on,!0).length===1,Qe,fn);if(!jn&&fn!==wt&&fn!==rt)return;(Mt.includes(fn)||[wt,rt].includes(fn))&&rn.preventDefault();var Qn=function(sn){if(sn){var Dt=sn,bt=sn.querySelector("a");bt!=null&&bt.getAttribute("href")&&(Dt=bt);var $t=cn.get(sn);Kt($t),un(),$n.current=(0,Oe.Z)(function(){Vt.current===$t&&Dt.focus()})}};if([wt,rt].includes(fn)||jn.sibling||!mn){var or;!mn||Re==="inline"?or=gt.current:or=ze(mn);var Vn,ir=me(or,Jt);fn===wt?Vn=ir[0]:fn===rt?Vn=ir[ir.length-1]:Vn=B(or,Jt,mn,jn.offset),Qn(Vn)}else if(jn.inlineTrigger)Ht(on);else if(jn.offset>0)Ht(on,!0),un(),$n.current=(0,Oe.Z)(function(){Bt=xe(Yt,Xe);var On=mn.getAttribute("aria-controls"),sn=document.getElementById(On),Dt=B(sn,Bt.elements);Qn(Dt)},5);else if(jn.offset<0){var Jn=Rt(on,!0),_r=Jn[Jn.length-2],ur=an.get(_r);Ht(_r,!1),Qn(ur)}}tn==null||tn(rn)}}function K(Re){Promise.resolve().then(Re)}var R="__RC_UTIL_PATH_SPLIT__",ie=function($e){return $e.join(R)},be=function($e){return $e.split(R)},k="rc-menu-more";function Y(){var Re=m.useState({}),$e=(0,$.Z)(Re,2),Qe=$e[1],Xe=(0,m.useRef)(new Map),gt=(0,m.useRef)(new Map),pt=m.useState([]),Rt=(0,$.Z)(pt,2),Kt=Rt[0],Ht=Rt[1],tn=(0,m.useRef)(0),$n=(0,m.useRef)(!1),Vt=function(){$n.current||Qe({})},un=(0,m.useCallback)(function(an,cn){var En=ie(cn);gt.current.set(En,an),Xe.current.set(an,En),tn.current+=1;var mn=tn.current;K(function(){mn===tn.current&&Vt()})},[]),rn=(0,m.useCallback)(function(an,cn){var En=ie(cn);gt.current.delete(En),Xe.current.delete(an)},[]),fn=(0,m.useCallback)(function(an){Ht(an)},[]),Yt=(0,m.useCallback)(function(an,cn){var En=Xe.current.get(an)||"",mn=be(En);return cn&&Kt.includes(mn[0])&&mn.unshift(k),mn},[Kt]),Bt=(0,m.useCallback)(function(an,cn){return an.filter(function(En){return En!==void 0}).some(function(En){var mn=Yt(En,!0);return mn.includes(cn)})},[Yt]),Wt=function(){var cn=(0,ue.Z)(Xe.current.keys());return Kt.length&&cn.push(k),cn},Jt=(0,m.useCallback)(function(an){var cn="".concat(Xe.current.get(an)).concat(R),En=new Set;return(0,ue.Z)(gt.current.keys()).forEach(function(mn){mn.startsWith(cn)&&En.add(gt.current.get(mn))}),En},[]);return m.useEffect(function(){return function(){$n.current=!0}},[]),{registerPath:un,unregisterPath:rn,refreshOverflowKeys:fn,isSubPathKey:Bt,getKeyPath:Yt,getKeys:Wt,getSubPathKeys:Jt}}function J(Re){var $e=m.useRef(Re);$e.current=Re;var Qe=m.useCallback(function(){for(var Xe,gt=arguments.length,pt=new Array(gt),Rt=0;Rt<gt;Rt++)pt[Rt]=arguments[Rt];return(Xe=$e.current)===null||Xe===void 0?void 0:Xe.call.apply(Xe,[$e].concat(pt))},[]);return Re?Qe:void 0}var se=Math.random().toFixed(5).toString().slice(2),ee=0;function ne(Re){var $e=(0,x.Z)(Re,{value:Re}),Qe=(0,$.Z)($e,2),Xe=Qe[0],gt=Qe[1];return m.useEffect(function(){ee+=1;var pt="".concat(se,"-").concat(ee);gt("rc-menu-uuid-".concat(pt))},[]),Xe}var Ee=w(67732),Be=w(83652),Ce=w(42403),De=w(158),oe=w(2738),Ge=w(8654);function Ue(Re,$e,Qe,Xe){var gt=m.useContext(N),pt=gt.activeKey,Rt=gt.onActive,Kt=gt.onInactive,Ht={active:pt===Re};return $e||(Ht.onMouseEnter=function(tn){Qe==null||Qe({key:Re,domEvent:tn}),Rt(Re)},Ht.onMouseLeave=function(tn){Xe==null||Xe({key:Re,domEvent:tn}),Kt(Re)}),Ht}function Fe(Re){var $e=m.useContext(N),Qe=$e.mode,Xe=$e.rtl,gt=$e.inlineIndent;if(Qe!=="inline")return null;var pt=Re;return Xe?{paddingRight:pt*gt}:{paddingLeft:pt*gt}}function lt(Re){var $e=Re.icon,Qe=Re.props,Xe=Re.children,gt;return $e===null||$e===!1?null:(typeof $e=="function"?gt=m.createElement($e,(0,Te.Z)({},Qe)):typeof $e!="boolean"&&(gt=$e),gt||Xe||null)}var ut=["item"];function it(Re){var $e=Re.item,Qe=(0,p.Z)(Re,ut);return Object.defineProperty(Qe,"item",{get:function(){return(0,h.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),$e}}),Qe}var Ct=["title","attribute","elementRef"],zt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],ct=["active"],Ut=function(Re){(0,Ce.Z)(Qe,Re);var $e=(0,De.Z)(Qe);function Qe(){return(0,Ee.Z)(this,Qe),$e.apply(this,arguments)}return(0,Be.Z)(Qe,[{key:"render",value:function(){var gt=this.props,pt=gt.title,Rt=gt.attribute,Kt=gt.elementRef,Ht=(0,p.Z)(gt,Ct),tn=(0,oe.Z)(Ht,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,h.ZP)(!Rt,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),m.createElement(l.Z.Item,(0,L.Z)({},Rt,{title:typeof pt=="string"?pt:void 0},tn,{ref:Kt}))}}]),Qe}(m.Component),Ne=m.forwardRef(function(Re,$e){var Qe=Re.style,Xe=Re.className,gt=Re.eventKey,pt=Re.warnKey,Rt=Re.disabled,Kt=Re.itemIcon,Ht=Re.children,tn=Re.role,$n=Re.onMouseEnter,Vt=Re.onMouseLeave,un=Re.onClick,rn=Re.onKeyDown,fn=Re.onFocus,Yt=(0,p.Z)(Re,zt),Bt=Z(gt),Wt=m.useContext(N),Jt=Wt.prefixCls,an=Wt.onItemClick,cn=Wt.disabled,En=Wt.overflowDisabled,mn=Wt.itemIcon,on=Wt.selectedKeys,jn=Wt.onActive,Qn=m.useContext(V),or=Qn._internalRenderMenuItem,Vn="".concat(Jt,"-item"),ir=m.useRef(),Jn=m.useRef(),_r=cn||Rt,ur=(0,Ge.x1)($e,Jn),On=we(gt),sn=function(An){return{key:gt,keyPath:(0,ue.Z)(On).reverse(),item:ir.current,domEvent:An}},Dt=Kt||mn,bt=Ue(gt,_r,$n,Vt),$t=bt.active,Qt=(0,p.Z)(bt,ct),bn=on.includes(gt),Kn=Fe(On.length),tr=function(An){if(!_r){var Yn=sn(An);un==null||un(it(Yn)),an(Yn)}},Xt=function(An){if(rn==null||rn(An),An.which===re.Z.ENTER){var Yn=sn(An);un==null||un(it(Yn)),an(Yn)}},Tn=function(An){jn(gt),fn==null||fn(An)},Bn={};Re.role==="option"&&(Bn["aria-selected"]=bn);var Zn=m.createElement(Ut,(0,L.Z)({ref:ir,elementRef:ur,role:tn===null?"none":tn||"menuitem",tabIndex:Rt?null:-1,"data-menu-id":En&&Bt?null:Bt},(0,oe.Z)(Yt,["extra"]),Qt,Bn,{component:"li","aria-disabled":Rt,style:(0,Te.Z)((0,Te.Z)({},Kn),Qe),className:le()(Vn,(0,fe.Z)((0,fe.Z)((0,fe.Z)({},"".concat(Vn,"-active"),$t),"".concat(Vn,"-selected"),bn),"".concat(Vn,"-disabled"),_r),Xe),onClick:tr,onKeyDown:Xt,onFocus:Tn}),Ht,m.createElement(lt,{props:(0,Te.Z)((0,Te.Z)({},Re),{},{isSelected:bn}),icon:Dt}));return or&&(Zn=or(Zn,Re,{selected:bn})),Zn});function Se(Re,$e){var Qe=Re.eventKey,Xe=X(),gt=we(Qe);return m.useEffect(function(){if(Xe)return Xe.registerPath(Qe,gt),function(){Xe.unregisterPath(Qe,gt)}},[gt]),Xe?null:m.createElement(Ne,(0,L.Z)({},Re,{ref:$e}))}var Ie=m.forwardRef(Se),U=["className","children"],z=function($e,Qe){var Xe=$e.className,gt=$e.children,pt=(0,p.Z)($e,U),Rt=m.useContext(N),Kt=Rt.prefixCls,Ht=Rt.mode,tn=Rt.rtl;return m.createElement("ul",(0,L.Z)({className:le()(Kt,tn&&"".concat(Kt,"-rtl"),"".concat(Kt,"-sub"),"".concat(Kt,"-").concat(Ht==="inline"?"inline":"vertical"),Xe),role:"menu"},pt,{"data-menu-list":!0,ref:Qe}),gt)},pe=m.forwardRef(z);pe.displayName="SubMenuList";var de=pe,ve=w(11592);function je(Re,$e){return(0,ve.Z)(Re).map(function(Qe,Xe){if(m.isValidElement(Qe)){var gt,pt,Rt=Qe.key,Kt=(gt=(pt=Qe.props)===null||pt===void 0?void 0:pt.eventKey)!==null&&gt!==void 0?gt:Rt,Ht=Kt==null;Ht&&(Kt="tmp_key-".concat([].concat((0,ue.Z)($e),[Xe]).join("-")));var tn={key:Kt,eventKey:Kt};return m.cloneElement(Qe,tn)}return Qe})}var tt=w(65030),yt={adjustX:1,adjustY:1},It={topLeft:{points:["bl","tl"],overflow:yt},topRight:{points:["br","tr"],overflow:yt},bottomLeft:{points:["tl","bl"],overflow:yt},bottomRight:{points:["tr","br"],overflow:yt},leftTop:{points:["tr","tl"],overflow:yt},leftBottom:{points:["br","bl"],overflow:yt},rightTop:{points:["tl","tr"],overflow:yt},rightBottom:{points:["bl","br"],overflow:yt}},qt={topLeft:{points:["bl","tl"],overflow:yt},topRight:{points:["br","tr"],overflow:yt},bottomLeft:{points:["tl","bl"],overflow:yt},bottomRight:{points:["tr","br"],overflow:yt},rightTop:{points:["tr","tl"],overflow:yt},rightBottom:{points:["br","bl"],overflow:yt},leftTop:{points:["tl","tr"],overflow:yt},leftBottom:{points:["bl","br"],overflow:yt}},gn=null;function en(Re,$e,Qe){if($e)return $e;if(Qe)return Qe[Re]||Qe.other}var nn={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function wn(Re){var $e=Re.prefixCls,Qe=Re.visible,Xe=Re.children,gt=Re.popup,pt=Re.popupStyle,Rt=Re.popupClassName,Kt=Re.popupOffset,Ht=Re.disabled,tn=Re.mode,$n=Re.onVisibleChange,Vt=m.useContext(N),un=Vt.getPopupContainer,rn=Vt.rtl,fn=Vt.subMenuOpenDelay,Yt=Vt.subMenuCloseDelay,Bt=Vt.builtinPlacements,Wt=Vt.triggerSubMenuAction,Jt=Vt.forceSubMenuRender,an=Vt.rootClassName,cn=Vt.motion,En=Vt.defaultMotions,mn=m.useState(!1),on=(0,$.Z)(mn,2),jn=on[0],Qn=on[1],or=rn?(0,Te.Z)((0,Te.Z)({},qt),Bt):(0,Te.Z)((0,Te.Z)({},It),Bt),Vn=nn[tn],ir=en(tn,cn,En),Jn=m.useRef(ir);tn!=="inline"&&(Jn.current=ir);var _r=(0,Te.Z)((0,Te.Z)({},Jn.current),{},{leavedClassName:"".concat($e,"-hidden"),removeOnLeave:!1,motionAppear:!0}),ur=m.useRef();return m.useEffect(function(){return ur.current=(0,Oe.Z)(function(){Qn(Qe)}),function(){Oe.Z.cancel(ur.current)}},[Qe]),m.createElement(tt.Z,{prefixCls:$e,popupClassName:le()("".concat($e,"-popup"),(0,fe.Z)({},"".concat($e,"-rtl"),rn),Rt,an),stretch:tn==="horizontal"?"minWidth":null,getPopupContainer:un,builtinPlacements:or,popupPlacement:Vn,popupVisible:jn,popup:gt,popupStyle:pt,popupAlign:Kt&&{offset:Kt},action:Ht?[]:[Wt],mouseEnterDelay:fn,mouseLeaveDelay:Yt,onPopupVisibleChange:$n,forceRender:Jt,popupMotion:_r,fresh:!0},Xe)}var zn=w(77900);function kn(Re){var $e=Re.id,Qe=Re.open,Xe=Re.keyPath,gt=Re.children,pt="inline",Rt=m.useContext(N),Kt=Rt.prefixCls,Ht=Rt.forceSubMenuRender,tn=Rt.motion,$n=Rt.defaultMotions,Vt=Rt.mode,un=m.useRef(!1);un.current=Vt===pt;var rn=m.useState(!un.current),fn=(0,$.Z)(rn,2),Yt=fn[0],Bt=fn[1],Wt=un.current?Qe:!1;m.useEffect(function(){un.current&&Bt(!1)},[Vt]);var Jt=(0,Te.Z)({},en(pt,tn,$n));Xe.length>1&&(Jt.motionAppear=!1);var an=Jt.onVisibleChanged;return Jt.onVisibleChanged=function(cn){return!un.current&&!cn&&Bt(!0),an==null?void 0:an(cn)},Yt?null:m.createElement(D,{mode:pt,locked:!un.current},m.createElement(zn.default,(0,L.Z)({visible:Wt},Jt,{forceRender:Ht,removeOnLeave:!1,leavedClassName:"".concat(Kt,"-hidden")}),function(cn){var En=cn.className,mn=cn.style;return m.createElement(de,{id:$e,className:En,style:mn},gt)}))}var Nn=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],Lt=["active"],ht=m.forwardRef(function(Re,$e){var Qe=Re.style,Xe=Re.className,gt=Re.title,pt=Re.eventKey,Rt=Re.warnKey,Kt=Re.disabled,Ht=Re.internalPopupClose,tn=Re.children,$n=Re.itemIcon,Vt=Re.expandIcon,un=Re.popupClassName,rn=Re.popupOffset,fn=Re.popupStyle,Yt=Re.onClick,Bt=Re.onMouseEnter,Wt=Re.onMouseLeave,Jt=Re.onTitleClick,an=Re.onTitleMouseEnter,cn=Re.onTitleMouseLeave,En=(0,p.Z)(Re,Nn),mn=Z(pt),on=m.useContext(N),jn=on.prefixCls,Qn=on.mode,or=on.openKeys,Vn=on.disabled,ir=on.overflowDisabled,Jn=on.activeKey,_r=on.selectedKeys,ur=on.itemIcon,On=on.expandIcon,sn=on.onItemClick,Dt=on.onOpenChange,bt=on.onActive,$t=m.useContext(V),Qt=$t._internalRenderSubMenuItem,bn=m.useContext(Pe),Kn=bn.isSubPathKey,tr=we(),Xt="".concat(jn,"-submenu"),Tn=Vn||Kt,Bn=m.useRef(),Zn=m.useRef(),pr=$n!=null?$n:ur,An=Vt!=null?Vt:On,Yn=or.includes(pt),Xn=!ir&&Yn,cr=Kn(_r,pt),sr=Ue(pt,Tn,an,cn),gr=sr.active,fr=(0,p.Z)(sr,Lt),Ar=m.useState(!1),Sr=(0,$.Z)(Ar,2),Or=Sr[0],br=Sr[1],yr=function(kr){Tn||br(kr)},Vr=function(kr){yr(!0),Bt==null||Bt({key:pt,domEvent:kr})},In=function(kr){yr(!1),Wt==null||Wt({key:pt,domEvent:kr})},zr=m.useMemo(function(){return gr||(Qn!=="inline"?Or||Kn([Jn],pt):!1)},[Qn,gr,Jn,Or,pt,Kn]),Dr=Fe(tr.length),ii=function(kr){Tn||(Jt==null||Jt({key:pt,domEvent:kr}),Qn==="inline"&&Dt(pt,!Yn))},si=J(function(Rr){Yt==null||Yt(it(Rr)),sn(Rr)}),Xr=function(kr){Qn!=="inline"&&Dt(pt,kr)},ui=function(){bt(pt)},Wr=mn&&"".concat(mn,"-popup"),mr=m.useMemo(function(){return m.createElement(lt,{icon:Qn!=="horizontal"?An:void 0,props:(0,Te.Z)((0,Te.Z)({},Re),{},{isOpen:Xn,isSubMenu:!0})},m.createElement("i",{className:"".concat(Xt,"-arrow")}))},[Qn,An,Re,Xn,Xt]),Lr=m.createElement("div",(0,L.Z)({role:"menuitem",style:Dr,className:"".concat(Xt,"-title"),tabIndex:Tn?null:-1,ref:Bn,title:typeof gt=="string"?gt:null,"data-menu-id":ir&&mn?null:mn,"aria-expanded":Xn,"aria-haspopup":!0,"aria-controls":Wr,"aria-disabled":Tn,onClick:ii,onFocus:ui},fr),gt,mr),Br=m.useRef(Qn);if(Qn!=="inline"&&tr.length>1?Br.current="vertical":Br.current=Qn,!ir){var Hr=Br.current;Lr=m.createElement(wn,{mode:Hr,prefixCls:Xt,visible:!Ht&&Xn&&Qn!=="inline",popupClassName:un,popupOffset:rn,popupStyle:fn,popup:m.createElement(D,{mode:Hr==="horizontal"?"vertical":Hr},m.createElement(de,{id:Wr,ref:Zn},tn)),disabled:Tn,onVisibleChange:Xr},Lr)}var ar=m.createElement(l.Z.Item,(0,L.Z)({ref:$e,role:"none"},En,{component:"li",style:Qe,className:le()(Xt,"".concat(Xt,"-").concat(Qn),Xe,(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)({},"".concat(Xt,"-open"),Xn),"".concat(Xt,"-active"),zr),"".concat(Xt,"-selected"),cr),"".concat(Xt,"-disabled"),Tn)),onMouseEnter:Vr,onMouseLeave:In}),Lr,!ir&&m.createElement(kn,{id:Wr,open:Xn,keyPath:tr},tn));return Qt&&(ar=Qt(ar,Re,{selected:cr,active:zr,open:Xn,disabled:Tn})),m.createElement(D,{onItemClick:si,mode:Qn==="horizontal"?"vertical":Qn,itemIcon:pr,expandIcon:An},ar)}),Zt=m.forwardRef(function(Re,$e){var Qe=Re.eventKey,Xe=Re.children,gt=we(Qe),pt=je(Xe,gt),Rt=X();m.useEffect(function(){if(Rt)return Rt.registerPath(Qe,gt),function(){Rt.unregisterPath(Qe,gt)}},[gt]);var Kt;return Rt?Kt=pt:Kt=m.createElement(ht,(0,L.Z)({ref:$e},Re),pt),m.createElement(ce.Provider,{value:gt},Kt)}),yn=Zt,Hn=w(76190);function Me(Re){var $e=Re.className,Qe=Re.style,Xe=m.useContext(N),gt=Xe.prefixCls,pt=X();return pt?null:m.createElement("li",{role:"separator",className:le()("".concat(gt,"-item-divider"),$e),style:Qe})}var ke=["className","title","eventKey","children"],St=m.forwardRef(function(Re,$e){var Qe=Re.className,Xe=Re.title,gt=Re.eventKey,pt=Re.children,Rt=(0,p.Z)(Re,ke),Kt=m.useContext(N),Ht=Kt.prefixCls,tn="".concat(Ht,"-item-group");return m.createElement("li",(0,L.Z)({ref:$e,role:"presentation"},Rt,{onClick:function(Vt){return Vt.stopPropagation()},className:le()(tn,Qe)}),m.createElement("div",{role:"presentation",className:"".concat(tn,"-title"),title:typeof Xe=="string"?Xe:void 0},Xe),m.createElement("ul",{role:"group",className:"".concat(tn,"-list")},pt))}),st=m.forwardRef(function(Re,$e){var Qe=Re.eventKey,Xe=Re.children,gt=we(Qe),pt=je(Xe,gt),Rt=X();return Rt?pt:m.createElement(St,(0,L.Z)({ref:$e},(0,oe.Z)(Re,["warnKey"])),pt)}),xt=st,Tt=["label","children","key","type","extra"];function Et(Re,$e,Qe){var Xe=$e.item,gt=$e.group,pt=$e.submenu,Rt=$e.divider;return(Re||[]).map(function(Kt,Ht){if(Kt&&(0,Hn.Z)(Kt)==="object"){var tn=Kt,$n=tn.label,Vt=tn.children,un=tn.key,rn=tn.type,fn=tn.extra,Yt=(0,p.Z)(tn,Tt),Bt=un!=null?un:"tmp-".concat(Ht);return Vt||rn==="group"?rn==="group"?m.createElement(gt,(0,L.Z)({key:Bt},Yt,{title:$n}),Et(Vt,$e,Qe)):m.createElement(pt,(0,L.Z)({key:Bt},Yt,{title:$n}),Et(Vt,$e,Qe)):rn==="divider"?m.createElement(Rt,(0,L.Z)({key:Bt},Yt)):m.createElement(Xe,(0,L.Z)({key:Bt},Yt,{extra:fn}),$n,(!!fn||fn===0)&&m.createElement("span",{className:"".concat(Qe,"-item-extra")},fn))}return null}).filter(function(Kt){return Kt})}function kt(Re,$e,Qe,Xe,gt){var pt=Re,Rt=(0,Te.Z)({divider:Me,item:Ie,group:xt,submenu:yn},Xe);return $e&&(pt=Et($e,Rt,gt)),je(pt,Qe)}var jt=["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"],At=[],Pt=m.forwardRef(function(Re,$e){var Qe,Xe=Re,gt=Xe.prefixCls,pt=gt===void 0?"rc-menu":gt,Rt=Xe.rootClassName,Kt=Xe.style,Ht=Xe.className,tn=Xe.tabIndex,$n=tn===void 0?0:tn,Vt=Xe.items,un=Xe.children,rn=Xe.direction,fn=Xe.id,Yt=Xe.mode,Bt=Yt===void 0?"vertical":Yt,Wt=Xe.inlineCollapsed,Jt=Xe.disabled,an=Xe.disabledOverflow,cn=Xe.subMenuOpenDelay,En=cn===void 0?.1:cn,mn=Xe.subMenuCloseDelay,on=mn===void 0?.1:mn,jn=Xe.forceSubMenuRender,Qn=Xe.defaultOpenKeys,or=Xe.openKeys,Vn=Xe.activeKey,ir=Xe.defaultActiveFirst,Jn=Xe.selectable,_r=Jn===void 0?!0:Jn,ur=Xe.multiple,On=ur===void 0?!1:ur,sn=Xe.defaultSelectedKeys,Dt=Xe.selectedKeys,bt=Xe.onSelect,$t=Xe.onDeselect,Qt=Xe.inlineIndent,bn=Qt===void 0?24:Qt,Kn=Xe.motion,tr=Xe.defaultMotions,Xt=Xe.triggerSubMenuAction,Tn=Xt===void 0?"hover":Xt,Bn=Xe.builtinPlacements,Zn=Xe.itemIcon,pr=Xe.expandIcon,An=Xe.overflowedIndicator,Yn=An===void 0?"...":An,Xn=Xe.overflowedIndicatorPopupClassName,cr=Xe.getPopupContainer,sr=Xe.onClick,gr=Xe.onOpenChange,fr=Xe.onKeyDown,Ar=Xe.openAnimation,Sr=Xe.openTransitionName,Or=Xe._internalRenderMenuItem,br=Xe._internalRenderSubMenuItem,yr=Xe._internalComponents,Vr=(0,p.Z)(Xe,jt),In=m.useMemo(function(){return[kt(un,Vt,At,yr,pt),kt(un,Vt,At,{},pt)]},[un,Vt,yr]),zr=(0,$.Z)(In,2),Dr=zr[0],ii=zr[1],si=m.useState(!1),Xr=(0,$.Z)(si,2),ui=Xr[0],Wr=Xr[1],mr=m.useRef(),Lr=ne(fn),Br=rn==="rtl",Hr=(0,x.Z)(Qn,{value:or,postState:function(Cr){return Cr||At}}),ar=(0,$.Z)(Hr,2),Rr=ar[0],kr=ar[1],Sn=function(Cr){var Pr=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function ei(){kr(Cr),gr==null||gr(Cr)}Pr?(0,y.flushSync)(ei):ei()},Gn=m.useState(Rr),Dn=(0,$.Z)(Gn,2),Un=Dn[0],lr=Dn[1],Er=m.useRef(!1),jr=m.useMemo(function(){return(Bt==="inline"||Bt==="vertical")&&Wt?["vertical",Wt]:[Bt,!1]},[Bt,Wt]),dn=(0,$.Z)(jr,2),Ln=dn[0],qn=dn[1],Wn=Ln==="inline",er=m.useState(Ln),Qr=(0,$.Z)(er,2),Ur=Qr[0],Jr=Qr[1],$r=m.useState(qn),Ni=(0,$.Z)($r,2),ps=Ni[0],gs=Ni[1];m.useEffect(function(){Jr(Ln),gs(qn),Er.current&&(Wn?kr(Un):Sn(At))},[Ln,qn]);var yi=m.useState(0),ki=(0,$.Z)(yi,2),ci=ki[0],ms=ki[1],Bi=ci>=Dr.length-1||Ur!=="horizontal"||an;m.useEffect(function(){Wn&&lr(Rr)},[Rr]),m.useEffect(function(){return Er.current=!0,function(){Er.current=!1}},[]);var Ei=Y(),Ui=Ei.registerPath,Hi=Ei.unregisterPath,es=Ei.refreshOverflowKeys,Pi=Ei.isSubPathKey,vs=Ei.getKeyPath,qr=Ei.getKeys,ts=Ei.getSubPathKeys,_s=m.useMemo(function(){return{registerPath:Ui,unregisterPath:Hi}},[Ui,Hi]),ns=m.useMemo(function(){return{isSubPathKey:Pi}},[Pi]);m.useEffect(function(){es(Bi?At:Dr.slice(ci+1).map(function(Mr){return Mr.key}))},[ci,Bi]);var rs=(0,x.Z)(Vn||ir&&((Qe=Dr[0])===null||Qe===void 0?void 0:Qe.key),{value:Vn}),$i=(0,$.Z)(rs,2),mi=$i[0],dr=$i[1],rr=J(function(Mr){dr(Mr)}),Kr=J(function(){dr(void 0)});(0,m.useImperativeHandle)($e,function(){return{list:mr.current,focus:function(Cr){var Pr,ei=qr(),ti=xe(ei,Lr),is=ti.elements,ss=ti.key2element,ji=ti.element2key,ks=me(mr.current,is),Es=mi!=null?mi:ks[0]?ji.get(ks[0]):(Pr=Dr.find(function(Ps){return!Ps.props.disabled}))===null||Pr===void 0?void 0:Pr.key,Zi=ss.get(Es);if(Es&&Zi){var bs;Zi==null||(bs=Zi.focus)===null||bs===void 0||bs.call(Zi,Cr)}}}});var Zr=(0,x.Z)(sn||[],{value:Dt,postState:function(Cr){return Array.isArray(Cr)?Cr:Cr==null?At:[Cr]}}),Tr=(0,$.Z)(Zr,2),Fr=Tr[0],ai=Tr[1],oi=function(Cr){if(_r){var Pr=Cr.key,ei=Fr.includes(Pr),ti;On?ei?ti=Fr.filter(function(ss){return ss!==Pr}):ti=[].concat((0,ue.Z)(Fr),[Pr]):ti=[Pr],ai(ti);var is=(0,Te.Z)((0,Te.Z)({},Cr),{},{selectedKeys:ti});ei?$t==null||$t(is):bt==null||bt(is)}!On&&Rr.length&&Ur!=="inline"&&Sn(At)},bi=J(function(Mr){sr==null||sr(it(Mr)),oi(Mr)}),xi=J(function(Mr,Cr){var Pr=Rr.filter(function(ti){return ti!==Mr});if(Cr)Pr.push(Mr);else if(Ur!=="inline"){var ei=ts(Mr);Pr=Pr.filter(function(ti){return!ei.has(ti)})}(0,A.Z)(Rr,Pr,!0)||Sn(Pr,!0)}),Si=function(Cr,Pr){var ei=Pr!=null?Pr:!Rr.includes(Cr);xi(Cr,ei)},Ki=Le(Ur,mi,Br,Lr,mr,qr,vs,dr,Si,fr);m.useEffect(function(){Wr(!0)},[]);var Oi=m.useMemo(function(){return{_internalRenderMenuItem:Or,_internalRenderSubMenuItem:br}},[Or,br]),Ls=Ur!=="horizontal"||an?Dr:Dr.map(function(Mr,Cr){return m.createElement(D,{key:Mr.key,overflowDisabled:Cr>ci},Mr)}),ys=m.createElement(l.Z,(0,L.Z)({id:fn,ref:mr,prefixCls:"".concat(pt,"-overflow"),component:"ul",itemComponent:Ie,className:le()(pt,"".concat(pt,"-root"),"".concat(pt,"-").concat(Ur),Ht,(0,fe.Z)((0,fe.Z)({},"".concat(pt,"-inline-collapsed"),ps),"".concat(pt,"-rtl"),Br),Rt),dir:rn,style:Kt,role:"menu",tabIndex:$n,data:Ls,renderRawItem:function(Cr){return Cr},renderRawRest:function(Cr){var Pr=Cr.length,ei=Pr?Dr.slice(-Pr):null;return m.createElement(yn,{eventKey:k,title:Yn,disabled:Bi,internalPopupClose:Pr===0,popupClassName:Xn},ei)},maxCount:Ur!=="horizontal"||an?l.Z.INVALIDATE:l.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Cr){ms(Cr)},onKeyDown:Ki},Vr));return m.createElement(V.Provider,{value:Oi},m.createElement(S.Provider,{value:Lr},m.createElement(D,{prefixCls:pt,rootClassName:Rt,mode:Ur,openKeys:Rr,rtl:Br,disabled:Jt,motion:ui?Kn:null,defaultMotions:ui?tr:null,activeKey:mi,onActive:rr,onInactive:Kr,selectedKeys:Fr,inlineIndent:bn,subMenuOpenDelay:En,subMenuCloseDelay:on,forceSubMenuRender:jn,builtinPlacements:Bn,triggerSubMenuAction:Tn,getPopupContainer:cr,itemIcon:Zn,expandIcon:pr,onItemClick:bi,onOpenChange:xi},m.createElement(Pe.Provider,{value:ns},ys),m.createElement("div",{style:{display:"none"},"aria-hidden":!0},m.createElement(te.Provider,{value:_s},ii)))))}),Gt=Pt,Ft=Gt;Ft.Item=Ie,Ft.SubMenu=yn,Ft.ItemGroup=xt,Ft.Divider=Me;var dt=Ft},11780:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return j}});var L=w(54476),fe=w(33885),Te=w(42978),ue=w(75931),$=w(59301),p=w(92310),ge=w.n(p),le=w(29301),l=w(34280),x=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],A=void 0;function h(_,v){var P=_.prefixCls,re=_.invalidate,Oe=_.item,Ze=_.renderItem,Ye=_.responsive,qe=_.responsiveDisabled,ft=_.registerSize,vt=_.itemKey,Ae=_.className,wt=_.style,rt=_.children,Mt=_.display,et=_.order,ze=_.component,ye=ze===void 0?"div":ze,me=(0,ue.Z)(_,x),B=Ye&&!Mt;function xe(be){ft(vt,be)}$.useEffect(function(){return function(){xe(null)}},[]);var Le=Ze&&Oe!==A?Ze(Oe,{index:et}):rt,K;re||(K={opacity:B?0:1,height:B?0:A,overflowY:B?"hidden":A,order:Ye?et:A,pointerEvents:B?"none":A,position:B?"absolute":A});var R={};B&&(R["aria-hidden"]=!0);var ie=$.createElement(ye,(0,L.Z)({className:ge()(!re&&P,Ae),style:(0,fe.Z)((0,fe.Z)({},K),wt)},R,me,{ref:v}),Le);return Ye&&(ie=$.createElement(le.Z,{onResize:function(k){var Y=k.offsetWidth;xe(Y)},disabled:qe},ie)),ie}var m=$.forwardRef(h);m.displayName="Item";var y=m,S=w(6089),F=w(4676),Z=w(16089);function W(_){if(typeof MessageChannel=="undefined")(0,Z.Z)(_);else{var v=new MessageChannel;v.port1.onmessage=function(){return _()},v.port2.postMessage(void 0)}}function I(){var _=$.useRef(null),v=function(re){_.current||(_.current=[],W(function(){(0,F.unstable_batchedUpdates)(function(){_.current.forEach(function(Oe){Oe()}),_.current=null})})),_.current.push(re)};return v}function N(_,v){var P=$.useState(v),re=(0,Te.Z)(P,2),Oe=re[0],Ze=re[1],Ye=(0,S.Z)(function(qe){_(function(){Ze(qe)})});return[Oe,Ye]}var T=$.createContext(null),D=["component"],q=["className"],te=["className"],X=function(v,P){var re=$.useContext(T);if(!re){var Oe=v.component,Ze=Oe===void 0?"div":Oe,Ye=(0,ue.Z)(v,D);return $.createElement(Ze,(0,L.Z)({},Ye,{ref:P}))}var qe=re.className,ft=(0,ue.Z)(re,q),vt=v.className,Ae=(0,ue.Z)(v,te);return $.createElement(T.Provider,{value:null},$.createElement(y,(0,L.Z)({ref:P,className:ge()(qe,vt)},ft,Ae)))},ce=$.forwardRef(X);ce.displayName="RawItem";var we=ce,Pe=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Ve="responsive",V="invalidate";function C(_){return"+ ".concat(_.length," ...")}function G(_,v){var P=_.prefixCls,re=P===void 0?"rc-overflow":P,Oe=_.data,Ze=Oe===void 0?[]:Oe,Ye=_.renderItem,qe=_.renderRawItem,ft=_.itemKey,vt=_.itemWidth,Ae=vt===void 0?10:vt,wt=_.ssr,rt=_.style,Mt=_.className,et=_.maxCount,ze=_.renderRest,ye=_.renderRawRest,me=_.suffix,B=_.component,xe=B===void 0?"div":B,Le=_.itemComponent,K=_.onVisibleChange,R=(0,ue.Z)(_,Pe),ie=wt==="full",be=I(),k=N(be,null),Y=(0,Te.Z)(k,2),J=Y[0],se=Y[1],ee=J||0,ne=N(be,new Map),Ee=(0,Te.Z)(ne,2),Be=Ee[0],Ce=Ee[1],De=N(be,0),oe=(0,Te.Z)(De,2),Ge=oe[0],Ue=oe[1],Fe=N(be,0),lt=(0,Te.Z)(Fe,2),ut=lt[0],it=lt[1],Ct=N(be,0),zt=(0,Te.Z)(Ct,2),ct=zt[0],Ut=zt[1],Ne=(0,$.useState)(null),Se=(0,Te.Z)(Ne,2),Ie=Se[0],U=Se[1],z=(0,$.useState)(null),pe=(0,Te.Z)(z,2),de=pe[0],ve=pe[1],je=$.useMemo(function(){return de===null&&ie?Number.MAX_SAFE_INTEGER:de||0},[de,J]),tt=(0,$.useState)(!1),yt=(0,Te.Z)(tt,2),It=yt[0],qt=yt[1],gn="".concat(re,"-item"),en=Math.max(Ge,ut),nn=et===Ve,wn=Ze.length&&nn,zn=et===V,kn=wn||typeof et=="number"&&Ze.length>et,Nn=(0,$.useMemo)(function(){var Ft=Ze;return wn?J===null&&ie?Ft=Ze:Ft=Ze.slice(0,Math.min(Ze.length,ee/Ae)):typeof et=="number"&&(Ft=Ze.slice(0,et)),Ft},[Ze,Ae,J,et,wn]),Lt=(0,$.useMemo)(function(){return wn?Ze.slice(je+1):Ze.slice(Nn.length)},[Ze,Nn,wn,je]),ht=(0,$.useCallback)(function(Ft,dt){var Re;return typeof ft=="function"?ft(Ft):(Re=ft&&(Ft==null?void 0:Ft[ft]))!==null&&Re!==void 0?Re:dt},[ft]),Zt=(0,$.useCallback)(Ye||function(Ft){return Ft},[Ye]);function yn(Ft,dt,Re){de===Ft&&(dt===void 0||dt===Ie)||(ve(Ft),Re||(qt(Ft<Ze.length-1),K==null||K(Ft)),dt!==void 0&&U(dt))}function Hn(Ft,dt){se(dt.clientWidth)}function Me(Ft,dt){Ce(function(Re){var $e=new Map(Re);return dt===null?$e.delete(Ft):$e.set(Ft,dt),$e})}function ke(Ft,dt){it(dt),Ue(ut)}function St(Ft,dt){Ut(dt)}function st(Ft){return Be.get(ht(Nn[Ft],Ft))}(0,l.Z)(function(){if(ee&&typeof en=="number"&&Nn){var Ft=ct,dt=Nn.length,Re=dt-1;if(!dt){yn(0,null);return}for(var $e=0;$e<dt;$e+=1){var Qe=st($e);if(ie&&(Qe=Qe||0),Qe===void 0){yn($e-1,void 0,!0);break}if(Ft+=Qe,Re===0&&Ft<=ee||$e===Re-1&&Ft+st(Re)<=ee){yn(Re,null);break}else if(Ft+en>ee){yn($e-1,Ft-Qe-ct+ut);break}}me&&st(0)+ct>ee&&U(null)}},[ee,Be,ut,ct,ht,Nn]);var xt=It&&!!Lt.length,Tt={};Ie!==null&&wn&&(Tt={position:"absolute",left:Ie,top:0});var Et={prefixCls:gn,responsive:wn,component:Le,invalidate:zn},kt=qe?function(Ft,dt){var Re=ht(Ft,dt);return $.createElement(T.Provider,{key:Re,value:(0,fe.Z)((0,fe.Z)({},Et),{},{order:dt,item:Ft,itemKey:Re,registerSize:Me,display:dt<=je})},qe(Ft,dt))}:function(Ft,dt){var Re=ht(Ft,dt);return $.createElement(y,(0,L.Z)({},Et,{order:dt,key:Re,item:Ft,renderItem:Zt,itemKey:Re,registerSize:Me,display:dt<=je}))},jt={order:xt?je:Number.MAX_SAFE_INTEGER,className:"".concat(gn,"-rest"),registerSize:ke,display:xt},At=ze||C,Pt=ye?$.createElement(T.Provider,{value:(0,fe.Z)((0,fe.Z)({},Et),jt)},ye(Lt)):$.createElement(y,(0,L.Z)({},Et,jt),typeof At=="function"?At(Lt):At),Gt=$.createElement(xe,(0,L.Z)({className:ge()(!zn&&re,Mt),style:rt,ref:v},R),Nn.map(kt),kn?Pt:null,me&&$.createElement(y,(0,L.Z)({},Et,{responsive:nn,responsiveDisabled:!wn,order:je,className:"".concat(gn,"-suffix"),registerSize:St,display:!0,style:Tt}),me));return nn?$.createElement(le.Z,{onResize:Hn,disabled:!wn},Gt):Gt}var H=$.forwardRef(G);H.displayName="Overflow",H.Item=we,H.RESPONSIVE=Ve,H.INVALIDATE=V;var Q=H,j=Q},29301:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return V}});var L=w(54476),fe=w(59301),Te=w(11592),ue=w(48736),$=w(33885),p=w(76190),ge=w(76846),le=w(8654),l=fe.createContext(null);function x(C){var G=C.children,H=C.onBatchResize,Q=fe.useRef(0),j=fe.useRef([]),_=fe.useContext(l),v=fe.useCallback(function(P,re,Oe){Q.current+=1;var Ze=Q.current;j.current.push({size:P,element:re,data:Oe}),Promise.resolve().then(function(){Ze===Q.current&&(H==null||H(j.current),j.current=[])}),_==null||_(P,re,Oe)},[H,_]);return fe.createElement(l.Provider,{value:v},G)}var A=w(76374),h=new Map;function m(C){C.forEach(function(G){var H,Q=G.target;(H=h.get(Q))===null||H===void 0||H.forEach(function(j){return j(Q)})})}var y=new A.Z(m),S=null,F=null;function Z(C,G){h.has(C)||(h.set(C,new Set),y.observe(C)),h.get(C).add(G)}function W(C,G){h.has(C)&&(h.get(C).delete(G),h.get(C).size||(y.unobserve(C),h.delete(C)))}var I=w(67732),N=w(83652),T=w(42403),D=w(158),q=function(C){(0,T.Z)(H,C);var G=(0,D.Z)(H);function H(){return(0,I.Z)(this,H),G.apply(this,arguments)}return(0,N.Z)(H,[{key:"render",value:function(){return this.props.children}}]),H}(fe.Component);function te(C,G){var H=C.children,Q=C.disabled,j=fe.useRef(null),_=fe.useRef(null),v=fe.useContext(l),P=typeof H=="function",re=P?H(j):H,Oe=fe.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Ze=!P&&fe.isValidElement(re)&&(0,le.Yr)(re),Ye=Ze?(0,le.C4)(re):null,qe=(0,le.x1)(Ye,j),ft=function(){var rt;return(0,ge.ZP)(j.current)||(j.current&&(0,p.Z)(j.current)==="object"?(0,ge.ZP)((rt=j.current)===null||rt===void 0?void 0:rt.nativeElement):null)||(0,ge.ZP)(_.current)};fe.useImperativeHandle(G,function(){return ft()});var vt=fe.useRef(C);vt.current=C;var Ae=fe.useCallback(function(wt){var rt=vt.current,Mt=rt.onResize,et=rt.data,ze=wt.getBoundingClientRect(),ye=ze.width,me=ze.height,B=wt.offsetWidth,xe=wt.offsetHeight,Le=Math.floor(ye),K=Math.floor(me);if(Oe.current.width!==Le||Oe.current.height!==K||Oe.current.offsetWidth!==B||Oe.current.offsetHeight!==xe){var R={width:Le,height:K,offsetWidth:B,offsetHeight:xe};Oe.current=R;var ie=B===Math.round(ye)?ye:B,be=xe===Math.round(me)?me:xe,k=(0,$.Z)((0,$.Z)({},R),{},{offsetWidth:ie,offsetHeight:be});v==null||v(k,wt,et),Mt&&Promise.resolve().then(function(){Mt(k,wt)})}},[]);return fe.useEffect(function(){var wt=ft();return wt&&!Q&&Z(wt,Ae),function(){return W(wt,Ae)}},[j.current,Q]),fe.createElement(q,{ref:_},Ze?fe.cloneElement(re,{ref:qe}):re)}var X=fe.forwardRef(te),ce=X,we="rc-observer-key";function Pe(C,G){var H=C.children,Q=typeof H=="function"?[H]:(0,Te.Z)(H);return Q.map(function(j,_){var v=(j==null?void 0:j.key)||"".concat(we,"-").concat(_);return fe.createElement(ce,(0,L.Z)({},C,{key:v,ref:_===0?G:void 0}),j)})}var Ve=fe.forwardRef(Pe);Ve.Collection=x;var V=Ve},6551:function(_n,_t,w){"use strict";w.d(_t,{ZP:function(){return ge}});var L=w(42978),fe=w(59301),Te=w(47273),ue=0,$=(0,Te.Z)();function p(){var le;return $?(le=ue,ue+=1):le="TEST_OR_SSR",le}function ge(le){var l=fe.useState(),x=(0,L.Z)(l,2),A=x[0],h=x[1];return fe.useEffect(function(){h("rc_select_".concat(p()))},[]),le||A}},37463:function(_n,_t,w){"use strict";w.d(_t,{Ac:function(){return oe},Xo:function(){return Ue},Wx:function(){return lt},ZP:function(){return Hn},lk:function(){return N}});var L=w(54476),fe=w(94480),Te=w(20068),ue=w(33885),$=w(42978),p=w(75931),ge=w(76190),le=w(18929),l=w(48736),x=w(59301),A=w(92310),h=w.n(A),m=w(34280),y=w(49658),S=w(8654),F=function(ke){var St=ke.className,st=ke.customizeIcon,xt=ke.customizeIconProps,Tt=ke.children,Et=ke.onMouseDown,kt=ke.onClick,jt=typeof st=="function"?st(xt):st;return x.createElement("span",{className:St,onMouseDown:function(Pt){Pt.preventDefault(),Et==null||Et(Pt)},style:{userSelect:"none",WebkitUserSelect:"none"},unselectable:"on",onClick:kt,"aria-hidden":!0},jt!==void 0?jt:x.createElement("span",{className:h()(St.split(/\s+/).map(function(At){return"".concat(At,"-icon")}))},Tt))},Z=F,W=function(ke,St,st,xt,Tt){var Et=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,kt=arguments.length>6?arguments[6]:void 0,jt=arguments.length>7?arguments[7]:void 0,At=x.useMemo(function(){if((0,ge.Z)(xt)==="object")return xt.clearIcon;if(Tt)return Tt},[xt,Tt]),Pt=x.useMemo(function(){return!!(!Et&&xt&&(st.length||kt)&&!(jt==="combobox"&&kt===""))},[xt,Et,st.length,kt,jt]);return{allowClear:Pt,clearIcon:x.createElement(Z,{className:"".concat(ke,"-clear"),onMouseDown:St,customizeIcon:At},"\xD7")}},I=x.createContext(null);function N(){return x.useContext(I)}function T(){var Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:10,ke=x.useState(!1),St=(0,$.Z)(ke,2),st=St[0],xt=St[1],Tt=x.useRef(null),Et=function(){window.clearTimeout(Tt.current)};x.useEffect(function(){return Et},[]);var kt=function(At,Pt){Et(),Tt.current=window.setTimeout(function(){xt(At),Pt&&Pt()},Me)};return[st,kt,Et]}function D(){var Me=arguments.length>0&&arguments[0]!==void 0?arguments[0]:250,ke=x.useRef(null),St=x.useRef(null);x.useEffect(function(){return function(){window.clearTimeout(St.current)}},[]);function st(xt){(xt||ke.current===null)&&(ke.current=xt),window.clearTimeout(St.current),St.current=window.setTimeout(function(){ke.current=null},Me)}return[function(){return ke.current},st]}function q(Me,ke,St,st){var xt=x.useRef(null);xt.current={open:ke,triggerOpen:St,customizedTrigger:st},x.useEffect(function(){function Tt(Et){var kt;if(!((kt=xt.current)!==null&&kt!==void 0&&kt.customizedTrigger)){var jt=Et.target;jt.shadowRoot&&Et.composed&&(jt=Et.composedPath()[0]||jt),xt.current.open&&Me().filter(function(At){return At}).every(function(At){return!At.contains(jt)&&At!==jt})&&xt.current.triggerOpen(!1)}}return window.addEventListener("mousedown",Tt),function(){return window.removeEventListener("mousedown",Tt)}},[])}var te=w(10228);function X(Me){return Me&&![te.Z.ESC,te.Z.SHIFT,te.Z.BACKSPACE,te.Z.TAB,te.Z.WIN_KEY,te.Z.ALT,te.Z.META,te.Z.WIN_KEY_RIGHT,te.Z.CTRL,te.Z.SEMICOLON,te.Z.EQUALS,te.Z.CAPS_LOCK,te.Z.CONTEXT_MENU,te.Z.F1,te.Z.F2,te.Z.F3,te.Z.F4,te.Z.F5,te.Z.F6,te.Z.F7,te.Z.F8,te.Z.F9,te.Z.F10,te.Z.F11,te.Z.F12].includes(Me)}var ce=w(26112),we=w(11780);function Pe(Me,ke,St){var st=(0,ue.Z)((0,ue.Z)({},Me),St?ke:{});return Object.keys(ke).forEach(function(xt){var Tt=ke[xt];typeof Tt=="function"&&(st[xt]=function(){for(var Et,kt=arguments.length,jt=new Array(kt),At=0;At<kt;At++)jt[At]=arguments[At];return Tt.apply(void 0,jt),(Et=Me[xt])===null||Et===void 0?void 0:Et.call.apply(Et,[Me].concat(jt))})}),st}var Ve=Pe,V=["prefixCls","id","inputElement","autoFocus","autoComplete","editable","activeDescendantId","value","open","attrs"],C=function(ke,St){var st=ke.prefixCls,xt=ke.id,Tt=ke.inputElement,Et=ke.autoFocus,kt=ke.autoComplete,jt=ke.editable,At=ke.activeDescendantId,Pt=ke.value,Gt=ke.open,Ft=ke.attrs,dt=(0,p.Z)(ke,V),Re=Tt||x.createElement("input",null),$e=Re,Qe=$e.ref,Xe=$e.props;return(0,l.Kp)(!("maxLength"in Re.props),"Passing 'maxLength' to input element directly may not work because input in BaseSelect is controlled."),Re=x.cloneElement(Re,(0,ue.Z)((0,ue.Z)((0,ue.Z)({type:"search"},Ve(dt,Xe,!0)),{},{id:xt,ref:(0,S.sQ)(St,Qe),autoComplete:kt||"off",autoFocus:Et,className:h()("".concat(st,"-selection-search-input"),Xe==null?void 0:Xe.className),role:"combobox","aria-expanded":Gt||!1,"aria-haspopup":"listbox","aria-owns":"".concat(xt,"_list"),"aria-autocomplete":"list","aria-controls":"".concat(xt,"_list"),"aria-activedescendant":Gt?At:void 0},Ft),{},{value:jt?Pt:"",readOnly:!jt,unselectable:jt?null:"on",style:(0,ue.Z)((0,ue.Z)({},Xe.style),{},{opacity:jt?null:0})})),Re},G=x.forwardRef(C),H=G;function Q(Me){return Array.isArray(Me)?Me:Me!==void 0?[Me]:[]}var j=typeof window!="undefined"&&window.document&&window.document.documentElement,_=j;function v(Me){return Me!=null}function P(Me){return!Me&&Me!==0}function re(Me){return["string","number"].includes((0,ge.Z)(Me))}function Oe(Me){var ke=void 0;return Me&&(re(Me.title)?ke=Me.title.toString():re(Me.label)&&(ke=Me.label.toString())),ke}function Ze(Me,ke){_?x.useLayoutEffect(Me,ke):x.useEffect(Me,ke)}function Ye(Me){var ke;return(ke=Me.key)!==null&&ke!==void 0?ke:Me.value}var qe=function(ke){ke.preventDefault(),ke.stopPropagation()},ft=function(ke){var St=ke.id,st=ke.prefixCls,xt=ke.values,Tt=ke.open,Et=ke.searchValue,kt=ke.autoClearSearchValue,jt=ke.inputRef,At=ke.placeholder,Pt=ke.disabled,Gt=ke.mode,Ft=ke.showSearch,dt=ke.autoFocus,Re=ke.autoComplete,$e=ke.activeDescendantId,Qe=ke.tabIndex,Xe=ke.removeIcon,gt=ke.maxTagCount,pt=ke.maxTagTextLength,Rt=ke.maxTagPlaceholder,Kt=Rt===void 0?function($t){return"+ ".concat($t.length," ...")}:Rt,Ht=ke.tagRender,tn=ke.onToggleOpen,$n=ke.onRemove,Vt=ke.onInputChange,un=ke.onInputPaste,rn=ke.onInputKeyDown,fn=ke.onInputMouseDown,Yt=ke.onInputCompositionStart,Bt=ke.onInputCompositionEnd,Wt=ke.onInputBlur,Jt=x.useRef(null),an=(0,x.useState)(0),cn=(0,$.Z)(an,2),En=cn[0],mn=cn[1],on=(0,x.useState)(!1),jn=(0,$.Z)(on,2),Qn=jn[0],or=jn[1],Vn="".concat(st,"-selection"),ir=Tt||Gt==="multiple"&&kt===!1||Gt==="tags"?Et:"",Jn=Gt==="tags"||Gt==="multiple"&&kt===!1||Ft&&(Tt||Qn);Ze(function(){mn(Jt.current.scrollWidth)},[ir]);var _r=function(Qt,bn,Kn,tr,Xt){return x.createElement("span",{title:Oe(Qt),className:h()("".concat(Vn,"-item"),(0,Te.Z)({},"".concat(Vn,"-item-disabled"),Kn))},x.createElement("span",{className:"".concat(Vn,"-item-content")},bn),tr&&x.createElement(Z,{className:"".concat(Vn,"-item-remove"),onMouseDown:qe,onClick:Xt,customizeIcon:Xe},"\xD7"))},ur=function(Qt,bn,Kn,tr,Xt,Tn){var Bn=function(pr){qe(pr),tn(!Tt)};return x.createElement("span",{onMouseDown:Bn},Ht({label:bn,value:Qt,disabled:Kn,closable:tr,onClose:Xt,isMaxTag:!!Tn}))},On=function(Qt){var bn=Qt.disabled,Kn=Qt.label,tr=Qt.value,Xt=!Pt&&!bn,Tn=Kn;if(typeof pt=="number"&&(typeof Kn=="string"||typeof Kn=="number")){var Bn=String(Tn);Bn.length>pt&&(Tn="".concat(Bn.slice(0,pt),"..."))}var Zn=function(An){An&&An.stopPropagation(),$n(Qt)};return typeof Ht=="function"?ur(tr,Tn,bn,Xt,Zn):_r(Qt,Tn,bn,Xt,Zn)},sn=function(Qt){if(!xt.length)return null;var bn=typeof Kt=="function"?Kt(Qt):Kt;return typeof Ht=="function"?ur(void 0,bn,!1,!1,void 0,!0):_r({title:bn},bn,!1)},Dt=x.createElement("div",{className:"".concat(Vn,"-search"),style:{width:En},onFocus:function(){or(!0)},onBlur:function(){or(!1)}},x.createElement(H,{ref:jt,open:Tt,prefixCls:st,id:St,inputElement:null,disabled:Pt,autoFocus:dt,autoComplete:Re,editable:Jn,activeDescendantId:$e,value:ir,onKeyDown:rn,onMouseDown:fn,onChange:Vt,onPaste:un,onCompositionStart:Yt,onCompositionEnd:Bt,onBlur:Wt,tabIndex:Qe,attrs:(0,ce.Z)(ke,!0)}),x.createElement("span",{ref:Jt,className:"".concat(Vn,"-search-mirror"),"aria-hidden":!0},ir,"\xA0")),bt=x.createElement(we.Z,{prefixCls:"".concat(Vn,"-overflow"),data:xt,renderItem:On,renderRest:sn,suffix:Dt,itemKey:Ye,maxCount:gt});return x.createElement("span",{className:"".concat(Vn,"-wrap")},bt,!xt.length&&!ir&&x.createElement("span",{className:"".concat(Vn,"-placeholder")},At))},vt=ft,Ae=function(ke){var St=ke.inputElement,st=ke.prefixCls,xt=ke.id,Tt=ke.inputRef,Et=ke.disabled,kt=ke.autoFocus,jt=ke.autoComplete,At=ke.activeDescendantId,Pt=ke.mode,Gt=ke.open,Ft=ke.values,dt=ke.placeholder,Re=ke.tabIndex,$e=ke.showSearch,Qe=ke.searchValue,Xe=ke.activeValue,gt=ke.maxLength,pt=ke.onInputKeyDown,Rt=ke.onInputMouseDown,Kt=ke.onInputChange,Ht=ke.onInputPaste,tn=ke.onInputCompositionStart,$n=ke.onInputCompositionEnd,Vt=ke.onInputBlur,un=ke.title,rn=x.useState(!1),fn=(0,$.Z)(rn,2),Yt=fn[0],Bt=fn[1],Wt=Pt==="combobox",Jt=Wt||$e,an=Ft[0],cn=Qe||"";Wt&&Xe&&!Yt&&(cn=Xe),x.useEffect(function(){Wt&&Bt(!1)},[Wt,Xe]);var En=Pt!=="combobox"&&!Gt&&!$e?!1:!!cn,mn=un===void 0?Oe(an):un,on=x.useMemo(function(){return an?null:x.createElement("span",{className:"".concat(st,"-selection-placeholder"),style:En?{visibility:"hidden"}:void 0},dt)},[an,En,dt,st]);return x.createElement("span",{className:"".concat(st,"-selection-wrap")},x.createElement("span",{className:"".concat(st,"-selection-search")},x.createElement(H,{ref:Tt,prefixCls:st,id:xt,open:Gt,inputElement:St,disabled:Et,autoFocus:kt,autoComplete:jt,editable:Jt,activeDescendantId:At,value:cn,onKeyDown:pt,onMouseDown:Rt,onChange:function(Qn){Bt(!0),Kt(Qn)},onPaste:Ht,onCompositionStart:tn,onCompositionEnd:$n,onBlur:Vt,tabIndex:Re,attrs:(0,ce.Z)(ke,!0),maxLength:Wt?gt:void 0})),!Wt&&an?x.createElement("span",{className:"".concat(st,"-selection-item"),title:mn,style:En?{visibility:"hidden"}:void 0},an.label):null,on)},wt=Ae,rt=function(ke,St){var st=(0,x.useRef)(null),xt=(0,x.useRef)(!1),Tt=ke.prefixCls,Et=ke.open,kt=ke.mode,jt=ke.showSearch,At=ke.tokenWithEnter,Pt=ke.disabled,Gt=ke.prefix,Ft=ke.autoClearSearchValue,dt=ke.onSearch,Re=ke.onSearchSubmit,$e=ke.onToggleOpen,Qe=ke.onInputKeyDown,Xe=ke.onInputBlur,gt=ke.domRef;x.useImperativeHandle(St,function(){return{focus:function(mn){st.current.focus(mn)},blur:function(){st.current.blur()}}});var pt=D(0),Rt=(0,$.Z)(pt,2),Kt=Rt[0],Ht=Rt[1],tn=function(mn){var on=mn.which,jn=st.current instanceof HTMLTextAreaElement;!jn&&Et&&(on===te.Z.UP||on===te.Z.DOWN)&&mn.preventDefault(),Qe&&Qe(mn),on===te.Z.ENTER&&kt==="tags"&&!xt.current&&!Et&&(Re==null||Re(mn.target.value)),!(jn&&!Et&&~[te.Z.UP,te.Z.DOWN,te.Z.LEFT,te.Z.RIGHT].indexOf(on))&&X(on)&&$e(!0)},$n=function(){Ht(!0)},Vt=(0,x.useRef)(null),un=function(mn){dt(mn,!0,xt.current)!==!1&&$e(!0)},rn=function(){xt.current=!0},fn=function(mn){xt.current=!1,kt!=="combobox"&&un(mn.target.value)},Yt=function(mn){var on=mn.target.value;if(At&&Vt.current&&/[\r\n]/.test(Vt.current)){var jn=Vt.current.replace(/[\r\n]+$/,"").replace(/\r\n/g," ").replace(/[\r\n]/g," ");on=on.replace(jn,Vt.current)}Vt.current=null,un(on)},Bt=function(mn){var on=mn.clipboardData,jn=on==null?void 0:on.getData("text");Vt.current=jn||""},Wt=function(mn){var on=mn.target;if(on!==st.current){var jn=document.body.style.msTouchAction!==void 0;jn?setTimeout(function(){st.current.focus()}):st.current.focus()}},Jt=function(mn){var on=Kt();mn.target!==st.current&&!on&&!(kt==="combobox"&&Pt)&&mn.preventDefault(),(kt!=="combobox"&&(!jt||!on)||!Et)&&(Et&&Ft!==!1&&dt("",!0,!1),$e())},an={inputRef:st,onInputKeyDown:tn,onInputMouseDown:$n,onInputChange:Yt,onInputPaste:Bt,onInputCompositionStart:rn,onInputCompositionEnd:fn,onInputBlur:Xe},cn=kt==="multiple"||kt==="tags"?x.createElement(vt,(0,L.Z)({},ke,an)):x.createElement(wt,(0,L.Z)({},ke,an));return x.createElement("div",{ref:gt,className:"".concat(Tt,"-selector"),onClick:Wt,onMouseDown:Jt},Gt&&x.createElement("div",{className:"".concat(Tt,"-prefix")},Gt),cn)},Mt=x.forwardRef(rt),et=Mt,ze=w(65030),ye=["prefixCls","disabled","visible","children","popupElement","animation","transitionName","dropdownStyle","dropdownClassName","direction","placement","builtinPlacements","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","getPopupContainer","empty","getTriggerDOMNode","onPopupVisibleChange","onPopupMouseEnter"],me=function(ke){var St=ke===!0?0:1;return{bottomLeft:{points:["tl","bl"],offset:[0,4],overflow:{adjustX:St,adjustY:1},htmlRegion:"scroll"},bottomRight:{points:["tr","br"],offset:[0,4],overflow:{adjustX:St,adjustY:1},htmlRegion:"scroll"},topLeft:{points:["bl","tl"],offset:[0,-4],overflow:{adjustX:St,adjustY:1},htmlRegion:"scroll"},topRight:{points:["br","tr"],offset:[0,-4],overflow:{adjustX:St,adjustY:1},htmlRegion:"scroll"}}},B=function(ke,St){var st=ke.prefixCls,xt=ke.disabled,Tt=ke.visible,Et=ke.children,kt=ke.popupElement,jt=ke.animation,At=ke.transitionName,Pt=ke.dropdownStyle,Gt=ke.dropdownClassName,Ft=ke.direction,dt=Ft===void 0?"ltr":Ft,Re=ke.placement,$e=ke.builtinPlacements,Qe=ke.dropdownMatchSelectWidth,Xe=ke.dropdownRender,gt=ke.dropdownAlign,pt=ke.getPopupContainer,Rt=ke.empty,Kt=ke.getTriggerDOMNode,Ht=ke.onPopupVisibleChange,tn=ke.onPopupMouseEnter,$n=(0,p.Z)(ke,ye),Vt="".concat(st,"-dropdown"),un=kt;Xe&&(un=Xe(kt));var rn=x.useMemo(function(){return $e||me(Qe)},[$e,Qe]),fn=jt?"".concat(Vt,"-").concat(jt):At,Yt=typeof Qe=="number",Bt=x.useMemo(function(){return Yt?null:Qe===!1?"minWidth":"width"},[Qe,Yt]),Wt=Pt;Yt&&(Wt=(0,ue.Z)((0,ue.Z)({},Wt),{},{width:Qe}));var Jt=x.useRef(null);return x.useImperativeHandle(St,function(){return{getPopupElement:function(){var cn;return(cn=Jt.current)===null||cn===void 0?void 0:cn.popupElement}}}),x.createElement(ze.Z,(0,L.Z)({},$n,{showAction:Ht?["click"]:[],hideAction:Ht?["click"]:[],popupPlacement:Re||(dt==="rtl"?"bottomRight":"bottomLeft"),builtinPlacements:rn,prefixCls:Vt,popupTransitionName:fn,popup:x.createElement("div",{onMouseEnter:tn},un),ref:Jt,stretch:Bt,popupAlign:gt,popupVisible:Tt,getPopupContainer:pt,popupClassName:h()(Gt,(0,Te.Z)({},"".concat(Vt,"-empty"),Rt)),popupStyle:Wt,getTriggerDOMNode:Kt,onPopupVisibleChange:Ht}),Et)},xe=x.forwardRef(B),Le=xe,K=w(66712);function R(Me,ke){var St=Me.key,st;return"value"in Me&&(st=Me.value),St!=null?St:st!==void 0?st:"rc-index-key-".concat(ke)}function ie(Me){return typeof Me!="undefined"&&!Number.isNaN(Me)}function be(Me,ke){var St=Me||{},st=St.label,xt=St.value,Tt=St.options,Et=St.groupLabel,kt=st||(ke?"children":"label");return{label:kt,value:xt||"value",options:Tt||"options",groupLabel:Et||kt}}function k(Me){var ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},St=ke.fieldNames,st=ke.childrenAsData,xt=[],Tt=be(St,!1),Et=Tt.label,kt=Tt.value,jt=Tt.options,At=Tt.groupLabel;function Pt(Gt,Ft){Array.isArray(Gt)&&Gt.forEach(function(dt){if(Ft||!(jt in dt)){var Re=dt[kt];xt.push({key:R(dt,xt.length),groupOption:Ft,data:dt,label:dt[Et],value:Re})}else{var $e=dt[At];$e===void 0&&st&&($e=dt.label),xt.push({key:R(dt,xt.length),group:!0,data:dt,label:$e}),Pt(dt[jt],!0)}})}return Pt(Me,!1),xt}function Y(Me){var ke=(0,ue.Z)({},Me);return"props"in ke||Object.defineProperty(ke,"props",{get:function(){return(0,l.ZP)(!1,"Return type is option instead of Option instance. Please read value directly instead of reading from `props`."),ke}}),ke}var J=function(ke,St,st){if(!St||!St.length)return null;var xt=!1,Tt=function kt(jt,At){var Pt=(0,K.Z)(At),Gt=Pt[0],Ft=Pt.slice(1);if(!Gt)return[jt];var dt=jt.split(Gt);return xt=xt||dt.length>1,dt.reduce(function(Re,$e){return[].concat((0,fe.Z)(Re),(0,fe.Z)(kt($e,Ft)))},[]).filter(Boolean)},Et=Tt(ke,St);return xt?typeof st!="undefined"?Et.slice(0,st):Et:null},se=x.createContext(null),ee=se;function ne(Me){var ke=Me.visible,St=Me.values;if(!ke)return null;var st=50;return x.createElement("span",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"".concat(St.slice(0,st).map(function(xt){var Tt=xt.label,Et=xt.value;return["number","string"].includes((0,ge.Z)(Tt))?Tt:Et}).join(", ")),St.length>st?", ...":null)}var Ee=["id","prefixCls","className","showSearch","tagRender","direction","omitDomProps","displayValues","onDisplayValuesChange","emptyOptions","notFoundContent","onClear","mode","disabled","loading","getInputElement","getRawInputElement","open","defaultOpen","onDropdownVisibleChange","activeValue","onActiveValueChange","activeDescendantId","searchValue","autoClearSearchValue","onSearch","onSearchSplit","tokenSeparators","allowClear","prefix","suffixIcon","clearIcon","OptionList","animation","transitionName","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","placement","builtinPlacements","getPopupContainer","showAction","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown"],Be=["value","onChange","removeIcon","placeholder","autoFocus","maxTagCount","maxTagTextLength","maxTagPlaceholder","choiceTransitionName","onInputKeyDown","onPopupScroll","tabIndex"],Ce=function(ke){return ke==="tags"||ke==="multiple"},De=x.forwardRef(function(Me,ke){var St,st=Me.id,xt=Me.prefixCls,Tt=Me.className,Et=Me.showSearch,kt=Me.tagRender,jt=Me.direction,At=Me.omitDomProps,Pt=Me.displayValues,Gt=Me.onDisplayValuesChange,Ft=Me.emptyOptions,dt=Me.notFoundContent,Re=dt===void 0?"Not Found":dt,$e=Me.onClear,Qe=Me.mode,Xe=Me.disabled,gt=Me.loading,pt=Me.getInputElement,Rt=Me.getRawInputElement,Kt=Me.open,Ht=Me.defaultOpen,tn=Me.onDropdownVisibleChange,$n=Me.activeValue,Vt=Me.onActiveValueChange,un=Me.activeDescendantId,rn=Me.searchValue,fn=Me.autoClearSearchValue,Yt=Me.onSearch,Bt=Me.onSearchSplit,Wt=Me.tokenSeparators,Jt=Me.allowClear,an=Me.prefix,cn=Me.suffixIcon,En=Me.clearIcon,mn=Me.OptionList,on=Me.animation,jn=Me.transitionName,Qn=Me.dropdownStyle,or=Me.dropdownClassName,Vn=Me.dropdownMatchSelectWidth,ir=Me.dropdownRender,Jn=Me.dropdownAlign,_r=Me.placement,ur=Me.builtinPlacements,On=Me.getPopupContainer,sn=Me.showAction,Dt=sn===void 0?[]:sn,bt=Me.onFocus,$t=Me.onBlur,Qt=Me.onKeyUp,bn=Me.onKeyDown,Kn=Me.onMouseDown,tr=(0,p.Z)(Me,Ee),Xt=Ce(Qe),Tn=(Et!==void 0?Et:Xt)||Qe==="combobox",Bn=(0,ue.Z)({},tr);Be.forEach(function(dr){delete Bn[dr]}),At==null||At.forEach(function(dr){delete Bn[dr]});var Zn=x.useState(!1),pr=(0,$.Z)(Zn,2),An=pr[0],Yn=pr[1];x.useEffect(function(){Yn((0,y.Z)())},[]);var Xn=x.useRef(null),cr=x.useRef(null),sr=x.useRef(null),gr=x.useRef(null),fr=x.useRef(null),Ar=x.useRef(!1),Sr=T(),Or=(0,$.Z)(Sr,3),br=Or[0],yr=Or[1],Vr=Or[2];x.useImperativeHandle(ke,function(){var dr,rr;return{focus:(dr=gr.current)===null||dr===void 0?void 0:dr.focus,blur:(rr=gr.current)===null||rr===void 0?void 0:rr.blur,scrollTo:function(Zr){var Tr;return(Tr=fr.current)===null||Tr===void 0?void 0:Tr.scrollTo(Zr)},nativeElement:Xn.current||cr.current}});var In=x.useMemo(function(){var dr;if(Qe!=="combobox")return rn;var rr=(dr=Pt[0])===null||dr===void 0?void 0:dr.value;return typeof rr=="string"||typeof rr=="number"?String(rr):""},[rn,Qe,Pt]),zr=Qe==="combobox"&&typeof pt=="function"&&pt()||null,Dr=typeof Rt=="function"&&Rt(),ii=(0,S.x1)(cr,Dr==null||(St=Dr.props)===null||St===void 0?void 0:St.ref),si=x.useState(!1),Xr=(0,$.Z)(si,2),ui=Xr[0],Wr=Xr[1];(0,m.Z)(function(){Wr(!0)},[]);var mr=(0,le.Z)(!1,{defaultValue:Ht,value:Kt}),Lr=(0,$.Z)(mr,2),Br=Lr[0],Hr=Lr[1],ar=ui?Br:!1,Rr=!Re&&Ft;(Xe||Rr&&ar&&Qe==="combobox")&&(ar=!1);var kr=Rr?!1:ar,Sn=x.useCallback(function(dr){var rr=dr!==void 0?dr:!ar;Xe||(Hr(rr),ar!==rr&&(tn==null||tn(rr)))},[Xe,ar,Hr,tn]),Gn=x.useMemo(function(){return(Wt||[]).some(function(dr){return[`
`,`\r
`].includes(dr)})},[Wt]),Dn=x.useContext(ee)||{},Un=Dn.maxCount,lr=Dn.rawValues,Er=function(rr,Kr,Zr){if(!(Xt&&ie(Un)&&(lr==null?void 0:lr.size)>=Un)){var Tr=!0,Fr=rr;Vt==null||Vt(null);var ai=J(rr,Wt,ie(Un)?Un-lr.size:void 0),oi=Zr?null:ai;return Qe!=="combobox"&&oi&&(Fr="",Bt==null||Bt(oi),Sn(!1),Tr=!1),Yt&&In!==Fr&&Yt(Fr,{source:Kr?"typing":"effect"}),Tr}},jr=function(rr){!rr||!rr.trim()||Yt(rr,{source:"submit"})};x.useEffect(function(){!ar&&!Xt&&Qe!=="combobox"&&Er("",!1,!1)},[ar]),x.useEffect(function(){Br&&Xe&&Hr(!1),Xe&&!Ar.current&&yr(!1)},[Xe]);var dn=D(),Ln=(0,$.Z)(dn,2),qn=Ln[0],Wn=Ln[1],er=x.useRef(!1),Qr=function(rr){var Kr=qn(),Zr=rr.key,Tr=Zr==="Enter";if(Tr&&(Qe!=="combobox"&&rr.preventDefault(),ar||Sn(!0)),Wn(!!In),Zr==="Backspace"&&!Kr&&Xt&&!In&&Pt.length){for(var Fr=(0,fe.Z)(Pt),ai=null,oi=Fr.length-1;oi>=0;oi-=1){var bi=Fr[oi];if(!bi.disabled){Fr.splice(oi,1),ai=bi;break}}ai&&Gt(Fr,{type:"remove",values:[ai]})}for(var xi=arguments.length,Si=new Array(xi>1?xi-1:0),Ki=1;Ki<xi;Ki++)Si[Ki-1]=arguments[Ki];if(ar&&(!Tr||!er.current)){var Oi;Tr&&(er.current=!0),(Oi=fr.current)===null||Oi===void 0||Oi.onKeyDown.apply(Oi,[rr].concat(Si))}bn==null||bn.apply(void 0,[rr].concat(Si))},Ur=function(rr){for(var Kr=arguments.length,Zr=new Array(Kr>1?Kr-1:0),Tr=1;Tr<Kr;Tr++)Zr[Tr-1]=arguments[Tr];if(ar){var Fr;(Fr=fr.current)===null||Fr===void 0||Fr.onKeyUp.apply(Fr,[rr].concat(Zr))}rr.key==="Enter"&&(er.current=!1),Qt==null||Qt.apply(void 0,[rr].concat(Zr))},Jr=function(rr){var Kr=Pt.filter(function(Zr){return Zr!==rr});Gt(Kr,{type:"remove",values:[rr]})},$r=function(){er.current=!1},Ni=x.useRef(!1),ps=function(){yr(!0),Xe||(bt&&!Ni.current&&bt.apply(void 0,arguments),Dt.includes("focus")&&Sn(!0)),Ni.current=!0},gs=function(){Ar.current=!0,yr(!1,function(){Ni.current=!1,Ar.current=!1,Sn(!1)}),!Xe&&(In&&(Qe==="tags"?Yt(In,{source:"submit"}):Qe==="multiple"&&Yt("",{source:"blur"})),$t&&$t.apply(void 0,arguments))},yi=[];x.useEffect(function(){return function(){yi.forEach(function(dr){return clearTimeout(dr)}),yi.splice(0,yi.length)}},[]);var ki=function(rr){var Kr,Zr=rr.target,Tr=(Kr=sr.current)===null||Kr===void 0?void 0:Kr.getPopupElement();if(Tr&&Tr.contains(Zr)){var Fr=setTimeout(function(){var xi=yi.indexOf(Fr);if(xi!==-1&&yi.splice(xi,1),Vr(),!An&&!Tr.contains(document.activeElement)){var Si;(Si=gr.current)===null||Si===void 0||Si.focus()}});yi.push(Fr)}for(var ai=arguments.length,oi=new Array(ai>1?ai-1:0),bi=1;bi<ai;bi++)oi[bi-1]=arguments[bi];Kn==null||Kn.apply(void 0,[rr].concat(oi))},ci=x.useState({}),ms=(0,$.Z)(ci,2),Bi=ms[1];function Ei(){Bi({})}var Ui;Dr&&(Ui=function(rr){Sn(rr)}),q(function(){var dr;return[Xn.current,(dr=sr.current)===null||dr===void 0?void 0:dr.getPopupElement()]},kr,Sn,!!Dr);var Hi=x.useMemo(function(){return(0,ue.Z)((0,ue.Z)({},Me),{},{notFoundContent:Re,open:ar,triggerOpen:kr,id:st,showSearch:Tn,multiple:Xt,toggleOpen:Sn})},[Me,Re,kr,ar,st,Tn,Xt,Sn]),es=!!cn||gt,Pi;es&&(Pi=x.createElement(Z,{className:h()("".concat(xt,"-arrow"),(0,Te.Z)({},"".concat(xt,"-arrow-loading"),gt)),customizeIcon:cn,customizeIconProps:{loading:gt,searchValue:In,open:ar,focused:br,showSearch:Tn}}));var vs=function(){var rr;$e==null||$e(),(rr=gr.current)===null||rr===void 0||rr.focus(),Gt([],{type:"clear",values:Pt}),Er("",!1,!1)},qr=W(xt,vs,Pt,Jt,En,Xe,In,Qe),ts=qr.allowClear,_s=qr.clearIcon,ns=x.createElement(mn,{ref:fr}),rs=h()(xt,Tt,(0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)({},"".concat(xt,"-focused"),br),"".concat(xt,"-multiple"),Xt),"".concat(xt,"-single"),!Xt),"".concat(xt,"-allow-clear"),Jt),"".concat(xt,"-show-arrow"),es),"".concat(xt,"-disabled"),Xe),"".concat(xt,"-loading"),gt),"".concat(xt,"-open"),ar),"".concat(xt,"-customize-input"),zr),"".concat(xt,"-show-search"),Tn)),$i=x.createElement(Le,{ref:sr,disabled:Xe,prefixCls:xt,visible:kr,popupElement:ns,animation:on,transitionName:jn,dropdownStyle:Qn,dropdownClassName:or,direction:jt,dropdownMatchSelectWidth:Vn,dropdownRender:ir,dropdownAlign:Jn,placement:_r,builtinPlacements:ur,getPopupContainer:On,empty:Ft,getTriggerDOMNode:function(rr){return cr.current||rr},onPopupVisibleChange:Ui,onPopupMouseEnter:Ei},Dr?x.cloneElement(Dr,{ref:ii}):x.createElement(et,(0,L.Z)({},Me,{domRef:cr,prefixCls:xt,inputElement:zr,ref:gr,id:st,prefix:an,showSearch:Tn,autoClearSearchValue:fn,mode:Qe,activeDescendantId:un,tagRender:kt,values:Pt,open:ar,onToggleOpen:Sn,activeValue:$n,searchValue:In,onSearch:Er,onSearchSubmit:jr,onRemove:Jr,tokenWithEnter:Gn,onInputBlur:$r}))),mi;return Dr?mi=$i:mi=x.createElement("div",(0,L.Z)({className:rs},Bn,{ref:Xn,onMouseDown:ki,onKeyDown:Qr,onKeyUp:Ur,onFocus:ps,onBlur:gs}),x.createElement(ne,{visible:br&&!ar,values:Pt}),$i,Pi,ts&&_s),x.createElement(I.Provider,{value:Hi},mi)}),oe=De,Ge=function(){return null};Ge.isSelectOptGroup=!0;var Ue=Ge,Fe=function(){return null};Fe.isSelectOption=!0;var lt=Fe,ut=w(80547),it=w(2738),Ct=w(48911);function zt(){return/(mac\sos|macintosh)/i.test(navigator.appVersion)}var ct=["disabled","title","children","style","className"];function Ut(Me){return typeof Me=="string"||typeof Me=="number"}var Ne=function(ke,St){var st=N(),xt=st.prefixCls,Tt=st.id,Et=st.open,kt=st.multiple,jt=st.mode,At=st.searchValue,Pt=st.toggleOpen,Gt=st.notFoundContent,Ft=st.onPopupScroll,dt=x.useContext(ee),Re=dt.maxCount,$e=dt.flattenOptions,Qe=dt.onActiveValue,Xe=dt.defaultActiveFirstOption,gt=dt.onSelect,pt=dt.menuItemSelectedIcon,Rt=dt.rawValues,Kt=dt.fieldNames,Ht=dt.virtual,tn=dt.direction,$n=dt.listHeight,Vt=dt.listItemHeight,un=dt.optionRender,rn="".concat(xt,"-item"),fn=(0,ut.Z)(function(){return $e},[Et,$e],function(sn,Dt){return Dt[0]&&sn[1]!==Dt[1]}),Yt=x.useRef(null),Bt=x.useMemo(function(){return kt&&ie(Re)&&(Rt==null?void 0:Rt.size)>=Re},[kt,Re,Rt==null?void 0:Rt.size]),Wt=function(Dt){Dt.preventDefault()},Jt=function(Dt){var bt;(bt=Yt.current)===null||bt===void 0||bt.scrollTo(typeof Dt=="number"?{index:Dt}:Dt)},an=x.useCallback(function(sn){return jt==="combobox"?!1:Rt.has(sn)},[jt,(0,fe.Z)(Rt).toString(),Rt.size]),cn=function(Dt){for(var bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,$t=fn.length,Qt=0;Qt<$t;Qt+=1){var bn=(Dt+Qt*bt+$t)%$t,Kn=fn[bn]||{},tr=Kn.group,Xt=Kn.data;if(!tr&&!(Xt!=null&&Xt.disabled)&&(an(Xt.value)||!Bt))return bn}return-1},En=x.useState(function(){return cn(0)}),mn=(0,$.Z)(En,2),on=mn[0],jn=mn[1],Qn=function(Dt){var bt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;jn(Dt);var $t={source:bt?"keyboard":"mouse"},Qt=fn[Dt];if(!Qt){Qe(null,-1,$t);return}Qe(Qt.value,Dt,$t)};(0,x.useEffect)(function(){Qn(Xe!==!1?cn(0):-1)},[fn.length,At]);var or=x.useCallback(function(sn){return jt==="combobox"?String(sn).toLowerCase()===At.toLowerCase():Rt.has(sn)},[jt,At,(0,fe.Z)(Rt).toString(),Rt.size]);(0,x.useEffect)(function(){var sn=setTimeout(function(){if(!kt&&Et&&Rt.size===1){var bt=Array.from(Rt)[0],$t=fn.findIndex(function(Qt){var bn=Qt.data;return At?String(bn.value).startsWith(At):bn.value===bt});$t!==-1&&(Qn($t),Jt($t))}});if(Et){var Dt;(Dt=Yt.current)===null||Dt===void 0||Dt.scrollTo(void 0)}return function(){return clearTimeout(sn)}},[Et,At]);var Vn=function(Dt){Dt!==void 0&&gt(Dt,{selected:!Rt.has(Dt)}),kt||Pt(!1)};if(x.useImperativeHandle(St,function(){return{onKeyDown:function(Dt){var bt=Dt.which,$t=Dt.ctrlKey;switch(bt){case te.Z.N:case te.Z.P:case te.Z.UP:case te.Z.DOWN:{var Qt=0;if(bt===te.Z.UP?Qt=-1:bt===te.Z.DOWN?Qt=1:zt()&&$t&&(bt===te.Z.N?Qt=1:bt===te.Z.P&&(Qt=-1)),Qt!==0){var bn=cn(on+Qt,Qt);Jt(bn),Qn(bn,!0)}break}case te.Z.TAB:case te.Z.ENTER:{var Kn,tr=fn[on];tr&&!(tr!=null&&(Kn=tr.data)!==null&&Kn!==void 0&&Kn.disabled)&&!Bt?Vn(tr.value):Vn(void 0),Et&&Dt.preventDefault();break}case te.Z.ESC:Pt(!1),Et&&Dt.stopPropagation()}},onKeyUp:function(){},scrollTo:function(Dt){Jt(Dt)}}}),fn.length===0)return x.createElement("div",{role:"listbox",id:"".concat(Tt,"_list"),className:"".concat(rn,"-empty"),onMouseDown:Wt},Gt);var ir=Object.keys(Kt).map(function(sn){return Kt[sn]}),Jn=function(Dt){return Dt.label};function _r(sn,Dt){var bt=sn.group;return{role:bt?"presentation":"option",id:"".concat(Tt,"_list_").concat(Dt)}}var ur=function(Dt){var bt=fn[Dt];if(!bt)return null;var $t=bt.data||{},Qt=$t.value,bn=bt.group,Kn=(0,ce.Z)($t,!0),tr=Jn(bt);return bt?x.createElement("div",(0,L.Z)({"aria-label":typeof tr=="string"&&!bn?tr:null},Kn,{key:Dt},_r(bt,Dt),{"aria-selected":or(Qt)}),Qt):null},On={role:"listbox",id:"".concat(Tt,"_list")};return x.createElement(x.Fragment,null,Ht&&x.createElement("div",(0,L.Z)({},On,{style:{height:0,width:0,overflow:"hidden"}}),ur(on-1),ur(on),ur(on+1)),x.createElement(Ct.Z,{itemKey:"key",ref:Yt,data:fn,height:$n,itemHeight:Vt,fullHeight:!1,onMouseDown:Wt,onScroll:Ft,virtual:Ht,direction:tn,innerProps:Ht?null:On},function(sn,Dt){var bt=sn.group,$t=sn.groupOption,Qt=sn.data,bn=sn.label,Kn=sn.value,tr=Qt.key;if(bt){var Xt,Tn=(Xt=Qt.title)!==null&&Xt!==void 0?Xt:Ut(bn)?bn.toString():void 0;return x.createElement("div",{className:h()(rn,"".concat(rn,"-group"),Qt.className),title:Tn},bn!==void 0?bn:tr)}var Bn=Qt.disabled,Zn=Qt.title,pr=Qt.children,An=Qt.style,Yn=Qt.className,Xn=(0,p.Z)(Qt,ct),cr=(0,it.Z)(Xn,ir),sr=an(Kn),gr=Bn||!sr&&Bt,fr="".concat(rn,"-option"),Ar=h()(rn,fr,Yn,(0,Te.Z)((0,Te.Z)((0,Te.Z)((0,Te.Z)({},"".concat(fr,"-grouped"),$t),"".concat(fr,"-active"),on===Dt&&!gr),"".concat(fr,"-disabled"),gr),"".concat(fr,"-selected"),sr)),Sr=Jn(sn),Or=!pt||typeof pt=="function"||sr,br=typeof Sr=="number"?Sr:Sr||Kn,yr=Ut(br)?br.toString():void 0;return Zn!==void 0&&(yr=Zn),x.createElement("div",(0,L.Z)({},(0,ce.Z)(cr),Ht?{}:_r(sn,Dt),{"aria-selected":or(Kn),className:Ar,title:yr,onMouseMove:function(){on===Dt||gr||Qn(Dt)},onClick:function(){gr||Vn(Kn)},style:An}),x.createElement("div",{className:"".concat(fr,"-content")},typeof un=="function"?un(sn,{index:Dt}):br),x.isValidElement(pt)||sr,Or&&x.createElement(Z,{className:"".concat(rn,"-option-state"),customizeIcon:pt,customizeIconProps:{value:Kn,disabled:gr,isSelected:sr}},sr?"\u2713":null))}))},Se=x.forwardRef(Ne),Ie=Se,U=function(Me,ke){var St=x.useRef({values:new Map,options:new Map}),st=x.useMemo(function(){var Tt=St.current,Et=Tt.values,kt=Tt.options,jt=Me.map(function(Gt){if(Gt.label===void 0){var Ft;return(0,ue.Z)((0,ue.Z)({},Gt),{},{label:(Ft=Et.get(Gt.value))===null||Ft===void 0?void 0:Ft.label})}return Gt}),At=new Map,Pt=new Map;return jt.forEach(function(Gt){At.set(Gt.value,Gt),Pt.set(Gt.value,ke.get(Gt.value)||kt.get(Gt.value))}),St.current.values=At,St.current.options=Pt,jt},[Me,ke]),xt=x.useCallback(function(Tt){return ke.get(Tt)||St.current.options.get(Tt)},[ke]);return[st,xt]};function z(Me,ke){return Q(Me).join("").toUpperCase().includes(ke)}var pe=function(Me,ke,St,st,xt){return x.useMemo(function(){if(!St||st===!1)return Me;var Tt=ke.options,Et=ke.label,kt=ke.value,jt=[],At=typeof st=="function",Pt=St.toUpperCase(),Gt=At?st:function(dt,Re){return xt?z(Re[xt],Pt):Re[Tt]?z(Re[Et!=="children"?Et:"label"],Pt):z(Re[kt],Pt)},Ft=At?function(dt){return Y(dt)}:function(dt){return dt};return Me.forEach(function(dt){if(dt[Tt]){var Re=Gt(St,Ft(dt));if(Re)jt.push(dt);else{var $e=dt[Tt].filter(function(Qe){return Gt(St,Ft(Qe))});$e.length&&jt.push((0,ue.Z)((0,ue.Z)({},dt),{},(0,Te.Z)({},Tt,$e)))}return}Gt(St,Ft(dt))&&jt.push(dt)}),jt},[Me,st,xt,St,ke])},de=w(6551),ve=w(11592),je=["children","value"],tt=["children"];function yt(Me){var ke=Me,St=ke.key,st=ke.props,xt=st.children,Tt=st.value,Et=(0,p.Z)(st,je);return(0,ue.Z)({key:St,value:Tt!==void 0?Tt:St,children:xt},Et)}function It(Me){var ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(0,ve.Z)(Me).map(function(St,st){if(!x.isValidElement(St)||!St.type)return null;var xt=St,Tt=xt.type.isSelectOptGroup,Et=xt.key,kt=xt.props,jt=kt.children,At=(0,p.Z)(kt,tt);return ke||!Tt?yt(St):(0,ue.Z)((0,ue.Z)({key:"__RC_SELECT_GRP__".concat(Et===null?st:Et,"__"),label:Et},At),{},{options:It(jt)})}).filter(function(St){return St})}var qt=function(ke,St,st,xt,Tt){return x.useMemo(function(){var Et=ke,kt=!ke;kt&&(Et=It(St));var jt=new Map,At=new Map,Pt=function(dt,Re,$e){$e&&typeof $e=="string"&&dt.set(Re[$e],Re)},Gt=function Ft(dt){for(var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,$e=0;$e<dt.length;$e+=1){var Qe=dt[$e];!Qe[st.options]||Re?(jt.set(Qe[st.value],Qe),Pt(At,Qe,st.label),Pt(At,Qe,xt),Pt(At,Qe,Tt)):Ft(Qe[st.options],!0)}};return Gt(Et),{options:Et,valueOptions:jt,labelOptions:At}},[ke,St,st,xt,Tt])},gn=qt;function en(Me){var ke=x.useRef();ke.current=Me;var St=x.useCallback(function(){return ke.current.apply(ke,arguments)},[]);return St}function nn(Me){var ke=Me.mode,St=Me.options,st=Me.children,xt=Me.backfill,Tt=Me.allowClear,Et=Me.placeholder,kt=Me.getInputElement,jt=Me.showSearch,At=Me.onSearch,Pt=Me.defaultOpen,Gt=Me.autoFocus,Ft=Me.labelInValue,dt=Me.value,Re=Me.inputValue,$e=Me.optionLabelProp,Qe=isMultiple(ke),Xe=jt!==void 0?jt:Qe||ke==="combobox",gt=St||convertChildrenToData(st);if(warning(ke!=="tags"||gt.every(function(Ht){return!Ht.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),ke==="tags"||ke==="combobox"){var pt=gt.some(function(Ht){return Ht.options?Ht.options.some(function(tn){return typeof("value"in tn?tn.value:tn.key)=="number"}):typeof("value"in Ht?Ht.value:Ht.key)=="number"});warning(!pt,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(warning(ke!=="combobox"||!$e,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),warning(ke==="combobox"||!xt,"`backfill` only works with `combobox` mode."),warning(ke==="combobox"||!kt,"`getInputElement` only work with `combobox` mode."),noteOnce(ke!=="combobox"||!kt||!Tt||!Et,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),At&&!Xe&&ke!=="combobox"&&ke!=="tags"&&warning(!1,"`onSearch` should work with `showSearch` instead of use alone."),noteOnce(!Pt||Gt,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),dt!=null){var Rt=toArray(dt);warning(!Ft||Rt.every(function(Ht){return _typeof(Ht)==="object"&&("key"in Ht||"value"in Ht)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),warning(!Qe||Array.isArray(dt),"`value` should be array when `mode` is `multiple` or `tags`")}if(st){var Kt=null;toNodeArray(st).some(function(Ht){if(!React.isValidElement(Ht)||!Ht.type)return!1;var tn=Ht,$n=tn.type;if($n.isSelectOption)return!1;if($n.isSelectOptGroup){var Vt=toNodeArray(Ht.props.children).every(function(un){return!React.isValidElement(un)||!Ht.type||un.type.isSelectOption?!0:(Kt=un.type,!1)});return!Vt}return Kt=$n,!0}),Kt&&warning(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Kt.displayName||Kt.name||Kt,"`.")),warning(Re===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}function wn(Me,ke){if(Me){var St=function st(xt){for(var Tt=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Et=0;Et<xt.length;Et++){var kt=xt[Et];if(kt[ke==null?void 0:ke.value]===null)return warning(!1,"`value` in Select options should not be `null`."),!0;if(!Tt&&Array.isArray(kt[ke==null?void 0:ke.options])&&st(kt[ke==null?void 0:ke.options],!0))break}};St(Me)}}var zn=null,kn=["id","mode","prefixCls","backfill","fieldNames","inputValue","searchValue","onSearch","autoClearSearchValue","onSelect","onDeselect","dropdownMatchSelectWidth","filterOption","filterSort","optionFilterProp","optionLabelProp","options","optionRender","children","defaultActiveFirstOption","menuItemSelectedIcon","virtual","direction","listHeight","listItemHeight","labelRender","value","defaultValue","labelInValue","onChange","maxCount"],Nn=["inputValue"];function Lt(Me){return!Me||(0,ge.Z)(Me)!=="object"}var ht=x.forwardRef(function(Me,ke){var St=Me.id,st=Me.mode,xt=Me.prefixCls,Tt=xt===void 0?"rc-select":xt,Et=Me.backfill,kt=Me.fieldNames,jt=Me.inputValue,At=Me.searchValue,Pt=Me.onSearch,Gt=Me.autoClearSearchValue,Ft=Gt===void 0?!0:Gt,dt=Me.onSelect,Re=Me.onDeselect,$e=Me.dropdownMatchSelectWidth,Qe=$e===void 0?!0:$e,Xe=Me.filterOption,gt=Me.filterSort,pt=Me.optionFilterProp,Rt=Me.optionLabelProp,Kt=Me.options,Ht=Me.optionRender,tn=Me.children,$n=Me.defaultActiveFirstOption,Vt=Me.menuItemSelectedIcon,un=Me.virtual,rn=Me.direction,fn=Me.listHeight,Yt=fn===void 0?200:fn,Bt=Me.listItemHeight,Wt=Bt===void 0?20:Bt,Jt=Me.labelRender,an=Me.value,cn=Me.defaultValue,En=Me.labelInValue,mn=Me.onChange,on=Me.maxCount,jn=(0,p.Z)(Me,kn),Qn=(0,de.ZP)(St),or=Ce(st),Vn=!!(!Kt&&tn),ir=x.useMemo(function(){return Xe===void 0&&st==="combobox"?!1:Xe},[Xe,st]),Jn=x.useMemo(function(){return be(kt,Vn)},[JSON.stringify(kt),Vn]),_r=(0,le.Z)("",{value:At!==void 0?At:jt,postState:function(Gn){return Gn||""}}),ur=(0,$.Z)(_r,2),On=ur[0],sn=ur[1],Dt=gn(Kt,tn,Jn,pt,Rt),bt=Dt.valueOptions,$t=Dt.labelOptions,Qt=Dt.options,bn=x.useCallback(function(Sn){var Gn=Q(Sn);return Gn.map(function(Dn){var Un,lr,Er,jr,dn;if(Lt(Dn))Un=Dn;else{var Ln;Er=Dn.key,lr=Dn.label,Un=(Ln=Dn.value)!==null&&Ln!==void 0?Ln:Er}var qn=bt.get(Un);if(qn){var Wn;if(lr===void 0&&(lr=qn==null?void 0:qn[Rt||Jn.label]),Er===void 0&&(Er=(Wn=qn==null?void 0:qn.key)!==null&&Wn!==void 0?Wn:Un),jr=qn==null?void 0:qn.disabled,dn=qn==null?void 0:qn.title,0)var er}return{label:lr,value:Un,key:Er,disabled:jr,title:dn}})},[Jn,Rt,bt]),Kn=(0,le.Z)(cn,{value:an}),tr=(0,$.Z)(Kn,2),Xt=tr[0],Tn=tr[1],Bn=x.useMemo(function(){var Sn,Gn=or&&Xt===null?[]:Xt,Dn=bn(Gn);return st==="combobox"&&P((Sn=Dn[0])===null||Sn===void 0?void 0:Sn.value)?[]:Dn},[Xt,bn,st,or]),Zn=U(Bn,bt),pr=(0,$.Z)(Zn,2),An=pr[0],Yn=pr[1],Xn=x.useMemo(function(){if(!st&&An.length===1){var Sn=An[0];if(Sn.value===null&&(Sn.label===null||Sn.label===void 0))return[]}return An.map(function(Gn){var Dn;return(0,ue.Z)((0,ue.Z)({},Gn),{},{label:(Dn=typeof Jt=="function"?Jt(Gn):Gn.label)!==null&&Dn!==void 0?Dn:Gn.value})})},[st,An,Jt]),cr=x.useMemo(function(){return new Set(An.map(function(Sn){return Sn.value}))},[An]);x.useEffect(function(){if(st==="combobox"){var Sn,Gn=(Sn=An[0])===null||Sn===void 0?void 0:Sn.value;sn(v(Gn)?String(Gn):"")}},[An]);var sr=en(function(Sn,Gn){var Dn=Gn!=null?Gn:Sn;return(0,Te.Z)((0,Te.Z)({},Jn.value,Sn),Jn.label,Dn)}),gr=x.useMemo(function(){if(st!=="tags")return Qt;var Sn=(0,fe.Z)(Qt),Gn=function(Un){return bt.has(Un)};return(0,fe.Z)(An).sort(function(Dn,Un){return Dn.value<Un.value?-1:1}).forEach(function(Dn){var Un=Dn.value;Gn(Un)||Sn.push(sr(Un,Dn.label))}),Sn},[sr,Qt,bt,An,st]),fr=pe(gr,Jn,On,ir,pt),Ar=x.useMemo(function(){return st!=="tags"||!On||fr.some(function(Sn){return Sn[pt||"value"]===On})||fr.some(function(Sn){return Sn[Jn.value]===On})?fr:[sr(On)].concat((0,fe.Z)(fr))},[sr,pt,st,fr,On,Jn]),Sr=function Sn(Gn){var Dn=(0,fe.Z)(Gn).sort(function(Un,lr){return gt(Un,lr,{searchValue:On})});return Dn.map(function(Un){return Array.isArray(Un.options)?(0,ue.Z)((0,ue.Z)({},Un),{},{options:Un.options.length>0?Sn(Un.options):Un.options}):Un})},Or=x.useMemo(function(){return gt?Sr(Ar):Ar},[Ar,gt,On]),br=x.useMemo(function(){return k(Or,{fieldNames:Jn,childrenAsData:Vn})},[Or,Jn,Vn]),yr=function(Gn){var Dn=bn(Gn);if(Tn(Dn),mn&&(Dn.length!==An.length||Dn.some(function(Er,jr){var dn;return((dn=An[jr])===null||dn===void 0?void 0:dn.value)!==(Er==null?void 0:Er.value)}))){var Un=En?Dn:Dn.map(function(Er){return Er.value}),lr=Dn.map(function(Er){return Y(Yn(Er.value))});mn(or?Un:Un[0],or?lr:lr[0])}},Vr=x.useState(null),In=(0,$.Z)(Vr,2),zr=In[0],Dr=In[1],ii=x.useState(0),si=(0,$.Z)(ii,2),Xr=si[0],ui=si[1],Wr=$n!==void 0?$n:st!=="combobox",mr=x.useCallback(function(Sn,Gn){var Dn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},Un=Dn.source,lr=Un===void 0?"keyboard":Un;ui(Gn),Et&&st==="combobox"&&Sn!==null&&lr==="keyboard"&&Dr(String(Sn))},[Et,st]),Lr=function(Gn,Dn,Un){var lr=function(){var Jr,$r=Yn(Gn);return[En?{label:$r==null?void 0:$r[Jn.label],value:Gn,key:(Jr=$r==null?void 0:$r.key)!==null&&Jr!==void 0?Jr:Gn}:Gn,Y($r)]};if(Dn&&dt){var Er=lr(),jr=(0,$.Z)(Er,2),dn=jr[0],Ln=jr[1];dt(dn,Ln)}else if(!Dn&&Re&&Un!=="clear"){var qn=lr(),Wn=(0,$.Z)(qn,2),er=Wn[0],Qr=Wn[1];Re(er,Qr)}},Br=en(function(Sn,Gn){var Dn,Un=or?Gn.selected:!0;Un?Dn=or?[].concat((0,fe.Z)(An),[Sn]):[Sn]:Dn=An.filter(function(lr){return lr.value!==Sn}),yr(Dn),Lr(Sn,Un),st==="combobox"?Dr(""):(!Ce||Ft)&&(sn(""),Dr(""))}),Hr=function(Gn,Dn){yr(Gn);var Un=Dn.type,lr=Dn.values;(Un==="remove"||Un==="clear")&&lr.forEach(function(Er){Lr(Er.value,!1,Un)})},ar=function(Gn,Dn){if(sn(Gn),Dr(null),Dn.source==="submit"){var Un=(Gn||"").trim();if(Un){var lr=Array.from(new Set([].concat((0,fe.Z)(cr),[Un])));yr(lr),Lr(Un,!0),sn("")}return}Dn.source!=="blur"&&(st==="combobox"&&yr(Gn),Pt==null||Pt(Gn))},Rr=function(Gn){var Dn=Gn;st!=="tags"&&(Dn=Gn.map(function(lr){var Er=$t.get(lr);return Er==null?void 0:Er.value}).filter(function(lr){return lr!==void 0}));var Un=Array.from(new Set([].concat((0,fe.Z)(cr),(0,fe.Z)(Dn))));yr(Un),Un.forEach(function(lr){Lr(lr,!0)})},kr=x.useMemo(function(){var Sn=un!==!1&&Qe!==!1;return(0,ue.Z)((0,ue.Z)({},Dt),{},{flattenOptions:br,onActiveValue:mr,defaultActiveFirstOption:Wr,onSelect:Br,menuItemSelectedIcon:Vt,rawValues:cr,fieldNames:Jn,virtual:Sn,direction:rn,listHeight:Yt,listItemHeight:Wt,childrenAsData:Vn,maxCount:on,optionRender:Ht})},[on,Dt,br,mr,Wr,Br,Vt,cr,Jn,un,Qe,rn,Yt,Wt,Vn,Ht]);return x.createElement(ee.Provider,{value:kr},x.createElement(oe,(0,L.Z)({},jn,{id:Qn,prefixCls:Tt,ref:ke,omitDomProps:Nn,mode:st,displayValues:Xn,onDisplayValuesChange:Hr,direction:rn,searchValue:On,onSearch:ar,autoClearSearchValue:Ft,onSearchSplit:Rr,dropdownMatchSelectWidth:Qe,OptionList:Ie,emptyOptions:!br.length,activeValue:zr,activeDescendantId:"".concat(Qn,"_list_").concat(Xr)})))}),Zt=ht;Zt.Option=lt,Zt.OptGroup=Ue;var yn=Zt,Hn=yn},22711:function(_n,_t,w){"use strict";w.r(_t),w.d(_t,{ResizableTextArea:function(){return Ve},default:function(){return H}});var L=w(54476),fe=w(20068),Te=w(33885),ue=w(94480),$=w(42978),p=w(75931),ge=w(92310),le=w.n(ge),l=w(36901),x=w(66003),A=w(30292),h=w(18929),m=w(59301),y=w(76190),S=w(29301),F=w(34280),Z=w(16089),W=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important;
pointer-events: none !important;
`,I=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"],N={},T;function D(Q){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=Q.getAttribute("id")||Q.getAttribute("data-reactid")||Q.getAttribute("name");if(j&&N[_])return N[_];var v=window.getComputedStyle(Q),P=v.getPropertyValue("box-sizing")||v.getPropertyValue("-moz-box-sizing")||v.getPropertyValue("-webkit-box-sizing"),re=parseFloat(v.getPropertyValue("padding-bottom"))+parseFloat(v.getPropertyValue("padding-top")),Oe=parseFloat(v.getPropertyValue("border-bottom-width"))+parseFloat(v.getPropertyValue("border-top-width")),Ze=I.map(function(qe){return"".concat(qe,":").concat(v.getPropertyValue(qe))}).join(";"),Ye={sizingStyle:Ze,paddingSize:re,borderSize:Oe,boxSizing:P};return j&&_&&(N[_]=Ye),Ye}function q(Q){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,v=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;T||(T=document.createElement("textarea"),T.setAttribute("tab-index","-1"),T.setAttribute("aria-hidden","true"),T.setAttribute("name","hiddenTextarea"),document.body.appendChild(T)),Q.getAttribute("wrap")?T.setAttribute("wrap",Q.getAttribute("wrap")):T.removeAttribute("wrap");var P=D(Q,j),re=P.paddingSize,Oe=P.borderSize,Ze=P.boxSizing,Ye=P.sizingStyle;T.setAttribute("style","".concat(Ye,";").concat(W)),T.value=Q.value||Q.placeholder||"";var qe=void 0,ft=void 0,vt,Ae=T.scrollHeight;if(Ze==="border-box"?Ae+=Oe:Ze==="content-box"&&(Ae-=re),_!==null||v!==null){T.value=" ";var wt=T.scrollHeight-re;_!==null&&(qe=wt*_,Ze==="border-box"&&(qe=qe+re+Oe),Ae=Math.max(qe,Ae)),v!==null&&(ft=wt*v,Ze==="border-box"&&(ft=ft+re+Oe),vt=Ae>ft?"":"hidden",Ae=Math.min(ft,Ae))}var rt={height:Ae,overflowY:vt,resize:"none"};return qe&&(rt.minHeight=qe),ft&&(rt.maxHeight=ft),rt}var te=["prefixCls","defaultValue","value","autoSize","onResize","className","style","disabled","onChange","onInternalAutoSize"],X=0,ce=1,we=2,Pe=m.forwardRef(function(Q,j){var _=Q,v=_.prefixCls,P=_.defaultValue,re=_.value,Oe=_.autoSize,Ze=_.onResize,Ye=_.className,qe=_.style,ft=_.disabled,vt=_.onChange,Ae=_.onInternalAutoSize,wt=(0,p.Z)(_,te),rt=(0,h.Z)(P,{value:re,postState:function(lt){return lt!=null?lt:""}}),Mt=(0,$.Z)(rt,2),et=Mt[0],ze=Mt[1],ye=function(lt){ze(lt.target.value),vt==null||vt(lt)},me=m.useRef();m.useImperativeHandle(j,function(){return{textArea:me.current}});var B=m.useMemo(function(){return Oe&&(0,y.Z)(Oe)==="object"?[Oe.minRows,Oe.maxRows]:[]},[Oe]),xe=(0,$.Z)(B,2),Le=xe[0],K=xe[1],R=!!Oe,ie=function(){try{if(document.activeElement===me.current){var lt=me.current,ut=lt.selectionStart,it=lt.selectionEnd,Ct=lt.scrollTop;me.current.setSelectionRange(ut,it),me.current.scrollTop=Ct}}catch(zt){}},be=m.useState(we),k=(0,$.Z)(be,2),Y=k[0],J=k[1],se=m.useState(),ee=(0,$.Z)(se,2),ne=ee[0],Ee=ee[1],Be=function(){J(X)};(0,F.Z)(function(){R&&Be()},[re,Le,K,R]),(0,F.Z)(function(){if(Y===X)J(ce);else if(Y===ce){var Fe=q(me.current,!1,Le,K);J(we),Ee(Fe)}else ie()},[Y]);var Ce=m.useRef(),De=function(){Z.Z.cancel(Ce.current)},oe=function(lt){Y===we&&(Ze==null||Ze(lt),Oe&&(De(),Ce.current=(0,Z.Z)(function(){Be()})))};m.useEffect(function(){return De},[]);var Ge=R?ne:null,Ue=(0,Te.Z)((0,Te.Z)({},qe),Ge);return(Y===X||Y===ce)&&(Ue.overflowY="hidden",Ue.overflowX="hidden"),m.createElement(S.Z,{onResize:oe,disabled:!(Oe||Ze)},m.createElement("textarea",(0,L.Z)({},wt,{ref:me,style:Ue,className:le()(v,Ye,(0,fe.Z)({},"".concat(v,"-disabled"),ft)),disabled:ft,value:et,onChange:ye})))}),Ve=Pe,V=["defaultValue","value","onFocus","onBlur","onChange","allowClear","maxLength","onCompositionStart","onCompositionEnd","suffix","prefixCls","showCount","count","className","style","disabled","hidden","classNames","styles","onResize","onClear","onPressEnter","readOnly","autoSize","onKeyDown"],C=m.forwardRef(function(Q,j){var _,v=Q.defaultValue,P=Q.value,re=Q.onFocus,Oe=Q.onBlur,Ze=Q.onChange,Ye=Q.allowClear,qe=Q.maxLength,ft=Q.onCompositionStart,vt=Q.onCompositionEnd,Ae=Q.suffix,wt=Q.prefixCls,rt=wt===void 0?"rc-textarea":wt,Mt=Q.showCount,et=Q.count,ze=Q.className,ye=Q.style,me=Q.disabled,B=Q.hidden,xe=Q.classNames,Le=Q.styles,K=Q.onResize,R=Q.onClear,ie=Q.onPressEnter,be=Q.readOnly,k=Q.autoSize,Y=Q.onKeyDown,J=(0,p.Z)(Q,V),se=(0,h.Z)(v,{value:P,defaultValue:v}),ee=(0,$.Z)(se,2),ne=ee[0],Ee=ee[1],Be=ne==null?"":String(ne),Ce=m.useState(!1),De=(0,$.Z)(Ce,2),oe=De[0],Ge=De[1],Ue=m.useRef(!1),Fe=m.useState(null),lt=(0,$.Z)(Fe,2),ut=lt[0],it=lt[1],Ct=(0,m.useRef)(null),zt=(0,m.useRef)(null),ct=function(){var Zt;return(Zt=zt.current)===null||Zt===void 0?void 0:Zt.textArea},Ut=function(){ct().focus()};(0,m.useImperativeHandle)(j,function(){var ht;return{resizableTextArea:zt.current,focus:Ut,blur:function(){ct().blur()},nativeElement:((ht=Ct.current)===null||ht===void 0?void 0:ht.nativeElement)||ct()}}),(0,m.useEffect)(function(){Ge(function(ht){return!me&&ht})},[me]);var Ne=m.useState(null),Se=(0,$.Z)(Ne,2),Ie=Se[0],U=Se[1];m.useEffect(function(){if(Ie){var ht;(ht=ct()).setSelectionRange.apply(ht,(0,ue.Z)(Ie))}},[Ie]);var z=(0,x.Z)(et,Mt),pe=(_=z.max)!==null&&_!==void 0?_:qe,de=Number(pe)>0,ve=z.strategy(Be),je=!!pe&&ve>pe,tt=function(Zt,yn){var Hn=yn;!Ue.current&&z.exceedFormatter&&z.max&&z.strategy(yn)>z.max&&(Hn=z.exceedFormatter(yn,{max:z.max}),yn!==Hn&&U([ct().selectionStart||0,ct().selectionEnd||0])),Ee(Hn),(0,A.rJ)(Zt.currentTarget,Zt,Ze,Hn)},yt=function(Zt){Ue.current=!0,ft==null||ft(Zt)},It=function(Zt){Ue.current=!1,tt(Zt,Zt.currentTarget.value),vt==null||vt(Zt)},qt=function(Zt){tt(Zt,Zt.target.value)},gn=function(Zt){Zt.key==="Enter"&&ie&&ie(Zt),Y==null||Y(Zt)},en=function(Zt){Ge(!0),re==null||re(Zt)},nn=function(Zt){Ge(!1),Oe==null||Oe(Zt)},wn=function(Zt){Ee(""),Ut(),(0,A.rJ)(ct(),Zt,Ze)},zn=Ae,kn;z.show&&(z.showFormatter?kn=z.showFormatter({value:Be,count:ve,maxLength:pe}):kn="".concat(ve).concat(de?" / ".concat(pe):""),zn=m.createElement(m.Fragment,null,zn,m.createElement("span",{className:le()("".concat(rt,"-data-count"),xe==null?void 0:xe.count),style:Le==null?void 0:Le.count},kn)));var Nn=function(Zt){var yn;K==null||K(Zt),(yn=ct())!==null&&yn!==void 0&&yn.style.height&&it(!0)},Lt=!k&&!Mt&&!Ye;return m.createElement(l.BaseInput,{ref:Ct,value:Be,allowClear:Ye,handleReset:wn,suffix:zn,prefixCls:rt,classNames:(0,Te.Z)((0,Te.Z)({},xe),{},{affixWrapper:le()(xe==null?void 0:xe.affixWrapper,(0,fe.Z)((0,fe.Z)({},"".concat(rt,"-show-count"),Mt),"".concat(rt,"-textarea-allow-clear"),Ye))}),disabled:me,focused:oe,className:le()(ze,je&&"".concat(rt,"-out-of-range")),style:(0,Te.Z)((0,Te.Z)({},ye),ut&&!Lt?{height:"auto"}:{}),dataAttrs:{affixWrapper:{"data-count":typeof kn=="string"?kn:void 0}},hidden:B,readOnly:be,onClear:R},m.createElement(Ve,(0,L.Z)({},J,{autoSize:k,maxLength:qe,onKeyDown:gn,onChange:qt,onFocus:en,onBlur:nn,onCompositionStart:yt,onCompositionEnd:It,className:le()(xe==null?void 0:xe.textarea),style:(0,Te.Z)((0,Te.Z)({},Le==null?void 0:Le.textarea),{},{resize:ye==null?void 0:ye.resize}),disabled:me,prefixCls:rt,onResize:Nn,ref:zt,readOnly:be})))}),G=C,H=G},29125:function(_n,_t,w){"use strict";w.d(_t,{G:function(){return ue},Z:function(){return W}});var L=w(92310),fe=w.n(L),Te=w(59301);function ue(I){var N=I.children,T=I.prefixCls,D=I.id,q=I.overlayInnerStyle,te=I.bodyClassName,X=I.className,ce=I.style;return Te.createElement("div",{className:fe()("".concat(T,"-content"),X),style:ce},Te.createElement("div",{className:fe()("".concat(T,"-inner"),te),id:D,role:"tooltip",style:q},typeof N=="function"?N():N))}var $=w(54476),p=w(33885),ge=w(75931),le=w(65030),l={shiftX:64,adjustY:1},x={adjustX:1,shiftY:!0},A=[0,0],h={left:{points:["cr","cl"],overflow:x,offset:[-4,0],targetOffset:A},right:{points:["cl","cr"],overflow:x,offset:[4,0],targetOffset:A},top:{points:["bc","tc"],overflow:l,offset:[0,-4],targetOffset:A},bottom:{points:["tc","bc"],overflow:l,offset:[0,4],targetOffset:A},topLeft:{points:["bl","tl"],overflow:l,offset:[0,-4],targetOffset:A},leftTop:{points:["tr","tl"],overflow:x,offset:[-4,0],targetOffset:A},topRight:{points:["br","tr"],overflow:l,offset:[0,-4],targetOffset:A},rightTop:{points:["tl","tr"],overflow:x,offset:[4,0],targetOffset:A},bottomRight:{points:["tr","br"],overflow:l,offset:[0,4],targetOffset:A},rightBottom:{points:["bl","br"],overflow:x,offset:[4,0],targetOffset:A},bottomLeft:{points:["tl","bl"],overflow:l,offset:[0,4],targetOffset:A},leftBottom:{points:["br","bl"],overflow:x,offset:[-4,0],targetOffset:A}},m=null,y=w(80402),S=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],F=function(N,T){var D=N.overlayClassName,q=N.trigger,te=q===void 0?["hover"]:q,X=N.mouseEnterDelay,ce=X===void 0?0:X,we=N.mouseLeaveDelay,Pe=we===void 0?.1:we,Ve=N.overlayStyle,V=N.prefixCls,C=V===void 0?"rc-tooltip":V,G=N.children,H=N.onVisibleChange,Q=N.afterVisibleChange,j=N.transitionName,_=N.animation,v=N.motion,P=N.placement,re=P===void 0?"right":P,Oe=N.align,Ze=Oe===void 0?{}:Oe,Ye=N.destroyTooltipOnHide,qe=Ye===void 0?!1:Ye,ft=N.defaultVisible,vt=N.getTooltipContainer,Ae=N.overlayInnerStyle,wt=N.arrowContent,rt=N.overlay,Mt=N.id,et=N.showArrow,ze=et===void 0?!0:et,ye=N.classNames,me=N.styles,B=(0,ge.Z)(N,S),xe=(0,y.Z)(Mt),Le=(0,Te.useRef)(null);(0,Te.useImperativeHandle)(T,function(){return Le.current});var K=(0,p.Z)({},B);"visible"in N&&(K.popupVisible=N.visible);var R=function(){return Te.createElement(ue,{key:"content",prefixCls:C,id:xe,bodyClassName:ye==null?void 0:ye.body,overlayInnerStyle:(0,p.Z)((0,p.Z)({},Ae),me==null?void 0:me.body)},rt)},ie=function(){var k=Te.Children.only(G),Y=(k==null?void 0:k.props)||{},J=(0,p.Z)((0,p.Z)({},Y),{},{"aria-describedby":rt?xe:null});return Te.cloneElement(G,J)};return Te.createElement(le.Z,(0,$.Z)({popupClassName:fe()(D,ye==null?void 0:ye.root),prefixCls:C,popup:R,action:te,builtinPlacements:h,popupPlacement:re,ref:Le,popupAlign:Ze,getPopupContainer:vt,onPopupVisibleChange:H,afterPopupVisibleChange:Q,popupTransitionName:j,popupAnimation:_,popupMotion:v,defaultPopupVisible:ft,autoDestroy:qe,mouseLeaveDelay:Pe,popupStyle:(0,p.Z)((0,p.Z)({},Ve),me==null?void 0:me.root),mouseEnterDelay:ce,arrow:ze},K),ie())},Z=(0,Te.forwardRef)(F),W=Z},9940:function(_n,_t,w){"use strict";w.d(_t,{Qw:function(){return Mt},FJ:function(){return ze},hT:function(){return et},OF:function(){return T},ZP:function(){return be}});var L=w(54476),fe=w(94480),Te=w(33885),ue=w(42978),$=w(75931),p=w(76190),ge=w(37463),le=w(6551),l=w(34643),x=w(18929),A=w(48736),h=w(59301),m=function(k){var Y=h.useRef({valueLabels:new Map});return h.useMemo(function(){var J=Y.current.valueLabels,se=new Map,ee=k.map(function(ne){var Ee=ne.value,Be=ne.label,Ce=Be!=null?Be:J.get(Ee);return se.set(Ee,Ce),(0,Te.Z)((0,Te.Z)({},ne),{},{label:Ce})});return Y.current.valueLabels=se,[ee]},[k])},y=function(Y,J,se,ee){return h.useMemo(function(){var ne=function(Fe){return Fe.map(function(lt){var ut=lt.value;return ut})},Ee=ne(Y),Be=ne(J),Ce=Ee.filter(function(Ue){return!ee[Ue]}),De=Ee,oe=Be;if(se){var Ge=(0,l.S)(Ee,!0,ee);De=Ge.checkedKeys,oe=Ge.halfCheckedKeys}return[Array.from(new Set([].concat((0,fe.Z)(Ce),(0,fe.Z)(De)))),oe]},[Y,J,se,ee])},S=y,F=w(34061),Z=function(k,Y){return h.useMemo(function(){var J=(0,F.I8)(k,{fieldNames:Y,initWrapper:function(ee){return(0,Te.Z)((0,Te.Z)({},ee),{},{valueEntities:new Map})},processEntity:function(ee,ne){var Ee=ee.node[Y.value];if(0)var Be;ne.valueEntities.set(Ee,ee)}});return J},[k,Y])},W=w(20068),I=w(11592),N=function(){return null},T=N,D=["children","value"];function q(k){return(0,I.Z)(k).map(function(Y){if(!h.isValidElement(Y)||!Y.type)return null;var J=Y,se=J.key,ee=J.props,ne=ee.children,Ee=ee.value,Be=(0,$.Z)(ee,D),Ce=(0,Te.Z)({key:se,value:Ee},Be),De=q(ne);return De.length&&(Ce.children=De),Ce}).filter(function(Y){return Y})}function te(k){if(!k)return k;var Y=(0,Te.Z)({},k);return"props"in Y||Object.defineProperty(Y,"props",{get:function(){return(0,A.ZP)(!1,"New `rc-tree-select` not support return node instance as argument anymore. Please consider to remove `props` access."),Y}}),Y}function X(k,Y,J,se,ee,ne){var Ee=null,Be=null;function Ce(){function De(oe){var Ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"0",Ue=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return oe.map(function(Fe,lt){var ut="".concat(Ge,"-").concat(lt),it=Fe[ne.value],Ct=J.includes(it),zt=De(Fe[ne.children]||[],ut,Ct),ct=h.createElement(T,Fe,zt.map(function(Ne){return Ne.node}));if(Y===it&&(Ee=ct),Ct){var Ut={pos:ut,node:ct,children:zt};return Ue||Be.push(Ut),Ut}return null}).filter(function(Fe){return Fe})}Be||(Be=[],De(se),Be.sort(function(oe,Ge){var Ue=oe.node.props.value,Fe=Ge.node.props.value,lt=J.indexOf(Ue),ut=J.indexOf(Fe);return lt-ut}))}Object.defineProperty(k,"triggerNode",{get:function(){return(0,A.ZP)(!1,"`triggerNode` is deprecated. Please consider decoupling data with node."),Ce(),Ee}}),Object.defineProperty(k,"allCheckedNodes",{get:function(){return(0,A.ZP)(!1,"`allCheckedNodes` is deprecated. Please consider decoupling data with node."),Ce(),ee?Be:Be.map(function(oe){var Ge=oe.node;return Ge})}})}var ce=function(Y,J,se){var ee=se.fieldNames,ne=se.treeNodeFilterProp,Ee=se.filterTreeNode,Be=ee.children;return h.useMemo(function(){if(!J||Ee===!1)return Y;var Ce=typeof Ee=="function"?Ee:function(oe,Ge){return String(Ge[ne]).toUpperCase().includes(J.toUpperCase())},De=function oe(Ge){var Ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ge.reduce(function(Fe,lt){var ut=lt[Be],it=Ue||Ce(J,te(lt)),Ct=oe(ut||[],it);return(it||Ct.length)&&Fe.push((0,Te.Z)((0,Te.Z)({},lt),{},(0,W.Z)({isLeaf:void 0},Be,Ct))),Fe},[])};return De(Y)},[Y,J,Be,ne,Ee])},we=ce;function Pe(k){var Y=h.useRef();Y.current=k;var J=h.useCallback(function(){return Y.current.apply(Y,arguments)},[]);return J}function Ve(k,Y){var J=Y.id,se=Y.pId,ee=Y.rootPId,ne=new Map,Ee=[];return k.forEach(function(Be){var Ce=Be[J],De=(0,Te.Z)((0,Te.Z)({},Be),{},{key:Be.key||Ce});ne.set(Ce,De)}),ne.forEach(function(Be){var Ce=Be[se],De=ne.get(Ce);De?(De.children=De.children||[],De.children.push(Be)):(Ce===ee||ee===null)&&Ee.push(Be)}),Ee}function V(k,Y,J){return h.useMemo(function(){if(k){if(J){var se=(0,Te.Z)({id:"id",pId:"pId",rootPId:null},(0,p.Z)(J)==="object"?J:{});return Ve(k,se)}return k}return q(Y)},[Y,J,k])}var C=h.createContext(null),G=C,H=w(19251),Q=w(3741),j=w(10228),_=w(80547),v=h.createContext(null),P=v,re=function(Y){return Array.isArray(Y)?Y:Y!==void 0?[Y]:[]},Oe=function(Y){var J=Y||{},se=J.label,ee=J.value,ne=J.children;return{_title:se?[se]:["title","label"],value:ee||"value",key:ee||"value",children:ne||"children"}},Ze=function(Y){return!Y||Y.disabled||Y.disableCheckbox||Y.checkable===!1},Ye=function(Y,J){var se=[],ee=function ne(Ee){Ee.forEach(function(Be){var Ce=Be[J.children];Ce&&(se.push(Be[J.value]),ne(Ce))})};return ee(Y),se},qe=function(Y){return Y==null},ft=w(70425),vt={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},Ae=function(Y,J){var se=(0,ge.lk)(),ee=se.prefixCls,ne=se.multiple,Ee=se.searchValue,Be=se.toggleOpen,Ce=se.open,De=se.notFoundContent,oe=h.useContext(P),Ge=oe.virtual,Ue=oe.listHeight,Fe=oe.listItemHeight,lt=oe.listItemScrollOffset,ut=oe.treeData,it=oe.fieldNames,Ct=oe.onSelect,zt=oe.dropdownMatchSelectWidth,ct=oe.treeExpandAction,Ut=oe.treeTitleRender,Ne=oe.onPopupScroll,Se=oe.leftMaxCount,Ie=oe.leafCountOnly,U=oe.valueEntities,z=h.useContext(G),pe=z.checkable,de=z.checkedKeys,ve=z.halfCheckedKeys,je=z.treeExpandedKeys,tt=z.treeDefaultExpandAll,yt=z.treeDefaultExpandedKeys,It=z.onTreeExpand,qt=z.treeIcon,gn=z.showTreeIcon,en=z.switcherIcon,nn=z.treeLine,wn=z.treeNodeFilterProp,zn=z.loadData,kn=z.treeLoadedKeys,Nn=z.treeMotion,Lt=z.onTreeLoad,ht=z.keyEntities,Zt=h.useRef(),yn=(0,_.Z)(function(){return ut},[Ce,ut],function(Yt,Bt){return Bt[0]&&Yt[1]!==Bt[1]}),Hn=h.useMemo(function(){return pe?{checked:de,halfChecked:ve}:null},[pe,de,ve]);h.useEffect(function(){if(Ce&&!ne&&de.length){var Yt;(Yt=Zt.current)===null||Yt===void 0||Yt.scrollTo({key:de[0]})}},[Ce]);var Me=function(Bt){Bt.preventDefault()},ke=function(Bt,Wt){var Jt=Wt.node;pe&&Ze(Jt)||(Ct(Jt.key,{selected:!de.includes(Jt.key)}),ne||Be(!1))},St=h.useState(yt),st=(0,ue.Z)(St,2),xt=st[0],Tt=st[1],Et=h.useState(null),kt=(0,ue.Z)(Et,2),jt=kt[0],At=kt[1],Pt=h.useMemo(function(){return je?(0,fe.Z)(je):Ee?jt:xt},[xt,jt,je,Ee]),Gt=function(Bt){Tt(Bt),At(Bt),It&&It(Bt)},Ft=String(Ee).toLowerCase(),dt=function(Bt){return Ft?String(Bt[wn]).toLowerCase().includes(Ft):!1};h.useEffect(function(){Ee&&At(Ye(ut,it))},[Ee]);var Re=h.useState(function(){return new Map}),$e=(0,ue.Z)(Re,2),Qe=$e[0],Xe=$e[1];h.useEffect(function(){Se&&Xe(new Map)},[Se]);function gt(Yt){var Bt=Yt[it.value];if(!Qe.has(Bt)){var Wt=U.get(Bt),Jt=(Wt.children||[]).length===0;if(Jt)Qe.set(Bt,!1);else{var an=Wt.children.filter(function(En){return!En.node.disabled&&!En.node.disableCheckbox&&!de.includes(En.node[it.value])}),cn=an.length;Qe.set(Bt,cn>Se)}}return Qe.get(Bt)}var pt=(0,ft.zX)(function(Yt){var Bt=Yt[it.value];return de.includes(Bt)||Se===null?!1:Se<=0?!0:Ie&&Se?gt(Yt):!1}),Rt=function Yt(Bt){var Wt=(0,H.Z)(Bt),Jt;try{for(Wt.s();!(Jt=Wt.n()).done;){var an=Jt.value;if(!(an.disabled||an.selectable===!1)){if(Ee){if(dt(an))return an}else return an;if(an[it.children]){var cn=Yt(an[it.children]);if(cn)return cn}}}}catch(En){Wt.e(En)}finally{Wt.f()}return null},Kt=h.useState(null),Ht=(0,ue.Z)(Kt,2),tn=Ht[0],$n=Ht[1],Vt=ht[tn];h.useEffect(function(){if(Ce){var Yt=null,Bt=function(){var Jt=Rt(yn);return Jt?Jt[it.value]:null};!ne&&de.length&&!Ee?Yt=de[0]:Yt=Bt(),$n(Yt)}},[Ce,Ee]),h.useImperativeHandle(J,function(){var Yt;return{scrollTo:(Yt=Zt.current)===null||Yt===void 0?void 0:Yt.scrollTo,onKeyDown:function(Wt){var Jt,an=Wt.which;switch(an){case j.Z.UP:case j.Z.DOWN:case j.Z.LEFT:case j.Z.RIGHT:(Jt=Zt.current)===null||Jt===void 0||Jt.onKeyDown(Wt);break;case j.Z.ENTER:{if(Vt){var cn=pt(Vt.node),En=(Vt==null?void 0:Vt.node)||{},mn=En.selectable,on=En.value,jn=En.disabled;mn!==!1&&!jn&&!cn&&ke(null,{node:{key:tn},selected:!de.includes(on)})}break}case j.Z.ESC:Be(!1)}},onKeyUp:function(){}}});var un=(0,_.Z)(function(){return!Ee},[Ee,je||xt],function(Yt,Bt){var Wt=(0,ue.Z)(Yt,1),Jt=Wt[0],an=(0,ue.Z)(Bt,2),cn=an[0],En=an[1];return Jt!==cn&&!!(cn||En)}),rn=un?zn:null;if(yn.length===0)return h.createElement("div",{role:"listbox",className:"".concat(ee,"-empty"),onMouseDown:Me},De);var fn={fieldNames:it};return kn&&(fn.loadedKeys=kn),Pt&&(fn.expandedKeys=Pt),h.createElement("div",{onMouseDown:Me},Vt&&Ce&&h.createElement("span",{style:vt,"aria-live":"assertive"},Vt.node.value),h.createElement(Q.y6.Provider,{value:{nodeDisabled:pt}},h.createElement(Q.ZP,(0,L.Z)({ref:Zt,focusable:!1,prefixCls:"".concat(ee,"-tree"),treeData:yn,height:Ue,itemHeight:Fe,itemScrollOffset:lt,virtual:Ge!==!1&&zt!==!1,multiple:ne,icon:qt,showIcon:gn,switcherIcon:en,showLine:nn,loadData:rn,motion:Nn,activeKey:tn,checkable:pe,checkStrictly:!0,checkedKeys:Hn,selectedKeys:pe?[]:de,defaultExpandAll:tt,titleRender:Ut},fn,{onActiveChange:$n,onSelect:ke,onCheck:ke,onExpand:Gt,onLoad:Lt,filterTreeNode:dt,expandAction:ct,onScroll:Ne}))))},wt=h.forwardRef(Ae),rt=wt,Mt="SHOW_ALL",et="SHOW_PARENT",ze="SHOW_CHILD";function ye(k,Y,J,se){var ee=new Set(k);return Y===ze?k.filter(function(ne){var Ee=J[ne];return!Ee||!Ee.children||!Ee.children.some(function(Be){var Ce=Be.node;return ee.has(Ce[se.value])})||!Ee.children.every(function(Be){var Ce=Be.node;return Ze(Ce)||ee.has(Ce[se.value])})}):Y===et?k.filter(function(ne){var Ee=J[ne],Be=Ee?Ee.parent:null;return!Be||Ze(Be.node)||!ee.has(Be.key)}):k}function me(k){var Y=k.searchPlaceholder,J=k.treeCheckStrictly,se=k.treeCheckable,ee=k.labelInValue,ne=k.value,Ee=k.multiple,Be=k.showCheckedStrategy,Ce=k.maxCount;warning(!Y,"`searchPlaceholder` has been removed."),J&&ee===!1&&warning(!1,"`treeCheckStrictly` will force set `labelInValue` to `true`."),(ee||J)&&warning(toArray(ne).every(function(De){return De&&_typeof(De)==="object"&&"value"in De}),"Invalid prop `value` supplied to `TreeSelect`. You should use { label: string, value: string | number } or [{ label: string, value: string | number }] instead."),J||Ee||se?warning(!ne||Array.isArray(ne),"`value` should be an array when `TreeSelect` is checkable or multiple."):warning(!Array.isArray(ne),"`value` should not be array when `TreeSelect` is single mode."),Ce&&(Be==="SHOW_ALL"&&!J||Be==="SHOW_PARENT")&&warning(!1,"`maxCount` not work with `showCheckedStrategy=SHOW_ALL` (when `treeCheckStrictly=false`) or `showCheckedStrategy=SHOW_PARENT`.")}var B=null,xe=["id","prefixCls","value","defaultValue","onChange","onSelect","onDeselect","searchValue","inputValue","onSearch","autoClearSearchValue","filterTreeNode","treeNodeFilterProp","showCheckedStrategy","treeNodeLabelProp","multiple","treeCheckable","treeCheckStrictly","labelInValue","maxCount","fieldNames","treeDataSimpleMode","treeData","children","loadData","treeLoadedKeys","onTreeLoad","treeDefaultExpandAll","treeExpandedKeys","treeDefaultExpandedKeys","onTreeExpand","treeExpandAction","virtual","listHeight","listItemHeight","listItemScrollOffset","onDropdownVisibleChange","dropdownMatchSelectWidth","treeLine","treeIcon","showTreeIcon","switcherIcon","treeMotion","treeTitleRender","onPopupScroll"];function Le(k){return!k||(0,p.Z)(k)!=="object"}var K=h.forwardRef(function(k,Y){var J=k.id,se=k.prefixCls,ee=se===void 0?"rc-tree-select":se,ne=k.value,Ee=k.defaultValue,Be=k.onChange,Ce=k.onSelect,De=k.onDeselect,oe=k.searchValue,Ge=k.inputValue,Ue=k.onSearch,Fe=k.autoClearSearchValue,lt=Fe===void 0?!0:Fe,ut=k.filterTreeNode,it=k.treeNodeFilterProp,Ct=it===void 0?"value":it,zt=k.showCheckedStrategy,ct=k.treeNodeLabelProp,Ut=k.multiple,Ne=k.treeCheckable,Se=k.treeCheckStrictly,Ie=k.labelInValue,U=k.maxCount,z=k.fieldNames,pe=k.treeDataSimpleMode,de=k.treeData,ve=k.children,je=k.loadData,tt=k.treeLoadedKeys,yt=k.onTreeLoad,It=k.treeDefaultExpandAll,qt=k.treeExpandedKeys,gn=k.treeDefaultExpandedKeys,en=k.onTreeExpand,nn=k.treeExpandAction,wn=k.virtual,zn=k.listHeight,kn=zn===void 0?200:zn,Nn=k.listItemHeight,Lt=Nn===void 0?20:Nn,ht=k.listItemScrollOffset,Zt=ht===void 0?0:ht,yn=k.onDropdownVisibleChange,Hn=k.dropdownMatchSelectWidth,Me=Hn===void 0?!0:Hn,ke=k.treeLine,St=k.treeIcon,st=k.showTreeIcon,xt=k.switcherIcon,Tt=k.treeMotion,Et=k.treeTitleRender,kt=k.onPopupScroll,jt=(0,$.Z)(k,xe),At=(0,le.ZP)(J),Pt=Ne&&!Se,Gt=Ne||Se,Ft=Se||Ie,dt=Gt||Ut,Re=(0,x.Z)(Ee,{value:ne}),$e=(0,ue.Z)(Re,2),Qe=$e[0],Xe=$e[1],gt=h.useMemo(function(){return Ne?zt||ze:Mt},[zt,Ne]),pt=h.useMemo(function(){return Oe(z)},[JSON.stringify(z)]),Rt=(0,x.Z)("",{value:oe!==void 0?oe:Ge,postState:function(Tn){return Tn||""}}),Kt=(0,ue.Z)(Rt,2),Ht=Kt[0],tn=Kt[1],$n=function(Tn){tn(Tn),Ue==null||Ue(Tn)},Vt=V(de,ve,pe),un=Z(Vt,pt),rn=un.keyEntities,fn=un.valueEntities,Yt=h.useCallback(function(Xt){var Tn=[],Bn=[];return Xt.forEach(function(Zn){fn.has(Zn)?Bn.push(Zn):Tn.push(Zn)}),{missingRawValues:Tn,existRawValues:Bn}},[fn]),Bt=we(Vt,Ht,{fieldNames:pt,treeNodeFilterProp:Ct,filterTreeNode:ut}),Wt=h.useCallback(function(Xt){if(Xt){if(ct)return Xt[ct];for(var Tn=pt._title,Bn=0;Bn<Tn.length;Bn+=1){var Zn=Xt[Tn[Bn]];if(Zn!==void 0)return Zn}}},[pt,ct]),Jt=h.useCallback(function(Xt){var Tn=re(Xt);return Tn.map(function(Bn){return Le(Bn)?{value:Bn}:Bn})},[]),an=h.useCallback(function(Xt){var Tn=Jt(Xt);return Tn.map(function(Bn){var Zn=Bn.label,pr=Bn.value,An=Bn.halfChecked,Yn,Xn=fn.get(pr);if(Xn){var cr;Zn=Et?Et(Xn.node):(cr=Zn)!==null&&cr!==void 0?cr:Wt(Xn.node),Yn=Xn.node.disabled}else if(Zn===void 0){var sr=Jt(Qe).find(function(gr){return gr.value===pr});Zn=sr.label}return{label:Zn,value:pr,halfChecked:An,disabled:Yn}})},[fn,Wt,Jt,Qe]),cn=h.useMemo(function(){return Jt(Qe===null?[]:Qe)},[Jt,Qe]),En=h.useMemo(function(){var Xt=[],Tn=[];return cn.forEach(function(Bn){Bn.halfChecked?Tn.push(Bn):Xt.push(Bn)}),[Xt,Tn]},[cn]),mn=(0,ue.Z)(En,2),on=mn[0],jn=mn[1],Qn=h.useMemo(function(){return on.map(function(Xt){return Xt.value})},[on]),or=S(on,jn,Pt,rn),Vn=(0,ue.Z)(or,2),ir=Vn[0],Jn=Vn[1],_r=h.useMemo(function(){var Xt=ye(ir,gt,rn,pt),Tn=Xt.map(function(An){var Yn,Xn;return(Yn=(Xn=rn[An])===null||Xn===void 0||(Xn=Xn.node)===null||Xn===void 0?void 0:Xn[pt.value])!==null&&Yn!==void 0?Yn:An}),Bn=Tn.map(function(An){var Yn=on.find(function(cr){return cr.value===An}),Xn=Ie?Yn==null?void 0:Yn.label:Et==null?void 0:Et(Yn);return{value:An,label:Xn}}),Zn=an(Bn),pr=Zn[0];return!dt&&pr&&qe(pr.value)&&qe(pr.label)?[]:Zn.map(function(An){var Yn;return(0,Te.Z)((0,Te.Z)({},An),{},{label:(Yn=An.label)!==null&&Yn!==void 0?Yn:An.value})})},[pt,dt,ir,on,an,gt,rn]),ur=m(_r),On=(0,ue.Z)(ur,1),sn=On[0],Dt=h.useMemo(function(){return dt&&(gt==="SHOW_CHILD"||Se||!Ne)?U:null},[U,dt,Se,gt,Ne]),bt=Pe(function(Xt,Tn,Bn){var Zn=ye(Xt,gt,rn,pt);if(!(Dt&&Zn.length>Dt)){var pr=an(Xt);if(Xe(pr),lt&&tn(""),Be){var An=Xt;Pt&&(An=Zn.map(function(br){var yr=fn.get(br);return yr?yr.node[pt.value]:br}));var Yn=Tn||{triggerValue:void 0,selected:void 0},Xn=Yn.triggerValue,cr=Yn.selected,sr=An;if(Se){var gr=jn.filter(function(br){return!An.includes(br.value)});sr=[].concat((0,fe.Z)(sr),(0,fe.Z)(gr))}var fr=an(sr),Ar={preValue:on,triggerValue:Xn},Sr=!0;(Se||Bn==="selection"&&!cr)&&(Sr=!1),X(Ar,Xn,Xt,Vt,Sr,pt),Gt?Ar.checked=cr:Ar.selected=cr;var Or=Ft?fr:fr.map(function(br){return br.value});Be(dt?Or:Or[0],Ft?null:fr.map(function(br){return br.label}),Ar)}}}),$t=h.useCallback(function(Xt,Tn){var Bn,Zn=Tn.selected,pr=Tn.source,An=rn[Xt],Yn=An==null?void 0:An.node,Xn=(Bn=Yn==null?void 0:Yn[pt.value])!==null&&Bn!==void 0?Bn:Xt;if(!dt)bt([Xn],{selected:!0,triggerValue:Xn},"option");else{var cr=Zn?[].concat((0,fe.Z)(Qn),[Xn]):ir.filter(function(yr){return yr!==Xn});if(Pt){var sr=Yt(cr),gr=sr.missingRawValues,fr=sr.existRawValues,Ar=fr.map(function(yr){return fn.get(yr).key}),Sr;if(Zn){var Or=(0,l.S)(Ar,!0,rn);Sr=Or.checkedKeys}else{var br=(0,l.S)(Ar,{checked:!1,halfCheckedKeys:Jn},rn);Sr=br.checkedKeys}cr=[].concat((0,fe.Z)(gr),(0,fe.Z)(Sr.map(function(yr){return rn[yr].node[pt.value]})))}bt(cr,{selected:Zn,triggerValue:Xn},pr||"option")}Zn||!dt?Ce==null||Ce(Xn,te(Yn)):De==null||De(Xn,te(Yn))},[Yt,fn,rn,pt,dt,Qn,bt,Pt,Ce,De,ir,Jn,U]),Qt=h.useCallback(function(Xt){if(yn){var Tn={};Object.defineProperty(Tn,"documentClickClose",{get:function(){return(0,A.ZP)(!1,"Second param of `onDropdownVisibleChange` has been removed."),!1}}),yn(Xt,Tn)}},[yn]),bn=Pe(function(Xt,Tn){var Bn=Xt.map(function(Zn){return Zn.value});if(Tn.type==="clear"){bt(Bn,{},"selection");return}Tn.values.length&&$t(Tn.values[0].value,{selected:!1,source:"selection"})}),Kn=h.useMemo(function(){return{virtual:wn,dropdownMatchSelectWidth:Me,listHeight:kn,listItemHeight:Lt,listItemScrollOffset:Zt,treeData:Bt,fieldNames:pt,onSelect:$t,treeExpandAction:nn,treeTitleRender:Et,onPopupScroll:kt,leftMaxCount:U===void 0?null:U-sn.length,leafCountOnly:gt==="SHOW_CHILD"&&!Se&&!!Ne,valueEntities:fn}},[wn,Me,kn,Lt,Zt,Bt,pt,$t,nn,Et,kt,U,sn.length,gt,Se,Ne,fn]),tr=h.useMemo(function(){return{checkable:Gt,loadData:je,treeLoadedKeys:tt,onTreeLoad:yt,checkedKeys:ir,halfCheckedKeys:Jn,treeDefaultExpandAll:It,treeExpandedKeys:qt,treeDefaultExpandedKeys:gn,onTreeExpand:en,treeIcon:St,treeMotion:Tt,showTreeIcon:st,switcherIcon:xt,treeLine:ke,treeNodeFilterProp:Ct,keyEntities:rn}},[Gt,je,tt,yt,ir,Jn,It,qt,gn,en,St,Tt,st,xt,ke,Ct,rn]);return h.createElement(P.Provider,{value:Kn},h.createElement(G.Provider,{value:tr},h.createElement(ge.Ac,(0,L.Z)({ref:Y},jt,{id:At,prefixCls:ee,mode:dt?"multiple":void 0,displayValues:sn,onDisplayValuesChange:bn,searchValue:Ht,onSearch:$n,OptionList:rt,emptyOptions:!Vt.length,onDropdownVisibleChange:Qt,dropdownMatchSelectWidth:Me}))))}),R=K;R.TreeNode=T,R.SHOW_ALL=Mt,R.SHOW_PARENT=et,R.SHOW_CHILD=ze;var ie=R,be=ie},639:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return N}});var L=w(54476),fe=w(20068),Te=w(33885),ue=w(42978),$=w(75931),p=w(59301),ge=w(92310),le=w.n(ge),l=w(26112),x=w(30699),A=function(D){for(var q=D.prefixCls,te=D.level,X=D.isStart,ce=D.isEnd,we="".concat(q,"-indent-unit"),Pe=[],Ve=0;Ve<te;Ve+=1)Pe.push(p.createElement("span",{key:Ve,className:le()(we,(0,fe.Z)((0,fe.Z)({},"".concat(we,"-start"),X[Ve]),"".concat(we,"-end"),ce[Ve]))}));return p.createElement("span",{"aria-hidden":"true",className:"".concat(q,"-indent")},Pe)},h=p.memo(A),m=w(65065),y=w(34061),S=["eventKey","className","style","dragOver","dragOverGapTop","dragOverGapBottom","isLeaf","isStart","isEnd","expanded","selected","checked","halfChecked","loading","domRef","active","data","onMouseMove","selectable"],F="open",Z="close",W="---",I=function(D){var q,te,X,ce=D.eventKey,we=D.className,Pe=D.style,Ve=D.dragOver,V=D.dragOverGapTop,C=D.dragOverGapBottom,G=D.isLeaf,H=D.isStart,Q=D.isEnd,j=D.expanded,_=D.selected,v=D.checked,P=D.halfChecked,re=D.loading,Oe=D.domRef,Ze=D.active,Ye=D.data,qe=D.onMouseMove,ft=D.selectable,vt=(0,$.Z)(D,S),Ae=p.useContext(x.k),wt=p.useContext(x.y),rt=p.useRef(null),Mt=p.useState(!1),et=(0,ue.Z)(Mt,2),ze=et[0],ye=et[1],me=!!(Ae.disabled||D.disabled||(q=wt.nodeDisabled)!==null&&q!==void 0&&q.call(wt,Ye)),B=p.useMemo(function(){return!Ae.checkable||D.checkable===!1?!1:Ae.checkable},[Ae.checkable,D.checkable]),xe=function(ve){me||Ae.onNodeSelect(ve,(0,y.F)(D))},Le=function(ve){me||!B||D.disableCheckbox||Ae.onNodeCheck(ve,(0,y.F)(D),!v)},K=p.useMemo(function(){return typeof ft=="boolean"?ft:Ae.selectable},[ft,Ae.selectable]),R=function(ve){Ae.onNodeClick(ve,(0,y.F)(D)),K?xe(ve):Le(ve)},ie=function(ve){Ae.onNodeDoubleClick(ve,(0,y.F)(D))},be=function(ve){Ae.onNodeMouseEnter(ve,(0,y.F)(D))},k=function(ve){Ae.onNodeMouseLeave(ve,(0,y.F)(D))},Y=function(ve){Ae.onNodeContextMenu(ve,(0,y.F)(D))},J=p.useMemo(function(){return!!(Ae.draggable&&(!Ae.draggable.nodeDraggable||Ae.draggable.nodeDraggable(Ye)))},[Ae.draggable,Ye]),se=function(ve){ve.stopPropagation(),ye(!0),Ae.onNodeDragStart(ve,D);try{ve.dataTransfer.setData("text/plain","")}catch(je){}},ee=function(ve){ve.preventDefault(),ve.stopPropagation(),Ae.onNodeDragEnter(ve,D)},ne=function(ve){ve.preventDefault(),ve.stopPropagation(),Ae.onNodeDragOver(ve,D)},Ee=function(ve){ve.stopPropagation(),Ae.onNodeDragLeave(ve,D)},Be=function(ve){ve.stopPropagation(),ye(!1),Ae.onNodeDragEnd(ve,D)},Ce=function(ve){ve.preventDefault(),ve.stopPropagation(),ye(!1),Ae.onNodeDrop(ve,D)},De=function(ve){re||Ae.onNodeExpand(ve,(0,y.F)(D))},oe=p.useMemo(function(){var de=(0,m.Z)(Ae.keyEntities,ce)||{},ve=de.children;return!!(ve||[]).length},[Ae.keyEntities,ce]),Ge=p.useMemo(function(){return G===!1?!1:G||!Ae.loadData&&!oe||Ae.loadData&&D.loaded&&!oe},[G,Ae.loadData,oe,D.loaded]);p.useEffect(function(){re||typeof Ae.loadData=="function"&&j&&!Ge&&!D.loaded&&Ae.onNodeLoad((0,y.F)(D))},[re,Ae.loadData,Ae.onNodeLoad,j,Ge,D]);var Ue=p.useMemo(function(){var de;return(de=Ae.draggable)!==null&&de!==void 0&&de.icon?p.createElement("span",{className:"".concat(Ae.prefixCls,"-draggable-icon")},Ae.draggable.icon):null},[Ae.draggable]),Fe=function(ve){var je=D.switcherIcon||Ae.switcherIcon;return typeof je=="function"?je((0,Te.Z)((0,Te.Z)({},D),{},{isLeaf:ve})):je},lt=function(){if(Ge){var ve=Fe(!0);return ve!==!1?p.createElement("span",{className:le()("".concat(Ae.prefixCls,"-switcher"),"".concat(Ae.prefixCls,"-switcher-noop"))},ve):null}var je=Fe(!1);return je!==!1?p.createElement("span",{onClick:De,className:le()("".concat(Ae.prefixCls,"-switcher"),"".concat(Ae.prefixCls,"-switcher_").concat(j?F:Z))},je):null},ut=p.useMemo(function(){if(!B)return null;var de=typeof B!="boolean"?B:null;return p.createElement("span",{className:le()("".concat(Ae.prefixCls,"-checkbox"),(0,fe.Z)((0,fe.Z)((0,fe.Z)({},"".concat(Ae.prefixCls,"-checkbox-checked"),v),"".concat(Ae.prefixCls,"-checkbox-indeterminate"),!v&&P),"".concat(Ae.prefixCls,"-checkbox-disabled"),me||D.disableCheckbox)),onClick:Le,role:"checkbox","aria-checked":P?"mixed":v,"aria-disabled":me||D.disableCheckbox,"aria-label":"Select ".concat(typeof D.title=="string"?D.title:"tree node")},de)},[B,v,P,me,D.disableCheckbox,D.title]),it=p.useMemo(function(){return Ge?null:j?F:Z},[Ge,j]),Ct=p.useMemo(function(){return p.createElement("span",{className:le()("".concat(Ae.prefixCls,"-iconEle"),"".concat(Ae.prefixCls,"-icon__").concat(it||"docu"),(0,fe.Z)({},"".concat(Ae.prefixCls,"-icon_loading"),re))})},[Ae.prefixCls,it,re]),zt=p.useMemo(function(){var de=!!Ae.draggable,ve=!D.disabled&&de&&Ae.dragOverNodeKey===ce;return ve?Ae.dropIndicatorRender({dropPosition:Ae.dropPosition,dropLevelOffset:Ae.dropLevelOffset,indent:Ae.indent,prefixCls:Ae.prefixCls,direction:Ae.direction}):null},[Ae.dropPosition,Ae.dropLevelOffset,Ae.indent,Ae.prefixCls,Ae.direction,Ae.draggable,Ae.dragOverNodeKey,Ae.dropIndicatorRender]),ct=p.useMemo(function(){var de=D.title,ve=de===void 0?W:de,je="".concat(Ae.prefixCls,"-node-content-wrapper"),tt;if(Ae.showIcon){var yt=D.icon||Ae.icon;tt=yt?p.createElement("span",{className:le()("".concat(Ae.prefixCls,"-iconEle"),"".concat(Ae.prefixCls,"-icon__customize"))},typeof yt=="function"?yt(D):yt):Ct}else Ae.loadData&&re&&(tt=Ct);var It;return typeof ve=="function"?It=ve(Ye):Ae.titleRender?It=Ae.titleRender(Ye):It=ve,p.createElement("span",{ref:rt,title:typeof ve=="string"?ve:"",className:le()(je,"".concat(je,"-").concat(it||"normal"),(0,fe.Z)({},"".concat(Ae.prefixCls,"-node-selected"),!me&&(_||ze))),onMouseEnter:be,onMouseLeave:k,onContextMenu:Y,onClick:R,onDoubleClick:ie},tt,p.createElement("span",{className:"".concat(Ae.prefixCls,"-title")},It),zt)},[Ae.prefixCls,Ae.showIcon,D,Ae.icon,Ct,Ae.titleRender,Ye,it,be,k,Y,R,ie]),Ut=(0,l.Z)(vt,{aria:!0,data:!0}),Ne=(0,m.Z)(Ae.keyEntities,ce)||{},Se=Ne.level,Ie=Q[Q.length-1],U=!me&&J,z=Ae.draggingNodeKey===ce,pe=ft!==void 0?{"aria-selected":!!ft}:void 0;return p.createElement("div",(0,L.Z)({ref:Oe,role:"treeitem","aria-expanded":G?void 0:j,className:le()(we,"".concat(Ae.prefixCls,"-treenode"),(X={},(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)(X,"".concat(Ae.prefixCls,"-treenode-disabled"),me),"".concat(Ae.prefixCls,"-treenode-switcher-").concat(j?"open":"close"),!G),"".concat(Ae.prefixCls,"-treenode-checkbox-checked"),v),"".concat(Ae.prefixCls,"-treenode-checkbox-indeterminate"),P),"".concat(Ae.prefixCls,"-treenode-selected"),_),"".concat(Ae.prefixCls,"-treenode-loading"),re),"".concat(Ae.prefixCls,"-treenode-active"),Ze),"".concat(Ae.prefixCls,"-treenode-leaf-last"),Ie),"".concat(Ae.prefixCls,"-treenode-draggable"),J),"dragging",z),(0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)((0,fe.Z)(X,"drop-target",Ae.dropTargetKey===ce),"drop-container",Ae.dropContainerKey===ce),"drag-over",!me&&Ve),"drag-over-gap-top",!me&&V),"drag-over-gap-bottom",!me&&C),"filter-node",(te=Ae.filterTreeNode)===null||te===void 0?void 0:te.call(Ae,(0,y.F)(D))),"".concat(Ae.prefixCls,"-treenode-leaf"),Ge))),style:Pe,draggable:U,onDragStart:U?se:void 0,onDragEnter:J?ee:void 0,onDragOver:J?ne:void 0,onDragLeave:J?Ee:void 0,onDrop:J?Ce:void 0,onDragEnd:J?Be:void 0,onMouseMove:qe},pe,Ut),p.createElement(h,{prefixCls:Ae.prefixCls,level:Se,isStart:H,isEnd:Q}),Ue,lt(),ut,ct)};I.isTreeNode=1;var N=I},30699:function(_n,_t,w){"use strict";w.d(_t,{k:function(){return fe},y:function(){return Te}});var L=w(59301),fe=L.createContext(null),Te=L.createContext({})},3741:function(_n,_t,w){"use strict";w.d(_t,{OF:function(){return ce.Z},y6:function(){return Z.y},ZP:function(){return me}});var L=w(54476),fe=w(76190),Te=w(33885),ue=w(94480),$=w(67732),p=w(83652),ge=w(31226),le=w(42403),l=w(158),x=w(20068),A=w(92310),h=w.n(A),m=w(10228),y=w(26112),S=w(48736),F=w(59301),Z=w(30699),W=function(xe){var Le=xe.dropPosition,K=xe.dropLevelOffset,R=xe.indent,ie={pointerEvents:"none",position:"absolute",right:0,backgroundColor:"red",height:2};switch(Le){case-1:ie.top=0,ie.left=-K*R;break;case 1:ie.bottom=0,ie.left=-K*R;break;case 0:ie.bottom=0,ie.left=R;break}return F.createElement("div",{style:ie})},I=W;function N(B){if(B==null)throw new TypeError("Cannot destructure "+B)}var T=w(42978),D=w(75931),q=w(34280),te=w(48911),X=w(77900),ce=w(639);function we(B,xe){var Le=F.useState(!1),K=(0,T.Z)(Le,2),R=K[0],ie=K[1];(0,q.Z)(function(){if(R)return B(),function(){xe()}},[R]),(0,q.Z)(function(){return ie(!0),function(){ie(!1)}},[])}var Pe=we,Ve=w(34061),V=["className","style","motion","motionNodes","motionType","onMotionStart","onMotionEnd","active","treeNodeRequiredProps"],C=F.forwardRef(function(B,xe){var Le=B.className,K=B.style,R=B.motion,ie=B.motionNodes,be=B.motionType,k=B.onMotionStart,Y=B.onMotionEnd,J=B.active,se=B.treeNodeRequiredProps,ee=(0,D.Z)(B,V),ne=F.useState(!0),Ee=(0,T.Z)(ne,2),Be=Ee[0],Ce=Ee[1],De=F.useContext(Z.k),oe=De.prefixCls,Ge=ie&&be!=="hide";(0,q.Z)(function(){ie&&Ge!==Be&&Ce(Ge)},[ie]);var Ue=function(){ie&&k()},Fe=F.useRef(!1),lt=function(){ie&&!Fe.current&&(Fe.current=!0,Y())};Pe(Ue,lt);var ut=function(Ct){Ge===Ct&&lt()};return ie?F.createElement(X.default,(0,L.Z)({ref:xe,visible:Be},R,{motionAppear:be==="show",onVisibleChanged:ut}),function(it,Ct){var zt=it.className,ct=it.style;return F.createElement("div",{ref:Ct,className:h()("".concat(oe,"-treenode-motion"),zt),style:ct},ie.map(function(Ut){var Ne=Object.assign({},(N(Ut.data),Ut.data)),Se=Ut.title,Ie=Ut.key,U=Ut.isStart,z=Ut.isEnd;delete Ne.children;var pe=(0,Ve.H8)(Ie,se);return F.createElement(ce.Z,(0,L.Z)({},Ne,pe,{title:Se,active:J,data:Ut.data,key:Ie,isStart:U,isEnd:z}))}))}):F.createElement(ce.Z,(0,L.Z)({domRef:xe,className:Le,style:K},ee,{active:J}))}),G=C;function H(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],Le=B.length,K=xe.length;if(Math.abs(Le-K)!==1)return{add:!1,key:null};function R(ie,be){var k=new Map;ie.forEach(function(J){k.set(J,!0)});var Y=be.filter(function(J){return!k.has(J)});return Y.length===1?Y[0]:null}return Le<K?{add:!0,key:R(B,xe)}:{add:!1,key:R(xe,B)}}function Q(B,xe,Le){var K=B.findIndex(function(k){return k.key===Le}),R=B[K+1],ie=xe.findIndex(function(k){return k.key===Le});if(R){var be=xe.findIndex(function(k){return k.key===R.key});return xe.slice(ie+1,be)}return xe.slice(ie+1)}var j=["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"],_={width:0,height:0,display:"flex",overflow:"hidden",opacity:0,border:0,padding:0,margin:0},v=function(){},P="RC_TREE_MOTION_".concat(Math.random()),re={key:P},Oe={key:P,level:0,index:0,pos:"0",node:re,nodes:[re]},Ze={parent:null,children:[],pos:Oe.pos,data:re,title:null,key:P,isStart:[],isEnd:[]};function Ye(B,xe,Le,K){return xe===!1||!Le?B:B.slice(0,Math.ceil(Le/K)+1)}function qe(B){var xe=B.key,Le=B.pos;return(0,Ve.km)(xe,Le)}function ft(B){for(var xe=String(B.data.key),Le=B;Le.parent;)Le=Le.parent,xe="".concat(Le.data.key," > ").concat(xe);return xe}var vt=F.forwardRef(function(B,xe){var Le=B.prefixCls,K=B.data,R=B.selectable,ie=B.checkable,be=B.expandedKeys,k=B.selectedKeys,Y=B.checkedKeys,J=B.loadedKeys,se=B.loadingKeys,ee=B.halfCheckedKeys,ne=B.keyEntities,Ee=B.disabled,Be=B.dragging,Ce=B.dragOverNodeKey,De=B.dropPosition,oe=B.motion,Ge=B.height,Ue=B.itemHeight,Fe=B.virtual,lt=B.scrollWidth,ut=B.focusable,it=B.activeItem,Ct=B.focused,zt=B.tabIndex,ct=B.onKeyDown,Ut=B.onFocus,Ne=B.onBlur,Se=B.onActiveChange,Ie=B.onListChangeStart,U=B.onListChangeEnd,z=(0,D.Z)(B,j),pe=F.useRef(null),de=F.useRef(null);F.useImperativeHandle(xe,function(){return{scrollTo:function(kt){pe.current.scrollTo(kt)},getIndentWidth:function(){return de.current.offsetWidth}}});var ve=F.useState(be),je=(0,T.Z)(ve,2),tt=je[0],yt=je[1],It=F.useState(K),qt=(0,T.Z)(It,2),gn=qt[0],en=qt[1],nn=F.useState(K),wn=(0,T.Z)(nn,2),zn=wn[0],kn=wn[1],Nn=F.useState([]),Lt=(0,T.Z)(Nn,2),ht=Lt[0],Zt=Lt[1],yn=F.useState(null),Hn=(0,T.Z)(yn,2),Me=Hn[0],ke=Hn[1],St=F.useRef(K);St.current=K;function st(){var Et=St.current;en(Et),kn(Et),Zt([]),ke(null),U()}(0,q.Z)(function(){yt(be);var Et=H(tt,be);if(Et.key!==null)if(Et.add){var kt=gn.findIndex(function(dt){var Re=dt.key;return Re===Et.key}),jt=Ye(Q(gn,K,Et.key),Fe,Ge,Ue),At=gn.slice();At.splice(kt+1,0,Ze),kn(At),Zt(jt),ke("show")}else{var Pt=K.findIndex(function(dt){var Re=dt.key;return Re===Et.key}),Gt=Ye(Q(K,gn,Et.key),Fe,Ge,Ue),Ft=K.slice();Ft.splice(Pt+1,0,Ze),kn(Ft),Zt(Gt),ke("hide")}else gn!==K&&(en(K),kn(K))},[be,K]),F.useEffect(function(){Be||st()},[Be]);var xt=oe?zn:K,Tt={expandedKeys:be,selectedKeys:k,loadedKeys:J,loadingKeys:se,checkedKeys:Y,halfCheckedKeys:ee,dragOverNodeKey:Ce,dropPosition:De,keyEntities:ne};return F.createElement(F.Fragment,null,Ct&&it&&F.createElement("span",{style:_,"aria-live":"assertive"},ft(it)),F.createElement("div",null,F.createElement("input",{style:_,disabled:ut===!1||Ee,tabIndex:ut!==!1?zt:null,onKeyDown:ct,onFocus:Ut,onBlur:Ne,value:"",onChange:v,"aria-label":"for screen reader"})),F.createElement("div",{className:"".concat(Le,"-treenode"),"aria-hidden":!0,style:{position:"absolute",pointerEvents:"none",visibility:"hidden",height:0,overflow:"hidden",border:0,padding:0}},F.createElement("div",{className:"".concat(Le,"-indent")},F.createElement("div",{ref:de,className:"".concat(Le,"-indent-unit")}))),F.createElement(te.Z,(0,L.Z)({},z,{data:xt,itemKey:qe,height:Ge,fullHeight:!1,virtual:Fe,itemHeight:Ue,scrollWidth:lt,prefixCls:"".concat(Le,"-list"),ref:pe,role:"tree",onVisibleChange:function(kt){kt.every(function(jt){return qe(jt)!==P})&&st()}}),function(Et){var kt=Et.pos,jt=Object.assign({},(N(Et.data),Et.data)),At=Et.title,Pt=Et.key,Gt=Et.isStart,Ft=Et.isEnd,dt=(0,Ve.km)(Pt,kt);delete jt.key,delete jt.children;var Re=(0,Ve.H8)(dt,Tt);return F.createElement(G,(0,L.Z)({},jt,Re,{title:At,active:!!it&&Pt===it.key,pos:kt,data:Et.data,isStart:Gt,isEnd:Ft,motion:oe,motionNodes:Pt===P?ht:null,motionType:Me,onMotionStart:Ie,onMotionEnd:st,treeNodeRequiredProps:Tt,onMouseMove:function(){Se(null)}}))}))}),Ae=vt,wt=w(82661),rt=w(34643),Mt=w(65065),et=10,ze=function(B){(0,le.Z)(Le,B);var xe=(0,l.Z)(Le);function Le(){var K;(0,$.Z)(this,Le);for(var R=arguments.length,ie=new Array(R),be=0;be<R;be++)ie[be]=arguments[be];return K=xe.call.apply(xe,[this].concat(ie)),(0,x.Z)((0,ge.Z)(K),"destroyed",!1),(0,x.Z)((0,ge.Z)(K),"delayedDragEnterLogic",void 0),(0,x.Z)((0,ge.Z)(K),"loadingRetryTimes",{}),(0,x.Z)((0,ge.Z)(K),"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,Ve.w$)()}),(0,x.Z)((0,ge.Z)(K),"dragStartMousePosition",null),(0,x.Z)((0,ge.Z)(K),"dragNodeProps",null),(0,x.Z)((0,ge.Z)(K),"currentMouseOverDroppableNodeKey",null),(0,x.Z)((0,ge.Z)(K),"listRef",F.createRef()),(0,x.Z)((0,ge.Z)(K),"onNodeDragStart",function(k,Y){var J=K.state,se=J.expandedKeys,ee=J.keyEntities,ne=K.props.onDragStart,Ee=Y.eventKey;K.dragNodeProps=Y,K.dragStartMousePosition={x:k.clientX,y:k.clientY};var Be=(0,wt._5)(se,Ee);K.setState({draggingNodeKey:Ee,dragChildrenKeys:(0,wt.wA)(Ee,ee),indent:K.listRef.current.getIndentWidth()}),K.setExpandedKeys(Be),window.addEventListener("dragend",K.onWindowDragEnd),ne==null||ne({event:k,node:(0,Ve.F)(Y)})}),(0,x.Z)((0,ge.Z)(K),"onNodeDragEnter",function(k,Y){var J=K.state,se=J.expandedKeys,ee=J.keyEntities,ne=J.dragChildrenKeys,Ee=J.flattenNodes,Be=J.indent,Ce=K.props,De=Ce.onDragEnter,oe=Ce.onExpand,Ge=Ce.allowDrop,Ue=Ce.direction,Fe=Y.pos,lt=Y.eventKey;if(K.currentMouseOverDroppableNodeKey!==lt&&(K.currentMouseOverDroppableNodeKey=lt),!K.dragNodeProps){K.resetDragState();return}var ut=(0,wt.OM)(k,K.dragNodeProps,Y,Be,K.dragStartMousePosition,Ge,Ee,ee,se,Ue),it=ut.dropPosition,Ct=ut.dropLevelOffset,zt=ut.dropTargetKey,ct=ut.dropContainerKey,Ut=ut.dropTargetPos,Ne=ut.dropAllowed,Se=ut.dragOverNodeKey;if(ne.includes(zt)||!Ne){K.resetDragState();return}if(K.delayedDragEnterLogic||(K.delayedDragEnterLogic={}),Object.keys(K.delayedDragEnterLogic).forEach(function(Ie){clearTimeout(K.delayedDragEnterLogic[Ie])}),K.dragNodeProps.eventKey!==Y.eventKey&&(k.persist(),K.delayedDragEnterLogic[Fe]=window.setTimeout(function(){if(K.state.draggingNodeKey!==null){var Ie=(0,ue.Z)(se),U=(0,Mt.Z)(ee,Y.eventKey);U&&(U.children||[]).length&&(Ie=(0,wt.L0)(se,Y.eventKey)),K.props.hasOwnProperty("expandedKeys")||K.setExpandedKeys(Ie),oe==null||oe(Ie,{node:(0,Ve.F)(Y),expanded:!0,nativeEvent:k.nativeEvent})}},800)),K.dragNodeProps.eventKey===zt&&Ct===0){K.resetDragState();return}K.setState({dragOverNodeKey:Se,dropPosition:it,dropLevelOffset:Ct,dropTargetKey:zt,dropContainerKey:ct,dropTargetPos:Ut,dropAllowed:Ne}),De==null||De({event:k,node:(0,Ve.F)(Y),expandedKeys:se})}),(0,x.Z)((0,ge.Z)(K),"onNodeDragOver",function(k,Y){var J=K.state,se=J.dragChildrenKeys,ee=J.flattenNodes,ne=J.keyEntities,Ee=J.expandedKeys,Be=J.indent,Ce=K.props,De=Ce.onDragOver,oe=Ce.allowDrop,Ge=Ce.direction;if(K.dragNodeProps){var Ue=(0,wt.OM)(k,K.dragNodeProps,Y,Be,K.dragStartMousePosition,oe,ee,ne,Ee,Ge),Fe=Ue.dropPosition,lt=Ue.dropLevelOffset,ut=Ue.dropTargetKey,it=Ue.dropContainerKey,Ct=Ue.dropTargetPos,zt=Ue.dropAllowed,ct=Ue.dragOverNodeKey;se.includes(ut)||!zt||(K.dragNodeProps.eventKey===ut&&lt===0?K.state.dropPosition===null&&K.state.dropLevelOffset===null&&K.state.dropTargetKey===null&&K.state.dropContainerKey===null&&K.state.dropTargetPos===null&&K.state.dropAllowed===!1&&K.state.dragOverNodeKey===null||K.resetDragState():Fe===K.state.dropPosition&&lt===K.state.dropLevelOffset&&ut===K.state.dropTargetKey&&it===K.state.dropContainerKey&&Ct===K.state.dropTargetPos&&zt===K.state.dropAllowed&&ct===K.state.dragOverNodeKey||K.setState({dropPosition:Fe,dropLevelOffset:lt,dropTargetKey:ut,dropContainerKey:it,dropTargetPos:Ct,dropAllowed:zt,dragOverNodeKey:ct}),De==null||De({event:k,node:(0,Ve.F)(Y)}))}}),(0,x.Z)((0,ge.Z)(K),"onNodeDragLeave",function(k,Y){K.currentMouseOverDroppableNodeKey===Y.eventKey&&!k.currentTarget.contains(k.relatedTarget)&&(K.resetDragState(),K.currentMouseOverDroppableNodeKey=null);var J=K.props.onDragLeave;J==null||J({event:k,node:(0,Ve.F)(Y)})}),(0,x.Z)((0,ge.Z)(K),"onWindowDragEnd",function(k){K.onNodeDragEnd(k,null,!0),window.removeEventListener("dragend",K.onWindowDragEnd)}),(0,x.Z)((0,ge.Z)(K),"onNodeDragEnd",function(k,Y){var J=K.props.onDragEnd;K.setState({dragOverNodeKey:null}),K.cleanDragState(),J==null||J({event:k,node:(0,Ve.F)(Y)}),K.dragNodeProps=null,window.removeEventListener("dragend",K.onWindowDragEnd)}),(0,x.Z)((0,ge.Z)(K),"onNodeDrop",function(k,Y){var J,se=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,ee=K.state,ne=ee.dragChildrenKeys,Ee=ee.dropPosition,Be=ee.dropTargetKey,Ce=ee.dropTargetPos,De=ee.dropAllowed;if(De){var oe=K.props.onDrop;if(K.setState({dragOverNodeKey:null}),K.cleanDragState(),Be!==null){var Ge=(0,Te.Z)((0,Te.Z)({},(0,Ve.H8)(Be,K.getTreeNodeRequiredProps())),{},{active:((J=K.getActiveItem())===null||J===void 0?void 0:J.key)===Be,data:(0,Mt.Z)(K.state.keyEntities,Be).node}),Ue=ne.includes(Be);(0,S.ZP)(!Ue,"Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");var Fe=(0,wt.yx)(Ce),lt={event:k,node:(0,Ve.F)(Ge),dragNode:K.dragNodeProps?(0,Ve.F)(K.dragNodeProps):null,dragNodesKeys:[K.dragNodeProps.eventKey].concat(ne),dropToGap:Ee!==0,dropPosition:Ee+Number(Fe[Fe.length-1])};se||oe==null||oe(lt),K.dragNodeProps=null}}}),(0,x.Z)((0,ge.Z)(K),"cleanDragState",function(){var k=K.state.draggingNodeKey;k!==null&&K.setState({draggingNodeKey:null,dropPosition:null,dropContainerKey:null,dropTargetKey:null,dropLevelOffset:null,dropAllowed:!0,dragOverNodeKey:null}),K.dragStartMousePosition=null,K.currentMouseOverDroppableNodeKey=null}),(0,x.Z)((0,ge.Z)(K),"triggerExpandActionExpand",function(k,Y){var J=K.state,se=J.expandedKeys,ee=J.flattenNodes,ne=Y.expanded,Ee=Y.key,Be=Y.isLeaf;if(!(Be||k.shiftKey||k.metaKey||k.ctrlKey)){var Ce=ee.filter(function(oe){return oe.key===Ee})[0],De=(0,Ve.F)((0,Te.Z)((0,Te.Z)({},(0,Ve.H8)(Ee,K.getTreeNodeRequiredProps())),{},{data:Ce.data}));K.setExpandedKeys(ne?(0,wt._5)(se,Ee):(0,wt.L0)(se,Ee)),K.onNodeExpand(k,De)}}),(0,x.Z)((0,ge.Z)(K),"onNodeClick",function(k,Y){var J=K.props,se=J.onClick,ee=J.expandAction;ee==="click"&&K.triggerExpandActionExpand(k,Y),se==null||se(k,Y)}),(0,x.Z)((0,ge.Z)(K),"onNodeDoubleClick",function(k,Y){var J=K.props,se=J.onDoubleClick,ee=J.expandAction;ee==="doubleClick"&&K.triggerExpandActionExpand(k,Y),se==null||se(k,Y)}),(0,x.Z)((0,ge.Z)(K),"onNodeSelect",function(k,Y){var J=K.state.selectedKeys,se=K.state,ee=se.keyEntities,ne=se.fieldNames,Ee=K.props,Be=Ee.onSelect,Ce=Ee.multiple,De=Y.selected,oe=Y[ne.key],Ge=!De;Ge?Ce?J=(0,wt.L0)(J,oe):J=[oe]:J=(0,wt._5)(J,oe);var Ue=J.map(function(Fe){var lt=(0,Mt.Z)(ee,Fe);return lt?lt.node:null}).filter(Boolean);K.setUncontrolledState({selectedKeys:J}),Be==null||Be(J,{event:"select",selected:Ge,node:Y,selectedNodes:Ue,nativeEvent:k.nativeEvent})}),(0,x.Z)((0,ge.Z)(K),"onNodeCheck",function(k,Y,J){var se=K.state,ee=se.keyEntities,ne=se.checkedKeys,Ee=se.halfCheckedKeys,Be=K.props,Ce=Be.checkStrictly,De=Be.onCheck,oe=Y.key,Ge,Ue={event:"check",node:Y,checked:J,nativeEvent:k.nativeEvent};if(Ce){var Fe=J?(0,wt.L0)(ne,oe):(0,wt._5)(ne,oe),lt=(0,wt._5)(Ee,oe);Ge={checked:Fe,halfChecked:lt},Ue.checkedNodes=Fe.map(function(Ut){return(0,Mt.Z)(ee,Ut)}).filter(Boolean).map(function(Ut){return Ut.node}),K.setUncontrolledState({checkedKeys:Fe})}else{var ut=(0,rt.S)([].concat((0,ue.Z)(ne),[oe]),!0,ee),it=ut.checkedKeys,Ct=ut.halfCheckedKeys;if(!J){var zt=new Set(it);zt.delete(oe);var ct=(0,rt.S)(Array.from(zt),{checked:!1,halfCheckedKeys:Ct},ee);it=ct.checkedKeys,Ct=ct.halfCheckedKeys}Ge=it,Ue.checkedNodes=[],Ue.checkedNodesPositions=[],Ue.halfCheckedKeys=Ct,it.forEach(function(Ut){var Ne=(0,Mt.Z)(ee,Ut);if(Ne){var Se=Ne.node,Ie=Ne.pos;Ue.checkedNodes.push(Se),Ue.checkedNodesPositions.push({node:Se,pos:Ie})}}),K.setUncontrolledState({checkedKeys:it},!1,{halfCheckedKeys:Ct})}De==null||De(Ge,Ue)}),(0,x.Z)((0,ge.Z)(K),"onNodeLoad",function(k){var Y,J=k.key,se=K.state.keyEntities,ee=(0,Mt.Z)(se,J);if(!(ee!=null&&(Y=ee.children)!==null&&Y!==void 0&&Y.length)){var ne=new Promise(function(Ee,Be){K.setState(function(Ce){var De=Ce.loadedKeys,oe=De===void 0?[]:De,Ge=Ce.loadingKeys,Ue=Ge===void 0?[]:Ge,Fe=K.props,lt=Fe.loadData,ut=Fe.onLoad;if(!lt||oe.includes(J)||Ue.includes(J))return null;var it=lt(k);return it.then(function(){var Ct=K.state.loadedKeys,zt=(0,wt.L0)(Ct,J);ut==null||ut(zt,{event:"load",node:k}),K.setUncontrolledState({loadedKeys:zt}),K.setState(function(ct){return{loadingKeys:(0,wt._5)(ct.loadingKeys,J)}}),Ee()}).catch(function(Ct){if(K.setState(function(ct){return{loadingKeys:(0,wt._5)(ct.loadingKeys,J)}}),K.loadingRetryTimes[J]=(K.loadingRetryTimes[J]||0)+1,K.loadingRetryTimes[J]>=et){var zt=K.state.loadedKeys;(0,S.ZP)(!1,"Retry for `loadData` many times but still failed. No more retry."),K.setUncontrolledState({loadedKeys:(0,wt.L0)(zt,J)}),Ee()}Be(Ct)}),{loadingKeys:(0,wt.L0)(Ue,J)}})});return ne.catch(function(){}),ne}}),(0,x.Z)((0,ge.Z)(K),"onNodeMouseEnter",function(k,Y){var J=K.props.onMouseEnter;J==null||J({event:k,node:Y})}),(0,x.Z)((0,ge.Z)(K),"onNodeMouseLeave",function(k,Y){var J=K.props.onMouseLeave;J==null||J({event:k,node:Y})}),(0,x.Z)((0,ge.Z)(K),"onNodeContextMenu",function(k,Y){var J=K.props.onRightClick;J&&(k.preventDefault(),J({event:k,node:Y}))}),(0,x.Z)((0,ge.Z)(K),"onFocus",function(){var k=K.props.onFocus;K.setState({focused:!0});for(var Y=arguments.length,J=new Array(Y),se=0;se<Y;se++)J[se]=arguments[se];k==null||k.apply(void 0,J)}),(0,x.Z)((0,ge.Z)(K),"onBlur",function(){var k=K.props.onBlur;K.setState({focused:!1}),K.onActiveChange(null);for(var Y=arguments.length,J=new Array(Y),se=0;se<Y;se++)J[se]=arguments[se];k==null||k.apply(void 0,J)}),(0,x.Z)((0,ge.Z)(K),"getTreeNodeRequiredProps",function(){var k=K.state,Y=k.expandedKeys,J=k.selectedKeys,se=k.loadedKeys,ee=k.loadingKeys,ne=k.checkedKeys,Ee=k.halfCheckedKeys,Be=k.dragOverNodeKey,Ce=k.dropPosition,De=k.keyEntities;return{expandedKeys:Y||[],selectedKeys:J||[],loadedKeys:se||[],loadingKeys:ee||[],checkedKeys:ne||[],halfCheckedKeys:Ee||[],dragOverNodeKey:Be,dropPosition:Ce,keyEntities:De}}),(0,x.Z)((0,ge.Z)(K),"setExpandedKeys",function(k){var Y=K.state,J=Y.treeData,se=Y.fieldNames,ee=(0,Ve.oH)(J,k,se);K.setUncontrolledState({expandedKeys:k,flattenNodes:ee},!0)}),(0,x.Z)((0,ge.Z)(K),"onNodeExpand",function(k,Y){var J=K.state.expandedKeys,se=K.state,ee=se.listChanging,ne=se.fieldNames,Ee=K.props,Be=Ee.onExpand,Ce=Ee.loadData,De=Y.expanded,oe=Y[ne.key];if(!ee){var Ge=J.includes(oe),Ue=!De;if((0,S.ZP)(De&&Ge||!De&&!Ge,"Expand state not sync with index check"),J=Ue?(0,wt.L0)(J,oe):(0,wt._5)(J,oe),K.setExpandedKeys(J),Be==null||Be(J,{node:Y,expanded:Ue,nativeEvent:k.nativeEvent}),Ue&&Ce){var Fe=K.onNodeLoad(Y);Fe&&Fe.then(function(){var lt=(0,Ve.oH)(K.state.treeData,J,ne);K.setUncontrolledState({flattenNodes:lt})}).catch(function(){var lt=K.state.expandedKeys,ut=(0,wt._5)(lt,oe);K.setExpandedKeys(ut)})}}}),(0,x.Z)((0,ge.Z)(K),"onListChangeStart",function(){K.setUncontrolledState({listChanging:!0})}),(0,x.Z)((0,ge.Z)(K),"onListChangeEnd",function(){setTimeout(function(){K.setUncontrolledState({listChanging:!1})})}),(0,x.Z)((0,ge.Z)(K),"onActiveChange",function(k){var Y=K.state.activeKey,J=K.props,se=J.onActiveChange,ee=J.itemScrollOffset,ne=ee===void 0?0:ee;Y!==k&&(K.setState({activeKey:k}),k!==null&&K.scrollTo({key:k,offset:ne}),se==null||se(k))}),(0,x.Z)((0,ge.Z)(K),"getActiveItem",function(){var k=K.state,Y=k.activeKey,J=k.flattenNodes;return Y===null?null:J.find(function(se){var ee=se.key;return ee===Y})||null}),(0,x.Z)((0,ge.Z)(K),"offsetActiveKey",function(k){var Y=K.state,J=Y.flattenNodes,se=Y.activeKey,ee=J.findIndex(function(Be){var Ce=Be.key;return Ce===se});ee===-1&&k<0&&(ee=J.length),ee=(ee+k+J.length)%J.length;var ne=J[ee];if(ne){var Ee=ne.key;K.onActiveChange(Ee)}else K.onActiveChange(null)}),(0,x.Z)((0,ge.Z)(K),"onKeyDown",function(k){var Y=K.state,J=Y.activeKey,se=Y.expandedKeys,ee=Y.checkedKeys,ne=Y.fieldNames,Ee=K.props,Be=Ee.onKeyDown,Ce=Ee.checkable,De=Ee.selectable;switch(k.which){case m.Z.UP:{K.offsetActiveKey(-1),k.preventDefault();break}case m.Z.DOWN:{K.offsetActiveKey(1),k.preventDefault();break}}var oe=K.getActiveItem();if(oe&&oe.data){var Ge=K.getTreeNodeRequiredProps(),Ue=oe.data.isLeaf===!1||!!(oe.data[ne.children]||[]).length,Fe=(0,Ve.F)((0,Te.Z)((0,Te.Z)({},(0,Ve.H8)(J,Ge)),{},{data:oe.data,active:!0}));switch(k.which){case m.Z.LEFT:{Ue&&se.includes(J)?K.onNodeExpand({},Fe):oe.parent&&K.onActiveChange(oe.parent.key),k.preventDefault();break}case m.Z.RIGHT:{Ue&&!se.includes(J)?K.onNodeExpand({},Fe):oe.children&&oe.children.length&&K.onActiveChange(oe.children[0].key),k.preventDefault();break}case m.Z.ENTER:case m.Z.SPACE:{Ce&&!Fe.disabled&&Fe.checkable!==!1&&!Fe.disableCheckbox?K.onNodeCheck({},Fe,!ee.includes(J)):!Ce&&De&&!Fe.disabled&&Fe.selectable!==!1&&K.onNodeSelect({},Fe);break}}}Be==null||Be(k)}),(0,x.Z)((0,ge.Z)(K),"setUncontrolledState",function(k){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,J=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!K.destroyed){var se=!1,ee=!0,ne={};Object.keys(k).forEach(function(Ee){if(K.props.hasOwnProperty(Ee)){ee=!1;return}se=!0,ne[Ee]=k[Ee]}),se&&(!Y||ee)&&K.setState((0,Te.Z)((0,Te.Z)({},ne),J))}}),(0,x.Z)((0,ge.Z)(K),"scrollTo",function(k){K.listRef.current.scrollTo(k)}),K}return(0,p.Z)(Le,[{key:"componentDidMount",value:function(){this.destroyed=!1,this.onUpdated()}},{key:"componentDidUpdate",value:function(){this.onUpdated()}},{key:"onUpdated",value:function(){var R=this.props,ie=R.activeKey,be=R.itemScrollOffset,k=be===void 0?0:be;ie!==void 0&&ie!==this.state.activeKey&&(this.setState({activeKey:ie}),ie!==null&&this.scrollTo({key:ie,offset:k}))}},{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 R=this.state,ie=R.focused,be=R.flattenNodes,k=R.keyEntities,Y=R.draggingNodeKey,J=R.activeKey,se=R.dropLevelOffset,ee=R.dropContainerKey,ne=R.dropTargetKey,Ee=R.dropPosition,Be=R.dragOverNodeKey,Ce=R.indent,De=this.props,oe=De.prefixCls,Ge=De.className,Ue=De.style,Fe=De.showLine,lt=De.focusable,ut=De.tabIndex,it=ut===void 0?0:ut,Ct=De.selectable,zt=De.showIcon,ct=De.icon,Ut=De.switcherIcon,Ne=De.draggable,Se=De.checkable,Ie=De.checkStrictly,U=De.disabled,z=De.motion,pe=De.loadData,de=De.filterTreeNode,ve=De.height,je=De.itemHeight,tt=De.scrollWidth,yt=De.virtual,It=De.titleRender,qt=De.dropIndicatorRender,gn=De.onContextMenu,en=De.onScroll,nn=De.direction,wn=De.rootClassName,zn=De.rootStyle,kn=(0,y.Z)(this.props,{aria:!0,data:!0}),Nn;Ne&&((0,fe.Z)(Ne)==="object"?Nn=Ne:typeof Ne=="function"?Nn={nodeDraggable:Ne}:Nn={});var Lt={prefixCls:oe,selectable:Ct,showIcon:zt,icon:ct,switcherIcon:Ut,draggable:Nn,draggingNodeKey:Y,checkable:Se,checkStrictly:Ie,disabled:U,keyEntities:k,dropLevelOffset:se,dropContainerKey:ee,dropTargetKey:ne,dropPosition:Ee,dragOverNodeKey:Be,indent:Ce,direction:nn,dropIndicatorRender:qt,loadData:pe,filterTreeNode:de,titleRender:It,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 F.createElement(Z.k.Provider,{value:Lt},F.createElement("div",{className:h()(oe,Ge,wn,(0,x.Z)((0,x.Z)((0,x.Z)({},"".concat(oe,"-show-line"),Fe),"".concat(oe,"-focused"),ie),"".concat(oe,"-active-focused"),J!==null)),style:zn},F.createElement(Ae,(0,L.Z)({ref:this.listRef,prefixCls:oe,style:Ue,data:be,disabled:U,selectable:Ct,checkable:!!Se,motion:z,dragging:Y!==null,height:ve,itemHeight:je,virtual:yt,focusable:lt,focused:ie,tabIndex:it,activeItem:this.getActiveItem(),onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onActiveChange:this.onActiveChange,onListChangeStart:this.onListChangeStart,onListChangeEnd:this.onListChangeEnd,onContextMenu:gn,onScroll:en,scrollWidth:tt},this.getTreeNodeRequiredProps(),kn))))}}],[{key:"getDerivedStateFromProps",value:function(R,ie){var be=ie.prevProps,k={prevProps:R};function Y(it){return!be&&R.hasOwnProperty(it)||be&&be[it]!==R[it]}var J,se=ie.fieldNames;if(Y("fieldNames")&&(se=(0,Ve.w$)(R.fieldNames),k.fieldNames=se),Y("treeData")?J=R.treeData:Y("children")&&((0,S.ZP)(!1,"`children` of Tree is deprecated. Please use `treeData` instead."),J=(0,Ve.zn)(R.children)),J){k.treeData=J;var ee=(0,Ve.I8)(J,{fieldNames:se});k.keyEntities=(0,Te.Z)((0,x.Z)({},P,Oe),ee.keyEntities)}var ne=k.keyEntities||ie.keyEntities;if(Y("expandedKeys")||be&&Y("autoExpandParent"))k.expandedKeys=R.autoExpandParent||!be&&R.defaultExpandParent?(0,wt.r7)(R.expandedKeys,ne):R.expandedKeys;else if(!be&&R.defaultExpandAll){var Ee=(0,Te.Z)({},ne);delete Ee[P];var Be=[];Object.keys(Ee).forEach(function(it){var Ct=Ee[it];Ct.children&&Ct.children.length&&Be.push(Ct.key)}),k.expandedKeys=Be}else!be&&R.defaultExpandedKeys&&(k.expandedKeys=R.autoExpandParent||R.defaultExpandParent?(0,wt.r7)(R.defaultExpandedKeys,ne):R.defaultExpandedKeys);if(k.expandedKeys||delete k.expandedKeys,J||k.expandedKeys){var Ce=(0,Ve.oH)(J||ie.treeData,k.expandedKeys||ie.expandedKeys,se);k.flattenNodes=Ce}if(R.selectable&&(Y("selectedKeys")?k.selectedKeys=(0,wt.BT)(R.selectedKeys,R):!be&&R.defaultSelectedKeys&&(k.selectedKeys=(0,wt.BT)(R.defaultSelectedKeys,R))),R.checkable){var De;if(Y("checkedKeys")?De=(0,wt.E6)(R.checkedKeys)||{}:!be&&R.defaultCheckedKeys?De=(0,wt.E6)(R.defaultCheckedKeys)||{}:J&&(De=(0,wt.E6)(R.checkedKeys)||{checkedKeys:ie.checkedKeys,halfCheckedKeys:ie.halfCheckedKeys}),De){var oe=De,Ge=oe.checkedKeys,Ue=Ge===void 0?[]:Ge,Fe=oe.halfCheckedKeys,lt=Fe===void 0?[]:Fe;if(!R.checkStrictly){var ut=(0,rt.S)(Ue,!0,ne);Ue=ut.checkedKeys,lt=ut.halfCheckedKeys}k.checkedKeys=Ue,k.halfCheckedKeys=lt}}return Y("loadedKeys")&&(k.loadedKeys=R.loadedKeys),k}}]),Le}(F.Component);(0,x.Z)(ze,"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:I,allowDrop:function(){return!0},expandAction:!1}),(0,x.Z)(ze,"TreeNode",ce.Z);var ye=ze,me=ye},82661:function(_n,_t,w){"use strict";w.d(_t,{BT:function(){return F},E6:function(){return I},L0:function(){return x},OM:function(){return S},_5:function(){return l},r7:function(){return N},wA:function(){return h},yx:function(){return A}});var L=w(94480),fe=w(76190),Te=w(48736),ue=w(59301),$=w(639),p=w(65065),ge=w(34061),le=null;function l(T,D){if(!T)return[];var q=T.slice(),te=q.indexOf(D);return te>=0&&q.splice(te,1),q}function x(T,D){var q=(T||[]).slice();return q.indexOf(D)===-1&&q.push(D),q}function A(T){return T.split("-")}function h(T,D){var q=[],te=(0,p.Z)(D,T);function X(){var ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];ce.forEach(function(we){var Pe=we.key,Ve=we.children;q.push(Pe),X(Ve)})}return X(te.children),q}function m(T){if(T.parent){var D=A(T.pos);return Number(D[D.length-1])===T.parent.children.length-1}return!1}function y(T){var D=A(T.pos);return Number(D[D.length-1])===0}function S(T,D,q,te,X,ce,we,Pe,Ve,V){var C,G=T.clientX,H=T.clientY,Q=T.target.getBoundingClientRect(),j=Q.top,_=Q.height,v=(V==="rtl"?-1:1)*(((X==null?void 0:X.x)||0)-G),P=(v-12)/te,re=Ve.filter(function(me){var B;return(B=Pe[me])===null||B===void 0||(B=B.children)===null||B===void 0?void 0:B.length}),Oe=(0,p.Z)(Pe,q.eventKey);if(H<j+_/2){var Ze=we.findIndex(function(me){return me.key===Oe.key}),Ye=Ze<=0?0:Ze-1,qe=we[Ye].key;Oe=(0,p.Z)(Pe,qe)}var ft=Oe.key,vt=Oe,Ae=Oe.key,wt=0,rt=0;if(!re.includes(ft))for(var Mt=0;Mt<P&&m(Oe);Mt+=1)Oe=Oe.parent,rt+=1;var et=D.data,ze=Oe.node,ye=!0;return y(Oe)&&Oe.level===0&&H<j+_/2&&ce({dragNode:et,dropNode:ze,dropPosition:-1})&&Oe.key===q.eventKey?wt=-1:(vt.children||[]).length&&re.includes(Ae)?ce({dragNode:et,dropNode:ze,dropPosition:0})?wt=0:ye=!1:rt===0?P>-1.5?ce({dragNode:et,dropNode:ze,dropPosition:1})?wt=1:ye=!1:ce({dragNode:et,dropNode:ze,dropPosition:0})?wt=0:ce({dragNode:et,dropNode:ze,dropPosition:1})?wt=1:ye=!1:ce({dragNode:et,dropNode:ze,dropPosition:1})?wt=1:ye=!1,{dropPosition:wt,dropLevelOffset:rt,dropTargetKey:Oe.key,dropTargetPos:Oe.pos,dragOverNodeKey:Ae,dropContainerKey:wt===0?null:((C=Oe.parent)===null||C===void 0?void 0:C.key)||null,dropAllowed:ye}}function F(T,D){if(T){var q=D.multiple;return q?T.slice():T.length?[T[0]]:T}}var Z=function(D){return D};function W(T,D){if(!T)return[];var q=D||{},te=q.processProps,X=te===void 0?Z:te,ce=Array.isArray(T)?T:[T];return ce.map(function(we){var Pe=we.children,Ve=_objectWithoutProperties(we,le),V=W(Pe,D);return React.createElement(TreeNode,_extends({key:Ve.key},X(Ve)),V)})}function I(T){if(!T)return null;var D;if(Array.isArray(T))D={checkedKeys:T,halfCheckedKeys:void 0};else if((0,fe.Z)(T)==="object")D={checkedKeys:T.checked||void 0,halfCheckedKeys:T.halfChecked||void 0};else return(0,Te.ZP)(!1,"`checkedKeys` is not an array or an object"),null;return D}function N(T,D){var q=new Set;function te(X){if(!q.has(X)){var ce=(0,p.Z)(D,X);if(ce){q.add(X);var we=ce.parent,Pe=ce.node;Pe.disabled||we&&te(we.key)}}}return(T||[]).forEach(function(X){te(X)}),(0,L.Z)(q)}},34643:function(_n,_t,w){"use strict";w.d(_t,{S:function(){return ge}});var L=w(48736),fe=w(65065);function Te(le,l){var x=new Set;return le.forEach(function(A){l.has(A)||x.add(A)}),x}function ue(le){var l=le||{},x=l.disabled,A=l.disableCheckbox,h=l.checkable;return!!(x||A)||h===!1}function $(le,l,x,A){for(var h=new Set(le),m=new Set,y=0;y<=x;y+=1){var S=l.get(y)||new Set;S.forEach(function(I){var N=I.key,T=I.node,D=I.children,q=D===void 0?[]:D;h.has(N)&&!A(T)&&q.filter(function(te){return!A(te.node)}).forEach(function(te){h.add(te.key)})})}for(var F=new Set,Z=x;Z>=0;Z-=1){var W=l.get(Z)||new Set;W.forEach(function(I){var N=I.parent,T=I.node;if(!(A(T)||!I.parent||F.has(I.parent.key))){if(A(I.parent.node)){F.add(N.key);return}var D=!0,q=!1;(N.children||[]).filter(function(te){return!A(te.node)}).forEach(function(te){var X=te.key,ce=h.has(X);D&&!ce&&(D=!1),!q&&(ce||m.has(X))&&(q=!0)}),D&&h.add(N.key),q&&m.add(N.key),F.add(N.key)}})}return{checkedKeys:Array.from(h),halfCheckedKeys:Array.from(Te(m,h))}}function p(le,l,x,A,h){for(var m=new Set(le),y=new Set(l),S=0;S<=A;S+=1){var F=x.get(S)||new Set;F.forEach(function(N){var T=N.key,D=N.node,q=N.children,te=q===void 0?[]:q;!m.has(T)&&!y.has(T)&&!h(D)&&te.filter(function(X){return!h(X.node)}).forEach(function(X){m.delete(X.key)})})}y=new Set;for(var Z=new Set,W=A;W>=0;W-=1){var I=x.get(W)||new Set;I.forEach(function(N){var T=N.parent,D=N.node;if(!(h(D)||!N.parent||Z.has(N.parent.key))){if(h(N.parent.node)){Z.add(T.key);return}var q=!0,te=!1;(T.children||[]).filter(function(X){return!h(X.node)}).forEach(function(X){var ce=X.key,we=m.has(ce);q&&!we&&(q=!1),!te&&(we||y.has(ce))&&(te=!0)}),q||m.delete(T.key),te&&y.add(T.key),Z.add(T.key)}})}return{checkedKeys:Array.from(m),halfCheckedKeys:Array.from(Te(y,m))}}function ge(le,l,x,A){var h=[],m;A?m=A:m=ue;var y=new Set(le.filter(function(W){var I=!!(0,fe.Z)(x,W);return I||h.push(W),I})),S=new Map,F=0;Object.keys(x).forEach(function(W){var I=x[W],N=I.level,T=S.get(N);T||(T=new Set,S.set(N,T)),T.add(I),F=Math.max(F,N)}),(0,L.ZP)(!h.length,"Tree missing follow keys: ".concat(h.slice(0,100).map(function(W){return"'".concat(W,"'")}).join(", ")));var Z;return l===!0?Z=$(y,S,F,m):Z=p(y,l.halfCheckedKeys,S,F,m),Z}},65065:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return L}});function L(fe,Te){return fe[Te]}},34061:function(_n,_t,w){"use strict";w.d(_t,{F:function(){return N},H8:function(){return I},I8:function(){return W},km:function(){return h},oH:function(){return F},w$:function(){return m},zn:function(){return S}});var L=w(76190),fe=w(94480),Te=w(33885),ue=w(75931),$=w(11592),p=w(2738),ge=w(48736),le=w(65065),l=["children"];function x(T,D){return"".concat(T,"-").concat(D)}function A(T){return T&&T.type&&T.type.isTreeNode}function h(T,D){return T!=null?T:D}function m(T){var D=T||{},q=D.title,te=D._title,X=D.key,ce=D.children,we=q||"title";return{title:we,_title:te||[we],key:X||"key",children:ce||"children"}}function y(T,D){var q=new Map;function te(X){var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(X||[]).forEach(function(we){var Pe=we[D.key],Ve=we[D.children];warning(Pe!=null,"Tree node must have a certain key: [".concat(ce).concat(Pe,"]"));var V=String(Pe);warning(!q.has(V)||Pe===null||Pe===void 0,"Same 'key' exist in the Tree: ".concat(V)),q.set(V,!0),te(Ve,"".concat(ce).concat(V," > "))})}te(T)}function S(T){function D(q){var te=(0,$.Z)(q);return te.map(function(X){if(!A(X))return(0,ge.ZP)(!X,"Tree/TreeNode can only accept TreeNode as children."),null;var ce=X.key,we=X.props,Pe=we.children,Ve=(0,ue.Z)(we,l),V=(0,Te.Z)({key:ce},Ve),C=D(Pe);return C.length&&(V.children=C),V}).filter(function(X){return X})}return D(T)}function F(T,D,q){var te=m(q),X=te._title,ce=te.key,we=te.children,Pe=new Set(D===!0?[]:D),Ve=[];function V(C){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return C.map(function(H,Q){for(var j=x(G?G.pos:"0",Q),_=h(H[ce],j),v,P=0;P<X.length;P+=1){var re=X[P];if(H[re]!==void 0){v=H[re];break}}var Oe=Object.assign((0,p.Z)(H,[].concat((0,fe.Z)(X),[ce,we])),{title:v,key:_,parent:G,pos:j,children:null,data:H,isStart:[].concat((0,fe.Z)(G?G.isStart:[]),[Q===0]),isEnd:[].concat((0,fe.Z)(G?G.isEnd:[]),[Q===C.length-1])});return Ve.push(Oe),D===!0||Pe.has(_)?Oe.children=V(H[we]||[],Oe):Oe.children=[],Oe})}return V(T),Ve}function Z(T,D,q){var te={};(0,L.Z)(q)==="object"?te=q:te={externalGetKey:q},te=te||{};var X=te,ce=X.childrenPropName,we=X.externalGetKey,Pe=X.fieldNames,Ve=m(Pe),V=Ve.key,C=Ve.children,G=ce||C,H;we?typeof we=="string"?H=function(_){return _[we]}:typeof we=="function"&&(H=function(_){return we(_)}):H=function(_,v){return h(_[V],v)};function Q(j,_,v,P){var re=j?j[G]:T,Oe=j?x(v.pos,_):"0",Ze=j?[].concat((0,fe.Z)(P),[j]):[];if(j){var Ye=H(j,Oe),qe={node:j,index:_,pos:Oe,key:Ye,parentPos:v.node?v.pos:null,level:v.level+1,nodes:Ze};D(qe)}re&&re.forEach(function(ft,vt){Q(ft,vt,{node:j,pos:Oe,level:v?v.level+1:-1},Ze)})}Q(null)}function W(T){var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=D.initWrapper,te=D.processEntity,X=D.onProcessFinished,ce=D.externalGetKey,we=D.childrenPropName,Pe=D.fieldNames,Ve=arguments.length>2?arguments[2]:void 0,V=ce||Ve,C={},G={},H={posEntities:C,keyEntities:G};return q&&(H=q(H)||H),Z(T,function(Q){var j=Q.node,_=Q.index,v=Q.pos,P=Q.key,re=Q.parentPos,Oe=Q.level,Ze=Q.nodes,Ye={node:j,nodes:Ze,index:_,key:P,pos:v,level:Oe},qe=h(P,v);C[v]=Ye,G[qe]=Ye,Ye.parent=C[re],Ye.parent&&(Ye.parent.children=Ye.parent.children||[],Ye.parent.children.push(Ye)),te&&te(Ye,H)},{externalGetKey:V,childrenPropName:we,fieldNames:Pe}),X&&X(H),H}function I(T,D){var q=D.expandedKeys,te=D.selectedKeys,X=D.loadedKeys,ce=D.loadingKeys,we=D.checkedKeys,Pe=D.halfCheckedKeys,Ve=D.dragOverNodeKey,V=D.dropPosition,C=D.keyEntities,G=(0,le.Z)(C,T),H={eventKey:T,expanded:q.indexOf(T)!==-1,selected:te.indexOf(T)!==-1,loaded:X.indexOf(T)!==-1,loading:ce.indexOf(T)!==-1,checked:we.indexOf(T)!==-1,halfChecked:Pe.indexOf(T)!==-1,pos:String(G?G.pos:""),dragOver:Ve===T&&V===0,dragOverGapTop:Ve===T&&V===-1,dragOverGapBottom:Ve===T&&V===1};return H}function N(T){var D=T.data,q=T.expanded,te=T.selected,X=T.checked,ce=T.loaded,we=T.loading,Pe=T.halfChecked,Ve=T.dragOver,V=T.dragOverGapTop,C=T.dragOverGapBottom,G=T.pos,H=T.active,Q=T.eventKey,j=(0,Te.Z)((0,Te.Z)({},D),{},{expanded:q,selected:te,checked:X,loaded:ce,loading:we,halfChecked:Pe,dragOver:Ve,dragOverGapTop:V,dragOverGapBottom:C,pos:G,active:H,key:Q});return"props"in j||Object.defineProperty(j,"props",{get:function(){return(0,ge.ZP)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),T}}),j}},49658:function(_n,_t){"use strict";_t.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var w=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(w)||/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(w==null?void 0:w.substr(0,4))}},48911:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return et}});var L=w(54476),fe=w(76190),Te=w(33885),ue=w(20068),$=w(42978),p=w(75931),ge=w(92310),le=w.n(ge),l=w(29301),x=w(70425),A=w(34280),h=w(59301),m=w(4676),y=h.forwardRef(function(ze,ye){var me=ze.height,B=ze.offsetY,xe=ze.offsetX,Le=ze.children,K=ze.prefixCls,R=ze.onInnerResize,ie=ze.innerProps,be=ze.rtl,k=ze.extra,Y={},J={display:"flex",flexDirection:"column"};return B!==void 0&&(Y={height:me,position:"relative",overflow:"hidden"},J=(0,Te.Z)((0,Te.Z)({},J),{},(0,ue.Z)((0,ue.Z)((0,ue.Z)((0,ue.Z)((0,ue.Z)({transform:"translateY(".concat(B,"px)")},be?"marginRight":"marginLeft",-xe),"position","absolute"),"left",0),"right",0),"top",0))),h.createElement("div",{style:Y},h.createElement(l.Z,{onResize:function(ee){var ne=ee.offsetHeight;ne&&R&&R()}},h.createElement("div",(0,L.Z)({style:J,className:le()((0,ue.Z)({},"".concat(K,"-holder-inner"),K)),ref:ye},ie),Le,k)))});y.displayName="Filler";var S=y;function F(ze){var ye=ze.children,me=ze.setRef,B=h.useCallback(function(xe){me(xe)},[]);return h.cloneElement(ye,{ref:B})}function Z(ze,ye,me,B,xe,Le,K,R){var ie=R.getKey;return ze.slice(ye,me+1).map(function(be,k){var Y=ye+k,J=K(be,Y,{style:{width:B},offsetX:xe}),se=ie(be);return h.createElement(F,{key:se,setRef:function(ne){return Le(be,ne)}},J)})}function W(ze,ye,me,B){var xe=me-ze,Le=ye-me,K=Math.min(xe,Le)*2;if(B<=K){var R=Math.floor(B/2);return B%2?me+R+1:me-R}return xe>Le?me-(B-Le):me+(B-xe)}function I(ze,ye,me){var B=ze.length,xe=ye.length,Le,K;if(B===0&&xe===0)return null;B<xe?(Le=ze,K=ye):(Le=ye,K=ze);var R={__EMPTY_ITEM__:!0};function ie(ee){return ee!==void 0?me(ee):R}for(var be=null,k=Math.abs(B-xe)!==1,Y=0;Y<K.length;Y+=1){var J=ie(Le[Y]),se=ie(K[Y]);if(J!==se){be=Y,k=k||J!==ie(K[Y+1]);break}}return be===null?null:{index:be,multiple:k}}function N(ze,ye,me){var B=h.useState(ze),xe=(0,$.Z)(B,2),Le=xe[0],K=xe[1],R=h.useState(null),ie=(0,$.Z)(R,2),be=ie[0],k=ie[1];return h.useEffect(function(){var Y=I(Le||[],ze||[],ye);(Y==null?void 0:Y.index)!==void 0&&(me==null||me(Y.index),k(ze[Y.index])),K(ze)},[ze]),[be]}var T=w(16089),D=(typeof navigator=="undefined"?"undefined":(0,fe.Z)(navigator))==="object"&&/Firefox/i.test(navigator.userAgent),q=D,te=function(ze,ye,me,B){var xe=(0,h.useRef)(!1),Le=(0,h.useRef)(null);function K(){clearTimeout(Le.current),xe.current=!0,Le.current=setTimeout(function(){xe.current=!1},50)}var R=(0,h.useRef)({top:ze,bottom:ye,left:me,right:B});return R.current.top=ze,R.current.bottom=ye,R.current.left=me,R.current.right=B,function(ie,be){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Y=ie?be<0&&R.current.left||be>0&&R.current.right:be<0&&R.current.top||be>0&&R.current.bottom;return k&&Y?(clearTimeout(Le.current),xe.current=!1):(!Y||xe.current)&&K(),!xe.current&&Y}};function X(ze,ye,me,B,xe,Le,K){var R=(0,h.useRef)(0),ie=(0,h.useRef)(null),be=(0,h.useRef)(null),k=(0,h.useRef)(!1),Y=te(ye,me,B,xe);function J(Ce,De){if(T.Z.cancel(ie.current),!Y(!1,De)){var oe=Ce;if(!oe._virtualHandled)oe._virtualHandled=!0;else return;R.current+=De,be.current=De,q||oe.preventDefault(),ie.current=(0,T.Z)(function(){var Ge=k.current?10:1;K(R.current*Ge,!1),R.current=0})}}function se(Ce,De){K(De,!0),q||Ce.preventDefault()}var ee=(0,h.useRef)(null),ne=(0,h.useRef)(null);function Ee(Ce){if(ze){T.Z.cancel(ne.current),ne.current=(0,T.Z)(function(){ee.current=null},2);var De=Ce.deltaX,oe=Ce.deltaY,Ge=Ce.shiftKey,Ue=De,Fe=oe;(ee.current==="sx"||!ee.current&&Ge&&oe&&!De)&&(Ue=oe,Fe=0,ee.current="sx");var lt=Math.abs(Ue),ut=Math.abs(Fe);ee.current===null&&(ee.current=Le&&lt>ut?"x":"y"),ee.current==="y"?J(Ce,Fe):se(Ce,Ue)}}function Be(Ce){ze&&(k.current=Ce.detail===be.current)}return[Ee,Be]}function ce(ze,ye,me,B){var xe=h.useMemo(function(){return[new Map,[]]},[ze,me.id,B]),Le=(0,$.Z)(xe,2),K=Le[0],R=Le[1],ie=function(k){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k,J=K.get(k),se=K.get(Y);if(J===void 0||se===void 0)for(var ee=ze.length,ne=R.length;ne<ee;ne+=1){var Ee,Be=ze[ne],Ce=ye(Be);K.set(Ce,ne);var De=(Ee=me.get(Ce))!==null&&Ee!==void 0?Ee:B;if(R[ne]=(R[ne-1]||0)+De,Ce===k&&(J=ne),Ce===Y&&(se=ne),J!==void 0&&se!==void 0)break}return{top:R[J-1]||0,bottom:R[se]}};return ie}var we=w(67732),Pe=w(83652),Ve=function(){function ze(){(0,we.Z)(this,ze),(0,ue.Z)(this,"maps",void 0),(0,ue.Z)(this,"id",0),(0,ue.Z)(this,"diffRecords",new Map),this.maps=Object.create(null)}return(0,Pe.Z)(ze,[{key:"set",value:function(me,B){this.diffRecords.set(me,this.maps[me]),this.maps[me]=B,this.id+=1}},{key:"get",value:function(me){return this.maps[me]}},{key:"resetRecord",value:function(){this.diffRecords.clear()}},{key:"getRecord",value:function(){return this.diffRecords}}]),ze}(),V=Ve;function C(ze){var ye=parseFloat(ze);return isNaN(ye)?0:ye}function G(ze,ye,me){var B=h.useState(0),xe=(0,$.Z)(B,2),Le=xe[0],K=xe[1],R=(0,h.useRef)(new Map),ie=(0,h.useRef)(new V),be=(0,h.useRef)(0);function k(){be.current+=1}function Y(){var se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;k();var ee=function(){var Be=!1;R.current.forEach(function(Ce,De){if(Ce&&Ce.offsetParent){var oe=Ce.offsetHeight,Ge=getComputedStyle(Ce),Ue=Ge.marginTop,Fe=Ge.marginBottom,lt=C(Ue),ut=C(Fe),it=oe+lt+ut;ie.current.get(De)!==it&&(ie.current.set(De,it),Be=!0)}}),Be&&K(function(Ce){return Ce+1})};if(se)ee();else{be.current+=1;var ne=be.current;Promise.resolve().then(function(){ne===be.current&&ee()})}}function J(se,ee){var ne=ze(se),Ee=R.current.get(ne);ee?(R.current.set(ne,ee),Y()):R.current.delete(ne),!Ee!=!ee&&(ee?ye==null||ye(se):me==null||me(se))}return(0,h.useEffect)(function(){return k},[]),[J,Y,ie.current,Le]}var H=14/15;function Q(ze,ye,me){var B=(0,h.useRef)(!1),xe=(0,h.useRef)(0),Le=(0,h.useRef)(0),K=(0,h.useRef)(null),R=(0,h.useRef)(null),ie,be=function(se){if(B.current){var ee=Math.ceil(se.touches[0].pageX),ne=Math.ceil(se.touches[0].pageY),Ee=xe.current-ee,Be=Le.current-ne,Ce=Math.abs(Ee)>Math.abs(Be);Ce?xe.current=ee:Le.current=ne;var De=me(Ce,Ce?Ee:Be,!1,se);De&&se.preventDefault(),clearInterval(R.current),De&&(R.current=setInterval(function(){Ce?Ee*=H:Be*=H;var oe=Math.floor(Ce?Ee:Be);(!me(Ce,oe,!0)||Math.abs(oe)<=.1)&&clearInterval(R.current)},16))}},k=function(){B.current=!1,ie()},Y=function(se){ie(),se.touches.length===1&&!B.current&&(B.current=!0,xe.current=Math.ceil(se.touches[0].pageX),Le.current=Math.ceil(se.touches[0].pageY),K.current=se.target,K.current.addEventListener("touchmove",be,{passive:!1}),K.current.addEventListener("touchend",k,{passive:!0}))};ie=function(){K.current&&(K.current.removeEventListener("touchmove",be),K.current.removeEventListener("touchend",k))},(0,A.Z)(function(){return ze&&ye.current.addEventListener("touchstart",Y,{passive:!0}),function(){var J;(J=ye.current)===null||J===void 0||J.removeEventListener("touchstart",Y),ie(),clearInterval(R.current)}},[ze])}function j(ze){return Math.floor(Math.pow(ze,.5))}function _(ze,ye){var me="touches"in ze?ze.touches[0]:ze;return me[ye?"pageX":"pageY"]-window[ye?"scrollX":"scrollY"]}function v(ze,ye,me){h.useEffect(function(){var B=ye.current;if(ze&&B){var xe=!1,Le,K,R=function(){T.Z.cancel(Le)},ie=function J(){R(),Le=(0,T.Z)(function(){me(K),J()})},be=function(){xe=!1,R()},k=function(se){if(!(se.target.draggable||se.button!==0)){var ee=se;ee._virtualHandled||(ee._virtualHandled=!0,xe=!0)}},Y=function(se){if(xe){var ee=_(se,!1),ne=B.getBoundingClientRect(),Ee=ne.top,Be=ne.bottom;if(ee<=Ee){var Ce=Ee-ee;K=-j(Ce),ie()}else if(ee>=Be){var De=ee-Be;K=j(De),ie()}else R()}};return B.addEventListener("mousedown",k),B.ownerDocument.addEventListener("mouseup",be),B.ownerDocument.addEventListener("mousemove",Y),B.ownerDocument.addEventListener("dragend",be),function(){B.removeEventListener("mousedown",k),B.ownerDocument.removeEventListener("mouseup",be),B.ownerDocument.removeEventListener("mousemove",Y),B.ownerDocument.removeEventListener("dragend",be),R()}}},[ze])}var P=10;function re(ze,ye,me,B,xe,Le,K,R){var ie=h.useRef(),be=h.useState(null),k=(0,$.Z)(be,2),Y=k[0],J=k[1];return(0,A.Z)(function(){if(Y&&Y.times<P){if(!ze.current){J(function(z){return(0,Te.Z)({},z)});return}Le();var se=Y.targetAlign,ee=Y.originAlign,ne=Y.index,Ee=Y.offset,Be=ze.current.clientHeight,Ce=!1,De=se,oe=null;if(Be){for(var Ge=se||ee,Ue=0,Fe=0,lt=0,ut=Math.min(ye.length-1,ne),it=0;it<=ut;it+=1){var Ct=xe(ye[it]);Fe=Ue;var zt=me.get(Ct);lt=Fe+(zt===void 0?B:zt),Ue=lt}for(var ct=Ge==="top"?Ee:Be-Ee,Ut=ut;Ut>=0;Ut-=1){var Ne=xe(ye[Ut]),Se=me.get(Ne);if(Se===void 0){Ce=!0;break}if(ct-=Se,ct<=0)break}switch(Ge){case"top":oe=Fe-Ee;break;case"bottom":oe=lt-Be+Ee;break;default:{var Ie=ze.current.scrollTop,U=Ie+Be;Fe<Ie?De="top":lt>U&&(De="bottom")}}oe!==null&&K(oe),oe!==Y.lastTop&&(Ce=!0)}Ce&&J((0,Te.Z)((0,Te.Z)({},Y),{},{times:Y.times+1,targetAlign:De,lastTop:oe}))}},[Y,ze.current]),function(se){if(se==null){R();return}if(T.Z.cancel(ie.current),typeof se=="number")K(se);else if(se&&(0,fe.Z)(se)==="object"){var ee,ne=se.align;"index"in se?ee=se.index:ee=ye.findIndex(function(Ce){return xe(Ce)===se.key});var Ee=se.offset,Be=Ee===void 0?0:Ee;J({times:0,index:ee,offset:Be,originAlign:ne})}}}var Oe=h.forwardRef(function(ze,ye){var me=ze.prefixCls,B=ze.rtl,xe=ze.scrollOffset,Le=ze.scrollRange,K=ze.onStartMove,R=ze.onStopMove,ie=ze.onScroll,be=ze.horizontal,k=ze.spinSize,Y=ze.containerSize,J=ze.style,se=ze.thumbStyle,ee=ze.showScrollBar,ne=h.useState(!1),Ee=(0,$.Z)(ne,2),Be=Ee[0],Ce=Ee[1],De=h.useState(null),oe=(0,$.Z)(De,2),Ge=oe[0],Ue=oe[1],Fe=h.useState(null),lt=(0,$.Z)(Fe,2),ut=lt[0],it=lt[1],Ct=!B,zt=h.useRef(),ct=h.useRef(),Ut=h.useState(ee),Ne=(0,$.Z)(Ut,2),Se=Ne[0],Ie=Ne[1],U=h.useRef(),z=function(){ee===!0||ee===!1||(clearTimeout(U.current),Ie(!0),U.current=setTimeout(function(){Ie(!1)},3e3))},pe=Le-Y||0,de=Y-k||0,ve=h.useMemo(function(){if(xe===0||pe===0)return 0;var wn=xe/pe;return wn*de},[xe,pe,de]),je=function(zn){zn.stopPropagation(),zn.preventDefault()},tt=h.useRef({top:ve,dragging:Be,pageY:Ge,startTop:ut});tt.current={top:ve,dragging:Be,pageY:Ge,startTop:ut};var yt=function(zn){Ce(!0),Ue(_(zn,be)),it(tt.current.top),K(),zn.stopPropagation(),zn.preventDefault()};h.useEffect(function(){var wn=function(Lt){Lt.preventDefault()},zn=zt.current,kn=ct.current;return zn.addEventListener("touchstart",wn,{passive:!1}),kn.addEventListener("touchstart",yt,{passive:!1}),function(){zn.removeEventListener("touchstart",wn),kn.removeEventListener("touchstart",yt)}},[]);var It=h.useRef();It.current=pe;var qt=h.useRef();qt.current=de,h.useEffect(function(){if(Be){var wn,zn=function(Lt){var ht=tt.current,Zt=ht.dragging,yn=ht.pageY,Hn=ht.startTop;T.Z.cancel(wn);var Me=zt.current.getBoundingClientRect(),ke=Y/(be?Me.width:Me.height);if(Zt){var St=(_(Lt,be)-yn)*ke,st=Hn;!Ct&&be?st-=St:st+=St;var xt=It.current,Tt=qt.current,Et=Tt?st/Tt:0,kt=Math.ceil(Et*xt);kt=Math.max(kt,0),kt=Math.min(kt,xt),wn=(0,T.Z)(function(){ie(kt,be)})}},kn=function(){Ce(!1),R()};return window.addEventListener("mousemove",zn,{passive:!0}),window.addEventListener("touchmove",zn,{passive:!0}),window.addEventListener("mouseup",kn,{passive:!0}),window.addEventListener("touchend",kn,{passive:!0}),function(){window.removeEventListener("mousemove",zn),window.removeEventListener("touchmove",zn),window.removeEventListener("mouseup",kn),window.removeEventListener("touchend",kn),T.Z.cancel(wn)}}},[Be]),h.useEffect(function(){return z(),function(){clearTimeout(U.current)}},[xe]),h.useImperativeHandle(ye,function(){return{delayHidden:z}});var gn="".concat(me,"-scrollbar"),en={position:"absolute",visibility:Se?null:"hidden"},nn={position:"absolute",borderRadius:99,background:"var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",cursor:"pointer",userSelect:"none"};return be?(Object.assign(en,{height:8,left:0,right:0,bottom:0}),Object.assign(nn,(0,ue.Z)({height:"100%",width:k},Ct?"left":"right",ve))):(Object.assign(en,(0,ue.Z)({width:8,top:0,bottom:0},Ct?"right":"left",0)),Object.assign(nn,{width:"100%",height:k,top:ve})),h.createElement("div",{ref:zt,className:le()(gn,(0,ue.Z)((0,ue.Z)((0,ue.Z)({},"".concat(gn,"-horizontal"),be),"".concat(gn,"-vertical"),!be),"".concat(gn,"-visible"),Se)),style:(0,Te.Z)((0,Te.Z)({},en),J),onMouseDown:je,onMouseMove:z},h.createElement("div",{ref:ct,className:le()("".concat(gn,"-thumb"),(0,ue.Z)({},"".concat(gn,"-thumb-moving"),Be)),style:(0,Te.Z)((0,Te.Z)({},nn),se),onMouseDown:yt}))}),Ze=Oe,Ye=20;function qe(){var ze=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,ye=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,me=ze/ye*ze;return isNaN(me)&&(me=0),me=Math.max(me,Ye),Math.floor(me)}var ft=["prefixCls","className","height","itemHeight","fullHeight","style","data","children","itemKey","virtual","direction","scrollWidth","component","onScroll","onVirtualScroll","onVisibleChange","innerProps","extraRender","styles","showScrollBar"],vt=[],Ae={overflowY:"auto",overflowAnchor:"none"};function wt(ze,ye){var me=ze.prefixCls,B=me===void 0?"rc-virtual-list":me,xe=ze.className,Le=ze.height,K=ze.itemHeight,R=ze.fullHeight,ie=R===void 0?!0:R,be=ze.style,k=ze.data,Y=ze.children,J=ze.itemKey,se=ze.virtual,ee=ze.direction,ne=ze.scrollWidth,Ee=ze.component,Be=Ee===void 0?"div":Ee,Ce=ze.onScroll,De=ze.onVirtualScroll,oe=ze.onVisibleChange,Ge=ze.innerProps,Ue=ze.extraRender,Fe=ze.styles,lt=ze.showScrollBar,ut=lt===void 0?"optional":lt,it=(0,p.Z)(ze,ft),Ct=h.useCallback(function(Dt){return typeof J=="function"?J(Dt):Dt==null?void 0:Dt[J]},[J]),zt=G(Ct,null,null),ct=(0,$.Z)(zt,4),Ut=ct[0],Ne=ct[1],Se=ct[2],Ie=ct[3],U=!!(se!==!1&&Le&&K),z=h.useMemo(function(){return Object.values(Se.maps).reduce(function(Dt,bt){return Dt+bt},0)},[Se.id,Se.maps]),pe=U&&k&&(Math.max(K*k.length,z)>Le||!!ne),de=ee==="rtl",ve=le()(B,(0,ue.Z)({},"".concat(B,"-rtl"),de),xe),je=k||vt,tt=(0,h.useRef)(),yt=(0,h.useRef)(),It=(0,h.useRef)(),qt=(0,h.useState)(0),gn=(0,$.Z)(qt,2),en=gn[0],nn=gn[1],wn=(0,h.useState)(0),zn=(0,$.Z)(wn,2),kn=zn[0],Nn=zn[1],Lt=(0,h.useState)(!1),ht=(0,$.Z)(Lt,2),Zt=ht[0],yn=ht[1],Hn=function(){yn(!0)},Me=function(){yn(!1)},ke={getKey:Ct};function St(Dt){nn(function(bt){var $t;typeof Dt=="function"?$t=Dt(bt):$t=Dt;var Qt=$n($t);return tt.current.scrollTop=Qt,Qt})}var st=(0,h.useRef)({start:0,end:je.length}),xt=(0,h.useRef)(),Tt=N(je,Ct),Et=(0,$.Z)(Tt,1),kt=Et[0];xt.current=kt;var jt=h.useMemo(function(){if(!U)return{scrollHeight:void 0,start:0,end:je.length-1,offset:void 0};if(!pe){var Dt;return{scrollHeight:((Dt=yt.current)===null||Dt===void 0?void 0:Dt.offsetHeight)||0,start:0,end:je.length-1,offset:void 0}}for(var bt=0,$t,Qt,bn,Kn=je.length,tr=0;tr<Kn;tr+=1){var Xt=je[tr],Tn=Ct(Xt),Bn=Se.get(Tn),Zn=bt+(Bn===void 0?K:Bn);Zn>=en&&$t===void 0&&($t=tr,Qt=bt),Zn>en+Le&&bn===void 0&&(bn=tr),bt=Zn}return $t===void 0&&($t=0,Qt=0,bn=Math.ceil(Le/K)),bn===void 0&&(bn=je.length-1),bn=Math.min(bn+1,je.length-1),{scrollHeight:bt,start:$t,end:bn,offset:Qt}},[pe,U,en,je,Ie,Le]),At=jt.scrollHeight,Pt=jt.start,Gt=jt.end,Ft=jt.offset;st.current.start=Pt,st.current.end=Gt,h.useLayoutEffect(function(){var Dt=Se.getRecord();if(Dt.size===1){var bt=Array.from(Dt.keys())[0],$t=Dt.get(bt),Qt=je[Pt];if(Qt&&$t===void 0){var bn=Ct(Qt);if(bn===bt){var Kn=Se.get(bt),tr=Kn-K;St(function(Xt){return Xt+tr})}}}Se.resetRecord()},[At]);var dt=h.useState({width:0,height:Le}),Re=(0,$.Z)(dt,2),$e=Re[0],Qe=Re[1],Xe=function(bt){Qe({width:bt.offsetWidth,height:bt.offsetHeight})},gt=(0,h.useRef)(),pt=(0,h.useRef)(),Rt=h.useMemo(function(){return qe($e.width,ne)},[$e.width,ne]),Kt=h.useMemo(function(){return qe($e.height,At)},[$e.height,At]),Ht=At-Le,tn=(0,h.useRef)(Ht);tn.current=Ht;function $n(Dt){var bt=Dt;return Number.isNaN(tn.current)||(bt=Math.min(bt,tn.current)),bt=Math.max(bt,0),bt}var Vt=en<=0,un=en>=Ht,rn=kn<=0,fn=kn>=ne,Yt=te(Vt,un,rn,fn),Bt=function(){return{x:de?-kn:kn,y:en}},Wt=(0,h.useRef)(Bt()),Jt=(0,x.zX)(function(Dt){if(De){var bt=(0,Te.Z)((0,Te.Z)({},Bt()),Dt);(Wt.current.x!==bt.x||Wt.current.y!==bt.y)&&(De(bt),Wt.current=bt)}});function an(Dt,bt){var $t=Dt;bt?((0,m.flushSync)(function(){Nn($t)}),Jt()):St($t)}function cn(Dt){var bt=Dt.currentTarget.scrollTop;bt!==en&&St(bt),Ce==null||Ce(Dt),Jt()}var En=function(bt){var $t=bt,Qt=ne?ne-$e.width:0;return $t=Math.max($t,0),$t=Math.min($t,Qt),$t},mn=(0,x.zX)(function(Dt,bt){bt?((0,m.flushSync)(function(){Nn(function($t){var Qt=$t+(de?-Dt:Dt);return En(Qt)})}),Jt()):St(function($t){var Qt=$t+Dt;return Qt})}),on=X(U,Vt,un,rn,fn,!!ne,mn),jn=(0,$.Z)(on,2),Qn=jn[0],or=jn[1];Q(U,tt,function(Dt,bt,$t,Qt){var bn=Qt;return Yt(Dt,bt,$t)?!1:!bn||!bn._virtualHandled?(bn&&(bn._virtualHandled=!0),Qn({preventDefault:function(){},deltaX:Dt?bt:0,deltaY:Dt?0:bt}),!0):!1}),v(pe,tt,function(Dt){St(function(bt){return bt+Dt})}),(0,A.Z)(function(){function Dt($t){var Qt=Vt&&$t.detail<0,bn=un&&$t.detail>0;U&&!Qt&&!bn&&$t.preventDefault()}var bt=tt.current;return bt.addEventListener("wheel",Qn,{passive:!1}),bt.addEventListener("DOMMouseScroll",or,{passive:!0}),bt.addEventListener("MozMousePixelScroll",Dt,{passive:!1}),function(){bt.removeEventListener("wheel",Qn),bt.removeEventListener("DOMMouseScroll",or),bt.removeEventListener("MozMousePixelScroll",Dt)}},[U,Vt,un]),(0,A.Z)(function(){if(ne){var Dt=En(kn);Nn(Dt),Jt({x:Dt})}},[$e.width,ne]);var Vn=function(){var bt,$t;(bt=gt.current)===null||bt===void 0||bt.delayHidden(),($t=pt.current)===null||$t===void 0||$t.delayHidden()},ir=re(tt,je,Se,K,Ct,function(){return Ne(!0)},St,Vn);h.useImperativeHandle(ye,function(){return{nativeElement:It.current,getScrollInfo:Bt,scrollTo:function(bt){function $t(Qt){return Qt&&(0,fe.Z)(Qt)==="object"&&("left"in Qt||"top"in Qt)}$t(bt)?(bt.left!==void 0&&Nn(En(bt.left)),ir(bt.top)):ir(bt)}}}),(0,A.Z)(function(){if(oe){var Dt=je.slice(Pt,Gt+1);oe(Dt,je)}},[Pt,Gt,je]);var Jn=ce(je,Ct,Se,K),_r=Ue==null?void 0:Ue({start:Pt,end:Gt,virtual:pe,offsetX:kn,offsetY:Ft,rtl:de,getSize:Jn}),ur=Z(je,Pt,Gt,ne,kn,Ut,Y,ke),On=null;Le&&(On=(0,Te.Z)((0,ue.Z)({},ie?"height":"maxHeight",Le),Ae),U&&(On.overflowY="hidden",ne&&(On.overflowX="hidden"),Zt&&(On.pointerEvents="none")));var sn={};return de&&(sn.dir="rtl"),h.createElement("div",(0,L.Z)({ref:It,style:(0,Te.Z)((0,Te.Z)({},be),{},{position:"relative"}),className:ve},sn,it),h.createElement(l.Z,{onResize:Xe},h.createElement(Be,{className:"".concat(B,"-holder"),style:On,ref:tt,onScroll:cn,onMouseEnter:Vn},h.createElement(S,{prefixCls:B,height:At,offsetX:kn,offsetY:Ft,scrollWidth:ne,onInnerResize:Ne,ref:yt,innerProps:Ge,rtl:de,extra:_r},ur))),pe&&At>Le&&h.createElement(Ze,{ref:gt,prefixCls:B,scrollOffset:en,scrollRange:At,rtl:de,onScroll:an,onStartMove:Hn,onStopMove:Me,spinSize:Kt,containerSize:$e.height,style:Fe==null?void 0:Fe.verticalScrollBar,thumbStyle:Fe==null?void 0:Fe.verticalScrollBarThumb,showScrollBar:ut}),pe&&ne>$e.width&&h.createElement(Ze,{ref:pt,prefixCls:B,scrollOffset:kn,scrollRange:ne,rtl:de,onScroll:an,onStartMove:Hn,onStopMove:Me,spinSize:Rt,containerSize:$e.width,horizontal:!0,style:Fe==null?void 0:Fe.horizontalScrollBar,thumbStyle:Fe==null?void 0:Fe.horizontalScrollBarThumb,showScrollBar:ut}))}var rt=h.forwardRef(wt);rt.displayName="List";var Mt=rt,et=Mt},83145:function(_n,_t,w){"use strict";Object.defineProperty(_t,"__esModule",{value:!0}),_t.CopyToClipboard=void 0;var L=Te(w(59301)),fe=Te(w(25769));function Te(I){return I&&I.__esModule?I:{default:I}}function ue(I){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ue=function(T){return typeof T}:ue=function(T){return T&&typeof Symbol=="function"&&T.constructor===Symbol&&T!==Symbol.prototype?"symbol":typeof T},ue(I)}function $(I,N){var T=Object.keys(I);if(Object.getOwnPropertySymbols){var D=Object.getOwnPropertySymbols(I);N&&(D=D.filter(function(q){return Object.getOwnPropertyDescriptor(I,q).enumerable})),T.push.apply(T,D)}return T}function p(I){for(var N=1;N<arguments.length;N++){var T=arguments[N]!=null?arguments[N]:{};N%2?$(T,!0).forEach(function(D){Z(I,D,T[D])}):Object.getOwnPropertyDescriptors?Object.defineProperties(I,Object.getOwnPropertyDescriptors(T)):$(T).forEach(function(D){Object.defineProperty(I,D,Object.getOwnPropertyDescriptor(T,D))})}return I}function ge(I,N){if(I==null)return{};var T=le(I,N),D,q;if(Object.getOwnPropertySymbols){var te=Object.getOwnPropertySymbols(I);for(q=0;q<te.length;q++)D=te[q],!(N.indexOf(D)>=0)&&Object.prototype.propertyIsEnumerable.call(I,D)&&(T[D]=I[D])}return T}function le(I,N){if(I==null)return{};var T={},D=Object.keys(I),q,te;for(te=0;te<D.length;te++)q=D[te],!(N.indexOf(q)>=0)&&(T[q]=I[q]);return T}function l(I,N){if(!(I instanceof N))throw new TypeError("Cannot call a class as a function")}function x(I,N){for(var T=0;T<N.length;T++){var D=N[T];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(I,D.key,D)}}function A(I,N,T){return N&&x(I.prototype,N),T&&x(I,T),I}function h(I,N){return N&&(ue(N)==="object"||typeof N=="function")?N:y(I)}function m(I){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(T){return T.__proto__||Object.getPrototypeOf(T)},m(I)}function y(I){if(I===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I}function S(I,N){if(typeof N!="function"&&N!==null)throw new TypeError("Super expression must either be null or a function");I.prototype=Object.create(N&&N.prototype,{constructor:{value:I,writable:!0,configurable:!0}}),N&&F(I,N)}function F(I,N){return F=Object.setPrototypeOf||function(D,q){return D.__proto__=q,D},F(I,N)}function Z(I,N,T){return N in I?Object.defineProperty(I,N,{value:T,enumerable:!0,configurable:!0,writable:!0}):I[N]=T,I}var W=function(I){S(N,I);function N(){var T,D;l(this,N);for(var q=arguments.length,te=new Array(q),X=0;X<q;X++)te[X]=arguments[X];return D=h(this,(T=m(N)).call.apply(T,[this].concat(te))),Z(y(D),"onClick",function(ce){var we=D.props,Pe=we.text,Ve=we.onCopy,V=we.children,C=we.options,G=L.default.Children.only(V),H=(0,fe.default)(Pe,C);Ve&&Ve(Pe,H),G&&G.props&&typeof G.props.onClick=="function"&&G.props.onClick(ce)}),D}return A(N,[{key:"render",value:function(){var D=this.props,q=D.text,te=D.onCopy,X=D.options,ce=D.children,we=ge(D,["text","onCopy","options","children"]),Pe=L.default.Children.only(ce);return L.default.cloneElement(Pe,p({},we,{onClick:this.onClick}))}}]),N}(L.default.PureComponent);_t.CopyToClipboard=W,Z(W,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(_n,_t,w){"use strict";var L=w(83145),fe=L.CopyToClipboard;fe.CopyToClipboard=fe,_n.exports=fe},76374:function(_n,_t,w){"use strict";var L=function(){if(typeof Map!="undefined")return Map;function V(C,G){var H=-1;return C.some(function(Q,j){return Q[0]===G?(H=j,!0):!1}),H}return function(){function C(){this.__entries__=[]}return Object.defineProperty(C.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),C.prototype.get=function(G){var H=V(this.__entries__,G),Q=this.__entries__[H];return Q&&Q[1]},C.prototype.set=function(G,H){var Q=V(this.__entries__,G);~Q?this.__entries__[Q][1]=H:this.__entries__.push([G,H])},C.prototype.delete=function(G){var H=this.__entries__,Q=V(H,G);~Q&&H.splice(Q,1)},C.prototype.has=function(G){return!!~V(this.__entries__,G)},C.prototype.clear=function(){this.__entries__.splice(0)},C.prototype.forEach=function(G,H){H===void 0&&(H=null);for(var Q=0,j=this.__entries__;Q<j.length;Q++){var _=j[Q];G.call(H,_[1],_[0])}},C}()}(),fe=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Te=function(){return typeof w.g!="undefined"&&w.g.Math===Math?w.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),ue=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Te):function(V){return setTimeout(function(){return V(Date.now())},1e3/60)}}(),$=2;function p(V,C){var G=!1,H=!1,Q=0;function j(){G&&(G=!1,V()),H&&v()}function _(){ue(j)}function v(){var P=Date.now();if(G){if(P-Q<$)return;H=!0}else G=!0,H=!1,setTimeout(_,C);Q=P}return v}var ge=20,le=["top","right","bottom","left","width","height","size","weight"],l=typeof MutationObserver!="undefined",x=function(){function V(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=p(this.refresh.bind(this),ge)}return V.prototype.addObserver=function(C){~this.observers_.indexOf(C)||this.observers_.push(C),this.connected_||this.connect_()},V.prototype.removeObserver=function(C){var G=this.observers_,H=G.indexOf(C);~H&&G.splice(H,1),!G.length&&this.connected_&&this.disconnect_()},V.prototype.refresh=function(){var C=this.updateObservers_();C&&this.refresh()},V.prototype.updateObservers_=function(){var C=this.observers_.filter(function(G){return G.gatherActive(),G.hasActive()});return C.forEach(function(G){return G.broadcastActive()}),C.length>0},V.prototype.connect_=function(){!fe||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)},V.prototype.disconnect_=function(){!fe||!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)},V.prototype.onTransitionEnd_=function(C){var G=C.propertyName,H=G===void 0?"":G,Q=le.some(function(j){return!!~H.indexOf(j)});Q&&this.refresh()},V.getInstance=function(){return this.instance_||(this.instance_=new V),this.instance_},V.instance_=null,V}(),A=function(V,C){for(var G=0,H=Object.keys(C);G<H.length;G++){var Q=H[G];Object.defineProperty(V,Q,{value:C[Q],enumerable:!1,writable:!1,configurable:!0})}return V},h=function(V){var C=V&&V.ownerDocument&&V.ownerDocument.defaultView;return C||Te},m=q(0,0,0,0);function y(V){return parseFloat(V)||0}function S(V){for(var C=[],G=1;G<arguments.length;G++)C[G-1]=arguments[G];return C.reduce(function(H,Q){var j=V["border-"+Q+"-width"];return H+y(j)},0)}function F(V){for(var C=["top","right","bottom","left"],G={},H=0,Q=C;H<Q.length;H++){var j=Q[H],_=V["padding-"+j];G[j]=y(_)}return G}function Z(V){var C=V.getBBox();return q(0,0,C.width,C.height)}function W(V){var C=V.clientWidth,G=V.clientHeight;if(!C&&!G)return m;var H=h(V).getComputedStyle(V),Q=F(H),j=Q.left+Q.right,_=Q.top+Q.bottom,v=y(H.width),P=y(H.height);if(H.boxSizing==="border-box"&&(Math.round(v+j)!==C&&(v-=S(H,"left","right")+j),Math.round(P+_)!==G&&(P-=S(H,"top","bottom")+_)),!N(V)){var re=Math.round(v+j)-C,Oe=Math.round(P+_)-G;Math.abs(re)!==1&&(v-=re),Math.abs(Oe)!==1&&(P-=Oe)}return q(Q.left,Q.top,v,P)}var I=function(){return typeof SVGGraphicsElement!="undefined"?function(V){return V instanceof h(V).SVGGraphicsElement}:function(V){return V instanceof h(V).SVGElement&&typeof V.getBBox=="function"}}();function N(V){return V===h(V).document.documentElement}function T(V){return fe?I(V)?Z(V):W(V):m}function D(V){var C=V.x,G=V.y,H=V.width,Q=V.height,j=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,_=Object.create(j.prototype);return A(_,{x:C,y:G,width:H,height:Q,top:G,right:C+H,bottom:Q+G,left:C}),_}function q(V,C,G,H){return{x:V,y:C,width:G,height:H}}var te=function(){function V(C){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=q(0,0,0,0),this.target=C}return V.prototype.isActive=function(){var C=T(this.target);return this.contentRect_=C,C.width!==this.broadcastWidth||C.height!==this.broadcastHeight},V.prototype.broadcastRect=function(){var C=this.contentRect_;return this.broadcastWidth=C.width,this.broadcastHeight=C.height,C},V}(),X=function(){function V(C,G){var H=D(G);A(this,{target:C,contentRect:H})}return V}(),ce=function(){function V(C,G,H){if(this.activeObservations_=[],this.observations_=new L,typeof C!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=C,this.controller_=G,this.callbackCtx_=H}return V.prototype.observe=function(C){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(C instanceof h(C).Element))throw new TypeError('parameter 1 is not of type "Element".');var G=this.observations_;G.has(C)||(G.set(C,new te(C)),this.controller_.addObserver(this),this.controller_.refresh())}},V.prototype.unobserve=function(C){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(C instanceof h(C).Element))throw new TypeError('parameter 1 is not of type "Element".');var G=this.observations_;G.has(C)&&(G.delete(C),G.size||this.controller_.removeObserver(this))}},V.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},V.prototype.gatherActive=function(){var C=this;this.clearActive(),this.observations_.forEach(function(G){G.isActive()&&C.activeObservations_.push(G)})},V.prototype.broadcastActive=function(){if(this.hasActive()){var C=this.callbackCtx_,G=this.activeObservations_.map(function(H){return new X(H.target,H.broadcastRect())});this.callback_.call(C,G,C),this.clearActive()}},V.prototype.clearActive=function(){this.activeObservations_.splice(0)},V.prototype.hasActive=function(){return this.activeObservations_.length>0},V}(),we=typeof WeakMap!="undefined"?new WeakMap:new L,Pe=function(){function V(C){if(!(this instanceof V))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var G=x.getInstance(),H=new ce(C,G,this);we.set(this,H)}return V}();["observe","unobserve","disconnect"].forEach(function(V){Pe.prototype[V]=function(){var C;return(C=we.get(this))[V].apply(C,arguments)}});var Ve=function(){return typeof Te.ResizeObserver!="undefined"?Te.ResizeObserver:Pe}();_t.Z=Ve},98040:function(_n){_n.exports=function(){var _t=document.getSelection();if(!_t.rangeCount)return function(){};for(var w=document.activeElement,L=[],fe=0;fe<_t.rangeCount;fe++)L.push(_t.getRangeAt(fe));switch(w.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":w.blur();break;default:w=null;break}return _t.removeAllRanges(),function(){_t.type==="Caret"&&_t.removeAllRanges(),_t.rangeCount||L.forEach(function(Te){_t.addRange(Te)}),w&&w.focus()}}},93314:function(_n){"use strict";_n.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=="},19251:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return fe}});var L=w(3208);function fe(Te,ue){var $=typeof Symbol!="undefined"&&Te[Symbol.iterator]||Te["@@iterator"];if(!$){if(Array.isArray(Te)||($=(0,L.Z)(Te))||ue&&Te&&typeof Te.length=="number"){$&&(Te=$);var p=0,ge=function(){};return{s:ge,n:function(){return p>=Te.length?{done:!0}:{done:!1,value:Te[p++]}},e:function(h){throw h},f:ge}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var le,l=!0,x=!1;return{s:function(){$=$.call(Te)},n:function(){var h=$.next();return l=h.done,h},e:function(h){x=!0,le=h},f:function(){try{l||$.return==null||$.return()}finally{if(x)throw le}}}}},80360:function(_n,_t,w){"use strict";w.d(_t,{ZP:function(){return Wi}});const L=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},fe=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=Te},Te=Number.MAX_SAFE_INTEGER||9007199254740991;let ue=function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a}({}),$=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 ge={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},le={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class l{constructor(e,t=0,n=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_=n}sample(e,t){const n=Math.pow(this.alpha_,e);this.estimate_=t*(1-n)+n*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 x{constructor(e,t,n,r=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_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new l(e),this.fast_=new l(t),this.defaultTTFB_=r,this.ttfb_=new l(e)}update(e,t){const{slow_:n,fast_:r,ttfb_:i}=this;n.halfLife!==e&&(this.slow_=new l(e,n.getEstimate(),n.getTotalWeight())),r.halfLife!==t&&(this.fast_=new l(t,r.getEstimate(),r.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new l(e,i.getEstimate(),i.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const n=8*t,r=e/1e3,i=n/r;this.fast_.sample(r,i),this.slow_.sample(r,i)}sampleTTFB(e){const t=e/1e3,n=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(n,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 A(a,e,t){return(e=F(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function h(){return h=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(a[n]=t[n])}return a},h.apply(null,arguments)}function m(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(a);e&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(a,r).enumerable})),t.push.apply(t,n)}return t}function y(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?m(Object(t),!0).forEach(function(n){A(a,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):m(Object(t)).forEach(function(n){Object.defineProperty(a,n,Object.getOwnPropertyDescriptor(t,n))})}return a}function S(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var n=t.call(a,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function F(a){var e=S(a,"string");return typeof e=="symbol"?e:e+""}class Z{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 n=`[${e}]:`;this.trace=W,this.debug=t.debug.bind(null,n),this.log=t.log.bind(null,n),this.warn=t.warn.bind(null,n),this.info=t.info.bind(null,n),this.error=t.error.bind(null,n)}}const W=function(){},I={trace:W,debug:W,log:W,warn:W,info:W,error:W};function N(){return h({},I)}function T(a,e){const t=self.console[a];return t?t.bind(self.console,`${e?"["+e+"] ":""}[${a}] >`):W}function D(a,e,t){return e[a]?e[a].bind(e):T(a,t)}const q=N();function te(a,e,t){const n=N();if(typeof console=="object"&&a===!0||typeof a=="object"){const r=["debug","log","info","warn","error"];r.forEach(i=>{n[i]=D(i,a,t)});try{n.log(`Debug logs enabled for "${e}" in hls.js version 1.6.13`)}catch(i){return N()}r.forEach(i=>{q[i]=D(i,a)})}else h(q,n);return n}const X=q;function ce(a=!0){return typeof self=="undefined"?void 0:(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function we(a){return typeof self!="undefined"&&a===self.ManagedMediaSource}function Pe(a,e){const t=Object.keys(a),n=Object.keys(e),r=t.length,i=n.length;return!r||!i||r===i&&!t.some(s=>n.indexOf(s)===-1)}function Ve(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 n,r,i,s="",o=0;for(;o<t;){if(n=a[o++],n===0&&e)return s;if(n===0||n===3)continue;switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:s+=String.fromCharCode(n);break;case 12:case 13:r=a[o++],s+=String.fromCharCode((n&31)<<6|r&63);break;case 14:r=a[o++],i=a[o++],s+=String.fromCharCode((n&15)<<12|(r&63)<<6|(i&63)<<0);break}}return s}function V(a){let e="";for(let t=0;t<a.length;t++){let n=a[t].toString(16);n.length<2&&(n="0"+n),e+=n}return e}function C(a){return Uint8Array.from(a.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function G(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var H={exports:{}},Q;function j(){return Q||(Q=1,function(a,e){(function(t){var n=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/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 g=o.parseURL(u);if(!g)throw new Error("Error trying to parse relative URL.");if(g.scheme)return f.alwaysNormalize?(g.path=o.normalizePath(g.path),o.buildURLFromParts(g)):u;var E=o.parseURL(c);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var b=r.exec(E.path);E.netLoc=b[1],E.path=b[2]}E.netLoc&&!E.path&&(E.path="/");var M={scheme:E.scheme,netLoc:g.netLoc,path:null,params:g.params,query:g.query,fragment:g.fragment};if(!g.netLoc&&(M.netLoc=E.netLoc,g.path[0]!=="/"))if(!g.path)M.path=E.path,g.params||(M.params=E.params,g.query||(M.query=E.query));else{var O=E.path,ae=O.substring(0,O.lastIndexOf("/")+1)+g.path;M.path=o.normalizePath(ae)}return M.path===null&&(M.path=f.alwaysNormalize?o.normalizePath(g.path):g.path),o.buildURLFromParts(M)},parseURL:function(c){var u=n.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(i,"");c.length!==(c=c.replace(s,"")).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})()}(H)),H.exports}var _=j();class v{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 P={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class re{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,ft(this,"stats")}setByteRange(e,t){const n=e.split("@",2);let r;n.length===1?r=(t==null?void 0:t.byteRangeEndOffset)||0:r=parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]}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={[P.AUDIO]:null,[P.VIDEO]:null,[P.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 v),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=_.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[P.AUDIO]=null,e[P.VIDEO]=null,e[P.AUDIOVIDEO]=null}}function Oe(a){return a.sn!=="initSegment"}class Ze extends re{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(L(e)&&L(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 n=Object.keys(t);if(n.length===1){const r=this._decryptdata=t[n[0]]||null;r&&(this._decryptdata=r.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=L(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 n=Object.keys(this.levelkeys),r=n.length;if(r>1||r===1&&(t=this.levelkeys[n[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(!L(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return Oe(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 n;const r=t[e];r&&!((n=this._decryptdata)!=null&&n.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,n,r,i,s=!1){const{elementaryStreams:o}=this,c=o[e];if(!c){o[e]={startPTS:t,endPTS:n,startDTS:r,endDTS:i,partial:s};return}c.startPTS=Math.min(c.startPTS,t),c.endPTS=Math.max(c.endPTS,n),c.startDTS=Math.min(c.startDTS,r),c.endDTS=Math.max(c.endDTS,i)}}class Ye extends re{constructor(e,t,n,r,i){super(n),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=r;const s=e.enumeratedString("BYTERANGE");s&&this.setByteRange(s,i),i&&(this.fragOffset=i.fragOffset+i.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 qe(a,e){const t=Object.getPrototypeOf(a);if(t){const n=Object.getOwnPropertyDescriptor(t,e);return n||qe(t,e)}}function ft(a,e){const t=qe(a,e);t&&(t.enumerable=!0,Object.defineProperty(a,e,t))}const vt=Math.pow(2,32)-1,Ae=[].push,wt={video:1,audio:2,id3:3,text:4};function rt(a){return String.fromCharCode.apply(null,a)}function Mt(a,e){const t=a[e]<<8|a[e+1];return t<0?65536+t:t}function et(a,e){const t=ye(a,e);return t<0?4294967296+t:t}function ze(a,e){let t=et(a,e);return t*=Math.pow(2,32),t+=et(a,e+4),t}function ye(a,e){return a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3]}function me(a){const e=a.byteLength;for(let t=0;t<e;){const n=et(a,t);if(n>8&&a[t+4]===109&&a[t+5]===111&&a[t+6]===111&&a[t+7]===102)return!0;t=n>1?t+n:e}return!1}function B(a,e){const t=[];if(!e.length)return t;const n=a.byteLength;for(let r=0;r<n;){const i=et(a,r),s=rt(a.subarray(r+4,r+8)),o=i>1?r+i:n;if(s===e[0])if(e.length===1)t.push(a.subarray(r+8,o));else{const c=B(a.subarray(r+8,o),e.slice(1));c.length&&Ae.apply(t,c)}r=o}return t}function xe(a){const e=[],t=a[0];let n=8;const r=et(a,n);n+=4;let i=0,s=0;t===0?(i=et(a,n),s=et(a,n+4),n+=8):(i=ze(a,n),s=ze(a,n+8),n+=16),n+=2;let o=a.length+s;const c=Mt(a,n);n+=2;for(let u=0;u<c;u++){let f=n;const d=et(a,f);f+=4;const g=d&2147483647;if((d&2147483648)>>>31===1)return X.warn("SIDX has hierarchical references (not supported)"),null;const b=et(a,f);f+=4,e.push({referenceSize:g,subsegmentDuration:b,info:{duration:b/r,start:o,end:o+g-1}}),o+=g,f+=4,n=f}return{earliestPresentationTime:i,timescale:r,version:t,referencesCount:c,references:e}}function Le(a){const e=[],t=B(a,["moov","trak"]);for(let r=0;r<t.length;r++){const i=t[r],s=B(i,["tkhd"])[0];if(s){let o=s[0];const c=et(s,o===0?12:20),u=B(i,["mdia","mdhd"])[0];if(u){o=u[0];const f=et(u,o===0?12:20),d=B(i,["mdia","hdlr"])[0];if(d){const g=rt(d.subarray(8,12)),E={soun:P.AUDIO,vide:P.VIDEO}[g],b=B(i,["mdia","minf","stbl","stsd"])[0],M=K(b);E?(e[c]={timescale:f,type:E,stsd:M},e[E]=y({timescale:f,id:c},M)):e[c]={timescale:f,type:g,stsd:M}}}}}return B(a,["moov","mvex","trex"]).forEach(r=>{const i=et(r,4),s=e[i];s&&(s.default={duration:et(r,12),flags:et(r,20)})}),e}function K(a){const e=a.subarray(8),t=e.subarray(86),n=rt(e.subarray(4,8));let r=n,i;const s=n==="enca"||n==="encv";if(s){const u=B(e,[n])[0].subarray(n==="enca"?28:78);B(u,["sinf"]).forEach(d=>{const g=B(d,["schm"])[0];if(g){const E=rt(g.subarray(4,8));if(E==="cbcs"||E==="cenc"){const b=B(d,["frma"])[0];b&&(r=rt(b))}}})}const o=r;switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const c=B(t,["avcC"])[0];c&&c.length>3&&(r+="."+k(c[1])+k(c[2])+k(c[3]),i=R(o==="avc1"?"dva1":"dvav",t));break}case"mp4a":{const c=B(e,[n])[0],u=B(c.subarray(28),["esds"])[0];if(u&&u.length>7){let f=4;if(u[f++]!==3)break;f=be(u,f),f+=2;const d=u[f++];if(d&128&&(f+=2),d&64&&(f+=u[f++]),u[f++]!==4)break;f=be(u,f);const g=u[f++];if(g===64)r+="."+k(g);else break;if(f+=12,u[f++]!==5)break;f=be(u,f);const E=u[f++];let b=(E&248)>>3;b===31&&(b+=1+((E&7)<<3)+((u[f]&224)>>5)),r+="."+b}break}case"hvc1":case"hev1":{const c=B(t,["hvcC"])[0];if(c&&c.length>12){const u=c[1],f=["","A","B","C"][u>>6],d=u&31,g=et(c,2),E=(u&32)>>5?"H":"L",b=c[12],M=c.subarray(6,12);r+="."+f+d,r+="."+ie(g).toString(16).toUpperCase(),r+="."+E+b;let O="";for(let ae=M.length;ae--;){const he=M[ae];(he||O)&&(O="."+he.toString(16).toUpperCase()+O)}r+=O}i=R(o=="hev1"?"dvhe":"dvh1",t);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{r=R(r,t)||r;break}case"vp09":{const c=B(t,["vpcC"])[0];if(c&&c.length>6){const u=c[4],f=c[5],d=c[6]>>4&15;r+="."+Y(u)+"."+Y(f)+"."+Y(d)}break}case"av01":{const c=B(t,["av1C"])[0];if(c&&c.length>2){const u=c[1]>>>5,f=c[1]&31,d=c[2]>>>7?"H":"M",g=(c[2]&64)>>6,E=(c[2]&32)>>5,b=u===2&&g?E?12:10:g?10:8,M=(c[2]&16)>>4,O=(c[2]&8)>>3,ae=(c[2]&4)>>2,he=c[2]&3;r+="."+u+"."+Y(f)+d+"."+Y(b)+"."+M+"."+O+ae+he+"."+Y(1)+"."+Y(1)+"."+Y(1)+"."+0,i=R("dav1",t)}break}}return{codec:r,encrypted:s,supplemental:i}}function R(a,e){const t=B(e,["dvvC"]),n=t.length?t[0]:B(e,["dvcC"])[0];if(n){const r=n[2]>>1&127,i=n[2]<<5&32|n[3]>>3&31;return a+"."+Y(r)+"."+Y(i)}}function ie(a){let e=0;for(let t=0;t<32;t++)e|=(a>>t&1)<<31-t;return e>>>0}function be(a,e){const t=e+5;for(;a[e++]&128&&e<t;);return e}function k(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function Y(a){return(a<10?"0":"")+a}function J(a,e){if(!a||!e)return;const t=e.keyId;t&&e.isCommonEncryption&&ee(a,(n,r)=>{const i=n.subarray(8,24);i.some(s=>s!==0)||(X.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${V(i)} -> ${V(t)}`),n.set(t,8))})}function se(a){const e=[];return ee(a,t=>e.push(t.subarray(8,24))),e}function ee(a,e){B(a,["moov","trak"]).forEach(n=>{const r=B(n,["mdia","minf","stbl","stsd"])[0];if(!r)return;const i=r.subarray(8);let s=B(i,["enca"]);const o=s.length>0;o||(s=B(i,["encv"])),s.forEach(c=>{const u=o?c.subarray(28):c.subarray(78);B(u,["sinf"]).forEach(d=>{const g=ne(d);g&&e(g,o)})})})}function ne(a){const e=B(a,["schm"])[0];if(e){const t=rt(e.subarray(4,8));if(t==="cbcs"||t==="cenc"){const n=B(a,["schi","tenc"])[0];if(n)return n}}}function Ee(a,e,t){const n={},r=B(a,["moof","traf"]);for(let i=0;i<r.length;i++){const s=r[i],o=B(s,["tfhd"])[0],c=et(o,4),u=e[c];if(!u)continue;n[c]||(n[c]={start:NaN,duration:0,sampleCount:0,timescale:u.timescale,type:u.type});const f=n[c],d=B(s,["tfdt"])[0];if(d){const _e=d[0];let Ke=et(d,4);_e===1&&(Ke===vt?t.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Ke*=vt+1,Ke+=et(d,8))),L(Ke)&&(!L(f.start)||Ke<f.start)&&(f.start=Ke)}const g=u.default,E=et(o,0)|(g==null?void 0:g.flags);let b=(g==null?void 0:g.duration)||0;E&8&&(E&2?b=et(o,12):b=et(o,8));const M=B(s,["trun"]);let O=f.start||0,ae=0,he=b;for(let _e=0;_e<M.length;_e++){const Ke=M[_e],We=et(Ke,4),mt=f.sampleCount;f.sampleCount+=We;const He=Ke[3]&1,ot=Ke[3]&4,at=Ke[2]&1,Je=Ke[2]&2,Nt=Ke[2]&4,vn=Ke[2]&8;let Rn=8,Fn=We;for(He&&(Rn+=4),ot&&We&&(!(Ke[Rn+1]&1)&&f.keyFrameIndex===void 0&&(f.keyFrameIndex=mt),Rn+=4,at?(he=et(Ke,Rn),Rn+=4):he=b,Je&&(Rn+=4),vn&&(Rn+=4),O+=he,ae+=he,Fn--);Fn--;)at?(he=et(Ke,Rn),Rn+=4):he=b,Je&&(Rn+=4),Nt&&(Ke[Rn+1]&1||f.keyFrameIndex===void 0&&(f.keyFrameIndex=f.sampleCount-(Fn+1),f.keyFrameStart=O),Rn+=4),vn&&(Rn+=4),O+=he,ae+=he;!ae&&b&&(ae+=b*We)}f.duration+=ae}if(!Object.keys(n).some(i=>n[i].duration)){let i=1/0,s=0;const o=B(a,["sidx"]);for(let c=0;c<o.length;c++){const u=xe(o[c]);if(u!=null&&u.references){i=Math.min(i,u.earliestPresentationTime/u.timescale);const f=u.references.reduce((d,g)=>d+g.info.duration||0,0);s=Math.max(s,f+u.earliestPresentationTime/u.timescale)}}s&&L(s)&&Object.keys(n).forEach(c=>{n[c].duration||(n[c].duration=s*n[c].timescale-n[c].start)})}return n}function Be(a){const e={valid:null,remainder:null},t=B(a,["moof"]);if(t.length<2)return e.remainder=a,e;const n=t[t.length-1];return e.valid=a.slice(0,n.byteOffset-8),e.remainder=a.slice(n.byteOffset-8),e}function Ce(a,e){const t=new Uint8Array(a.length+e.length);return t.set(a),t.set(e,a.length),t}function De(a,e){const t=[],n=e.samples,r=e.timescale,i=e.id;let s=!1;return B(n,["moof"]).map(c=>{const u=c.byteOffset-8;B(c,["traf"]).map(d=>{const g=B(d,["tfdt"]).map(E=>{const b=E[0];let M=et(E,4);return b===1&&(M*=Math.pow(2,32),M+=et(E,8)),M/r})[0];return g!==void 0&&(a=g),B(d,["tfhd"]).map(E=>{const b=et(E,4),M=et(E,0)&16777215,O=(M&1)!==0,ae=(M&2)!==0,he=(M&8)!==0;let _e=0;const Ke=(M&16)!==0;let We=0;const mt=(M&32)!==0;let He=8;b===i&&(O&&(He+=8),ae&&(He+=4),he&&(_e=et(E,He),He+=4),Ke&&(We=et(E,He),He+=4),mt&&(He+=4),e.type==="video"&&(s=oe(e.codec)),B(d,["trun"]).map(ot=>{const at=ot[0],Je=et(ot,0)&16777215,Nt=(Je&1)!==0;let vn=0;const Rn=(Je&4)!==0,Fn=(Je&256)!==0;let Cn=0;const ln=(Je&512)!==0;let Pn=0;const xn=(Je&1024)!==0,Mn=(Je&2048)!==0;let nr=0;const hn=et(ot,4);let pn=8;Nt&&(vn=et(ot,pn),pn+=4),Rn&&(pn+=4);let hr=vn+u;for(let Ir=0;Ir<hn;Ir++){if(Fn?(Cn=et(ot,pn),pn+=4):Cn=_e,ln?(Pn=et(ot,pn),pn+=4):Pn=We,xn&&(pn+=4),Mn&&(at===0?nr=et(ot,pn):nr=ye(ot,pn),pn+=4),e.type===P.VIDEO){let vr=0;for(;vr<Pn;){const xr=et(n,hr);if(hr+=4,Ge(s,n[hr])){const ni=n.subarray(hr,hr+xr);Ue(ni,s?2:1,a+nr/r,t)}hr+=xr,vr+=xr+4}}a+=Cn/r}}))})})}),t}function oe(a){if(!a)return!1;const e=a.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function Ge(a,e){if(a){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function Ue(a,e,t,n){const r=Fe(a);let i=0;i+=e;let s=0,o=0,c=0;for(;i<r.length;){s=0;do{if(i>=r.length)break;c=r[i++],s+=c}while(c===255);o=0;do{if(i>=r.length)break;c=r[i++],o+=c}while(c===255);const u=r.length-i;let f=i;if(o<u)i+=o;else if(o>u){X.error(`Malformed SEI payload. ${o} is too small, only ${u} bytes left to parse.`);break}if(s===4){if(r[f++]===181){const g=Mt(r,f);if(f+=2,g===49){const E=et(r,f);if(f+=4,E===1195456820){const b=r[f++];if(b===3){const M=r[f++],O=31&M,ae=64&M,he=ae?2+O*3:0,_e=new Uint8Array(he);if(ae){_e[0]=M;for(let Ke=1;Ke<he;Ke++)_e[Ke]=r[f++]}n.push({type:b,payloadType:s,pts:t,bytes:_e})}}}}}else if(s===5&&o>16){const d=[];for(let b=0;b<16;b++){const M=r[f++].toString(16);d.push(M.length==1?"0"+M:M),(b===3||b===5||b===7||b===9)&&d.push("-")}const g=o-16,E=new Uint8Array(g);for(let b=0;b<g;b++)E[b]=r[f++];n.push({payloadType:s,pts:t,uuid:d.join(""),userData:Ve(E),userDataBytes:E})}}}function Fe(a){const e=a.byteLength,t=[];let n=1;for(;n<e-2;)a[n]===0&&a[n+1]===0&&a[n+2]===3?(t.push(n+2),n+=2):n++;if(t.length===0)return a;const r=e-t.length,i=new Uint8Array(r);let s=0;for(n=0;n<r;s++,n++)s===t[0]&&(s++,t.shift()),i[n]=a[s];return i}function lt(a){const e=a[0];let t="",n="",r=0,i=0,s=0,o=0,c=0,u=0;if(e===0){for(;rt(a.subarray(u,u+1))!=="\0";)t+=rt(a.subarray(u,u+1)),u+=1;for(t+=rt(a.subarray(u,u+1)),u+=1;rt(a.subarray(u,u+1))!=="\0";)n+=rt(a.subarray(u,u+1)),u+=1;n+=rt(a.subarray(u,u+1)),u+=1,r=et(a,12),i=et(a,16),o=et(a,20),c=et(a,24),u=28}else if(e===1){u+=4,r=et(a,u),u+=4;const d=et(a,u);u+=4;const g=et(a,u);for(u+=4,s=xl(2,32)*d+g,fe(s)||(s=Number.MAX_SAFE_INTEGER,X.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=et(a,u),u+=4,c=et(a,u),u+=4;rt(a.subarray(u,u+1))!=="\0";)t+=rt(a.subarray(u,u+1)),u+=1;for(t+=rt(a.subarray(u,u+1)),u+=1;rt(a.subarray(u,u+1))!=="\0";)n+=rt(a.subarray(u,u+1)),u+=1;n+=rt(a.subarray(u,u+1)),u+=1}const f=a.subarray(u,a.byteLength);return{schemeIdUri:t,value:n,timeScale:r,presentationTime:s,presentationTimeDelta:i,eventDuration:o,id:c,payload:f}}function ut(a,...e){const t=e.length;let n=8,r=t;for(;r--;)n+=e[r].byteLength;const i=new Uint8Array(n);for(i[0]=n>>24&255,i[1]=n>>16&255,i[2]=n>>8&255,i[3]=n&255,i.set(a,4),r=0,n=8;r<t;r++)i.set(e[r],n),n+=e[r].byteLength;return i}function it(a,e,t){if(a.byteLength!==16)throw new RangeError("Invalid system id");let n,r;n=0,r=new Uint8Array;let i;n>0?(i=new Uint8Array(4),e.length>0&&new DataView(i.buffer).setUint32(0,e.length,!1)):i=new Uint8Array;const s=new Uint8Array(4);return t.byteLength>0&&new DataView(s.buffer).setUint32(0,t.byteLength,!1),ut([112,115,115,104],new Uint8Array([n,0,0,0]),a,i,r,s,t)}function Ct(a){const e=[];if(a instanceof ArrayBuffer){const t=a.byteLength;let n=0;for(;n+32<t;){const r=new DataView(a,n),i=zt(r);e.push(i),n+=i.size}}return e}function zt(a){const e=a.getUint32(0),t=a.byteOffset,n=a.byteLength;if(n<e)return{offset:t,size:n};if(a.getUint32(4)!==1886614376)return{offset:t,size:e};const i=a.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:t,size:e};const s=a.buffer,o=V(new Uint8Array(s,t+12,16));let c=null,u=null,f=0;if(i===0)f=28;else{const g=a.getUint32(28);if(!g||n<32+g*16)return{offset:t,size:e};c=[];for(let E=0;E<g;E++)c.push(new Uint8Array(s,t+32+E*16,16));f=32+g*16}if(!f)return{offset:t,size:e};const d=a.getUint32(f);return e-32<d?{offset:t,size:e}:(u=new Uint8Array(s,t+f+4,d),{version:i,systemId:o,kids:c,data:u,offset:t,size:e})}const ct=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Ut={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,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 Ne(a,e){const t=Ut[e];return!!t&&!!t[a.slice(0,4)]}function Se(a,e,t=!0){return!a.split(",").some(n=>!Ie(n,e,t))}function Ie(a,e,t=!0){var n;const r=ce(t);return(n=r==null?void 0:r.isTypeSupported(U(a,e)))!=null?n:!1}function U(a,e){return`${e}/mp4;codecs=${a}`}function z(a){if(a){const e=a.substring(0,4);return Ut.video[e]}return 2}function pe(a){const e=ct();return a.split(",").reduce((t,n)=>{const i=e&&oe(n)?9:Ut.video[n];return i?(i*2+t)/(t?3:2):(Ut.audio[n]+t)/(t?2:1)},0)}const de={};function ve(a,e=!0){if(de[a])return de[a];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[a];for(let r=0;r<t.length;r++){var n;if(Ie(t[r],"audio",e))return de[a]=t[r],t[r];if(t[r]==="mp3"&&(n=ce(e))!=null&&n.isTypeSupported("audio/mpeg"))return""}return a}const je=/flac|opus|mp4a\.40\.34/i;function tt(a,e=!0){return a.replace(je,t=>ve(t.toLowerCase(),e))}function yt(a,e){const t=[];if(a){const n=a.split(",");for(let r=0;r<n.length;r++)Ne(n[r],"video")||t.push(n[r])}return e&&t.push(e),t.join(",")}function It(a,e){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1)&&(qt(a,"audio")||qt(a,"video")))return a;if(e){const t=e.split(",");if(t.length>1){if(a){for(let n=t.length;n--;)if(t[n].substring(0,4)===a.substring(0,4))return t[n]}return t[0]}}return e||a}function qt(a,e){return Ne(a,e)&&Ie(a,e)}function gn(a){const e=a.split(",");for(let t=0;t<e.length;t++){const n=e[t].split(".");n.length>2&&n[0]==="avc1"&&(e[t]=`avc1.${parseInt(n[1]).toString(16)}${("000"+parseInt(n[2]).toString(16)).slice(-4)}`)}return e.join(",")}function en(a){if(a.startsWith("av01.")){const e=a.split("."),t=["0","111","01","01","01","0"];for(let n=e.length;n>4&&n<10;n++)e[n]=t[n-4];return e.join(".")}return a}function nn(a){const e=ce(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 wn(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const zn={supported:!0,powerEfficient:!0,smooth:!0},kn={supported:!1,smooth:!1,powerEfficient:!1},Nn={supported:!0,configurations:[],decodingInfoResults:[zn]};function Lt(a,e){return{supported:!1,configurations:e,decodingInfoResults:[kn],error:a}}function ht(a,e,t,n,r,i){const s=a.videoCodec,o=a.audioCodec?a.audioGroups:null,c=i==null?void 0:i.audioCodec,u=i==null?void 0:i.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((g,E)=>{if(E){const b=e.groups[E];if(!b)throw new Error(`Audio track group ${E} not found`);Object.keys(b.channels).forEach(M=>{g[M]=(g[M]||0)+b.channels[M]})}return g},{2:0})}catch(g){return!0}return s!==void 0&&(s.split(",").some(g=>oe(g))||a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(n,30)||a.videoRange!=="SDR"&&a.videoRange!==t||a.bitrate>Math.max(r,8e6))||!!d&&L(f)&&Object.keys(d).some(g=>parseInt(g)>f)}function Zt(a,e,t,n={}){const r=a.videoCodec;if(!r&&!a.audioCodec||!t)return Promise.resolve(Nn);const i=[],s=yn(a),o=s.length,c=Hn(a,e,o>0),u=c.length;for(let f=o||1*u||1;f--;){const d={type:"media-source"};if(o&&(d.video=s[f%o]),u){d.audio=c[f%u];const g=d.audio.bitrate;d.video&&g&&(d.video.bitrate-=g)}i.push(d)}if(r){const f=navigator.userAgent;if(r.split(",").some(d=>oe(d))&&ct())return Promise.resolve(Lt(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${f})`),i))}return Promise.all(i.map(f=>{const d=St(f);return n[d]||(n[d]=t.decodingInfo(f))})).then(f=>({supported:!f.some(d=>!d.supported),configurations:i,decodingInfoResults:f})).catch(f=>({supported:!1,configurations:i,decodingInfoResults:[],error:f}))}function yn(a){var e;const t=(e=a.videoCodec)==null?void 0:e.split(","),n=ke(a),r=a.width||640,i=a.height||480,s=a.frameRate||30,o=a.videoRange.toLowerCase();return t?t.map(c=>{const u={contentType:U(en(c),"video"),width:r,height:i,bitrate:n,framerate:s};return o!=="sdr"&&(u.transferFunction=o),u}):[]}function Hn(a,e,t){var n;const r=(n=a.audioCodec)==null?void 0:n.split(","),i=ke(a);return r&&a.audioGroups?a.audioGroups.reduce((s,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 g=parseFloat(d.channels||"");r.forEach(E=>{const b={contentType:U(E,"audio"),bitrate:t?Me(E,i):i};g&&(b.channels=""+g),f.push(b)})}return f},s):s},[]):[]}function Me(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 ke(a){return Math.ceil(Math.max(a.bitrate*.9,a.averageBitrate)/1e3)*1e3||1}function St(a){let e="";const{audio:t,video:n}=a;if(n){const r=wn(n.contentType);e+=`${r}_r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction||"sd"}_${Math.ceil(n.bitrate/1e5)}`}if(t){const r=wn(t.contentType);e+=`${n?"_":""}${r}_c${t.channels}`}return e}const st=["NONE","TYPE-0","TYPE-1",null];function xt(a){return st.indexOf(a)>-1}const Tt=["SDR","PQ","HLG"];function Et(a){return!!a&&Tt.indexOf(a)>-1}var kt={No:"",Yes:"YES",v2:"v2"};function jt(a){const{canSkipUntil:e,canSkipDateRanges:t,age:n}=a,r=n<e/2;return e&&r?t?kt.v2:kt.Yes:kt.No}class At{constructor(e,t,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=n}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 Pt{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(n=>!!n).map(n=>n.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;const n=(t=e.supplemental)==null?void 0:t.videoCodec;n&&n!==e.videoCodec&&(this.codecSet+=`,${n.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 Gt(this._audioGroups,e)}hasSubtitleGroup(e){return Gt(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let n=this._audioGroups;n||(n=this._audioGroups=[]),n.indexOf(t)===-1&&n.push(t)}else if(e==="text"){let n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),n.indexOf(t)===-1&&n.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 Gt(a,e){return!e||!a?!1:a.indexOf(e)!==-1}function Ft(){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 dt(a,e){let t=!1,n=[];if(a&&(t=a!=="SDR",n=[a]),e){n=e.allowedVideoRanges||Tt.slice(0);const r=n.join("")!=="SDR"&&!e.videoCodec;t=e.preferHDR!==void 0?e.preferHDR:r&&Ft(),t||(n=["SDR"])}return{preferHDR:t,allowedVideoRanges:n}}const Re=a=>{const e=new WeakSet;return(t,n)=>{if(a&&(n=a(t,n)),typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}},$e=(a,e)=>JSON.stringify(a,Re(e));function Qe(a,e,t,n,r){const i=Object.keys(a),s=n==null?void 0:n.channels,o=n==null?void 0:n.audioCodec,c=r==null?void 0:r.videoCodec,u=s&&parseInt(s)===2;let f=!1,d=!1,g=1/0,E=1/0,b=1/0,M=1/0,O=0,ae=[];const{preferHDR:he,allowedVideoRanges:_e}=dt(e,r);for(let ot=i.length;ot--;){const at=a[i[ot]];f||(f=at.channels[2]>0),g=Math.min(g,at.minHeight),E=Math.min(E,at.minFramerate),b=Math.min(b,at.minBitrate),_e.filter(Nt=>at.videoRanges[Nt]>0).length>0&&(d=!0)}g=L(g)?g:0,E=L(E)?E:0;const Ke=Math.max(1080,g),We=Math.max(30,E);b=L(b)?b:t,t=Math.max(b,t),d||(e=void 0);const mt=i.length>1;return{codecSet:i.reduce((ot,at)=>{const Je=a[at];if(at===ot)return ot;if(ae=d?_e.filter(Nt=>Je.videoRanges[Nt]>0):[],mt){if(Je.minBitrate>t)return Xe(at,`min bitrate of ${Je.minBitrate} > current estimate of ${t}`),ot;if(!Je.hasDefaultAudio)return Xe(at,"no renditions with default or auto-select sound found"),ot;if(o&&at.indexOf(o.substring(0,4))%5!==0)return Xe(at,`audio codec preference "${o}" not found`),ot;if(s&&!u){if(!Je.channels[s])return Xe(at,`no renditions with ${s} channel sound found (channels options: ${Object.keys(Je.channels)})`),ot}else if((!o||u)&&f&&Je.channels[2]===0)return Xe(at,"no renditions with stereo sound found"),ot;if(Je.minHeight>Ke)return Xe(at,`min resolution of ${Je.minHeight} > maximum of ${Ke}`),ot;if(Je.minFramerate>We)return Xe(at,`min framerate of ${Je.minFramerate} > maximum of ${We}`),ot;if(!ae.some(Nt=>Je.videoRanges[Nt]>0))return Xe(at,`no variants with VIDEO-RANGE of ${$e(ae)} found`),ot;if(c&&at.indexOf(c.substring(0,4))%5!==0)return Xe(at,`video codec preference "${c}" not found`),ot;if(Je.maxScore<O)return Xe(at,`max score of ${Je.maxScore} < selected max of ${O}`),ot}return ot&&(pe(at)>=pe(ot)||Je.fragmentError>a[ot].fragmentError)?ot:(M=Je.minIndex,O=Je.maxScore,at)},void 0),videoRanges:ae,preferHDR:he,minFramerate:E,minBitrate:b,minIndex:M}}function Xe(a,e){X.log(`[abr] start candidates with "${a}" ignored because ${e}`)}function gt(a){return a.reduce((e,t)=>{let n=e.groups[t.groupId];n||(n=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),n.tracks.push(t);const r=t.channels||"2";return n.channels[r]=(n.channels[r]||0)+1,n.hasDefault=n.hasDefault||t.default,n.hasAutoSelect=n.hasAutoSelect||t.autoselect,n.hasDefault&&(e.hasDefaultAudio=!0),n.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function pt(a,e,t,n){return a.slice(t,n+1).reduce((r,i,s)=>{if(!i.codecSet)return r;const o=i.audioGroups;let c=r[i.codecSet];c||(r[i.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:s,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!o,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,i.bitrate);const u=Math.min(i.height,i.width);return c.minHeight=Math.min(c.minHeight,u),c.minFramerate=Math.min(c.minFramerate,i.frameRate),c.minIndex=Math.min(c.minIndex,s),c.maxScore=Math.max(c.maxScore,i.score),c.fragmentError+=i.fragmentError,c.videoRanges[i.videoRange]=(c.videoRanges[i.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(g=>{c.channels[g]=(c.channels[g]||0)+d.channels[g]}))}),r},{})}function Rt(a){if(!a)return a;const{lang:e,assocLang:t,characteristics:n,channels:r,audioCodec:i}=a;return{lang:e,assocLang:t,characteristics:n,channels:r,audioCodec:i}}function Kt(a,e,t){if("attrs"in a){const n=e.indexOf(a);if(n!==-1)return n}for(let n=0;n<e.length;n++){const r=e[n];if(Ht(a,r,t))return n}return-1}function Ht(a,e,t){const{groupId:n,name:r,lang:i,assocLang:s,default:o}=a,c=a.forced;return(n===void 0||e.groupId===n)&&(r===void 0||e.name===r)&&(i===void 0||tn(i,e.lang))&&(i===void 0||e.assocLang===s)&&(o===void 0||e.default===o)&&(c===void 0||e.forced===c)&&(!("characteristics"in a)||$n(a.characteristics||"",e.characteristics))&&(t===void 0||t(a,e))}function tn(a,e="--"){return a.length===e.length?a===e:a.startsWith(e)||e.startsWith(a)}function $n(a,e=""){const t=a.split(","),n=e.split(",");return t.length===n.length&&!t.some(r=>n.indexOf(r)===-1)}function Vt(a,e){const{audioCodec:t,channels:n}=a;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(n===void 0||n===(e.channels||"2"))}function un(a,e,t,n,r){const i=e[n],o=e.reduce((g,E,b)=>{const M=E.uri;return(g[M]||(g[M]=[])).push(b),g},{})[i.uri];o.length>1&&(n=Math.max.apply(Math,o));const c=i.videoRange,u=i.frameRate,f=i.codecSet.substring(0,4),d=rn(e,n,g=>{if(g.videoRange!==c||g.frameRate!==u||g.codecSet.substring(0,4)!==f)return!1;const E=g.audioGroups,b=t.filter(M=>!E||E.indexOf(M.groupId)!==-1);return Kt(a,b,r)>-1});return d>-1?d:rn(e,n,g=>{const E=g.audioGroups,b=t.filter(M=>!E||E.indexOf(M.groupId)!==-1);return Kt(a,b,r)>-1})}function rn(a,e,t){for(let n=e;n>-1;n--)if(t(a[n]))return n;for(let n=e+1;n<a.length;n++)if(t(a[n]))return n;return-1}function fn(a,e){var t;return!!a&&a!==((t=e.loadLevelObj)==null?void 0:t.uri)}class Yt extends Z{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 n;const{fragCurrent:r,partCurrent:i,hls:s}=this,{autoLevelEnabled:o,media:c}=s;if(!r||!c)return;const u=performance.now(),f=i?i.stats:r.stats,d=i?i.duration:r.duration,g=u-f.loading.start,E=s.minAutoLevel,b=r.level,M=this._nextAutoLevel;if(f.aborted||f.loaded&&f.loaded===f.total||b<=E){this.clearTimer(),this._nextAutoLevel=-1;return}if(!o)return;const O=M>-1&&M!==b,ae=!!t||O;if(!ae&&(c.paused||!c.playbackRate||!c.readyState))return;const he=s.mainForwardBufferInfo;if(!ae&&he===null)return;const _e=this.bwEstimator.getEstimateTTFB(),Ke=Math.abs(c.playbackRate);if(g<=Math.max(_e,1e3*(d/(Ke*2))))return;const We=he?he.len/Ke:0,mt=f.loading.first?f.loading.first-f.loading.start:-1,He=f.loaded&&mt>-1,ot=this.getBwEstimate(),at=s.levels,Je=at[b],Nt=Math.max(f.loaded,Math.round(d*(r.bitrate||Je.averageBitrate)/8));let vn=He?g-mt:g;vn<1&&He&&(vn=Math.min(g,f.loaded*8/ot));const Rn=He?f.loaded*1e3/vn:0,Fn=_e/1e3,Cn=Rn?(Nt-f.loaded)/Rn:Nt*8/ot+Fn;if(Cn<=We)return;const ln=Rn?Rn*8:ot,Pn=((n=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:n.live)===!0,xn=this.hls.config.abrBandWidthUpFactor;let Mn=Number.POSITIVE_INFINITY,nr;for(nr=b-1;nr>E;nr--){const Ir=at[nr].maxBitrate,vr=!at[nr].details||Pn;if(Mn=this.getTimeToLoadFrag(Fn,ln,d*Ir,vr),Mn<Math.min(We,d+Fn))break}if(Mn>=Cn||Mn>d*10)return;He?this.bwEstimator.sample(g-Math.min(_e,mt),f.loaded):this.bwEstimator.sampleTTFB(g);const hn=at[nr].maxBitrate;this.getBwEstimate()*xn>hn&&this.resetEstimator(hn);const pn=this.findBestLevel(hn,E,nr,0,We,1,1);pn>-1&&(nr=pn),this.warn(`Fragment ${r.sn}${i?" part "+i.index:""} of level ${b} is loading too slowly;
Fragment duration: ${r.duration.toFixed(3)}
Time to underbuffer: ${We.toFixed(3)} s
Estimated load time for current fragment: ${Cn.toFixed(3)} s
Estimated load time for down switch fragment: ${Mn.toFixed(3)} s
TTFB estimate: ${mt|0} ms
Current BW estimate: ${L(ot)?ot|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${nr} @ ${hn|0} bps`),s.nextLoadLevel=s.nextAutoLevel=nr,this.clearTimer();const hr=()=>{if(this.clearTimer(),this.fragCurrent===r&&this.hls.loadLevel===nr&&nr>0){const Ir=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${nr>0?"and switching down":""}
Fragment duration: ${r.duration.toFixed(3)} s
Time to underbuffer: ${Ir.toFixed(3)} s`),r.abortRequests(),this.fragCurrent=this.partCurrent=null,nr>E){let vr=this.findBestLevel(this.hls.levels[E].bitrate,E,nr,0,Ir,1,1);vr===-1&&(vr=E),this.hls.nextLoadLevel=this.hls.nextAutoLevel=vr,this.resetEstimator(this.hls.levels[vr].bitrate)}}};O||Cn>Mn*2?hr():this.timer=self.setInterval(hr,Mn*1e3),s.trigger(p.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:i,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 x(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 n=t.frag;if(!this.ignoreFragment(n)){if(!n.bitrateTest){var r;this.fragCurrent=n,this.partCurrent=(r=t.part)!=null?r: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 $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case $.FRAG_LOAD_TIMEOUT:{const n=t.frag,{fragCurrent:r,partCurrent:i}=this;if(n&&r&&n.sn===r.sn&&n.level===r.level){const s=performance.now(),o=i?i.stats:n.stats,c=s-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,n,r){const i=e+n/t,s=r?e+this.lastLevelLoadSec:0;return i+s}onLevelLoaded(e,t){const n=this.hls.config,{loading:r}=t.stats,i=r.end-r.first;L(i)&&(this.lastLevelLoadSec=i/1e3),t.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,{frag:t,part:n}){const r=n?n.stats:t.stats;if(t.type===le.MAIN&&this.bwEstimator.sampleTTFB(r.loading.first-r.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const i=n?n.duration:t.duration,s=this.hls.levels[t.level],o=(s.loaded?s.loaded.bytes:0)+r.loaded,c=(s.loaded?s.loaded.duration:0)+i;s.loaded={bytes:o,duration:c},s.realBitrate=Math.round(8*o/c)}if(t.bitrateTest){const i={stats:r,frag:t,part:n,id:t.type};this.onFragBuffered(p.FRAG_BUFFERED,i),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:n,part:r}=t,i=r!=null&&r.stats.loaded?r.stats:n.stats;if(i.aborted||this.ignoreFragment(n))return;const s=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,i.loaded),i.bwEstimate=this.getBwEstimate(),n.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==le.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,n=this.getBwEstimate(),r=this.hls.config.maxStarvationDelay,i=this.findBestLevel(n,t,e,0,r,1,1);if(i>-1)return i;const s=this.hls.firstLevel,o=Math.min(Math.max(s,t),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,n=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(e!==-1&&(!n||!r||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const i=n&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const s=this.hls.levels;if(s.length>Math.max(e,i)&&s[e].loadError<=s[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:n}=this;if(n.levels.length<=1)return n.loadLevel;const{maxAutoLevel:r,config:i,minAutoLevel:s}=n,o=t?t.duration:e?e.duration:0,c=this.getBwEstimate(),u=this.getStarvationDelay();let f=i.abrBandWidthFactor,d=i.abrBandWidthUpFactor;if(u){const O=this.findBestLevel(c,s,r,u,0,f,d);if(O>=0)return this.rebufferNotice=-1,O}let g=o?Math.min(o,i.maxStarvationDelay):i.maxStarvationDelay;if(!u){const O=this.bitrateTestDelay;O&&(g=(o?Math.min(o,i.maxLoadingDelay):i.maxLoadingDelay)-O,this.info(`bitrate test took ${Math.round(1e3*O)}ms, set first fragment max fetchDuration to ${Math.round(1e3*g)} ms`),f=d=1)}const E=this.findBestLevel(c,s,r,u,g,f,d);if(this.rebufferNotice!==E&&(this.rebufferNotice=E,this.info(`${u?"rebuffering expected":"buffer is empty"}, optimal quality level ${E}`)),E>-1)return E;const b=n.levels[s],M=n.loadLevelObj;return M&&(b==null?void 0:b.bitrate)<M.bitrate?s:n.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const n=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/n}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,n,r,i,s,o){var c;const u=r+i,f=this.lastLoadedFragLevel,d=f===-1?this.hls.firstLevel:f,{fragCurrent:g,partCurrent:E}=this,{levels:b,allAudioTracks:M,loadLevel:O,config:ae}=this.hls;if(b.length===1)return 0;const he=b[d],_e=!!((c=this.hls.latestLevelDetails)!=null&&c.live),Ke=O===-1||f===-1;let We,mt="SDR",He=(he==null?void 0:he.frameRate)||0;const{audioPreference:ot,videoPreference:at}=ae,Je=this.audioTracksByGroup||(this.audioTracksByGroup=gt(M));let Nt=-1;if(Ke){if(this.firstSelection!==-1)return this.firstSelection;const ln=this.codecTiers||(this.codecTiers=pt(b,Je,t,n)),Pn=Qe(ln,mt,e,ot,at),{codecSet:xn,videoRanges:Mn,minFramerate:nr,minBitrate:hn,minIndex:pn,preferHDR:hr}=Pn;Nt=pn,We=xn,mt=hr?Mn[Mn.length-1]:Mn[0],He=nr,e=Math.max(e,hn),this.log(`picked start tier ${$e(Pn)}`)}else We=he==null?void 0:he.codecSet,mt=he==null?void 0:he.videoRange;const vn=E?E.duration:g?g.duration:0,Rn=this.bwEstimator.getEstimateTTFB()/1e3,Fn=[];for(let ln=n;ln>=t;ln--){var Cn;const Pn=b[ln],xn=ln>d;if(!Pn)continue;if(ae.useMediaCapabilities&&!Pn.supportedResult&&!Pn.supportedPromise){const vr=navigator.mediaCapabilities;typeof(vr==null?void 0:vr.decodingInfo)=="function"&&ht(Pn,Je,mt,He,e,ot)?(Pn.supportedPromise=Zt(Pn,Je,vr,this.supportedCache),Pn.supportedPromise.then(xr=>{if(!this.hls)return;Pn.supportedResult=xr;const ni=this.hls.levels,Yr=ni.indexOf(Pn);xr.error?this.warn(`MediaCapabilities decodingInfo error: "${xr.error}" for level ${Yr} ${$e(xr)}`):xr.supported?xr.decodingInfoResults.some(vi=>vi.smooth===!1||vi.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${Yr} not smooth or powerEfficient: ${$e(xr)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${Yr} ${$e(xr)}`),Yr>-1&&ni.length>1&&(this.log(`Removing unsupported level ${Yr}`),this.hls.removeLevel(Yr),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(xr=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${xr}`)})):Pn.supportedResult=Nn}if((We&&Pn.codecSet!==We||mt&&Pn.videoRange!==mt||xn&&He>Pn.frameRate||!xn&&He>0&&He<Pn.frameRate||(Cn=Pn.supportedResult)!=null&&(Cn=Cn.decodingInfoResults)!=null&&Cn.some(vr=>vr.smooth===!1))&&(!Ke||ln!==Nt)){Fn.push(ln);continue}const Mn=Pn.details,nr=(E?Mn==null?void 0:Mn.partTarget:Mn==null?void 0:Mn.averagetargetduration)||vn;let hn;xn?hn=o*e:hn=s*e;const pn=vn&&r>=vn*2&&i===0?Pn.averageBitrate:Pn.maxBitrate,hr=this.getTimeToLoadFrag(Rn,hn,pn*nr,Mn===void 0);if(hn>=pn&&(ln===f||Pn.loadError===0&&Pn.fragmentError===0)&&(hr<=Rn||!L(hr)||_e&&!this.bitrateTestDelay||hr<u)){const vr=this.forcedAutoLevel;return ln!==O&&(vr===-1||vr!==O)&&(Fn.length&&this.trace(`Skipped level(s) ${Fn.join(",")} of ${n} max with CODECS and VIDEO-RANGE:"${b[Fn[0]].codecs}" ${b[Fn[0]].videoRange}; not compatible with "${We}" ${mt}`),this.info(`switch candidate:${d}->${ln} adjustedbw(${Math.round(hn)})-bitrate=${Math.round(hn-pn)} ttfb:${Rn.toFixed(1)} avgDuration:${nr.toFixed(1)} maxFetchDuration:${u.toFixed(1)} fetchDuration:${hr.toFixed(1)} firstSelection:${Ke} codecSet:${Pn.codecSet} videoRange:${Pn.videoRange} hls.loadLevel:${O}`)),Ke&&(this.firstSelection=ln),ln}}return-1}set nextAutoLevel(e){const t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:n}=this.hls;return Math.min(Math.max(e,n),t)}}const Bt={search:function(a,e){let t=0,n=a.length-1,r=null,i=null;for(;t<=n;){r=(t+n)/2|0,i=a[r];const s=e(i);if(s>0)t=r+1;else if(s<0)n=r-1;else return i}return null}};function Wt(a,e,t){if(e===null||!Array.isArray(a)||!a.length||!L(e))return null;const n=a[0].programDateTime;if(e<(n||0))return null;const r=a[a.length-1].endProgramDateTime;if(e>=(r||0))return null;for(let i=0;i<a.length;++i){const s=a[i];if(En(e,t,s))return s}return null}function Jt(a,e,t=0,n=0,r=.005){let i=null;if(a){i=e[1+a.sn-e[0].sn]||null;const o=a.endDTS-t;o>0&&o<15e-7&&(t+=15e-7),i&&a.level!==i.level&&i.end<=a.end&&(i=e[2+a.sn-e[0].sn]||null)}else t===0&&e[0].start===0&&(i=e[0]);if(i&&((!a||a.level===i.level)&&cn(t,n,i)===0||an(i,a,Math.min(r,n))))return i;const s=Bt.search(e,cn.bind(null,t,n));return s&&(s!==a||!i)?s:i}function an(a,e,t){if(e&&e.start===0&&e.level<a.level&&(e.endPTS||0)>0){const n=e.tagList.reduce((r,i)=>(i[0]==="INF"&&(r+=parseFloat(i[1])),r),t);return a.start<=n}return!1}function cn(a=0,e=0,t){if(t.start<=a&&t.start+t.duration>a)return 0;const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-n<=a?1:t.start-n>a&&t.start?-1:0}function En(a,e,t){const n=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-n>a}function mn(a,e,t){if(a&&a.startCC<=e&&a.endCC>=e){let n=a.fragments;const{fragmentHint:r}=a;r&&(n=n.concat(r));let i;return Bt.search(n,s=>s.cc<e?1:s.cc>e?-1:(i=s,s.end<=t?1:s.start>t?-1:0)),i||null}return null}function on(a){switch(a.details){case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_TIMEOUT:case $.LEVEL_LOAD_TIMEOUT:case $.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function jn(a){return a.details.startsWith("key")}function Qn(a){return jn(a)&&!!a.frag&&!a.frag.decryptdata}function or(a,e){const t=on(e);return a.default[`${t?"timeout":"error"}Retry`]}function Vn(a,e){const t=a.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*a.retryDelayMs,a.maxRetryDelayMs)}function ir(a){return y(y({},a),{errorRetry:null,timeoutRetry:null})}function Jn(a,e,t,n){if(!a)return!1;const r=n==null?void 0:n.code,i=e<a.maxNumRetry&&(_r(r)||!!t);return a.shouldRetry?a.shouldRetry(a,e,t,n,i):i}function _r(a){return ur(a)||!!a&&(a<400||a>499)}function ur(a){return a===0&&navigator.onLine===!1}var On={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},sn={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class Dt extends Z{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)===le.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const t=this.hls,n=t.currentLevel;return(e=t.loadLevelObj)!=null&&e.details||n===-1?t.loadLevel:n}variantHasKey(e,t){if(e){var n;if((n=e.details)!=null&&n.hasKey(t))return!0;const r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(s=>r.indexOf(s.groupId)>=0).some(s=>{var o;return(o=s.details)==null?void 0:o.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var n;if(t.fatal)return;const r=this.hls,i=t.context;switch(t.details){case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case $.FRAG_PARSING_ERROR:if((n=t.frag)!=null&&n.gap){t.errorAction=bt();return}case $.FRAG_GAP:case $.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=On.SendAlternateToPenaltyBox;return}case $.LEVEL_EMPTY_ERROR:case $.LEVEL_PARSING_ERROR:{var s;const c=t.parent===le.MAIN?t.level:r.loadLevel;t.details===$.LEVEL_EMPTY_ERROR&&((s=t.context)!=null&&(s=s.levelDetails)!=null&&s.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,c):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,c))}return;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:typeof(i==null?void 0:i.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.level));return;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.SUBTITLE_LOAD_ERROR:case $.SUBTITLE_TRACK_LOAD_TIMEOUT:if(i){const c=r.loadLevelObj;if(c&&(i.type===ge.AUDIO_TRACK&&c.hasAudioGroup(i.groupId)||i.type===ge.SUBTITLE_TRACK&&c.hasSubtitleGroup(i.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=On.SendAlternateToPenaltyBox,t.errorAction.flags=sn.MoveAllAlternatesMatchingHost;return}}return;case $.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:On.SendAlternateToPenaltyBox,flags:sn.MoveAllAlternatesMatchingHDCP};return;case $.KEY_SYSTEM_SESSION_UPDATE_FAILED:case $.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case $.KEY_SYSTEM_NO_SESSION:t.errorAction={action:On.SendAlternateToPenaltyBox,flags:sn.MoveAllAlternatesMatchingKey};return;case $.BUFFER_ADD_CODEC_ERROR:case $.REMUX_ALLOC_ERROR:case $.BUFFER_APPEND_ERROR:if(!t.errorAction){var o;t.errorAction=this.getLevelSwitchAction(t,(o=t.level)!=null?o:r.loadLevel)}return;case $.INTERNAL_EXCEPTION:case $.BUFFER_APPENDING_ERROR:case $.BUFFER_FULL_ERROR:case $.LEVEL_SWITCH_ERROR:case $.BUFFER_STALLED_ERROR:case $.BUFFER_SEEK_OVER_HOLE:case $.BUFFER_NUDGE_ON_STALL:t.errorAction=bt();return}t.type===ue.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=bt())}getPlaylistRetryOrSwitchAction(e,t){const n=this.hls,r=or(n.config.playlistLoadPolicy,e),i=this.playlistError++;if(Jn(r,i,on(e),e.response))return{action:On.RetryRequest,flags:sn.None,retryConfig:r,retryCount:i};const o=this.getLevelSwitchAction(e,t);return r&&(o.retryConfig=r,o.retryCount=i),o}getFragRetryOrSwitchAction(e){const t=this.hls,n=this.getVariantLevelIndex(e.frag),r=t.levels[n],{fragLoadPolicy:i,keyLoadPolicy:s}=t.config,o=or(jn(e)?s:i,e),c=t.levels.reduce((f,d)=>f+d.fragmentError,0);if(r&&(e.details!==$.FRAG_GAP&&r.fragmentError++,!Qn(e)&&Jn(o,c,on(e),e.response)))return{action:On.RetryRequest,flags:sn.None,retryConfig:o,retryCount:c};const u=this.getLevelSwitchAction(e,n);return o&&(u.retryConfig=o,u.retryCount=c),u}getLevelSwitchAction(e,t){const n=this.hls;t==null&&(t=n.loadLevel);const r=this.hls.levels[t];if(r){var i,s;const u=e.details;r.loadError++,u===$.BUFFER_APPEND_ERROR&&r.fragmentError++;let f=-1;const{levels:d,loadLevel:g,minAutoLevel:E,maxAutoLevel:b}=n;!n.autoLevelEnabled&&!n.config.preserveManualLevelOnError&&(n.loadLevel=-1);const M=(i=e.frag)==null?void 0:i.type,ae=(M===le.AUDIO&&u===$.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(u===$.BUFFER_ADD_CODEC_ERROR||u===$.BUFFER_APPEND_ERROR))&&d.some(({audioCodec:mt})=>r.audioCodec!==mt),_e=e.sourceBufferName==="video"&&(u===$.BUFFER_ADD_CODEC_ERROR||u===$.BUFFER_APPEND_ERROR)&&d.some(({codecSet:mt,audioCodec:He})=>r.codecSet!==mt&&r.audioCodec===He),{type:Ke,groupId:We}=(s=e.context)!=null?s:{};for(let mt=d.length;mt--;){const He=(mt+g)%d.length;if(He!==g&&He>=E&&He<=b&&d[He].loadError===0){var o,c;const ot=d[He];if(u===$.FRAG_GAP&&M===le.MAIN&&e.frag){const at=d[He].details;if(at){const Je=Jt(e.frag,at.fragments,e.frag.start);if(Je!=null&&Je.gap)continue}}else{if(Ke===ge.AUDIO_TRACK&&ot.hasAudioGroup(We)||Ke===ge.SUBTITLE_TRACK&&ot.hasSubtitleGroup(We))continue;if(M===le.AUDIO&&(o=r.audioGroups)!=null&&o.some(at=>ot.hasAudioGroup(at))||M===le.SUBTITLE&&(c=r.subtitleGroups)!=null&&c.some(at=>ot.hasSubtitleGroup(at))||ae&&r.audioCodec===ot.audioCodec||_e&&r.codecSet===ot.codecSet||!ae&&r.codecSet!==ot.codecSet)continue}f=He;break}}if(f>-1&&n.loadLevel!==f)return e.levelRetry=!0,this.playlistError=0,{action:On.SendAlternateToPenaltyBox,flags:sn.None,nextAutoLevel:f}}return{action:On.SendAlternateToPenaltyBox,flags:sn.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var n;switch((n=t.errorAction)==null?void 0:n.action){case On.DoNothing:break;case On.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==$.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 On.RetryRequest:break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,n=e.errorAction;if(!n)return;const{flags:r}=n,i=n.nextAutoLevel;switch(r){case sn.None:this.switchLevel(e,i);break;case sn.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),u=t.levels[c],f=u==null?void 0:u.attrs["HDCP-LEVEL"];if(n.hdcpLevel=f,f==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(f){t.maxHdcpLevel=st[st.indexOf(f)-1],n.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}}case sn.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const u=this.hls.levels,f=u.length;for(let g=f;g--;)if(this.variantHasKey(u[g],c)){var s,o;this.log(`Banned key found in level ${g} (${u[g].bitrate}bps) or audio group "${(s=u[g].audioGroups)==null?void 0:s.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${V(c.keyId||[])}`),u[g].fragmentError++,u[g].loadError++,this.log(`Removing level ${g} with key error (${e.error})`),this.hls.removeLevel(g)}const d=e.frag;if(this.hls.levels.length<f)n.resolved=!0;else if(d&&d.type!==le.MAIN){const g=d.decryptdata;g&&!c.matches(g)&&(n.resolved=!0)}}break}}n.resolved||this.switchLevel(e,i)}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===$.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const n=wn(e.mimeType),r=this.hls.levels;for(let i=r.length;i--;)r[i][`${e.sourceBufferName}Codec`]===n&&(this.log(`Removing level ${i} for ${e.details} ("${n}" not supported)`),this.hls.removeLevel(i))}}}function bt(a){const e={action:On.DoNothing,flags:sn.None};return a&&(e.resolved=!0),e}var $t={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Qt{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 n=this.activePartLists[t];if(n)for(let r=n.length;r--;){const i=n[r];if(!i)break;if(i.start<=e&&e<=i.end&&i.loaded)return i}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,n){const{fragments:r}=this,i=Object.keys(r);for(let s=i.length;s--;){const o=r[i[s]];if((o==null?void 0:o.body.type)===t&&(!n||o.buffered)){const c=o.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,t,n,r,i){this.timeRanges&&(this.timeRanges[e]=t);const s=(r==null?void 0:r.fragment.sn)||-1;Object.keys(this.fragments).forEach(o=>{const c=this.fragments[o];if(!c||s>=c.body.sn)return;if(!c.buffered&&(!c.loaded||i)){c.body.type===n&&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 n=e.frag,r=Kn(n),i=this.fragments[r];if(!i||i.buffered&&n.gap)return;const s=!n.relurl;Object.keys(t).forEach(o=>{const c=n.elementaryStreams[o];if(!c)return;const u=t[o],f=s||c.partial===!0;i.range[o]=this.getBufferedTimes(n,e.part,f,u)}),i.loaded=null,Object.keys(i.range).length?(i.buffered=!0,(i.body.endList=n.endList||i.body.endList)&&(this.endListFragments[i.body.type]=i),bn(i)||this.removeParts(n.sn-1,n.type)):this.removeFragment(i.body)}removeParts(e,t){const n=this.activePartLists[t];n&&(this.activePartLists[t]=tr(n,r=>r.fragment.sn>=e))}fragBuffered(e,t){const n=Kn(e);let r=this.fragments[n];!r&&t&&(r=this.fragments[n]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,r.buffered=!0)}getBufferedTimes(e,t,n,r){const i={time:[],partial:n},s=e.start,o=e.end,c=e.minEndPTS||o,u=e.maxStartPTS||s;for(let f=0;f<r.length;f++){const d=r.start(f)-this.bufferPadding,g=r.end(f)+this.bufferPadding;if(u>=d&&c<=g){i.time.push({startPTS:Math.max(s,r.start(f)),endPTS:Math.min(o,r.end(f))});break}else if(s<g&&o>d){const E=Math.max(s,r.start(f)),b=Math.min(o,r.end(f));b>E&&(i.partial=!0,i.time.push({startPTS:E,endPTS:b}))}else if(o<=d)break}return i}getPartialFragment(e){let t=null,n,r,i,s=0;const{bufferPadding:o,fragments:c}=this;return Object.keys(c).forEach(u=>{const f=c[u];f&&bn(f)&&(r=f.body.start-o,i=f.body.end+o,e>=r&&e<=i&&(n=Math.min(e-r,i-e),s<=n&&(t=f.body,s=n)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||bn(t))}getState(e){const t=Kn(e),n=this.fragments[t];return n?n.buffered?bn(n)?$t.PARTIAL:$t.OK:$t.APPENDING:$t.NOT_LOADED}isTimeBuffered(e,t,n){let r,i;for(let s=0;s<n.length;s++){if(r=n.start(s)-this.bufferPadding,i=n.end(s)+this.bufferPadding,e>=r&&t<=i)return!0;if(t<=r)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(t.frag.sn==="initSegment"||t.frag.bitrateTest)return;const n=t.frag,r=t.part?null:t,i=Kn(n);this.fragments[i]={body:n,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:n,part:r,timeRanges:i,type:s}=t;if(n.sn==="initSegment")return;const o=n.type;if(r){let u=this.activePartLists[o];u||(this.activePartLists[o]=u=[]),u.push(r)}this.timeRanges=i;const c=i[s];this.detectEvictedFragments(s,c,o,r)}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Kn(e);return!!this.fragments[t]}hasFragments(e){const{fragments:t}=this,n=Object.keys(t);if(!e)return n.length>0;for(let r=n.length;r--;){const i=t[n[r]];if((i==null?void 0:i.body.type)===e)return!0}return!1}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,n,r,i){r&&!this.hasGaps||Object.keys(this.fragments).forEach(s=>{const o=this.fragments[s];if(!o)return;const c=o.body;c.type!==n||r&&!c.gap||c.start<t&&c.end>e&&(o.buffered||i)&&this.removeFragment(c)})}removeFragment(e){const t=Kn(e);e.clearElementaryStreamInfo();const n=this.activePartLists[e.type];if(n){const r=e.sn;this.activePartLists[e.type]=tr(n,i=>i.fragment.sn!==r)}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(n=>n.clearElementaryStreamInfo())}}function bn(a){var e,t,n;return a.buffered&&!!(a.body.gap||(e=a.range.video)!=null&&e.partial||(t=a.range.audio)!=null&&t.partial||(n=a.range.audiovideo)!=null&&n.partial)}function Kn(a){return`${a.type}_${a.level}_${a.sn}`}function tr(a,e){return a.filter(t=>{const n=e(t);return n||t.clearElementaryStreamInfo(),n})}var Xt={cbc:0,ctr:1};class Tn{constructor(e,t,n){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=n}decrypt(e,t){switch(this.aesMode){case Xt.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case Xt.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 Bn(a){const e=a.byteLength,t=e&&new DataView(a.buffer).getUint8(e-1);return t?a.slice(0,e-t):a}class Zn{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),n=new Uint32Array(4);for(let r=0;r<4;r++)n[r]=t.getUint32(r*4);return n}initTable(){const e=this.sBox,t=this.invSBox,n=this.subMix,r=n[0],i=n[1],s=n[2],o=n[3],c=this.invSubMix,u=c[0],f=c[1],d=c[2],g=c[3],E=new Uint32Array(256);let b=0,M=0,O=0;for(O=0;O<256;O++)O<128?E[O]=O<<1:E[O]=O<<1^283;for(O=0;O<256;O++){let ae=M^M<<1^M<<2^M<<3^M<<4;ae=ae>>>8^ae&255^99,e[b]=ae,t[ae]=b;const he=E[b],_e=E[he],Ke=E[_e];let We=E[ae]*257^ae*16843008;r[b]=We<<24|We>>>8,i[b]=We<<16|We>>>16,s[b]=We<<8|We>>>24,o[b]=We,We=Ke*16843009^_e*65537^he*257^b*16843008,u[ae]=We<<24|We>>>8,f[ae]=We<<16|We>>>16,d[ae]=We<<8|We>>>24,g[ae]=We,b?(b=he^E[E[E[Ke^he]]],M^=E[E[M]]):b=M=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let n=!0,r=0;for(;r<t.length&&n;)n=t[r]===this.key[r],r++;if(n)return;this.key=t;const i=this.keySize=t.length;if(i!==4&&i!==6&&i!==8)throw new Error("Invalid aes key size="+i);const s=this.ksRows=(i+6+1)*4;let o,c;const u=this.keySchedule=new Uint32Array(s),f=this.invKeySchedule=new Uint32Array(s),d=this.sBox,g=this.rcon,E=this.invSubMix,b=E[0],M=E[1],O=E[2],ae=E[3];let he,_e;for(o=0;o<s;o++){if(o<i){he=u[o]=t[o];continue}_e=he,o%i===0?(_e=_e<<8|_e>>>24,_e=d[_e>>>24]<<24|d[_e>>>16&255]<<16|d[_e>>>8&255]<<8|d[_e&255],_e^=g[o/i|0]<<24):i>6&&o%i===4&&(_e=d[_e>>>24]<<24|d[_e>>>16&255]<<16|d[_e>>>8&255]<<8|d[_e&255]),u[o]=he=(u[o-i]^_e)>>>0}for(c=0;c<s;c++)o=s-c,c&3?_e=u[o]:_e=u[o-4],c<4||o<=4?f[c]=_e:f[c]=b[d[_e>>>24]]^M[d[_e>>>16&255]]^O[d[_e>>>8&255]]^ae[d[_e&255]],f[c]=f[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,n){const r=this.keySize+6,i=this.invKeySchedule,s=this.invSBox,o=this.invSubMix,c=o[0],u=o[1],f=o[2],d=o[3],g=this.uint8ArrayToUint32Array_(n);let E=g[0],b=g[1],M=g[2],O=g[3];const ae=new Int32Array(e),he=new Int32Array(ae.length);let _e,Ke,We,mt,He,ot,at,Je,Nt,vn,Rn,Fn,Cn,ln;const Pn=this.networkToHostOrderSwap;for(;t<ae.length;){for(Nt=Pn(ae[t]),vn=Pn(ae[t+1]),Rn=Pn(ae[t+2]),Fn=Pn(ae[t+3]),He=Nt^i[0],ot=Fn^i[1],at=Rn^i[2],Je=vn^i[3],Cn=4,ln=1;ln<r;ln++)_e=c[He>>>24]^u[ot>>16&255]^f[at>>8&255]^d[Je&255]^i[Cn],Ke=c[ot>>>24]^u[at>>16&255]^f[Je>>8&255]^d[He&255]^i[Cn+1],We=c[at>>>24]^u[Je>>16&255]^f[He>>8&255]^d[ot&255]^i[Cn+2],mt=c[Je>>>24]^u[He>>16&255]^f[ot>>8&255]^d[at&255]^i[Cn+3],He=_e,ot=Ke,at=We,Je=mt,Cn=Cn+4;_e=s[He>>>24]<<24^s[ot>>16&255]<<16^s[at>>8&255]<<8^s[Je&255]^i[Cn],Ke=s[ot>>>24]<<24^s[at>>16&255]<<16^s[Je>>8&255]<<8^s[He&255]^i[Cn+1],We=s[at>>>24]<<24^s[Je>>16&255]<<16^s[He>>8&255]<<8^s[ot&255]^i[Cn+2],mt=s[Je>>>24]<<24^s[He>>16&255]<<16^s[ot>>8&255]<<8^s[at&255]^i[Cn+3],he[t]=Pn(_e^E),he[t+1]=Pn(mt^b),he[t+2]=Pn(We^M),he[t+3]=Pn(Ke^O),E=Nt,b=vn,M=Rn,O=Fn,t=t+4}return he.buffer}}class pr{constructor(e,t,n){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=n}expandKey(){const e=An(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function An(a){switch(a){case Xt.cbc:return"AES-CBC";case Xt.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${a}`)}}const Yn=16;class Xn{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 n=self.crypto;n&&(this.subtle=n.subtle||n.webkitSubtle)}catch(n){}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 n=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?Bn(n):n}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,n,r){return this.useSoftware?new Promise((i,s)=>{const o=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(o,t,n,r);const c=this.flush();c?i(c.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,n,r)}softwareDecrypt(e,t,n,r){const{currentIV:i,currentResult:s,remainderData:o}=this;if(r!==Xt.cbc||t.byteLength!==16)return X.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),o&&(e=Ce(o,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;i&&(n=i);let u=this.softwareDecrypter;u||(u=this.softwareDecrypter=new Zn),u.expandKey(t);const f=s;return this.currentResult=u.decrypt(c.buffer,0,n),this.currentIV=c.slice(-16).buffer,f||null}webCryptoDecrypt(e,t,n,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,n,r));this.key=t,this.fastAesKey=new pr(this.subtle,t,r)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Tn(this.subtle,new Uint8Array(n),r).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(X.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,t,n,r)))}onWebCryptoError(e,t,n,r){const i=this.enableSoftwareAES;if(i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,n,r);const s=this.flush();if(s)return s.buffer}throw new Error("WebCrypto"+(i?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e;const n=e.length-e.length%Yn;return n!==e.length&&(t=e.slice(0,n),this.remainderData=e.slice(n)),t}logOnce(e){this.logEnabled&&(X.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const cr=Math.pow(2,17);class sr{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 n=e.url;if(!n)return Promise.reject(new Sr({type:ue.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${n?"part list":"url"}`),networkDetails:null}));this.abort();const r=this.config,i=r.fLoader,s=r.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(b=>b[0]==="GAP")){c(fr(e));return}else e.gap=!1;const u=this.loader=i?new i(r):new s(r),f=gr(e);e.loader=u;const d=ir(r.fragLoadPolicy.default),g={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:cr};e.stats=u.stats;const E={onSuccess:(b,M,O,ae)=>{this.resetLoader(e,u);let he=b.data;O.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(he.slice(0,16)),he=he.slice(16)),o({frag:e,part:null,payload:he,networkDetails:ae})},onError:(b,M,O,ae)=>{this.resetLoader(e,u),c(new Sr({type:ue.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:y({url:n,data:void 0},b),error:new Error(`HTTP Error ${b.code} ${b.text}`),networkDetails:O,stats:ae}))},onAbort:(b,M,O)=>{this.resetLoader(e,u),c(new Sr({type:ue.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:O,stats:b}))},onTimeout:(b,M,O)=>{this.resetLoader(e,u),c(new Sr({type:ue.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:O,stats:b}))}};t&&(E.onProgress=(b,M,O,ae)=>t({frag:e,part:null,payload:O,networkDetails:ae})),u.load(f,g,E)})}loadPart(e,t,n){this.abort();const r=this.config,i=r.fLoader,s=r.loader;return new Promise((o,c)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){c(fr(e,t));return}const u=this.loader=i?new i(r):new s(r),f=gr(e,t);e.loader=u;const d=ir(r.fragLoadPolicy.default),g={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:cr};t.stats=u.stats,u.load(f,g,{onSuccess:(E,b,M,O)=>{this.resetLoader(e,u),this.updateStatsFromPart(e,t);const ae={frag:e,part:t,payload:E.data,networkDetails:O};n(ae),o(ae)},onError:(E,b,M,O)=>{this.resetLoader(e,u),c(new Sr({type:ue.NETWORK_ERROR,details:$.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:y({url:f.url,data:void 0},E),error:new Error(`HTTP Error ${E.code} ${E.text}`),networkDetails:M,stats:O}))},onAbort:(E,b,M)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,u),c(new Sr({type:ue.NETWORK_ERROR,details:$.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:M,stats:E}))},onTimeout:(E,b,M)=>{this.resetLoader(e,u),c(new Sr({type:ue.NETWORK_ERROR,details:$.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${g.timeout}ms`),networkDetails:M,stats:E}))}})})}updateStatsFromPart(e,t){const n=e.stats,r=t.stats,i=r.total;if(n.loaded+=r.loaded,i){const c=Math.round(e.duration/t.duration),u=Math.min(Math.round(n.loaded/i),c),d=(c-u)*Math.round(n.loaded/u);n.total=n.loaded+d}else n.total=Math.max(n.loaded,n.total);const s=n.loading,o=r.loading;s.start?s.first+=o.first-o.start:(s.start=o.start,s.first=o.first),s.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function gr(a,e=null){const t=e||a,n={frag:a,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},r=t.byteRangeStartOffset,i=t.byteRangeEndOffset;if(L(r)&&L(i)){var s;let o=r,c=i;if(a.sn==="initSegment"&&Ar((s=a.decryptdata)==null?void 0:s.method)){const u=i-r;u%16&&(c=i+(16-u%16)),r!==0&&(n.resetIV=!0,o=r-16)}n.rangeStart=o,n.rangeEnd=c}return n}function fr(a,e){const t=new Error(`GAP ${a.gap?"tag":"attribute"} found`),n={type:ue.MEDIA_ERROR,details:$.FRAG_GAP,fatal:!1,frag:a,error:t,networkDetails:null};return e&&(n.part=e),(e||a).stats.aborted=!0,new Sr(n)}function Ar(a){return a==="AES-128"||a==="AES-256"}class Sr extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Or extends Z{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 br{constructor(e,t,n,r=0,i=-1,s=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=yr(),this.buffering={audio:yr(),video:yr(),audiovideo:yr()},this.level=e,this.sn=t,this.id=n,this.size=r,this.part=i,this.partial=s}}function yr(){return{start:0,executeStart:0,executeEnd:0,end:0}}const Vr={length:0,start:()=>0,end:()=>0};class In{static isBuffered(e,t){if(e){const n=In.getBuffered(e);for(let r=n.length;r--;)if(t>=n.start(r)&&t<=n.end(r))return!0}return!1}static bufferedRanges(e){if(e){const t=In.getBuffered(e);return In.timeRangesToArray(t)}return[]}static timeRangesToArray(e){const t=[];for(let n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t}static bufferInfo(e,t,n){if(e){const r=In.bufferedRanges(e);if(r.length)return In.bufferedInfo(r,t,n)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,n){t=Math.max(0,t),e.length>1&&e.sort((f,d)=>f.start-d.start||d.end-f.end);let r=-1,i=[];if(n)for(let f=0;f<e.length;f++){t>=e[f].start&&t<=e[f].end&&(r=f);const d=i.length;if(d){const g=i[d-1].end;e[f].start-g<n?e[f].end>g&&(i[d-1].end=e[f].end):i.push(e[f])}else i.push(e[f])}else i=e;let s=0,o,c=t,u=t;for(let f=0;f<i.length;f++){const d=i[f].start,g=i[f].end;if(r===-1&&t>=d&&t<=g&&(r=f),t+n>=d&&t<g)c=d,u=g,s=u-t;else if(t+n<d){o=d;break}}return{len:s,start:c||0,end:u||0,nextStart:o,buffered:e,bufferedIndex:r}}static getBuffered(e){try{return e.buffered||Vr}catch(t){return X.log("failed to get media.buffered",t),Vr}}}const zr=/\{\$([a-zA-Z0-9-_]+)\}/g;function Dr(a){return zr.test(a)}function ii(a,e){if(a.variableList!==null||a.hasVariableRefs){const t=a.variableList;return e.replace(zr,n=>{const r=n.substring(2,n.length-1),i=t==null?void 0:t[r];return i===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${r}"`)),n):i})}return e}function si(a,e,t){let n=a.variableList;n||(a.variableList=n={});let r,i;if("QUERYPARAM"in e){r=e.QUERYPARAM;try{const s=new self.URL(t).searchParams;if(s.has(r))i=s.get(r);else throw new Error(`"${r}" does not match any query parameter in URI: "${t}"`)}catch(s){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${s.message}`))}}else r=e.NAME,i=e.VALUE;r in n?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${r}"`)):n[r]=i||""}function Xr(a,e,t){const n=e.IMPORT;if(t&&n in t){let r=a.variableList;r||(a.variableList=r={}),r[n]=t[n]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}const ui=/^(\d+)x(\d+)$/,Wr=/(.+?)=(".*?"|.*?)(?:,|$)/g;class mr{constructor(e,t){typeof e=="string"&&(e=mr.parseAttrList(e,t)),h(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 n=new Uint8Array(t.length/2);for(let r=0;r<t.length/2;r++)n[r]=parseInt(t.slice(r*2,r*2+2),16);return n}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 n=this[e];return n?parseFloat(n):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){const n=this[e];return(n?n.split(/[ ,]+/):[]).reduce((r,i)=>(r[i.toLowerCase()]=!0,r),t)}bool(e){return this[e]==="YES"}decimalResolution(e){const t=ui.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let n;const r={},i='"';for(Wr.lastIndex=0;(n=Wr.exec(e))!==null;){const s=n[1].trim();let o=n[2];const c=o.indexOf(i)===0&&o.lastIndexOf(i)===o.length-1;let u=!1;if(c)o=o.slice(1,-1);else switch(s){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":u=!0}if(t&&(c||u))o=ii(t,o);else if(!u&&!c)switch(s){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":X.warn(`${e}: attribute ${s} is missing quotes`)}r[s]=o}return r}}const Lr="com.apple.hls.interstitial";function Br(a){return a!=="ID"&&a!=="CLASS"&&a!=="CUE"&&a!=="START-DATE"&&a!=="DURATION"&&a!=="END-DATE"&&a!=="END-ON-NEXT"}function Hr(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class ar{constructor(e,t,n=0){var r;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=(r=t==null?void 0:t.tagOrder)!=null?r:n,t){const i=t.attr;for(const s in i)if(Object.prototype.hasOwnProperty.call(e,s)&&e[s]!==i[s]){X.warn(`DATERANGE tag attribute: "${s}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=s;break}e=h(new mr({}),i,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 i=(t==null?void 0:t.endDate)||new Date(this.attr["END-DATE"]);L(i.getTime())&&(this._endDate=i)}}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?(X.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(L(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===Lr}get isValid(){return!!this.id&&!this._badValueForSameId&&L(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 Rr=10;class kr{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,n=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!n||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&n>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 n=t.decryptdata;return n||(t.setKeyFormat(e.keyFormat),n=t.decryptdata),!!n&&e.matches(n)})}get hasProgramDateTime(){return this.fragments.length?L(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Rr}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 n=e.length;n--;)if(e[n].index>t)return e[n].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 Sn(a,e){return a.length===e.length?!a.some((t,n)=>t!==e[n]):!1}function Gn(a,e){return!a&&!e?!0:!a||!e?!1:Sn(a,e)}function Dn(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function Un(a){switch(a){case"AES-128":case"AES-256":return Xt.cbc;case"AES-256-CTR":return Xt.ctr;default:throw new Error(`invalid full segment method ${a}`)}}function lr(a){return Uint8Array.from(atob(a),e=>e.charCodeAt(0))}function Er(a){return Uint8Array.from(unescape(encodeURIComponent(a)),e=>e.charCodeAt(0))}function jr(a){const e=Er(a).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function dn(a){const e=function(n,r,i){const s=n[r];n[r]=n[i],n[i]=s};e(a,0,3),e(a,1,2),e(a,4,5),e(a,6,7)}function Ln(a){const e=a.split(":");let t=null;if(e[0]==="data"&&e.length===2){const n=e[1].split(";"),r=n[n.length-1].split(",");if(r.length===2){const i=r[0]==="base64",s=r[1];i?(n.splice(-1,1),t=lr(s)):t=jr(s)}}return t}const qn=typeof self!="undefined"?self:void 0;var Wn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},er={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Qr(a){switch(a){case er.FAIRPLAY:return Wn.FAIRPLAY;case er.PLAYREADY:return Wn.PLAYREADY;case er.WIDEVINE:return Wn.WIDEVINE;case er.CLEARKEY:return Wn.CLEARKEY}}function Ur(a){switch(a){case Wn.FAIRPLAY:return er.FAIRPLAY;case Wn.PLAYREADY:return er.PLAYREADY;case Wn.WIDEVINE:return er.WIDEVINE;case Wn.CLEARKEY:return er.CLEARKEY}}function Jr(a){const{drmSystems:e,widevineLicenseUrl:t}=a,n=e?[Wn.FAIRPLAY,Wn.WIDEVINE,Wn.PLAYREADY,Wn.CLEARKEY].filter(r=>!!e[r]):[];return!n[Wn.WIDEVINE]&&t&&n.push(Wn.WIDEVINE),n}const $r=function(a){return qn!=null&&(a=qn.navigator)!=null&&a.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function Ni(a,e,t,n){let r;switch(a){case Wn.FAIRPLAY:r=["cenc","sinf"];break;case Wn.WIDEVINE:case Wn.PLAYREADY:r=["cenc"];break;case Wn.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${a}`)}return ps(r,e,t,n)}function ps(a,e,t,n){return[{initDataTypes:a,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map(i=>({contentType:`audio/mp4; codecs=${i}`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null})),videoCapabilities:t.map(i=>({contentType:`video/mp4; codecs=${i}`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}))}]}function gs(a){var e;return!!a&&(a.sessionType==="persistent-license"||!!((e=a.sessionTypes)!=null&&e.some(t=>t==="persistent-license")))}function yi(a){const e=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),n=t.substring(t.indexOf("<"),t.length),s=new DOMParser().parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(s){const o=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(o){const c=lr(o).subarray(0,16);return dn(c),c}}return null}let ki={};class ci{static clearKeyUriToKeyIdMap(){ki={}}static setKeyIdForUri(e,t){ki[e]=t}constructor(e,t,n,r=[1],i=null,s){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=n,this.keyFormatVersions=r,this.iv=i,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Dn(e),s!=null&&s.startsWith("0x")&&(this.keyId=new Uint8Array(C(s)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&Sn(e.keyFormatVersions,this.keyFormatVersions)&&Gn(e.iv,this.iv)&&Gn(e.keyId,this.keyId)}isSupported(){if(this.method){if(Dn(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case er.FAIRPLAY:case er.WIDEVINE:case er.PLAYREADY:case er.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(Dn(this.method)){let i=this.iv;return i||(typeof e!="number"&&(X.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),i=Ei(e)),new ci(this.method,this.uri,"identity",this.keyFormatVersions,i)}if(this.keyId){const i=ki[this.uri];if(i&&!Sn(this.keyId,i)&&ci.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const n=Ln(this.uri);if(n)switch(this.keyFormat){case er.WIDEVINE:if(this.pssh=n,!this.keyId){const i=Ct(n.buffer);if(i.length){var r;const s=i[0];this.keyId=(r=s.kids)!=null&&r.length?s.kids[0]:null}}this.keyId||(this.keyId=Bi(t));break;case er.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=it(i,null,n),this.keyId=yi(n);break}default:{let i=n.subarray(0,16);if(i.length!==16){const s=new Uint8Array(16);s.set(i,16-i.length),i=s}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i;i=ms(t),i||(i=Bi(t),i||(i=ki[this.uri])),i&&(this.keyId=i,ci.setKeyIdForUri(this.uri,i))}return this}}function ms(a){const e=a==null?void 0:a[er.WIDEVINE];return e?e.keyId:null}function Bi(a){const e=a==null?void 0:a[er.PLAYREADY];if(e){const t=Ln(e.uri);if(t)return yi(t)}return null}function Ei(a){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=a>>8*(15-t)&255;return e}const Ui=/#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,Hi=/#EXT-X-MEDIA:(.*)/g,es=/^#EXT(?:INF|-X-TARGETDURATION):/m,Pi=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),vs=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 qr{static findGroup(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r.id===t)return r}}static resolve(e,t){return _.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return es.test(e)}static parseMasterPlaylist(e,t){const n=Dr(e),r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:n},i=[];if(Ui.lastIndex=0,!e.startsWith("#EXTM3U"))return r.playlistParsingError=new Error("no EXTM3U delimiter"),r;let s;for(;(s=Ui.exec(e))!=null;)if(s[1]){var o;const u=new mr(s[1],r),f=ii(r,s[2]),d={attrs:u,bitrate:u.decimalInteger("BANDWIDTH")||u.decimalInteger("AVERAGE-BANDWIDTH"),name:u.NAME,url:qr.resolve(f,t)},g=u.decimalResolution("RESOLUTION");g&&(d.width=g.width,d.height=g.height),$i(u.CODECS,d);const E=u["SUPPLEMENTAL-CODECS"];E&&(d.supplemental={},$i(E,d.supplemental)),(o=d.unknownCodecs)!=null&&o.length||i.push(d),r.levels.push(d)}else if(s[3]){const u=s[3],f=s[4];switch(u){case"SESSION-DATA":{const d=new mr(f,r),g=d["DATA-ID"];g&&(r.sessionData===null&&(r.sessionData={}),r.sessionData[g]=d);break}case"SESSION-KEY":{const d=ns(f,t,r);d.encrypted&&d.isSupported()?(r.sessionKeys===null&&(r.sessionKeys=[]),r.sessionKeys.push(d)):X.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${f}"`);break}case"DEFINE":{{const d=new mr(f,r);si(r,d,t)}break}case"CONTENT-STEERING":{const d=new mr(f,r);r.contentSteering={uri:qr.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{r.startTimeOffset=rs(f);break}}}const c=i.length>0&&i.length<r.levels.length;return r.levels=c?i:r.levels,r.levels.length===0&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,n){let r;const i={},s=n.levels,o={AUDIO:s.map(u=>({id:u.attrs.AUDIO,audioCodec:u.audioCodec})),SUBTITLES:s.map(u=>({id:u.attrs.SUBTITLES,textCodec:u.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(Hi.lastIndex=0;(r=Hi.exec(e))!==null;){const u=new mr(r[1],n),f=u.TYPE;if(f){const d=o[f],g=i[f]||[];i[f]=g;const E=u.LANGUAGE,b=u["ASSOC-LANGUAGE"],M=u.CHANNELS,O=u.CHARACTERISTICS,ae=u["INSTREAM-ID"],he={attrs:u,bitrate:0,id:c++,groupId:u["GROUP-ID"]||"",name:u.NAME||E||"",type:f,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:E,url:u.URI?qr.resolve(u.URI,t):""};if(b&&(he.assocLang=b),M&&(he.channels=M),O&&(he.characteristics=O),ae&&(he.instreamId=ae),d!=null&&d.length){const _e=qr.findGroup(d,he.groupId)||d[0];mi(he,_e,"audioCodec"),mi(he,_e,"textCodec")}g.push(he)}}return i}static parseLevelPlaylist(e,t,n,r,i,s){var o;const c={url:t},u=new kr(t),f=u.fragments,d=[];let g=null,E=0,b=0,M=0,O=0,ae=0,he=null,_e=new Ze(r,c),Ke,We,mt,He=-1,ot=!1,at=null,Je;if(Pi.lastIndex=0,u.m3u8=e,u.hasVariableRefs=Dr(e),((o=Pi.exec(e))==null?void 0:o[0])!=="#EXTM3U")return u.playlistParsingError=new Error("Missing format identifier #EXTM3U"),u;for(;(Ke=Pi.exec(e))!==null;){ot&&(ot=!1,_e=new Ze(r,c),_e.playlistOffset=M,_e.setStart(M),_e.sn=E,_e.cc=O,ae&&(_e.bitrate=ae),_e.level=n,g&&(_e.initSegment=g,g.rawProgramDateTime&&(_e.rawProgramDateTime=g.rawProgramDateTime,g.rawProgramDateTime=null),at&&(_e.setByteRange(at),at=null)));const Fn=Ke[1];if(Fn){_e.duration=parseFloat(Fn);const Cn=(" "+Ke[2]).slice(1);_e.title=Cn||null,_e.tagList.push(Cn?["INF",Fn,Cn]:["INF",Fn])}else if(Ke[3]){if(L(_e.duration)){_e.playlistOffset=M,_e.setStart(M),mt&&Zr(_e,mt,u),_e.sn=E,_e.level=n,_e.cc=O,f.push(_e);const Cn=(" "+Ke[3]).slice(1);_e.relurl=ii(u,Cn),rr(_e,he,d),he=_e,M+=_e.duration,E++,b=0,ot=!0}}else{if(Ke=Ke[0].match(vs),!Ke){X.warn("No matches on slow regex match for level playlist!");continue}for(We=1;We<Ke.length&&Ke[We]===void 0;We++);const Cn=(" "+Ke[We]).slice(1),ln=(" "+Ke[We+1]).slice(1),Pn=Ke[We+2]?(" "+Ke[We+2]).slice(1):null;switch(Cn){case"BYTERANGE":he?_e.setByteRange(ln,he):_e.setByteRange(ln);break;case"PROGRAM-DATE-TIME":_e.rawProgramDateTime=ln,_e.tagList.push(["PROGRAM-DATE-TIME",ln]),He===-1&&(He=f.length);break;case"PLAYLIST-TYPE":u.type&&Tr(u,Cn,Ke),u.type=ln.toUpperCase();break;case"MEDIA-SEQUENCE":u.startSN!==0?Tr(u,Cn,Ke):f.length>0&&Fr(u,Cn,Ke),E=u.startSN=parseInt(ln);break;case"SKIP":{u.skippedSegments&&Tr(u,Cn,Ke);const xn=new mr(ln,u),Mn=xn.decimalInteger("SKIPPED-SEGMENTS");if(L(Mn)){u.skippedSegments+=Mn;for(let hn=Mn;hn--;)f.push(null);E+=Mn}const nr=xn.enumeratedString("RECENTLY-REMOVED-DATERANGES");nr&&(u.recentlyRemovedDateranges=(u.recentlyRemovedDateranges||[]).concat(nr.split(" ")));break}case"TARGETDURATION":u.targetduration!==0&&Tr(u,Cn,Ke),u.targetduration=Math.max(parseInt(ln),1);break;case"VERSION":u.version!==null&&Tr(u,Cn,Ke),u.version=parseInt(ln);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":u.live||Tr(u,Cn,Ke),u.live=!1;break;case"#":(ln||Pn)&&_e.tagList.push(Pn?[ln,Pn]:[ln]);break;case"DISCONTINUITY":O++,_e.tagList.push(["DIS"]);break;case"GAP":_e.gap=!0,_e.tagList.push([Cn]);break;case"BITRATE":_e.tagList.push([Cn,ln]),ae=parseInt(ln)*1e3,L(ae)?_e.bitrate=ae:ae=0;break;case"DATERANGE":{const xn=new mr(ln,u),Mn=new ar(xn,u.dateRanges[xn.ID],u.dateRangeTagCount);u.dateRangeTagCount++,Mn.isValid||u.skippedSegments?u.dateRanges[Mn.id]=Mn:X.warn(`Ignoring invalid DATERANGE tag: "${ln}"`),_e.tagList.push(["EXT-X-DATERANGE",ln]);break}case"DEFINE":{{const xn=new mr(ln,u);"IMPORT"in xn?Xr(u,xn,s):si(u,xn,t)}break}case"DISCONTINUITY-SEQUENCE":u.startCC!==0?Tr(u,Cn,Ke):f.length>0&&Fr(u,Cn,Ke),u.startCC=O=parseInt(ln);break;case"KEY":{const xn=ns(ln,t,u);if(xn.isSupported()){if(xn.method==="NONE"){mt=void 0;break}mt||(mt={});const Mn=mt[xn.keyFormat];Mn!=null&&Mn.matches(xn)||(Mn&&(mt=h({},mt)),mt[xn.keyFormat]=xn)}else X.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${ln}"`);break}case"START":u.startTimeOffset=rs(ln);break;case"MAP":{const xn=new mr(ln,u);if(_e.duration){const Mn=new Ze(r,c);Kr(Mn,xn,n,mt),g=Mn,_e.initSegment=g,g.rawProgramDateTime&&!_e.rawProgramDateTime&&(_e.rawProgramDateTime=g.rawProgramDateTime)}else{const Mn=_e.byteRangeEndOffset;if(Mn){const nr=_e.byteRangeStartOffset;at=`${Mn-nr}@${nr}`}else at=null;Kr(_e,xn,n,mt),g=_e,ot=!0}g.cc=O;break}case"SERVER-CONTROL":{Je&&Tr(u,Cn,Ke),Je=new mr(ln),u.canBlockReload=Je.bool("CAN-BLOCK-RELOAD"),u.canSkipUntil=Je.optionalFloat("CAN-SKIP-UNTIL",0),u.canSkipDateRanges=u.canSkipUntil>0&&Je.bool("CAN-SKIP-DATERANGES"),u.partHoldBack=Je.optionalFloat("PART-HOLD-BACK",0),u.holdBack=Je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{u.partTarget&&Tr(u,Cn,Ke);const xn=new mr(ln);u.partTarget=xn.decimalFloatingPoint("PART-TARGET");break}case"PART":{let xn=u.partList;xn||(xn=u.partList=[]);const Mn=b>0?xn[xn.length-1]:void 0,nr=b++,hn=new mr(ln,u),pn=new Ye(hn,_e,c,nr,Mn);xn.push(pn),_e.duration+=pn.duration;break}case"PRELOAD-HINT":{const xn=new mr(ln,u);u.preloadHint=xn;break}case"RENDITION-REPORT":{const xn=new mr(ln,u);u.renditionReports=u.renditionReports||[],u.renditionReports.push(xn);break}default:X.warn(`line parsed but not handled: ${Ke}`);break}}}he&&!he.relurl?(f.pop(),M-=he.duration,u.partList&&(u.fragmentHint=he)):u.partList&&(rr(_e,he,d),_e.cc=O,u.fragmentHint=_e,mt&&Zr(_e,mt,u)),u.targetduration||(u.playlistParsingError=new Error("Missing Target Duration"));const Nt=f.length,vn=f[0],Rn=f[Nt-1];if(M+=u.skippedSegments*u.targetduration,M>0&&Nt&&Rn){u.averagetargetduration=M/Nt;const Fn=Rn.sn;u.endSN=Fn!=="initSegment"?Fn:0,u.live||(Rn.endList=!0),He>0&&(dr(f,He),vn&&d.unshift(vn))}return u.fragmentHint&&(M+=u.fragmentHint.duration),u.totalduration=M,d.length&&u.dateRangeTagCount&&vn&&ts(d,u),u.endCC=O,u}}function ts(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 n=a[t-1],r=e.live?1/0:e.totalduration,i=Object.keys(e.dateRanges);for(let o=i.length;o--;){const c=e.dateRanges[i[o]],u=c.startDate.getTime();c.tagAnchor=n.ref;for(let f=t;f--;){var s;if(((s=a[f])==null?void 0:s.sn)<e.startSN)break;const d=_s(e,u,a,f,r);if(d!==-1){c.tagAnchor=e.fragments[d].ref;break}}}}function _s(a,e,t,n,r){const i=t[n];if(i){const o=i.programDateTime;if(e>=o||n===0){var s;const c=(((s=t[n+1])==null?void 0:s.start)||r)-i.start;if(e<=o+c*1e3){const u=t[n].sn-a.startSN;if(u<0)return-1;const f=a.fragments;if(f.length>t.length){const g=(t[n+1]||f[f.length-1]).sn-a.startSN;for(let E=g;E>u;E--){const b=f[E].programDateTime;if(e>=b&&e<b+f[E].duration*1e3)return E}}return u}}}return-1}function ns(a,e,t){var n,r;const i=new mr(a,t),s=(n=i.METHOD)!=null?n:"",o=i.URI,c=i.hexadecimalInteger("IV"),u=i.KEYFORMATVERSIONS,f=(r=i.KEYFORMAT)!=null?r:"identity";o&&i.IV&&!c&&X.error(`Invalid IV: ${i.IV}`);const d=o?qr.resolve(o,e):"",g=(u||"1").split("/").map(Number).filter(Number.isFinite);return new ci(s,d,f,g,c,i.KEYID)}function rs(a){const t=new mr(a).decimalFloatingPoint("TIME-OFFSET");return L(t)?t:null}function $i(a,e){let t=(a||"").split(/[ ,]+/).filter(n=>n);["video","audio","text"].forEach(n=>{const r=t.filter(i=>Ne(i,n));r.length&&(e[`${n}Codec`]=r.map(i=>i.split("/")[0]).join(","),t=t.filter(i=>r.indexOf(i)===-1))}),e.unknownCodecs=t}function mi(a,e,t){const n=e[t];n&&(a[t]=n)}function dr(a,e){let t=a[e];for(let n=e;n--;){const r=a[n];if(!r)return;r.programDateTime=t.programDateTime-r.duration*1e3,t=r}}function rr(a,e,t){a.rawProgramDateTime?t.push(a):e!=null&&e.programDateTime&&(a.programDateTime=e.endProgramDateTime)}function Kr(a,e,t,n){a.relurl=e.URI,e.BYTERANGE&&a.setByteRange(e.BYTERANGE),a.level=t,a.sn="initSegment",n&&(a.levelkeys=n),a.initSegment=null}function Zr(a,e,t){a.levelkeys=e;const{encryptedFragments:n}=t;(!n.length||n[n.length-1].levelkeys!==e)&&Object.keys(e).some(r=>e[r].isCommonEncryption)&&n.push(a)}function Tr(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${t[0]})`)}function Fr(a,e,t){a.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${t[0]})`)}function ai(a,e){const t=e.startPTS;if(L(t)){let n=0,r;e.sn>a.sn?(n=t-a.start,r=a):(n=a.start-t,r=e),r.duration!==n&&r.setDuration(n)}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 oi(a,e,t,n,r,i,s){n-t<=0&&(s.warn("Fragment should have a positive duration",e),n=t+e.duration,i=r+e.duration);let c=t,u=n;const f=e.startPTS,d=e.endPTS;if(L(f)){const ae=Math.abs(f-t);a&&ae>a.totalduration?s.warn(`media timestamps and playlist times differ by ${ae}s for level ${e.level} ${a.url}`):L(e.deltaPTS)?e.deltaPTS=Math.max(ae,e.deltaPTS):e.deltaPTS=ae,c=Math.max(t,f),t=Math.min(t,f),r=e.startDTS!==void 0?Math.min(r,e.startDTS):r,u=Math.min(n,d),n=Math.max(n,d),i=e.endDTS!==void 0?Math.max(i,e.endDTS):i}const g=t-e.start;e.start!==0&&e.setStart(t),e.setDuration(n-e.start),e.startPTS=t,e.maxStartPTS=c,e.startDTS=r,e.endPTS=n,e.minEndPTS=u,e.endDTS=i;const E=e.sn;if(!a||E<a.startSN||E>a.endSN)return 0;let b;const M=E-a.startSN,O=a.fragments;for(O[M]=e,b=M;b>0;b--)ai(O[b],O[b-1]);for(b=M;b<O.length-1;b++)ai(O[b],O[b+1]);return a.fragmentHint&&ai(O[O.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,g}function bi(a,e,t){if(a===e)return;let n=null;const r=a.fragments;for(let f=r.length-1;f>=0;f--){const d=r[f].initSegment;if(d){n=d;break}}a.fragmentHint&&delete a.fragmentHint.endPTS;let i;Ki(a,e,(f,d,g,E)=>{if((!e.startCC||e.skippedSegments)&&d.cc!==f.cc){const b=f.cc-d.cc;for(let M=g;M<E.length;M++)E[M].cc+=b;e.endCC=E[E.length-1].cc}L(f.startPTS)&&L(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&&(i=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,n=f.initSegment)});const s=e.fragments,o=e.fragmentHint?s.concat(e.fragmentHint):s;if(n&&o.forEach(f=>{var d;f&&(!f.initSegment||f.initSegment.relurl===((d=n)==null?void 0:d.relurl))&&(f.initSegment=n)}),e.skippedSegments){if(e.deltaUpdateFailed=s.some(f=>!f),e.deltaUpdateFailed){t.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let f=e.skippedSegments;f--;)s.shift();e.startSN=s[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=xi(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&&rr(o[d],o[d-1],f);ts(f,e)}e.endCC=s[s.length-1].cc}if(!e.startCC){var c;const f=Cr(a,e.startSN-1);e.startCC=(c=f==null?void 0:f.cc)!=null?c:s[0].cc}Si(a.partList,e.partList,(f,d)=>{d.elementaryStreams=f.elementaryStreams,d.stats=f.stats}),i?oi(e,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS,t):Ls(a,e),s.length&&(e.totalduration=e.edge-s[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 xi(a,e,t){const{dateRanges:n,recentlyRemovedDateranges:r}=e,i=h({},a);r&&r.forEach(c=>{delete i[c]});const o=Object.keys(i).length;return o?(Object.keys(n).forEach(c=>{const u=i[c],f=new ar(n[c].attr,u);f.isValid?(i[c]=f,u||(f.tagOrder+=o)):t.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${$e(n[c].attr)}"`)}),i):n}function Si(a,e,t){if(a&&e){let n=0;for(let r=0,i=a.length;r<=i;r++){const s=a[r],o=e[r+n];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?t(s,o):n--}}}function Ki(a,e,t){const n=e.skippedSegments,r=Math.max(a.startSN,e.startSN)-e.startSN,i=(a.fragmentHint?1:0)+(n?e.endSN:Math.min(a.endSN,e.endSN))-e.startSN,s=e.startSN-a.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=a.fragmentHint?a.fragments.concat(a.fragmentHint):a.fragments;for(let u=r;u<=i;u++){const f=c[s+u];let d=o[u];if(n&&!d&&f&&(d=e.fragments[u]=f),f&&d){t(f,d,u,o);const g=f.relurl,E=d.relurl;if(g&&is(g,E)){e.playlistParsingError=Oi(`media sequence mismatch ${d.sn}:`,a,e,f,d);return}else if(f.cc!==d.cc){e.playlistParsingError=Oi(`discontinuity sequence mismatch (${f.cc}!=${d.cc})`,a,e,f,d);return}}}}function Oi(a,e,t,n,r){return new Error(`${a} ${r.url}
Playlist starting @${e.startSN}
${e.m3u8}
Playlist starting @${t.startSN}
${t.m3u8}`)}function Ls(a,e,t=!0){const n=e.startSN+e.skippedSegments-a.startSN,r=a.fragments,i=n>=0;let s=0;if(i&&n<r.length)s=r[n].start;else if(i&&e.startSN===a.endSN+1)s=a.fragmentEnd;else if(i&&t)s=a.fragmentStart+n*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)s=a.fragmentStart;else return;ys(e,s)}function ys(a,e){if(e){const t=a.fragments;for(let n=a.skippedSegments;n<t.length;n++)t[n].addStart(e);a.fragmentHint&&a.fragmentHint.addStart(e)}}function Mr(a,e=1/0){let t=1e3*a.targetduration;if(a.updated){const n=a.fragments;if(n.length&&t*4>e){const i=n[n.length-1].duration*1e3;i<t&&(t=i)}}else t/=2;return Math.round(t)}function Cr(a,e,t){if(!a)return null;let n=a.fragments[e-a.startSN];return n||(n=a.fragmentHint,n&&n.sn===e)?n:e<a.startSN&&t&&t.sn===e?t:null}function Pr(a,e,t){return a?ei(a.partList,e,t):null}function ei(a,e,t){if(a)for(let n=a.length;n--;){const r=a[n];if(r.index===t&&r.fragment.sn===e)return r}return null}function ti(a){a.forEach((e,t)=>{var n;(n=e.details)==null||n.fragments.forEach(r=>{r.level=t,r.initSegment&&(r.initSegment.level=t)})})}function is(a,e){return a!==e&&e?ss(a)!==ss(e):!1}function ss(a){return a.replace(/\?[^?]*$/,"")}function ji(a,e){for(let n=0,r=a.length;n<r;n++){var t;if(((t=a[n])==null?void 0:t.cc)===e)return a[n]}return null}function ks(a,e){return!!(a&&e.startCC<a.endCC&&e.endCC>a.startCC)}function Es(a,e){const t=a.start+e;a.startPTS=t,a.setStart(t),a.endPTS=t+a.duration}function Zi(a,e){const t=e.fragments;for(let n=0,r=t.length;n<r;n++)Es(t[n],a);e.fragmentHint&&Es(e.fragmentHint,a),e.alignedSliding=!0}function bs(a,e){a&&(Ps(e,a),e.alignedSliding||Os(e,a),!e.alignedSliding&&!e.skippedSegments&&Ls(a,e,!1))}function Ps(a,e){if(!ks(e,a))return;const t=Math.min(e.endCC,a.endCC),n=ji(e.fragments,t),r=ji(a.fragments,t);if(!n||!r)return;X.log(`Aligning playlist at start of dicontinuity sequence ${t}`);const i=n.start-r.start;Zi(i,a)}function Os(a,e){if(!a.hasProgramDateTime||!e.hasProgramDateTime)return;const t=a.fragments,n=e.fragments;if(!t.length||!n.length)return;let r,i;const s=Math.min(e.endCC,a.endCC);e.startCC<s&&a.startCC<s&&(r=ji(n,s),i=ji(t,s)),(!r||!i)&&(r=n[Math.floor(n.length/2)],i=ji(t,r.cc)||t[Math.floor(t.length/2)]);const o=r.programDateTime,c=i.programDateTime;if(!o||!c)return;const u=(c-o)/1e3-(i.start-r.start);Zi(u,a)}function li(a,e,t){fi(a,e,t),a.addEventListener(e,t)}function fi(a,e,t){a.removeEventListener(e,t)}const wl={toString:function(a){let e="";const t=a.length;for(let n=0;n<t;n++)e+=`[${a.start(n).toFixed(3)}-${a.end(n).toFixed(3)}]`;return e}},Ot={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 na extends Or{constructor(e,t,n,r,i){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Ot.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:s,fragCurrent:o,media:c,mediaBuffer:u,state:f}=this,d=c?c.currentTime:0,g=In.bufferInfo(u||c,d,s.maxBufferHole),E=!g.len;if(this.log(`Media seeking to ${L(d)?d.toFixed(3):d}, state: ${f}, ${E?"out of":"in"} buffer`),this.state===Ot.ENDED)this.resetLoadingState();else if(o){const b=s.maxFragLookUpTolerance,M=o.start-b,O=o.start+o.duration+b;if(E||O<g.start||M>g.end){const ae=d>O;(d<M||ae)&&(ae&&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 b=this.lastCurrentTime;if(d>b&&(this.lastCurrentTime=d),!this.loadingParts){const M=Math.max(g.end,d),O=this.shouldLoadParts(this.getLevelDetails(),M);O&&(this.log(`LL-Part loading ON after seeking to ${d.toFixed(2)} with buffer @${M.toFixed(2)}`),this.loadingParts=O)}}this.hls.hasEnoughToStart||(this.log(`Setting ${E?"startPosition":"nextLoadPosition"} to ${d} for seek without enough to start`),this.nextLoadPosition=d,E&&(this.startPosition=d)),E&&this.state===Ot.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=i,this.hls=e,this.fragmentLoader=new sr(e.config),this.keyLoader=n,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Xn(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===Ot.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=Ot.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 n=e.end||0,r=this.config.timelineOffset||0;if(n<=r)return!1;const i=e.buffered;this.config.maxBufferHole&&i&&i.length>1&&(e=In.bufferedInfo(i,e.start,0));const s=e.nextStart;if(s&&s>r&&s<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 In.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 n=this.media=this.mediaBuffer=t.media;li(n,"seeking",this.onMediaSeeking),li(n,"ended",this.onMediaEnded);const r=this.config;this.levels&&r.autoStartLoad&&this.state===Ot.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){const n=!!t.transferMedia,r=this.media;if(r!==null){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),fi(r,"seeking",this.onMediaSeeking),fi(r,"ended",this.onMediaEnded),this.keyLoader&&!n&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,n){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=Ot.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,n){this.startFragRequested=!0,this._loadFragForPlayback(e,t,n)}_loadFragForPlayback(e,t,n){const r=i=>{const s=i.frag;if(this.fragContextChanged(s)){this.warn(`${s.type} sn: ${s.sn}${i.part?" part: "+i.part.index:""} of ${this.fragInfo(s,!1,i.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(s);return}s.stats.chunkCount++,this._handleFragmentLoadProgress(i)};this._doFragLoad(e,t,n,r).then(i=>{if(!i)return;const s=this.state,o=i.frag;if(this.fragContextChanged(o)){(s===Ot.FRAG_LOADING||!this.fragCurrent&&s===Ot.PARSING)&&(this.fragmentTracker.removeFragment(o),this.state=Ot.IDLE);return}"payload"in i&&(this.log(`Loaded ${o.type} sn: ${o.sn} of ${this.playlistLabel()} ${o.level}`),this.hls.trigger(p.FRAG_LOADED,i)),this._handleFragmentLoadComplete(i)}).catch(i=>{this.state===Ot.STOPPED||this.state===Ot.ERROR||(this.warn(`Frag error: ${(i==null?void 0:i.message)||i}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:n}=this;if(n.getState(e)===$t.APPENDING){const i=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,i),o=Math.max(e.duration,s?s.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&n.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?n.removeAllFragments():n.hasParts(e.type)&&(n.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),n.getState(e)===$t.PARTIAL&&n.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,n=null){if(!(e-t))return;const r={startOffset:e,endOffset:t,type:n};this.hls.trigger(p.BUFFER_FLUSHING,r)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(n=>{const r=n==null?void 0:n.frag;if(!r||this.fragContextChanged(r)||!this.levels)throw new Error("init load aborted");return n}).then(n=>{const{hls:r}=this,{frag:i,payload:s}=n,o=i.decryptdata;if(s&&s.byteLength>0&&o!=null&&o.key&&o.iv&&Dn(o.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer,Un(o.method)).catch(u=>{throw r.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:u,reason:u.message,frag:i}),u}).then(u=>{const f=self.performance.now();return r.trigger(p.FRAG_DECRYPTED,{frag:i,payload:u,stats:{tstart:c,tdecrypt:f}}),n.payload=u,this.completeInitSegmentLoad(n)})}return this.completeInitSegmentLoad(n)}).catch(n=>{this.state===Ot.STOPPED||this.state===Ot.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const n=e.frag.stats;this.state!==Ot.STOPPED&&(this.state=Ot.IDLE),e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,t){var n,r;const i=e.tracks;if(i&&!t.encrypted&&((n=i.audio)!=null&&n.encrypted||(r=i.video)!=null&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const s=this.media,o=new Error(`Encrypted track with no key in ${this.fragInfo(t)} (media ${s?"attached mediaKeys: "+s.mediaKeys:"detached"})`);return this.warn(o.message),!s||s.mediaKeys?!1:(this.hls.trigger(p.ERROR,{type:ue.KEY_SYSTEM_ERROR,details:$.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 n=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:${n?wl.toString(In.getBuffered(n)):"(detached)"})`),Oe(e)){var r;if(e.type!==le.SUBTITLE){const s=e.elementaryStreams;if(!Object.keys(s).some(o=>!!s[o])){this.state=Ot.IDLE;return}}const i=(r=this.levels)==null?void 0:r[e.level];i!=null&&i.fragmentError&&(this.log(`Resetting level fragment error count of ${i.fragmentError} on frag buffered`),i.fragmentError=0)}this.state=Ot.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:n,part:r,partsLoaded:i}=e,s=!i||i.length===0||i.some(c=>!c),o=new br(n.level,n.sn,n.stats.chunkCount+1,0,r?r.index:-1,!s);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,n=null,r){var i;this.fragCurrent=e;const s=t.details;if(!this.levels||!s)throw new Error(`frag load aborted, missing level${s?"":" detail"}s`);let o=null;if(e.encrypted&&!((i=e.decryptdata)!=null&&i.key)){if(this.log(`Loading key for ${e.sn} of [${s.startSN}-${s.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Ot.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(g=>{if(!this.fragContextChanged(g.frag))return this.hls.trigger(p.KEY_LOADED,g),this.state===Ot.KEY_LOADING&&(this.state=Ot.IDLE),g}),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,s.encryptedFragments,this.startFragRequested),o&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(Oe(e)&&(!c||e.sn!==c.sn)){const g=this.shouldLoadParts(t.details,e.end);g!==this.loadingParts&&(this.log(`LL-Part loading ${g?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=g)}if(n=Math.max(e.start,n||0),this.loadingParts&&Oe(e)){const g=s.partList;if(g&&r){n>s.fragmentEnd&&s.fragmentHint&&(e=s.fragmentHint);const E=this.getNextPart(g,e,n);if(E>-1){const b=g[E];e=this.fragCurrent=b.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${b.index} (${E}/${g.length-1}) of ${this.fragInfo(e,!1,b)}) cc: ${e.cc} [${s.startSN}-${s.endSN}], target: ${parseFloat(n.toFixed(3))}`),this.nextLoadPosition=b.start+b.duration,this.state=Ot.FRAG_LOADING;let M;return o?M=o.then(O=>!O||this.fragContextChanged(O.frag)?null:this.doFragPartsLoad(e,b,t,r)).catch(O=>this.handleFragLoadError(O)):M=this.doFragPartsLoad(e,b,t,r).catch(O=>this.handleFragLoadError(O)),this.hls.trigger(p.FRAG_LOADING,{frag:e,part:b,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):M}else if(!e.url||this.loadedEndOfParts(g,n))return Promise.resolve(null)}}if(Oe(e)&&this.loadingParts){var u;this.log(`LL-Part loading OFF after next part miss @${n.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(u=s.partList)==null?void 0:u.filter(g=>g.loaded).map(g=>`[${g.start}-${g.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} ${"["+s.startSN+"-"+s.endSN+"]"}, target: ${parseFloat(n.toFixed(3))}`),L(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Ot.FRAG_LOADING;const f=this.config.progressive;let d;return f&&o?d=o.then(g=>!g||this.fragContextChanged(g.frag)?null:this.fragmentLoader.load(e,r)).catch(g=>this.handleFragLoadError(g)):d=Promise.all([this.fragmentLoader.load(e,f?r:void 0),o]).then(([g])=>(!f&&r&&r(g),g)).catch(g=>this.handleFragLoadError(g)),this.hls.trigger(p.FRAG_LOADING,{frag:e,targetBufferTime:n}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,n,r){return new Promise((i,s)=>{var o;const c=[],u=(o=n.details)==null?void 0:o.partList,f=d=>{this.fragmentLoader.loadPart(e,d,r).then(g=>{c[d.index]=g;const E=g.part;this.hls.trigger(p.FRAG_LOADED,g);const b=Pr(n.details,e.sn,d.index+1)||ei(u,e.sn,d.index+1);if(b)f(b);else return i({frag:e,part:E,partsLoaded:c})}).catch(s)};f(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;t.frag&&t.details===$.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===ue.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:ue.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==Ot.PARSING){!this.fragCurrent&&this.state!==Ot.STOPPED&&this.state!==Ot.ERROR&&(this.state=Ot.IDLE);return}const{frag:n,part:r,level:i}=t,s=self.performance.now();n.stats.parsing.end=s,r&&(r.stats.parsing.end=s);const o=this.getLevelDetails(),u=o&&n.sn>o.endSN||this.shouldLoadParts(o,n.end);u!==this.loadingParts&&(this.log(`LL-Part loading ${u?"ON":"OFF"} after parsing segment ending @${n.end.toFixed(2)}`),this.loadingParts=u),this.updateLevelTiming(n,r,i,e.partial)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var n;const i=e.partList[0];if(i.fragment.type===le.SUBTITLE)return!1;const s=i.end+(((n=e.fragmentHint)==null?void 0:n.duration)||0);if(t>=s){var r;if((this.hls.hasEnoughToStart?((r=this.media)==null?void 0:r.currentTime)||this.lastCurrentTime:this.getLoadPosition())>i.start-i.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:t,fragCurrent:n}=this,{level:r,sn:i,part:s}=e;if(!(t!=null&&t[r]))return this.warn(`Levels object was unset while buffering fragment ${i} of ${this.playlistLabel()} ${r}. The current chunk will not be buffered.`),null;const o=t[r],c=o.details,u=s>-1?Pr(c,i,s):null,f=u?u.fragment:Cr(c,i,n);return f?(n&&n!==f&&(f.stats=n.stats),{frag:f,part:u,level:o}):null}bufferFragmentData(e,t,n,r,i){if(this.state!==Ot.PARSING)return;const{data1:s,data2:o}=e;let c=s;if(o&&(c=Ce(s,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:n,chunkMeta:r,offset:f,parent:t.type,data:c};if(this.hls.trigger(p.BUFFER_APPENDING,d),e.dropped&&e.independent&&!n){if(i)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!In.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const n=t.currentTime,r=In.bufferInfo(t,n,0),i=e.duration,s=Math.min(this.config.maxFragLookUpTolerance*2,i*.25),o=Math.max(Math.min(e.start-s,r.end-s),n+s);e.start-o>s&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){var n;const r=this.getLoadPosition();if(!L(r))return null;const s=this.lastCurrentTime>r||(n=this.media)!=null&&n.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,s)}getFwdBufferInfoAtPos(e,t,n,r){const i=In.bufferInfo(e,t,r);if(i.len===0&&i.nextStart!==void 0){const s=this.fragmentTracker.getBufferedFrag(t,n);if(s&&(i.nextStart<=s.end||s.gap)){const o=Math.max(Math.min(i.nextStart,s.end)-t,r);return In.bufferInfo(e,t,o)}}return i}getMaxBufferLength(e){const{config:t}=this;let n;return e?n=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):n=t.maxBufferLength,Math.min(n,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const n=this.config,r=Math.max(Math.min(e-t,n.maxBufferLength),t),i=Math.max(e-t*3,n.maxMaxBufferLength/2,r);return i>=r?(n.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e,t=le.MAIN){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,t):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,t){const n=t.fragments,r=n.length;if(!r)return null;const{config:i}=this,s=n[0].start,o=i.lowLatencyMode&&!!t.partList;let c=null;if(t.live){const d=i.initialLiveManifestSize;if(r<d)return this.warn(`Not enough fragments to start playback (have: ${r}, need: ${d})`),null;if(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<s){var u;o&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(t);const g=this.hls.startPosition,E=this.hls.liveSyncPosition,b=c?(g!==-1&&g>=s?g:E)||c.start:e;this.log(`Setting startPosition to ${b} to match start frag at live edge. mainStart: ${g} liveSyncPosition: ${E} frag.start: ${(u=c)==null?void 0:u.start}`),this.startPosition=this.nextLoadPosition=b}}else e<=s&&(c=n[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(n[d+1]||null,t)}return this.mapToInitFragWhenRequired(f)}isLoopLoading(e,t){const n=this.fragmentTracker.getState(e);return(n===$t.OK||n===$t.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,n,r,i){let s=null;if(e.gap&&(s=this.getNextFragment(this.nextLoadPosition,t),s&&!s.gap&&n.nextStart)){const o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,n.nextStart,r,0);if(o!==null&&n.len+o.len>=i){const c=s.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${r}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,s}get primaryPrefetch(){if(za(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(za(this.config)&&e.type!==le.SUBTITLE){const n=this.hls.interstitialsManager,r=n==null?void 0:n.bufferingItem;if(r){const s=r.event;if(s){if(s.appendInPlace||Math.abs(e.start-r.start)>1||r.start===0)return null}else if(e.end<=r.start&&(t==null?void 0:t.live)===!1||e.start>r.end&&r.nextEvent&&(r.nextEvent.appendInPlace||e.start-r.end>1))return null}const i=n==null?void 0:n.playerQueue;if(i)for(let s=i.length;s--;){const o=i[s].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,n){let r=-1,i=!1,s=!0;for(let o=0,c=e.length;o<c;o++){const u=e[o];if(s=s&&!u.independent,r>-1&&n<u.start)break;const f=u.loaded;f?r=-1:(i||(u.independent||s)&&u.fragment===t)&&(u.fragment!==t&&this.warn(`Need buffer at ${n} but next unloaded part starts at ${u.start}`),r=o),i=f}return r}loadedEndOfParts(e,t){let n;for(let r=e.length;r--;){if(n=e[r],!n.loaded)return!1;if(t>n.start)return!0}return!1}getInitialLiveFragment(e){const t=e.fragments,n=this.fragPrevious;let r=null;if(n){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`),r=Wt(t,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){const i=n.sn+1;if(i>=e.startSN&&i<=e.endSN){const s=t[i-e.startSN];n.cc===s.cc&&(r=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${r.sn}`))}r||(r=mn(e,n.cc,n.end),r&&this.log(`Live playlist, switching playlist, load frag with same CC: ${r.sn}`))}}else{const i=this.hls.liveSyncPosition;i!==null&&(r=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,n){const{config:r}=this;let{fragPrevious:i}=this,{fragments:s,endSN:o}=n;const{fragmentHint:c}=n,{maxFragLookUpTolerance:u}=r,f=n.partList,d=!!(this.loadingParts&&f!=null&&f.length&&c);d&&!this.bitrateTest&&f[f.length-1].fragment.sn===c.sn&&(s=s.concat(c),o=c.sn);let g;if(e<t){var E;const M=e<this.lastCurrentTime||e>t-u||(E=this.media)!=null&&E.paused||!this.startFragRequested?0:u;g=Jt(i,s,e,M)}else g=s[s.length-1];if(g){const b=g.sn-n.startSN,M=this.fragmentTracker.getState(g);if((M===$t.OK||M===$t.PARTIAL&&g.gap)&&(i=g),i&&g.sn===i.sn&&(!d||f[0].fragment.sn>g.sn||!n.live)&&g.level===i.level){const ae=s[b+1];g.sn<o&&this.fragmentTracker.getState(ae)!==$t.OK?g=ae:g=null}}return g}alignPlaylists(e,t,n){const r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;const i=e.fragmentStart,s=!t,o=e.alignedSliding&&L(i);if(s||!o&&!i){bs(n,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} fragments: ${r}`),c}return i}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let n=this.startPosition;n<t&&(n=-1);const r=this.timelineOffset;if(n===-1){const i=this.startTimeOffset!==null,s=i?this.startTimeOffset:e.startTimeOffset;s!==null&&L(s)?(n=t+s,s<0&&(n+=e.edge),n=Math.min(Math.max(t,n),t+e.totalduration),this.log(`Setting startPosition to ${n} for start time offset ${s} found in ${i?"multivariant":"media"} playlist`),this.startPosition=n):e.live?(n=this.hls.liveSyncPosition||t,this.log(`Setting startPosition to -1 to start at live edge ${n}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=n=0),this.lastCurrentTime=n+r}this.nextLoadPosition=n+r}getLoadPosition(){var e;const{media:t}=this;let n=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&t?n=t.currentTime:this.nextLoadPosition>=0&&(n=this.nextLoadPosition),n}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&Oe(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!==Ot.FRAG_LOADING_WAITING_RETRY)&&(this.state=Ot.IDLE)}onFragmentOrKeyLoadError(e,t){var n;if(t.chunkMeta&&!t.frag){const ae=this.getCurrentContext(t.chunkMeta);ae&&(t.frag=ae.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var i;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const s=t.details===$.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(r,!0);const o=t.errorAction;if(!o){this.state=Ot.ERROR;return}const{action:c,flags:u,retryCount:f=0,retryConfig:d}=o,g=!!d,E=g&&c===On.RetryRequest,b=g&&!o.resolved&&u===sn.MoveAllAlternatesMatchingHost,M=(n=this.hls.latestLevelDetails)==null?void 0:n.live;if(!E&&b&&Oe(r)&&!r.endList&&M&&!Qn(t))this.resetFragmentErrors(e),this.treatAsGap(r),o.resolved=!0;else if((E||b)&&f<d.maxNumRetry){var O;const ae=ur((O=t.response)==null?void 0:O.code),he=Vn(d,f);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+he,this.state=Ot.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,ae){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${f+1}/${d.maxNumRetry} in ${he}ms`)}else if(d)if(this.resetFragmentErrors(e),f<d.maxNumRetry)!s&&c!==On.RemoveAlternatePermanently&&(o.resolved=!0);else{this.warn(`${t.details} reached or exceeded max retry (${f})`);return}else c===On.SendAlternateToPenaltyBox?this.state=Ot.WAITING_LEVEL:this.state=Ot.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),t=this.retryDate,n=t===1/0;(!t||e>=t||n&&!ur(0))&&(n&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Ot.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Ot.PARSING||this.state===Ot.PARSED){const t=e.frag,n=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,n),i=r&&r.len>.5;i&&this.reduceMaxBufferLength(r.len,(t==null?void 0:t.duration)||10);const s=!i;return s&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${n} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(e){e===le.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Ot.STOPPED&&(this.state=Ot.IDLE)}afterBufferFlushed(e,t,n){if(!e)return;const r=In.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,r,n),this.state===Ot.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Ot.STOPPED&&(this.state=Ot.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,n,r){const i=n.details;if(!i){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 g=r?0:oi(i,e,f.startPTS,f.endPTS,f.startDTS,f.endDTS,this);return this.hls.trigger(p.LEVEL_PTS_UPDATED,{details:i,level:n,drift:g,type:u,frag:e,start:f.startPTS,end:f.endPTS}),!0}return c},!1)){var o;if(n.fragmentError===0&&this.treatAsGap(e,n),((o=this.transmuxer)==null?void 0:o.error)===null){const c=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(c.message),this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:c,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${n.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Ot.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===le.MAIN?"level":"track"}fragInfo(e,t=!0,n){var r,i;return`${this.playlistLabel()} ${e.level} (${n?"part":"frag"}:[${((r=t&&!n?e.startPTS:(n||e).start)!=null?r:NaN).toFixed(3)}-${((i=t&&!n?e.endPTS:(n||e).end)!=null?i:NaN).toFixed(3)}]${n&&e.type==="main"?"INDEPENDENT="+(n.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 za(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 n;if(e.length)e.length===1?n=e[0]:n=Al(e,t);else return new Uint8Array(0);return this.reset(),n}reset(){this.chunks.length=0,this.dataLength=0}}function Al(a,e){const t=new Uint8Array(e);let n=0;for(let r=0;r<a.length;r++){const i=a[r];t.set(i,n),n+=i.length}return t}var ra={exports:{}},Ha;function Dl(){return Ha||(Ha=1,function(a){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function r(c,u,f){this.fn=c,this.context=u,this.once=f||!1}function i(c,u,f,d,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var E=new r(f,d||c,g),b=t?t+u:u;return c._events[b]?c._events[b].fn?c._events[b]=[c._events[b],E]:c._events[b].push(E):(c._events[b]=E,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function o(){this._events=new n,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 g=0,E=d.length,b=new Array(E);g<E;g++)b[g]=d[g].fn;return b},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,g,E,b){var M=t?t+u:u;if(!this._events[M])return!1;var O=this._events[M],ae=arguments.length,he,_e;if(O.fn){switch(O.once&&this.removeListener(u,O.fn,void 0,!0),ae){case 1:return O.fn.call(O.context),!0;case 2:return O.fn.call(O.context,f),!0;case 3:return O.fn.call(O.context,f,d),!0;case 4:return O.fn.call(O.context,f,d,g),!0;case 5:return O.fn.call(O.context,f,d,g,E),!0;case 6:return O.fn.call(O.context,f,d,g,E,b),!0}for(_e=1,he=new Array(ae-1);_e<ae;_e++)he[_e-1]=arguments[_e];O.fn.apply(O.context,he)}else{var Ke=O.length,We;for(_e=0;_e<Ke;_e++)switch(O[_e].once&&this.removeListener(u,O[_e].fn,void 0,!0),ae){case 1:O[_e].fn.call(O[_e].context);break;case 2:O[_e].fn.call(O[_e].context,f);break;case 3:O[_e].fn.call(O[_e].context,f,d);break;case 4:O[_e].fn.call(O[_e].context,f,d,g);break;default:if(!he)for(We=1,he=new Array(ae-1);We<ae;We++)he[We-1]=arguments[We];O[_e].fn.apply(O[_e].context,he)}}return!0},o.prototype.on=function(u,f,d){return i(this,u,f,d,!1)},o.prototype.once=function(u,f,d){return i(this,u,f,d,!0)},o.prototype.removeListener=function(u,f,d,g){var E=t?t+u:u;if(!this._events[E])return this;if(!f)return s(this,E),this;var b=this._events[E];if(b.fn)b.fn===f&&(!g||b.once)&&(!d||b.context===d)&&s(this,E);else{for(var M=0,O=[],ae=b.length;M<ae;M++)(b[M].fn!==f||g&&!b[M].once||d&&b[M].context!==d)&&O.push(b[M]);O.length?this._events[E]=O.length===1?O[0]:O:s(this,E)}return this},o.prototype.removeAllListeners=function(u){var f;return u?(f=t?t+u:u,this._events[f]&&s(this,f)):(this._events=new n,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}(ra)),ra.exports}var Rl=Dl(),ia=G(Rl);const xs="1.6.13",as={};function Cl(){return typeof __HLS_WORKER_BUNDLE__=="function"}function Il(){const a=as[xs];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),r={worker:new self.Worker(t),objectURL:t,clientCount:1};return as[xs]=r,r}function Ll(a){const e=as[a];if(e)return e.clientCount++,e;const t=new self.URL(a,self.location.href).href,r={worker:new self.Worker(t),scriptURL:t,clientCount:1};return as[a]=r,r}function kl(a){const e=as[a||xs];if(e&&e.clientCount--===1){const{worker:n,objectURL:r}=e;delete as[a||xs],r&&self.URL.revokeObjectURL(r),n.terminate()}}function ja(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 sa(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 Ms(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 Ss(a,e){const t=e;let n=0;for(;sa(a,e);){n+=10;const r=Ms(a,e+6);n+=r,ja(a,e+10)&&(n+=10),e+=n}if(n>0)return a.subarray(t,t+n)}function Pl(a,e,t,n){const r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=e[t+2],s=i>>2&15;if(s>12){const E=new Error(`invalid ADTS sampling index:${s}`);a.emit(p.ERROR,p.ERROR,{type:ue.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!0,error:E,reason:E.message});return}const o=(i>>6&3)+1,c=e[t+3]>>6&3|(i&1)<<2,u="mp4a.40."+o,f=r[s];let d=s;(o===5||o===29)&&(d-=3);const g=[o<<3|(d&14)>>1,(d&1)<<7|c<<3];return X.log(`manifest codec:${n}, parsed codec:${u}, channels:${c}, rate:${f} (ADTS object type:${o} sampling index:${s})`),{config:g,samplerate:f,channelCount:c,codec:u,parsedCodec:u,manifestCodec:n}}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 Fs(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 Fl(a,e){if(Fs(a,e)){const t=Xa(a,e);if(e+t>=a.length)return!1;const n=aa(a,e);if(n<=t)return!1;const r=e+n;return r===a.length||Fs(a,r)}return!1}function Qa(a,e,t,n,r){if(!a.samplerate){const i=Pl(e,t,n,r);if(!i)return;h(a,i)}}function Ja(a){return 1024*9e4/a}function Nl(a,e){const t=Xa(a,e);if(e+t<=a.length){const n=aa(a,e)-t;if(n>0)return{headerLength:t,frameLength:n}}}function qa(a,e,t,n,r){const i=Ja(a.samplerate),s=n+r*i,o=Nl(e,t);let c;if(o){const{frameLength:d,headerLength:g}=o,E=g+d,b=Math.max(0,t+E-e.length);b?(c=new Uint8Array(E-g),c.set(e.subarray(t+g,e.length),0)):c=e.subarray(t+g,t+E);const M={unit:c,pts:s};return b||a.samples.push(M),{sample:M,length:E,missing:b}}const u=e.length-t;return c=new Uint8Array(u),c.set(e.subarray(t,e.length),0),{sample:{unit:c,pts:s},length:u,missing:-1}}function Bl(a,e){return sa(a,e)&&Ms(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 $l(a,e,t,Uint8Array)}function $l(a,e,t,n){const r=Kl(a);let i=1;"BYTES_PER_ELEMENT"in n&&(i=n.BYTES_PER_ELEMENT);const s=Zl(a)?a.byteOffset:0,o=(s+a.byteLength)/i,c=(s+e)/i,u=Math.floor(Math.max(0,Math.min(c,o))),f=Math.floor(Math.min(u+Math.max(t,0),o));return new n(r,u,f-u)}function Kl(a){return a instanceof ArrayBuffer?a:a.buffer}function Zl(a){return a&&a.buffer instanceof ArrayBuffer&&a.byteLength!==void 0&&a.byteOffset!==void 0}function Gl(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 n=a.data.subarray(1).indexOf(0);if(n===-1)return;const r=Ve(oa(a.data,1,n)),i=a.data[2+n],s=a.data.subarray(3+n).indexOf(0);if(s===-1)return;const o=Ve(oa(a.data,3+n,s));let c;return r==="-->"?c=Ve(oa(a.data,4+n+s)):c=Ul(a.data.subarray(4+n+s)),e.mimeType=r,e.pictureType=i,e.description=o,e.data=c,e}function Vl(a){if(a.size<2)return;const e=Ve(a.data,!0),t=new Uint8Array(a.data.subarray(e.length+1));return{key:a.type,info:e,data:t.buffer}}function zl(a){if(a.size<2)return;if(a.type==="TXXX"){let t=1;const n=Ve(a.data.subarray(t),!0);t+=n.length+1;const r=Ve(a.data.subarray(t));return{key:a.type,info:n,data:r}}const e=Ve(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 n=Ve(a.data.subarray(t),!0);t+=n.length+1;const r=Ve(a.data.subarray(t));return{key:a.type,info:n,data:r}}const e=Ve(a.data);return{key:a.type,info:"",data:e}}function Hl(a){return a.type==="PRIV"?Vl(a):a.type[0]==="W"?Wl(a):a.type==="APIC"?Gl(a):zl(a)}function jl(a){const e=String.fromCharCode(a[0],a[1],a[2],a[3]),t=Ms(a,4),n=10;return{type:e,size:t,data:a.subarray(n,n+t)}}const Ns=10,Yl=10;function eo(a){let e=0;const t=[];for(;sa(a,e);){const n=Ms(a,e+6);a[e+5]>>6&1&&(e+=Ns),e+=Ns;const r=e+n;for(;e+Yl<r;){const i=jl(a.subarray(e)),s=Hl(i);s&&t.push(s),e+=i.size+Ns}ja(a,e)&&(e+=Ns)}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 n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,t&&(n+=4772185884e-2),Math.round(n)}}function la(a){const e=eo(a);for(let t=0;t<e.length;t++){const n=e[t];if(to(n))return Xl(n)}}let hi=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 Di(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,n,r){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,n){}demux(e,t){this.cachedData&&(e=Ce(this.cachedData,e),this.cachedData=null);let n=Ss(e,0),r=n?n.length:0,i;const s=this._audioTrack,o=this._id3Track,c=n?la(n):void 0,u=e.length;for((this.basePTS===null||this.frameIndex===0&&L(c))&&(this.basePTS=Ql(c,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),n&&n.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:hi.audioId3,duration:Number.POSITIVE_INFINITY});r<u;){if(this.canParse(e,r)){const f=this.appendFrame(s,e,r);f?(this.frameIndex++,this.lastPTS=f.sample.pts,r+=f.length,i=r):r=u}else Bl(e,r)?(n=Ss(e,r),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:hi.audioId3,duration:Number.POSITIVE_INFINITY}),r+=n.length,i=r):r++;if(r===u&&i!==u){const f=e.slice(i);this.cachedData?this.cachedData=Ce(this.cachedData,f):this.cachedData=f}}return{audioTrack:s,videoTrack:Di(),id3Track:o,textTrack:Di()}}demuxSampleAes(e,t,n){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:Di(),id3Track:this._id3Track,textTrack:Di()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Ql=(a,e,t)=>{if(L(a))return a*90;const n=t?t.baseTime*9e4/t.timescale:0;return e*9e4+n};let Bs=null;const Jl=[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],ql=[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 no(a,e,t,n,r){if(t+24>e.length)return;const i=ro(e,t);if(i&&t+i.frameLength<=e.length){const s=i.samplesPerFrame*9e4/i.sampleRate,o=n+r*s,c={unit:e.subarray(t,t+i.frameLength),pts:o,dts:o};return a.config=[],a.channelCount=i.channelCount,a.samplerate=i.sampleRate,a.samples.push(c),{sample:c,length:i.frameLength,missing:0}}}function ro(a,e){const t=a[e+1]>>3&3,n=a[e+1]>>1&3,r=a[e+2]>>4&15,i=a[e+2]>>2&3;if(t!==1&&r!==0&&r!==15&&i!==3){const s=a[e+2]>>1&1,o=a[e+3]>>6,c=t===3?3-n:n===3?3:4,u=Jl[c*14+r-1]*1e3,d=ql[(t===3?0:t===2?1:2)*3+i],g=o===3?1:2,E=eu[t][n],b=tu[n],M=E*8*b,O=Math.floor(E*u/d+s)*b;if(Bs===null){const _e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Bs=_e?parseInt(_e[1]):0}return!!Bs&&Bs<=87&&n===2&&u>=224e3&&o===0&&(a[e+3]=a[e+3]|128),{sampleRate:d,channelCount:g,frameLength:O,samplesPerFrame:M}}}function ca(a,e){return a[e]===255&&(a[e+1]&224)===224&&(a[e+1]&6)!==0}function io(a,e){return e+1<a.length&&ca(a,e)}function nu(a,e){return ca(a,e)&&4<=a.length-e}function so(a,e){if(e+1<a.length&&ca(a,e)){const n=ro(a,e);let r=4;n!=null&&n.frameLength&&(r=n.frameLength);const i=e+r;return i===a.length||io(a,i)}return!1}class ru extends ua{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;const n=Ss(e,0);let r=(n==null?void 0:n.length)||0;if(so(e,r))return!1;for(let i=e.length;r<i;r++)if(Fl(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return Ml(e,t)}appendFrame(e,t,n){Qa(e,this.observer,t,n,e.manifestCodec);const r=qa(e,t,n,this.basePTS,this.frameIndex);if(r&&r.missing===0)return r}}const ao=(a,e)=>{let t=0,n=5;e+=n;const r=new Uint32Array(1),i=new Uint32Array(1),s=new Uint8Array(1);for(;n>0;){s[0]=a[e];const o=Math.min(n,8),c=8-o;i[0]=4278190080>>>24+c<<c,r[0]=(s[0]&i[0])>>c,t=t?t<<o|r[0]:r[0],e+=1,n-=o}return t};class iu extends ua{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,n){const r=oo(e,t,n,this.basePTS,this.frameIndex);if(r!==-1)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;const t=Ss(e,0);if(!t)return!1;const n=t.length;return e[n]===11&&e[n+1]===119&&la(t)!==void 0&&ao(e,n)<16}}function oo(a,e,t,n,r){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const i=e[t+4]>>6;if(i>=3)return-1;const o=[48e3,44100,32e3][i],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+i]*2;if(t+f>e.length)return-1;const d=e[t+6]>>5;let g=0;d===2?g+=2:(d&1&&d!==1&&(g+=2),d&4&&(g+=2));const E=(e[t+6]<<8|e[t+7])>>12-g&1,M=[2,1,2,3,3,4,4,5][d]+E,O=e[t+5]>>3,ae=e[t+5]&7,he=new Uint8Array([i<<6|O<<1|ae>>2,(ae&3)<<6|d<<3|E<<2|c>>4,c<<4&224]),_e=1536/o*9e4,Ke=n+r*_e,We=e.subarray(t,t+f);return a.config=he,a.channelCount=M,a.samplerate=o,a.samples.push({unit:We,pts:Ke}),f}class su extends ua{resetInitSegment(e,t,n,r){super.resetInitSegment(e,t,n,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Ss(e,0);let n=(t==null?void 0:t.length)||0;if(t&&e[n]===11&&e[n+1]===119&&la(t)!==void 0&&ao(e,n)<=16)return!1;for(let r=e.length;n<r;n++)if(so(e,n))return X.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return nu(e,t)}appendFrame(e,t,n){if(this.basePTS!==null)return no(e,t,n,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,n,r){const i=this.videoTrack=Di("video",1),s=this.audioTrack=Di("audio",1),o=this.txtTrack=Di("text",1);if(this.id3Track=Di("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=Le(e);if(c.video){const{id:u,timescale:f,codec:d,supplemental:g}=c.video;i.id=u,i.timescale=o.timescale=f,i.codec=d,i.supplemental=g}if(c.audio){const{id:u,timescale:f,codec:d}=c.audio;s.id=u,s.timescale=f,s.codec=d}o.id=wt.text,i.sampleDuration=0,i.duration=s.duration=r}resetContiguity(){this.remainderData=null}static probe(e){return me(e)}demux(e,t){this.timeOffset=t;let n=e;const r=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(n=Ce(this.remainderData,e));const o=Be(n);this.remainderData=o.remainder,r.samples=o.valid||new Uint8Array}else r.samples=n;const s=this.extractID3Track(r,t);return i.samples=De(t,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,n=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const r=this.extractID3Track(t,this.timeOffset);return n.samples=De(e,t),{videoTrack:t,audioTrack:Di(),id3Track:r,textTrack:Di()}}extractID3Track(e,t){const n=this.id3Track;if(e.samples.length){const r=B(e.samples,["emsg"]);r&&r.forEach(i=>{const s=lt(i);if(au.test(s.schemeIdUri)){const o=lo(s,t);let c=s.eventDuration===4294967295?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const u=s.payload;n.samples.push({data:u,len:u.byteLength,dts:o,pts:o,type:hi.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&s.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const o=lo(s,t);n.samples.push({data:s.payload,len:s.payload.byteLength,dts:o,pts:o,type:hi.misbklv,duration:Number.POSITIVE_INFINITY})}})}return n}demuxSampleAes(e,t,n){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 L(a.presentationTime)?a.presentationTime/a.timeScale:e+a.presentationTimeDelta/a.timeScale}class lu{constructor(e,t,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new Xn(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Xt.cbc)}decryptAacSample(e,t,n){const r=e[t].unit;if(r.length<=16)return;const i=r.subarray(16,r.length-r.length%16),s=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(s).then(o=>{const c=new Uint8Array(o);r.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,n)}).catch(n)}decryptAacSamples(e,t,n){for(;;t++){if(t>=e.length){n();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,n),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,n=new Int8Array(t);let r=0;for(let i=32;i<e.length-16;i+=160,r+=16)n.set(e.subarray(i,i+16),r);return n}getAvcDecryptedUnit(e,t){const n=new Uint8Array(t);let r=0;for(let i=32;i<e.length-16;i+=160,r+=16)e.set(n.subarray(r,r+16),i);return e}decryptAvcSample(e,t,n,r,i){const s=Fe(i.data),o=this.getAvcEncryptedData(s);this.decryptBuffer(o.buffer).then(c=>{i.data=this.getAvcDecryptedUnit(s,c),this.decrypter.isSync()||this.decryptAvcSamples(e,t,n+1,r)}).catch(r)}decryptAvcSamples(e,t,n,r){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,n=0){if(t>=e.length){r();return}const i=e[t].units;for(;!(n>=i.length);n++){const s=i[n];if(!(s.data.length<=48||s.type!==1&&s.type!==5)&&(this.decryptAvcSample(e,t,n,r,s),!this.decrypter.isSync()))return}}}}class uo{constructor(){this.VideoSample=null}createVideoSample(e,t,n){return{key:e,frame:!1,pts:t,dts:n,units:[],length:0}}getLastNalUnit(e){var t;let n=this.VideoSample,r;if((!n||n.units.length===0)&&(n=e[e.length-1]),(t=n)!=null&&t.units){const i=n.units;r=i[i.length-1]}return r}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const n=t.samples,r=n.length;if(r){const i=n[r-1];e.pts=i.pts,e.dts=i.dts}else{t.dropped++;return}}t.samples.push(e)}}parseNALu(e,t,n){const r=t.byteLength;let i=e.naluState||0;const s=i,o=[];let c=0,u,f,d,g=-1,E=0;for(i===-1&&(g=0,E=this.getNALuType(t,0),i=0,c=1);c<r;){if(u=t[c++],!i){i=u?0:1;continue}if(i===1){i=u?0:2;continue}if(!u)i=3;else if(u===1){if(f=c-i-1,g>=0){const b={data:t.subarray(g,f),type:E};o.push(b)}else{const b=this.getLastNalUnit(e.samples);b&&(s&&c<=4-s&&b.state&&(b.data=b.data.subarray(0,b.data.byteLength-s)),f>0&&(b.data=Ce(b.data,t.subarray(0,f)),b.state=0))}c<r?(d=this.getNALuType(t,c),g=c,E=d,i=0):i=-1}else i=0}if(g>=0&&i>=0){const b={data:t.subarray(g,r),type:E,state:i};o.push(b)}if(o.length===0){const b=this.getLastNalUnit(e.samples);b&&(b.data=Ce(b.data,t))}return e.naluState=i,o}}class Ts{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,n=e.byteLength-t,r=new Uint8Array(4),i=Math.min(4,t);if(i===0)throw new Error("no bytes available");r.set(e.subarray(n,n+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=i*8,this.bytesAvailable-=i}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 n=this.word>>>32-t;if(e>32&&X.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?n<<t|this.readBits(t):n}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,n,r){const i=this.parseNALu(e,n.data,r);let s=this.VideoSample,o,c=!1;n.data=null,s&&i.length&&!e.audFound&&(this.pushAccessUnit(s,e),s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),i.forEach(u=>{var f,d;switch(u.type){case 1:{let M=!1;o=!0;const O=u.data;if(c&&O.length>4){const ae=this.readSliceType(O);(ae===2||ae===4||ae===7||ae===9)&&(M=!0)}if(M){var g;(g=s)!=null&&g.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null)}s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.frame=!0,s.key=M;break}case 5:o=!0,(f=s)!=null&&f.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null),s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.key=!0,s.frame=!0;break;case 6:{o=!0,Ue(u.data,1,n.pts,t.samples);break}case 7:{var E,b;o=!0,c=!0;const M=u.data,O=this.readSPS(M);if(!e.sps||e.width!==O.width||e.height!==O.height||((E=e.pixelRatio)==null?void 0:E[0])!==O.pixelRatio[0]||((b=e.pixelRatio)==null?void 0:b[1])!==O.pixelRatio[1]){e.width=O.width,e.height=O.height,e.pixelRatio=O.pixelRatio,e.sps=[M];const ae=M.subarray(1,4);let he="avc1.";for(let _e=0;_e<3;_e++){let Ke=ae[_e].toString(16);Ke.length<2&&(Ke="0"+Ke),he+=Ke}e.codec=he}break}case 8:o=!0,e.pps=[u.data];break;case 9:o=!0,e.audFound=!0,(d=s)!=null&&d.frame&&(this.pushAccessUnit(s,e),s=null),s||(s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;case 12:o=!0;break;default:o=!1;break}s&&o&&s.units.push(u)}),r&&s&&(this.pushAccessUnit(s,e),this.VideoSample=null)}getNALuType(e,t){return e[t]&31}readSliceType(e){const t=new Ts(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let n=8,r=8,i;for(let s=0;s<e;s++)r!==0&&(i=t.readEG(),r=(n+i+256)%256),n=r===0?n:r}readSPS(e){const t=new Ts(e);let n=0,r=0,i=0,s=0,o,c,u;const f=t.readUByte.bind(t),d=t.readBits.bind(t),g=t.readUEG.bind(t),E=t.readBoolean.bind(t),b=t.skipBits.bind(t),M=t.skipEG.bind(t),O=t.skipUEG.bind(t),ae=this.skipScalingList.bind(this);f();const he=f();if(d(5),b(3),f(),O(),he===100||he===110||he===122||he===244||he===44||he===83||he===86||he===118||he===128){const ot=g();if(ot===3&&b(1),O(),O(),b(1),E())for(c=ot!==3?8:12,u=0;u<c;u++)E()&&(u<6?ae(16,t):ae(64,t))}O();const _e=g();if(_e===0)g();else if(_e===1)for(b(1),M(),M(),o=g(),u=0;u<o;u++)M();O(),b(1);const Ke=g(),We=g(),mt=d(1);mt===0&&b(1),b(1),E()&&(n=g(),r=g(),i=g(),s=g());let He=[1,1];if(E()&&E())switch(f()){case 1:He=[1,1];break;case 2:He=[12,11];break;case 3:He=[10,11];break;case 4:He=[16,11];break;case 5:He=[40,33];break;case 6:He=[24,11];break;case 7:He=[20,11];break;case 8:He=[32,11];break;case 9:He=[80,33];break;case 10:He=[18,11];break;case 11:He=[15,11];break;case 12:He=[64,33];break;case 13:He=[160,99];break;case 14:He=[4,3];break;case 15:He=[3,2];break;case 16:He=[2,1];break;case 255:{He=[f()<<8|f(),f()<<8|f()];break}}return{width:Math.ceil((Ke+1)*16-n*2-r*2),height:(2-mt)*(We+1)*16-(mt?2:4)*(i+s),pixelRatio:He}}}class cu extends uo{constructor(...e){super(...e),this.initVPS=null}parsePES(e,t,n,r){const i=this.parseNALu(e,n.data,r);let s=this.VideoSample,o,c=!1;n.data=null,s&&i.length&&!e.audFound&&(this.pushAccessUnit(s,e),s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),i.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:s||(s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts)),s.frame=!0,o=!0;break;case 16:case 17:case 18:case 21:if(o=!0,c){var g;(g=s)!=null&&g.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null)}s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.key=!0,s.frame=!0;break;case 19:case 20:o=!0,(f=s)!=null&&f.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null),s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.key=!0,s.frame=!0;break;case 39:o=!0,Ue(u.data,2,n.pts,t.samples);break;case 32:o=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=h(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 E=this.readSPS(u.data);e.width=E.width,e.height=E.height,e.pixelRatio=E.pixelRatio,e.codec=E.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const b in E.params)e.params[b]=E.params[b]}this.pushParameterSet(e.sps,u.data,e.vps),s||(s=this.VideoSample=this.createVideoSample(!0,n.pts,n.dts)),s.key=!0;break;case 34:if(o=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const E=this.readPPS(u.data);for(const b in E)e.params[b]=E[b]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:o=!0,e.audFound=!0,(d=s)!=null&&d.frame&&(this.pushAccessUnit(s,e),s=null),s||(s=this.VideoSample=this.createVideoSample(!1,n.pts,n.dts));break;default:o=!1;break}s&&o&&s.units.push(u)}),r&&s&&(this.pushAccessUnit(s,e),this.VideoSample=null)}pushParameterSet(e,t,n){(n&&n[0]===this.initVPS||!n&&!e.length)&&e.push(t)}getNALuType(e,t){return(e[t]&126)>>>1}ebsp2rbsp(e){const t=new Uint8Array(e.byteLength);let n=0;for(let r=0;r<e.byteLength;r++)r>=2&&e[r]===3&&e[r-1]===0&&e[r-2]===0||(t[n]=e[r],n++);return new Uint8Array(t.buffer,0,n)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){const t=new Ts(e);t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6);const n=t.readBits(3),r=t.readBoolean();return{numTemporalLayers:n+1,temporalIdNested:r}}readSPS(e){const t=new Ts(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);const n=t.readBits(3);t.readBoolean();const r=t.readBits(2),i=t.readBoolean(),s=t.readBits(5),o=t.readUByte(),c=t.readUByte(),u=t.readUByte(),f=t.readUByte(),d=t.readUByte(),g=t.readUByte(),E=t.readUByte(),b=t.readUByte(),M=t.readUByte(),O=t.readUByte(),ae=t.readUByte(),he=[],_e=[];for(let wr=0;wr<n;wr++)he.push(t.readBoolean()),_e.push(t.readBoolean());if(n>0)for(let wr=n;wr<8;wr++)t.readBits(2);for(let wr=0;wr<n;wr++)he[wr]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),_e[wr]&&t.readUByte();t.readUEG();const Ke=t.readUEG();Ke==3&&t.skipBits(1);const We=t.readUEG(),mt=t.readUEG(),He=t.readBoolean();let ot=0,at=0,Je=0,Nt=0;He&&(ot+=t.readUEG(),at+=t.readUEG(),Je+=t.readUEG(),Nt+=t.readUEG());const vn=t.readUEG(),Rn=t.readUEG(),Fn=t.readUEG(),Cn=t.readBoolean();for(let wr=Cn?0:n;wr<=n;wr++)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 ri=0;ri<4;ri++)for(let _i=0;_i<(ri===3?2:6);_i++)if(!t.readBoolean())t.readUEG();else{const Ai=Math.min(64,1<<4+(ri<<1));ri>1&&t.readEG();for(let hs=0;hs<Ai;hs++)t.readEG()}t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());const xn=t.readUEG();let Mn=0;for(let wr=0;wr<xn;wr++){let ri=!1;if(wr!==0&&(ri=t.readBoolean()),ri){wr===xn&&t.readUEG(),t.readBoolean(),t.readUEG();let _i=0;for(let Ji=0;Ji<=Mn;Ji++){const Ai=t.readBoolean();let hs=!1;Ai||(hs=t.readBoolean()),(Ai||hs)&&_i++}Mn=_i}else{const _i=t.readUEG(),Ji=t.readUEG();Mn=_i+Ji;for(let Ai=0;Ai<_i;Ai++)t.readUEG(),t.readBoolean();for(let Ai=0;Ai<Ji;Ai++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){const wr=t.readUEG();for(let ri=0;ri<wr;ri++){for(let _i=0;_i<Fn+4;_i++)t.readBits(1);t.readBits(1)}}let hn=0,pn=1,hr=1,Ir=!0,vr=1,xr=0;t.readBoolean(),t.readBoolean();let ni=!1;if(t.readBoolean()){if(t.readBoolean()){const qi=t.readUByte(),vl=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],ta=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];qi>0&&qi<16?(pn=vl[qi-1],hr=ta[qi-1]):qi===255&&(pn=t.readBits(16),hr=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(),ni=t.readBoolean(),ni&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(vr=t.readBits(32),xr=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){const ta=t.readBoolean(),_l=t.readBoolean();let Cs=!1;(ta||_l)&&(Cs=t.readBoolean(),Cs&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),Cs&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let yl=0;yl<=n;yl++){Ir=t.readBoolean();const zf=Ir||t.readBoolean();let El=!1;zf?t.readEG():El=t.readBoolean();const bl=El?1:t.readUEG()+1;if(ta)for(let Is=0;Is<bl;Is++)t.readUEG(),t.readUEG(),Cs&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(_l)for(let Is=0;Is<bl;Is++)t.readUEG(),t.readUEG(),Cs&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),hn=t.readUEG())}let vi=We,Li=mt;if(He){let wr=1,ri=1;Ke===1?wr=ri=2:Ke==2&&(wr=2),vi=We-wr*at-wr*ot,Li=mt-ri*Nt-ri*Je}const Qi=r?["A","B","C"][r]:"",Vf=o<<24|c<<16|u<<8|f;let Ga=0;for(let wr=0;wr<32;wr++)Ga=(Ga|(Vf>>wr&1)<<31-wr)>>>0;let Va=Ga.toString(16);return s===1&&Va==="2"&&(Va="6"),{codecString:`hvc1.${Qi}${s}.${Va}.${i?"H":"L"}${ae}.B0`,params:{general_tier_flag:i,general_profile_idc:s,general_profile_space:r,general_profile_compatibility_flags:[o,c,u,f],general_constraint_indicator_flags:[d,g,E,b,M,O],general_level_idc:ae,bit_depth:vn+8,bit_depth_luma_minus8:vn,bit_depth_chroma_minus8:Rn,min_spatial_segmentation_idc:hn,chroma_format_idc:Ke,frame_rate:{fixed:Ir,fps:xr/vr}},width:vi,height:Li,pixelRatio:[pn,hr]}}readPPS(e){const t=new Ts(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 r=t.readBoolean(),i=t.readBoolean();let s=1;return i&&r?s=0:i?s=3:r&&(s=2),{parallelismType:s}}matchSPS(e,t){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,t).substr(3)}}const Gr=188;class Gi{constructor(e,t,n,r){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=n,this.logger=r,this.videoParser=null}static probe(e,t){const n=Gi.syncOffset(e);return n>0&&t.warn(`MPEG2-TS detected but first sync word found @ offset ${n}`),n!==-1}static syncOffset(e){const t=e.length;let n=Math.min(Gr*5,t-Gr)+1,r=0;for(;r<n;){let i=!1,s=-1,o=0;for(let c=r;c<t;c+=Gr)if(e[c]===71&&(t-c===Gr||e[c+Gr]===71)){if(o++,s===-1&&(s=c,s!==0&&(n=Math.min(s+Gr*99,e.length-Gr)+1)),i||(i=fa(e,c)===0),i&&o>1&&(s===0&&o>2||c+Gr>n))return s}else{if(o)return-1;break}r++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:wt[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,n,r){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Gi.createTrack("video"),this._videoTrack.duration=r,this._audioTrack=Gi.createTrack("audio",r),this._id3Track=Gi.createTrack("id3"),this._txtTrack=Gi.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:n}=this;e&&(e.pesData=null),t&&(t.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,n=!1,r=!1){n||(this.sampleAes=null);let i;const s=this._videoTrack,o=this._audioTrack,c=this._id3Track,u=this._txtTrack;let f=s.pid,d=s.pesData,g=o.pid,E=c.pid,b=o.pesData,M=c.pesData,O=null,ae=this.pmtParsed,he=this._pmtId,_e=e.length;if(this.remainderData&&(e=Ce(this.remainderData,e),_e=e.length,this.remainderData=null),_e<Gr&&!r)return this.remainderData=e,{audioTrack:o,videoTrack:s,id3Track:c,textTrack:u};const Ke=Math.max(0,Gi.syncOffset(e));_e-=(_e-Ke)%Gr,_e<e.byteLength&&!r&&(this.remainderData=new Uint8Array(e.buffer,_e,e.buffer.byteLength-_e));let We=0;for(let He=Ke;He<_e;He+=Gr)if(e[He]===71){const ot=!!(e[He+1]&64),at=fa(e,He),Je=(e[He+3]&48)>>4;let Nt;if(Je>1){if(Nt=He+5+e[He+4],Nt===He+Gr)continue}else Nt=He+4;switch(at){case f:ot&&(d&&(i=os(d,this.logger))&&(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(s,u,i,!1)),d={data:[],size:0}),d&&(d.data.push(e.subarray(Nt,He+Gr)),d.size+=He+Gr-Nt);break;case g:if(ot){if(b&&(i=os(b,this.logger)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,i);break;case"mp3":this.parseMPEGPES(o,i);break;case"ac3":this.parseAC3PES(o,i);break}b={data:[],size:0}}b&&(b.data.push(e.subarray(Nt,He+Gr)),b.size+=He+Gr-Nt);break;case E:ot&&(M&&(i=os(M,this.logger))&&this.parseID3PES(c,i),M={data:[],size:0}),M&&(M.data.push(e.subarray(Nt,He+Gr)),M.size+=He+Gr-Nt);break;case 0:ot&&(Nt+=e[Nt]+1),he=this._pmtId=fu(e,Nt);break;case he:{ot&&(Nt+=e[Nt]+1);const vn=du(e,Nt,this.typeSupported,n,this.observer,this.logger);f=vn.videoPid,f>0&&(s.pid=f,s.segmentCodec=vn.segmentVideoCodec),g=vn.audioPid,g>0&&(o.pid=g,o.segmentCodec=vn.segmentAudioCodec),E=vn.id3Pid,E>0&&(c.pid=E),O!==null&&!ae&&(this.logger.warn(`MPEG-TS PMT found at ${He} after unknown PID '${O}'. Backtracking to sync byte @${Ke} to parse all TS packets.`),O=null,He=Ke-188),ae=this.pmtParsed=!0;break}case 17:case 8191:break;default:O=at;break}}else We++;We>0&&da(this.observer,new Error(`Found ${We} TS packet/s that do not start with 0x47`),void 0,this.logger),s.pesData=d,o.pesData=b,c.pesData=M;const mt={audioTrack:o,videoTrack:s,id3Track:c,textTrack:u};return r&&this.extractRemainingSamples(mt),mt}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:n,id3Track:r,textTrack:i}=e,s=n.pesData,o=t.pesData,c=r.pesData;let u;if(s&&(u=os(s,this.logger))?(this.readyVideoParser(n.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(n,i,u,!0),n.pesData=null)):n.pesData=s,o&&(u=os(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=os(c,this.logger))?(this.parseID3PES(r,u),r.pesData=null):r.pesData=c}demuxSampleAes(e,t,n){const r=this.demux(e,n,!0,!this.config.progressive),i=this.sampleAes=new lu(this.observer,this.config,t);return this.decrypt(r,i)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new uu:e==="hevc"&&(this.videoParser=new cu))}decrypt(e,t){return new Promise(n=>{const{audioTrack:r,videoTrack:i}=e;r.samples&&r.segmentCodec==="aac"?t.decryptAacSamples(r.samples,0,()=>{i.samples?t.decryptAvcSamples(i.samples,0,0,()=>{n(e)}):n(e)}):i.samples&&t.decryptAvcSamples(i.samples,0,0,()=>{n(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 n=0;const r=this.aacOverFlow;let i=t.data;if(r){this.aacOverFlow=null;const d=r.missing,g=r.sample.unit.byteLength;if(d===-1)i=Ce(r.sample.unit,i);else{const E=g-d;r.sample.unit.set(i.subarray(0,d),E),e.samples.push(r.sample),n=r.missing}}let s,o;for(s=n,o=i.length;s<o-1&&!Fs(i,s);s++);if(s!==n){let d;const g=s<o-1;if(g?d=`AAC PES did not start with ADTS header,offset:${s}`:d="No ADTS header found in AAC PES",da(this.observer,new Error(d),g,this.logger),!g)return}Qa(e,this.observer,i,s,this.audioCodec);let c;if(t.pts!==void 0)c=t.pts;else if(r){const d=Ja(e.samplerate);c=r.sample.pts+d}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,f;for(;s<o;)if(f=qa(e,i,s,c,u),s+=f.length,f.missing){this.aacOverFlow=f;break}else for(u++;s<o-1&&!Fs(i,s);s++);}parseMPEGPES(e,t){const n=t.data,r=n.length;let i=0,s=0;const o=t.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;s<r;)if(io(n,s)){const c=no(e,n,s,o,i);if(c)s+=c.length,i++;else break}else s++}parseAC3PES(e,t){{const n=t.data,r=t.pts;if(r===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const i=n.length;let s=0,o=0,c;for(;o<i&&(c=oo(e,n,o,r,s++))>0;)o+=c}}parseID3PES(e,t){if(t.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const n=h({},t,{type:this._videoTrack?hi.emsg:hi.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(n)}}function fa(a,e){return((a[e+1]&31)<<8)+a[e+2]}function fu(a,e){return(a[e+10]&31)<<8|a[e+11]}function du(a,e,t,n,r,i){const s={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=fa(a,e),d=(a[e+3]&15)<<8|a[e+4];switch(a[e]){case 207:if(!n){ha("ADTS AAC",i);break}case 15:s.audioPid===-1&&(s.audioPid=f);break;case 21:s.id3Pid===-1&&(s.id3Pid=f);break;case 219:if(!n){ha("H.264",i);break}case 27:s.videoPid===-1&&(s.videoPid=f);break;case 3:case 4:!t.mpeg&&!t.mp3?i.log("MPEG audio found, not supported in this browser"):s.audioPid===-1&&(s.audioPid=f,s.segmentAudioCodec="mp3");break;case 193:if(!n){ha("AC-3",i);break}case 129:t.ac3?s.audioPid===-1&&(s.audioPid=f,s.segmentAudioCodec="ac3"):i.log("AC-3 audio found, not supported in this browser");break;case 6:if(s.audioPid===-1&&d>0){let g=e+5,E=d;for(;E>2;){switch(a[g]){case 106:t.ac3!==!0?i.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=f,s.segmentAudioCodec="ac3");break}const M=a[g+1]+2;g+=M,E-=M}}break;case 194:case 135:return da(r,new Error("Unsupported EC-3 in M2TS found"),void 0,i),s;case 36:s.videoPid===-1&&(s.videoPid=f,s.segmentVideoCodec="hevc",i.log("HEVC in M2TS found"));break}e+=d+5}return s}function da(a,e,t,n){n.warn(`parsing error: ${e.message}`),a.emit(p.ERROR,p.ERROR,{type:ue.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function ha(a,e){e.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function os(a,e){let t=0,n,r,i,s,o;const c=a.data;if(!a||a.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Ce(c[0],c[1]),c.splice(1,1);if(n=c[0],(n[0]<<16)+(n[1]<<8)+n[2]===1){if(r=(n[4]<<8)+n[5],r&&r>a.size-6)return null;const f=n[7];f&192&&(s=(n[9]&14)*536870912+(n[10]&255)*4194304+(n[11]&254)*16384+(n[12]&255)*128+(n[13]&254)/2,f&64?(o=(n[14]&14)*536870912+(n[15]&255)*4194304+(n[16]&254)*16384+(n[17]&255)*128+(n[18]&254)/2,s-o>60*9e4&&(e.warn(`${Math.round((s-o)/9e4)}s delta between PTS and DTS, align them`),s=o)):o=s),i=n[8];let d=i+9;if(a.size<=d)return null;a.size-=d;const g=new Uint8Array(a.size);for(let E=0,b=c.length;E<b;E++){n=c[E];let M=n.byteLength;if(d)if(d>M){d-=M;continue}else n=n.subarray(d),M-=d,d=0;g.set(n,t),t+=M}return r&&(r-=i+3),{data:g,pts:s,dts:o,len:r}}return null}class hu{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 Vi=Math.pow(2,32)-1;class nt{static init(){nt.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 nt.types)nt.types.hasOwnProperty(e)&&(nt.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]),n=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]);nt.HDLR_TYPES={video:t,audio:n};const r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);nt.STTS=nt.STSC=nt.STCO=i,nt.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),nt.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),nt.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),nt.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);nt.FTYP=nt.box(nt.types.ftyp,s,c,s,o),nt.DINF=nt.box(nt.types.dinf,nt.box(nt.types.dref,r))}static box(e,...t){let n=8,r=t.length;const i=r;for(;r--;)n+=t[r].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=n&255,s.set(e,4),r=0,n=8;r<i;r++)s.set(t[r],n),n+=t[r].byteLength;return s}static hdlr(e){return nt.box(nt.types.hdlr,nt.HDLR_TYPES[e])}static mdat(e){return nt.box(nt.types.mdat,e)}static mdhd(e,t){t*=e;const n=Math.floor(t/(Vi+1)),r=Math.floor(t%(Vi+1));return nt.box(nt.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,n>>24,n>>16&255,n>>8&255,n&255,r>>24,r>>16&255,r>>8&255,r&255,85,196,0,0]))}static mdia(e){return nt.box(nt.types.mdia,nt.mdhd(e.timescale||0,e.duration||0),nt.hdlr(e.type),nt.minf(e))}static mfhd(e){return nt.box(nt.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"?nt.box(nt.types.minf,nt.box(nt.types.smhd,nt.SMHD),nt.DINF,nt.stbl(e)):nt.box(nt.types.minf,nt.box(nt.types.vmhd,nt.VMHD),nt.DINF,nt.stbl(e))}static moof(e,t,n){return nt.box(nt.types.moof,nt.mfhd(e),nt.traf(n,t))}static moov(e){let t=e.length;const n=[];for(;t--;)n[t]=nt.trak(e[t]);return nt.box.apply(null,[nt.types.moov,nt.mvhd(e[0].timescale||0,e[0].duration||0)].concat(n).concat(nt.mvex(e)))}static mvex(e){let t=e.length;const n=[];for(;t--;)n[t]=nt.trex(e[t]);return nt.box.apply(null,[nt.types.mvex,...n])}static mvhd(e,t){t*=e;const n=Math.floor(t/(Vi+1)),r=Math.floor(t%(Vi+1)),i=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,n>>24,n>>16&255,n>>8&255,n&255,r>>24,r>>16&255,r>>8&255,r&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 nt.box(nt.types.mvhd,i)}static sdtp(e){const t=e.samples||[],n=new Uint8Array(4+t.length);let r,i;for(r=0;r<t.length;r++)i=t[r].flags,n[r+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return nt.box(nt.types.sdtp,n)}static stbl(e){return nt.box(nt.types.stbl,nt.stsd(e),nt.box(nt.types.stts,nt.STTS),nt.box(nt.types.stsc,nt.STSC),nt.box(nt.types.stsz,nt.STSZ),nt.box(nt.types.stco,nt.STCO))}static avc1(e){let t=[],n=[],r,i,s;for(r=0;r<e.sps.length;r++)i=e.sps[r],s=i.byteLength,t.push(s>>>8&255),t.push(s&255),t=t.concat(Array.prototype.slice.call(i));for(r=0;r<e.pps.length;r++)i=e.pps[r],s=i.byteLength,n.push(s>>>8&255),n.push(s&255),n=n.concat(Array.prototype.slice.call(i));const o=nt.box(nt.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(n))),c=e.width,u=e.height,f=e.pixelRatio[0],d=e.pixelRatio[1];return nt.box(nt.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,nt.box(nt.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),nt.box(nt.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 nt.box(nt.types.mp4a,nt.audioStsd(e),nt.box(nt.types.esds,nt.esds(e)))}static mp3(e){return nt.box(nt.types[".mp3"],nt.audioStsd(e))}static ac3(e){return nt.box(nt.types["ac-3"],nt.audioStsd(e),nt.box(nt.types.dac3,e.config))}static stsd(e){const{segmentCodec:t}=e;if(e.type==="audio"){if(t==="aac")return nt.box(nt.types.stsd,nt.STSD,nt.mp4a(e));if(t==="ac3"&&e.config)return nt.box(nt.types.stsd,nt.STSD,nt.ac3(e));if(t==="mp3"&&e.codec==="mp3")return nt.box(nt.types.stsd,nt.STSD,nt.mp3(e))}else if(e.pps&&e.sps){if(t==="avc")return nt.box(nt.types.stsd,nt.STSD,nt.avc1(e));if(t==="hevc"&&e.vps)return nt.box(nt.types.stsd,nt.STSD,nt.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,n=(e.duration||0)*(e.timescale||0),r=e.width||0,i=e.height||0,s=Math.floor(n/(Vi+1)),o=Math.floor(n%(Vi+1));return nt.box(nt.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,r&255,0,0,i>>8&255,i&255,0,0]))}static traf(e,t){const n=nt.sdtp(e),r=e.id,i=Math.floor(t/(Vi+1)),s=Math.floor(t%(Vi+1));return nt.box(nt.types.traf,nt.box(nt.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,r&255])),nt.box(nt.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,i&255,s>>24,s>>16&255,s>>8&255,s&255])),nt.trun(e,n.length+16+20+8+16+8+8),n)}static trak(e){return e.duration=e.duration||4294967295,nt.box(nt.types.trak,nt.tkhd(e),nt.mdia(e))}static trex(e){const t=e.id;return nt.box(nt.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 n=e.samples||[],r=n.length,i=12+16*r,s=new Uint8Array(i);let o,c,u,f,d,g;for(t+=8+i,s.set([e.type==="video"?1:0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,r&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<r;o++)c=n[o],u=c.duration,f=c.size,d=c.flags,g=c.cts,s.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,g>>>24&255,g>>>16&255,g>>>8&255,g&255],12+16*o);return nt.box(nt.types.trun,s)}static initSegment(e){nt.types||nt.init();const t=nt.moov(e);return Ce(nt.FTYP,t)}static hvc1(e){const t=e.params,n=[e.vps,e.sps,e.pps],r=4,i=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),r-1|t.temporal_id_nested<<2|t.num_temporal_layers<<3|(t.frame_rate.fixed?64:0),n.length]);let s=i.length;for(let b=0;b<n.length;b+=1){s+=3;for(let M=0;M<n[b].length;M+=1)s+=2+n[b][M].length}const o=new Uint8Array(s);o.set(i,0),s=i.length;const c=n.length-1;for(let b=0;b<n.length;b+=1){o.set(new Uint8Array([32+b|(b===c?128:0),0,n[b].length]),s),s+=3;for(let M=0;M<n[b].length;M+=1)o.set(new Uint8Array([n[b][M].length>>8,n[b][M].length&255]),s),s+=2,o.set(n[b][M],s),s+=n[b][M].length}const u=nt.box(nt.types.hvcC,o),f=e.width,d=e.height,g=e.pixelRatio[0],E=e.pixelRatio[1];return nt.box(nt.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,nt.box(nt.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),nt.box(nt.types.pasp,new Uint8Array([g>>24,g>>16&255,g>>8&255,g&255,E>>24,E>>16&255,E>>8&255,E&255])))}}nt.types=void 0,nt.HDLR_TYPES=void 0,nt.STTS=void 0,nt.STSC=void 0,nt.STCO=void 0,nt.STSZ=void 0,nt.VMHD=void 0,nt.SMHD=void 0,nt.STSD=void 0,nt.FTYP=void 0,nt.DINF=void 0;const co=9e4;function pa(a,e,t=1,n=!1){const r=a*e*t;return n?Math.round(r):r}function pu(a,e,t=1,n=!1){return pa(a,e,1/t,n)}function ws(a,e=!1){return pa(a,1e3,1/co,e)}function gu(a,e=1){return pa(a,co,1/e)}function fo(a){const{baseTime:e,timescale:t,trackId:n}=a;return`${e/t} (${e}/${t}) trackId: ${n}`}const mu=10*1e3,vu=1024,_u=1152,yu=1536;let ls=null,ga=null;function ho(a,e,t,n){return{duration:e,size:t,cts:n,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class Us extends Z{constructor(e,t,n,r){if(super("mp4-remuxer",r),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=n,this.ISGenerated=!1,ls===null){const s=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);ls=s?parseInt(s[1]):0}if(ga===null){const i=navigator.userAgent.match(/Safari\/(\d+)/i);ga=i?parseInt(i[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&&fo(t)} > ${e&&fo(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 n=e[0].pts,r=e.reduce((i,s)=>{let o=s.pts,c=o-i;return c<-4294967296&&(t=!0,o=pi(o,n),c=o-i),c>0?i:o},n);return t&&this.debug("PTS rollover detected"),r}remux(e,t,n,r,i,s,o,c){let u,f,d,g,E,b,M=i,O=i;const ae=e.pid>-1,he=t.pid>-1,_e=t.samples.length,Ke=e.samples.length>0,We=o&&_e>0||_e>1;if((!ae||Ke)&&(!he||We)||this.ISGenerated||o){if(this.ISGenerated){var He,ot,at,Je;const Fn=this.videoTrackConfig;(Fn&&(t.width!==Fn.width||t.height!==Fn.height||((He=t.pixelRatio)==null?void 0:He[0])!==((ot=Fn.pixelRatio)==null?void 0:ot[0])||((at=t.pixelRatio)==null?void 0:at[1])!==((Je=Fn.pixelRatio)==null?void 0:Je[1]))||!Fn&&We||this.nextAudioTs===null&&Ke)&&this.resetInitSegment()}this.ISGenerated||(d=this.generateIS(e,t,i,s));const Nt=this.isVideoContiguous;let vn=-1,Rn;if(We&&(vn=Eu(t.samples),!Nt&&this.config.forceKeyFrameOnDiscontinuity))if(b=!0,vn>0){this.warn(`Dropped ${vn} out of ${_e} video samples due to a missing keyframe`);const Fn=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(vn),t.dropped+=vn,O+=(t.samples[0].pts-Fn)/t.inputTimeScale,Rn=O}else vn===-1&&(this.warn(`No keyframe found out of ${_e} video samples`),b=!1);if(this.ISGenerated){if(Ke&&We){const Fn=this.getVideoStartPts(t.samples),ln=(pi(e.samples[0].pts,Fn)-Fn)/t.inputTimeScale;M+=Math.max(0,ln),O+=Math.max(0,-ln)}if(Ke){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),d=this.generateIS(e,t,i,s)),f=this.remuxAudio(e,M,this.isAudioContiguous,s,he||We||c===le.AUDIO?O:void 0),We){const Fn=f?f.endPTS-f.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),d=this.generateIS(e,t,i,s)),u=this.remuxVideo(t,O,Nt,Fn)}}else We&&(u=this.remuxVideo(t,O,Nt,0));u&&(u.firstKeyFrame=vn,u.independent=vn!==-1,u.firstKeyFramePTS=Rn)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(n.samples.length&&(E=po(n,i,this._initPTS,this._initDTS)),r.samples.length&&(g=go(r,i,this._initPTS))),{audio:f,video:u,initSegment:d,independent:b,text:g,id3:E}}computeInitPts(e,t,n,r){const i=Math.round(n*t);let s=pi(e,i);if(s<i+t)for(this.log(`Adjusting PTS for rollover in timeline near ${(i-s)/t} ${r}`);s<i+t;)s+=8589934592;return s-i}generateIS(e,t,n,r){const i=e.samples,s=t.samples,o=this.typeSupported,c={},u=this._initPTS;let f=!u||r,d="audio/mp4",g,E,b,M=-1;if(f&&(g=E=1/0),e.config&&i.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):nt.initSegment([e]),metadata:{channelCount:e.channelCount}},f&&(M=e.id,b=e.inputTimeScale,!u||b!==u.timescale?g=E=this.computeInitPts(i[0].pts,b,n,"audio"):f=!1)}if(t.sps&&t.pps&&s.length){if(t.timescale=t.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:nt.initSegment([t]),metadata:{width:t.width,height:t.height}},f)if(M=t.id,b=t.inputTimeScale,!u||b!==u.timescale){const O=this.getVideoStartPts(s),ae=pi(s[0].dts,O),he=this.computeInitPts(ae,b,n,"video"),_e=this.computeInitPts(O,b,n,"video");E=Math.min(E,he),g=Math.min(g,_e)}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: ${r?"":"~"}${n} ${g/b} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${n} offset: ${g/b} (${g}/${b}) trackId: ${M}`),this._initPTS={baseTime:g,timescale:b,trackId:M},this._initDTS={baseTime:E,timescale:b,trackId:M}):g=b=void 0,{tracks:c,initPTS:g,timescale:b,trackId:M}}remuxVideo(e,t,n,r){const i=e.inputTimeScale,s=e.samples,o=[],c=s.length,u=this._initPTS,f=u.baseTime*i/u.timescale;let d=this.nextVideoTs,g=8,E=this.videoSampleDuration,b,M,O=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,he=!1;if(!n||d===null){const hn=f+t*i,pn=s[0].pts-pi(s[0].dts,s[0].pts);ls&&d!==null&&Math.abs(hn-pn-(d+f))<15e3?n=!0:d=hn-pn-f}const _e=d+f;for(let hn=0;hn<c;hn++){const pn=s[hn];pn.pts=pi(pn.pts,_e),pn.dts=pi(pn.dts,_e),pn.dts<s[hn>0?hn-1:hn].dts&&(he=!0)}he&&s.sort(function(hn,pn){const hr=hn.dts-pn.dts,Ir=hn.pts-pn.pts;return hr||Ir}),b=s[0].dts,M=s[s.length-1].dts;const Ke=M-b,We=Ke?Math.round(Ke/(c-1)):E||e.inputTimeScale/30;if(n){const hn=b-_e,pn=hn>We,hr=hn<-1;if((pn||hr)&&(pn?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ws(hn,!0)} ms (${hn}dts) hole between fragments detected at ${t.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${ws(-hn,!0)} ms (${hn}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!hr||_e>=s[0].pts||ls)){b=_e;const Ir=s[0].pts-hn;if(pn)s[0].dts=b,s[0].pts=Ir;else{let vr=!0;for(let xr=0;xr<s.length&&!(s[xr].dts>Ir&&vr);xr++){const ni=s[xr].pts;if(s[xr].dts-=hn,s[xr].pts-=hn,xr<s.length-1){const Yr=s[xr+1].pts,vi=s[xr].pts,Li=Yr<=vi,Qi=Yr<=ni;vr=Li==Qi}}}this.log(`Video: Initial PTS/DTS adjusted: ${ws(Ir,!0)}/${ws(b,!0)}, delta: ${ws(hn,!0)} ms`)}}b=Math.max(0,b);let mt=0,He=0,ot=b;for(let hn=0;hn<c;hn++){const pn=s[hn],hr=pn.units,Ir=hr.length;let vr=0;for(let xr=0;xr<Ir;xr++)vr+=hr[xr].data.length;He+=vr,mt+=Ir,pn.length=vr,pn.dts<ot?(pn.dts=ot,ot+=We/4|0||1):ot=pn.dts,O=Math.min(pn.pts,O),ae=Math.max(pn.pts,ae)}M=s[c-1].dts;const at=He+4*mt+8;let Je;try{Je=new Uint8Array(at)}catch(hn){this.observer.emit(p.ERROR,p.ERROR,{type:ue.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:hn,bytes:at,reason:`fail allocating video mdat ${at}`});return}const Nt=new DataView(Je.buffer);Nt.setUint32(0,at),Je.set(nt.types.mdat,4);let vn=!1,Rn=Number.POSITIVE_INFINITY,Fn=Number.POSITIVE_INFINITY,Cn=Number.NEGATIVE_INFINITY,ln=Number.NEGATIVE_INFINITY;for(let hn=0;hn<c;hn++){const pn=s[hn],hr=pn.units;let Ir=0;for(let ni=0,Yr=hr.length;ni<Yr;ni++){const vi=hr[ni],Li=vi.data,Qi=vi.data.byteLength;Nt.setUint32(g,Qi),g+=4,Je.set(Li,g),g+=Qi,Ir+=4+Qi}let vr;if(hn<c-1)E=s[hn+1].dts-pn.dts,vr=s[hn+1].pts-pn.pts;else{const ni=this.config,Yr=hn>0?pn.dts-s[hn-1].dts:We;if(vr=hn>0?pn.pts-s[hn-1].pts:We,ni.stretchShortVideoTrack&&this.nextAudioTs!==null){const vi=Math.floor(ni.maxBufferHole*i),Li=(r?O+r*i:this.nextAudioTs+f)-pn.pts;Li>vi?(E=Li-Yr,E<0?E=Yr:vn=!0,this.log(`It is approximately ${Li/90} ms to the next segment; using duration ${E/90} ms for the last video frame.`)):E=Yr}else E=Yr}const xr=Math.round(pn.pts-pn.dts);Rn=Math.min(Rn,E),Cn=Math.max(Cn,E),Fn=Math.min(Fn,vr),ln=Math.max(ln,vr),o.push(ho(pn.key,E,Ir,xr))}if(o.length){if(ls){if(ls<70){const hn=o[0].flags;hn.dependsOn=2,hn.isNonSync=0}}else if(ga&&ln-Fn<Cn-Rn&&We/Cn<.025&&o[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let hn=b;for(let pn=0,hr=o.length;pn<hr;pn++){const Ir=hn+o[pn].duration,vr=hn+o[pn].cts;if(pn<hr-1){const xr=Ir+o[pn+1].cts;o[pn].duration=xr-vr}else o[pn].duration=pn?o[pn-1].duration:We;o[pn].cts=0,hn=Ir}}}E=vn||!E?We:E;const Pn=M+E;this.nextVideoTs=d=Pn-f,this.videoSampleDuration=E,this.isVideoContiguous=!0;const nr={data1:nt.moof(e.sequenceNumber++,b,h(e,{samples:o})),data2:Je,startPTS:(O-f)/i,endPTS:(ae+E-f)/i,startDTS:(b-f)/i,endDTS:d/i,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,nr}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return _u;case"ac3":return yu;default:return vu}}remuxAudio(e,t,n,r,i){const s=e.inputTimeScale,o=e.samplerate?e.samplerate:s,c=s/o,u=this.getSamplesPerFrame(e),f=u*c,d=this._initPTS,g=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,E=[],b=i!==void 0;let M=e.samples,O=g?0:8,ae=this.nextAudioTs||-1;const he=d.baseTime*s/d.timescale,_e=he+t*s;if(this.isAudioContiguous=n=n||M.length&&ae>0&&(r&&Math.abs(_e-(ae+he))<9e3||Math.abs(pi(M[0].pts,_e)-(ae+he))<20*f),M.forEach(function(ln){ln.pts=pi(ln.pts,_e)}),!n||ae<0){const ln=M.length;if(M=M.filter(Pn=>Pn.pts>=0),ln!==M.length&&this.warn(`Removed ${M.length-ln} of ${ln} samples (initPTS ${he} / ${s})`),!M.length)return;i===0?ae=0:r&&!b?ae=Math.max(0,_e-he):ae=M[0].pts-he}if(e.segmentCodec==="aac"){const ln=this.config.maxAudioFramesDrift;for(let Pn=0,xn=ae+he;Pn<M.length;Pn++){const Mn=M[Pn],nr=Mn.pts,hn=nr-xn,pn=Math.abs(1e3*hn/s);if(hn<=-ln*f&&b)Pn===0&&(this.warn(`Audio frame @ ${(nr/s).toFixed(3)}s overlaps marker by ${Math.round(1e3*hn/s)} ms.`),this.nextAudioTs=ae=nr-he,xn=nr);else if(hn>=ln*f&&pn<mu&&b){let hr=Math.round(hn/f);for(xn=nr-hr*f;xn<0&&hr&&f;)hr--,xn+=f;Pn===0&&(this.nextAudioTs=ae=xn-he),this.warn(`Injecting ${hr} audio frames @ ${((xn-he)/s).toFixed(3)}s due to ${Math.round(1e3*hn/s)} ms gap.`);for(let Ir=0;Ir<hr;Ir++){let vr=hu.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);vr||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),vr=Mn.unit.subarray()),M.splice(Pn,0,{unit:vr,pts:xn}),xn+=f,Pn++}}Mn.pts=xn,xn+=f}}let Ke=null,We=null,mt,He=0,ot=M.length;for(;ot--;)He+=M[ot].unit.byteLength;for(let ln=0,Pn=M.length;ln<Pn;ln++){const xn=M[ln],Mn=xn.unit;let nr=xn.pts;if(We!==null){const pn=E[ln-1];pn.duration=Math.round((nr-We)/c)}else if(n&&e.segmentCodec==="aac"&&(nr=ae+he),Ke=nr,He>0){He+=O;try{mt=new Uint8Array(He)}catch(pn){this.observer.emit(p.ERROR,p.ERROR,{type:ue.MUX_ERROR,details:$.REMUX_ALLOC_ERROR,fatal:!1,error:pn,bytes:He,reason:`fail allocating audio mdat ${He}`});return}g||(new DataView(mt.buffer).setUint32(0,He),mt.set(nt.types.mdat,4))}else return;mt.set(Mn,O);const hn=Mn.byteLength;O+=hn,E.push(ho(!0,u,hn,0)),We=nr}const at=E.length;if(!at)return;const Je=E[E.length-1];ae=We-he,this.nextAudioTs=ae+c*Je.duration;const Nt=g?new Uint8Array(0):nt.moof(e.sequenceNumber++,Ke/c,h({},e,{samples:E}));e.samples=[];const vn=(Ke-he)/s,Rn=ae/s,Cn={data1:Nt,data2:mt,startPTS:vn,endPTS:Rn,startDTS:vn,endDTS:Rn,type:"audio",hasAudio:!0,hasVideo:!1,nb:at};return this.isAudioContiguous=!0,Cn}}function pi(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,n){const r=a.samples.length;if(!r)return;const i=a.inputTimeScale;for(let o=0;o<r;o++){const c=a.samples[o];c.pts=pi(c.pts-t.baseTime*i/t.timescale,e*i)/i,c.dts=pi(c.dts-n.baseTime*i/n.timescale,e*i)/i}const s=a.samples;return a.samples=[],{samples:s}}function go(a,e,t){const n=a.samples.length;if(!n)return;const r=a.inputTimeScale;for(let s=0;s<n;s++){const o=a.samples[s];o.pts=pi(o.pts-t.baseTime*r/t.timescale,e*r)/r}a.samples.sort((s,o)=>s.pts-o.pts);const i=a.samples;return a.samples=[],{samples:i}}class bu extends Z{constructor(e,t,n,r){super("passthrough-remuxer",r),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,n,r){this.audioCodec=t,this.videoCodec=n,this.generateInitSegment(e,r),this.emitInitSegment=!0}generateInitSegment(e,t){let{audioCodec:n,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:i,video:s}=this.initData=Le(e);if(t)J(e,t);else{const c=i||s;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}i&&(n=mo(i,P.AUDIO,this)),s&&(r=mo(s,P.VIDEO,this));const o={};i&&s?o.audiovideo={container:"video/mp4",codec:n+","+r,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:i?o.audio={container:"audio/mp4",codec:n,encrypted:i.encrypted,initSegment:e,id:"audio"}:s?o.video={container:"video/mp4",codec:r,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,n,r,i,s){var o,c;let{initPTS:u,lastEndTime:f}=this;const d={audio:void 0,video:void 0,text:r,id3:n,initSegment:void 0};L(f)||(f=this.lastEndTime=i||0);const g=t.samples;if(!g.length)return d;const E={initPTS:void 0,timescale:void 0,trackId:void 0};let b=this.initData;if((o=b)!=null&&o.length||(this.generateInitSegment(g),b=this.initData),!((c=b)!=null&&c.length))return this.warn("Failed to generate initSegment."),d;this.emitInitSegment&&(E.tracks=this.initTracks,this.emitInitSegment=!1);const M=Ee(g,b,this),O=b.audio?M[b.audio.id]:null,ae=b.video?M[b.video.id]:null,he=$s(ae,1/0),_e=$s(O,1/0),Ke=$s(ae,0,!0),We=$s(O,0,!0);let mt=i,He=0;const ot=O&&(!ae||!u&&_e<he||u&&u.trackId===b.audio.id),at=ot?O:ae;if(at){const xn=at.timescale,Mn=at.start-i*xn,nr=ot?b.audio.id:b.video.id;mt=at.start/xn,He=ot?We-_e:Ke-he,(s||!u)&&(xu(u,mt,i,He)||xn!==u.timescale)&&(u&&this.warn(`Timestamps at playlist time: ${s?"":"~"}${i} ${Mn/xn} != initPTS: ${u.baseTime/u.timescale} (${u.baseTime}/${u.timescale}) trackId: ${u.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${mt-i} (${Mn}/${xn}) trackId: ${nr}`),u=null,E.initPTS=Mn,E.timescale=xn,E.trackId=nr)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${i}`);u?(E.initPTS=u.baseTime,E.timescale=u.timescale,E.trackId=u.trackId):((!E.timescale||E.trackId===void 0||E.initPTS===void 0)&&(this.warn("Could not set initPTS"),E.initPTS=mt,E.timescale=1,E.trackId=-1),this.initPTS=u={baseTime:E.initPTS,timescale:E.timescale,trackId:E.trackId});const Je=mt-u.baseTime/u.timescale,Nt=Je+He;He>0?this.lastEndTime=Nt:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const vn=!!b.audio,Rn=!!b.video;let Fn="";vn&&(Fn+="audio"),Rn&&(Fn+="video");const Cn=(b.audio?b.audio.encrypted:!1)||(b.video?b.video.encrypted:!1),ln={data1:g,startPTS:Je,startDTS:Je,endPTS:Nt,endDTS:Nt,type:Fn,hasAudio:vn,hasVideo:Rn,nb:1,dropped:0,encrypted:Cn};d.audio=vn&&!Rn?ln:void 0,d.video=Rn?ln:void 0;const Pn=ae==null?void 0:ae.sampleCount;if(Pn){const xn=ae.keyFrameIndex,Mn=xn!==-1;ln.nb=Pn,ln.dropped=xn===0||this.isVideoContiguous?0:Mn?xn:Pn,ln.independent=Mn,ln.firstKeyFrame=xn,Mn&&ae.keyFrameStart&&(ln.firstKeyFramePTS=(ae.keyFrameStart-u.baseTime)/u.timescale),this.isVideoContiguous||(d.independent=Mn),this.isVideoContiguous||(this.isVideoContiguous=Mn),ln.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${xn}/${Pn} dropped: ${ln.dropped} start: ${ln.firstKeyFramePTS||"NA"}`)}return d.initSegment=E,d.id3=po(n,i,u,u),r.samples.length&&(d.text=go(r,i,u)),d}}function $s(a,e,t=!1){return(a==null?void 0:a.start)!==void 0?(a.start+(t?a.duration:0))/a.timescale:e}function xu(a,e,t,n){if(a===null)return!0;const r=Math.max(n,1),i=e-a.baseTime/a.timescale;return Math.abs(i-t)>r}function mo(a,e,t){const n=a.codec;return n&&n.length>4?n:e===P.AUDIO?n==="ec-3"||n==="ac-3"||n==="alac"?n:n==="fLaC"||n==="Opus"?tt(n,!1):(t.warn(`Unhandled audio codec "${n}" in mp4 MAP`),n||"mp4a"):(t.warn(`Unhandled video codec "${n}" in mp4 MAP`),n||"avc1")}let Mi;try{Mi=self.performance.now.bind(self.performance)}catch(a){Mi=Date.now}const Ks=[{demux:ou,remux:bu},{demux:Gi,remux:Us},{demux:ru,remux:Us},{demux:su,remux:Us}];Ks.splice(2,0,{demux:iu,remux:Us});class vo{constructor(e,t,n,r,i,s){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=n,this.id=i,this.logger=s}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,n,r){const i=n.transmuxing;i.executeStart=Mi();let s=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:c}=this;r&&(this.currentTransmuxState=r);const{contiguous:u,discontinuity:f,trackSwitch:d,accurateTimeOffset:g,timeOffset:E,initSegmentChange:b}=r||o,{audioCodec:M,videoCodec:O,defaultInitPts:ae,duration:he,initSegmentData:_e}=c,Ke=Su(s,t);if(Ke&&Dn(Ke.method)){const ot=this.getDecrypter(),at=Un(Ke.method);if(ot.isSync()){let Je=ot.softwareDecrypt(s,Ke.key.buffer,Ke.iv.buffer,at);if(n.part>-1){const vn=ot.flush();Je=vn&&vn.buffer}if(!Je)return i.executeEnd=Mi(),ma(n);s=new Uint8Array(Je)}else return this.asyncResult=!0,this.decryptionPromise=ot.webCryptoDecrypt(s,Ke.key.buffer,Ke.iv.buffer,at).then(Je=>{const Nt=this.push(Je,null,n);return this.decryptionPromise=null,Nt}),this.decryptionPromise}const We=this.needsProbing(f,d);if(We){const ot=this.configureTransmuxer(s);if(ot)return this.logger.warn(`[transmuxer] ${ot.message}`),this.observer.emit(p.ERROR,p.ERROR,{type:ue.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,fatal:!1,error:ot,reason:ot.message}),i.executeEnd=Mi(),ma(n)}(f||d||b||We)&&this.resetInitSegment(_e,M,O,he,t),(f||b||We)&&this.resetInitialTimestamp(ae),u||this.resetContiguity();const mt=this.transmux(s,Ke,E,g,n);this.asyncResult=As(mt);const He=this.currentTransmuxState;return He.contiguous=!0,He.discontinuity=!1,He.trackSwitch=!1,i.executeEnd=Mi(),mt}flush(e){const t=e.transmuxing;t.executeStart=Mi();const{decrypter:n,currentTransmuxState:r,decryptionPromise:i}=this;if(i)return this.asyncResult=!0,i.then(()=>this.flush(e));const s=[],{timeOffset:o}=r;if(n){const d=n.flush();d&&s.push(this.push(d.buffer,null,e))}const{demuxer:c,remuxer:u}=this;if(!c||!u){t.executeEnd=Mi();const d=[ma(e)];return this.asyncResult?Promise.resolve(d):d}const f=c.flush(o);return As(f)?(this.asyncResult=!0,f.then(d=>(this.flushRemux(s,d,e),s))):(this.flushRemux(s,f,e),this.asyncResult?Promise.resolve(s):s)}flushRemux(e,t,n){const{audioTrack:r,videoTrack:i,id3Track:s,textTrack:o}=t,{accurateTimeOffset:c,timeOffset:u}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${n.sn}${n.part>-1?" part: "+n.part:""} of ${this.id===le.MAIN?"level":"track"} ${n.level}`);const f=this.remuxer.remux(r,i,s,o,u,c,!0,this.id);e.push({remuxResult:f,chunkMeta:n}),n.transmuxing.executeEnd=Mi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetTimeStamp(e),n.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,n,r,i){const{demuxer:s,remuxer:o}=this;!s||!o||(s.resetInitSegment(e,t,n,r),o.resetInitSegment(e,t,n,i))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,n,r,i){let s;return t&&t.method==="SAMPLE-AES"?s=this.transmuxSampleAes(e,t,n,r,i):s=this.transmuxUnencrypted(e,n,r,i),s}transmuxUnencrypted(e,t,n,r){const{audioTrack:i,videoTrack:s,id3Track:o,textTrack:c}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(i,s,o,c,t,n,!1,this.id),chunkMeta:r}}transmuxSampleAes(e,t,n,r,i){return this.demuxer.demuxSampleAes(e,t,n).then(s=>({remuxResult:this.remuxer.remux(s.audioTrack,s.videoTrack,s.id3Track,s.textTrack,n,r,!1,this.id),chunkMeta:i}))}configureTransmuxer(e){const{config:t,observer:n,typeSupported:r}=this;let i;for(let d=0,g=Ks.length;d<g;d++){var s;if((s=Ks[d].demux)!=null&&s.probe(e,this.logger)){i=Ks[d];break}}if(!i)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,c=this.remuxer,u=i.remux,f=i.demux;(!c||!(c instanceof u))&&(this.remuxer=new u(n,t,r,this.logger)),(!o||!(o instanceof f))&&(this.demuxer=new f(n,t,r,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 Xn(this.config)),e}}function Su(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 ma=a=>({remuxResult:{},chunkMeta:a});function As(a){return"then"in a&&a.then instanceof Function}class Tu{constructor(e,t,n,r,i){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=n,this.duration=r,this.defaultInitPts=i||null}}class wu{constructor(e,t,n,r,i,s){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=i,this.initSegmentChange=s}}let _o=0;class yo{constructor(e,t,n,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=_o++,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 g=(d=this.workerContext)==null?void 0:d.objectURL;g&&self.URL.revokeObjectURL(g);break}case"transmuxComplete":{this.handleTransmuxComplete(u.data);break}case"flush":{this.onFlush(u.data);break}case"workerLog":{f.logger[u.data.logType]&&f.logger[u.data.logType](u.data.message);break}default:{u.data=u.data||{},u.data.frag=this.frag,u.data.part=this.part,u.data.id=this.id,f.trigger(u.event,u.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const u=new Error(`${c.message} (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:u})};const i=e.config;this.hls=e,this.id=t,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=n,this.onFlush=r;const s=(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 ia,this.observer.on(p.FRAG_DECRYPTED,s),this.observer.on(p.ERROR,s);const o=nn(i.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const c=this.hls.logger;if(i.workerPath||Cl()){try{i.workerPath?(c.log(`loading Web Worker ${i.workerPath} for "${t}"`),this.workerContext=Ll(i.workerPath)):(c.log(`injecting Web Worker for "${t}"`),this.workerContext=Il());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:$e(i)})}catch(f){c.warn(`Error setting up "${t}" Web Worker, fallback to inline`,f),this.terminateWorker(),this.error=null,this.transmuxer=new vo(this.observer,o,i,"",t,e.logger)}return}}this.transmuxer=new vo(this.observer,o,i,"",t,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=_o++;const t=this.hls.config,n=nn(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:n,id:this.id,config:$e(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,n,r,i,s,o,c,u,f){var d,g;u.transmuxing.start=self.performance.now();const{instanceNo:E,transmuxer:b}=this,M=s?s.start:i.start,O=i.decryptdata,ae=this.frag,he=!(ae&&i.cc===ae.cc),_e=!(ae&&u.level===ae.level),Ke=ae?u.sn-ae.sn:-1,We=this.part?u.part-this.part.index:-1,mt=Ke===0&&u.id>1&&u.id===(ae==null?void 0:ae.stats.chunkCount),He=!_e&&(Ke===1||Ke===0&&(We===1||mt&&We<=0)),ot=self.performance.now();(_e||Ke||i.stats.parsing.start===0)&&(i.stats.parsing.start=ot),s&&(We||!He)&&(s.stats.parsing.start=ot);const at=!(ae&&((d=i.initSegment)==null?void 0:d.url)===((g=ae.initSegment)==null?void 0:g.url)),Je=new wu(he,He,c,_e,M,at);if(!He||he||at){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${i.type} sn: ${u.sn}${u.part>-1?" part: "+u.part:""} ${this.id===le.MAIN?"level":"track"}: ${u.level} id: ${u.id}
discontinuity: ${he}
trackSwitch: ${_e}
contiguous: ${He}
accurateTimeOffset: ${c}
timeOffset: ${M}
initSegmentChange: ${at}`);const Nt=new Tu(n,r,t,o,f);this.configureTransmuxer(Nt)}if(this.frag=i,this.part=s,this.workerContext)this.workerContext.worker.postMessage({instanceNo:E,cmd:"demux",data:e,decryptdata:O,chunkMeta:u,state:Je},e instanceof ArrayBuffer?[e]:[]);else if(b){const Nt=b.push(e,O,u,Je);As(Nt)?Nt.then(vn=>{this.handleTransmuxComplete(vn)}).catch(vn=>{this.transmuxerError(vn,u,"transmuxer-interface push error")}):this.handleTransmuxComplete(Nt)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:t,transmuxer:n}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(n){const r=n.flush(e);As(r)?r.then(i=>{this.handleFlushResult(i,e)}).catch(i=>{this.transmuxerError(i,e,"transmuxer-interface flush error")}):this.handleFlushResult(r,e)}}transmuxerError(e,t,n){this.hls&&(this.error=e,this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:n}))}handleFlushResult(e,t){e.forEach(n=>{this.handleTransmuxComplete(n)}),this.onFlush(t)}configureTransmuxer(e){const{instanceNo:t,transmuxer:n}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):n&&n.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Eo=100;class Au extends na{constructor(e,t,n){super(e,t,n,"audio-stream-controller",le.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:n,initPTS:r,timescale:i,trackId:s}){if(n===le.MAIN){const o=t.cc,c=this.fragCurrent;if(this.initPTS[o]={baseTime:r,timescale:i,trackId:s},this.log(`InitPTS for cc: ${o} found from main: ${r/i} (${r}/${i}) trackId: ${s}`),this.mainAnchor=t,this.state===Ot.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===Ot.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var n;const r=((n=this.mainFragLoading)==null?void 0:n.frag)||null;if(t&&(r==null?void 0:r.cc)===t.cc)return;const i=(r||e).cc,s=this.getLevelDetails(),o=this.getLoadPosition(),c=mn(s,i,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===Ot.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=Ot.STOPPED;return}const n=this.lastCurrentTime;this.stopLoad(),this.setInterval(Eo),n>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n,this.state=Ot.IDLE):this.state=Ot.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}doTick(){switch(this.state){case Ot.IDLE:this.doTickIdle();break;case Ot.WAITING_TRACK:{const{levels:e,trackId:t}=this,n=e==null?void 0:e[t],r=n==null?void 0:n.details;if(r&&!this.waitForLive(n)){if(this.waitForCdnTuneIn(r))break;this.state=Ot.WAITING_INIT_PTS}break}case Ot.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Ot.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:t,part:n,cache:r,complete:i}=e,s=this.mainAnchor;if(this.initPTS[t.cc]!==void 0){this.waitingData=null,this.state=Ot.FRAG_LOADING;const o=r.flush().buffer,c={frag:t,part:n,payload:o,networkDetails:null};this._handleFragmentLoadProgress(c),i&&super._handleFragmentLoadComplete(c)}else s&&s.cc!==e.frag.cc&&this.syncWithAnchor(s,e.frag)}else this.state=Ot.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:n,media:r,trackId:i}=this,s=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!s.startFragPrefetch)||!(n!=null&&n[i]))return;const o=n[i],c=o.details;if(!c||this.waitForLive(o)||this.waitForCdnTuneIn(c)){this.state=Ot.WAITING_TRACK,this.startFragRequested=!1;return}const u=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&u&&(this.bufferFlushed=!1,this.afterBufferFlushed(u,P.AUDIO,le.AUDIO));const f=this.getFwdBufferInfo(u,le.AUDIO);if(f===null)return;if(!this.switchingTrack&&this._streamEnded(f,c)){t.trigger(p.BUFFER_EOS,{type:"audio"}),this.state=Ot.ENDED;return}const d=f.len,g=t.maxBufferLength,E=c.fragments,b=E[0].start,M=this.getLoadPosition(),O=this.flushing?M:f.end;if(this.switchingTrack&&r){const _e=M;c.PTSKnown&&_e<b&&(f.end>b||f.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=b+.05)}if(d>=g&&!this.switchingTrack&&O<E[E.length-1].start)return;let ae=this.getNextFragment(O,c);if(ae&&this.isLoopLoading(ae,O)&&(ae=this.getNextFragmentLoopLoading(ae,c,f,le.MAIN,g)),!ae){this.bufferFlushed=!0;return}let he=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&he&&Oe(ae)&&!ae.endList&&(!c.live||!this.loadingParts&&O<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(he)===$t.OK&&(this.mainFragLoading=he=null),he&&Oe(he))){if(ae.start>he.end){const Ke=this.fragmentTracker.getFragAtPos(O,le.MAIN);Ke&&Ke.end>he.end&&(he=Ke,this.mainFragLoading={frag:Ke,targetBufferTime:null})}if(ae.start>he.end)return}this.loadFragment(ae,o,O)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(n=>new Pt(n))}onAudioTrackSwitching(e,t){const n=!!t.url;this.trackId=t.id;const{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),n?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==Ot.STOPPED&&(this.setInterval(Eo),this.state=Ot.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 n=this.cachedTrackLoadedData;n&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(p.AUDIO_TRACK_LOADED,n))}onAudioTrackLoaded(e,t){var n;const{levels:r}=this,{details:i,id:s,groupId:o,track:c}=t;if(!r){this.warn(`Audio tracks reset while loading track ${s} "${c.name}" of "${o}"`);return}const u=this.mainDetails;if(!u||i.endCC>u.endCC||u.expired){this.cachedTrackLoadedData=t,this.state!==Ot.STOPPED&&(this.state=Ot.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${s} "${c.name}" of "${o}" loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:""},duration:${i.totalduration}`);const f=r[s];let d=0;if(i.live||(n=f.details)!=null&&n.live){if(this.checkLiveUpdate(i),i.deltaUpdateFailed)return;if(f.details){var g;d=this.alignPlaylists(i,f.details,(g=this.levelLastLoaded)==null?void 0:g.details)}i.alignedSliding||(Ps(i,u),i.alignedSliding||Os(i,u),d=i.fragmentStart)}f.details=i,this.levelLastLoaded=f,this.startFragRequested||this.setStartPosition(u,d),this.hls.trigger(p.AUDIO_TRACK_UPDATED,{details:i,id:s,groupId:t.groupId}),this.state===Ot.WAITING_TRACK&&!this.waitForCdnTuneIn(i)&&(this.state=Ot.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:r,payload:i}=e,{config:s,trackId:o,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.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(n.start);return}const d=s.defaultAudioCodec||u.audioCodec||"mp4a.40.2";let g=this.transmuxer;g||(g=this.transmuxer=new yo(this.hls,le.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const E=this.initPTS[n.cc],b=(t=n.initSegment)==null?void 0:t.data;if(E!==void 0){const O=r?r.index:-1,ae=O!==-1,he=new br(n.level,n.sn,n.stats.chunkCount,i.byteLength,O,ae);g.push(i,b,d,"",n,r,f.totalduration,!1,he,E)}else{this.log(`Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${f.startSN} ,${f.endSN}],track ${o}`);const{cache:M}=this.waitingData=this.waitingData||{frag:n,part:r,cache:new Wa,complete:!1};M.push(new Uint8Array(i)),this.state!==Ot.STOPPED&&(this.state=Ot.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 n=t.tracks.audio;n&&(this.mediaBuffer=n.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===le.MAIN&&Oe(t.frag)&&(this.mainFragLoading=t,this.state===Ot.IDLE&&this.tick())}onFragBuffered(e,t){const{frag:n,part:r}=t;if(n.type!==le.AUDIO){!this.audioOnly&&n.type===le.MAIN&&!n.elementaryStreams.video&&!n.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?" p: "+r.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(Oe(n)){this.fragPrevious=n;const i=this.switchingTrack;i&&(this.bufferedTrack=i,this.switchingTrack=null,this.hls.trigger(p.AUDIO_TRACK_SWITCHED,y({},i)))}this.fragBufferedComplete(n,r),this.media&&this.tick()}onError(e,t){var n;if(t.fatal){this.state=Ot.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(le.AUDIO,t);break;case $.AUDIO_TRACK_LOAD_ERROR:case $.AUDIO_TRACK_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ot.WAITING_TRACK&&((n=t.context)==null?void 0:n.type)===ge.AUDIO_TRACK&&(this.state=Ot.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case $.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==P.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==P.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Ot.ENDED&&(this.state=Ot.IDLE);const n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,t,le.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const n="audio",{hls:r}=this,{remuxResult:i,chunkMeta:s}=e,o=this.getCurrentContext(s);if(!o){this.resetWhenMissingContext(s);return}const{frag:c,part:u,level:f}=o,{details:d}=f,{audio:g,text:E,id3:b,initSegment:M}=i;if(this.fragContextChanged(c)||!d){this.fragmentTracker.removeFragment(c);return}if(this.state=Ot.PARSING,this.switchingTrack&&g&&this.completeAudioSwitch(this.switchingTrack),M!=null&&M.tracks){const O=c.initSegment||c;if(this.unhandledEncryptionError(M,c))return;this._bufferInitSegment(f,M.tracks,O,s),r.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:O,id:n,tracks:M.tracks})}if(g){const{startPTS:O,endPTS:ae,startDTS:he,endDTS:_e}=g;u&&(u.elementaryStreams[P.AUDIO]={startPTS:O,endPTS:ae,startDTS:he,endDTS:_e}),c.setElementaryStreamInfo(P.AUDIO,O,ae,he,_e),this.bufferFragmentData(g,c,u,s)}if(b!=null&&(t=b.samples)!=null&&t.length){const O=h({id:n,frag:c,details:d},b);r.trigger(p.FRAG_PARSING_METADATA,O)}if(E){const O=h({id:n,frag:c,details:d},E);r.trigger(p.FRAG_PARSING_USERDATA,O)}}_bufferInitSegment(e,t,n,r){if(this.state!==Ot.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const i=t.audio;i.id=le.AUDIO;const s=e.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${s}/${i.codec}]`),s&&s.split(",").length===1&&(i.levelCodec=s),this.hls.trigger(p.BUFFER_CODECS,t);const o=i.initSegment;if(o!=null&&o.byteLength){const c={type:"audio",frag:n,part:null,chunkMeta:r,parent:n.type,data:o};this.hls.trigger(p.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,t,n){const r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===$t.NOT_LOADED||r===$t.PARTIAL){var i;if(!Oe(e))this._loadInitSegment(e,t);else if((i=t.details)!=null&&i.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=Ot.WAITING_INIT_PTS;const s=this.mainDetails;s&&s.fragmentStart!==t.details.fragmentStart&&Os(t.details,s)}else super.loadFragment(e,t,n)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:n,assocLang:r,characteristics:i,audioCodec:s,channels:o}=this.bufferedTrack;Ht({name:t,lang:n,assocLang:r,characteristics:i,audioCodec:s,channels:o},e,Vt)||(fn(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,y({},e))}}class va extends Z{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,n){const r=t==null?void 0:t.renditionReports;if(r){let i=-1;for(let s=0;s<r.length;s++){const o=r[s];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){i=s;break}else c===e.substring(0,c.length)&&(i=s)}if(i!==-1){const s=r[i],o=parseInt(s["LAST-MSN"])||t.lastPartSn;let c=parseInt(s["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=n&&jt(n);return new At(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(n){this.warn(`Could not construct new URL with HLS Delivery Directives: ${n}`)}return e}playlistLoaded(e,t,n){const{details:r,stats:i}=t,s=self.performance.now(),o=i.loading.first?Math.max(0,s-i.loading.first):0;r.advancedDateTime=Date.now()-o;const c=this.hls.config.timelineOffset;if(c!==r.appliedTimelineOffset){const f=Math.max(c||0,0);r.appliedTimelineOffset=f,r.fragments.forEach(d=>{d.setStart(d.playlistOffset+f)})}if(r.live||n!=null&&n.live){const f="levelInfo"in t?t.levelInfo:t.track;if(r.reloaded(n),n&&r.fragments.length>0){bi(n,r,this);const he=r.playlistParsingError;if(he){this.warn(he);const _e=this.hls;if(!_e.config.ignorePlaylistParsingErrors){var u;const{networkDetails:Ke}=t;_e.trigger(p.ERROR,{type:ue.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:he,reason:he.message,level:t.level||void 0,parent:(u=r.fragments[0])==null?void 0:u.type,networkDetails:Ke,stats:i});return}r.playlistParsingError=null}}r.requestScheduled===-1&&(r.requestScheduled=i.loading.start);const d=this.hls.mainForwardBufferInfo,g=d?d.end-d.len:0,E=(r.edge-g)*1e3,b=Mr(r,E);if(r.requestScheduled+b<s?r.requestScheduled=s:r.requestScheduled+=b,this.log(`live playlist ${e} ${r.advanced?"REFRESHED "+r.lastPartSn+"-"+r.lastPartIndex:r.updated?"UPDATED":"MISSED"}`),!this.canLoad||!r.live)return;let M,O,ae;if(r.canBlockReload&&r.endSN&&r.advanced){const he=this.hls.config.lowLatencyMode,_e=r.lastPartSn,Ke=r.endSN,We=r.lastPartIndex,mt=We!==-1,He=_e===Ke;mt?He?(O=Ke+1,ae=he?0:We):(O=_e,ae=he?We+1:r.maxPartIndex):O=Ke+1;const ot=r.age,at=ot+r.ageHeader;let Je=Math.min(at-r.partTarget,r.targetduration*1.5);if(Je>0){if(at>r.targetduration*3)this.log(`Playlist last advanced ${ot.toFixed(2)}s ago. Omitting segment and part directives.`),O=void 0,ae=void 0;else if(n!=null&&n.tuneInGoal&&at-r.partTarget>n.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${Je} with playlist age: ${r.age}`),Je=0;else{const Nt=Math.floor(Je/r.targetduration);if(O+=Nt,ae!==void 0){const vn=Math.round(Je%r.targetduration/r.partTarget);ae+=vn}this.log(`CDN Tune-in age: ${r.ageHeader}s last advanced ${ot.toFixed(2)}s goal: ${Je} skip sn ${Nt} to part ${ae}`)}r.tuneInGoal=Je}if(M=this.getDeliveryDirectives(r,t.deliveryDirectives,O,ae),he||!He){r.requestScheduled=s,this.loadingPlaylist(f,M);return}}else(r.canBlockReload||r.canSkipUntil)&&(M=this.getDeliveryDirectives(r,t.deliveryDirectives,O,ae));M&&O!==void 0&&r.canBlockReload&&(r.requestScheduled=i.loading.first+Math.max(b-o*2,b/2)),this.scheduleLoading(f,M,r)}else this.clearTimer()}scheduleLoading(e,t,n){const r=n||e.details;if(!r){this.loadingPlaylist(e,t);return}const i=self.performance.now(),s=r.requestScheduled;if(i>=s){this.loadingPlaylist(e,t);return}const o=s-i;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,n,r){let i=jt(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(n=t.msn,r=t.part,i=kt.No),new At(n,r,i)}checkRetry(e){const t=e.details,n=on(e),r=e.errorAction,{action:i,retryCount:s=0,retryConfig:o}=r||{},c=!!r&&!!o&&(i===On.RetryRequest||!r.resolved&&i===On.SendAlternateToPenaltyBox);if(c){var u;if(s>=o.maxNumRetry)return!1;if(n&&(u=e.context)!=null&&u.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const f=Vn(o,s);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),f),this.warn(`Retrying playlist loading ${s+1}/${o.maxNumRetry} after "${t}" in ${f}ms`)}e.levelRetry=!0,r.resolved=!0}return c}}function bo(a,e){if(a.length!==e.length)return!1;for(let t=0;t<a.length;t++)if(!Ds(a[t].attrs,e[t].attrs))return!1;return!0}function Ds(a,e,t){const n=a["STABLE-RENDITION-ID"];return n&&!t?n===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(r=>a[r]!==e[r])}function _a(a,e){return e.label.toLowerCase()===a.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(a.lang||"").toLowerCase())}class Du extends va{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:n,groupId:r,details:i}=t,s=this.tracksInGroup[n];if(!s||s.groupId!==r){this.warn(`Audio track with id:${n} and group:${r} not found in active group ${s==null?void 0:s.groupId}`);return}const o=s.details;s.details=t.details,this.log(`Audio track ${n} "${s.name}" lang:${s.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.audioGroups||null,r=this.groupIds;let i=this.currentTrack;if(!n||(r==null?void 0:r.length)!==(n==null?void 0:n.length)||n!=null&&n.some(o=>(r==null?void 0:r.indexOf(o))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(g=>!n||n.indexOf(g.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(g=>g.default)&&(this.selectDefaultTrack=!1),o.forEach((g,E)=>{g.id=E});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const c=this.hls.config.audioPreference;if(!i&&c){const g=Kt(c,o,Vt);if(g>-1)i=o[g];else{const E=Kt(c,this.tracks);i=this.tracks[E]}}let u=this.findTrackId(i);u===-1&&i&&(u=this.findTrackId(null));const f={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${n==null?void 0:n.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 s;const g=new Error(`No audio track selected for current audio group-ID(s): ${(s=this.groupIds)==null?void 0:s.join(",")} track count: ${o.length}`);this.warn(g.message),this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:g})}}}onError(e,t){t.fatal||!t.context||t.context.type===ge.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 n=this.allAudioTracks;if(this.selectDefaultTrack=!1,n.length){const r=this.currentTrack;if(r&&Ht(e,r,Vt))return r;const i=Kt(e,this.tracksInGroup,Vt);if(i>-1){const s=this.tracksInGroup[i];return this.setAudioTrack(i),s}else if(r){let s=t.loadLevel;s===-1&&(s=t.firstAutoLevel);const o=un(e,t.levels,n,s,Vt);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const s=Kt(e,n);if(s>-1)return n[s]}}}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 n=this.currentTrack,r=t[e],i=r.details&&!r.details.live;if(e===this.trackId&&r===n&&i||(this.log(`Switching to audio-track ${e} "${r.name}" lang:${r.lang} group:${r.groupId} channels:${r.channels}`),this.trackId=e,this.currentTrack=r,this.hls.trigger(p.AUDIO_TRACK_SWITCHING,y({},r)),i))return;const s=this.switchParams(r.url,n==null?void 0:n.details,r.details);this.loadPlaylist(s)}findTrackId(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const r=t[n];if(!(this.selectDefaultTrack&&!r.default)&&(!e||Ht(e,r,Vt)))return n}if(e){const{name:n,lang:r,assocLang:i,characteristics:s,audioCodec:o,channels:c}=e;for(let u=0;u<t.length;u++){const f=t[u];if(Ht({name:n,lang:r,assocLang:i,characteristics:s,audioCodec:o,channels:c},f,Vt))return u}for(let u=0;u<t.length;u++){const f=t[u];if(Ds(e.attrs,f.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return u}for(let u=0;u<t.length;u++){const f=t[u];if(Ds(e.attrs,f.attrs,["LANGUAGE"]))return u}}return-1}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&fn(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,t),s=e.details,o=s==null?void 0:s.age;this.log(`Loading audio-track ${n} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):""} ${i}`),this.hls.trigger(p.AUDIO_TRACK_LOADING,{url:i,id:n,groupId:r,deliveryDirectives:t||null,track:e})}}class Ru{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,t,n){if(this.queues===null||this.tracks===null)return;const r=this.queues[t];r.push(e),r.length===1&&!n&&this.executeNext(t)}appendBlocker(e){return new Promise(t=>{const n={label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(n,e)})}prependBlocker(e){return new Promise(t=>{if(this.queues){const n={label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(n)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;const n=(t=e[0])==null?void 0:t.label;(n==="async-blocker"||n==="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 r=t[0];try{r.execute()}catch(i){var n;if(r.onError(i),this.queues===null||this.tracks===null)return;const s=(n=this.tracks[e])==null?void 0:n.buffer;s!=null&&s.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,n;return(t=this.queues)!=null&&t[e]||(n=this.tracks)!=null&&n[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var t;const n=(t=this.tracks)==null?void 0:t[e],r=n==null?void 0:n.buffer;return r?`SourceBuffer${r.updating?" updating":""}${n.ended?" ended":""}${n.ending?" ending":""}`:"none"}listOps(e){var t;return((t=this.queues)==null?void 0:t[e].map(n=>n.label).join(", "))||""}}const xo=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,So="HlsJsTrackRemovedError";class Cu extends Error{constructor(e){super(e),this.name=So}}class Iu extends Z{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=n=>{var r;this.hls&&((r=this.mediaSource)==null?void 0:r.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=n=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=n=>{const{media:r,mediaSource:i}=this;n&&this.log("Media source opened"),!(!r||!i)&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),r.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(p.MEDIA_ATTACHED,{media:r,mediaSource:i}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:n,_objectUrl:r}=this;n!==r&&this.error(`Media element src was set while attaching MediaSource (${r} > ${n})`)},this.hls=e,this.fragmentTracker=t,this.appendSource=we(ce(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 n={};if(this.operationQueue){const i=this.isUpdating();i||this.operationQueue.removeBlockers();const s=this.isQueued();(i||s)&&this.warn(`Transfering MediaSource with${s?" operations in queue":""}${i?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const r=this.transferData;return!this.sourceBufferCount&&r&&r.mediaSource===t?h(n,r.tracks):this.sourceBuffers.forEach(i=>{const[s]=i;s&&(n[s]=h({},this.tracks[s]),this.removeBuffer(s)),i[0]=i[1]=null}),{media:e,mediaSource:t,tracks:n}}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 n;let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsTotal=r,this.log(`${r} bufferCodec event(s) expected.`),(n=this.transferData)!=null&&n.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){const n=this.media=t.media;this.transferData=this.overrides=void 0;const r=ce(this.appendSource);if(r){const i=!!t.mediaSource;(i||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const s=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(s),i)this._objectUrl=n.src,this.attachTransferred();else{const o=this._objectUrl=self.URL.createObjectURL(s);if(this.appendSource)try{n.removeAttribute("src");const c=self.ManagedMediaSource;n.disableRemotePlayback=n.disableRemotePlayback||c&&s instanceof c,To(n),Lu(n,o),n.load()}catch(c){n.src=o}else n.src=o}n.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var t,n;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===e?"transferred":"created"} media source: ${(n=e.constructor)==null?void 0:n.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 n=this.tracks,r=t.tracks,i=r?Object.keys(r):null,s=i?i.length:0,o=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&i&&s){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: ${$e(n,(c,u)=>c==="initSegment"?void 0:u)};
transfer tracks: ${$e(r,(c,u)=>c==="initSegment"?void 0:u)}}`),!Pe(r,n)){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(r)}"->"${Object.keys(n)}") start time: ${f} currentTime: ${c}`),this.onMediaDetaching(p.MEDIA_DETACHING,{}),this.onMediaAttaching(p.MEDIA_ATTACHING,t),e.currentTime=f;return}this.transferData=void 0,i.forEach(c=>{const u=c,f=r[u];if(f){const d=f.buffer;if(d){const g=this.fragmentTracker,E=f.id;if(g.hasFragments(E)||g.hasParts(E)){const O=In.getBuffered(d);g.detectEvictedFragments(u,O,E,null,!0)}const b=ya(u),M=[u,d];this.sourceBuffers[b]=M,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 n=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:r,mediaSource:i,_objectUrl:s}=this;if(i){if(this.log(`media source ${n?"transferring":"detaching"}`),n)this.sourceBuffers.forEach(([o])=>{o&&this.removeBuffer(o)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const o=i.readyState==="open";try{const c=i.sourceBuffers;for(let u=c.length;u--;)o&&c[u].abort(),i.removeSourceBuffer(c[u]);o&&i.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(i.removeEventListener("startstreaming",this._onStartStreaming),i.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(r.removeEventListener("emptied",this._onMediaEmptied),n||(s&&self.URL.revokeObjectURL(s),this.mediaSrc===s?(r.removeAttribute("src"),this.appendSource&&To(r),r.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 n=(t=this.tracks[e])==null?void 0:t.buffer;if(this.removeBuffer(e),n)try{var r;(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(n)}catch(i){this.warn(`onBufferReset ${e}`,i)}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 Ru(this.tracks)}onBufferCodecs(e,t){var n;const r=this.tracks,i=Object.keys(t);this.log(`BUFFER_CODECS: "${i}" (current SB count ${this.sourceBufferCount})`);const s="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),o=!s&&this.sourceBufferCount&&this.media&&i.some(c=>!r[c]);if(s||o){this.warn(`Unsupported transition between "${Object.keys(r)}" and "${i}" SourceBuffers`);return}i.forEach(c=>{var u,f;const d=t[c],{id:g,codec:E,levelCodec:b,container:M,metadata:O,supplemental:ae}=d;let he=r[c];const _e=(u=this.transferData)==null||(u=u.tracks)==null?void 0:u[c],Ke=_e!=null&&_e.buffer?_e:he,We=(Ke==null?void 0:Ke.pendingCodec)||(Ke==null?void 0:Ke.codec),mt=Ke==null?void 0:Ke.levelCodec;he||(he=r[c]={buffer:void 0,listeners:[],codec:E,supplemental:ae,container:M,levelCodec:b,metadata:O,id:g});const He=It(We,mt),ot=He==null?void 0:He.replace(xo,"$1");let at=It(E,b);const Je=(f=at)==null?void 0:f.replace(xo,"$1");at&&He&&ot!==Je&&(c.slice(0,5)==="audio"&&(at=tt(at,this.appendSource)),this.log(`switching codec ${We} to ${at}`),at!==(he.pendingCodec||he.codec)&&(he.pendingCodec=at),he.container=M,this.appendChangeType(c,M,at))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!t.video&&((n=t.audio)==null?void 0:n.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 n=this.tracks[t];return e[t]={id:n.id,container:n.container,codec:n.codec,levelCodec:n.levelCodec},e},{})}appendChangeType(e,t,n){const r=`${t};codecs=${n}`,i={label:`change-type=${r}`,execute:()=>{const s=this.tracks[e];if(s){const o=s.buffer;o!=null&&o.changeType&&(this.log(`changing ${e} sourceBuffer type to ${r}`),o.changeType(r),s.codec=n,s.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:s=>{this.warn(`Failed to change ${e} SourceBuffer type`,s)}};this.append(i,e,this.isPending(this.tracks[e]))}blockAudio(e){var t;const n=e.start,r=n+e.duration*.05;if(((t=this.fragmentTracker.getAppendedFrag(n,le.MAIN))==null?void 0:t.gap)===!0)return;const s={label:"block-audio",execute:()=>{var o;const c=this.tracks.video;(this.lastVideoAppendEnd>r||c!=null&&c.buffer&&In.isBuffered(c.buffer,r)||((o=this.fragmentTracker.getAppendedFrag(r,le.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:s,frag:e},this.append(s,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:t}=this;e&&t&&(this.blockedAudioAppend=null,t.unblockAudio(e.op))}onBufferAppending(e,t){const{tracks:n}=this,{data:r,type:i,parent:s,frag:o,part:c,chunkMeta:u,offset:f}=t,d=u.buffering[i],{sn:g,cc:E}=o,b=self.performance.now();d.start=b;const M=o.stats.buffering,O=c?c.stats.buffering:null;M.start===0&&(M.start=b),O&&O.start===0&&(O.start=b);const ae=n.audio;let he=!1;i==="audio"&&(ae==null?void 0:ae.container)==="audio/mpeg"&&(he=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const _e=n.video,Ke=_e==null?void 0:_e.buffer;if(Ke&&g!=="initSegment"){const He=c||o,ot=this.blockedAudioAppend;if(i==="audio"&&s!=="main"&&!this.blockedAudioAppend&&!(_e.ending||_e.ended)){const Je=He.start+He.duration*.05,Nt=Ke.buffered,vn=this.currentOp("video");!Nt.length&&!vn?this.blockAudio(He):!vn&&!In.isBuffered(Ke,Je)&&this.lastVideoAppendEnd<Je&&this.blockAudio(He)}else if(i==="video"){const at=He.end;if(ot){const Je=ot.frag.start;(at>Je||at<this.lastVideoAppendEnd||In.isBuffered(Ke,Je))&&this.unblockAudio()}this.lastVideoAppendEnd=at}}const We=(c||o).start,mt={label:`append-${i}`,execute:()=>{var He;d.executeStart=self.performance.now();const ot=(He=this.tracks[i])==null?void 0:He.buffer;ot&&(he?this.updateTimestampOffset(ot,We,.1,i,g,E):f!==void 0&&L(f)&&this.updateTimestampOffset(ot,f,1e-6,i,g,E)),this.appendExecutor(r,i)},onStart:()=>{},onComplete:()=>{const He=self.performance.now();d.executeEnd=d.end=He,M.first===0&&(M.first=He),O&&O.first===0&&(O.first=He);const ot={};this.sourceBuffers.forEach(([at,Je])=>{at&&(ot[at]=In.getBuffered(Je))}),this.appendErrors[i]=0,i==="audio"||i==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(p.BUFFER_APPENDED,{type:i,frag:o,part:c,chunkMeta:u,parent:o.type,timeRanges:ot})},onError:He=>{var ot;const at={type:ue.MEDIA_ERROR,parent:o.type,details:$.BUFFER_APPEND_ERROR,sourceBufferName:i,frag:o,part:c,chunkMeta:u,error:He,err:He,fatal:!1},Je=(ot=this.media)==null?void 0:ot.error;if(He.code===DOMException.QUOTA_EXCEEDED_ERR||He.name=="QuotaExceededError"||"quota"in He)at.details=$.BUFFER_FULL_ERROR;else if(He.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Je)at.errorAction=bt(!0);else if(He.name===So&&this.sourceBufferCount===0)at.errorAction=bt(!0);else{const Nt=++this.appendErrors[i];this.warn(`Failed ${Nt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${i}" sourceBuffer (${Je||"no media error"})`),(Nt>=this.hls.config.appendErrorMaxRetry||Je)&&(at.fatal=!0)}this.hls.trigger(p.ERROR,at)}};this.log(`queuing "${i}" append sn: ${g}${c?" p: "+c.index:""} of ${o.type===le.MAIN?"level":"track"} ${o.level} cc: ${E}`),this.append(mt,i,this.isPending(this.tracks[i]))}getFlushOp(e,t,n){return this.log(`queuing "${e}" remove ${t}-${n}`),{label:"remove",execute:()=>{this.removeExecutor(e,t,n)},onStart:()=>{},onComplete:()=>{this.hls.trigger(p.BUFFER_FLUSHED,{type:e})},onError:r=>{this.warn(`Failed to remove ${t}-${n} from "${e}" SourceBuffer`,r)}}}onBufferFlushing(e,t){const{type:n,startOffset:r,endOffset:i}=t;n?this.append(this.getFlushOp(n,r,i),n):this.sourceBuffers.forEach(([s])=>{s&&this.append(this.getFlushOp(s,r,i),s)})}onFragParsed(e,t){const{frag:n,part:r}=t,i=[],s=r?r.elementaryStreams:n.elementaryStreams;s[P.AUDIOVIDEO]?i.push("audiovideo"):(s[P.AUDIO]&&i.push("audio"),s[P.VIDEO]&&i.push("video"));const o=()=>{const c=self.performance.now();n.stats.buffering.end=c,r&&(r.stats.buffering.end=c);const u=r?r.stats:n.stats;this.hls.trigger(p.FRAG_BUFFERED,{frag:n,part:r,stats:u,id:n.type})};i.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}`),this.blockBuffers(o,i).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 n;this.sourceBuffers.forEach(([s])=>{if(s){const o=this.tracks[s];(!t.type||t.type===s)&&(o.ending=!0,o.ended||(o.ended=!0,this.log(`${s} buffer reached EOS`)))}});const r=((n=this.overrides)==null?void 0:n.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([s])=>{var o;return s&&!((o=this.tracks[s])!=null&&o.ended)})?r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:s}=this;if(!s||s.readyState!=="open"){s&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${s.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),s.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===$.BUFFER_APPEND_ERROR&&t.frag){var n;const r=(n=t.errorAction)==null?void 0:n.nextAutoLevel;L(r)&&r!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:t,media:n}=this;if(!n||t===null||!this.sourceBufferCount)return;const r=e.config,i=n.currentTime,s=t.levelTargetDuration,o=t.live&&r.liveBackBufferLength!==null?r.liveBackBufferLength:r.backBufferLength;if(L(o)&&o>=0){const u=Math.max(o,s),f=Math.floor(i/s)*s-u;this.flushBackBuffer(i,s,f)}const c=r.frontBufferFlushThreshold;if(L(c)&&c>0){const u=Math.max(r.maxBufferLength,c),f=Math.max(u,s),d=Math.floor(i/s)*s+f;this.flushFrontBuffer(i,s,d)}}flushBackBuffer(e,t,n){this.sourceBuffers.forEach(([r,i])=>{if(i){const o=In.getBuffered(i);if(o.length>0&&n>o.start(0)){var s;this.hls.trigger(p.BACK_BUFFER_REACHED,{bufferEnd:n});const c=this.tracks[r];if((s=this.details)!=null&&s.live)this.hls.trigger(p.LIVE_BACK_BUFFER_REACHED,{bufferEnd:n});else if(c!=null&&c.ended){this.log(`Cannot flush ${r} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:n,type:r})}}})}flushFrontBuffer(e,t,n){this.sourceBuffers.forEach(([r,i])=>{if(i){const s=In.getBuffered(i),o=s.length;if(o<2)return;const c=s.start(o-1),u=s.end(o-1);if(n>c||e>=c&&e<=u)return;this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;const{details:t,mediaSource:n}=this;if(!t||!this.media||(n==null?void 0:n.readyState)!=="open")return null;const r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&n.setLiveSeekableRange){const u=Math.max(0,t.fragmentStart),f=Math.max(u,r);return{duration:1/0,start:u,end:f}}return{duration:1/0}}const i=(e=this.overrides)==null?void 0:e.duration;if(i)return L(i)?{duration:i}:null;const s=this.media.duration,o=L(n.duration)?n.duration:0;return r>o&&r>s||!L(s)?{duration:r}:null}updateMediaSource({duration:e,start:t,end:n}){const r=this.mediaSource;!this.media||!r||r.readyState!=="open"||(r.duration!==e&&(L(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),r.duration=e),t!==void 0&&n!==void 0&&(this.log(`MediaSource duration is set to ${r.duration}. Setting seekable range to ${t}-${n}.`),r.setLiveSeekableRange(t,n)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:n}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${e}) ${$e(n)}`),this.tracksReady){var r;const i=(r=this.transferData)==null?void 0:r.tracks;i&&Object.keys(i).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([t,n])=>{if(t){const r=this.tracks[t];e[t]={buffer:n,container:r.container,codec:r.codec,supplemental:r.supplemental,levelCodec:r.levelCodec,id:r.id,metadata:r.metadata}}}),this.hls.trigger(p.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:t,mediaSource:n}=this;if(!n)throw new Error("createSourceBuffers called when mediaSource was null");for(const i in e){const s=i,o=e[s];if(this.isPending(o)){const c=this.getTrackCodec(o,s),u=`${o.container};codecs=${c}`;o.codec=c,this.log(`creating sourceBuffer(${u})${this.currentOp(s)?" Queued":""} ${$e(o)}`);try{const f=n.addSourceBuffer(u),d=ya(s),g=[s,f];t[d]=g,o.buffer=f}catch(f){var r;this.error(`error while trying to add sourceBuffer: ${f.message}`),this.shiftAndExecuteNext(s),(r=this.operationQueue)==null||r.removeBlockers(),delete this.tracks[s],this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:f,sourceBufferName:s,mimeType:u,parent:o.id});return}this.trackSourceBuffer(s,o)}}this.bufferCreated()}getTrackCodec(e,t){const n=e.supplemental;let r=e.codec;n&&(t==="video"||t==="audiovideo")&&Se(n,"video")&&(r=yt(r,n));const i=It(r,e.levelCodec);return i?t.slice(0,5)==="audio"?tt(i,this.appendSource):i:""}trackSourceBuffer(e,t){const n=t.buffer;if(!n)return;const r=this.getTrackCodec(t,e);this.tracks[e]={buffer:n,codec:r,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",(i,s)=>{const o=s.removedRanges;o!=null&&o.length&&this.hls.trigger(p.BUFFER_FLUSHED,{type:i})})}get mediaSrc(){var e,t;const n=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return n==null?void 0:n.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 n=this.currentOp(e);n&&(n.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,t){var n;const r=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(n=this.mediaSource)==null?void 0:n.readyState}`);this.error(`${r}`,t),this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:r,fatal:!1});const i=this.currentOp(e);i&&i.onError(r)}updateTimestampOffset(e,t,n,r,i,s){const o=t-e.timestampOffset;Math.abs(o)>=n&&(this.log(`Updating ${r} SourceBuffer timestampOffset to ${t} (sn: ${i} cc: ${s})`),e.timestampOffset=t)}removeExecutor(e,t,n){const{media:r,mediaSource:i}=this,s=this.tracks[e],o=s==null?void 0:s.buffer;if(!r||!i||!o){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=L(r.duration)?r.duration:1/0,u=L(i.duration)?i.duration:1/0,f=Math.max(0,t),d=Math.min(n,c,u);d>f&&(!s.ending||s.ended)?(s.ended=!1,this.log(`Removing [${f},${d}] from the ${e} SourceBuffer`),o.remove(f,d)):this.shiftAndExecuteNext(e)}appendExecutor(e,t){const n=this.tracks[t],r=n==null?void 0:n.buffer;if(!r)throw new Cu(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);n.ending=!1,n.ended=!1,r.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:n}=this,r=t.map(s=>this.appendBlocker(s));return t.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(r).then(s=>{n===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(t=>{var n;const r=(n=this.tracks[t])==null?void 0:n.buffer;!r||r.updating||this.shiftAndExecuteNext(t)})}append(e,t,n){this.operationQueue&&this.operationQueue.append(e,t,n)}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,n){const r=this.tracks[e];if(!r)return;const i=r.buffer;if(!i)return;const s=n.bind(this,e);r.listeners.push({event:t,listener:s}),i.addEventListener(t,s)}removeBufferListeners(e){const t=this.tracks[e];if(!t)return;const n=t.buffer;n&&(t.listeners.forEach(r=>{n.removeEventListener(r.event,r.listener)}),t.listeners.length=0)}}function To(a){const e=a.querySelectorAll("source");[].slice.call(e).forEach(t=>{a.removeChild(t)})}function Lu(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 n=this.hls.levels[t.droppedLevel];this.isLevelAllowed(n)&&this.restrictedLevels.push({bitrate:n.bitrate,height:n.height,width:n.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 n=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,n.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&L(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,n=this.getMaxLevel(e.length-1);n!==this.autoLevelCapping&&t.logger.log(`Setting autoLevelCapping to ${n}: ${e[n].height}p@${e[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=n,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 n=t.filter((r,i)=>this.isLevelAllowed(r)&&i<=e);return this.clientRect=null,Ea.getMaxLevelByMediaSize(n,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 n=e.getBoundingClientRect();t.width=n.width,t.height=n.height,!t.width&&!t.height&&(t.width=n.right-n.left||e.width||0,t.height=n.bottom-n.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(n=>e.bitrate===n.bitrate&&e.width===n.width&&e.height===n.height)}static getMaxLevelByMediaSize(e,t,n){if(!(e!=null&&e.length))return-1;const r=(o,c)=>c?o.width!==c.width||o.height!==c.height:!0;let i=e.length-1;const s=Math.max(t,n);for(let o=0;o<e.length;o+=1){const c=e[o];if((c.width>=s||c.height>=s)&&r(c,e[o+1])){i=o;break}}return i}}const di={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},ku={HLS:"h"};class Ri{constructor(e,t){Array.isArray(e)&&(e=e.map(n=>n instanceof Ri?n:new Ri(n))),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,n){return new Error(`failed to ${a} "${Ou(e)}" as ${t}`,{cause:n})}function Ci(a,e,t){return Mu("serialize",a,e,t)}class wo{constructor(e){this.description=e}}const Ao="Bare Item",Fu="Boolean";function Nu(a){if(typeof a!="boolean")throw Ci(a,Fu);return a?"?1":"?0"}function Bu(a){return btoa(String.fromCharCode(...a))}const Uu="Byte Sequence";function $u(a){if(ArrayBuffer.isView(a)===!1)throw Ci(a,Uu);return`:${Bu(a)}:`}const Ku="Integer";function Zu(a){return a<-999999999999999||999999999999999<a}function Do(a){if(Zu(a))throw Ci(a,Ku);return a.toString()}function Gu(a){return`@${Do(a.getTime()/1e3)}`}function Ro(a,e){if(a<0)return-Ro(-a,e);const t=Math.pow(10,e);if(Math.abs(a*t%1-.5)<Number.EPSILON){const r=Math.floor(a*t);return(r%2===0?r:r+1)/t}else return Math.round(a*t)/t}const Vu="Decimal";function zu(a){const e=Ro(a,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ci(a,Vu);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Wu="String",Hu=/[\x00-\x1f\x7f]+/;function ju(a){if(Hu.test(a))throw Ci(a,Wu);return`"${a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Yu(a){return a.description||a.toString().slice(7,-1)}const Xu="Token";function Co(a){const e=Yu(a);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ci(e,Xu);return e}function ba(a){switch(typeof a){case"number":if(!L(a))throw Ci(a,Ao);return Number.isInteger(a)?Do(a):zu(a);case"string":return ju(a);case"symbol":return Co(a);case"boolean":return Nu(a);case"object":if(a instanceof Date)return Gu(a);if(a instanceof Uint8Array)return $u(a);if(a instanceof wo)return Co(a);default:throw Ci(a,Ao)}}const Qu="Key";function xa(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw Ci(a,Qu);return a}function Sa(a){return a==null?"":Object.entries(a).map(([e,t])=>t===!0?`;${xa(e)}`:`;${xa(e)}=${ba(t)}`).join("")}function Io(a){return a instanceof Ri?`${ba(a.value)}${Sa(a.params)}`:ba(a)}function Ju(a){return`(${a.value.map(Io).join(" ")})${Sa(a.params)}`}function qu(a,e={whitespace:!0}){if(typeof a!="object"||a==null)throw Ci(a,Pu);const t=a instanceof Map?a.entries():Object.entries(a),n=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([r,i])=>{i instanceof Ri||(i=new Ri(i));let s=xa(r);return i.value===!0?s+=Sa(i.params):(s+="=",Array.isArray(i.value)?s+=Ju(i):s+=Io(i)),s}).join(`,${n}`)}function Lo(a,e){return qu(a,e)}const Ii="CMCD-Object",Nr="CMCD-Request",Yi="CMCD-Session",zi="CMCD-Status",ec={br:Ii,ab:Ii,d:Ii,ot:Ii,tb:Ii,tpb:Ii,lb:Ii,tab:Ii,lab:Ii,url:Ii,pb:Nr,bl:Nr,tbl:Nr,dl:Nr,ltc:Nr,mtp:Nr,nor:Nr,nrr:Nr,rc:Nr,sn:Nr,sta:Nr,su:Nr,ttfb:Nr,ttfbb:Nr,ttlb:Nr,cmsdd:Nr,cmsds:Nr,smrt:Nr,df:Nr,cs:Nr,ts:Nr,cid:Yi,pr:Yi,sf:Yi,sid:Yi,st:Yi,v:Yi,msd:Yi,bs:zi,bsd:zi,cdn:zi,rtp:zi,bg:zi,pt:zi,ec:zi,e:zi},tc={REQUEST:Nr};function nc(a){return Object.keys(a).reduce((e,t)=>{var n;return(n=a[t])===null||n===void 0||n.forEach(r=>e[r]=t),e},{})}function rc(a,e){const t={};if(!a)return t;const n=Object.keys(a),r=e?nc(e):{};return n.reduce((i,s)=>{var o;const c=ec[s]||r[s]||tc.REQUEST,u=(o=i[c])!==null&&o!==void 0?o:i[c]={};return u[s]=a[s],i},t)}function ic(a){return["ot","sf","st","e","sta"].includes(a)}function sc(a){return typeof a=="number"?L(a):a!=null&&a!==""&&a!==!1}const ko="event";function ac(a,e){const t=new URL(a),n=new URL(e);if(t.origin!==n.origin)return a;const r=t.pathname.split("/").slice(1),i=n.pathname.split("/").slice(1,-1);for(;r[0]===i[0];)r.shift(),i.shift();for(;i.length;)i.shift(),r.unshift("..");return r.join("/")+t.search+t.hash}const Zs=a=>Math.round(a),Ta=(a,e)=>Array.isArray(a)?a.map(t=>Ta(t,e)):a instanceof Ri&&typeof a.value=="string"?new Ri(Ta(a.value,e),a.params):(e.baseUrl&&(a=ac(a,e.baseUrl)),e.version===1?encodeURIComponent(a):a),Gs=a=>Zs(a/100)*100,oc={br:Zs,d:Zs,bl:Gs,dl:Gs,mtp:Gs,nor:(a,e)=>{let t=a;return e.version>=2&&(a instanceof Ri&&typeof a.value=="string"?t=new Ri([a]):typeof a=="string"&&(t=[a])),Ta(t,e)},rtp:Gs,tb:Zs},Po="request",Oo="response",wa=["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 Vs(a){return uc.test(a)}function cc(a){return wa.includes(a)||lc.includes(a)||Vs(a)}const Mo=["d","dl","nor","ot","rtp","su"];function fc(a){return wa.includes(a)||Mo.includes(a)||Vs(a)}const dc=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function hc(a){return wa.includes(a)||Mo.includes(a)||dc.includes(a)||Vs(a)}const pc=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function gc(a){return pc.includes(a)||Vs(a)}const mc={[Oo]:hc,[ko]:cc,[Po]:fc};function Fo(a,e={}){const t={};if(a==null||typeof a!="object")return t;const n=e.version||a.v||1,r=e.reportingMode||Po,i=n===1?gc:mc[r];let s=Object.keys(a).filter(i);const o=e.filter;typeof o=="function"&&(s=s.filter(o));const c=r===Oo||r===ko;c&&!s.includes("ts")&&s.push("ts"),n>1&&!s.includes("v")&&s.push("v");const u=h({},oc,e.formatters),f={version:n,reportingMode:r,baseUrl:e.baseUrl};return s.sort().forEach(d=>{let g=a[d];const E=u[d];if(typeof E=="function"&&(g=E(g,f)),d==="v"){if(n===1)return;g=n}d=="pr"&&g===1||(c&&d==="ts"&&!L(g)&&(g=Date.now()),sc(g)&&(ic(d)&&typeof g=="string"&&(g=new wo(g)),t[d]=g))}),t}function vc(a,e={}){const t={};if(!a)return t;const n=Fo(a,e),r=rc(n,e==null?void 0:e.customHeaderMap);return Object.entries(r).reduce((i,[s,o])=>{const c=Lo(o,{whitespace:!1});return c&&(i[s]=c),i},t)}function _c(a,e,t){return h(a,vc(e,t))}const yc="CMCD";function Ec(a,e={}){return a?Lo(Fo(a,e),{whitespace:!1}):""}function bc(a,e={}){if(!a)return"";const t=Ec(a,e);return encodeURIComponent(t)}function xc(a,e={}){if(!a)return"";const t=bc(a,e);return`${yc}=${t}`}const No=/CMCD=[^&#]+/;function Sc(a,e,t){const n=xc(e,t);if(!n)return a;if(No.test(a))return a.replace(No,n);const r=a.includes("?")?"&":"?";return`${a}${r}${n}`}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=r=>{try{this.apply(r,{ot:di.MANIFEST,su:!this.initialized})}catch(i){this.hls.logger.warn("Could not generate manifest CMCD data.",i)}},this.applyFragmentData=r=>{try{const{frag:i,part:s}=r,o=this.hls.levels[i.level],c=this.getObjectType(i),u={d:(s||i).duration*1e3,ot:c};(c===di.VIDEO||c===di.AUDIO||c==di.MUXED)&&(u.br=o.bitrate/1e3,u.tb=this.getTopBandwidth(c)/1e3,u.bl=this.getBufferLength(c));const f=s?this.getNextPart(s):this.getNextFrag(i);f!=null&&f.url&&f.url!==i.url&&(u.nor=f.url),this.apply(r,u)}catch(i){this.hls.logger.warn("Could not generate segment CMCD data.",i)}},this.hls=e;const t=this.config=e.config,{cmcd:n}=t;n!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||e.sessionId,this.cid=n.contentId,this.useHeaders=n.useHeaders===!0,this.includeKeys=n.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 n,r;this.audioBuffer=(n=t.tracks.audio)==null?void 0:n.buffer,this.videoBuffer=(r=t.tracks.video)==null?void 0:r.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={}){h(t,this.createData());const n=t.ot===di.INIT||t.ot===di.VIDEO||t.ot===di.MUXED;this.starved&&n&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:r}=this;r&&(t=Object.keys(t).reduce((s,o)=>(r.includes(o)&&(s[o]=t[o]),s),{}));const i={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),_c(e.headers,t,i)):e.url=Sc(e.url,t,i)}getNextFrag(e){var t;const n=(t=this.hls.levels[e.level])==null?void 0:t.details;if(n){const r=e.sn-n.startSN;return n.fragments[r+1]}}getNextPart(e){var t;const{index:n,fragment:r}=e,i=(t=this.hls.levels[r.level])==null||(t=t.details)==null?void 0:t.partList;if(i){const{sn:s}=r;for(let o=i.length-1;o>=0;o--){const c=i[o];if(c.index===n&&c.fragment.sn===s)return i[o+1]}}}getObjectType(e){const{type:t}=e;if(t==="subtitle")return di.TIMED_TEXT;if(e.sn==="initSegment")return di.INIT;if(t==="audio")return di.AUDIO;if(t==="main")return this.hls.audioTracks.length?di.VIDEO:di.MUXED}getTopBandwidth(e){let t=0,n;const r=this.hls;if(e===di.AUDIO)n=r.audioTracks;else{const i=r.maxAutoLevel,s=i>-1?i+1:r.levels.length;n=r.levels.slice(0,s)}return n.forEach(i=>{i.bitrate>t&&(t=i.bitrate)}),t>0?t:NaN}getBufferLength(e){const t=this.media,n=e===di.AUDIO?this.audioBuffer:this.videoBuffer;return!n||!t?NaN:In.bufferInfo(n,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,n=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new n(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,s,o){t(i),this.loader.load(i,s,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,n=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new n(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,s,o){t(i),this.loader.load(i,s,o)}}}}const wc=3e5;class Ac extends Z{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(n=>n!==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:n}=t;n!==null&&(this.pathwayId=n.pathwayId,this.uri=n.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:n}=t;if((n==null?void 0:n.action)===On.SendAlternateToPenaltyBox&&n.flags===sn.MoveAllAlternatesMatchingHost){const r=this.levels;let i=this._pathwayPriority,s=this.pathwayId;if(t.context){const{groupId:o,pathwayId:c,type:u}=t.context;o&&r?s=this.getPathwayForGroupId(o,u,s):c&&(s=c)}s in this.penalizedPathways||(this.penalizedPathways[s]=performance.now()),!i&&r&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),n.resolved=this.pathwayId!==s),t.details===$.BUFFER_APPEND_ERROR&&!t.fatal?n.resolved=!0:n.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${s} levels: ${r&&r.length} priorities: ${$e(i)} penalized: ${$e(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const n=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`),t=this.getLevelsForPathway(n),this.pathwayId=n}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 n=this.penalizedPathways,r=performance.now();Object.keys(n).forEach(i=>{r-n[i]>wc&&delete n[i]});for(let i=0;i<e.length;i++){const s=e[i];if(s in n)continue;if(s===this.pathwayId)return;const o=this.hls.nextLoadLevel,c=this.hls.levels[o];if(t=this.getLevelsForPathway(s),t.length>0){this.log(`Setting Pathway to "${s}"`),this.pathwayId=s,ti(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,n){const r=this.getLevelsForPathway(n).concat(this.levels||[]);for(let i=0;i<r.length;i++)if(t===ge.AUDIO_TRACK&&r[i].hasAudioGroup(e)||t===ge.SUBTITLE_TRACK&&r[i].hasSubtitleGroup(e))return r[i].pathwayId;return n}clonePathways(e){const t=this.levels;if(!t)return;const n={},r={};e.forEach(i=>{const{ID:s,"BASE-ID":o,"URI-REPLACEMENT":c}=i;if(t.some(f=>f.pathwayId===s))return;const u=this.getLevelsForPathway(o).map(f=>{const d=new mr(f.attrs);d["PATHWAY-ID"]=s;const g=d.AUDIO&&`${d.AUDIO}_clone_${s}`,E=d.SUBTITLES&&`${d.SUBTITLES}_clone_${s}`;g&&(n[d.AUDIO]=g,d.AUDIO=g),E&&(r[d.SUBTITLES]=E,d.SUBTITLES=E);const b=Uo(f.uri,d["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),M=new Pt({attrs:d,audioCodec:f.audioCodec,bitrate:f.bitrate,height:f.height,name:f.name,url:b,videoCodec:f.videoCodec,width:f.width});if(f.audioGroups)for(let O=1;O<f.audioGroups.length;O++)M.addGroupId("audio",`${f.audioGroups[O]}_clone_${s}`);if(f.subtitleGroups)for(let O=1;O<f.subtitleGroups.length;O++)M.addGroupId("text",`${f.subtitleGroups[O]}_clone_${s}`);return M});t.push(...u),Bo(this.audioTracks,n,c,s),Bo(this.subtitleTracks,r,c,s)})}loadSteeringManifest(e){const t=this.hls.config,n=t.loader;this.loader&&this.loader.destroy(),this.loader=new n(t);let r;try{r=new self.URL(e)}catch(f){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(r.protocol!=="data:"){const f=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;r.searchParams.set("_HLS_pathway",this.pathwayId),r.searchParams.set("_HLS_throughput",""+f)}const i={responseType:"json",url:r.href},s=t.steeringManifestLoadPolicy.default,o=s.errorRetry||s.timeoutRetry||{},c={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},u={onSuccess:(f,d,g,E)=>{this.log(`Loaded steering manifest: "${r}"`);const b=f.data;if((b==null?void 0:b.VERSION)!==1){this.log(`Steering VERSION ${b.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=b.TTL;const{"RELOAD-URI":M,"PATHWAY-CLONES":O,"PATHWAY-PRIORITY":ae}=b;if(M)try{this.uri=new self.URL(M,r).href}catch(_e){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${M}`);return}this.scheduleRefresh(this.uri||g.url),O&&this.clonePathways(O);const he={steeringManifest:b,url:r.toString()};this.hls.trigger(p.STEERING_MANIFEST_LOADED,he),ae&&this.updatePathwayPriority(ae)},onError:(f,d,g,E)=>{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 b=this.timeToLoad*1e3;if(f.code===429){const M=this.loader;if(typeof(M==null?void 0:M.getResponseHeader)=="function"){const O=M.getResponseHeader("Retry-After");O&&(b=parseFloat(O)*1e3)}this.log(`Steering manifest ${d.url} rate limited`);return}this.scheduleRefresh(this.uri||d.url,b)},onTimeout:(f,d,g)=>{this.log(`Timeout loading steering manifest (${d.url})`),this.scheduleRefresh(this.uri||d.url)}};this.log(`Requesting steering manifest: ${r}`),this.loader.load(i,c,u)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var n;const r=(n=this.hls)==null?void 0:n.media;if(r&&!r.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Bo(a,e,t,n){a&&Object.keys(e).forEach(r=>{const i=a.filter(s=>s.groupId===r).map(s=>{const o=h({},s);return o.details=void 0,o.attrs=new mr(o.attrs),o.url=o.attrs.URI=Uo(s.url,s.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[r],o.attrs["PATHWAY-ID"]=n,o});a.push(...i)})}function Uo(a,e,t,n){const{HOST:r,PARAMS:i,[t]:s}=n;let o;e&&(o=s==null?void 0:s[e],o&&(a=o));const c=new self.URL(a);return r&&!o&&(c.host=r),i&&Object.keys(i).sort().forEach(u=>{u&&c.searchParams.set(u,i[u])}),c.href}class us extends Z{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=us.CDMCleanupPromise?[us.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=t=>{const{initDataType:n,initData:r}=t,i=`"${t.type}" event: init data type: "${n}"`;if(this.debug(i),r!==null){if(!this.keyFormatPromise){let s=Object.keys(this.keySystemAccessPromises);s.length||(s=Jr(this.config));const o=s.map(Ur).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(s=>{const o=Qr(s);if(n!=="sinf"||o!==Wn.FAIRPLAY){this.log(`Ignoring "${t.type}" event with init data type: "${n}" for selected key-system ${o}`);return}let c;try{const E=rt(new Uint8Array(r)),b=lr(JSON.parse(E).sinf),M=ne(b);if(!M)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(M.subarray(8,24))}catch(E){this.warn(`${i} Failed to parse sinf: ${E}`);return}const u=V(c),{keyIdToKeySessionPromise:f,mediaKeySessions:d}=this;let g=f[u];for(let E=0;E<d.length;E++){const b=d[E],M=b.decryptdata;if(!M.keyId)continue;const O=V(M.keyId);if(Sn(c,M.keyId)||M.uri.replace(/-/g,"").indexOf(u)!==-1){if(g=f[O],!g)continue;if(M.pssh)break;delete f[O],M.pssh=new Uint8Array(r),M.keyId=c,g=f[u]=g.then(()=>this.generateRequestWithPreferredKeySession(b,n,r,"encrypted-event-key-match")),g.catch(ae=>this.handleError(ae));break}}g||this.handleError(new Error(`Key ID ${u} not encountered in playlist. Key-system sessions ${d.length}.`))}).catch(s=>this.handleError(s))}},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:n}=this.config,r=t==null?void 0:t[e];if(r)return r.licenseUrl;if(e===Wn.WIDEVINE&&n)return n}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,n=t==null?void 0:t[e];if(n)return n.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,n=(s,o,c)=>!!s&&c.indexOf(s)===o,r=t.map(s=>s.audioCodec).filter(n),i=t.map(s=>s.videoCodec).filter(n);return r.length+i.length===0&&i.push("avc1.42e01e"),new Promise((s,o)=>{const c=u=>{const f=u.shift();this.getMediaKeysPromise(f,r,i).then(d=>s({keySystem:f,mediaKeys:d})).catch(d=>{u.length?c(u):d instanceof gi?o(d):o(new gi({type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_ACCESS,error:d,fatal:!0},d.message))})};c(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:n}=this.config;if(typeof n!="function"){let r=`Configured requestMediaKeySystemAccess is not a function ${n}`;return $r===null&&self.location.protocol==="http:"&&(r=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(r))}return n(e,t)}getMediaKeysPromise(e,t,n){var r;const i=Ni(e,t,n,this.config.drmSystemOptions||{});let s=this.keySystemAccessPromises[e],o=(r=s)==null?void 0:r.keySystemAccess;if(!o){this.log(`Requesting encrypted media "${e}" key-system access with config: ${$e(i)}`),o=this.requestMediaKeySystemAccess(e,i);const c=s=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(g=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,f.then(E=>E?this.setMediaKeysServerCertificate(g,e,E):g)));return d.catch(g=>{this.error(`Failed to create media-keys for "${e}"}: ${g}`)}),d})}return o.then(()=>s.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:n}){this.log(`Creating key-system session "${t}" keyId: ${V(e.keyId||[])} keyUri: ${e.uri}`);const r=n.createSession(),i={decryptdata:e,keySystem:t,mediaKeys:n,mediaKeysSession:r,keyStatus:"status-pending"};return this.mediaKeySessions.push(i),i}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const n=this.createMediaKeySessionContext(e),r=zs(t),i="cenc";this.keyIdToKeySessionPromise[r]=this.generateRequestWithPreferredKeySession(n,i,t.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,t){const n=e.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyId ${V(e.decryptdata.keyId||[])}
} (data length: ${t.byteLength})`),n.update(t)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Ur(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:t,mediaKeys:n})=>this.attemptSetMediaKeys(t,n))}selectKeySystem(e){return new Promise((t,n)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:r})=>{const i=Ur(r);i?t(i):n(new Error(`Unable to find format for key-system "${r}"`))}).catch(n)})}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=Jr(this.config),n=e.map(Qr).filter(r=>!!r&&t.indexOf(r)!==-1);return this.selectKeySystem(n)}getKeyStatus(e){const{mediaKeySessions:t}=this;for(let n=0;n<t.length;n++){const r=Dc(e,t[n]);if(r)return r}}loadKey(e){const t=e.keyInfo.decryptdata,n=zs(t),r=this.bannedKeyIds[n];if(r||this.getKeyStatus(t)==="internal-error"){const o=$o(r||"internal-error",t);return this.handleError(o,e.frag),Promise.reject(o)}const i=`(keyId: ${n} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${i}`);const s=this.keyIdToKeySessionPromise[n];if(!s){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 ${i}`),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[n]=o,o}return s.catch(o=>{if(o instanceof gi){const c=y({},o.data);this.getKeyStatus(t)==="internal-error"&&(c.decryptdata=t);const u=new gi(c,o.message);this.handleError(u,e.frag)}}),s}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof gi){t&&(e.data.frag=t);const n=e.data.decryptdata;this.error(`${e.message}${n?` (${V(n.keyId||[])})`:""}`),this.hls.trigger(p.ERROR,e.data)}else this.error(e.message),this.hls.trigger(p.ERROR,{type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const t=zs(e),n=this.keyIdToKeySessionPromise[t];if(!n){const r=Qr(e.keyFormat),i=r?[r]:Jr(this.config);return this.attemptKeySystemAccess(i)}return n}getKeySystemSelectionPromise(e){if(e.length||(e=Jr(this.config)),e.length===0)throw new gi({type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${$e({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){if(this.mediaKeys===t)return Promise.resolve();const n=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const r=Promise.all(n).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(r),r.then(()=>{this.log(`Media-keys set for "${e}"`),n.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(i=>n.indexOf(i)===-1)})}generateRequestWithPreferredKeySession(e,t,n,r){var i;const s=(i=this.config.drmSystems)==null||(i=i[e.keySystem])==null?void 0:i.generateRequest;if(s)try{const b=s.call(this.hls,t,n,e);if(!b)throw new Error("Invalid response from configured generateRequest filter");t=b.initDataType,n=b.initData?b.initData:null,e.decryptdata.pssh=n?new Uint8Array(n):null}catch(b){if(this.warn(b.message),this.hls&&this.hls.config.debug)throw b}if(n===null)return this.log(`Skipping key-session request for "${r}" (no initData)`),Promise.resolve(e);const o=zs(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${r}" keyId: ${o} URI: ${c} (init data type: ${t} length: ${n.byteLength})`);const u=new ia,f=e._onmessage=b=>{const M=e.mediaKeysSession;if(!M){u.emit("error",new Error("invalid state"));return}const{messageType:O,message:ae}=b;this.log(`"${O}" message event for session "${M.sessionId}" message size: ${ae.byteLength}`),O==="license-request"||O==="license-renewal"?this.renewLicense(e,ae).catch(he=>{u.eventNames().length?u.emit("error",he):this.handleError(he)}):O==="license-release"?e.keySystem===Wn.FAIRPLAY&&this.updateKeySession(e,Er("acknowledged")).then(()=>this.removeSession(e)).catch(he=>this.handleError(he)):this.warn(`unhandled media key message type "${O}"`)},d=(b,M)=>{M.keyStatus=b;let O;b.startsWith("usable")?u.emit("resolved"):b==="internal-error"||b==="output-restricted"||b==="output-downscaled"?O=$o(b,M.decryptdata):b==="expired"?O=new Error(`key expired (keyId: ${o})`):b==="released"?O=new Error("key released"):b==="status-pending"||this.warn(`unhandled key status change "${b}" (keyId: ${o})`),O&&(u.eventNames().length?u.emit("error",O):this.handleError(O))},g=e._onkeystatuseschange=b=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}const O=this.getKeyStatuses(e);if(!Object.keys(O).some(Ke=>O[Ke]!=="status-pending"))return;if(O[o]==="expired"){this.log(`Expired key ${$e(O)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let he=O[o];if(he)d(he,e);else{var _e;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(_e=e.keyStatusTimeouts)[o]||(_e[o]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const We=this.getKeyStatus(e.decryptdata);if(We&&We!=="status-pending")return this.log(`No status for keyId ${o} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${We} from other session.`),d(We,e);this.log(`key status for ${o} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),he="internal-error",d(he,e)},1e3)),this.log(`No status for keyId ${o} (${$e(O)}).`)}};li(e.mediaKeysSession,"message",f),li(e.mediaKeysSession,"keystatuseschange",g);const E=new Promise((b,M)=>{u.on("error",M),u.on("resolved",b)});return e.mediaKeysSession.generateRequest(t,n).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${o} URI: ${c}`)}).catch(b=>{throw new gi({type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_NO_SESSION,error:b,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${b}`)}).then(()=>E).catch(b=>(u.removeAllListeners(),this.removeSession(e).then(()=>{throw b}))).then(()=>(u.removeAllListeners(),e))}getKeyStatuses(e){const t={};return e.mediaKeysSession.keyStatuses.forEach((n,r)=>{if(typeof r=="string"&&typeof n=="object"){const o=r;r=n,n=o}const i="buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r);e.keySystem===Wn.PLAYREADY&&i.length===16&&dn(i);const s=V(i);n==="internal-error"&&(this.bannedKeyIds[s]=n),this.log(`key status change "${n}" for keyStatuses keyId: ${s} key-session "${e.mediaKeysSession.sessionId}"`),t[s]=n}),t}fetchServerCertificate(e){const t=this.config,n=t.loader,r=new n(t),i=this.getServerCertificateUrl(e);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise((s,o)=>{const c={responseType:"arraybuffer",url:i},u=t.certLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(g,E,b,M)=>{s(g.data)},onError:(g,E,b,M)=>{o(new gi({type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:y({url:c.url,data:void 0},g)},`"${e}" certificate request failed (${i}). Status: ${g.code} (${g.text})`))},onTimeout:(g,E,b)=>{o(new gi({type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:b,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(g,E,b)=>{o(new Error("aborted"))}};r.load(c,f,d)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,n){return new Promise((r,i)=>{e.setServerCertificate(n).then(s=>{this.log(`setServerCertificate ${s?"success":"not supported by CDM"} (${n.byteLength}) on "${t}"`),r(e)}).catch(s=>{i(new gi({type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:s,fatal:!0},s.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(n=>this.updateKeySession(e,new Uint8Array(n)).catch(r=>{throw new gi({type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:r,fatal:!1},r.message)}))}unpackPlayReadyKeyMessage(e,t){const n=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!n.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const r=new DOMParser().parseFromString(n,"application/xml"),i=r.querySelectorAll("HttpHeader");if(i.length>0){let f;for(let d=0,g=i.length;d<g;d++){var s,o;f=i[d];const E=(s=f.querySelector("name"))==null?void 0:s.textContent,b=(o=f.querySelector("value"))==null?void 0:o.textContent;E&&b&&e.setRequestHeader(E,b)}}const c=r.querySelector("Challenge"),u=c==null?void 0:c.textContent;if(!u)throw new Error("Cannot find <Challenge> in key message");return Er(atob(u))}setupLicenseXHR(e,t,n,r){const i=this.config.licenseXhrSetup;return i?Promise.resolve().then(()=>{if(!n.decryptdata)throw new Error("Key removed");return i.call(this.hls,e,t,n,r)}).catch(s=>{if(!n.decryptdata)throw s;return e.open("POST",t,!0),i.call(this.hls,e,t,n,r)}).then(s=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:s||r})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:r}))}requestLicense(e,t){const n=this.config.keyLoadPolicy.default;return new Promise((r,i)=>{const s=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${s}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(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,s,e)}catch(f){this.error(f)}r(c)}else{const c=n.errorRetry,u=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>u||o.status>=400&&o.status<500)i(new gi({type:ue.KEY_SYSTEM_ERROR,details:$.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:o,response:{url:s,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${s}). Status: ${o.status} (${o.statusText})`));else{const f=u-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${f} attempts left`),this.requestLicense(e,t).then(r,i)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,s,e,t).then(({xhr:c,licenseChallenge:u})=>{e.keySystem==Wn.PLAYREADY&&(u=this.unpackPlayReadyKeyMessage(c,u)),c.send(u)}).catch(i)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const n=t.media;this.media=n,li(n,"encrypted",this.onMediaEncrypted),li(n,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media;e&&(fi(e,"encrypted",this.onMediaEncrypted),fi(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,n=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,ci.clearKeyUriToKeyIdMap();const r=n.length;us.CDMCleanupPromise=Promise.all(n.map(i=>this.removeSession(i)).concat((t==null||(e=t.setMediaKeys(null))==null?void 0:e.catch(i=>{this.log(`Could not clear media keys: ${i}`),this.hls&&this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${i}`)})}))||Promise.resolve())).catch(i=>{this.log(`Could not close sessions and clear media keys: ${i}`),this.hls&&this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${i}`)})}).then(()=>{r&&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 n=t.reduce((r,i)=>(r.indexOf(i.keyFormat)===-1&&r.push(i.keyFormat),r),[]);this.log(`Selecting key-system from session-keys ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:n,decryptdata:r}=e;if(t){this.log(`Remove licenses and keys and close session "${t.sessionId}" keyId: ${V((r==null?void 0:r.keyId)||[])}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);i>-1&&this.mediaKeySessions.splice(i,1);const{keyStatusTimeouts:s}=e;s&&Object.keys(s).forEach(u=>self.clearTimeout(s[u]));const{drmSystemOptions:o}=this.config;return(gs(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:ue.OTHER_ERROR,details:$.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:ue.OTHER_ERROR,details:$.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${u}`)})})}return Promise.resolve()}}us.CDMCleanupPromise=void 0;function zs(a){if(!a)throw new Error("Could not read keyId of undefined decryptdata");if(a.keyId===null)throw new Error("keyId is null");return V(a.keyId)}function Dc(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 gi 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 $o(a,e){const t=a==="output-restricted",n=t?$.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:$.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new gi({type:ue.KEY_SYSTEM_ERROR,details:n,fatal:!1,decryptdata:e},t?"HDCP level output restricted":`key status changed to "${a}"`)}class Rc{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 n=this.hls.config;if(n.capLevelOnFPSDrop){const r=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=r,r&&typeof r.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,n){const r=performance.now();if(t){if(this.lastTime){const i=r-this.lastTime,s=n-this.lastDroppedFrames,o=t-this.lastDecodedFrames,c=1e3*s/i,u=this.hls;if(u.trigger(p.FPS_DROP,{currentDropped:s,currentDecoded:o,totalDroppedFrames:n}),c>0&&s>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=r,this.lastDroppedFrames=n,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}function Ko(a,e){let t;try{t=new Event("addtrack")}catch(n){t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=a,e.dispatchEvent(t)}function Zo(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(n){X.debug(`[texttrack-utils]: ${n}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,a.addCue(r)}catch(r){X.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${r}`)}}t==="disabled"&&(a.mode=t)}function cs(a,e){const t=a.mode;if(t==="disabled"&&(a.mode="hidden"),a.cues)for(let n=a.cues.length;n--;)e&&a.cues[n].removeEventListener("enter",e),a.removeCue(a.cues[n]);t==="disabled"&&(a.mode=t)}function Aa(a,e,t,n){const r=a.mode;if(r==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const i=Ic(a.cues,e,t);for(let s=0;s<i.length;s++)(!n||n(i[s]))&&a.removeCue(i[s])}r==="disabled"&&(a.mode=r)}function Cc(a,e){if(e<=a[0].startTime)return 0;const t=a.length-1;if(e>a[t].endTime)return-1;let n=0,r=t,i;for(;n<=r;)if(i=Math.floor((r+n)/2),e<a[i].startTime)r=i-1;else if(e>a[i].startTime&&n<t)n=i+1;else return i;return a[n].startTime-e<e-a[r].startTime?n:r}function Ic(a,e,t){const n=[],r=Cc(a,e);if(r>-1)for(let i=r,s=a.length;i<s;i++){const o=a[i];if(o.startTime>=e&&o.endTime<=t)n.push(o);else if(o.startTime>t)return n}return n}function Ws(a){const e=[];for(let t=0;t<a.length;t++){const n=a[t];(n.kind==="subtitles"||n.kind==="captions")&&n.label&&e.push(a[t])}return e}class Lc extends va{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 n=Ws(this.media.textTracks);for(let i=0;i<n.length;i++)if(n[i].mode==="hidden")t=n[i];else if(n[i].mode==="showing"){t=n[i];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},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 n=this.media;if(!n)return;const r=!!t.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||n.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,r)return;Ws(n.textTracks).forEach(s=>{cs(s)})}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:n,groupId:r,details:i}=t,s=this.tracksInGroup[n];if(!s||s.groupId!==r){this.warn(`Subtitle track with id:${n} and group:${r} not found in active group ${s==null?void 0:s.groupId}`);return}const o=s.details;s.details=t.details,this.log(`Subtitle track ${n} "${s.name}" lang:${s.lang} group:${r} loaded [${i.startSN}-${i.endSN}]`),n===this.trackId&&this.playlistLoaded(n,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 n=t.subtitleGroups||null,r=this.groupIds;let i=this.currentTrack;if(!n||(r==null?void 0:r.length)!==(n==null?void 0:n.length)||n!=null&&n.some(s=>(r==null?void 0:r.indexOf(s))===-1)){this.groupIds=n,this.trackId=-1,this.currentTrack=null;const s=this.tracks.filter(f=>!n||n.indexOf(f.groupId)!==-1);if(s.length)this.selectDefaultTrack&&!s.some(f=>f.default)&&(this.selectDefaultTrack=!1),s.forEach((f,d)=>{f.id=d});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=s;const o=this.hls.config.subtitlePreference;if(!i&&o){this.selectDefaultTrack=!1;const f=Kt(o,s);if(f>-1)i=s[f];else{const d=Kt(o,this.tracks);i=this.tracks[d]}}let c=this.findTrackId(i);c===-1&&i&&(c=this.findTrackId(null));const u={subtitleTracks:s};this.log(`Updating subtitle tracks, ${s.length} track(s) found in "${n==null?void 0:n.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,n=this.selectDefaultTrack;for(let r=0;r<t.length;r++){const i=t[r];if(!(n&&!i.default||!n&&!e)&&(!e||Ht(i,e)))return r}if(e){for(let r=0;r<t.length;r++){const i=t[r];if(Ds(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<t.length;r++){const i=t[r];if(Ds(e.attrs,i.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let n=0;n<t.length;n++){const r=t[n];if(_a(r,e))return n}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ge.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 n=this.currentTrack;if(n&&Ht(e,n))return n;const r=Kt(e,this.tracksInGroup);if(r>-1){const i=this.tracksInGroup[r];return this.setSubtitleTrack(r),i}else{if(n)return null;{const i=Kt(e,t);if(i>-1)return t[i]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=e.id,r=e.groupId,i=this.getUrlWithDirectives(e.url,t),s=e.details,o=s==null?void 0:s.age;this.log(`Loading subtitle ${n} "${e.name}" lang:${e.lang} group:${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):""} ${i}`),this.hls.trigger(p.SUBTITLE_TRACK_LOADING,{url:i,id:n,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Ws(e.textTracks),n=this.currentTrack;let r;if(n&&(r=t.filter(i=>_a(n,i))[0],r||this.warn(`Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"`)),[].slice.call(t).forEach(i=>{i.mode!=="disabled"&&i!==r&&(i.mode="disabled")}),r){const i=this.subtitleDisplay?"showing":"hidden";r.mode!==i&&(r.mode=i)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!L(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const n=this.currentTrack,r=t[e]||null;if(this.trackId=e,this.currentTrack=r,this.toggleTrackModes(),!r){this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:e});return}const i=!!r.details&&!r.details.live;if(e===this.trackId&&r===n&&i)return;this.log(`Switching to subtitle-track ${e}`+(r?` "${r.name}" lang:${r.lang} group:${r.groupId}`:""));const{id:s,groupId:o="",name:c,type:u,url:f}=r;this.hls.trigger(p.SUBTITLE_TRACK_SWITCH,{id:s,groupId:o,name:c,type:u,url:f});const d=this.switchParams(r.url,n==null?void 0:n.details,r.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,r=>{const i=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(r=="x"?i:i&3|8).toString(16)})}}}function Rs(a){let e=5381,t=a.length;for(;t;)e=e*33^a.charCodeAt(--t);return(e>>>0).toString()}const fs=.025;let Hs=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function Pc(a,e,t){return`${a.identifier}-${t+1}-${Rs(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 n=this.playoutLimit;return e<=0||isNaN(n)?!1:n===0?!0:(((t=this.assetList[e])==null?void 0:t.startOffset)||0)>n}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 Da(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,n=Da(t,e);return t-n<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,t=L(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 Da(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)<fs))}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"?Hs.Range:Hs.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 Da(a,e){return a-e.start<e.duration/2&&!(Math.abs(a-(e.start+e.duration))<fs)?e.start:e.start+e.duration}function Go(a,e,t){const n=new self.URL(a,t);return n.protocol!=="data:"&&n.searchParams.set("_HLS_primary_id",e),n}function Ra(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 ds(a){const e=a.timelineStart,t=a.duration||0;return`["${a.identifier}" ${e.toFixed(2)}-${(e+t).toFixed(2)}]`}class Fc{constructor(e,t,n,r){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 i=this.hls=new e(t);this.interstitial=n,this.assetItem=r;const s=()=>{this.hasDetails=!0};i.once(p.LEVEL_LOADED,s),i.once(p.AUDIO_TRACK_LOADED,s),i.once(p.SUBTITLE_TRACK_LOADED,s),i.on(p.MEDIA_ATTACHING,(o,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&i.on(p.BUFFER_APPENDED,()=>{const f=this.bufferedEnd;this.reachedPlayout(f)&&(this._bufferedEosTime=f,i.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=Go(t,e.config.primarySessionId||"").href}catch(n){}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 n=Math.min(this._bufferedEosTime||1/0,this.duration),r=this.timelineOffset,i=In.bufferInfo(e,r,0);return this.getAssetTime(i.end)>=n-.02}reachedPlayout(e){const n=this.interstitial.playoutLimit;return this.startOffset+e>=n}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=In.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 n=t-this.startOffset;if(n>0&&n<e)return n}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 n=e-t;if(Math.abs(n)>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,n=this.duration;return Math.min(Math.max(0,e-t),n)}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=n=>delete n.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,n){var r;(r=this.hls)==null||r.on(e,t)}once(e,t,n){var r;(r=this.hls)==null||r.once(e,t)}off(e,t,n){var r;(r=this.hls)==null||r.off(e,t)}toString(){var e;return`HlsAssetPlayer: ${ds(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Vo=.033;class Nc extends Z{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((n,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,n+1):n,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 n=-1;e.nextEvent?n=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(n=this.findEventIndex(e.previousEvent.identifier)+1);const r=this.items;if(r)for(r[n]||(t===void 0&&(t=e.start),n=this.findItemIndexAtTime(t));n>=0&&(i=r[n])!=null&&i.event;){var i;n--}return n}findItemIndexAtTime(e,t){const n=this.items;if(n)for(let r=0;r<n.length;r++){let i=n[r];if(t&&t!=="primary"&&(i=i[t]),e===i.start||e>i.start&&e<i.end)return r}return-1}findJumpRestrictedIndex(e,t){const n=this.items;if(n)for(let r=e;r<=t&&n[r];r++){const i=n[r].event;if(i!=null&&i.restrictions.jump&&!i.appendInPlace)return r}return-1}findEventIndex(e){const t=this.items;if(t)for(let r=t.length;r--;){var n;if(((n=t[r].event)==null?void 0:n.identifier)===e)return r}return-1}findAssetIndex(e,t){const n=e.assetList,r=n.length;if(r>1)for(let i=0;i<r;i++){const s=n[i];if(!s.error){const o=s.timelineStart;if(t===o||t>o&&(t<o+(s.duration||0)||i===r-1))return i}}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 n=t.assetList,r=n[n.length-1];if(r)return r.identifier}return null}parseInterstitialDateRanges(e,t){const n=e.main.details,{dateRanges:r}=n,i=this.events,s=this.parseDateRanges(r,{url:n.url},t),o=Object.keys(r),c=i?i.filter(u=>!o.includes(u.identifier)):[];s.length&&s.sort((u,f)=>{const d=u.cue.pre,g=u.cue.post,E=f.cue.pre,b=f.cue.post;if(d&&!E)return-1;if(E&&!d||g&&!b)return 1;if(b&&!g)return-1;if(!d&&!E&&!g&&!b){const M=u.startTime,O=f.startTime;if(M!==O)return M-O}return u.dateRange.tagOrder-f.dateRange.tagOrder}),this.events=s,c.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,c)}updateSchedule(e,t=[],n=!1){const r=this.events||[];if(r.length||t.length||this.length<2){const i=this.items,s=this.parseSchedule(r,e);(n||t.length||(i==null?void 0:i.length)!==s.length||s.some((c,u)=>Math.abs(c.playout.start-i[u].playout.start)>.005||Math.abs(c.playout.end-i[u].playout.end)>.005))&&(this.items=s,this.onScheduleUpdate(t,i))}}parseDateRanges(e,t,n){const r=[],i=Object.keys(e);for(let s=0;s<i.length;s++){const o=i[s],c=e[o];if(c.isInterstitial){let u=this.eventMap[o];u?u.setDateRange(c):(u=new Oc(c,t),this.eventMap[o]=u,n===!1&&(u.appendInPlace=n)),r.push(u)}}return r}parseSchedule(e,t){const n=[],r=t.main.details,i=r.live?1/0:r.edge;let s=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 g=f.cue.pre,E=f.cue.post,b=e[d-1]||null,M=f.appendInPlace,O=E?i:f.startOffset,ae=f.duration,he=f.timelineOccupancy===Hs.Range?ae:0,_e=f.resumptionOffset,Ke=(b==null?void 0:b.startTime)===O,We=O+f.cumulativeDuration;let mt=M?We+ae:O+_e;if(g||!E&&O<=0){const ot=u;u+=he,f.timelineStart=We;const at=s;s+=ae,n.push({event:f,start:We,end:mt,playout:{start:at,end:s},integrated:{start:ot,end:u}})}else if(O<=i){if(!Ke){const Je=O-c;if(Je>Vo){const Nt=c,vn=u;u+=Je;const Rn=s;s+=Je;const Fn={previousEvent:e[d-1]||null,nextEvent:f,start:Nt,end:Nt+Je,playout:{start:Rn,end:s},integrated:{start:vn,end:u}};n.push(Fn)}else Je>0&&b&&(b.cumulativeDuration+=Je,n[n.length-1].end=O)}E&&(mt=We),f.timelineStart=We;const ot=u;u+=he;const at=s;s+=ae,n.push({event:f,start:We,end:mt,playout:{start:at,end:s},integrated:{start:ot,end:u}})}else return;const He=f.resumeTime;E||He>i?c=i:c=He}),c<i){var o;const f=c,d=u,g=i-c;u+=g;const E=s;s+=g,n.push({previousEvent:((o=n[n.length-1])==null?void 0:o.event)||null,nextEvent:null,start:c,end:f+g,playout:{start:E,end:s},integrated:{start:d,end:u}})}this.setDurations(i,s,u)}else n.push({previousEvent:null,nextEvent:null,start:0,end:i,playout:{start:0,end:i},integrated:{start:0,end:i}}),this.setDurations(i,i,i);return n}setDurations(e,t,n){this.durations={primary:e,playout:t,integrated:n}}resolveOffsets(e,t){const n=t.main.details,r=n.live?1/0:n.edge;let i=0,s=-1;e.forEach((o,c)=>{const u=o.cue.pre,f=o.cue.post,d=u?0:f?r:o.startTime;this.updateAssetDurations(o),s===d?o.cumulativeDuration=i:(i=0,s=d),!f&&o.snapOptions.in&&(o.resumeAnchor=Jt(null,n.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<Vo&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${o}`));const E=L(o.resumeOffset)?o.resumeOffset:o.duration;i+=E})}primaryCanResumeInPlaceAt(e,t){const n=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(n-r)>fs?(this.log(`"${e.identifier}" resumption ${n} not aligned with estimated timeline end ${r}`),!1):!Object.keys(t).some(s=>{const o=t[s].details,c=o.edge;if(n>=c)return this.log(`"${e.identifier}" resumption ${n} past ${s} playlist end ${c}`),!1;const u=Jt(null,o.fragments,n);if(!u)return this.log(`"${e.identifier}" resumption ${n} does not align with any fragments in ${s} playlist (${o.fragStart}-${o.fragmentEnd})`),!0;const f=s==="audio"?.175:0;return Math.abs(u.start-n)<fs+f||Math.abs(u.end-n)<fs+f?!1:(this.log(`"${e.identifier}" resumption ${n} not aligned with ${s} fragment bounds (${u.start}-${u.end} sn: ${u.sn} cc: ${u.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const t=e.timelineStart;let n=0,r=!1,i=!1;for(let s=0;s<e.assetList.length;s++){const o=e.assetList[s],c=t+n;o.startOffset=n,o.timelineStart=c,r||(r=o.duration===null),i||(i=!!o.error);const u=o.error?0:o.duration||0;n+=u}r&&!i?e.duration=Math.max(n,e.duration):e.duration=n}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Ti(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 n=e.assetListUrl;let r;try{r=Go(n,this.hls.sessionId,e.baseUrl)}catch(g){const E=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,g,n);this.hls.trigger(p.ERROR,E);return}t&&r.protocol!=="data:"&&r.searchParams.set("_HLS_start_offset",""+t);const i=this.hls.config,s=i.loader,o=new s(i),c={responseType:"json",url:r.href},u=i.interstitialAssetListLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(g,E,b,M)=>{const O=g.data,ae=O==null?void 0:O.ASSETS;if(!Array.isArray(ae)){const he=this.assignAssetListError(e,$.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),b.url,E,M);this.hls.trigger(p.ERROR,he);return}e.assetListResponse=O,this.hls.trigger(p.ASSET_LIST_LOADED,{event:e,assetListResponse:O,networkDetails:M})},onError:(g,E,b,M)=>{const O=this.assignAssetListError(e,$.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${g.code} ${g.text} (${E.url})`),E.url,M,b);this.hls.trigger(p.ERROR,O)},onTimeout:(g,E,b)=>{const M=this.assignAssetListError(e,$.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${E.url})`),E.url,g,b);this.hls.trigger(p.ERROR,M)}};return o.load(c,f,d),this.hls.trigger(p.ASSET_LIST_LOADING,{event:e}),o}assignAssetListError(e,t,n,r,i,s){return e.error=n,{type:ue.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:n,networkDetails:s,stats:i}}}function zo(a){a==null||a.play().catch(()=>{})}function js(a,e){return`[${a}] Advancing timeline position to ${e}`}class Uc extends Z{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 n=this.currentTime;if(n===void 0||this.playbackDisabled||!this.schedule)return;const r=n-this.timelinePos;if(Math.abs(r)<1/7056e5)return;const s=r<=-.01;this.timelinePos=n,this.bufferedPos=n;const o=this.playingItem;if(!o){this.checkBuffer();return}if(s&&this.schedule.resetErrorsInRange(n,n-r)&&this.updateSchedule(!0),this.checkBuffer(),s&&n<o.start||n>=o.end){var c;const E=this.findItemIndex(o);let b=this.schedule.findItemIndexAtTime(n);if(b===-1&&(b=E+(s?-1:1),this.log(`seeked ${s?"back ":""}to position not covered by schedule ${n} (resolving from ${E} to ${b})`)),!this.isInterstitial(o)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!s&&b>E){const M=this.schedule.findJumpRestrictedIndex(E+1,b);if(M>E){this.setSchedulePosition(M);return}}this.setSchedulePosition(b);return}const u=this.playingAsset;if(!u){if(this.playingLastItem&&this.isInterstitial(o)){const E=o.event.assetList[0];E&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(n,E))}return}const f=u.timelineStart,d=u.duration||0;if(s&&n<f||n>=f+d){var g;(g=o.event)!=null&&g.appendInPlace&&(this.clearInterstitial(o.event,o),this.flushFrontBuffer(n)),this.setScheduleToAssetAtTime(n,u)}},this.onTimeupdate=()=>{const n=this.currentTime;if(n===void 0||this.playbackDisabled)return;if(n>this.timelinePos)this.timelinePos=n,n>this.bufferedPos&&this.checkBuffer();else return;const r=this.playingItem;if(!r||this.playingLastItem)return;if(n>=r.end){this.timelinePos=r.end;const o=this.findItemIndex(r);this.setSchedulePosition(o+1)}const i=this.playingAsset;if(!i)return;const s=i.timelineStart+(i.duration||0);n>=s&&this.setScheduleToAssetAtTime(n,i)},this.onScheduleUpdate=(n,r)=>{const i=this.schedule;if(!i)return;const s=this.playingItem,o=i.events||[],c=i.items||[],u=i.durations,f=n.map(M=>M.identifier),d=!!(o.length||f.length);(d||r)&&this.log(`INTERSTITIALS_UPDATED (${o.length}): ${o}
Schedule: ${c.map(M=>Ti(M))} pos: ${this.timelinePos}`),f.length&&this.log(`Removed events ${f}`);let g=null,E=null;s&&(g=this.updateItem(s,this.timelinePos),this.itemsMatch(s,g)?this.playingItem=g:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const b=this.bufferingItem;if(b&&(E=this.updateItem(b,this.bufferedPos),this.itemsMatch(b,E)?this.bufferingItem=E:b.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(b.event,null))),n.forEach(M=>{M.assetList.forEach(O=>{this.clearAssetPlayer(O.identifier,null)})}),this.playerQueue.forEach(M=>{if(M.interstitial.appendInPlace){const O=M.assetItem.timelineStart,ae=M.timelineOffset-O;if(ae)try{M.timelineOffset=O}catch(he){Math.abs(ae)>fs&&this.warn(`${he} ("${M.assetId}" ${M.timelineOffset}->${O})`)}}}),d||r){if(this.hls.trigger(p.INTERSTITIALS_UPDATED,{events:o.slice(0),schedule:c.slice(0),durations:u,removedIds:f}),this.isInterstitial(s)&&f.includes(s.event.identifier)){this.warn(`Interstitial "${s.event.identifier}" removed while playing`),this.primaryFallback(s.event);return}s&&this.trimInPlace(g,s),b&&E!==g&&this.trimInPlace(E,b),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new Bc(e),this.schedule=new Nc(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){fi(e,"play",this.onPlay),fi(e,"pause",this.onPause),fi(e,"seeking",this.onSeeking),fi(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){const n=this.media=t.media;li(n,"seeking",this.onSeeking),li(n,"timeupdate",this.onTimeupdate),li(n,"play",this.onPlay),li(n,"pause",this.onPause)}onMediaAttached(e,t){const n=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,n===null)this.checkStart();else if(!r){this.clearScheduleState();const i=this.findItemIndex(n);this.setSchedulePosition(i)}}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 n=!!t.transferMedia,r=this.media;if(this.media=null,!n&&(r&&this.removeMediaListeners(r),this.detachedData)){const i=this.getBufferingPlayer();i&&(this.log(`Removing schedule state for detachedData and ${i}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,i.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,n=d=>d&&e.getAssetPlayer(d.identifier),r=(d,g,E,b,M)=>{if(d){let O=d[g].start;const ae=d.event;if(ae){if(g==="playout"||ae.timelineOccupancy!==Hs.Point){const he=n(E);(he==null?void 0:he.interstitial)===ae&&(O+=he.assetItem.startOffset+he[M])}}else{const he=b==="bufferedPos"?s():e[b];O+=he-d.start}return O}return 0},i=(d,g)=>{var E;if(d!==0&&g!=="primary"&&(E=e.schedule)!=null&&E.length){var b;const M=e.schedule.findItemIndexAtTime(d),O=(b=e.schedule.items)==null?void 0:b[M];if(O){const ae=O[g].start-O.start;return d+ae}}return d},s=()=>{const d=e.bufferedPos;return d===Number.MAX_VALUE?o("primary"):Math.max(d,0)},o=d=>{var g,E;return(g=e.primaryDetails)!=null&&g.live?e.primaryDetails.edge:((E=e.schedule)==null?void 0:E.durations[d])||0},c=(d,g)=>{var E,b;const M=e.effectivePlayingItem;if(M!=null&&(E=M.event)!=null&&E.restrictions.skip||!e.schedule)return;e.log(`seek to ${d} "${g}"`);const O=e.effectivePlayingItem,ae=e.schedule.findItemIndexAtTime(d,g),he=(b=e.schedule.items)==null?void 0:b[ae],_e=e.getBufferingPlayer(),Ke=_e==null?void 0:_e.interstitial,We=Ke==null?void 0:Ke.appendInPlace,mt=O&&e.itemsMatch(O,he);if(O&&(We||mt)){const He=n(e.playingAsset),ot=(He==null?void 0:He.media)||e.primaryMedia;if(ot){const at=g==="primary"?ot.currentTime:r(O,g,e.playingAsset,"timelinePos","currentTime"),Je=d-at,Nt=(We?at:ot.currentTime)+Je;if(Nt>=0&&(!He||We||Nt<=He.duration)){ot.currentTime=Nt;return}}}if(he){let He=d;if(g!=="primary"){const at=he[g].start,Je=d-at;He=he.start+Je}const ot=!e.isInterstitial(he);if((!e.isInterstitial(O)||O.event.appendInPlace)&&(ot||he.event.appendInPlace)){const at=e.media||(We?_e==null?void 0:_e.media:null);at&&(at.currentTime=He)}else if(O){const at=e.findItemIndex(O);if(ae>at){const Nt=e.schedule.findJumpRestrictedIndex(at+1,ae);if(Nt>at){e.setSchedulePosition(Nt);return}}let Je=0;if(ot)e.timelinePos=He,e.checkBuffer();else{const Nt=he.event.assetList,vn=d-(he[g]||he).start;for(let Rn=Nt.length;Rn--;){const Fn=Nt[Rn];if(Fn.duration&&vn>=Fn.startOffset&&vn<Fn.startOffset+Fn.duration){Je=Rn;break}}}e.setSchedulePosition(ae,Je)}}},u=()=>{const d=e.effectivePlayingItem;if(e.isInterstitial(d))return d;const g=t();return e.isInterstitial(g)?g:null},f={get bufferedEnd(){const d=t(),g=e.bufferingItem;if(g&&g===d){var E;return r(g,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-g.playout.start||((E=e.bufferingAsset)==null?void 0:E.startOffset)||0}return 0},get currentTime(){const d=u(),g=e.effectivePlayingItem;return g&&g===d?r(g,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-g.playout.start:0},set currentTime(d){const g=u(),E=e.effectivePlayingItem;E&&E===g&&c(d+E.playout.start,"playout")},get duration(){const d=u();return d?d.playout.end-d.playout.start:0},get assetPlayers(){var d;const g=(d=u())==null?void 0:d.event.assetList;return g?g.map(E=>e.getAssetPlayer(E.identifier)):[]},get playingIndex(){var d;const g=(d=u())==null?void 0:d.event;return g&&e.effectivePlayingAsset?g.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 s()},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 r(t(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return r(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(d){c(d,"integrated")},get duration(){return o("integrated")},get seekableStart(){var d;return i(((d=e.primaryDetails)==null?void 0:d.fragmentStart)||0,"integrated")}},skip:()=>{const d=e.effectivePlayingItem,g=d==null?void 0:d.event;if(g&&!g.restrictions.skip){const E=e.findItemIndex(d);if(g.appendInPlace){const b=d.playout.start+d.event.duration;c(b+.001,"playout")}else e.advanceAfterAssetEnded(g,E,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,n=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!t||!n?!1:this.findItemIndex(t)===n.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,t;if(this.mediaSelection===null)return;const n=this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&!n.event.appendInPlace)return;let r=this.media;!r&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(r=this.primaryMedia);const i=(t=r)==null?void 0:t.currentTime;if(!(i===void 0||!L(i)))return i}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 n=this.getAssetPlayer(e);n&&this.transferMediaFromPlayer(n,t)}transferMediaFromPlayer(e,t){const n=e.interstitial.appendInPlace,r=e.media;if(n&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}const i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${$e(i)}`),this.detachedData=i}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var n,r;if(e.media===t)return;let i=null;const s=this.hls,o=e!==s,c=o&&e.interstitial.appendInPlace,u=(n=this.detachedData)==null?void 0:n.mediaSource;let f;if(s.media)c&&(i=s.transferMedia(),this.detachedData=i),f="Primary";else if(u){const b=this.getBufferingPlayer();b?(i=b.transferMedia(),f=`${b}`):f="detached MediaSource"}else f="detached media";if(!i){if(u)i=this.detachedData,this.log(`using detachedData: MediaSource ${$e(i)}`);else if(!this.detachedData||s.media===t){const b=this.playerQueue;b.length>1&&b.forEach(M=>{if(o&&M.interstitial.appendInPlace!==c){const O=M.interstitial;this.clearInterstitial(M.interstitial,null),O.appendInPlace=!1,O.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${O}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const d=i&&"mediaSource"in i&&((r=i.mediaSource)==null?void 0:r.readyState)!=="closed",g=d&&i?i:t;this.log(`${d?"transfering MediaSource":"attaching media"} to ${o?e:"Primary"} from ${f} (media.currentTime: ${t.currentTime})`);const E=this.schedule;if(g===i&&E){const b=o&&e.assetId===E.assetIdAtEnd;g.overrides={duration:E.duration,endOfStream:!o||b,cueRemoval:!o}}e.attachMedia(g)}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 n=this.timelinePos,r=this.effectivePlayingItem;if(n===-1){const i=this.hls.startPosition;if(this.log(js("checkStart",i)),this.timelinePos=i,t.length&&t[0].cue.pre){const s=e.findEventIndex(t[0].identifier);this.setSchedulePosition(s)}else if(i>=0||!this.primaryLive){const s=this.timelinePos=i>0?i:0,o=e.findItemIndexAtTime(s);this.setSchedulePosition(o)}}else if(r&&!this.playingItem){const i=e.findItemIndex(r);this.setSchedulePosition(i)}}advanceAssetBuffering(e,t){const n=e.event,r=n.findAssetIndex(t),i=Ra(n,r);if(!n.isAssetPastPlayoutLimit(i))this.bufferedToEvent(e,i);else if(this.schedule){var s;const o=(s=this.schedule.items)==null?void 0:s[this.findItemIndex(e)+1];o&&this.bufferedToItem(o)}}advanceAfterAssetEnded(e,t,n){const r=Ra(e,n);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){const i=this.schedule.items;if(i){const s=t+1,o=i.length;if(s>=o){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.log(js("advanceAfterAssetEnded",c)),this.timelinePos=c,e.appendInPlace&&this.advanceInPlace(c),this.checkBuffer(this.bufferedPos<c)),this.setSchedulePosition(s)}}}else{if(e.appendInPlace){const i=e.assetList[r];i&&this.advanceInPlace(i.timelineStart)}this.setSchedulePosition(t,r)}}setScheduleToAssetAtTime(e,t){const n=this.schedule;if(!n)return;const r=t.parentIdentifier,i=n.getEvent(r);if(i){const s=n.findEventIndex(r),o=n.findAssetIndex(i,e);this.advanceAfterAssetEnded(i,s,o-1)}}setSchedulePosition(e,t){var n;const r=(n=this.schedule)==null?void 0:n.items;if(!r||this.playbackDisabled)return;const i=e>=0?r[e]:null;this.log(`setSchedulePosition ${e}, ${t} (${i&&Ti(i)}) pos: ${this.timelinePos}`);const s=this.waitingItem||this.playingItem,o=this.playingLastItem;if(this.isInterstitial(s)){const f=s.event,d=this.playingAsset,g=d==null?void 0:d.identifier,E=g?this.getAssetPlayer(g):null;if(E&&g&&(!this.eventItemsMatch(s,i)||t!==void 0&&g!==f.assetList[t].identifier)){var c;const b=f.findAssetIndex(d);if(this.log(`INTERSTITIAL_ASSET_ENDED ${b+1}/${f.assetList.length} ${ds(d)}`),this.endedAsset=d,this.playingAsset=null,this.hls.trigger(p.INTERSTITIAL_ASSET_ENDED,{asset:d,assetListIndex:b,event:f,schedule:r.slice(0),scheduleIndex:e,player:E}),s!==this.playingItem){this.itemsMatch(s,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(f,this.findItemIndex(this.playingItem),b);return}this.retreiveMediaSource(g,i),E.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&E.detachMedia()}if(!this.eventItemsMatch(s,i)&&(this.endedItem=s,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${f} ${Ti(s)}`),f.hasPlayed=!0,this.hls.trigger(p.INTERSTITIAL_ENDED,{event:f,schedule:r.slice(0),scheduleIndex:e}),f.cue.once)){var u;this.updateSchedule();const b=(u=this.schedule)==null?void 0:u.items;if(i&&b){const M=this.findItemIndex(i);this.advanceSchedule(M,b,t,s,o)}return}}this.advanceSchedule(e,r,t,s,o)}advanceSchedule(e,t,n,r,i){const s=this.schedule;if(!s)return;const o=t[e]||null,c=this.primaryMedia,u=this.playerQueue;if(u.length&&u.forEach(f=>{const d=f.interstitial,g=s.findEventIndex(d.identifier);(g<e||g>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(n===void 0){n=s.findAssetIndex(f,this.timelinePos);const b=Ra(f,n-1);if(f.isAssetPastPlayoutLimit(b)||f.appendInPlace&&this.timelinePos===o.end){this.advanceAfterAssetEnded(f,e,n);return}n=b}const d=this.waitingItem;this.assetsBuffered(o,c)||this.setBufferingItem(o);let g=this.preloadAssets(f,n);if(this.eventItemsMatch(o,d||r)||(this.waitingItem=o,this.log(`INTERSTITIAL_STARTED ${Ti(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 E=f.assetList[n];if(!E){this.advanceAfterAssetEnded(f,e,n||0);return}if(g||(g=this.getAssetPlayer(E.identifier)),g===null||g.destroyed){const b=f.assetList.length;this.warn(`asset ${n+1}/${b} player destroyed ${f}`),g=this.createAssetPlayer(f,E,n),g.loadSource()}if(!this.eventItemsMatch(o,this.bufferingItem)&&f.appendInPlace&&this.isAssetBuffered(E))return;this.startAssetPlayer(g,n,t,e,c),this.shouldPlay&&zo(g.media)}else o?(this.resumePrimary(o,e,r),this.shouldPlay&&zo(this.hls.media)):i&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(s.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,n){var r,i;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${Ti(e)}`),!((r=this.detachedData)!=null&&r.mediaSource)){let o=this.timelinePos;(o<e.start||o>=e.end)&&(o=this.getPrimaryResumption(e,t),this.log(js("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)}if(!n)return;const s=(i=this.schedule)==null?void 0:i.items;s&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Ti(e)}`),this.hls.trigger(p.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(e,t){const n=e.start;if(this.primaryLive){const r=this.primaryDetails;if(t===0)return this.hls.startPosition;if(r&&(n<r.fragmentStart||n>r.edge))return this.hls.liveSyncPosition||-1}return n}isAssetBuffered(e){const t=this.getAssetPlayer(e.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:In.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,n){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const r=this.primaryMedia;if(!r)return;const i=this.hls;i.media?this.checkBuffer():(this.transferMediaTo(i,r),n&&this.startLoadingPrimaryAt(e,n)),n||(this.log(js("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,n))}startLoadingPrimaryAt(e,t){var n;const r=this.hls;!r.loadingEnabled||!r.media||Math.abs((((n=r.mainForwardBufferInfo)==null?void 0:n.start)||r.media.currentTime)-e)>.5?r.startLoad(e,t):r.bufferingEnabled||r.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 n=this.hls.levels[t.level];if(!n.details)return;const r=y(y({},this.mediaSelection||this.altSelection),{},{main:n});this.mediaSelection=r,this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,t){const n=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=y(y({},this.altSelection),{},{audio:n});return}const i=y(y({},r),{},{audio:n});this.mediaSelection=i}onSubtitleTrackUpdated(e,t){const n=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=y(y({},this.altSelection),{},{subtitles:n});return}const i=y(y({},r),{},{subtitles:n});this.mediaSelection=i}onAudioTrackSwitching(e,t){const n=Rt(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setAudioOption(t)||r.setAudioOption(n)))}onSubtitleTrackSwitch(e,t){const n=Rt(t);this.playerQueue.forEach(({hls:r})=>r&&(r.setSubtitleOption(t)||t.id!==-1&&r.setSubtitleOption(n)))}onBufferCodecs(e,t){const n=t.tracks;n&&(this.requiredTracks=n)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){const n=this.playingItem;if(n&&!this.itemsMatch(n,this.bufferingItem)&&!this.isInterstitial(n)){const r=this.timelinePos;this.bufferedPos=r,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let r=0;r<t.length;r++){const i=t[r];if(i.cue.post){var n;const s=this.schedule.findEventIndex(i.identifier),o=(n=this.schedule.items)==null?void 0:n[s];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 n=this.findItemIndex(t);this.setSchedulePosition(n+1)}else this.shouldPlay=!1}updateItem(e,t){var n;const r=(n=this.schedule)==null?void 0:n.items;if(e&&r){const i=this.findItemIndex(e,t);return r[i]||null}return null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((i,s)=>{e.event.isAssetPastPlayoutLimit(s)&&this.clearAssetPlayer(i.identifier,null)});const n=e.end+.25,r=In.bufferInfo(this.primaryMedia,n,0);(r.end>n||(r.nextStart||0)>n)&&(this.log(`trim buffered interstitial ${Ti(e)} (was ${Ti(t)})`),this.attachPrimary(n,null,!0),this.flushFrontBuffer(n))}}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 n;return!!t&&(e===t||e.event.identifier===((n=t.event)==null?void 0:n.identifier))}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(e=!1){var t;const n=this.mediaSelection;n&&((t=this.schedule)==null||t.updateSchedule(n,[],e))}checkBuffer(e){var t;const n=(t=this.schedule)==null?void 0:t.items;if(!n)return;const r=In.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,n,e)}updateBufferedPos(e,t,n){const r=this.schedule,i=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(t.length===1&&this.itemsMatch(t[0],i)){this.bufferedPos=e;return}const s=this.playingItem,o=this.findItemIndex(s);let c=r.findItemIndexAtTime(e);if(this.bufferedPos<e){var u;const f=this.findItemIndex(i),d=Math.min(f+1,t.length-1),g=t[d];if((c===-1&&i&&e>=i.end||(u=g.event)!=null&&u.appendInPlace&&e+.01>=g.start)&&(c=d),this.isInterstitial(i)){const E=i.event;if(d-o>1&&E.appendInPlace===!1||E.assetList.length===0&&E.assetListLoader)return}if(this.bufferedPos=e,c>f&&c>o)this.bufferedToItem(g);else{const E=this.primaryDetails;this.primaryLive&&E&&e>E.edge-E.targetduration&&g.start<E.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(g)&&this.preloadAssets(g.event,0)}}else n&&s&&!this.itemsMatch(s,i)&&(c===o?this.bufferedToItem(s):c===o+1&&this.bufferedToItem(t[c]))}assetsBuffered(e,t){return e.event.assetList.length===0?!1:!e.event.assetList.some(r=>{const i=this.getAssetPlayer(r.identifier);return!(i!=null&&i.bufferedInPlaceToEnd(t))})}setBufferingItem(e){const t=this.bufferingItem,n=this.schedule;if(!this.itemsMatch(e,t)&&n){const{items:r,events:i}=n;if(!r||!i)return t;const s=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 ${Ti(e)}`+(t?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(s){const u=n.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((f,d)=>{const g=this.getAssetPlayer(f.identifier);g&&(d===u&&g.loadSource(),g.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(u=>u.pauseBuffering());this.hls.trigger(p.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:i.slice(0),schedule:r.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 n=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(n!==null){this.bufferingAsset=null;const r=this.detachedData;r?r.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const t=this.findItemIndex(e),n=this.getPrimaryResumption(e,t);this.startLoadingPrimaryAt(n)}bufferedToEvent(e,t){const n=e.event,r=n.assetList.length===0&&!n.assetListLoader,i=n.cue.once;if(r||!i){const s=this.preloadAssets(n,t);if(s!=null&&s.interstitial.appendInPlace){const o=this.primaryMedia;o&&this.bufferAssetPlayer(s,o)}}}preloadAssets(e,t){const n=e.assetUrl,r=e.assetList.length,i=r===0&&!e.assetListLoader,s=e.cue.once;if(i){const c=e.timelineStart;if(e.appendInPlace){var o;const g=this.playingItem;!this.isInterstitial(g)&&(g==null||(o=g.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 g=f-c;g>0&&(u=Math.round(g*1e3)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${n?1:r} ${e}${u?` live-start: ${f} start-offset: ${u}`:""}`),n)return this.createAsset(e,0,0,c,e.duration,n);const d=this.assetListLoader.loadAssetList(e,u);d&&(e.assetListLoader=d)}else if(!s&&r){for(let u=t;u<r;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(r=>{this.hls.trigger(p.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:r})})}getAssetPlayerQueueIndex(e){const t=this.playerQueue;for(let n=0;n<t.length;n++)if(e===t[n].assetId)return n;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 n=0;n<e.length;n++)if(e[n].media===t)return e[n]}return null}createAsset(e,t,n,r,i,s){const o={parentIdentifier:e.identifier,identifier:Pc(e,s,t),duration:i,startOffset:n,timelineStart:r,uri:s};return this.createAssetPlayer(e,o,t)}createAssetPlayer(e,t,n){const r=this.hls,i=r.userConfig;let s=i.videoPreference;const o=r.loadLevelObj||r.levels[r.currentLevel];(s||o)&&(s=h({},s),o.videoCodec&&(s.videoCodec=o.videoCodec),o.videoRange&&(s.allowedVideoRanges=[o.videoRange]));const c=r.audioTracks[r.audioTrack],u=r.subtitleTracks[r.subtitleTrack];let f=0;if(this.primaryLive||e.appendInPlace){const Ke=this.timelinePos-t.timelineStart;if(Ke>1){const We=t.duration;We&&Ke<We&&(f=Ke)}}const d=t.identifier,g=y(y({},i),{},{maxMaxBufferLength:Math.min(180,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:f,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:s,audioPreference:c||i.audioPreference,subtitlePreference:u||i.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(g.timelineOffset=t.timelineStart));const E=g.cmcd;E!=null&&E.sessionId&&E.contentId&&(g.cmcd=h({},E,{contentId:Rs(t.uri)})),this.getAssetPlayer(d)&&this.warn(`Duplicate date range identifier ${e} and asset ${d}`);const b=new Fc(this.HlsPlayerClass,g,e,t);this.playerQueue.push(b),e.assetList[n]=t;let M=!0;const O=Ke=>{if(Ke.live){var We;const ot=new Error(`Interstitials MUST be VOD assets ${e}`),at={fatal:!0,type:ue.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:ot},Je=((We=this.schedule)==null?void 0:We.findEventIndex(e.identifier))||-1;this.handleAssetItemError(at,e,Je,n,ot.message);return}const mt=Ke.edge-Ke.fragmentStart,He=t.duration;(M||He===null||mt>He)&&(M=!1,this.log(`Interstitial asset "${d}" duration change ${He} > ${mt}`),t.duration=mt,this.updateSchedule())};b.on(p.LEVEL_UPDATED,(Ke,{details:We})=>O(We)),b.on(p.LEVEL_PTS_UPDATED,(Ke,{details:We})=>O(We)),b.on(p.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const ae=(Ke,We)=>{const mt=this.getAssetPlayer(d);if(mt&&We.tracks){mt.off(p.BUFFER_CODECS,ae),mt.tracks=We.tracks;const He=this.primaryMedia;this.bufferingAsset===mt.assetItem&&He&&!mt.media&&this.bufferAssetPlayer(mt,He)}};b.on(p.BUFFER_CODECS,ae);const he=()=>{var Ke;const We=this.getAssetPlayer(d);if(this.log(`buffered to end of asset ${We}`),!We||!this.schedule)return;const mt=this.schedule.findEventIndex(e.identifier),He=(Ke=this.schedule.items)==null?void 0:Ke[mt];this.isInterstitial(He)&&this.advanceAssetBuffering(He,t)};b.on(p.BUFFERED_TO_END,he);const _e=Ke=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;const mt=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,mt,Ke)};return b.once(p.MEDIA_ENDED,_e(n)),b.once(p.PLAYOUT_LIMIT_REACHED,_e(1/0)),b.on(p.ERROR,(Ke,We)=>{if(!this.schedule)return;const mt=this.getAssetPlayer(d);if(We.details===$.BUFFER_STALLED_ERROR){if(mt!=null&&mt.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(We,e,this.schedule.findEventIndex(e.identifier),n,`Asset player error ${We.error} ${e}`)}),b.on(p.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;const We=new Error(`Asset player destroyed unexpectedly ${d}`),mt={fatal:!0,type:ue.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:We};this.handleAssetItemError(mt,e,this.schedule.findEventIndex(e.identifier),n,We.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${ds(t)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:n,event:e,player:b}),b}clearInterstitial(e,t){e.assetList.forEach(n=>{this.clearAssetPlayer(n.identifier,t)}),e.reset()}resetAssetPlayer(e){const t=this.getAssetPlayerQueueIndex(e);if(t!==-1){this.log(`reset asset player "${e}" after error`);const n=this.playerQueue[t];this.transferMediaFromPlayer(n,null),n.resetDetails()}}clearAssetPlayer(e,t){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){const r=this.playerQueue[n];this.log(`clear ${r} toSegment: ${t&&Ti(t)}`),this.transferMediaFromPlayer(r,t),this.playerQueue.splice(n,1),r.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,t,n,r,i){const{interstitial:s,assetItem:o,assetId:c}=e,u=s.assetList.length,f=this.playingAsset;this.endedAsset=null,this.playingAsset=o,(!f||f.identifier!==c)&&(f&&(this.clearAssetPlayer(f.identifier,n[r]),delete f.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${u} ${ds(o)}`),this.hls.trigger(p.INTERSTITIAL_ASSET_STARTED,{asset:o,assetListIndex:t,event:s,schedule:n.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,i)}bufferAssetPlayer(e,t){var n,r;if(!this.schedule)return;const{interstitial:i,assetItem:s}=e,o=this.schedule.findEventIndex(i.identifier),c=(n=this.schedule.items)==null?void 0:n[o];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=s;const u=this.getBufferingPlayer();if(u===e)return;const f=i.appendInPlace;if(f&&(u==null?void 0:u.interstitial.appendInPlace)===!1)return;const d=(u==null?void 0:u.tracks)||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(f&&s!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(d&&!Pe(d,e.tracks)){const g=new Error(`Asset ${ds(s)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),E={fatal:!0,type:ue.OTHER_ERROR,details:$.INTERSTITIAL_ASSET_ITEM_ERROR,error:g},b=i.findAssetIndex(s);this.handleAssetItemError(E,i,o,b,g.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){const t=this.schedule,n=this.primaryMedia;if(!t||!n)return;const r=n.currentTime,i=t.findAssetIndex(e,r),s=e.assetList[i];if(s){const o=this.getAssetPlayer(s.identifier);if(o){const c=o.currentTime||r-s.timelineStart,u=o.duration-c;if(this.warn(`Stalled at ${c} of ${c+u} in ${o} ${e} (media.currentTime: ${r})`),c&&(u/n.playbackRate<.5||o.bufferedInPlaceToEnd(n))&&o.hls){const f=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,f,i)}}}}advanceInPlace(e){const t=this.primaryMedia;t&&t.currentTime<e&&(t.currentTime=e)}handleAssetItemError(e,t,n,r,i){if(e.details===$.BUFFER_STALLED_ERROR)return;const s=t.assetList[r]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${s&&ds(s)} ${e.error}`),!this.schedule)return;const o=(s==null?void 0:s.identifier)||"",c=this.getAssetPlayerQueueIndex(o),u=this.playerQueue[c]||null,f=this.schedule.items,d=h({},e,{fatal:!1,errorAction:bt(!0),asset:s,assetListIndex:r,event:t,schedule:f,scheduleIndex:n,player:u});if(this.hls.trigger(p.INTERSTITIAL_ASSET_ERROR,d),!e.fatal)return;const g=this.playingAsset,E=this.bufferingAsset,b=new Error(i);if(s&&(this.clearAssetPlayer(o,null),s.error=b),!t.assetList.some(M=>!M.error))t.error=b;else for(let M=r;M<t.assetList.length;M++)this.resetAssetPlayer(t.assetList[M].identifier);this.updateSchedule(!0),t.error?this.primaryFallback(t):g&&g.identifier===o?this.advanceAfterAssetEnded(t,n,r):E&&E.identifier===o&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,E)}primaryFallback(e){const t=e.timelineStart,n=this.effectivePlayingItem;if(n){this.log(`Fallback to primary from event "${e.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${Ti(n)} error: ${e.error}`);let r=this.timelinePos;r===-1&&(r=this.hls.startPosition);const i=this.updateItem(n,r);if(this.itemsMatch(n,i)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t)),!this.schedule)return;const s=this.schedule.findItemIndexAtTime(r);this.setSchedulePosition(s)}else this.checkStart()}onAssetListLoaded(e,t){var n,r;const i=t.event,s=i.identifier,o=t.assetListResponse.ASSETS;if(!((n=this.schedule)!=null&&n.hasEvent(s)))return;const c=i.timelineStart,u=i.duration;let f=0;o.forEach((M,O)=>{const ae=parseFloat(M.DURATION);this.createAsset(i,O,f,c+f,ae,M.URI),f+=ae}),i.duration=f,this.log(`Loaded asset-list with duration: ${f} (was: ${u}) ${i}`);const d=this.waitingItem,g=(d==null?void 0:d.event.identifier)===s;this.updateSchedule();const E=(r=this.bufferingItem)==null?void 0:r.event;if(g){var b;const M=this.schedule.findEventIndex(s),O=(b=this.schedule.items)==null?void 0:b[M];if(O){if(!this.playingItem&&this.timelinePos>O.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==M){i.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${i}`),this.updateSchedule(!0),this.primaryFallback(i);return}this.setBufferingItem(O)}this.setSchedulePosition(M)}else if((E==null?void 0:E.identifier)===s){const M=i.assetList[0];if(M){const O=this.getAssetPlayer(M.identifier);if(E.appendInPlace){const ae=this.primaryMedia;O&&ae&&this.bufferAssetPlayer(O,ae)}else O&&O.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case $.ASSET_LIST_PARSING_ERROR:case $.ASSET_LIST_LOAD_ERROR:case $.ASSET_LIST_LOAD_TIMEOUT:{const n=t.interstitial;n&&(this.updateSchedule(!0),this.primaryFallback(n));break}case $.BUFFER_STALLED_ERROR:{const n=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(n)&&n.event.appendInPlace){this.handleInPlaceStall(n.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const Wo=500;class $c extends na{constructor(e,t,n){super(e,t,n,"subtitle-stream-controller",le.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=Ot.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:n,success:r}=t;if(this.fragContextChanged(n)||(Oe(n)&&(this.fragPrevious=n),this.state=Ot.IDLE),!r)return;const i=this.tracksBuffered[this.currentTrackId];if(!i)return;let s;const o=n.start;for(let u=0;u<i.length;u++)if(o>=i[u].start&&o<=i[u].end){s=i[u];break}const c=n.start+n.duration;s?s.end=c:(s={start:o,end:c},i.push(s)),this.fragmentTracker.fragBuffered(n),this.fragBufferedComplete(n,null),this.media&&this.tick()}onBufferFlushing(e,t){const{startOffset:n,endOffset:r}=t;if(n===0&&r!==Number.POSITIVE_INFINITY){const i=r-1;if(i<=0)return;t.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach(s=>{for(let o=0;o<s.length;){if(s[o].end<=i){s.shift();continue}else if(s[o].start<i)s[o].start=i;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(n,i,le.SUBTITLE)}}onError(e,t){const n=t.frag;(n==null?void 0:n.type)===le.SUBTITLE&&(t.details===$.FRAG_GAP&&this.fragmentTracker.fragBuffered(n,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ot.STOPPED&&(this.state=Ot.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&bo(this.levels,t)){this.levels=t.map(n=>new Pt(n));return}this.tracksBuffered=[],this.levels=t.map(n=>{const r=new Pt(n);return this.tracksBuffered[r.id]=[],r}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,le.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var n;if(this.currentTrackId=t.id,!((n=this.levels)!=null&&n.length)||this.currentTrackId===-1){this.clearInterval();return}const r=this.levels[this.currentTrackId];r!=null&&r.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,r&&this.state!==Ot.STOPPED&&this.setInterval(Wo)}onSubtitleTrackLoaded(e,t){var n;const{currentTrackId:r,levels:i}=this,{details:s,id:o}=t;if(!i){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const c=i[o];if(o>=i.length||!c)return;this.log(`Subtitle track ${o} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let u=0;if(s.live||(n=c.details)!=null&&n.live){if(s.deltaUpdateFailed)return;const d=this.mainDetails;if(!d){this.startFragRequested=!1;return}const g=d.fragments[0];if(!c.details)s.hasProgramDateTime&&d.hasProgramDateTime?(Os(s,d),u=s.fragmentStart):g&&(u=g.start,ys(s,u));else{var f;u=this.alignPlaylists(s,c.details,(f=this.levelLastLoaded)==null?void 0:f.details),u===0&&g&&(u=g.start,ys(s,u))}d&&!this.startFragRequested&&this.setStartPosition(d,u)}c.details=s,this.levelLastLoaded=c,o===r&&(this.hls.trigger(p.SUBTITLE_TRACK_UPDATED,{details:s,id:o,groupId:t.groupId}),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===Ot.IDLE&&(Jt(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:n}=e,r=t.decryptdata,i=this.hls;if(!this.fragContextChanged(t)&&n&&n.byteLength>0&&r!=null&&r.key&&r.iv&&Dn(r.method)){const s=performance.now();this.decrypter.decrypt(new Uint8Array(n),r.key.buffer,r.iv.buffer,Un(r.method)).catch(o=>{throw i.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const c=performance.now();i.trigger(p.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:s,tdecrypt:c}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=Ot.IDLE})}}doTick(){if(!this.media){this.state=Ot.IDLE;return}if(this.state===Ot.IDLE){const{currentTrackId:e,levels:t}=this,n=t==null?void 0:t[e];if(!n||!t.length||!n.details||this.waitForLive(n))return;const{config:r}=this,i=this.getLoadPosition(),s=In.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,r.maxBufferHole),{end:o,len:c}=s,u=n.details,f=this.hls.maxBufferLength+u.levelTargetDuration;if(c>f)return;const d=u.fragments,g=d.length,E=u.edge;let b=null;const M=this.fragPrevious;if(o<E){const he=r.maxFragLookUpTolerance,_e=o>E-he?0:he;b=Jt(M,d,Math.max(d[0].start,o),_e),!b&&M&&M.start<d[0].start&&(b=d[0])}else b=d[g-1];if(b=this.filterReplacedPrimary(b,n.details),!b)return;const O=b.sn-u.startSN,ae=d[O-1];if(ae&&ae.cc===b.cc&&this.fragmentTracker.getState(ae)===$t.NOT_LOADED&&(b=ae),this.fragmentTracker.getState(b)===$t.NOT_LOADED){const he=this.mapToInitFragWhenRequired(b);he&&this.loadFragment(he,n,o)}}}loadFragment(e,t,n){Oe(e)?super.loadFragment(e,t,n):this._loadInitSegment(e,t)}get mediaBufferTimeRanges(){return new Kc(this.tracksBuffered[this.currentTrackId]||[])}}class Kc{constructor(e){this.buffered=void 0;const t=(n,r,i)=>{if(r=r>>>0,r>i-1)throw new DOMException(`Failed to execute '${n}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${i})`);return e[r][n]};this.buffered={get length(){return e.length},end(n){return t("end",n,e.length)},start(n){return t("start",n,e.length)}}}}const Zc={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},Ho=a=>String.fromCharCode(Zc[a]||a),wi=15,Fi=100,Gc={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Vc={17:2,18:4,21:6,22:8,23:10,19:13,20:15},zc={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},Hc=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class jc{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const n=typeof t=="function"?t():t;X.log(`${this.time} [${e}] ${n}`)}}}const Xi=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].toString(16));return t};class jo{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 n=0;n<t.length;n++){const r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}}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 jo}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 jo,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Fi;t++)this.chars.push(new Yc);this.logger=e}equals(e){for(let t=0;t<Fi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Fi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Fi;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>Fi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Fi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let n=this.pos+1;n<t+1;n++)this.chars[n].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=Ho(e);if(this.pos>=Fi){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<Fi;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 n=0;n<Fi;n++){const r=this.chars[n].uchar;r!==" "&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class Ca{constructor(e){this.rows=[],this.currRow=wi-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<wi;t++)this.rows.push(new Xc(e));this.logger=e}reset(){for(let e=0;e<wi;e++)this.rows[e].clear();this.currRow=wi-1}equals(e){let t=!0;for(let n=0;n<wi;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t}copy(e){for(let t=0;t<wi;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<wi;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 = "+$e(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<wi;o++)this.rows[o].clear();const i=this.currRow+1-this.nrRollUpRows,s=this.lastOutputScreen;if(s){const o=s.rows[i].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(s.rows[i+u])}}this.currRow=t;const n=this.rows[this.currRow];if(e.indent!==null){const i=e.indent,s=Math.max(i-1,0);n.setCursor(e.indent),e.color=n.chars[s].penState.foreground}const r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+$e(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 n="",r=-1;for(let i=0;i<wi;i++){const s=this.rows[i].getTextString();s&&(r=i+1,e?t.push("Row "+r+": '"+s+"'"):t.push(s.trim()))}return t.length>0&&(e?n="["+t.join(" | ")+"]":n=t.join(`
`)),n}getTextAndFormat(){return this.rows}}class Yo{constructor(e,t,n){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 Ca(n),this.nonDisplayedMemory=new Ca(n),this.lastOutputScreen=new Ca(n),this.currRollUpRow=this.displayedMemory.rows[wi-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[wi-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 n=0;n<e.length;n++)this.writeScreen.insertChar(e[n]);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 n=Math.floor(e/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=r[n]}this.logger.log(2,"MIDROW: "+$e(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,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Jc(),this.logger=void 0;const r=this.logger=new jc;this.channels=[null,new Yo(e,t,r),new Yo(e+1,n,r)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let n=0;n<t.length;n+=2){const r=t[n]&127,i=t[n+1]&127;let s=!1,o=null;if(r===0&&i===0)continue;this.logger.log(3,()=>"["+Xi([t[n],t[n+1]])+"] -> ("+Xi([r,i])+")");const c=this.cmdHistory;if(r>=16&&r<=31){if(Qc(r,i,c)){Ys(null,null,c),this.logger.log(3,()=>"Repeated command ("+Xi([r,i])+") is dropped");continue}Ys(r,i,this.cmdHistory),s=this.parseCmd(r,i),s||(s=this.parseMidrow(r,i)),s||(s=this.parsePAC(r,i)),s||(s=this.parseBackgroundAttributes(r,i))}else Ys(null,null,c);if(!s&&(o=this.parseChars(r,i),o)){const f=this.currentChannel;f&&f>0?this.channels[f].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!s&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+Xi([r,i])+" orig: "+Xi([t[n],t[n+1]]))}}parseCmd(e,t){const n=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=33&&t<=35;if(!(n||r))return!1;const i=e===20||e===21||e===23?1:2,s=this.channels[i];return e===20||e===21||e===28||e===29?t===32?s.ccRCL():t===33?s.ccBS():t===34?s.ccAOF():t===35?s.ccAON():t===36?s.ccDER():t===37?s.ccRU(2):t===38?s.ccRU(3):t===39?s.ccRU(4):t===40?s.ccFON():t===41?s.ccRDC():t===42?s.ccTR():t===43?s.ccRTD():t===44?s.ccEDM():t===45?s.ccCR():t===46?s.ccENM():t===47&&s.ccEOC():s.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let n=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?n=1:n=2,n!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const r=this.channels[n];return r?(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+Xi([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let n;const r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,i=(e===16||e===24)&&t>=64&&t<=95;if(!(r||i))return!1;const s=e<=23?1:2;t>=64&&t<=95?n=s===1?Gc[e]:zc[e]:n=s===1?Vc[e]:Wc[e];const o=this.channels[s];return o?(o.setPAC(this.interpretPAC(n,t)),this.currentChannel=s,!0):!1}interpretPAC(e,t){let n;const r={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?n=t-96:n=t-64,r.underline=(n&1)===1,n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=Math.floor((n-16)/2)*4,r}parseChars(e,t){let n,r=null,i=null;if(e>=25?(n=2,i=e-8):(n=1,i=e),i>=17&&i<=19){let s;i===17?s=t+80:i===18?s=t+112:s=t+144,this.logger.log(2,()=>"Special char '"+Ho(s)+"' in channel "+n),r=[s]}else e>=32&&e<=127&&(r=t===0?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes = "+Xi(r).join(",")),r}parseBackgroundAttributes(e,t){const n=(e===16||e===24)&&t>=32&&t<=47,r=(e===23||e===31)&&t>=45&&t<=47;if(!(n||r))return!1;let i;const s={};e===16||e===24?(i=Math.floor((t-32)/2),s.background=Hc[i],t%2===1&&(s.background=s.background+"_semi")):t===45?s.background="transparent":(s.foreground="black",t===47&&(s.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(s),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}Ys(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const n=this.channels[t];n&&n.cueSplitAtTime(e)}}}function Ys(a,e,t){t.a=a,t.b=e}function Qc(a,e,t){return t.a===a&&t.b===e}function Jc(){return{a:null,b:null}}var Ia=function(){if(qn!=null&&qn.VTTCue)return self.VTTCue;const a=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,c){if(typeof c!="string"||!Array.isArray(o))return!1;const u=c.toLowerCase();return~o.indexOf(u)?u:!1}function n(o){return t(a,o)}function r(o){return t(e,o)}function i(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 s(o,c,u){const f=this,d={enumerable:!0};f.hasBeenReset=!1;let g="",E=!1,b=o,M=c,O=u,ae=null,he="",_e=!0,Ke="auto",We="start",mt=50,He="middle",ot=50,at="middle";Object.defineProperty(f,"id",i({},d,{get:function(){return g},set:function(Je){g=""+Je}})),Object.defineProperty(f,"pauseOnExit",i({},d,{get:function(){return E},set:function(Je){E=!!Je}})),Object.defineProperty(f,"startTime",i({},d,{get:function(){return b},set:function(Je){if(typeof Je!="number")throw new TypeError("Start time must be set to a number.");b=Je,this.hasBeenReset=!0}})),Object.defineProperty(f,"endTime",i({},d,{get:function(){return M},set:function(Je){if(typeof Je!="number")throw new TypeError("End time must be set to a number.");M=Je,this.hasBeenReset=!0}})),Object.defineProperty(f,"text",i({},d,{get:function(){return O},set:function(Je){O=""+Je,this.hasBeenReset=!0}})),Object.defineProperty(f,"region",i({},d,{get:function(){return ae},set:function(Je){ae=Je,this.hasBeenReset=!0}})),Object.defineProperty(f,"vertical",i({},d,{get:function(){return he},set:function(Je){const Nt=n(Je);if(Nt===!1)throw new SyntaxError("An invalid or illegal string was specified.");he=Nt,this.hasBeenReset=!0}})),Object.defineProperty(f,"snapToLines",i({},d,{get:function(){return _e},set:function(Je){_e=!!Je,this.hasBeenReset=!0}})),Object.defineProperty(f,"line",i({},d,{get:function(){return Ke},set:function(Je){if(typeof Je!="number"&&Je!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Ke=Je,this.hasBeenReset=!0}})),Object.defineProperty(f,"lineAlign",i({},d,{get:function(){return We},set:function(Je){const Nt=r(Je);if(!Nt)throw new SyntaxError("An invalid or illegal string was specified.");We=Nt,this.hasBeenReset=!0}})),Object.defineProperty(f,"position",i({},d,{get:function(){return mt},set:function(Je){if(Je<0||Je>100)throw new Error("Position must be between 0 and 100.");mt=Je,this.hasBeenReset=!0}})),Object.defineProperty(f,"positionAlign",i({},d,{get:function(){return He},set:function(Je){const Nt=r(Je);if(!Nt)throw new SyntaxError("An invalid or illegal string was specified.");He=Nt,this.hasBeenReset=!0}})),Object.defineProperty(f,"size",i({},d,{get:function(){return ot},set:function(Je){if(Je<0||Je>100)throw new Error("Size must be between 0 and 100.");ot=Je,this.hasBeenReset=!0}})),Object.defineProperty(f,"align",i({},d,{get:function(){return at},set:function(Je){const Nt=r(Je);if(!Nt)throw new SyntaxError("An invalid or illegal string was specified.");at=Nt,this.hasBeenReset=!0}})),f.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class qc{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(n,r,i,s){return(n|0)*3600+(r|0)*60+(i|0)+parseFloat(s||0)}const t=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class ef{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,n){for(let r=0;r<n.length;++r)if(t===n[r]){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 n=parseFloat(t);if(n>=0&&n<=100)return this.set(e,n),!0}return!1}}function Jo(a,e,t,n){const r=n?a.split(n):[a];for(const i in r){if(typeof r[i]!="string")continue;const s=r[i].split(t);if(s.length!==2)continue;const o=s[0],c=s[1];e(o,c)}}const La=new Ia(0,0,""),Xs=La.align==="middle"?"middle":"center";function tf(a,e,t){const n=a;function r(){const o=Qo(a);if(o===null)throw new Error("Malformed timestamp: "+n);return a=a.replace(/^[^\sa-zA-Z-]+/,""),o}function i(o,c){const u=new ef;Jo(o,function(g,E){let b;switch(g){case"region":for(let M=t.length-1;M>=0;M--)if(t[M].id===E){u.set(g,t[M].region);break}break;case"vertical":u.alt(g,E,["rl","lr"]);break;case"line":b=E.split(","),u.integer(g,b[0]),u.percent(g,b[0])&&u.set("snapToLines",!1),u.alt(g,b[0],["auto"]),b.length===2&&u.alt("lineAlign",b[1],["start",Xs,"end"]);break;case"position":b=E.split(","),u.percent(g,b[0]),b.length===2&&u.alt("positionAlign",b[1],["start",Xs,"end","line-left","line-right","auto"]);break;case"size":u.percent(g,E);break;case"align":u.alt(g,E,["start",Xs,"end","left","right"]);break}},/:/,/\s/),c.region=u.get("region",null),c.vertical=u.get("vertical","");let f=u.get("line","auto");f==="auto"&&La.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",Xs);let d=u.get("position","auto");d==="auto"&&La.position===50&&(d=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=d}function s(){a=a.replace(/^\s+/,"")}if(s(),e.startTime=r(),s(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+n);a=a.slice(3),s(),e.endTime=r(),s(),i(a,e)}function qo(a){return a.replace(/<br(?: \/)?>/gi,`
`)}class nf{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new qc,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 n(){let i=t.buffer,s=0;for(i=qo(i);s<i.length&&i[s]!=="\r"&&i[s]!==`
`;)++s;const o=i.slice(0,s);return i[s]==="\r"&&++s,i[s]===`
`&&++s,t.buffer=i.slice(s),o}function r(i){Jo(i,function(s,o){},/:/)}try{let i="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;i=n();const o=i.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let s=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:i=n(),t.state){case"HEADER":/:/.test(i)?r(i):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;if(t.cue=new Ia(0,0,""),t.state="CUE",i.indexOf("-->")===-1){t.cue.id=i;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{tf(i,t.cue,t.regionList)}catch(o){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=i.indexOf("-->")!==-1;if(!i||o&&(s=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=`
`),t.cue.text+=i}continue;case"BADCUE":i||(t.state="ID")}}}catch(i){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 rf=/\r\n|\n\r|\n|\r/g,ka=function(e,t,n=0){return e.slice(n,n+t.length)===t},sf=function(e){let t=parseInt(e.slice(-3));const n=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),i=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!L(t)||!L(n)||!L(r)||!L(i))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*n,t+=60*1e3*r,t+=60*60*1e3*i,t};function Pa(a,e,t){return Rs(a.toString())+Rs(e.toString())+Rs(t)}const af=function(e,t,n){let r=e[t],i=e[r.prevCC];if(!i||!i.new&&r.new){e.ccOffset=e.presentationOffset=r.start,r.new=!1;return}for(;(s=i)!=null&&s.new;){var s;e.ccOffset+=r.start-i.start,r.new=!1,r=i,i=e[r.prevCC]}e.presentationOffset=n};function of(a,e,t,n,r,i,s){const o=new nf,c=Ve(new Uint8Array(a)).trim().replace(rf,`
`).split(`
`),u=[],f=e?gu(e.baseTime,e.timescale):0;let d="00:00.000",g=0,E=0,b,M=!0;o.oncue=function(O){const ae=t[n];let he=t.ccOffset;const _e=(g-f)/9e4;if(ae!=null&&ae.new&&(E!==void 0?he=t.ccOffset=ae.start:af(t,n,_e)),_e){if(!e){b=new Error("Missing initPTS for VTT MPEGTS");return}he=_e-t.presentationOffset}const Ke=O.endTime-O.startTime,We=pi((O.startTime+he-E)*9e4,r*9e4)/9e4;O.startTime=Math.max(We,0),O.endTime=Math.max(We+Ke,0);const mt=O.text.trim();O.text=decodeURIComponent(encodeURIComponent(mt)),O.id||(O.id=Pa(O.startTime,O.endTime,mt)),O.endTime>0&&u.push(O)},o.onparsingerror=function(O){b=O},o.onflush=function(){if(b){s(b);return}i(u)},c.forEach(O=>{if(M)if(ka(O,"X-TIMESTAMP-MAP=")){M=!1,O.slice(16).split(",").forEach(ae=>{ka(ae,"LOCAL:")?d=ae.slice(6):ka(ae,"MPEGTS:")&&(g=parseInt(ae.slice(7)))});try{E=sf(d)/1e3}catch(ae){b=ae}return}else O===""&&(M=!1);o.parse(O+`
`)}),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)$/,lf={left:"start",center:"center",right:"end",start:"start",end:"end"};function nl(a,e,t,n){const r=B(new Uint8Array(a),["mdat"]);if(r.length===0){n(new Error("Could not parse IMSC1 mdat"));return}const i=r.map(o=>Ve(o)),s=pu(e.baseTime,1,e.timescale);try{i.forEach(o=>t(uf(o,s)))}catch(o){n(o)}}function uf(a,e){const r=new DOMParser().parseFromString(a,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},s=Object.keys(i).reduce((d,g)=>(d[g]=r.getAttribute(`ttp:${g}`)||i[g],d),{}),o=r.getAttribute("xml:space")!=="preserve",c=rl(Ma(r,"styling","style")),u=rl(Ma(r,"layout","region")),f=Ma(r,"body","[begin]");return[].map.call(f,d=>{const g=il(d,o);if(!g||!d.hasAttribute("begin"))return null;const E=Na(d.getAttribute("begin"),s),b=Na(d.getAttribute("dur"),s);let M=Na(d.getAttribute("end"),s);if(E===null)throw sl(d);if(M===null){if(b===null)throw sl(d);M=E+b}const O=new Ia(E-e,M-e,g);O.id=Pa(O.startTime,O.endTime,O.text);const ae=u[d.getAttribute("region")],he=c[d.getAttribute("style")],_e=cf(ae,he,c),{textAlign:Ke}=_e;if(Ke){const We=lf[Ke];We&&(O.lineAlign=We),O.align=Ke}return h(O,_e),O}).filter(d=>d!==null)}function Ma(a,e,t){const n=a.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(t)):[]}function rl(a){return a.reduce((e,t)=>{const n=t.getAttribute("xml:id");return n&&(e[n]=t),e},{})}function il(a,e){return[].slice.call(a.childNodes).reduce((t,n,r)=>{var i;return n.nodeName==="br"&&r?t+`
`:(i=n.childNodes)!=null&&i.length?il(n,e):e?t+n.textContent.trim().replace(/\s+/g," "):t+n.textContent},"")}function cf(a,e,t){const n="http://www.w3.org/ns/ttml#styling";let r=null;const i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],s=a!=null&&a.hasAttribute("style")?a.getAttribute("style"):null;return s&&t.hasOwnProperty(s)&&(r=t[s]),i.reduce((o,c)=>{const u=Fa(e,n,c)||Fa(a,n,c)||Fa(r,n,c);return u&&(o[c]=u),o},{})}function Fa(a,e,t){return a&&a.hasAttributeNS(e,t)?a.getAttributeNS(e,t):null}function sl(a){return new Error(`Could not parse ttml timestamp ${a}`)}function Na(a,e){if(!a)return null;let t=Qo(a);return t===null&&(el.test(a)?t=ff(a,e):tl.test(a)&&(t=df(a,e))),t}function ff(a,e){const t=el.exec(a),n=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+n/e.frameRate}function df(a,e){const t=tl.exec(a),n=Number(t[1]);switch(t[2]){case"h":return n*3600;case"m":return n*60;case"ms":return n*1e3;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}class Qs{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,n){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class hf{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 Qs(this,"textTrack1"),t=new Qs(this,"textTrack2"),n=new Qs(this,"textTrack3"),r=new Qs(this,"textTrack4");this.cea608Parser1=new Xo(1,e,t),this.cea608Parser2=new Xo(3,n,r)}addCues(e,t,n,r,i){let s=!1;for(let o=i.length;o--;){const c=i[o],u=pf(c[0],c[1],t,n);if(u>=0&&(c[0]=Math.min(c[0],t),c[1]=Math.max(c[1],n),s=!0,u/(n-t)>.5))return}if(s||i.push([t,n]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,n,r)}else{const o=this.Cues.newCue(null,t,n,r);this.hls.trigger(p.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:n,initPTS:r,timescale:i,trackId:s}){const{unparsedVttFrags:o}=this;n===le.MAIN&&(this.initPTS[t.cc]={baseTime:r,timescale:i,trackId:s}),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:n}=this;if(n)for(let r=0;r<n.textTracks.length;r++){const i=n.textTracks[r];if(ol(i,{name:e,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return i}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:n,media:r}=this,{label:i,languageCode:s}=t[e],o=this.getExistingTrack(i,s);if(o)n[e]=o,cs(n[e]),Ko(n[e],r);else{const c=this.createTextTrack("captions",i,s);c&&(c[e]=!0,n[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const n=t.label,r={_id:e,label:n,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=r,this.hls.trigger(p.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(e,t,n){const r=this.media;if(r)return r.addTextTrack(e,t,n)}onMediaAttaching(e,t){this.media=t.media,t.mediaSource||this._cleanTracks()}onMediaDetaching(e,t){const n=!!t.transferMedia;if(this.media=null,n)return;const{captionsTracks:r}=this;Object.keys(r).forEach(i=>{cs(r[i]),delete r[i]}),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 n=0;n<t.length;n++)cs(t[n])}onSubtitleTracksUpdated(e,t){const n=t.subtitleTracks||[],r=n.some(i=>i.textCodec===Oa);if(this.config.enableWebVTT||r&&this.config.enableIMSC1){if(bo(this.tracks,n)){this.tracks=n;return}if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){const s=this.media,o=s?Ws(s.textTracks):null;if(this.tracks.forEach((c,u)=>{let f;if(o){let d=null;for(let g=0;g<o.length;g++)if(o[g]&&ol(o[g],c)){d=o[g],o[g]=null;break}d&&(f=d)}if(f)cs(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 s=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:s})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(n=>{const r=/(?:CC|SERVICE)([1-4])/.exec(n.instreamId);if(!r)return;const i=`textTrack${r[1]}`,s=this.captionsProperties[i];s&&(s.label=n.name,n.lang&&(s.languageCode=n.lang),s.media=n)})}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===le.MAIN){var n,r;const{cea608Parser1:i,cea608Parser2:s,lastSn:o}=this,{cc:c,sn:u}=t.frag,f=(n=(r=t.part)==null?void 0:r.index)!=null?n:-1;i&&s&&(u!==o+1||u===o&&f!==this.lastPartIndex+1||c!==this.lastCc)&&(i.reset(),s.reset()),this.lastCc=c,this.lastSn=u,this.lastPartIndex=f}}onFragLoaded(e,t){const{frag:n,payload:r}=t;if(n.type===le.SUBTITLE)if(r.byteLength){const i=n.decryptdata,s="stats"in t;if(i==null||!i.encrypted||s){const o=this.tracks[n.level],c=this.vttCCs;c[n.cc]||(c[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),o&&o.textCodec===Oa?this._parseIMSC1(n,r):this._parseVTTs(t)}}else this.hls.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const n=this.hls;nl(t,this.initPTS[e.cc],r=>{this._appendCues(r,e.level),n.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},r=>{n.logger.log(`Failed to parse IMSC1: ${r}`),n.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:r})})}_parseVTTs(e){var t;const{frag:n,payload:r}=e,{initPTS:i,unparsedVttFrags:s}=this,o=i.length-1;if(!i[n.cc]&&o===-1){s.push(e);return}const c=this.hls,u=(t=n.initSegment)!=null&&t.data?Ce(n.initSegment.data,new Uint8Array(r)).buffer:r;of(u,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,f=>{this._appendCues(f,n.level),c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})},f=>{const d=f.message==="Missing initPTS for VTT MPEGTS";d?s.push(e):this._fallbackToIMSC1(n,r),c.logger.log(`Failed to parse VTT cue: ${f}`),!(d&&o>n.cc)&&c.trigger(p.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:f})})}_fallbackToIMSC1(e,t){const n=this.tracks[e.level];n.textCodec||nl(t,this.initPTS[e.cc],()=>{n.textCodec=Oa,this._parseIMSC1(e,t)},()=>{n.textCodec="wvtt"})}_appendCues(e,t){const n=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[t];if(!r||r.mode==="disabled")return;e.forEach(i=>Zo(r,i))}else{const r=this.tracks[t];if(!r)return;const i=r.default?"default":"subtitles"+t;n.trigger(p.CUES_PARSED,{type:"subtitles",cues:e,track:i})}}onFragDecrypted(e,t){const{frag:n}=t;n.type===le.SUBTITLE&&this.onFragLoaded(p.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:n,samples:r}=t;if(!(n.type===le.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let i=0;i<r.length;i++){const s=r[i].bytes;if(s){this.cea608Parser1||this.initCea608Parsers();const o=this.extractCea608Data(s);this.cea608Parser1.addData(r[i].pts,o[0]),this.cea608Parser2.addData(r[i].pts,o[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:n,endOffsetSubtitles:r,type:i}){const{media:s}=this;if(!(!s||s.currentTime<n)){if(!i||i==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(c=>Aa(o[c],t,n))}if(this.config.renderTextTracksNatively&&t===0&&r!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(c=>Aa(o[c],t,r))}}}extractCea608Data(e){const t=[[],[]],n=e[0]&31;let r=2;for(let i=0;i<n;i++){const s=e[r++],o=127&e[r++],c=127&e[r++];if(o===0&&c===0)continue;if((4&s)!==0){const f=3&s;(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)&&_a(e,a)}function pf(a,e,t,n){return Math.min(e,n)-Math.max(a,t)}function ll(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const gf=/\s/,mf={newCue(a,e,t,n){const r=[];let i,s,o,c,u;const f=self.VTTCue||self.TextTrackCue;for(let g=0;g<n.rows.length;g++)if(i=n.rows[g],o=!0,c=0,u="",!i.isEmpty()){var d;for(let M=0;M<i.chars.length;M++)gf.test(i.chars[M].uchar)&&o?c++:(u+=i.chars[M].uchar,o=!1);i.cueStartTime=e,e===t&&(t+=1e-4),c>=16?c--:c++;const E=qo(u.trim()),b=Pa(e,t,E);a!=null&&(d=a.cues)!=null&&d.getCueById(b)||(s=new f(e,t,E),s.id=b,s.line=g+1,s.align="left",s.position=10+Math.min(80,Math.floor(c*8/32)*10),r.push(s))}return a&&r.length&&(r.sort((g,E)=>g.line==="auto"||E.line==="auto"?0:g.line>8&&E.line>8?E.line-g.line:g.line-E.line),r.forEach(g=>Zo(a,g))),r}};function vf(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(a){}return!1}const _f=/(\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||xf,this.controller=new self.AbortController,this.stats=new v}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,n){const r=this.stats;if(r.loading.start)throw new Error("Loader can only be used once.");r.loading.start=self.performance.now();const i=yf(e,this.controller.signal),s=e.responseType==="arraybuffer",o=s?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=n,this.request=this.fetchSetup(e,i),self.clearTimeout(this.requestTimeout),t.timeout=c&&L(c)?c:u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},t.timeout),(As(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(d=>{var g;this.response=this.loader=d;const E=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(r,e,this.response))},u-(E-r.loading.start)),!d.ok){const{status:M,statusText:O}=d;throw new Sf(O||"fetch, bad network response",M,d)}r.loading.first=E,r.total=bf(d.headers)||r.total;const b=(g=this.callbacks)==null?void 0:g.onProgress;return b&&L(t.highWaterMark)?this.loadProgressively(d,r,e,t.highWaterMark,b):s?d.arrayBuffer():e.responseType==="json"?d.json():d.text()}).then(d=>{var g,E;const b=this.response;if(!b)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const M=d[o];M&&(r.loaded=r.total=M);const O={url:b.url,data:d,code:b.status},ae=(g=this.callbacks)==null?void 0:g.onProgress;ae&&!L(t.highWaterMark)&&ae(r,e,d,b),(E=this.callbacks)==null||E.onSuccess(O,r,e,b)}).catch(d=>{var g;if(self.clearTimeout(this.requestTimeout),r.aborted)return;const E=d&&d.code||0,b=d?d.message:null;(g=this.callbacks)==null||g.onError({code:E,text:b},e,d?d.details:null,r)})}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,n,r=0,i){const s=new Wa,o=e.body.getReader(),c=()=>o.read().then(u=>{if(u.done)return s.dataLength&&i(t,n,s.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const f=u.value,d=f.length;return t.loaded+=d,d<r||s.dataLength?(s.push(f),s.dataLength>=r&&i(t,n,s.flush().buffer,e)):i(t,n,f.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function yf(a,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(h({},a.headers))};return a.rangeEnd&&t.headers.set("Range","bytes="+a.rangeStart+"-"+String(a.rangeEnd-1)),t}function Ef(a){const e=_f.exec(a);if(e)return parseInt(e[2])-parseInt(e[1])+1}function bf(a){const e=a.get("Content-Range");if(e){const n=Ef(e);if(L(n))return n}const t=a.get("Content-Length");if(t)return parseInt(t)}function xf(a,e){return new self.Request(a.url,e)}class Sf extends Error{constructor(e,t,n){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=n}}const Tf=/^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 v,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,n){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=n,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;const i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==n||this.stats.aborted))return i(n,t.url)}).catch(s=>{if(!(this.loader!==n||this.stats.aborted))return n.open("GET",t.url,!0),i(n,t.url)}).then(()=>{this.loader!==n||this.stats.aborted||this.openAndSendXhr(n,t,e)}).catch(s=>{var o;(o=this.callbacks)==null||o.onError({code:n.status,text:s.message},t,n,r)}):this.openAndSendXhr(n,t,e)}openAndSendXhr(e,t,n){e.readyState||e.open("GET",t.url,!0);const r=t.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:s}=n.loadPolicy;if(r)for(const o in r)e.setRequestHeader(o,r[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),n.timeout=i&&L(i)?i:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:n}=this;if(!e||!t)return;const r=t.readyState,i=this.config;if(!n.aborted&&r>=2&&(n.loading.first===0&&(n.loading.first=Math.max(self.performance.now(),n.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(n.loading.first-n.loading.start)))),r===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 b=f!=null?f:t.response;if(b!=null){var s,o;n.loading.end=Math.max(self.performance.now(),n.loading.first);const M=t.responseType==="arraybuffer"?b.byteLength:b.length;n.loaded=n.total=M,n.bwEstimate=n.total*8e3/(n.loading.end-n.loading.first);const O=(s=this.callbacks)==null?void 0:s.onProgress;O&&O(n,e,b,t);const ae={url:t.responseURL,data:b,code:u};(o=this.callbacks)==null||o.onSuccess(ae,n,e,t);return}}const d=i.loadPolicy.errorRetry,g=n.retry,E={url:e.url,data:void 0,code:u};if(Jn(d,g,!1,E))this.retry(d);else{var c;X.error(`${u} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:u,text:t.statusText},e,t,n)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(Jn(e,t,!0))this.retry(e);else{var n;X.warn(`timeout while loading ${(n=this.context)==null?void 0:n.url}`);const r=this.callbacks;r&&(this.abortInternal(),r.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:n}=this;this.retryDelay=Vn(e,n.retry),n.retry++,X.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${n.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&&Tf.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 wf={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Af=y(y({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:Yt,bufferController:Iu,capLevelController:Ea,errorController:Dt,fpsController:Rc,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:$r,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:wf},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},Df()),{},{subtitleStreamController:$c,subtitleTrackController:Lc,timelineController:hf,audioStreamController:Au,audioTrackController:Du,emeController:us,cmcdController:Tc,contentSteeringController:Ac,interstitialsController:Uc});function Df(){return{cueHandler:mf,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 Rf(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 n=Ba(a),r=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(s=>{const o=`${s==="level"?"playlist":s}LoadPolicy`,c=e[o]===void 0,u=[];i.forEach(f=>{const d=`${s}Loading${f}`,g=e[d];if(g!==void 0&&c){u.push(d);const E=n[o].default;switch(e[o]={default:E},f){case"TimeOut":E.maxLoadTimeMs=g,E.maxTimeToFirstByteMs=g;break;case"MaxRetry":E.errorRetry.maxNumRetry=g,E.timeoutRetry.maxNumRetry=g;break;case"RetryDelay":E.errorRetry.retryDelayMs=g,E.timeoutRetry.retryDelayMs=g;break;case"MaxRetryTimeout":E.errorRetry.maxRetryDelayMs=g,E.timeoutRetry.maxRetryDelayMs=g;break}}}),u.length&&t.warn(`hls.js config: "${u.join('", "')}" setting(s) are deprecated, use "${o}": ${$e(e[o])}`)}),y(y({},n),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 Cf(a,e){const t=a.loader;t!==ul&&t!==cl?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):vf()&&(a.loader=ul,a.progressive=!0,a.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Js=2,If=.1,Lf=.05,kf=100;class Pf extends Or{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 n;(n=this.media)!=null&&n.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var n;this.ended=((n=this.media)==null?void 0:n.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(kf),this.mediaSource=t.mediaSource;const n=this.media=t.media;li(n,"playing",this.onMediaPlaying),li(n,"waiting",this.onMediaWaiting),li(n,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();const{media:n}=this;n&&(fi(n,"playing",this.onMediaPlaying),fi(n,"waiting",this.onMediaWaiting),fi(n,"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 n,r;const i=(n=this.hls)==null?void 0:n.config;if(!i)return;const s=this.media;if(!s)return;const{seeking:o}=s,c=this.seeking&&!o,u=!this.seeking&&o,f=s.paused&&!o||s.ended||s.playbackRate===0;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,o||(this.nudgeRetry=0,i.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&&s.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(p.MEDIA_ENDED,{stalled:!1}));return}if(!In.getBuffered(s).length){this.nudgeRetry=0;return}const d=In.bufferInfo(s,e,0),g=d.nextStart||0,E=this.fragmentTracker;if(o&&E&&this.hls){const mt=fl(this.hls.inFlightFragments,e),He=d.len>Js,ot=!g||mt||g-e>Js&&!E.getPartialFragment(e);if(He||ot)return;this.moved=!1}const b=(r=this.hls)==null?void 0:r.latestLevelDetails;if(!this.moved&&this.stalled!==null&&E){if(!(d.len>0)&&!g)return;const He=Math.max(g,d.start||0)-e,at=!!(b!=null&&b.live)?b.targetduration*2:Js,Je=qs(e,E);if(He>0&&(He<=at||Je)){s.paused||this._trySkipBufferHole(Je);return}}const M=i.detectStallWithCurrentTimeMs,O=self.performance.now(),ae=this.waiting;let he=this.stalled;if(he===null)if(ae>0&&O-ae<M)he=this.stalled=ae;else{this.stalled=O;return}const _e=O-he;if(!o&&(_e>=M||ae)&&this.hls){var Ke;if(((Ke=this.mediaSource)==null?void 0:Ke.readyState)==="ended"&&!(b!=null&&b.live)&&Math.abs(e-((b==null?void 0:b.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 We=In.bufferInfo(s,e,i.maxBufferHole);this._tryFixBufferStall(We,_e,e)}stallResolved(e){const t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){const n=self.performance.now()-t;this.log(`playback not stuck anymore @${e}, after ${Math.round(n)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(p.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var n;const r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(n=this.buffered.audio)!=null&&n.length&&r&&r.length>1&&e>r.end(0)){const i=In.bufferedInfo(In.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&t>=i.start){const s=In.timeRangesToArray(r),o=In.bufferedInfo(s,t,0).bufferedIndex;if(o>-1&&o<s.length-1){const c=In.bufferedInfo(s,e,0).bufferedIndex,u=s[o].end,f=s[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 g=qs(e,this.fragmentTracker);g&&"fragment"in g?g=g.fragment:g||(g=void 0);const E=In.bufferInfo(this.media,e,0);this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:d,reason:d.message,frag:g,buffer:E.len,bufferInfo:E})}}}}}_tryFixBufferStall(e,t,n){var r,i;const{fragmentTracker:s,media:o}=this,c=(r=this.hls)==null?void 0:r.config;if(!o||!s||!c)return;const u=(i=this.hls)==null?void 0:i.latestLevelDetails,f=qs(n,s);if((f||u!=null&&u.live&&n<u.fragmentStart)&&(this._trySkipBufferHole(f)||!this.media))return;const d=e.buffered,g=this.adjacentTraversal(e,n);(d&&d.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-n<c.maxBufferHole||g))&&(t>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){const n=this.fragmentTracker,r=e.nextStart;if(n&&r){const i=n.getFragAtPos(t,le.MAIN),s=n.getFragAtPos(r,le.MAIN);if(i&&s)return s.sn-i.sn<2}return!1}_reportStall(e){const{hls:t,media:n,stallReported:r,stalled:i}=this;if(!r&&i!==null&&n&&t){this.stallReported=!0;const s=new Error(`Playback stalling at @${n.currentTime} due to low buffer (${$e(e)})`);this.warn(s.message),t.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len,bufferInfo:e,stalled:{start:i}})}}_trySkipBufferHole(e){var t;const{fragmentTracker:n,media:r}=this,i=(t=this.hls)==null?void 0:t.config;if(!r||!n||!i)return 0;const s=r.currentTime,o=In.bufferInfo(r,s,0),c=s<o.start?o.start:o.nextStart;if(c&&this.hls){const f=o.len<=i.maxBufferHole,d=o.len>0&&o.len<1&&r.readyState<3,g=c-s;if(g>0&&(f||d)){if(g>i.maxBufferHole){let b=!1;if(s===0){const M=n.getAppendedFrag(0,le.MAIN);M&&c<M.end&&(b=!0)}if(!b&&e){var u;if(!((u=this.hls.loadLevelObj)!=null&&u.details)||fl(this.hls.inFlightFragments,c))return 0;let O=!1,ae=e.end;for(;ae<c;){const he=qs(ae,n);if(he)ae+=he.duration;else{O=!0;break}}if(O)return 0}}const E=Math.max(c+Lf,s+If);if(this.warn(`skipping hole, adjusting currentTime from ${s} to ${E}`),this.moved=!0,r.currentTime=E,!(e!=null&&e.gap)){const b=new Error(`fragment loaded with buffer holes, seeking from ${s} to ${E}`),M={type:ue.MEDIA_ERROR,details:$.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:b,reason:b.message,buffer:o.len,bufferInfo:o};e&&("fragment"in e?M.part=e:M.frag=e),this.hls.trigger(p.ERROR,M)}return E}}return 0}_tryNudgeBuffer(e){const{hls:t,media:n,nudgeRetry:r}=this,i=t==null?void 0:t.config;if(!n||!i)return 0;const s=n.currentTime;if(this.nudgeRetry++,r<i.nudgeMaxRetry){const o=s+(r+1)*i.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${s} to ${o}`);this.warn(c.message),n.currentTime=o,t.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.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 @${s} after ${i.nudgeMaxRetry} nudges`);this.error(o.message),t.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.BUFFER_STALLED_ERROR,error:o,fatal:!0,buffer:e.len,bufferInfo:e})}}}function fl(a,e){const t=dl(a.main);if(t&&t.start<=e)return t;const n=dl(a.audio);return n&&n.start<=e?n:null}function dl(a){if(!a)return null;switch(a.state){case Ot.IDLE:case Ot.STOPPED:case Ot.ENDED:case Ot.ERROR:return null}return a.frag}function qs(a,e){return e.getAppendedFrag(a,le.MAIN)||e.getPartialFragment(a)}const Of=.25;function Ua(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function $a(a,e,t,n,r){let i=new a(e,t,"");try{i.value=n,r&&(i.type=r)}catch(s){i=new a(e,t,$e(r?y({type:r},n):n))}return i}const ea=(()=>{const a=Ua();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Mf{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 n;this.media=t.media,((n=t.overrides)==null?void 0:n.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&&cs(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 n=e[t];if(n.kind==="metadata"&&n.label==="id3")return Ko(n,this.media),n}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:n,enableID3MetadataCues:r}=this.hls.config;if(!n&&!r)return;const{samples:i}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=Ua();if(s)for(let o=0;o<i.length;o++){const c=i[o].type;if(c===hi.emsg&&!n||!r)continue;const u=eo(i[o].data),f=i[o].pts;let d=f+i[o].duration;d>ea&&(d=ea),d-f<=0&&(d=f+Of);for(let E=0;E<u.length;E++){const b=u[E];if(!to(b)){this.updateId3CueEnds(f,c);const M=$a(s,f,d,b,c);M&&this.id3Track.addCue(M)}}}}updateId3CueEnds(e,t){var n;const r=(n=this.id3Track)==null?void 0:n.cues;if(r)for(let i=r.length;i--;){const s=r[i];s.type===t&&s.startTime<e&&s.endTime===ea&&(s.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:n,type:r}){const{id3Track:i,hls:s}=this;if(!s)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:c}}=s;if(i&&(o||c)){let u;r==="audio"?u=f=>f.type===hi.audioId3&&c:r==="video"?u=f=>f.type===hi.emsg&&o:u=f=>f.type===hi.audioId3&&c||f.type===hi.emsg&&o,Aa(i,t,n,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:n,timelineOffset:r,enableDateRangeMetadataCues:i,interstitialsController:s}=this.hls.config;if(!i)return;const o=Ua();if(n&&r&&!s){const{fragmentStart:M,fragmentEnd:O}=e;let ae=this.assetCue;ae?(ae.startTime=M,ae.endTime=O):o&&(ae=this.assetCue=$a(o,M,O,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),ae&&(ae.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(ae),ae.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 g;if((g=c.cues)!=null&&g.length){const M=Object.keys(d).filter(O=>!f.includes(O));for(let O=M.length;O--;){var E;const ae=M[O],he=(E=d[ae])==null?void 0:E.cues;delete d[ae],he&&Object.keys(he).forEach(_e=>{const Ke=he[_e];if(Ke){Ke.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(Ke)}catch(We){}}})}}else d=this.dateRangeCuesAppended={}}const b=e.fragments[e.fragments.length-1];if(!(f.length===0||!L(b==null?void 0:b.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let M=0;M<f.length;M++){const O=f[M],ae=u[O],he=ae.startTime,_e=d[O],Ke=(_e==null?void 0:_e.cues)||{};let We=(_e==null?void 0:_e.durationKnown)||!1,mt=ea;const{duration:He,endDate:ot}=ae;if(ot&&He!==null)mt=he+He,We=!0;else if(ae.endOnNext&&!We){const Je=f.reduce((Nt,vn)=>{if(vn!==ae.id){const Rn=u[vn];if(Rn.class===ae.class&&Rn.startDate>ae.startDate&&(!Nt||ae.startDate<Nt.startDate))return Rn}return Nt},null);Je&&(mt=Je.startTime,We=!0)}const at=Object.keys(ae.attr);for(let Je=0;Je<at.length;Je++){const Nt=at[Je];if(!Br(Nt))continue;const vn=Ke[Nt];if(vn)We&&!(_e!=null&&_e.durationKnown)?vn.endTime=mt:Math.abs(vn.startTime-he)>.01&&(vn.startTime=he,vn.endTime=mt);else if(o){let Rn=ae.attr[Nt];Hr(Nt)&&(Rn=C(Rn));const Cn=$a(o,he,mt,{key:Nt,data:Rn},hi.dateRange);Cn&&(Cn.id=O,this.id3Track.addCue(Cn),Ke[Nt]=Cn,s&&(Nt==="X-ASSET-LIST"||Nt==="X-ASSET-URL")&&Cn.addEventListener("enter",this.onEventCueEnter))}}d[O]={cues:Ke,dateRange:ae,durationKnown:We}}}}}class Ff{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,n=this.levelDetails;if(!t||!n)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:s}=this.config;if(!i||s===1||!n.live)return;const o=this.targetLatency;if(o===null)return;const c=r-o,u=Math.min(this.maxLatency,o+n.targetduration);if(c<u&&c>.05&&this.forwardBufferLength>1){const d=Math.min(2,Math.max(1,s)),g=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,E=Math.min(d,Math.max(1,g));this.changeMediaPlaybackRate(t,E)}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:n,targetduration:r}=e,{liveSyncDuration:i,liveSyncDurationCount:s,lowLatencyMode:o}=this.config,c=this.hls.userConfig;let u=o&&n||t;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||u===0)&&(u=i!==void 0?i:s*r);const f=r;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 n=this.levelDetails;if(n===null)return null;const r=n.edge,i=e-t-this.edgeStalled,s=r-n.totalduration,o=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(s,i),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 n=e.buffered.length;return(n?e.buffered.end(n-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 n;t.details===$.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(n=this.levelDetails)!=null&&n.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var n,r;e.playbackRate!==t&&((n=this.hls)==null||n.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(r=this.targetLatency)==null?void 0:r.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 Nf extends va{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 n=this.hls.config.preferManagedMediaSource,r=[],i={},s={};let o=!1,c=!1,u=!1;t.levels.forEach(f=>{const d=f.attrs;let{audioCodec:g,videoCodec:E}=f;g&&(f.audioCodec=g=tt(g,n)||void 0),E&&(E=f.videoCodec=gn(E));const{width:b,height:M,unknownCodecs:O}=f,ae=(O==null?void 0:O.length)||0;if(o||(o=!!(b&&M)),c||(c=!!E),u||(u=!!g),ae||g&&!this.isAudioSupported(g)||E&&!this.isVideoSupported(E)){this.log(`Some or all CODECS not supported "${d.CODECS}"`);return}const{CODECS:he,"FRAME-RATE":_e,"HDCP-LEVEL":Ke,"PATHWAY-ID":We,RESOLUTION:mt,"VIDEO-RANGE":He}=d,at=`${`${We||"."}-`}${f.bitrate}-${mt}-${_e}-${he}-${He}-${Ke}`;if(i[at])if(i[at].uri!==f.url&&!f.attrs["PATHWAY-ID"]){const Je=s[at]+=1;f.attrs["PATHWAY-ID"]=new Array(Je+1).join(".");const Nt=this.createLevel(f);i[at]=Nt,r.push(Nt)}else i[at].addGroupId("audio",d.AUDIO),i[at].addGroupId("text",d.SUBTITLES);else{const Je=this.createLevel(f);i[at]=Je,s[at]=1,r.push(Je)}}),this.filterAndSortMediaOptions(r,t,o,c,u)}createLevel(e){const t=new Pt(e),n=e.supplemental;if(n!=null&&n.videoCodec&&!this.isVideoSupported(n.videoCodec)){const r=new Error(`SUPPLEMENTAL-CODECS not supported "${n.videoCodec}"`);this.log(r.message),t.supportedResult=Lt(r,[])}return t}isAudioSupported(e){return Se(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return Se(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,t,n,r,i){var s;let o=[],c=[],u=e;const f=((s=t.stats)==null?void 0:s.parsing)||{};if((n||r)&&i&&(u=u.filter(({videoCodec:he,videoRange:_e,width:Ke,height:We})=>(!!he||!!(Ke&&We))&&Et(_e))),u.length===0){Promise.resolve().then(()=>{if(this.hls){let he="no level with compatible codecs found in manifest",_e=he;t.levels.length&&(_e=`one or more CODECS in variant not supported: ${$e(t.levels.map(We=>We.attrs.CODECS).filter((We,mt,He)=>He.indexOf(We)===mt))}`,this.warn(_e),he+=` (${_e})`);const Ke=new Error(he);this.hls.trigger(p.ERROR,{type:ue.MEDIA_ERROR,details:$.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:Ke,reason:_e})}}),f.end=performance.now();return}t.audioTracks&&(o=t.audioTracks.filter(he=>!he.audioCodec||this.isAudioSupported(he.audioCodec)),hl(o)),t.subtitles&&(c=t.subtitles,hl(c));const d=u.slice(0);u.sort((he,_e)=>{if(he.attrs["HDCP-LEVEL"]!==_e.attrs["HDCP-LEVEL"])return(he.attrs["HDCP-LEVEL"]||"")>(_e.attrs["HDCP-LEVEL"]||"")?1:-1;if(n&&he.height!==_e.height)return he.height-_e.height;if(he.frameRate!==_e.frameRate)return he.frameRate-_e.frameRate;if(he.videoRange!==_e.videoRange)return Tt.indexOf(he.videoRange)-Tt.indexOf(_e.videoRange);if(he.videoCodec!==_e.videoCodec){const Ke=z(he.videoCodec),We=z(_e.videoCodec);if(Ke!==We)return We-Ke}if(he.uri===_e.uri&&he.codecSet!==_e.codecSet){const Ke=pe(he.codecSet),We=pe(_e.codecSet);if(Ke!==We)return We-Ke}return he.averageBitrate!==_e.averageBitrate?he.averageBitrate-_e.averageBitrate:0});let g=d[0];if(this.steering&&(u=this.steering.filterParsedLevels(u),u.length!==d.length)){for(let he=0;he<d.length;he++)if(d[he].pathwayId===u[0].pathwayId){g=d[he];break}}this._levels=u;for(let he=0;he<u.length;he++)if(u[he]===g){var E;this._firstLevel=he;const _e=g.bitrate,Ke=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${u.length} level(s) found, first bitrate: ${_e}`),((E=this.hls.userConfig)==null?void 0:E.abrEwmaDefaultEstimate)===void 0){const We=Math.min(_e,this.hls.config.abrEwmaDefaultEstimateMax);We>Ke&&Ke===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=We)}break}const b=i&&!r,M=this.hls.config,O=!!(M.audioStreamController&&M.audioTrackController),ae={levels:u,audioTracks:o,subtitleTracks:c,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:i,video:r,altAudio:O&&!b&&o.some(he=>!!he.url)};f.end=performance.now(),this.hls.trigger(p.MANIFEST_PARSED,ae)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const f=new Error("invalid level idx"),d=e<0;if(this.hls.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:$.LEVEL_SWITCH_ERROR,level:e,fatal:d,error:f,reason:f.message}),d)return;e=Math.min(e,t.length-1)}const n=this.currentLevelIndex,r=this.currentLevel,i=r?r.attrs["PATHWAY-ID"]:void 0,s=t[e],o=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=s,n===e&&r&&i===o)return;this.log(`Switching to level ${e} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${o?" with Pathway "+o:""} from level ${n}${i?" with Pathway "+i:""}`);const c={level:e,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(p.LEVEL_SWITCHING,c);const u=s.details;if(!u||u.live){const f=this.switchParams(s.uri,r==null?void 0:r.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(),n=e.filter(r=>t.indexOf(r)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${t}`);return}this.steering.pathwayPriority=n}}onError(e,t){t.fatal||!t.context||t.context.type===ge.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===le.MAIN){const n=t.elementaryStreams;if(!Object.keys(n).some(i=>!!n[i]))return;const r=this._levels[t.level];r!=null&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(e,t){var n;const{level:r,details:i}=t,s=t.levelInfo;if(!s){var o;this.warn(`Invalid level index ${r}`),(o=t.deliveryDirectives)!=null&&o.skip&&(i.deltaUpdateFailed=!0);return}if(s===this.currentLevel||t.withoutMultiVariant){s.fragmentError===0&&(s.loadError=0);let c=s.details;c===t.details&&c.advanced&&(c=void 0),this.playlistLoaded(r,t,c)}else(n=t.deliveryDirectives)!=null&&n.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);const n=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,i=e.attrs["PATHWAY-ID"],s=e.details,o=s==null?void 0:s.age;this.log(`Loading level index ${r}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${i?" Pathway "+i:""}${o&&s.live?" age "+o.toFixed(1)+(s.type?" "+s.type||0:""):""} ${n}`),this.hls.trigger(p.LEVEL_LOADING,{url:n,level:r,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 n=this._levels.filter((i,s)=>s!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(o=>o.level=-1)),!1));ti(n),this._levels=n,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 r=n.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(p.LEVELS_UPDATED,{levels:n})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:n}=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:n}))}}function hl(a){const e={};a.forEach(t=>{const n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++})}function pl(){return self.SourceBuffer||self.WebKitSourceBuffer}function gl(){if(!ce())return!1;const e=pl();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Bf(){if(!gl())return!1;const a=ce();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(U(e,"video")))||["mp4a.40.2","fLaC"].some(e=>a.isTypeSupported(U(e,"audio"))))}function Uf(){var a;const e=pl();return typeof(e==null||(a=e.prototype)==null?void 0:a.changeType)=="function"}const $f=100;class Kf extends na{constructor(e,t,n){super(e,t,n,"stream-controller",le.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 r=this.media,i=r?r.currentTime:null;if(i===null||!L(i)||(this.log(`Media seeked to ${i.toFixed(3)}`),!this.getBufferedFrag(i)))return;const s=this.getFwdBufferInfoAtPos(r,i,le.MAIN,0);if(s===null||s.len===0){this.warn(`Main forward buffer length at ${i} on "seeked" event ${s?s.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:n,hls:r}=this;if(this.stopLoad(),this.setInterval($f),this.level=-1,!this.startFragRequested){let i=r.startLevel;i===-1&&(r.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=r.firstAutoLevel),r.nextLoadLevel=i,this.level=r.loadLevel,this._hasEnoughToStart=!!t}n>0&&e===-1&&!t&&(this.log(`Override startPosition with lastCurrentTime @${n.toFixed(3)}`),e=n),this.state=Ot.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Ot.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ot.WAITING_LEVEL:{const{levels:e,level:t}=this,n=e==null?void 0:e[t],r=n==null?void 0:n.details;if(r&&(!r.live||this.levelLastLoaded===n&&!this.waitForLive(n))){if(this.waitForCdnTuneIn(r))break;this.state=Ot.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Ot.IDLE;break}break}case Ot.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Ot.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:n,media:r}=this;if(t===null||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(n!=null&&n[i]))return;const s=n[i],o=this.getMainFwdBufferInfo();if(o===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(o,c)){const M={};this.altAudio===2&&(M.type="video"),this.hls.trigger(p.BUFFER_EOS,M),this.state=Ot.ENDED;return}if(!this.buffering)return;e.loadLevel!==i&&e.manualLevel===-1&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=e.nextLoadLevel=i;const u=s.details;if(!u||this.state===Ot.WAITING_LEVEL||this.waitForLive(s)){this.level=i,this.state=Ot.WAITING_LEVEL,this.startFragRequested=!1;return}const f=o.len,d=this.getMaxBufferLength(s.maxBitrate);if(f>=d)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const g=this.backtrackFragment?this.backtrackFragment.start:o.end;let E=this.getNextFragment(g,u);if(this.couldBacktrack&&!this.fragPrevious&&E&&Oe(E)&&this.fragmentTracker.getState(E)!==$t.OK){var b;const O=((b=this.backtrackFragment)!=null?b:E).sn-u.startSN,ae=u.fragments[O-1];ae&&E.cc===ae.cc&&(E=ae,this.fragmentTracker.removeFragment(ae))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(E&&this.isLoopLoading(E,g)){if(!E.gap){const O=this.audioOnly&&!this.altAudio?P.AUDIO:P.VIDEO,ae=(O===P.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;ae&&this.afterBufferFlushed(ae,O,le.MAIN)}E=this.getNextFragmentLoopLoading(E,u,o,le.MAIN,d)}E&&(E.initSegment&&!E.initSegment.data&&!this.bitrateTest&&(E=E.initSegment),this.loadFragment(E,s,g))}loadFragment(e,t,n){const r=this.fragmentTracker.getState(e);r===$t.NOT_LOADED||r===$t.PARTIAL?Oe(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,n):this._loadInitSegment(e,t):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,le.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 n;const r=this.getAppendedFrag(t.currentTime);r&&r.start>1&&this.flushMainBuffer(0,r.start-1);const i=this.getLevelDetails();if(i!=null&&i.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<i.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,c=e[o],u=this.fragLastKbps;u&&this.fragCurrent?n=this.fragCurrent.duration*c.maxBitrate/(1e3*u)+1:n=0}else n=0;const s=this.getBufferedFrag(t.currentTime+n);if(s){const o=this.followingBufferedFrag(s);if(o){this.abortCurrentFrag();const c=o.maxStartPTS?o.maxStartPTS:o.start,u=o.duration,f=Math.max(s.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 Ot.KEY_LOADING:case Ot.FRAG_LOADING:case Ot.FRAG_LOADING_WAITING_RETRY:case Ot.PARSING:case Ot.PARSED:this.state=Ot.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 n=t.media;li(n,"playing",this.onMediaPlaying),li(n,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){const{media:n}=this;n&&(fi(n,"playing",this.onMediaPlaying),fi(n,"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 n=!1,r=!1;for(let i=0;i<t.levels.length;i++){const s=t.levels[i].audioCodec;s&&(n=n||s.indexOf("mp4a.40.2")!==-1,r=r||s.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=n&&r&&!Uf(),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:n}=this;if(!n||this.state!==Ot.IDLE)return;const r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=Ot.WAITING_LEVEL)}onLevelLoaded(e,t){var n;const{levels:r,startFragRequested:i}=this,s=t.level,o=t.details,c=o.totalduration;if(!r){this.warn(`Levels were reset while loading level ${s}`);return}this.log(`Level ${s} 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===Ot.FRAG_LOADING||this.state===Ot.FRAG_LOADING_WAITING_RETRY)&&f.level!==t.level&&f.loader&&this.abortCurrentFrag();let d=0;if(o.live||(n=u.details)!=null&&n.live){var g;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;d=this.alignPlaylists(o,u.details,(g=this.levelLastLoaded)==null?void 0:g.details)}if(u.details=o,this.levelLastLoaded=u,i||this.setStartPosition(o,d),this.hls.trigger(p.LEVEL_UPDATED,{details:o,level:s}),this.state===Ot.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Ot.IDLE}i&&o.live&&this.synchronizeToLiveEdge(o),this.tick()}synchronizeToLiveEdge(e){const{config:t,media:n}=this;if(!n)return;const r=this.hls.liveSyncPosition,i=this.getLoadPosition(),s=e.fragmentStart,o=e.edge,c=i>=s-t.maxFragLookUpTolerance&&i<=o;if(r!==null&&n.duration>r&&(i<r||!c)){const f=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!c&&n.readyState<4||i<o-f)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),n.readyState))if(this.warn(`Playback: ${i.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${r.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var u;const d=In.bufferInfo(n,r,0);if(!((u=d.buffered)!=null&&u.length)){n.currentTime=r;return}if(d.start<=i){n.currentTime=r;return}const{nextStart:E}=In.bufferedInfo(d.buffered,i,0);E&&(n.currentTime=E)}else n.currentTime=r}}_handleFragmentLoadProgress(e){var t;const n=e.frag,{part:r,payload:i}=e,{levels:s}=this;if(!s){this.warn(`Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered`);return}const o=s[n.level];if(!o){this.warn(`Level ${n.level} not found on progress`);return}const c=o.details;if(!c){this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`),this.fragmentTracker.removeFragment(n);return}const u=o.videoCodec,f=c.PTSKnown||!c.live,d=(t=n.initSegment)==null?void 0:t.data,g=this._getAudioCodec(o),E=this.transmuxer=this.transmuxer||new yo(this.hls,le.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),b=r?r.index:-1,M=b!==-1,O=new br(n.level,n.sn,n.stats.chunkCount,i.byteLength,b,M),ae=this.initPTS[n.cc];E.push(i,d,g,u,n,r,c.totalduration,f,O,ae)}onAudioTrackSwitching(e,t){const n=this.hls,r=this.altAudio===2;if(fn(t.url,n))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 s=this.fragCurrent;s&&(this.log("Switching to main audio track, cancel main fragment load"),s.abortRequests(),this.fragmentTracker.removeFragment(s)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.fragmentTracker.removeAllFragments(),n.once(p.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(p.AUDIO_TRACK_SWITCHED,t)}),n.trigger(p.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}n.trigger(p.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const n=fn(t.url,this.hls);if(n){const r=this.videoBuffer;r&&this.mediaBuffer!==r&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=r)}this.altAudio=n?2:0,this.tick()}onBufferCreated(e,t){const n=t.tracks;let r,i,s=!1;for(const o in n){const c=n[o];if(c.id==="main"){if(i=o,r=c,o==="video"){const u=n[o];u&&(this.videoBuffer=u.buffer)}}else s=!0}s&&r?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:n,part:r}=t,i=n.type===le.MAIN;if(i){if(this.fragContextChanged(n)){this.warn(`Fragment ${n.sn}${r?" p: "+r.index:""} of level ${n.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Ot.PARSED&&(this.state=Ot.IDLE);return}const o=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),Oe(n)&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}const s=this.media;s&&(!this._hasEnoughToStart&&In.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),i&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var n;if(t.fatal){this.state=Ot.ERROR;return}switch(t.details){case $.FRAG_GAP:case $.FRAG_PARSING_ERROR:case $.FRAG_DECRYPT_ERROR:case $.FRAG_LOAD_ERROR:case $.FRAG_LOAD_TIMEOUT:case $.KEY_LOAD_ERROR:case $.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(le.MAIN,t);break;case $.LEVEL_LOAD_ERROR:case $.LEVEL_LOAD_TIMEOUT:case $.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===Ot.WAITING_LEVEL&&((n=t.context)==null?void 0:n.type)===ge.LEVEL&&(this.state=Ot.IDLE);break;case $.BUFFER_ADD_CODEC_ERROR:case $.BUFFER_APPEND_ERROR:if(t.parent!=="main")return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case $.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 $.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onFragLoadEmergencyAborted(){this.state=Ot.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==P.AUDIO||!this.altAudio){const n=(t===P.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;n&&(this.afterBufferFlushed(n,t,le.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 n=this.startPosition;if(n>=0&&t<n){if(e.seeking){this.log(`could not seek to ${n}, already seeking at ${t}`);return}const r=this.timelineOffset;r&&n&&(n+=r);const i=this.getLevelDetails(),s=In.getBuffered(e),o=s.length?s.start(0):0,c=o-n,u=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<u||this.loadingParts&&c<2*((i==null?void 0:i.partTarget)||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),n+=c,this.startPosition=n),t<n&&(this.log(`seek to target start position ${n} from current time ${t} buffer start ${o}`),e.currentTime=n)}}_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(n=>{const{hls:r}=this,i=n==null?void 0:n.frag;if(!i||this.fragContextChanged(i))return;t.fragmentError=0,this.state=Ot.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const s=i.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),r.trigger(p.FRAG_LOADED,n),i.bitrateTest=!1}).catch(n=>{this.state===Ot.STOPPED||this.state===Ot.ERROR||(this.warn(n),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const t=this.playlistType,{hls:n}=this,{remuxResult:r,chunkMeta:i}=e,s=this.getCurrentContext(i);if(!s){this.resetWhenMissingContext(i);return}const{frag:o,part:c,level:u}=s,{video:f,text:d,id3:g,initSegment:E}=r,{details:b}=u,M=this.altAudio?void 0:r.audio;if(this.fragContextChanged(o)){this.fragmentTracker.removeFragment(o);return}if(this.state=Ot.PARSING,E){const O=E.tracks;if(O){const Ke=o.initSegment||o;if(this.unhandledEncryptionError(E,o))return;this._bufferInitSegment(u,O,Ke,i),n.trigger(p.FRAG_PARSING_INIT_SEGMENT,{frag:Ke,id:t,tracks:O})}const ae=E.initPTS,he=E.timescale,_e=this.initPTS[o.cc];if(L(ae)&&(!_e||_e.baseTime!==ae||_e.timescale!==he)){const Ke=E.trackId;this.initPTS[o.cc]={baseTime:ae,timescale:he,trackId:Ke},n.trigger(p.INIT_PTS_FOUND,{frag:o,id:t,initPTS:ae,timescale:he,trackId:Ke})}}if(f&&b){M&&f.type==="audiovideo"&&this.logMuxedErr(o);const O=b.fragments[o.sn-1-b.startSN],ae=o.sn===b.startSN,he=!O||o.cc>O.cc;if(r.independent!==!1){const{startPTS:_e,endPTS:Ke,startDTS:We,endDTS:mt}=f;if(c)c.elementaryStreams[f.type]={startPTS:_e,endPTS:Ke,startDTS:We,endDTS:mt};else if(f.firstKeyFrame&&f.independent&&i.id===1&&!he&&(this.couldBacktrack=!0),f.dropped&&f.independent){const He=this.getMainFwdBufferInfo(),ot=(He?He.end:this.getLoadPosition())+this.config.maxBufferHole,at=f.firstKeyFramePTS?f.firstKeyFramePTS:_e;if(!ae&&ot<at-this.config.maxBufferHole&&!he){this.backtrack(o);return}else he&&(o.gap=!0);o.setElementaryStreamInfo(f.type,o.start,Ke,o.start,mt,!0)}else ae&&_e-(b.appliedTimelineOffset||0)>Js&&(o.gap=!0);o.setElementaryStreamInfo(f.type,_e,Ke,We,mt),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(f,o,c,i,ae||he)}else if(ae||he)o.gap=!0;else{this.backtrack(o);return}}if(M){const{startPTS:O,endPTS:ae,startDTS:he,endDTS:_e}=M;c&&(c.elementaryStreams[P.AUDIO]={startPTS:O,endPTS:ae,startDTS:he,endDTS:_e}),o.setElementaryStreamInfo(P.AUDIO,O,ae,he,_e),this.bufferFragmentData(M,o,c,i)}if(b&&g!=null&&g.samples.length){const O={id:t,frag:o,details:b,samples:g.samples};n.trigger(p.FRAG_PARSING_METADATA,O)}if(b&&d){const O={id:t,frag:o,details:b,samples:d.samples};n.trigger(p.FRAG_PARSING_USERDATA,O)}}logMuxedErr(e){this.warn(`${Oe(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,t,n,r){if(this.state!==Ot.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(n));const{audio:i,video:s,audiovideo:o}=t;if(i){const u=e.audioCodec;let f=It(i.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 g=i.metadata;g&&"channelCount"in g&&(g.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(f="mp4a.40.5")}f&&f.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&i.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}"`),i.levelCodec=f,i.id=le.MAIN,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${f||""}/${u||""}/${i.codec}]`),delete t.audiovideo}if(s){s.levelCodec=e.videoCodec,s.id=le.MAIN;const u=s.codec;if((u==null?void 0:u.length)===4)switch(u){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${e.videoCodec||""}/${u}]${s.codec!==u?" parsed-corrected="+s.codec:""}${s.supplemental?" supplemental="+s.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:n,part:null,chunkMeta:r,parent:n.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,le.MAIN)}get maxBufferLength(){const{levels:e,level:t}=this,n=e==null?void 0:e[t];return n?this.getMaxBufferLength(n.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=Ot.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const n=e.currentTime;if(In.isBuffered(e,n)?t=this.getAppendedFrag(n):In.isBuffered(e,n+.1)&&(t=this.getAppendedFrag(n+.1)),t){this.backtrackFragment=null;const r=this.fragPlaying,i=t.level;(!r||t.sn!==r.sn||r.level!==i)&&(this.fragPlaying=t,this.hls.trigger(p.FRAG_CHANGED,{frag:t}),(!r||r.level!==i)&&this.hls.trigger(p.LEVEL_SWITCHED,{level:i}))}}}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 L(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;const t=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(L(t)){const n=this.getLevelDetails(),r=this.currentFrag||(n?Jt(null,n.fragments,t):null);if(r){const i=r.programDateTime;if(i!==null){const s=i+(t-r.start)*1e3;return new Date(s)}}}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 Zf extends Z{constructor(e,t){super("key-loader",t),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const n in this.keyIdToKeyInfo){const r=this.keyIdToKeyInfo[n].loader;if(r){var t;if(e&&e!==((t=r.context)==null?void 0:t.frag.type))return;r.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=$.KEY_LOAD_ERROR,n,r,i){return new Sr({type:ue.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:n,networkDetails:r})}loadClear(e,t,n){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,i=t.length;r<i;r++){const s=t[r];if(e.cc<=s.cc&&(!Oe(e)||!Oe(s)||e.sn<s.sn)||!n&&r==i-1)return this.emeController.selectKeySystemFormat(s).then(o=>{if(!this.emeController)return;s.setKeyFormat(o);const c=Qr(o);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const r=Jr(this.config);if(r.length)return this.emeController.getKeySystemAccess(r)}}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 n,r;t&&e.setKeyFormat(t);const i=e.decryptdata;if(!i){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,$.KEY_LOAD_ERROR,u))}const s=i.uri;if(!s)return Promise.reject(this.createKeyLoadError(e,$.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));const o=Ka(i);let c=this.keyIdToKeyInfo[o];if((n=c)!=null&&n.decryptdata.key)return i.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(r=c)!=null&&r.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case"usable":case"usable-in-future":return c.keyLoadPromise.then(f=>{const{keyInfo:d}=f;return i.key=d.decryptdata.key,{frag:e,keyInfo:d}})}switch(this.log(`${this.keyIdToKeyInfo[o]?"Rel":"L"}oading${i.keyId?" keyId: "+V(i.keyId):""} URI: ${i.uri} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[o]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return i.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,$.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e,t){const n={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var r;if(!e.decryptdata.keyId&&(r=t.initSegment)!=null&&r.data){const s=se(t.initSegment.data);if(s.length){const o=s[0];o.some(c=>c!==0)&&(this.log(`Using keyId found in init segment ${V(o)}`),e.decryptdata.keyId=o,ci.setKeyIdForUri(e.decryptdata.uri,o))}}const i=this.emeController.loadKey(n);return(e.keyLoadPromise=i.then(s=>(e.mediaKeySessionContext=s,n))).catch(s=>{throw e.keyLoadPromise=null,"data"in s&&(s.data.frag=t),s})}return Promise.resolve(n)}loadKeyHTTP(e,t){const n=this.config,r=n.loader,i=new r(n);return t.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((s,o)=>{const c={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},u=n.keyLoadPolicy.default,f={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(g,E,b,M)=>{const{frag:O,keyInfo:ae}=b,he=Ka(ae.decryptdata);if(!O.decryptdata||ae!==this.keyIdToKeyInfo[he])return o(this.createKeyLoadError(O,$.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),M));ae.decryptdata.key=O.decryptdata.key=new Uint8Array(g.data),O.keyLoader=null,ae.loader=null,s({frag:O,keyInfo:ae})},onError:(g,E,b,M)=>{this.resetLoader(E),o(this.createKeyLoadError(t,$.KEY_LOAD_ERROR,new Error(`HTTP Error ${g.code} loading key ${g.text}`),b,y({url:c.url,data:void 0},g)))},onTimeout:(g,E,b)=>{this.resetLoader(E),o(this.createKeyLoadError(t,$.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),b))},onAbort:(g,E,b)=>{this.resetLoader(E),o(this.createKeyLoadError(t,$.INTERNAL_ABORTED,new Error("key loading aborted"),b))}};i.load(c,f,d)})}resetLoader(e){const{frag:t,keyInfo:n,url:r}=e,i=n.loader;t.keyLoader===i&&(t.keyLoader=null,n.loader=null);const s=Ka(n.decryptdata)||r;delete this.keyIdToKeyInfo[s],i&&i.destroy()}}function Ka(a){if(a.keyFormat!==er.FAIRPLAY){const e=a.keyId;if(e)return V(e)}return a.uri}function ml(a){const{type:e}=a;switch(e){case ge.AUDIO_TRACK:return le.AUDIO;case ge.SUBTITLE_TRACK:return le.SUBTITLE;default:return le.MAIN}}function Za(a,e){let t=a.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class Gf{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,n=t.pLoader,r=t.loader,i=n||r,s=new i(t);return this.loaders[e.type]=s,s}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:n}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ge.MANIFEST,url:n,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){const{id:n,level:r,pathwayId:i,url:s,deliveryDirectives:o,levelInfo:c}=t;this.load({id:n,level:r,pathwayId:i,responseType:"text",type:ge.LEVEL,url:s,deliveryDirectives:o,levelOrTrack:c})}onAudioTrackLoading(e,t){const{id:n,groupId:r,url:i,deliveryDirectives:s,track:o}=t;this.load({id:n,groupId:r,level:null,responseType:"text",type:ge.AUDIO_TRACK,url:i,deliveryDirectives:s,levelOrTrack:o})}onSubtitleTrackLoading(e,t){const{id:n,groupId:r,url:i,deliveryDirectives:s,track:o}=t;this.load({id:n,groupId:r,level:null,responseType:"text",type:ge.SUBTITLE_TRACK,url:i,deliveryDirectives:s,levelOrTrack:o})}onLevelsUpdated(e,t){const n=this.loaders[ge.LEVEL];if(n){const r=n.context;r&&!t.levels.some(i=>i===r.levelOrTrack)&&(n.abort(),delete this.loaders[ge.LEVEL])}}load(e){var t;const n=this.hls.config;let r=this.getInternalLoader(e);if(r){const u=this.hls.logger,f=r.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}`),r.abort()}let i;if(e.type===ge.MANIFEST?i=n.manifestLoadPolicy.default:i=h({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),L((t=e.deliveryDirectives)==null?void 0:t.part)){let u;if(e.type===ge.LEVEL&&e.level!==null?u=this.hls.levels[e.level].details:e.type===ge.AUDIO_TRACK&&e.id!==null?u=this.hls.audioTracks[e.id].details:e.type===ge.SUBTITLE_TRACK&&e.id!==null&&(u=this.hls.subtitleTracks[e.id].details),u){const f=u.partTarget,d=u.targetduration;if(f&&d){const g=Math.max(f*3,d*.8)*1e3;i=h({},i,{maxTimeToFirstByteMs:Math.min(g,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(g,i.maxTimeToFirstByteMs)})}}}const s=i.errorRetry||i.timeoutRetry||{},o={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0},c={onSuccess:(u,f,d,g)=>{const E=this.getInternalLoader(d);this.resetInternalLoader(d.type);const b=u.data;f.parsing.start=performance.now(),qr.isMediaPlaylist(b)||d.type!==ge.MANIFEST?this.handleTrackOrLevelPlaylist(u,f,d,g||null,E):this.handleMasterPlaylist(u,f,d,g)},onError:(u,f,d,g)=>{this.handleNetworkError(f,d,!1,u,g)},onTimeout:(u,f,d)=>{this.handleNetworkError(f,d,!0,void 0,u)}};r.load(e,o,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:t},forceStartLoad:n}=this.hls;(e||n)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${t}`),this.hls.startLoad(t))}handleMasterPlaylist(e,t,n,r){const i=this.hls,s=e.data,o=Za(e,n),c=qr.parseMasterPlaylist(s,o);if(c.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,n,c.playlistParsingError,r,t);return}const{contentSteering:u,levels:f,sessionData:d,sessionKeys:g,startTimeOffset:E,variableList:b}=c;this.variableList=b,f.forEach(he=>{const{unknownCodecs:_e}=he;if(_e){const{preferManagedMediaSource:Ke}=this.hls.config;let{audioCodec:We,videoCodec:mt}=he;for(let He=_e.length;He--;){const ot=_e[He];Se(ot,"audio",Ke)?(he.audioCodec=We=We?`${We},${ot}`:ot,Ut.audio[We.substring(0,4)]=2,_e.splice(He,1)):Se(ot,"video",Ke)&&(he.videoCodec=mt=mt?`${mt},${ot}`:ot,Ut.video[mt.substring(0,4)]=2,_e.splice(He,1))}}});const{AUDIO:M=[],SUBTITLES:O,"CLOSED-CAPTIONS":ae}=qr.parseMasterPlaylistMedia(s,o,c);M.length&&!M.some(_e=>!_e.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"),M.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new mr({}),bitrate:0,url:""})),i.trigger(p.MANIFEST_LOADED,{levels:f,audioTracks:M,subtitles:O,captions:ae,contentSteering:u,url:o,stats:t,networkDetails:r,sessionData:d,sessionKeys:g,startTimeOffset:E,variableList:b})}handleTrackOrLevelPlaylist(e,t,n,r,i){const s=this.hls,{id:o,level:c,type:u}=n,f=Za(e,n),d=L(c)?c:L(o)?o:0,g=ml(n),E=qr.parseLevelPlaylist(e.data,f,d,g,0,this.variableList);if(u===ge.MANIFEST){const b={attrs:new mr({}),bitrate:0,details:E,name:"",url:f};E.requestScheduled=t.loading.start+Mr(E,0),s.trigger(p.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:f,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),n.levelDetails=E,this.handlePlaylistLoaded(E,e,t,n,r,i)}handleManifestParsingError(e,t,n,r,i){this.hls.trigger(p.ERROR,{type:ue.NETWORK_ERROR,details:$.MANIFEST_PARSING_ERROR,fatal:t.type===ge.MANIFEST,url:e.url,err:n,error:n,reason:n.message,response:e,context:t,networkDetails:r,stats:i})}handleNetworkError(e,t,n=!1,r,i){let s=`A network ${n?"timeout":"error"+(r?" (status "+r.code+")":"")} occurred while loading ${e.type}`;e.type===ge.LEVEL?s+=`: ${e.level} id: ${e.id}`:(e.type===ge.AUDIO_TRACK||e.type===ge.SUBTITLE_TRACK)&&(s+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(s);this.hls.logger.warn(`[playlist-loader]: ${s}`);let c=$.UNKNOWN,u=!1;const f=this.getInternalLoader(e);switch(e.type){case ge.MANIFEST:c=n?$.MANIFEST_LOAD_TIMEOUT:$.MANIFEST_LOAD_ERROR,u=!0;break;case ge.LEVEL:c=n?$.LEVEL_LOAD_TIMEOUT:$.LEVEL_LOAD_ERROR,u=!1;break;case ge.AUDIO_TRACK:c=n?$.AUDIO_TRACK_LOAD_TIMEOUT:$.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case ge.SUBTITLE_TRACK:c=n?$.SUBTITLE_TRACK_LOAD_TIMEOUT:$.SUBTITLE_LOAD_ERROR,u=!1;break}f&&this.resetInternalLoader(e.type);const d={type:ue.NETWORK_ERROR,details:c,fatal:u,url:e.url,loader:f,context:e,error:o,networkDetails:t,stats:i};if(r){const g=(t==null?void 0:t.url)||e.url;d.response=y({url:g,data:void 0},r)}this.hls.trigger(p.ERROR,d)}handlePlaylistLoaded(e,t,n,r,i,s){const o=this.hls,{type:c,level:u,levelOrTrack:f,id:d,groupId:g,deliveryDirectives:E}=r,b=Za(t,r),M=ml(r);let O=typeof r.level=="number"&&M===le.MAIN?u:void 0;const ae=e.playlistParsingError;if(ae){if(this.hls.logger.warn(`${ae} ${e.url}`),!o.config.ignorePlaylistParsingErrors){o.trigger(p.ERROR,{type:ue.NETWORK_ERROR,details:$.LEVEL_PARSING_ERROR,fatal:!1,url:b,error:ae,reason:ae.message,response:t,context:r,level:O,parent:M,networkDetails:i,stats:n});return}e.playlistParsingError=null}if(!e.fragments.length){const he=e.playlistParsingError=new Error("No Segments found in Playlist");o.trigger(p.ERROR,{type:ue.NETWORK_ERROR,details:$.LEVEL_EMPTY_ERROR,fatal:!1,url:b,error:he,reason:he.message,response:t,context:r,level:O,parent:M,networkDetails:i,stats:n});return}switch(e.live&&s&&(s.getCacheAge&&(e.ageHeader=s.getCacheAge()||0),(!s.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case ge.MANIFEST:case ge.LEVEL:if(O){if(!f)O=0;else if(f!==o.levels[O]){const he=o.levels.indexOf(f);he>-1&&(O=he)}}o.trigger(p.LEVEL_LOADED,{details:e,levelInfo:f||o.levels[0],level:O||0,id:d||0,stats:n,networkDetails:i,deliveryDirectives:E,withoutMultiVariant:c===ge.MANIFEST});break;case ge.AUDIO_TRACK:o.trigger(p.AUDIO_TRACK_LOADED,{details:e,track:f,id:d||0,groupId:g||"",stats:n,networkDetails:i,deliveryDirectives:E});break;case ge.SUBTITLE_TRACK:o.trigger(p.SUBTITLE_TRACK_LOADED,{details:e,track:f,id:d||0,groupId:g||"",stats:n,networkDetails:i,deliveryDirectives:E});break}}}class Wi{static get version(){return xs}static isMSESupported(){return gl()}static isSupported(){return Bf()}static getMediaSource(){return ce()}static get Events(){return p}static get MetadataSchema(){return hi}static get ErrorTypes(){return ue}static get ErrorDetails(){return $}static get DefaultConfig(){return Wi.defaultConfig?Wi.defaultConfig:Af}static set DefaultConfig(e){Wi.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 ia,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=te(e.debug||!1,"Hls instance",e.assetPlayerId),n=this.config=Rf(Wi.DefaultConfig,e,t);this.userConfig=e,n.progressive&&Cf(n,t);const{abrController:r,bufferController:i,capLevelController:s,errorController:o,fpsController:c}=n,u=new o(this),f=this.abrController=new r(this),d=new Qt(this),g=n.interstitialsController,E=g?this.interstitialsController=new g(this,Wi):null,b=this.bufferController=new i(this,d),M=this.capLevelController=new s(this),O=new c(this),ae=new Gf(this),he=n.contentSteeringController,_e=he?new he(this):null,Ke=this.levelController=new Nf(this,_e),We=new Mf(this),mt=new Zf(this.config,this.logger),He=this.streamController=new Kf(this,d,mt),ot=this.gapController=new Pf(this,d);M.setStreamController(He),O.setStreamController(He);const at=[ae,Ke,He];E&&at.splice(1,0,E),_e&&at.splice(1,0,_e),this.networkControllers=at;const Je=[f,b,ot,M,O,We,d];this.audioTrackController=this.createController(n.audioTrackController,at);const Nt=n.audioStreamController;Nt&&at.push(this.audioStreamController=new Nt(this,d,mt)),this.subtitleTrackController=this.createController(n.subtitleTrackController,at);const vn=n.subtitleStreamController;vn&&at.push(this.subtititleStreamController=new vn(this,d,mt)),this.createController(n.timelineController,Je),mt.emeController=this.emeController=this.createController(n.emeController,Je),this.cmcdController=this.createController(n.cmcdController,Je),this.latencyController=this.createController(Ff,Je),this.coreComponents=Je,at.push(u);const Rn=u.onErrorOut;typeof Rn=="function"&&this.on(p.ERROR,Rn,u),this.on(p.MANIFEST_LOADED,ae.onManifestLoaded,ae)}createController(e,t){if(e){const n=new e(this);return t&&t.push(n),n}return null}on(e,t,n=this){this._emitter.on(e,t,n)}once(e,t,n=this){this._emitter.once(e,t,n)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,n=this,r){this._emitter.off(e,t,n,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,n){return this._emitter.emit(e,t,n)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(n){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+n.message+'". Here is a stacktrace:',n),!this.triggeringException){this.triggeringException=!0;const r=e===p.ERROR;this.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:$.INTERNAL_EXCEPTION,fatal:r,event:e,error:n}),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 i=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(p.ERROR,{type:ue.OTHER_ERROR,details:$.ATTACH_MEDIA_ERROR,fatal:!0,error:i});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const t="media"in e,n=t?e.media:e,r=t?e:{media:n};this._media=n,this.trigger(p.MEDIA_ATTACHING,r)}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,n=this._url,r=this._url=_.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${r}`),t&&n&&(n!==r||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 n=0;n<this.networkControllers.length&&(this.networkControllers[n].startLoad(e,t),!(!this.started||!this.networkControllers));n++);}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={[le.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[le.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[le.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){xt(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 n=e.length;for(let r=0;r<n;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:n}=this;let r;if(t===-1&&e!=null&&e.length?r=e.length-1:r=t,n)for(let i=r;i--;){const s=e[i].attrs["HDCP-LEVEL"];if(s&&s<=n)return i}return r}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 n=gt(t);return Zt(e,n,navigator.mediaCapabilities)}}Wi.defaultConfig=void 0},16722:function(_n,_t,w){"use strict";w.d(_t,{Z:function(){return le}});const L=l=>typeof l=="object"&&l!=null&&l.nodeType===1,fe=(l,x)=>(!x||l!=="hidden")&&l!=="visible"&&l!=="clip",Te=(l,x)=>{if(l.clientHeight<l.scrollHeight||l.clientWidth<l.scrollWidth){const A=getComputedStyle(l,null);return fe(A.overflowY,x)||fe(A.overflowX,x)||(h=>{const m=(y=>{if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(S){return null}})(h);return!!m&&(m.clientHeight<h.scrollHeight||m.clientWidth<h.scrollWidth)})(l)}return!1},ue=(l,x,A,h,m,y,S,F)=>y<l&&S>x||y>l&&S<x?0:y<=l&&F<=A||S>=x&&F>=A?y-l-h:S>x&&F<A||y<l&&F>A?S-x+m:0,$=l=>{const x=l.parentElement;return x==null?l.getRootNode().host||null:x},p=(l,x)=>{var A,h,m,y;if(typeof document=="undefined")return[];const{scrollMode:S,block:F,inline:Z,boundary:W,skipOverflowHiddenElements:I}=x,N=typeof W=="function"?W:Ze=>Ze!==W;if(!L(l))throw new TypeError("Invalid target");const T=document.scrollingElement||document.documentElement,D=[];let q=l;for(;L(q)&&N(q);){if(q=$(q),q===T){D.push(q);break}q!=null&&q===document.body&&Te(q)&&!Te(document.documentElement)||q!=null&&Te(q,I)&&D.push(q)}const te=(h=(A=window.visualViewport)==null?void 0:A.width)!=null?h:innerWidth,X=(y=(m=window.visualViewport)==null?void 0:m.height)!=null?y:innerHeight,{scrollX:ce,scrollY:we}=window,{height:Pe,width:Ve,top:V,right:C,bottom:G,left:H}=l.getBoundingClientRect(),{top:Q,right:j,bottom:_,left:v}=(Ze=>{const Ye=window.getComputedStyle(Ze);return{top:parseFloat(Ye.scrollMarginTop)||0,right:parseFloat(Ye.scrollMarginRight)||0,bottom:parseFloat(Ye.scrollMarginBottom)||0,left:parseFloat(Ye.scrollMarginLeft)||0}})(l);let P=F==="start"||F==="nearest"?V-Q:F==="end"?G+_:V+Pe/2-Q+_,re=Z==="center"?H+Ve/2-v+j:Z==="end"?C+j:H-v;const Oe=[];for(let Ze=0;Ze<D.length;Ze++){const Ye=D[Ze],{height:qe,width:ft,top:vt,right:Ae,bottom:wt,left:rt}=Ye.getBoundingClientRect();if(S==="if-needed"&&V>=0&&H>=0&&G<=X&&C<=te&&(Ye===T&&!Te(Ye)||V>=vt&&G<=wt&&H>=rt&&C<=Ae))return Oe;const Mt=getComputedStyle(Ye),et=parseInt(Mt.borderLeftWidth,10),ze=parseInt(Mt.borderTopWidth,10),ye=parseInt(Mt.borderRightWidth,10),me=parseInt(Mt.borderBottomWidth,10);let B=0,xe=0;const Le="offsetWidth"in Ye?Ye.offsetWidth-Ye.clientWidth-et-ye:0,K="offsetHeight"in Ye?Ye.offsetHeight-Ye.clientHeight-ze-me:0,R="offsetWidth"in Ye?Ye.offsetWidth===0?0:ft/Ye.offsetWidth:0,ie="offsetHeight"in Ye?Ye.offsetHeight===0?0:qe/Ye.offsetHeight:0;if(T===Ye)B=F==="start"?P:F==="end"?P-X:F==="nearest"?ue(we,we+X,X,ze,me,we+P,we+P+Pe,Pe):P-X/2,xe=Z==="start"?re:Z==="center"?re-te/2:Z==="end"?re-te:ue(ce,ce+te,te,et,ye,ce+re,ce+re+Ve,Ve),B=Math.max(0,B+we),xe=Math.max(0,xe+ce);else{B=F==="start"?P-vt-ze:F==="end"?P-wt+me+K:F==="nearest"?ue(vt,wt,qe,ze,me+K,P,P+Pe,Pe):P-(vt+qe/2)+K/2,xe=Z==="start"?re-rt-et:Z==="center"?re-(rt+ft/2)+Le/2:Z==="end"?re-Ae+ye+Le:ue(rt,Ae,ft,et,ye+Le,re,re+Ve,Ve);const{scrollLeft:be,scrollTop:k}=Ye;B=ie===0?0:Math.max(0,Math.min(k+B/ie,Ye.scrollHeight-qe/ie+K)),xe=R===0?0:Math.max(0,Math.min(be+xe/R,Ye.scrollWidth-ft/R+Le)),P+=k-B,re+=be-xe}Oe.push({el:Ye,top:B,left:xe})}return Oe},ge=l=>l===!1?{block:"end",inline:"nearest"}:(x=>x===Object(x)&&Object.keys(x).length!==0)(l)?l:{block:"start",inline:"nearest"};function le(l,x){if(!l.isConnected||!(m=>{let y=m;for(;y&&y.parentNode;){if(y.parentNode===document)return!0;y=y.parentNode instanceof ShadowRoot?y.parentNode.host:y.parentNode}return!1})(l))return;const A=(m=>{const y=window.getComputedStyle(m);return{top:parseFloat(y.scrollMarginTop)||0,right:parseFloat(y.scrollMarginRight)||0,bottom:parseFloat(y.scrollMarginBottom)||0,left:parseFloat(y.scrollMarginLeft)||0}})(l);if((m=>typeof m=="object"&&typeof m.behavior=="function")(x))return x.behavior(p(l,x));const h=typeof x=="boolean"||x==null?void 0:x.behavior;for(const{el:m,top:y,left:S}of p(l,ge(x))){const F=y-A.top+A.bottom,Z=S-A.left+A.right;m.scroll({top:F,left:Z,behavior:h})}}}}]);
}());