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/9763.feae7cc3.async.js

3206 lines
1.6 MiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

!(function(){var wa=Math.pow;var cl=(Ci,Bt,re)=>new Promise((le,we)=>{var Ze=S=>{try{Z(re.next(S))}catch(Ae){we(Ae)}},pe=S=>{try{Z(re.throw(S))}catch(Ae){we(Ae)}},Z=S=>S.done?le(S.value):Promise.resolve(S.value).then(Ze,pe);Z((re=re.apply(Ci,Bt)).next())});(self.webpackChunk=self.webpackChunk||[]).push([[9763],{65030:function(Ci,Bt,re){"use strict";re.d(Bt,{Z:function(){return ei}});var le=re(27247),we=re(11913),Ze=re(43079),pe=re(43403),Z=re(92310),S=re.n(Z),Ae=re(29301),P=re(76846),f=re(96452),ie=re(6089),R=re(80402),k=re(34280),T=re(49658),C=re(59301),O=re(32855),Q=re(77900),H=re(8654);function q(Ce){var Fe=Ce.prefixCls,me=Ce.align,Ye=Ce.arrow,at=Ce.arrowPos,Xe=Ye||{},Y=Xe.className,ye=Xe.content,Oe=at.x,qe=Oe===void 0?0:Oe,ot=at.y,vt=ot===void 0?0:ot,jt=C.useRef();if(!me||!me.points)return null;var gt={position:"absolute"};if(me.autoArrow!==!1){var Se=me.points[0],yt=me.points[1],Wt=Se[0],Gt=Se[1],Le=yt[0],Me=yt[1];Wt===Le||!["t","b"].includes(Wt)?gt.top=vt:Wt==="t"?gt.top=0:gt.bottom=0,Gt===Me||!["l","r"].includes(Gt)?gt.left=qe:Gt==="l"?gt.left=0:gt.right=0}return C.createElement("div",{ref:jt,className:S()("".concat(Fe,"-arrow"),Y),style:gt},ye)}function K(Ce){var Fe=Ce.prefixCls,me=Ce.open,Ye=Ce.zIndex,at=Ce.mask,Xe=Ce.motion;return at?C.createElement(Q.default,(0,O.Z)({},Xe,{motionAppear:!0,visible:me,removeOnLeave:!0}),function(Y){var ye=Y.className;return C.createElement("div",{style:{zIndex:Ye},className:S()("".concat(Fe,"-mask"),ye)})}):null}var $=C.memo(function(Ce){var Fe=Ce.children;return Fe},function(Ce,Fe){return Fe.cache}),V=$,he=C.forwardRef(function(Ce,Fe){var me=Ce.popup,Ye=Ce.className,at=Ce.prefixCls,Xe=Ce.style,Y=Ce.target,ye=Ce.onVisibleChanged,Oe=Ce.open,qe=Ce.keepDom,ot=Ce.fresh,vt=Ce.onClick,jt=Ce.mask,gt=Ce.arrow,Se=Ce.arrowPos,yt=Ce.align,Wt=Ce.motion,Gt=Ce.maskMotion,Le=Ce.forceRender,Me=Ce.getPopupContainer,rt=Ce.autoDestroy,bt=Ce.portal,je=Ce.zIndex,Mt=Ce.onMouseEnter,Ct=Ce.onMouseLeave,Et=Ce.onPointerEnter,Nt=Ce.onPointerDownCapture,Xt=Ce.ready,Je=Ce.offsetX,zt=Ce.offsetY,De=Ce.offsetR,xe=Ce.offsetB,ke=Ce.onAlign,U=Ce.onPrepare,j=Ce.stretch,ae=Ce.targetWidth,ue=Ce.targetHeight,ve=typeof me=="function"?me():me,ht=Oe||qe,_t=(Me==null?void 0:Me.length)>0,lt=C.useState(!Me||!_t),Vt=(0,we.Z)(lt,2),ni=Vt[0],gi=Vt[1];if((0,k.Z)(function(){!ni&&_t&&Y&&gi(!0)},[ni,_t,Y]),!ni)return null;var ri="auto",Dt={left:"-1000vw",top:"-1000vh",right:ri,bottom:ri};if(Xt||!Oe){var oi,Mi=yt.points,Ei=yt.dynamicInset||((oi=yt._experimental)===null||oi===void 0?void 0:oi.dynamicInset),Oi=Ei&&Mi[0][1]==="r",vi=Ei&&Mi[0][0]==="b";Oi?(Dt.right=De,Dt.left=ri):(Dt.left=Je,Dt.right=ri),vi?(Dt.bottom=xe,Dt.top=ri):(Dt.top=zt,Dt.bottom=ri)}var di={};return j&&(j.includes("height")&&ue?di.height=ue:j.includes("minHeight")&&ue&&(di.minHeight=ue),j.includes("width")&&ae?di.width=ae:j.includes("minWidth")&&ae&&(di.minWidth=ae)),Oe||(di.pointerEvents="none"),C.createElement(bt,{open:Le||ht,getContainer:Me&&function(){return Me(Y)},autoDestroy:rt},C.createElement(K,{prefixCls:at,open:Oe,zIndex:je,mask:jt,motion:Gt}),C.createElement(Ae.Z,{onResize:ke,disabled:!Oe},function(zi){return C.createElement(Q.default,(0,O.Z)({motionAppear:!0,motionEnter:!0,motionLeave:!0,removeOnLeave:!1,forceRender:Le,leavedClassName:"".concat(at,"-hidden")},Wt,{onAppearPrepare:U,onEnterPrepare:U,visible:Oe,onVisibleChanged:function(rn){var Yi;Wt==null||(Yi=Wt.onVisibleChanged)===null||Yi===void 0||Yi.call(Wt,rn),ye(rn)}}),function(Wi,rn){var Yi=Wi.className,Qn=Wi.style,Di=S()(at,Yi,Ye);return C.createElement("div",{ref:(0,H.sQ)(zi,Fe,rn),className:Di,style:(0,le.Z)((0,le.Z)((0,le.Z)((0,le.Z)({"--arrow-x":"".concat(Se.x||0,"px"),"--arrow-y":"".concat(Se.y||0,"px")},Dt),di),Qn),{},{boxSizing:"border-box",zIndex:je},Xe),onMouseEnter:Mt,onMouseLeave:Ct,onPointerEnter:Et,onClick:vt,onPointerDownCapture:Nt},gt&&C.createElement(q,{prefixCls:at,arrow:gt,arrowPos:Se,align:yt}),C.createElement(V,{cache:!Oe&&!ot},ve))})}))}),be=he,Te=C.forwardRef(function(Ce,Fe){var me=Ce.children,Ye=Ce.getTriggerDOMNode,at=(0,H.Yr)(me),Xe=C.useCallback(function(ye){(0,H.mH)(Fe,Ye?Ye(ye):ye)},[Ye]),Y=(0,H.x1)(Xe,(0,H.C4)(me));return at?C.cloneElement(me,{ref:Y}):me}),se=Te,Ee=C.createContext(null),We=Ee;function Ke(Ce){return Ce?Array.isArray(Ce)?Ce:[Ce]:[]}function Rt(Ce,Fe,me,Ye){return C.useMemo(function(){var at=Ke(me!=null?me:Fe),Xe=Ke(Ye!=null?Ye:Fe),Y=new Set(at),ye=new Set(Xe);return Ce&&(Y.has("hover")&&(Y.delete("hover"),Y.add("click")),ye.has("hover")&&(ye.delete("hover"),ye.add("click"))),[Y,ye]},[Ce,Fe,me,Ye])}var te=re(29194);function z(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],Fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],me=arguments.length>2?arguments[2]:void 0;return me?Ce[0]===Fe[0]:Ce[0]===Fe[0]&&Ce[1]===Fe[1]}function X(Ce,Fe,me,Ye){for(var at=me.points,Xe=Object.keys(Ce),Y=0;Y<Xe.length;Y+=1){var ye,Oe=Xe[Y];if(z((ye=Ce[Oe])===null||ye===void 0?void 0:ye.points,at,Ye))return"".concat(Fe,"-placement-").concat(Oe)}return""}function ee(Ce,Fe,me,Ye){return Fe||(me?{motionName:"".concat(Ce,"-").concat(me)}:Ye?{motionName:Ye}:null)}function fe(Ce){return Ce.ownerDocument.defaultView}function ne(Ce){for(var Fe=[],me=Ce==null?void 0:Ce.parentElement,Ye=["hidden","scroll","clip","auto"];me;){var at=fe(me).getComputedStyle(me),Xe=at.overflowX,Y=at.overflowY,ye=at.overflow;[Xe,Y,ye].some(function(Oe){return Ye.includes(Oe)})&&Fe.push(me),me=me.parentElement}return Fe}function A(Ce){var Fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;return Number.isNaN(Ce)?Fe:Ce}function D(Ce){return A(parseFloat(Ce),0)}function G(Ce,Fe){var me=(0,le.Z)({},Ce);return(Fe||[]).forEach(function(Ye){if(!(Ye instanceof HTMLBodyElement||Ye instanceof HTMLHtmlElement)){var at=fe(Ye).getComputedStyle(Ye),Xe=at.overflow,Y=at.overflowClipMargin,ye=at.borderTopWidth,Oe=at.borderBottomWidth,qe=at.borderLeftWidth,ot=at.borderRightWidth,vt=Ye.getBoundingClientRect(),jt=Ye.offsetHeight,gt=Ye.clientHeight,Se=Ye.offsetWidth,yt=Ye.clientWidth,Wt=D(ye),Gt=D(Oe),Le=D(qe),Me=D(ot),rt=A(Math.round(vt.width/Se*1e3)/1e3),bt=A(Math.round(vt.height/jt*1e3)/1e3),je=(Se-yt-Le-Me)*rt,Mt=(jt-gt-Wt-Gt)*bt,Ct=Wt*bt,Et=Gt*bt,Nt=Le*rt,Xt=Me*rt,Je=0,zt=0;if(Xe==="clip"){var De=D(Y);Je=De*rt,zt=De*bt}var xe=vt.x+Nt-Je,ke=vt.y+Ct-zt,U=xe+vt.width+2*Je-Nt-Xt-je,j=ke+vt.height+2*zt-Ct-Et-Mt;me.left=Math.max(me.left,xe),me.top=Math.max(me.top,ke),me.right=Math.min(me.right,U),me.bottom=Math.min(me.bottom,j)}}),me}function de(Ce){var Fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,me="".concat(Fe),Ye=me.match(/^(.*)\%$/);return Ye?Ce*(parseFloat(Ye[1])/100):parseFloat(me)}function ze(Ce,Fe){var me=Fe||[],Ye=(0,we.Z)(me,2),at=Ye[0],Xe=Ye[1];return[de(Ce.width,at),de(Ce.height,Xe)]}function pt(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return[Ce[0],Ce[1]]}function Ut(Ce,Fe){var me=Fe[0],Ye=Fe[1],at,Xe;return me==="t"?Xe=Ce.y:me==="b"?Xe=Ce.y+Ce.height:Xe=Ce.y+Ce.height/2,Ye==="l"?at=Ce.x:Ye==="r"?at=Ce.x+Ce.width:at=Ce.x+Ce.width/2,{x:at,y:Xe}}function Ie(Ce,Fe){var me={t:"b",b:"t",l:"r",r:"l"};return Ce.map(function(Ye,at){return at===Fe?me[Ye]||"c":Ye}).join("")}function qt(Ce,Fe,me,Ye,at,Xe,Y){var ye=C.useState({ready:!1,offsetX:0,offsetY:0,offsetR:0,offsetB:0,arrowX:0,arrowY:0,scaleX:1,scaleY:1,align:at[Ye]||{}}),Oe=(0,we.Z)(ye,2),qe=Oe[0],ot=Oe[1],vt=C.useRef(0),jt=C.useMemo(function(){return Fe?ne(Fe):[]},[Fe]),gt=C.useRef({}),Se=function(){gt.current={}};Ce||Se();var yt=(0,ie.Z)(function(){if(Fe&&me&&Ce){let hr=function(sr,yr){var ys=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mn,bs=ht.x+sr,Ms=ht.y+yr,Vn=bs+vi,mr=Ms+Oi,$s=Math.max(bs,ys.left),ui=Math.max(Ms,ys.top),Li=Math.min(Vn,ys.right),Cn=Math.min(mr,ys.bottom);return Math.max(0,(Li-$s)*(Cn-ui))},zn=function(){Vi=ht.y+Bi,bn=Vi+Oi,xn=ht.x+wi,wn=xn+vi};var Le,Me,rt,bt,je=Fe,Mt=je.ownerDocument,Ct=fe(je),Et=Ct.getComputedStyle(je),Nt=Et.position,Xt=je.style.left,Je=je.style.top,zt=je.style.right,De=je.style.bottom,xe=je.style.overflow,ke=(0,le.Z)((0,le.Z)({},at[Ye]),Xe),U=Mt.createElement("div");(Le=je.parentElement)===null||Le===void 0||Le.appendChild(U),U.style.left="".concat(je.offsetLeft,"px"),U.style.top="".concat(je.offsetTop,"px"),U.style.position=Nt,U.style.height="".concat(je.offsetHeight,"px"),U.style.width="".concat(je.offsetWidth,"px"),je.style.left="0",je.style.top="0",je.style.right="auto",je.style.bottom="auto",je.style.overflow="hidden";var j;if(Array.isArray(me))j={x:me[0],y:me[1],width:0,height:0};else{var ae,ue,ve=me.getBoundingClientRect();ve.x=(ae=ve.x)!==null&&ae!==void 0?ae:ve.left,ve.y=(ue=ve.y)!==null&&ue!==void 0?ue:ve.top,j={x:ve.x,y:ve.y,width:ve.width,height:ve.height}}var ht=je.getBoundingClientRect(),_t=Ct.getComputedStyle(je),lt=_t.height,Vt=_t.width;ht.x=(Me=ht.x)!==null&&Me!==void 0?Me:ht.left,ht.y=(rt=ht.y)!==null&&rt!==void 0?rt:ht.top;var ni=Mt.documentElement,gi=ni.clientWidth,ri=ni.clientHeight,Dt=ni.scrollWidth,oi=ni.scrollHeight,Mi=ni.scrollTop,Ei=ni.scrollLeft,Oi=ht.height,vi=ht.width,di=j.height,zi=j.width,Wi={left:0,top:0,right:gi,bottom:ri},rn={left:-Ei,top:-Mi,right:Dt-Ei,bottom:oi-Mi},Yi=ke.htmlRegion,Qn="visible",Di="visibleFirst";Yi!=="scroll"&&Yi!==Di&&(Yi=Qn);var Ki=Yi===Di,vn=G(rn,jt),Ri=G(Wi,jt),mn=Yi===Qn?Ri:vn,sn=Ki?Ri:mn;je.style.left="auto",je.style.top="auto",je.style.right="0",je.style.bottom="0";var rr=je.getBoundingClientRect();je.style.left=Xt,je.style.top=Je,je.style.right=zt,je.style.bottom=De,je.style.overflow=xe,(bt=je.parentElement)===null||bt===void 0||bt.removeChild(U);var gn=A(Math.round(vi/parseFloat(Vt)*1e3)/1e3),cr=A(Math.round(Oi/parseFloat(lt)*1e3)/1e3);if(gn===0||cr===0||(0,P.Sh)(me)&&!(0,te.Z)(me))return;var Qi=ke.offset,ki=ke.targetOffset,ii=ze(ht,Qi),Re=(0,we.Z)(ii,2),it=Re[0],xt=Re[1],nt=ze(j,ki),At=(0,we.Z)(nt,2),st=At[0],ft=At[1];j.x-=st,j.y-=ft;var Pt=ke.points||[],Jt=(0,we.Z)(Pt,2),pi=Jt[0],Zi=Jt[1],_i=pt(Zi),Fi=pt(pi),Pi=Ut(j,_i),Ni=Ut(ht,Fi),Gi=(0,le.Z)({},ke),wi=Pi.x-Ni.x+it,Bi=Pi.y-Ni.y+xt,un=hr(wi,Bi),$i=hr(wi,Bi,Ri),Ai=Ut(j,["t","l"]),Xi=Ut(ht,["t","l"]),Hi=Ut(j,["b","r"]),en=Ut(ht,["b","r"]),Nn=ke.overflow||{},cn=Nn.adjustX,tn=Nn.adjustY,ji=Nn.shiftX,In=Nn.shiftY,$n=function(yr){return typeof yr=="boolean"?yr:yr>=0},Vi,bn,xn,wn;zn();var gr=$n(tn),an=Fi[0]===_i[0];if(gr&&Fi[0]==="t"&&(bn>sn.bottom||gt.current.bt)){var Ln=Bi;an?Ln-=Oi-di:Ln=Ai.y-en.y-xt;var fr=hr(wi,Ln),Or=hr(wi,Ln,Ri);fr>un||fr===un&&(!Ki||Or>=$i)?(gt.current.bt=!0,Bi=Ln,xt=-xt,Gi.points=[Ie(Fi,0),Ie(_i,0)]):gt.current.bt=!1}if(gr&&Fi[0]==="b"&&(Vi<sn.top||gt.current.tb)){var dr=Bi;an?dr+=Oi-di:dr=Hi.y-Xi.y-xt;var Fr=hr(wi,dr),Dn=hr(wi,dr,Ri);Fr>un||Fr===un&&(!Ki||Dn>=$i)?(gt.current.tb=!0,Bi=dr,xt=-xt,Gi.points=[Ie(Fi,0),Ie(_i,0)]):gt.current.tb=!1}var qn=$n(cn),Ar=Fi[1]===_i[1];if(qn&&Fi[1]==="l"&&(wn>sn.right||gt.current.rl)){var Lr=wi;Ar?Lr-=vi-zi:Lr=Ai.x-en.x-it;var _r=hr(Lr,Bi),Pn=hr(Lr,Bi,Ri);_r>un||_r===un&&(!Ki||Pn>=$i)?(gt.current.rl=!0,wi=Lr,it=-it,Gi.points=[Ie(Fi,1),Ie(_i,1)]):gt.current.rl=!1}if(qn&&Fi[1]==="r"&&(xn<sn.left||gt.current.lr)){var pr=wi;Ar?pr+=vi-zi:pr=Hi.x-Xi.x-it;var Kn=hr(pr,Bi),Br=hr(pr,Bi,Ri);Kn>un||Kn===un&&(!Ki||Br>=$i)?(gt.current.lr=!0,wi=pr,it=-it,Gi.points=[Ie(Fi,1),Ie(_i,1)]):gt.current.lr=!1}zn();var Sn=ji===!0?0:ji;typeof Sn=="number"&&(xn<Ri.left&&(wi-=xn-Ri.left-it,j.x+zi<Ri.left+Sn&&(wi+=j.x-Ri.left+zi-Sn)),wn>Ri.right&&(wi-=wn-Ri.right-it,j.x>Ri.right-Sn&&(wi+=j.x-Ri.right+Sn)));var er=In===!0?0:In;typeof er=="number"&&(Vi<Ri.top&&(Bi-=Vi-Ri.top-xt,j.y+di<Ri.top+er&&(Bi+=j.y-Ri.top+di-er)),bn>Ri.bottom&&(Bi-=bn-Ri.bottom-xt,j.y>Ri.bottom-er&&(Bi+=j.y-Ri.bottom+er)));var kr=ht.x+wi,mi=kr+vi,es=ht.y+Bi,Ji=es+Oi,bi=j.x,nn=bi+zi,En=j.y,vr=En+di,Wn=Math.max(kr,bi),qi=Math.min(mi,nn),Un=(Wn+qi)/2,ls=Un-kr,Dr=Math.max(es,En),us=Math.min(Ji,vr),cs=(Dr+us)/2,rs=cs-es;Y==null||Y(Fe,Gi);var tr=rr.right-ht.x-(wi+ht.width),Wr=rr.bottom-ht.y-(Bi+ht.height);gn===1&&(wi=Math.round(wi),tr=Math.round(tr)),cr===1&&(Bi=Math.round(Bi),Wr=Math.round(Wr));var Nr={ready:!0,offsetX:wi/gn,offsetY:Bi/cr,offsetR:tr/gn,offsetB:Wr/cr,arrowX:ls/gn,arrowY:rs/cr,scaleX:gn,scaleY:cr,align:Gi};ot(Nr)}}),Wt=function(){vt.current+=1;var Me=vt.current;Promise.resolve().then(function(){vt.current===Me&&yt()})},Gt=function(){ot(function(Me){return(0,le.Z)((0,le.Z)({},Me),{},{ready:!1})})};return(0,k.Z)(Gt,[Ye]),(0,k.Z)(function(){Ce||Gt()},[Ce]),[qe.ready,qe.offsetX,qe.offsetY,qe.offsetR,qe.offsetB,qe.arrowX,qe.arrowY,qe.scaleX,qe.scaleY,qe.align,Wt]}var Ot=re(3300);function wt(Ce,Fe,me,Ye,at){(0,k.Z)(function(){if(Ce&&Fe&&me){let vt=function(){Ye(),at()};var Xe=Fe,Y=me,ye=ne(Xe),Oe=ne(Y),qe=fe(Y),ot=new Set([qe].concat((0,Ot.Z)(ye),(0,Ot.Z)(Oe)));return ot.forEach(function(jt){jt.addEventListener("scroll",vt,{passive:!0})}),qe.addEventListener("resize",vt,{passive:!0}),Ye(),function(){ot.forEach(function(jt){jt.removeEventListener("scroll",vt),qe.removeEventListener("resize",vt)})}}},[Ce,Fe,me])}var Ne=re(48736);function tt(Ce,Fe,me,Ye,at,Xe,Y,ye){var Oe=C.useRef(Ce);Oe.current=Ce;var qe=C.useRef(!1);C.useEffect(function(){if(Fe&&Ye&&(!at||Xe)){var vt=function(){qe.current=!1},jt=function(rt){var bt;Oe.current&&!Y(((bt=rt.composedPath)===null||bt===void 0||(bt=bt.call(rt))===null||bt===void 0?void 0:bt[0])||rt.target)&&!qe.current&&ye(!1)},gt=fe(Ye);gt.addEventListener("pointerdown",vt,!0),gt.addEventListener("mousedown",jt,!0),gt.addEventListener("contextmenu",jt,!0);var Se=(0,f.A)(me);if(Se&&(Se.addEventListener("mousedown",jt,!0),Se.addEventListener("contextmenu",jt,!0)),0)var yt,Wt,Gt,Le;return function(){gt.removeEventListener("pointerdown",vt,!0),gt.removeEventListener("mousedown",jt,!0),gt.removeEventListener("contextmenu",jt,!0),Se&&(Se.removeEventListener("mousedown",jt,!0),Se.removeEventListener("contextmenu",jt,!0))}}},[Fe,me,Ye,at,Xe]);function ot(){qe.current=!0}return ot}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 ct(){var Ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pe.Z,Fe=C.forwardRef(function(me,Ye){var at=me.prefixCls,Xe=at===void 0?"rc-trigger-popup":at,Y=me.children,ye=me.action,Oe=ye===void 0?"hover":ye,qe=me.showAction,ot=me.hideAction,vt=me.popupVisible,jt=me.defaultPopupVisible,gt=me.onPopupVisibleChange,Se=me.afterPopupVisibleChange,yt=me.mouseEnterDelay,Wt=me.mouseLeaveDelay,Gt=Wt===void 0?.1:Wt,Le=me.focusDelay,Me=me.blurDelay,rt=me.mask,bt=me.maskClosable,je=bt===void 0?!0:bt,Mt=me.getPopupContainer,Ct=me.forceRender,Et=me.autoDestroy,Nt=me.destroyPopupOnHide,Xt=me.popup,Je=me.popupClassName,zt=me.popupStyle,De=me.popupPlacement,xe=me.builtinPlacements,ke=xe===void 0?{}:xe,U=me.popupAlign,j=me.zIndex,ae=me.stretch,ue=me.getPopupClassNameFromAlign,ve=me.fresh,ht=me.alignPoint,_t=me.onPopupClick,lt=me.onPopupAlign,Vt=me.arrow,ni=me.popupMotion,gi=me.maskMotion,ri=me.popupTransitionName,Dt=me.popupAnimation,oi=me.maskTransitionName,Mi=me.maskAnimation,Ei=me.className,Oi=me.getTriggerDOMNode,vi=(0,Ze.Z)(me,mt),di=Et||Nt||!1,zi=C.useState(!1),Wi=(0,we.Z)(zi,2),rn=Wi[0],Yi=Wi[1];(0,k.Z)(function(){Yi((0,T.Z)())},[]);var Qn=C.useRef({}),Di=C.useContext(We),Ki=C.useMemo(function(){return{registerSubPopup:function(Li,Cn){Qn.current[Li]=Cn,Di==null||Di.registerSubPopup(Li,Cn)}}},[Di]),vn=(0,R.Z)(),Ri=C.useState(null),mn=(0,we.Z)(Ri,2),sn=mn[0],rr=mn[1],gn=C.useRef(null),cr=(0,ie.Z)(function(ui){gn.current=ui,(0,P.Sh)(ui)&&sn!==ui&&rr(ui),Di==null||Di.registerSubPopup(vn,ui)}),Qi=C.useState(null),ki=(0,we.Z)(Qi,2),ii=ki[0],Re=ki[1],it=C.useRef(null),xt=(0,ie.Z)(function(ui){(0,P.Sh)(ui)&&ii!==ui&&(Re(ui),it.current=ui)}),nt=C.Children.only(Y),At=(nt==null?void 0:nt.props)||{},st={},ft=(0,ie.Z)(function(ui){var Li,Cn,ar=ii;return(ar==null?void 0:ar.contains(ui))||((Li=(0,f.A)(ar))===null||Li===void 0?void 0:Li.host)===ui||ui===ar||(sn==null?void 0:sn.contains(ui))||((Cn=(0,f.A)(sn))===null||Cn===void 0?void 0:Cn.host)===ui||ui===sn||Object.values(Qn.current).some(function(kn){return(kn==null?void 0:kn.contains(ui))||ui===kn})}),Pt=ee(Xe,ni,Dt,ri),Jt=ee(Xe,gi,Mi,oi),pi=C.useState(jt||!1),Zi=(0,we.Z)(pi,2),_i=Zi[0],Fi=Zi[1],Pi=vt!=null?vt:_i,Ni=(0,ie.Z)(function(ui){vt===void 0&&Fi(ui)});(0,k.Z)(function(){Fi(vt||!1)},[vt]);var Gi=C.useRef(Pi);Gi.current=Pi;var wi=C.useRef([]);wi.current=[];var Bi=(0,ie.Z)(function(ui){var Li;Ni(ui),((Li=wi.current[wi.current.length-1])!==null&&Li!==void 0?Li:Pi)!==ui&&(wi.current.push(ui),gt==null||gt(ui))}),un=C.useRef(),$i=function(){clearTimeout(un.current)},Ai=function(Li){var Cn=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;$i(),Cn===0?Bi(Li):un.current=setTimeout(function(){Bi(Li)},Cn*1e3)};C.useEffect(function(){return $i},[]);var Xi=C.useState(!1),Hi=(0,we.Z)(Xi,2),en=Hi[0],Nn=Hi[1];(0,k.Z)(function(ui){(!ui||Pi)&&Nn(!0)},[Pi]);var cn=C.useState(null),tn=(0,we.Z)(cn,2),ji=tn[0],In=tn[1],$n=C.useState(null),Vi=(0,we.Z)($n,2),bn=Vi[0],xn=Vi[1],wn=function(Li){xn([Li.clientX,Li.clientY])},gr=qt(Pi,sn,ht&&bn!==null?bn:ii,De,ke,U,lt),an=(0,we.Z)(gr,11),Ln=an[0],fr=an[1],Or=an[2],dr=an[3],Fr=an[4],Dn=an[5],qn=an[6],Ar=an[7],Lr=an[8],_r=an[9],Pn=an[10],pr=Rt(rn,Oe,qe,ot),Kn=(0,we.Z)(pr,2),Br=Kn[0],Sn=Kn[1],er=Br.has("click"),kr=Sn.has("click")||Sn.has("contextMenu"),mi=(0,ie.Z)(function(){en||Pn()}),es=function(){Gi.current&&ht&&kr&&Ai(!1)};wt(Pi,ii,sn,mi,es),(0,k.Z)(function(){mi()},[bn,De]),(0,k.Z)(function(){Pi&&!(ke!=null&&ke[De])&&mi()},[JSON.stringify(U)]);var Ji=C.useMemo(function(){var ui=X(ke,Xe,_r,ht);return S()(ui,ue==null?void 0:ue(_r))},[_r,ue,ke,Xe,ht]);C.useImperativeHandle(Ye,function(){return{nativeElement:it.current,popupElement:gn.current,forceAlign:mi}});var bi=C.useState(0),nn=(0,we.Z)(bi,2),En=nn[0],vr=nn[1],Wn=C.useState(0),qi=(0,we.Z)(Wn,2),Un=qi[0],ls=qi[1],Dr=function(){if(ae&&ii){var Li=ii.getBoundingClientRect();vr(Li.width),ls(Li.height)}},us=function(){Dr(),mi()},cs=function(Li){Nn(!1),Pn(),Se==null||Se(Li)},rs=function(){return new Promise(function(Li){Dr(),In(function(){return Li})})};(0,k.Z)(function(){ji&&(Pn(),ji(),In(null))},[ji]);function tr(ui,Li,Cn,ar){st[ui]=function(kn){var hs;ar==null||ar(kn),Ai(Li,Cn);for(var or=arguments.length,ss=new Array(or>1?or-1:0),jr=1;jr<or;jr++)ss[jr-1]=arguments[jr];(hs=At[ui])===null||hs===void 0||hs.call.apply(hs,[At,kn].concat(ss))}}(er||kr)&&(st.onClick=function(ui){var Li;Gi.current&&kr?Ai(!1):!Gi.current&&er&&(wn(ui),Ai(!0));for(var Cn=arguments.length,ar=new Array(Cn>1?Cn-1:0),kn=1;kn<Cn;kn++)ar[kn-1]=arguments[kn];(Li=At.onClick)===null||Li===void 0||Li.call.apply(Li,[At,ui].concat(ar))});var Wr=tt(Pi,kr,ii,sn,rt,je,ft,Ai),Nr=Br.has("hover"),hr=Sn.has("hover"),zn,sr;Nr&&(tr("onMouseEnter",!0,yt,function(ui){wn(ui)}),tr("onPointerEnter",!0,yt,function(ui){wn(ui)}),zn=function(Li){(Pi||en)&&sn!==null&&sn!==void 0&&sn.contains(Li.target)&&Ai(!0,yt)},ht&&(st.onMouseMove=function(ui){var Li;(Li=At.onMouseMove)===null||Li===void 0||Li.call(At,ui)})),hr&&(tr("onMouseLeave",!1,Gt),tr("onPointerLeave",!1,Gt),sr=function(){Ai(!1,Gt)}),Br.has("focus")&&tr("onFocus",!0,Le),Sn.has("focus")&&tr("onBlur",!1,Me),Br.has("contextMenu")&&(st.onContextMenu=function(ui){var Li;Gi.current&&Sn.has("contextMenu")?Ai(!1):(wn(ui),Ai(!0)),ui.preventDefault();for(var Cn=arguments.length,ar=new Array(Cn>1?Cn-1:0),kn=1;kn<Cn;kn++)ar[kn-1]=arguments[kn];(Li=At.onContextMenu)===null||Li===void 0||Li.call.apply(Li,[At,ui].concat(ar))}),Ei&&(st.className=S()(At.className,Ei));var yr=C.useRef(!1);yr.current||(yr.current=Ct||Pi||en);var ys=(0,le.Z)((0,le.Z)({},At),st),bs={},Ms=["onContextMenu","onClick","onMouseDown","onTouchStart","onMouseEnter","onMouseLeave","onFocus","onBlur"];Ms.forEach(function(ui){vi[ui]&&(bs[ui]=function(){for(var Li,Cn=arguments.length,ar=new Array(Cn),kn=0;kn<Cn;kn++)ar[kn]=arguments[kn];(Li=ys[ui])===null||Li===void 0||Li.call.apply(Li,[ys].concat(ar)),vi[ui].apply(vi,ar)})});var Vn=C.cloneElement(nt,(0,le.Z)((0,le.Z)({},ys),bs)),mr={x:Dn,y:qn},$s=Vt?(0,le.Z)({},Vt!==!0?Vt:{}):null;return C.createElement(C.Fragment,null,C.createElement(Ae.Z,{disabled:!Pi,ref:xt,onResize:us},C.createElement(se,{getTriggerDOMNode:Oi},Vn)),yr.current&&C.createElement(We.Provider,{value:Ki},C.createElement(be,{portal:Ce,ref:cr,prefixCls:Xe,popup:Xt,className:S()(Je,Ji),style:zt,target:ii,onMouseEnter:zn,onMouseLeave:sr,onPointerEnter:zn,zIndex:j,open:Pi,keepDom:en,fresh:ve,onClick:_t,onPointerDownCapture:Wr,mask:rt,motion:Pt,maskMotion:Jt,onVisibleChanged:cs,onPrepare:rs,forceRender:Ct,autoDestroy:di,getPopupContainer:Mt,align:_r,arrow:$s,arrowPos:mr,ready:Ln,offsetX:fr,offsetY:Or,offsetR:dr,offsetB:Fr,onAlign:mi,stretch:ae,targetWidth:En/Ar,targetHeight:Un/Lr})))});return Fe}var ei=ct(pe.Z)},64018:function(){var Ci,Bt,re,le=!1,we,Ze;window.PR_SHOULD_USE_CONTINUATION=!0;var pe,Z;(function(){var S=window,Ae=["break,continue,do,else,for,if,return,while"],P=[Ae,"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"],f=[P,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],ie=[f,"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"],R=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],k=[f,"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"],T="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",C=[f,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],O="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",Q=[Ae,"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"],H=[Ae,"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"],q=[Ae,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=[ie,k,R,C,O,Q,H,q],$=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,V="str",he="kwd",be="com",Te="typ",se="lit",Ee="pun",We="pln",Ke="tag",Rt="dec",te="src",z="atn",X="atv",ee="nocode",fe="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function ne(Fe){for(var me=0,Ye=!1,at=!1,Xe=0,Y=Fe.length;Xe<Y;++Xe){var ye=Fe[Xe];if(ye.ignoreCase)at=!0;else if(/[a-z]/i.test(ye.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ye=!0,at=!1;break}}var Oe={b:8,t:9,n:10,v:11,f:12,r:13};function qe(Se){var yt=Se.charCodeAt(0);if(yt!==92)return yt;var Wt=Se.charAt(1);return yt=Oe[Wt],yt||("0"<=Wt&&Wt<="7"?parseInt(Se.substring(1),8):Wt==="u"||Wt==="x"?parseInt(Se.substring(2),16):Se.charCodeAt(1))}function ot(Se){if(Se<32)return(Se<16?"\\x0":"\\x")+Se.toString(16);var yt=String.fromCharCode(Se);return yt==="\\"||yt==="-"||yt==="]"||yt==="^"?"\\"+yt:yt}function vt(Se){var yt=Se.substring(1,Se.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")),Wt=[],Gt=yt[0]==="^",Le=["["];Gt&&Le.push("^");for(var Me=Gt?1:0,rt=yt.length;Me<rt;++Me){var bt=yt[Me];if(/\\[bdsw]/i.test(bt))Le.push(bt);else{var je=qe(bt),Mt;Me+2<rt&&yt[Me+1]==="-"?(Mt=qe(yt[Me+2]),Me+=2):Mt=je,Wt.push([je,Mt]),Mt<65||je>122||(Mt<65||je>90||Wt.push([Math.max(65,je)|32,Math.min(Mt,90)|32]),Mt<97||je>122||Wt.push([Math.max(97,je)&-33,Math.min(Mt,122)&-33]))}}Wt.sort(function(Xt,Je){return Xt[0]-Je[0]||Je[1]-Xt[1]});for(var Ct=[],Et=[],Me=0;Me<Wt.length;++Me){var Nt=Wt[Me];Nt[0]<=Et[1]+1?Et[1]=Math.max(Et[1],Nt[1]):Ct.push(Et=Nt)}for(var Me=0;Me<Ct.length;++Me){var Nt=Ct[Me];Le.push(ot(Nt[0])),Nt[1]>Nt[0]&&(Nt[1]+1>Nt[0]&&Le.push("-"),Le.push(ot(Nt[1])))}return Le.push("]"),Le.join("")}function jt(Se){for(var yt=Se.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")),Wt=yt.length,Gt=[],Le=0,Me=0;Le<Wt;++Le){var rt=yt[Le];if(rt==="(")++Me;else if(rt.charAt(0)==="\\"){var bt=+rt.substring(1);bt&&(bt<=Me?Gt[bt]=-1:yt[Le]=ot(bt))}}for(var Le=1;Le<Gt.length;++Le)Gt[Le]===-1&&(Gt[Le]=++me);for(var Le=0,Me=0;Le<Wt;++Le){var rt=yt[Le];if(rt==="(")++Me,Gt[Me]||(yt[Le]="(?:");else if(rt.charAt(0)==="\\"){var bt=+rt.substring(1);bt&&bt<=Me&&(yt[Le]="\\"+Gt[bt])}}for(var Le=0;Le<Wt;++Le)yt[Le]==="^"&&yt[Le+1]!=="^"&&(yt[Le]="");if(Se.ignoreCase&&Ye)for(var Le=0;Le<Wt;++Le){var rt=yt[Le],je=rt.charAt(0);rt.length>=2&&je==="["?yt[Le]=vt(rt):je!=="\\"&&(yt[Le]=rt.replace(/[a-zA-Z]/g,function(Et){var Nt=Et.charCodeAt(0);return"["+String.fromCharCode(Nt&-33,Nt|32)+"]"}))}return yt.join("")}for(var gt=[],Xe=0,Y=Fe.length;Xe<Y;++Xe){var ye=Fe[Xe];if(ye.global||ye.multiline)throw new Error(""+ye);gt.push("(?:"+jt(ye)+")")}return new RegExp(gt.join("|"),at?"gi":"g")}function A(Fe,me){var Ye=/(?:^|\s)nocode(?:\s|$)/,at=[],Xe=0,Y=[],ye=0;function Oe(qe){var ot=qe.nodeType;if(ot==1){if(Ye.test(qe.className))return;for(var vt=qe.firstChild;vt;vt=vt.nextSibling)Oe(vt);var jt=qe.nodeName.toLowerCase();(jt==="br"||jt==="li")&&(at[ye]=`
`,Y[ye<<1]=Xe++,Y[ye++<<1|1]=qe)}else if(ot==3||ot==4){var gt=qe.nodeValue;gt.length&&(me?gt=gt.replace(/\r\n?/g,`
`):gt=gt.replace(/[ \t\r\n]+/g," "),at[ye]=gt,Y[ye<<1]=Xe,Xe+=gt.length,Y[ye++<<1|1]=qe)}}return Oe(Fe),{sourceCode:at.join("").replace(/\n$/,""),spans:Y}}function D(Fe,me,Ye,at,Xe){if(Ye){var Y={sourceNode:Fe,pre:1,langExtension:null,numberLines:null,sourceCode:Ye,spans:null,basePos:me,decorations:null};at(Y),Xe.push.apply(Xe,Y.decorations)}}var G=/\S/;function de(Fe){for(var me=void 0,Ye=Fe.firstChild;Ye;Ye=Ye.nextSibling){var at=Ye.nodeType;me=at===1?me?Fe:Ye:at===3&&G.test(Ye.nodeValue)?Fe:me}return me===Fe?void 0:me}function ze(Fe,me){var Ye={},at;(function(){for(var ye=Fe.concat(me),Oe=[],qe={},ot=0,vt=ye.length;ot<vt;++ot){var jt=ye[ot],gt=jt[3];if(gt)for(var Se=gt.length;--Se>=0;)Ye[gt.charAt(Se)]=jt;var yt=jt[1],Wt=""+yt;qe.hasOwnProperty(Wt)||(Oe.push(yt),qe[Wt]=null)}Oe.push(/[\0-\uffff]/),at=ne(Oe)})();var Xe=me.length,Y=function(ye){for(var Oe=ye.sourceCode,qe=ye.basePos,ot=ye.sourceNode,vt=[qe,We],jt=0,gt=Oe.match(at)||[],Se={},yt=0,Wt=gt.length;yt<Wt;++yt){var Gt=gt[yt],Le=Se[Gt],Me=void 0,rt;if(typeof Le=="string")rt=!1;else{var bt=Ye[Gt.charAt(0)];if(bt)Me=Gt.match(bt[1]),Le=bt[0];else{for(var je=0;je<Xe;++je)if(bt=me[je],Me=Gt.match(bt[1]),Me){Le=bt[0];break}Me||(Le=We)}rt=Le.length>=5&&Le.substring(0,5)==="lang-",rt&&!(Me&&typeof Me[1]=="string")&&(rt=!1,Le=te),rt||(Se[Gt]=Le)}var Mt=jt;if(jt+=Gt.length,!rt)vt.push(qe+Mt,Le);else{var Ct=Me[1],Et=Gt.indexOf(Ct),Nt=Et+Ct.length;Me[2]&&(Nt=Gt.length-Me[2].length,Et=Nt-Ct.length);var Xt=Le.substring(5);D(ot,qe+Mt,Gt.substring(0,Et),Y,vt),D(ot,qe+Mt+Et,Ct,Ne(Xt,Ct),vt),D(ot,qe+Mt+Nt,Gt.substring(Nt),Y,vt)}}ye.decorations=vt};return Y}function pt(Fe){var me=[],Ye=[];Fe.tripleQuotedStrings?me.push([V,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Fe.multiLineStrings?me.push([V,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):me.push([V,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Fe.verbatimStrings&&Ye.push([V,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var at=Fe.hashComments;at&&(Fe.cStyleComments?(at>1?me.push([be,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):me.push([be,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ye.push([V,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):me.push([be,/^#[^\r\n]*/,null,"#"])),Fe.cStyleComments&&(Ye.push([be,/^\/\/[^\r\n]*/,null]),Ye.push([be,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Xe=Fe.regexLiterals;if(Xe){var Y=Xe>1?"":`
\r`,ye=Y?".":"[\\S\\s]",Oe="/(?=[^/*"+Y+"])(?:[^/\\x5B\\x5C"+Y+"]|\\x5C"+ye+"|\\x5B(?:[^\\x5C\\x5D"+Y+"]|\\x5C"+ye+")*(?:\\x5D|$))+/";Ye.push(["lang-regex",RegExp("^"+fe+"("+Oe+")")])}var qe=Fe.types;qe&&Ye.push([Te,qe]);var ot=(""+Fe.keywords).replace(/^ | $/g,"");ot.length&&Ye.push([he,new RegExp("^(?:"+ot.replace(/[\s,]+/g,"|")+")\\b"),null]),me.push([We,/^\s+/,null,` \r
\xA0`]);var vt="^.[^\\s\\w.$@'\"`/\\\\]*";return Fe.regexLiterals&&(vt+="(?!s*/)"),Ye.push([se,/^@[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],[se,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[We,/^\\[\s\S]?/,null],[Ee,new RegExp(vt),null]),ze(me,Ye)}var Ut=pt({keywords:K,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ie(Fe,me,Ye){for(var at=/(?:^|\s)nocode(?:\s|$)/,Xe=/\r\n?|\n/,Y=Fe.ownerDocument,ye=Y.createElement("li");Fe.firstChild;)ye.appendChild(Fe.firstChild);var Oe=[ye];function qe(yt){var Wt=yt.nodeType;if(Wt==1&&!at.test(yt.className))if(yt.nodeName==="br")ot(yt),yt.parentNode&&yt.parentNode.removeChild(yt);else for(var Gt=yt.firstChild;Gt;Gt=Gt.nextSibling)qe(Gt);else if((Wt==3||Wt==4)&&Ye){var Le=yt.nodeValue,Me=Le.match(Xe);if(Me){var rt=Le.substring(0,Me.index);yt.nodeValue=rt;var bt=Le.substring(Me.index+Me[0].length);if(bt){var je=yt.parentNode;je.insertBefore(Y.createTextNode(bt),yt.nextSibling)}ot(yt),rt||yt.parentNode.removeChild(yt)}}}function ot(yt){for(;!yt.nextSibling;)if(yt=yt.parentNode,!yt)return;function Wt(Me,rt){var bt=rt?Me.cloneNode(!1):Me,je=Me.parentNode;if(je){var Mt=Wt(je,1),Ct=Me.nextSibling;Mt.appendChild(bt);for(var Et=Ct;Et;Et=Ct)Ct=Et.nextSibling,Mt.appendChild(Et)}return bt}for(var Gt=Wt(yt.nextSibling,0),Le;(Le=Gt.parentNode)&&Le.nodeType===1;)Gt=Le;Oe.push(Gt)}for(var vt=0;vt<Oe.length;++vt)qe(Oe[vt]);me===(me|0)&&Oe[0].setAttribute("value",me);var jt=Y.createElement("ol");jt.className="linenums";for(var gt=Math.max(0,me-1|0)||0,vt=0,Se=Oe.length;vt<Se;++vt)ye=Oe[vt],ye.className="L"+(vt+gt)%10,ye.firstChild||ye.appendChild(Y.createTextNode("\xA0")),jt.appendChild(ye);Fe.appendChild(jt)}function qt(Fe){var me=/\bMSIE\s(\d+)/.exec(navigator.userAgent);me=me&&+me[1]<=8;var Ye=/\n/g,at=Fe.sourceCode,Xe=at.length,Y=0,ye=Fe.spans,Oe=ye.length,qe=0,ot=Fe.decorations,vt=ot.length,jt=0;ot[vt]=Xe;var gt,Se;for(Se=gt=0;Se<vt;)ot[Se]!==ot[Se+2]?(ot[gt++]=ot[Se++],ot[gt++]=ot[Se++]):Se+=2;for(vt=gt,Se=gt=0;Se<vt;){for(var yt=ot[Se],Wt=ot[Se+1],Gt=Se+2;Gt+2<=vt&&ot[Gt+1]===Wt;)Gt+=2;ot[gt++]=yt,ot[gt++]=Wt,Se=Gt}vt=ot.length=gt;var Le=Fe.sourceNode,Me="";Le&&(Me=Le.style.display,Le.style.display="none");try{for(var rt=null;qe<Oe;){var bt=ye[qe],je=ye[qe+2]||Xe,Mt=ot[jt+2]||Xe,Gt=Math.min(je,Mt),Ct=ye[qe+1],Et;if(Ct.nodeType!==1&&(Et=at.substring(Y,Gt))){me&&(Et=Et.replace(Ye,"\r")),Ct.nodeValue=Et;var Nt=Ct.ownerDocument,Xt=Nt.createElement("span");Xt.className=ot[jt+1];var Je=Ct.parentNode;Je.replaceChild(Xt,Ct),Xt.appendChild(Ct),Y<je&&(ye[qe+1]=Ct=Nt.createTextNode(at.substring(Gt,je)),Je.insertBefore(Ct,Xt.nextSibling))}Y=Gt,Y>=je&&(qe+=2),Y>=Mt&&(jt+=2)}}finally{Le&&(Le.style.display=Me)}}var Ot={};function wt(Fe,me){for(var Ye=me.length;--Ye>=0;){var at=me[Ye];Ot.hasOwnProperty(at)?S.console&&console.warn("cannot override language handler %s",at):Ot[at]=Fe}}function Ne(Fe,me){return Fe&&Ot.hasOwnProperty(Fe)||(Fe=/^\s*</.test(me)?"default-markup":"default-code"),Ot[Fe]}wt(Ut,["default-code"]),wt(ze([],[[We,/^[^<?]+/],[Rt,/^<!\w[^>]*(?:>|$)/],[be,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[Ee,/^(?:<[%?]|[%?]>)/],["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"]),wt(ze([[We,/^[\s]+/,null,` \r
`],[X,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[Ke,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[z,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[Ee,/^[=<>\/]+/],["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"]),wt(ze([],[[X,/^[\s\S]+/]]),["uq.val"]),wt(pt({keywords:ie,hashComments:!0,cStyleComments:!0,types:$}),["c","cc","cpp","cxx","cyc","m"]),wt(pt({keywords:"null,true,false"}),["json"]),wt(pt({keywords:k,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:$}),["cs"]),wt(pt({keywords:R,cStyleComments:!0}),["java"]),wt(pt({keywords:q,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),wt(pt({keywords:Q,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),wt(pt({keywords:O,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),wt(pt({keywords:H,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),wt(pt({keywords:C,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),wt(pt({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),wt(ze([],[[V,/^[\s\S]+/]]),["regex"]);function tt(Fe){var me=Fe.langExtension;try{var Ye=A(Fe.sourceNode,Fe.pre),at=Ye.sourceCode;Fe.sourceCode=at,Fe.spans=Ye.spans,Fe.basePos=0,Ne(me,at)(Fe),qt(Fe)}catch(Xe){S.console&&console.log(Xe&&Xe.stack||Xe)}}function mt(Fe,me,Ye){var at=Ye||!1,Xe=me||null,Y=document.createElement("div");Y.innerHTML="<pre>"+Fe+"</pre>",Y=Y.firstChild,at&&Ie(Y,at,!0);var ye={langExtension:Xe,numberLines:at,sourceNode:Y,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return tt(ye),Y.innerHTML}function ct(Fe,me){var Ye=me||document.body,at=Ye.ownerDocument||document;function Xe(bt){return Ye.getElementsByTagName(bt)}for(var Y=[Xe("pre"),Xe("code"),Xe("xmp")],ye=[],Oe=0;Oe<Y.length;++Oe)for(var qe=0,ot=Y[Oe].length;qe<ot;++qe)ye.push(Y[Oe][qe]);Y=null;var vt=Date;vt.now||(vt={now:function(){return+new Date}});var jt=0,gt=/\blang(?:uage)?-([\w.]+)(?!\S)/,Se=/\bprettyprint\b/,yt=/\bprettyprinted\b/,Wt=/pre|xmp/i,Gt=/^code$/i,Le=/^(?:pre|code|xmp)$/i,Me={};function rt(){for(var bt=S.PR_SHOULD_USE_CONTINUATION?vt.now()+250:1/0;jt<ye.length&&vt.now()<bt;jt++){for(var je=ye[jt],Mt=Me,Ct=je;Ct=Ct.previousSibling;){var Et=Ct.nodeType,Nt=(Et===7||Et===8)&&Ct.nodeValue;if(Nt?!/^\??prettify\b/.test(Nt):Et!==3||/\S/.test(Ct.nodeValue))break;if(Nt){Mt={},Nt.replace(/\b(\w+)=([\w:.%+-]+)/g,function(_t,lt,Vt){Mt[lt]=Vt});break}}var Xt=je.className;if((Mt!==Me||Se.test(Xt))&&!yt.test(Xt)){for(var Je=!1,zt=je.parentNode;zt;zt=zt.parentNode){var De=zt.tagName;if(Le.test(De)&&zt.className&&Se.test(zt.className)){Je=!0;break}}if(!Je){je.className+=" prettyprinted";var xe=Mt.lang;if(!xe){xe=Xt.match(gt);var ke;!xe&&(ke=de(je))&&Gt.test(ke.tagName)&&(xe=ke.className.match(gt)),xe&&(xe=xe[1])}var U;if(Wt.test(je.tagName))U=1;else{var j=je.currentStyle,ae=at.defaultView,ue=j?j.whiteSpace:ae&&ae.getComputedStyle?ae.getComputedStyle(je,null).getPropertyValue("white-space"):0;U=ue&&ue.substring(0,3)==="pre"}var ve=Mt.linenums;(ve=ve==="true"||+ve)||(ve=Xt.match(/\blinenums\b(?::(\d+))?/),ve=ve?ve[1]&&ve[1].length?+ve[1]:!0:!1),ve&&Ie(je,ve,U);var ht={langExtension:xe,sourceNode:je,numberLines:ve,pre:U,sourceCode:null,basePos:null,spans:null,decorations:null};tt(ht)}}}jt<ye.length?S.setTimeout(rt,250):typeof Fe=="function"&&Fe()}rt()}var ei=S.PR={createSimpleLexer:ze,registerLangHandler:wt,sourceDecorator:pt,PR_ATTRIB_NAME:z,PR_ATTRIB_VALUE:X,PR_COMMENT:be,PR_DECLARATION:Rt,PR_KEYWORD:he,PR_LITERAL:se,PR_NOCODE:ee,PR_PLAIN:We,PR_PUNCTUATION:Ee,PR_SOURCE:te,PR_STRING:V,PR_TAG:Ke,PR_TYPE:Te,prettyPrintOne:le?S.prettyPrintOne=mt:pe=mt,prettyPrint:Z=le?S.prettyPrint=ct:Z=ct},Ce=S.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return ei})})()},25769:function(Ci,Bt,re){"use strict";var le=re(98040),we={"text/plain":"Text","text/html":"Url",default:"Text"},Ze="Copy to clipboard: #{key}, Enter";function pe(S){var Ae=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return S.replace(/#{\s*key\s*}/g,Ae)}function Z(S,Ae){var P,f,ie,R,k,T,C=!1;Ae||(Ae={}),P=Ae.debug||!1;try{ie=le(),R=document.createRange(),k=document.getSelection(),T=document.createElement("span"),T.textContent=S,T.ariaHidden="true",T.style.all="unset",T.style.position="fixed",T.style.top=0,T.style.clip="rect(0, 0, 0, 0)",T.style.whiteSpace="pre",T.style.webkitUserSelect="text",T.style.MozUserSelect="text",T.style.msUserSelect="text",T.style.userSelect="text",T.addEventListener("copy",function(Q){if(Q.stopPropagation(),Ae.format)if(Q.preventDefault(),typeof Q.clipboardData=="undefined"){P&&console.warn("unable to use e.clipboardData"),P&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var H=we[Ae.format]||we.default;window.clipboardData.setData(H,S)}else Q.clipboardData.clearData(),Q.clipboardData.setData(Ae.format,S);Ae.onCopy&&(Q.preventDefault(),Ae.onCopy(Q.clipboardData))}),document.body.appendChild(T),R.selectNodeContents(T),k.addRange(R);var O=document.execCommand("copy");if(!O)throw new Error("copy command was unsuccessful");C=!0}catch(Q){P&&console.error("unable to copy using execCommand: ",Q),P&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(Ae.format||"text",S),Ae.onCopy&&Ae.onCopy(window.clipboardData),C=!0}catch(H){P&&console.error("unable to copy using clipboardData: ",H),P&&console.error("falling back to prompt"),f=pe("message"in Ae?Ae.message:Ze),window.prompt(f,S)}}finally{k&&(typeof k.removeRange=="function"?k.removeRange(R):k.removeAllRanges()),T&&document.body.removeChild(T),ie()}return C}Ci.exports=Z},53184:function(Ci,Bt,re){"use strict";var le,we;function Ze(pe,Z,S){var Ae=function(P,f){return pe.js_beautify(P,f)};return Ae.js=pe.js_beautify,Ae.css=Z.css_beautify,Ae.html=S.html_beautify,Ae.js_beautify=pe.js_beautify,Ae.css_beautify=Z.css_beautify,Ae.html_beautify=S.html_beautify,Ae}le=[re(58553),re(87804),re(40998)],we=function(pe,Z,S){return Ze(pe,Z,S)}.apply(Bt,le),we!==void 0&&(Ci.exports=we)},87804:function(Ci,Bt){var re,le;(function(){var we;(function(){"use strict";var pe=[,,function(P){function f(k){this.__parent=k,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=[]}f.prototype.clone_empty=function(){var k=new f(this.__parent);return k.set_indent(this.__indent_count,this.__alignment_count),k},f.prototype.item=function(k){return k<0?this.__items[this.__items.length+k]:this.__items[k]},f.prototype.has_match=function(k){for(var T=this.__items.length-1;T>=0;T--)if(this.__items[T].match(k))return!0;return!1},f.prototype.set_indent=function(k,T){this.is_empty()&&(this.__indent_count=k||0,this.__alignment_count=T||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},f.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)},f.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},f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var k=this.__parent.current_line;return k.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),k.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),k.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,k.__items[0]===" "&&(k.__items.splice(0,1),k.__character_count-=1),!0}return!1},f.prototype.is_empty=function(){return this.__items.length===0},f.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},f.prototype.push=function(k){this.__items.push(k);var T=k.lastIndexOf(`
`);T!==-1?this.__character_count=k.length-T:this.__character_count+=k.length},f.prototype.pop=function(){var k=null;return this.is_empty()||(k=this.__items.pop(),this.__character_count-=k.length),k},f.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},f.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},f.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},f.prototype.toString=function(){var k="";return this.is_empty()?this.__parent.indent_empty_lines&&(k=this.__parent.get_indent_string(this.__indent_count)):(k=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),k+=this.__items.join("")),k};function ie(k,T){this.__cache=[""],this.__indent_size=k.indent_size,this.__indent_string=k.indent_char,k.indent_with_tabs||(this.__indent_string=new Array(k.indent_size+1).join(k.indent_char)),T=T||"",k.indent_level>0&&(T=new Array(k.indent_level+1).join(this.__indent_string)),this.__base_string=T,this.__base_string_length=T.length}ie.prototype.get_indent_size=function(k,T){var C=this.__base_string_length;return T=T||0,k<0&&(C=0),C+=k*this.__indent_size,C+=T,C},ie.prototype.get_indent_string=function(k,T){var C=this.__base_string;return T=T||0,k<0&&(k=0,C=""),T+=k*this.__indent_size,this.__ensure_cache(T),C+=this.__cache[T],C},ie.prototype.__ensure_cache=function(k){for(;k>=this.__cache.length;)this.__add_column()},ie.prototype.__add_column=function(){var k=this.__cache.length,T=0,C="";this.__indent_size&&k>=this.__indent_size&&(T=Math.floor(k/this.__indent_size),k-=T*this.__indent_size,C=new Array(T+1).join(this.__indent_string)),k&&(C+=new Array(k+1).join(" ")),this.__cache.push(C)};function R(k,T){this.__indent_cache=new ie(k,T),this.raw=!1,this._end_with_newline=k.end_with_newline,this.indent_size=k.indent_size,this.wrap_line_length=k.wrap_line_length,this.indent_empty_lines=k.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new f(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}R.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},R.prototype.get_line_number=function(){return this.__lines.length},R.prototype.get_indent_string=function(k,T){return this.__indent_cache.get_indent_string(k,T)},R.prototype.get_indent_size=function(k,T){return this.__indent_cache.get_indent_size(k,T)},R.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},R.prototype.add_new_line=function(k){return this.is_empty()||!k&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},R.prototype.get_code=function(k){this.trim(!0);var T=this.current_line.pop();T&&(T[T.length-1]===`
`&&(T=T.replace(/\n+$/g,"")),this.current_line.push(T)),this._end_with_newline&&this.__add_outputline();var C=this.__lines.join(`
`);return k!==`
`&&(C=C.replace(/[\n]/g,k)),C},R.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},R.prototype.set_indent=function(k,T){return k=k||0,T=T||0,this.next_line.set_indent(k,T),this.__lines.length>1?(this.current_line.set_indent(k,T),!0):(this.current_line.set_indent(),!1)},R.prototype.add_raw_token=function(k){for(var T=0;T<k.newlines;T++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(k.whitespace_before),this.current_line.push(k.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},R.prototype.add_token=function(k){this.__add_space_before_token(),this.current_line.push(k),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},R.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(" "))},R.prototype.remove_indent=function(k){for(var T=this.__lines.length;k<T;)this.__lines[k]._remove_indent(),k++;this.current_line._remove_wrap_indent()},R.prototype.trim=function(k){for(k=k===void 0?!1:k,this.current_line.trim();k&&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},R.prototype.just_added_newline=function(){return this.current_line.is_empty()},R.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},R.prototype.ensure_empty_line_above=function(k,T){for(var C=this.__lines.length-2;C>=0;){var O=this.__lines[C];if(O.is_empty())break;if(O.item(0).indexOf(k)!==0&&O.item(-1)!==T){this.__lines.splice(C+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}C--}},P.exports.Output=R},,,,function(P){function f(k,T){this.raw_options=ie(k,T),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"])}f.prototype._get_array=function(k,T){var C=this.raw_options[k],O=T||[];return typeof C=="object"?C!==null&&typeof C.concat=="function"&&(O=C.concat()):typeof C=="string"&&(O=C.split(/[^a-zA-Z0-9_\/\-]+/)),O},f.prototype._get_boolean=function(k,T){var C=this.raw_options[k],O=C===void 0?!!T:!!C;return O},f.prototype._get_characters=function(k,T){var C=this.raw_options[k],O=T||"";return typeof C=="string"&&(O=C.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),O},f.prototype._get_number=function(k,T){var C=this.raw_options[k];T=parseInt(T,10),isNaN(T)&&(T=0);var O=parseInt(C,10);return isNaN(O)&&(O=T),O},f.prototype._get_selection=function(k,T,C){var O=this._get_selection_list(k,T,C);if(O.length!==1)throw new Error("Invalid Option Value: The option '"+k+`' can only be one of the following values:
`+T+`
You passed in: '`+this.raw_options[k]+"'");return O[0]},f.prototype._get_selection_list=function(k,T,C){if(!T||T.length===0)throw new Error("Selection list cannot be empty.");if(C=C||[T[0]],!this._is_valid_selection(C,T))throw new Error("Invalid Default Value!");var O=this._get_array(k,C);if(!this._is_valid_selection(O,T))throw new Error("Invalid Option Value: The option '"+k+`' can contain only the following values:
`+T+`
You passed in: '`+this.raw_options[k]+"'");return O},f.prototype._is_valid_selection=function(k,T){return k.length&&T.length&&!k.some(function(C){return T.indexOf(C)===-1})};function ie(k,T){var C={};k=R(k);var O;for(O in k)O!==T&&(C[O]=k[O]);if(T&&k[T])for(O in k[T])C[O]=k[T][O];return C}function R(k){var T={},C;for(C in k){var O=C.replace(/-/g,"_");T[O]=k[C]}return T}P.exports.Options=f,P.exports.normalizeOpts=R,P.exports.mergeOpts=ie},,function(P){var f=RegExp.prototype.hasOwnProperty("sticky");function ie(R){this.__input=R||"",this.__input_length=this.__input.length,this.__position=0}ie.prototype.restart=function(){this.__position=0},ie.prototype.back=function(){this.__position>0&&(this.__position-=1)},ie.prototype.hasNext=function(){return this.__position<this.__input_length},ie.prototype.next=function(){var R=null;return this.hasNext()&&(R=this.__input.charAt(this.__position),this.__position+=1),R},ie.prototype.peek=function(R){var k=null;return R=R||0,R+=this.__position,R>=0&&R<this.__input_length&&(k=this.__input.charAt(R)),k},ie.prototype.__match=function(R,k){R.lastIndex=k;var T=R.exec(this.__input);return T&&!(f&&R.sticky)&&T.index!==k&&(T=null),T},ie.prototype.test=function(R,k){return k=k||0,k+=this.__position,k>=0&&k<this.__input_length?!!this.__match(R,k):!1},ie.prototype.testChar=function(R,k){var T=this.peek(k);return R.lastIndex=0,T!==null&&R.test(T)},ie.prototype.match=function(R){var k=this.__match(R,this.__position);return k?this.__position+=k[0].length:k=null,k},ie.prototype.read=function(R,k,T){var C="",O;return R&&(O=this.match(R),O&&(C+=O[0])),k&&(O||!R)&&(C+=this.readUntil(k,T)),C},ie.prototype.readUntil=function(R,k){var T="",C=this.__position;R.lastIndex=this.__position;var O=R.exec(this.__input);return O?(C=O.index,k&&(C+=O[0].length)):C=this.__input_length,T=this.__input.substring(this.__position,C),this.__position=C,T},ie.prototype.readUntilAfter=function(R){return this.readUntil(R,!0)},ie.prototype.get_regexp=function(R,k){var T=null,C="g";return k&&f&&(C="y"),typeof R=="string"&&R!==""?T=new RegExp(R,C):R&&(T=new RegExp(R.source,C)),T},ie.prototype.get_literal_regexp=function(R){return RegExp(R.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},ie.prototype.peekUntilAfter=function(R){var k=this.__position,T=this.readUntilAfter(R);return this.__position=k,T},ie.prototype.lookBack=function(R){var k=this.__position-1;return k>=R.length&&this.__input.substring(k-R.length,k).toLowerCase()===R},P.exports.InputScanner=ie},,,,,function(P){function f(ie,R){ie=typeof ie=="string"?ie:ie.source,R=typeof R=="string"?R:R.source,this.__directives_block_pattern=new RegExp(ie+/ beautify( \w+[:]\w+)+ /.source+R,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(ie+/\sbeautify\signore:end\s/.source+R,"g")}f.prototype.get_directives=function(ie){if(!ie.match(this.__directives_block_pattern))return null;var R={};this.__directive_pattern.lastIndex=0;for(var k=this.__directive_pattern.exec(ie);k;)R[k[1]]=k[2],k=this.__directive_pattern.exec(ie);return R},f.prototype.readIgnored=function(ie){return ie.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=f},,function(P,f,ie){var R=ie(16).Beautifier,k=ie(17).Options;function T(C,O){var Q=new R(C,O);return Q.beautify()}P.exports=T,P.exports.defaultOptions=function(){return new k}},function(P,f,ie){var R=ie(17).Options,k=ie(2).Output,T=ie(8).InputScanner,C=ie(13).Directives,O=new C(/\/\*/,/\*\//),Q=/\r\n|[\r\n]/,H=/\r\n|[\r\n]/g,q=/\s/,K=/(?:\s|\n)+/g,$=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g,V=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function he(be,Te){this._source_text=be||"",this._options=new R(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"]}he.prototype.eatString=function(be){var Te="";for(this._ch=this._input.next();this._ch;){if(Te+=this._ch,this._ch==="\\")Te+=this._input.next();else if(be.indexOf(this._ch)!==-1||this._ch===`
`)break;this._ch=this._input.next()}return Te},he.prototype.eatWhitespace=function(be){for(var Te=q.test(this._input.peek()),se=0;q.test(this._input.peek());)this._ch=this._input.next(),be&&this._ch===`
`&&(se===0||se<this._options.max_preserve_newlines)&&(se++,this._output.add_new_line(!0));return Te},he.prototype.foundNestedPseudoClass=function(){for(var be=0,Te=1,se=this._input.peek(Te);se;){if(se==="{")return!0;if(se==="(")be+=1;else if(se===")"){if(be===0)return!1;be-=1}else if(se===";"||se==="}")return!1;Te++,se=this._input.peek(Te)}return!1},he.prototype.print_string=function(be){this._output.set_indent(this._indentLevel),this._output.non_breaking_space=!0,this._output.add_token(be)},he.prototype.preserveSingleSpace=function(be){be&&(this._output.space_before_token=!0)},he.prototype.indent=function(){this._indentLevel++},he.prototype.outdent=function(){this._indentLevel>0&&this._indentLevel--},he.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var be=this._source_text,Te=this._options.eol;Te==="auto"&&(Te=`
`,be&&Q.test(be||"")&&(Te=be.match(Q)[0])),be=be.replace(H,`
`);var se=be.match(/^[\t ]*/)[0];this._output=new k(this._options,se),this._input=new T(be),this._indentLevel=0,this._nestedLevel=0,this._ch=null;for(var Ee=0,We=!1,Ke=!1,Rt=!1,te=!1,z=!1,X=this._ch,ee=!1,fe,ne,A;fe=this._input.read(K),ne=fe!=="",A=X,this._ch=this._input.next(),this._ch==="\\"&&this._input.hasNext()&&(this._ch+=this._input.next()),X=this._ch,this._ch;)if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line(),this._input.back();var D=this._input.read($),G=O.get_directives(D);G&&G.ignore==="start"&&(D+=O.readIgnored(this._input)),this.print_string(D),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(V)),this.eatWhitespace(!0);else if(this._ch==="$"){this.preserveSingleSpace(ne),this.print_string(this._ch);var de=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);de.match(/[ :]$/)&&(de=this.eatString(": ").replace(/\s+$/,""),this.print_string(de),this._output.space_before_token=!0),Ee===0&&de.indexOf(":")!==-1&&(Ke=!0,this.indent())}else if(this._ch==="@")if(this.preserveSingleSpace(ne),this._input.peek()==="{")this.print_string(this._ch+this.eatString("}"));else{this.print_string(this._ch);var ze=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);ze.match(/[ :]$/)&&(ze=this.eatString(": ").replace(/\s+$/,""),this.print_string(ze),this._output.space_before_token=!0),Ee===0&&ze.indexOf(":")!==-1?(Ke=!0,this.indent()):ze in this.NESTED_AT_RULE?(this._nestedLevel+=1,ze in this.CONDITIONAL_GROUP_RULE&&(Rt=!0)):Ee===0&&!Ke&&(te=!0)}else if(this._ch==="#"&&this._input.peek()==="{")this.preserveSingleSpace(ne),this.print_string(this._ch+this.eatString("}"));else if(this._ch==="{")Ke&&(Ke=!1,this.outdent()),te=!1,Rt?(Rt=!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)):(A==="("?this._output.space_before_token=!1:A!==","&&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(),A==="{"&&this._output.trim(!0),Ke&&(this.outdent(),Ke=!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 pt=0;pt<this.NON_SEMICOLON_NEWLINE_PROPERTY.length;pt++)if(this._input.lookBack(this.NON_SEMICOLON_NEWLINE_PROPERTY[pt])){ee=!0;break}(We||Rt)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!te&&Ee===0?(this.print_string(":"),Ke||(Ke=!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 Ut=A==='"'||A==="'";this.preserveSingleSpace(Ut||ne),this.print_string(this._ch+this.eatString(this._ch)),this.eatWhitespace(!0)}else if(this._ch===";")ee=!1,Ee===0?(Ke&&(this.outdent(),Ke=!1),te=!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(),Ee++,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(")")),Ee&&(Ee--,this.outdent()));else{var Ie=!1;this._input.lookBack("with")&&(Ie=!0),this.preserveSingleSpace(ne||Ie),this.print_string(this._ch),Ke&&A==="$"&&this._options.selector_separator_newline?(this._output.add_new_line(),z=!0):(this.eatWhitespace(),Ee++,this.indent())}else if(this._ch===")")Ee&&(Ee--,this.outdent()),z&&this._input.peek()===";"&&this._options.selector_separator_newline&&(z=!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&&(!Ke||z)&&Ee===0&&!te?this._output.add_new_line():this._output.space_before_token=!0;else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!Ke&&Ee===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&&q.test(this._ch)&&(this._ch=""));else if(this._ch==="]")this.print_string(this._ch);else if(this._ch==="[")this.preserveSingleSpace(ne),this.print_string(this._ch);else if(this._ch==="=")this.eatWhitespace(),this.print_string("="),q.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 qt=A==='"'||A==="'";this.preserveSingleSpace(qt||ne),this.print_string(this._ch),!this._output.just_added_newline()&&this._input.peek()===`
`&&ee&&this._output.add_new_line()}var Ot=this._output.get_code(Te);return Ot},P.exports.Beautifier=he},function(P,f,ie){var R=ie(6).Options;function k(T){R.call(this,T,"css"),this.selector_separator_newline=this._get_boolean("selector_separator_newline",!0),this.newline_between_rules=this._get_boolean("newline_between_rules",!0);var C=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||C;var O=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var Q=0;Q<O.length;Q++)O[Q]!=="expand"?this.brace_style="collapse":this.brace_style=O[Q]}k.prototype=new R,P.exports.Options=k}],Z={};function S(P){var f=Z[P];if(f!==void 0)return f.exports;var ie=Z[P]={exports:{}};return pe[P](ie,ie.exports,S),ie.exports}var Ae=S(15);we=Ae})();var Ze=we;re=[],le=function(){return{css_beautify:Ze}}.apply(Bt,re),le!==void 0&&(Ci.exports=le)})()},40998:function(Ci,Bt,re){var le,we;(function(){var Ze;(function(){"use strict";var Ae=[,,function(R){function k(O){this.__parent=O,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=[]}k.prototype.clone_empty=function(){var O=new k(this.__parent);return O.set_indent(this.__indent_count,this.__alignment_count),O},k.prototype.item=function(O){return O<0?this.__items[this.__items.length+O]:this.__items[O]},k.prototype.has_match=function(O){for(var Q=this.__items.length-1;Q>=0;Q--)if(this.__items[Q].match(O))return!0;return!1},k.prototype.set_indent=function(O,Q){this.is_empty()&&(this.__indent_count=O||0,this.__alignment_count=Q||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},k.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)},k.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},k.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var O=this.__parent.current_line;return O.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),O.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),O.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,O.__items[0]===" "&&(O.__items.splice(0,1),O.__character_count-=1),!0}return!1},k.prototype.is_empty=function(){return this.__items.length===0},k.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},k.prototype.push=function(O){this.__items.push(O);var Q=O.lastIndexOf(`
`);Q!==-1?this.__character_count=O.length-Q:this.__character_count+=O.length},k.prototype.pop=function(){var O=null;return this.is_empty()||(O=this.__items.pop(),this.__character_count-=O.length),O},k.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},k.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},k.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},k.prototype.toString=function(){var O="";return this.is_empty()?this.__parent.indent_empty_lines&&(O=this.__parent.get_indent_string(this.__indent_count)):(O=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),O+=this.__items.join("")),O};function T(O,Q){this.__cache=[""],this.__indent_size=O.indent_size,this.__indent_string=O.indent_char,O.indent_with_tabs||(this.__indent_string=new Array(O.indent_size+1).join(O.indent_char)),Q=Q||"",O.indent_level>0&&(Q=new Array(O.indent_level+1).join(this.__indent_string)),this.__base_string=Q,this.__base_string_length=Q.length}T.prototype.get_indent_size=function(O,Q){var H=this.__base_string_length;return Q=Q||0,O<0&&(H=0),H+=O*this.__indent_size,H+=Q,H},T.prototype.get_indent_string=function(O,Q){var H=this.__base_string;return Q=Q||0,O<0&&(O=0,H=""),Q+=O*this.__indent_size,this.__ensure_cache(Q),H+=this.__cache[Q],H},T.prototype.__ensure_cache=function(O){for(;O>=this.__cache.length;)this.__add_column()},T.prototype.__add_column=function(){var O=this.__cache.length,Q=0,H="";this.__indent_size&&O>=this.__indent_size&&(Q=Math.floor(O/this.__indent_size),O-=Q*this.__indent_size,H=new Array(Q+1).join(this.__indent_string)),O&&(H+=new Array(O+1).join(" ")),this.__cache.push(H)};function C(O,Q){this.__indent_cache=new T(O,Q),this.raw=!1,this._end_with_newline=O.end_with_newline,this.indent_size=O.indent_size,this.wrap_line_length=O.wrap_line_length,this.indent_empty_lines=O.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new k(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}C.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},C.prototype.get_line_number=function(){return this.__lines.length},C.prototype.get_indent_string=function(O,Q){return this.__indent_cache.get_indent_string(O,Q)},C.prototype.get_indent_size=function(O,Q){return this.__indent_cache.get_indent_size(O,Q)},C.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},C.prototype.add_new_line=function(O){return this.is_empty()||!O&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},C.prototype.get_code=function(O){this.trim(!0);var Q=this.current_line.pop();Q&&(Q[Q.length-1]===`
`&&(Q=Q.replace(/\n+$/g,"")),this.current_line.push(Q)),this._end_with_newline&&this.__add_outputline();var H=this.__lines.join(`
`);return O!==`
`&&(H=H.replace(/[\n]/g,O)),H},C.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},C.prototype.set_indent=function(O,Q){return O=O||0,Q=Q||0,this.next_line.set_indent(O,Q),this.__lines.length>1?(this.current_line.set_indent(O,Q),!0):(this.current_line.set_indent(),!1)},C.prototype.add_raw_token=function(O){for(var Q=0;Q<O.newlines;Q++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(O.whitespace_before),this.current_line.push(O.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},C.prototype.add_token=function(O){this.__add_space_before_token(),this.current_line.push(O),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},C.prototype.__add_space_before_token=function(){this.space_before_token&&!this.just_added_newline()&&(this.non_breaking_space||this.set_wrap_point(),this.current_line.push(" "))},C.prototype.remove_indent=function(O){for(var Q=this.__lines.length;O<Q;)this.__lines[O]._remove_indent(),O++;this.current_line._remove_wrap_indent()},C.prototype.trim=function(O){for(O=O===void 0?!1:O,this.current_line.trim();O&&this.__lines.length>1&&this.current_line.is_empty();)this.__lines.pop(),this.current_line=this.__lines[this.__lines.length-1],this.current_line.trim();this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null},C.prototype.just_added_newline=function(){return this.current_line.is_empty()},C.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},C.prototype.ensure_empty_line_above=function(O,Q){for(var H=this.__lines.length-2;H>=0;){var q=this.__lines[H];if(q.is_empty())break;if(q.item(0).indexOf(O)!==0&&q.item(-1)!==Q){this.__lines.splice(H+1,0,new k(this)),this.previous_line=this.__lines[this.__lines.length-2];break}H--}},R.exports.Output=C},function(R){function k(T,C,O,Q){this.type=T,this.text=C,this.comments_before=null,this.newlines=O||0,this.whitespace_before=Q||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}R.exports.Token=k},,,function(R){function k(O,Q){this.raw_options=T(O,Q),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"])}k.prototype._get_array=function(O,Q){var H=this.raw_options[O],q=Q||[];return typeof H=="object"?H!==null&&typeof H.concat=="function"&&(q=H.concat()):typeof H=="string"&&(q=H.split(/[^a-zA-Z0-9_\/\-]+/)),q},k.prototype._get_boolean=function(O,Q){var H=this.raw_options[O],q=H===void 0?!!Q:!!H;return q},k.prototype._get_characters=function(O,Q){var H=this.raw_options[O],q=Q||"";return typeof H=="string"&&(q=H.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),q},k.prototype._get_number=function(O,Q){var H=this.raw_options[O];Q=parseInt(Q,10),isNaN(Q)&&(Q=0);var q=parseInt(H,10);return isNaN(q)&&(q=Q),q},k.prototype._get_selection=function(O,Q,H){var q=this._get_selection_list(O,Q,H);if(q.length!==1)throw new Error("Invalid Option Value: The option '"+O+`' can only be one of the following values:
`+Q+`
You passed in: '`+this.raw_options[O]+"'");return q[0]},k.prototype._get_selection_list=function(O,Q,H){if(!Q||Q.length===0)throw new Error("Selection list cannot be empty.");if(H=H||[Q[0]],!this._is_valid_selection(H,Q))throw new Error("Invalid Default Value!");var q=this._get_array(O,H);if(!this._is_valid_selection(q,Q))throw new Error("Invalid Option Value: The option '"+O+`' can contain only the following values:
`+Q+`
You passed in: '`+this.raw_options[O]+"'");return q},k.prototype._is_valid_selection=function(O,Q){return O.length&&Q.length&&!O.some(function(H){return Q.indexOf(H)===-1})};function T(O,Q){var H={};O=C(O);var q;for(q in O)q!==Q&&(H[q]=O[q]);if(Q&&O[Q])for(q in O[Q])H[q]=O[Q][q];return H}function C(O){var Q={},H;for(H in O){var q=H.replace(/-/g,"_");Q[q]=O[H]}return Q}R.exports.Options=k,R.exports.normalizeOpts=C,R.exports.mergeOpts=T},,function(R){var k=RegExp.prototype.hasOwnProperty("sticky");function T(C){this.__input=C||"",this.__input_length=this.__input.length,this.__position=0}T.prototype.restart=function(){this.__position=0},T.prototype.back=function(){this.__position>0&&(this.__position-=1)},T.prototype.hasNext=function(){return this.__position<this.__input_length},T.prototype.next=function(){var C=null;return this.hasNext()&&(C=this.__input.charAt(this.__position),this.__position+=1),C},T.prototype.peek=function(C){var O=null;return C=C||0,C+=this.__position,C>=0&&C<this.__input_length&&(O=this.__input.charAt(C)),O},T.prototype.__match=function(C,O){C.lastIndex=O;var Q=C.exec(this.__input);return Q&&!(k&&C.sticky)&&Q.index!==O&&(Q=null),Q},T.prototype.test=function(C,O){return O=O||0,O+=this.__position,O>=0&&O<this.__input_length?!!this.__match(C,O):!1},T.prototype.testChar=function(C,O){var Q=this.peek(O);return C.lastIndex=0,Q!==null&&C.test(Q)},T.prototype.match=function(C){var O=this.__match(C,this.__position);return O?this.__position+=O[0].length:O=null,O},T.prototype.read=function(C,O,Q){var H="",q;return C&&(q=this.match(C),q&&(H+=q[0])),O&&(q||!C)&&(H+=this.readUntil(O,Q)),H},T.prototype.readUntil=function(C,O){var Q="",H=this.__position;C.lastIndex=this.__position;var q=C.exec(this.__input);return q?(H=q.index,O&&(H+=q[0].length)):H=this.__input_length,Q=this.__input.substring(this.__position,H),this.__position=H,Q},T.prototype.readUntilAfter=function(C){return this.readUntil(C,!0)},T.prototype.get_regexp=function(C,O){var Q=null,H="g";return O&&k&&(H="y"),typeof C=="string"&&C!==""?Q=new RegExp(C,H):C&&(Q=new RegExp(C.source,H)),Q},T.prototype.get_literal_regexp=function(C){return RegExp(C.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},T.prototype.peekUntilAfter=function(C){var O=this.__position,Q=this.readUntilAfter(C);return this.__position=O,Q},T.prototype.lookBack=function(C){var O=this.__position-1;return O>=C.length&&this.__input.substring(O-C.length,O).toLowerCase()===C},R.exports.InputScanner=T},function(R,k,T){var C=T(8).InputScanner,O=T(3).Token,Q=T(10).TokenStream,H=T(11).WhitespacePattern,q={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},K=function($,V){this._input=new C($),this._options=V||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new H(this._input)};K.prototype.tokenize=function(){this._input.restart(),this.__tokens=new Q,this._reset();for(var $,V=new O(q.START,""),he=null,be=[],Te=new Q;V.type!==q.EOF;){for($=this._get_next_token(V,he);this._is_comment($);)Te.add($),$=this._get_next_token(V,he);Te.isEmpty()||($.comments_before=Te,Te=new Q),$.parent=he,this._is_opening($)?(be.push(he),he=$):he&&this._is_closing($,he)&&($.opened=he,he.closed=$,he=be.pop(),$.parent=he),$.previous=V,V.next=$,this.__tokens.add($),V=$}return this.__tokens},K.prototype._is_first_token=function(){return this.__tokens.isEmpty()},K.prototype._reset=function(){},K.prototype._get_next_token=function($,V){this._readWhitespace();var he=this._input.read(/.+/g);return he?this._create_token(q.RAW,he):this._create_token(q.EOF,"")},K.prototype._is_comment=function($){return!1},K.prototype._is_opening=function($){return!1},K.prototype._is_closing=function($,V){return!1},K.prototype._create_token=function($,V){var he=new O($,V,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return he},K.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},R.exports.Tokenizer=K,R.exports.TOKEN=q},function(R){function k(T){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=T}k.prototype.restart=function(){this.__position=0},k.prototype.isEmpty=function(){return this.__tokens_length===0},k.prototype.hasNext=function(){return this.__position<this.__tokens_length},k.prototype.next=function(){var T=null;return this.hasNext()&&(T=this.__tokens[this.__position],this.__position+=1),T},k.prototype.peek=function(T){var C=null;return T=T||0,T+=this.__position,T>=0&&T<this.__tokens_length&&(C=this.__tokens[T]),C},k.prototype.add=function(T){this.__parent_token&&(T.parent=this.__parent_token),this.__tokens.push(T),this.__tokens_length+=1},R.exports.TokenStream=k},function(R,k,T){var C=T(12).Pattern;function O(Q,H){C.call(this,Q,H),H?this._line_regexp=this._input.get_regexp(H._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}O.prototype=new C,O.prototype.__set_whitespace_patterns=function(Q,H){Q+="\\t ",H+="\\n\\r",this._match_pattern=this._input.get_regexp("["+Q+H+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+H+"]")},O.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var Q=this._input.read(this._match_pattern);if(Q===" ")this.whitespace_before_token=" ";else if(Q){var H=this.__split(this._newline_regexp,Q);this.newline_count=H.length-1,this.whitespace_before_token=H[this.newline_count]}return Q},O.prototype.matching=function(Q,H){var q=this._create();return q.__set_whitespace_patterns(Q,H),q._update(),q},O.prototype._create=function(){return new O(this._input,this)},O.prototype.__split=function(Q,H){Q.lastIndex=0;for(var q=0,K=[],$=Q.exec(H);$;)K.push(H.substring(q,$.index)),q=$.index+$[0].length,$=Q.exec(H);return q<H.length?K.push(H.substring(q,H.length)):K.push(""),K},R.exports.WhitespacePattern=O},function(R){function k(T,C){this._input=T,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,C&&(this._starting_pattern=this._input.get_regexp(C._starting_pattern,!0),this._match_pattern=this._input.get_regexp(C._match_pattern,!0),this._until_pattern=this._input.get_regexp(C._until_pattern),this._until_after=C._until_after)}k.prototype.read=function(){var T=this._input.read(this._starting_pattern);return(!this._starting_pattern||T)&&(T+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),T},k.prototype.read_match=function(){return this._input.match(this._match_pattern)},k.prototype.until_after=function(T){var C=this._create();return C._until_after=!0,C._until_pattern=this._input.get_regexp(T),C._update(),C},k.prototype.until=function(T){var C=this._create();return C._until_after=!1,C._until_pattern=this._input.get_regexp(T),C._update(),C},k.prototype.starting_with=function(T){var C=this._create();return C._starting_pattern=this._input.get_regexp(T,!0),C._update(),C},k.prototype.matching=function(T){var C=this._create();return C._match_pattern=this._input.get_regexp(T,!0),C._update(),C},k.prototype._create=function(){return new k(this._input,this)},k.prototype._update=function(){},R.exports.Pattern=k},function(R){function k(T,C){T=typeof T=="string"?T:T.source,C=typeof C=="string"?C:C.source,this.__directives_block_pattern=new RegExp(T+/ beautify( \w+[:]\w+)+ /.source+C,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(T+/\sbeautify\signore:end\s/.source+C,"g")}k.prototype.get_directives=function(T){if(!T.match(this.__directives_block_pattern))return null;var C={};this.__directive_pattern.lastIndex=0;for(var O=this.__directive_pattern.exec(T);O;)C[O[1]]=O[2],O=this.__directive_pattern.exec(T);return C},k.prototype.readIgnored=function(T){return T.readUntilAfter(this.__directives_end_ignore_pattern)},R.exports.Directives=k},function(R,k,T){var C=T(12).Pattern,O={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function Q(H,q){C.call(this,H,q),this.__template_pattern=null,this._disabled=Object.assign({},O),this._excluded=Object.assign({},O),q&&(this.__template_pattern=this._input.get_regexp(q.__template_pattern),this._excluded=Object.assign(this._excluded,q._excluded),this._disabled=Object.assign(this._disabled,q._disabled));var K=new C(H);this.__patterns={handlebars_comment:K.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:K.starting_with(/{{{/).until_after(/}}}/),handlebars:K.starting_with(/{{/).until_after(/}}/),php:K.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:K.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:K.starting_with(/{%/).until_after(/%}/),django_value:K.starting_with(/{{/).until_after(/}}/),django_comment:K.starting_with(/{#/).until_after(/#}/),smarty:K.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:K.starting_with(/{\*/).until_after(/\*}/),smarty_literal:K.starting_with(/{literal}/).until_after(/{\/literal}/)}}Q.prototype=new C,Q.prototype._create=function(){return new Q(this._input,this)},Q.prototype._update=function(){this.__set_templated_pattern()},Q.prototype.disable=function(H){var q=this._create();return q._disabled[H]=!0,q._update(),q},Q.prototype.read_options=function(H){var q=this._create();for(var K in O)q._disabled[K]=H.templating.indexOf(K)===-1;return q._update(),q},Q.prototype.exclude=function(H){var q=this._create();return q._excluded[H]=!0,q._update(),q},Q.prototype.read=function(){var H="";this._match_pattern?H=this._input.read(this._starting_pattern):H=this._input.read(this._starting_pattern,this.__template_pattern);for(var q=this._read_template();q;)this._match_pattern?q+=this._input.read(this._match_pattern):q+=this._input.readUntil(this.__template_pattern),H+=q,q=this._read_template();return this._until_after&&(H+=this._input.readUntilAfter(this._until_pattern)),H},Q.prototype.__set_templated_pattern=function(){var H=[];this._disabled.php||H.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||H.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||H.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(H.push(this.__patterns.django._starting_pattern.source),H.push(this.__patterns.django_value._starting_pattern.source),H.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||H.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&H.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+H.join("|")+")")},Q.prototype._read_template=function(){var H="",q=this._input.peek();if(q==="<"){var K=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&K==="?"&&(H=H||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&K==="%"&&(H=H||this.__patterns.erb.read())}else q==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(H=H||this.__patterns.handlebars_comment.read(),H=H||this.__patterns.handlebars_unescaped.read(),H=H||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(H=H||this.__patterns.django_value.read()),this._excluded.django||(H=H||this.__patterns.django_comment.read(),H=H||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(H=H||this.__patterns.smarty_comment.read(),H=H||this.__patterns.smarty_literal.read(),H=H||this.__patterns.smarty.read()));return H},R.exports.TemplatablePattern=Q},,,,function(R,k,T){var C=T(19).Beautifier,O=T(20).Options;function Q(H,q,K,$){var V=new C(H,q,K,$);return V.beautify()}R.exports=Q,R.exports.defaultOptions=function(){return new O}},function(R,k,T){var C=T(20).Options,O=T(2).Output,Q=T(21).Tokenizer,H=T(21).TOKEN,q=/\r\n|[\r\n]/,K=/\r\n|[\r\n]/g,$=function(te,z){this.indent_level=0,this.alignment_size=0,this.max_preserve_newlines=te.max_preserve_newlines,this.preserve_newlines=te.preserve_newlines,this._output=new O(te,z)};$.prototype.current_line_has_match=function(te){return this._output.current_line.has_match(te)},$.prototype.set_space_before_token=function(te,z){this._output.space_before_token=te,this._output.non_breaking_space=z},$.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size),this._output.set_wrap_point()},$.prototype.add_raw_token=function(te){this._output.add_raw_token(te)},$.prototype.print_preserved_newlines=function(te){var z=0;te.type!==H.TEXT&&te.previous.type!==H.TEXT&&(z=te.newlines?1:0),this.preserve_newlines&&(z=te.newlines<this.max_preserve_newlines+1?te.newlines:this.max_preserve_newlines+1);for(var X=0;X<z;X++)this.print_newline(X>0);return z!==0},$.prototype.traverse_whitespace=function(te){return te.whitespace_before||te.newlines?(this.print_preserved_newlines(te)||(this._output.space_before_token=!0),!0):!1},$.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped},$.prototype.print_newline=function(te){this._output.add_new_line(te)},$.prototype.print_token=function(te){te.text&&(this._output.set_indent(this.indent_level,this.alignment_size),this._output.add_token(te.text))},$.prototype.indent=function(){this.indent_level++},$.prototype.deindent=function(){this.indent_level>0&&(this.indent_level--,this._output.set_indent(this.indent_level,this.alignment_size))},$.prototype.get_full_indent=function(te){return te=this.indent_level+(te||0),te<1?"":this._output.get_indent_string(te)};var V=function(te){for(var z=null,X=te.next;X.type!==H.EOF&&te.closed!==X;){if(X.type===H.ATTRIBUTE&&X.text==="type"){X.next&&X.next.type===H.EQUALS&&X.next.next&&X.next.next.type===H.VALUE&&(z=X.next.next.text);break}X=X.next}return z},he=function(te,z){var X=null,ee=null;return z.closed?(te==="script"?X="text/javascript":te==="style"&&(X="text/css"),X=V(z)||X,X.search("text/css")>-1?ee="css":X.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1?ee="javascript":X.search(/(text|application|dojo)\/(x-)?(html)/)>-1?ee="html":X.search(/test\/null/)>-1&&(ee="null"),ee):null};function be(te,z){return z.indexOf(te)!==-1}function Te(te,z,X){this.parent=te||null,this.tag=z?z.tag_name:"",this.indent_level=X||0,this.parser_token=z||null}function se(te){this._printer=te,this._current_frame=null}se.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null},se.prototype.record_tag=function(te){var z=new Te(this._current_frame,te,this._printer.indent_level);this._current_frame=z},se.prototype._try_pop_frame=function(te){var z=null;return te&&(z=te.parser_token,this._printer.indent_level=te.indent_level,this._current_frame=te.parent),z},se.prototype._get_frame=function(te,z){for(var X=this._current_frame;X&&te.indexOf(X.tag)===-1;){if(z&&z.indexOf(X.tag)!==-1){X=null;break}X=X.parent}return X},se.prototype.try_pop=function(te,z){var X=this._get_frame([te],z);return this._try_pop_frame(X)},se.prototype.indent_to_tag=function(te){var z=this._get_frame(te);z&&(this._printer.indent_level=z.indent_level)};function Ee(te,z,X,ee){this._source_text=te||"",z=z||{},this._js_beautify=X,this._css_beautify=ee,this._tag_stack=null;var fe=new C(z,"html");this._options=fe,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"}Ee.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var te=this._source_text,z=this._options.eol;this._options.eol==="auto"&&(z=`
`,te&&q.test(te)&&(z=te.match(q)[0])),te=te.replace(K,`
`);var X=te.match(/^[\t ]*/)[0],ee={text:"",type:""},fe=new We(this._options),ne=new $(this._options,X),A=new Q(te,this._options).tokenize();this._tag_stack=new se(ne);for(var D=null,G=A.next();G.type!==H.EOF;)G.type===H.TAG_OPEN||G.type===H.COMMENT?(D=this._handle_tag_open(ne,G,fe,ee,A),fe=D):G.type===H.ATTRIBUTE||G.type===H.EQUALS||G.type===H.VALUE||G.type===H.TEXT&&!fe.tag_complete?D=this._handle_inside_tag(ne,G,fe,ee):G.type===H.TAG_CLOSE?D=this._handle_tag_close(ne,G,fe):G.type===H.TEXT?D=this._handle_text(ne,G,fe):G.type===H.CONTROL_FLOW_OPEN?D=this._handle_control_flow_open(ne,G):G.type===H.CONTROL_FLOW_CLOSE?D=this._handle_control_flow_close(ne,G):ne.add_raw_token(G),ee=D,G=A.next();var de=ne._output.get_code(z);return de},Ee.prototype._handle_control_flow_open=function(te,z){var X={text:z.text,type:z.type};return te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),z.newlines?te.print_preserved_newlines(z):te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),te.print_token(z),te.indent(),X},Ee.prototype._handle_control_flow_close=function(te,z){var X={text:z.text,type:z.type};return te.deindent(),z.newlines?te.print_preserved_newlines(z):te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),te.print_token(z),X},Ee.prototype._handle_tag_close=function(te,z,X){var ee={text:z.text,type:z.type};return te.alignment_size=0,X.tag_complete=!0,te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),X.is_unformatted?te.add_raw_token(z):(X.tag_start_char==="<"&&(te.set_space_before_token(z.text[0]==="/",!0),this._is_wrap_attributes_force_expand_multiline&&X.has_wrapped_attrs&&te.print_newline(!1)),te.print_token(z)),X.indent_content&&!(X.is_unformatted||X.is_content_unformatted)&&(te.indent(),X.indent_content=!1),!X.is_inline_element&&!(X.is_unformatted||X.is_content_unformatted)&&te.set_wrap_point(),ee},Ee.prototype._handle_inside_tag=function(te,z,X,ee){var fe=X.has_wrapped_attrs,ne={text:z.text,type:z.type};return te.set_space_before_token(z.newlines||z.whitespace_before!=="",!0),X.is_unformatted?te.add_raw_token(z):X.tag_start_char==="{"&&z.type===H.TEXT?te.print_preserved_newlines(z)?(z.newlines=0,te.add_raw_token(z)):te.print_token(z):(z.type===H.ATTRIBUTE?te.set_space_before_token(!0):(z.type===H.EQUALS||z.type===H.VALUE&&z.previous.type===H.EQUALS)&&te.set_space_before_token(!1),z.type===H.ATTRIBUTE&&X.tag_start_char==="<"&&((this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned)&&(te.traverse_whitespace(z),fe=fe||z.newlines!==0),this._is_wrap_attributes_force&&X.attr_count>=this._options.wrap_attributes_min_attrs&&(ee.type!==H.TAG_OPEN||this._is_wrap_attributes_force_expand_multiline)&&(te.print_newline(!1),fe=!0)),te.print_token(z),fe=fe||te.previous_token_wrapped(),X.has_wrapped_attrs=fe),ne},Ee.prototype._handle_text=function(te,z,X){var ee={text:z.text,type:"TK_CONTENT"};return X.custom_beautifier_name?this._print_custom_beatifier_text(te,z,X):X.is_unformatted||X.is_content_unformatted?te.add_raw_token(z):(te.traverse_whitespace(z),te.print_token(z)),ee},Ee.prototype._print_custom_beatifier_text=function(te,z,X){var ee=this;if(z.text!==""){var fe=z.text,ne,A=1,D="",G="";X.custom_beautifier_name==="javascript"&&typeof this._js_beautify=="function"?ne=this._js_beautify:X.custom_beautifier_name==="css"&&typeof this._css_beautify=="function"?ne=this._css_beautify:X.custom_beautifier_name==="html"&&(ne=function(qt,Ot){var wt=new Ee(qt,Ot,ee._js_beautify,ee._css_beautify);return wt.beautify()}),this._options.indent_scripts==="keep"?A=0:this._options.indent_scripts==="separate"&&(A=-te.indent_level);var de=te.get_full_indent(A);if(fe=fe.replace(/\n[ \t]*$/,""),X.custom_beautifier_name!=="html"&&fe[0]==="<"&&fe.match(/^(<!--|<!\[CDATA\[)/)){var ze=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(fe);if(!ze){te.add_raw_token(z);return}D=de+ze[1]+`
`,fe=ze[4],ze[5]&&(G=de+ze[5]),fe=fe.replace(/\n[ \t]*$/,""),(ze[2]||ze[3].indexOf(`
`)!==-1)&&(ze=ze[3].match(/[ \t]+$/),ze&&(z.whitespace_before=ze[0]))}if(fe)if(ne){var pt=function(){this.eol=`
`};pt.prototype=this._options.raw_options;var Ut=new pt;fe=ne(de+fe,Ut)}else{var Ie=z.whitespace_before;Ie&&(fe=fe.replace(new RegExp(`
(`+Ie+")?","g"),`
`)),fe=de+fe.replace(/\n/g,`
`+de)}D&&(fe?fe=D+fe+`
`+G:fe=D+G),te.print_newline(!1),fe&&(z.text=fe,z.whitespace_before="",z.newlines=0,te.add_raw_token(z),te.print_newline(!0))}},Ee.prototype._handle_tag_open=function(te,z,X,ee,fe){var ne=this._get_tag_open_token(z);if((X.is_unformatted||X.is_content_unformatted)&&!X.is_empty_element&&z.type===H.TAG_OPEN&&!ne.is_start_tag?(te.add_raw_token(z),ne.start_tag_token=this._tag_stack.try_pop(ne.tag_name)):(te.traverse_whitespace(z),this._set_tag_position(te,z,ne,X,ee),ne.is_inline_element||te.set_wrap_point(),te.print_token(z)),ne.is_start_tag&&this._is_wrap_attributes_force){var A=0,D;do D=fe.peek(A),D.type===H.ATTRIBUTE&&(ne.attr_count+=1),A+=1;while(D.type!==H.EOF&&D.type!==H.TAG_CLOSE)}return(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned)&&(ne.alignment_size=z.text.length+1),!ne.tag_complete&&!ne.is_unformatted&&(te.alignment_size=ne.alignment_size),ne};var We=function(te,z,X){if(this.parent=z||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="",!X)this.tag_complete=!0;else{var ee;this.tag_start_char=X.text[0],this.text=X.text,this.tag_start_char==="<"?(ee=X.text.match(/^<([^\s>]*)/),this.tag_check=ee?ee[1]:""):(ee=X.text.match(/^{{~?(?:[\^]|#\*?)?([^\s}]+)/),this.tag_check=ee?ee[1]:"",(X.text.startsWith("{{#>")||X.text.startsWith("{{~#>"))&&this.tag_check[0]===">"&&(this.tag_check===">"&&X.next!==null?this.tag_check=X.next.text.split(" ")[0]:this.tag_check=X.text.split(">")[1])),this.tag_check=this.tag_check.toLowerCase(),X.type===H.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||X.closed&&X.closed.text==="/>";var fe=2;this.tag_start_char==="{"&&this.text.length>=3&&this.text.charAt(2)==="~"&&(fe=3),this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(!te.indent_handlebars||this.text.length<3||/[^#\^]/.test(this.text.charAt(fe)))}};Ee.prototype._get_tag_open_token=function(te){var z=new We(this._options,this._tag_stack.get_parser_token(),te);return z.alignment_size=this._options.wrap_attributes_indent_size,z.is_end_tag=z.is_end_tag||be(z.tag_check,this._options.void_elements),z.is_empty_element=z.tag_complete||z.is_start_tag&&z.is_end_tag,z.is_unformatted=!z.tag_complete&&be(z.tag_check,this._options.unformatted),z.is_content_unformatted=!z.is_empty_element&&be(z.tag_check,this._options.content_unformatted),z.is_inline_element=be(z.tag_name,this._options.inline)||this._options.inline_custom_elements&&z.tag_name.includes("-")||z.tag_start_char==="{",z},Ee.prototype._set_tag_position=function(te,z,X,ee,fe){if(X.is_empty_element||(X.is_end_tag?X.start_tag_token=this._tag_stack.try_pop(X.tag_name):(this._do_optional_end_element(X)&&(X.is_inline_element||te.print_newline(!1)),this._tag_stack.record_tag(X),(X.tag_name==="script"||X.tag_name==="style")&&!(X.is_unformatted||X.is_content_unformatted)&&(X.custom_beautifier_name=he(X.tag_check,z)))),be(X.tag_check,this._options.extra_liners)&&(te.print_newline(!1),te._output.just_added_blankline()||te.print_newline(!0)),X.is_empty_element){if(X.tag_start_char==="{"&&X.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]),X.indent_content=!0;var ne=te.current_line_has_match(/{{#if/);ne||te.print_newline(!1)}X.tag_name==="!--"&&fe.type===H.TAG_CLOSE&&ee.is_end_tag&&X.text.indexOf(`
`)===-1||(X.is_inline_element||X.is_unformatted||te.print_newline(!1),this._calcluate_parent_multiline(te,X))}else if(X.is_end_tag){var A=!1;A=X.start_tag_token&&X.start_tag_token.multiline_content,A=A||!X.is_inline_element&&!(ee.is_inline_element||ee.is_unformatted)&&!(fe.type===H.TAG_CLOSE&&X.start_tag_token===ee)&&fe.type!=="TK_CONTENT",(X.is_content_unformatted||X.is_unformatted)&&(A=!1),A&&te.print_newline(!1)}else X.indent_content=!X.custom_beautifier_name,X.tag_start_char==="<"&&(X.tag_name==="html"?X.indent_content=this._options.indent_inner_html:X.tag_name==="head"?X.indent_content=this._options.indent_head_inner_html:X.tag_name==="body"&&(X.indent_content=this._options.indent_body_inner_html)),!(X.is_inline_element||X.is_unformatted)&&(fe.type!=="TK_CONTENT"||X.is_content_unformatted)&&te.print_newline(!1),this._calcluate_parent_multiline(te,X)},Ee.prototype._calcluate_parent_multiline=function(te,z){z.parent&&te._output.just_added_newline()&&!((z.is_inline_element||z.is_unformatted)&&z.parent.is_inline_element)&&(z.parent.multiline_content=!0)};var Ke=["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"],Rt=["a","audio","del","ins","map","noscript","video"];Ee.prototype._do_optional_end_element=function(te){var z=null;if(!(te.is_empty_element||!te.is_start_tag||!te.parent)){if(te.tag_name==="body")z=z||this._tag_stack.try_pop("head");else if(te.tag_name==="li")z=z||this._tag_stack.try_pop("li",["ol","ul","menu"]);else if(te.tag_name==="dd"||te.tag_name==="dt")z=z||this._tag_stack.try_pop("dt",["dl"]),z=z||this._tag_stack.try_pop("dd",["dl"]);else if(te.parent.tag_name==="p"&&Ke.indexOf(te.tag_name)!==-1){var X=te.parent.parent;(!X||Rt.indexOf(X.tag_name)===-1)&&(z=z||this._tag_stack.try_pop("p"))}else te.tag_name==="rp"||te.tag_name==="rt"?(z=z||this._tag_stack.try_pop("rt",["ruby","rtc"]),z=z||this._tag_stack.try_pop("rp",["ruby","rtc"])):te.tag_name==="optgroup"?z=z||this._tag_stack.try_pop("optgroup",["select"]):te.tag_name==="option"?z=z||this._tag_stack.try_pop("option",["select","datalist","optgroup"]):te.tag_name==="colgroup"?z=z||this._tag_stack.try_pop("caption",["table"]):te.tag_name==="thead"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"])):te.tag_name==="tbody"||te.tag_name==="tfoot"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"]),z=z||this._tag_stack.try_pop("thead",["table"]),z=z||this._tag_stack.try_pop("tbody",["table"])):te.tag_name==="tr"?(z=z||this._tag_stack.try_pop("caption",["table"]),z=z||this._tag_stack.try_pop("colgroup",["table"]),z=z||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])):(te.tag_name==="th"||te.tag_name==="td")&&(z=z||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]),z=z||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"]));return te.parent=this._tag_stack.get_parser_token(),z}},R.exports.Beautifier=Ee},function(R,k,T){var C=T(6).Options;function O(Q){C.call(this,Q,"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"])}O.prototype=new C,R.exports.Options=O},function(R,k,T){var C=T(9).Tokenizer,O=T(9).TOKEN,Q=T(13).Directives,H=T(14).TemplatablePattern,q=T(12).Pattern,K={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:O.START,RAW:O.RAW,EOF:O.EOF},$=new Q(/<\!--/,/-->/),V=function(he,be){C.call(this,he,be),this._current_tag_name="";var Te=new H(this._input).read_options(this._options),se=new q(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:se.matching(/\@[a-zA-Z]+[^({]*[({]/),handlebars_comment:se.starting_with(/{{!--/).until_after(/--}}/),handlebars:se.starting_with(/{{/).until_after(/}}/),handlebars_open:se.until(/[\n\r\t }]/),handlebars_raw_close:se.until(/}}/),comment:se.starting_with(/<!--/).until_after(/-->/),cdata:se.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:se.starting_with(/<!\[/).until_after(/]>/),processing:se.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 Ee=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=se.matching(Ee).until_after(Ee)}};V.prototype=new C,V.prototype._is_comment=function(he){return!1},V.prototype._is_opening=function(he){return he.type===K.TAG_OPEN||he.type===K.CONTROL_FLOW_OPEN},V.prototype._is_closing=function(he,be){return he.type===K.TAG_CLOSE&&be&&((he.text===">"||he.text==="/>")&&be.text[0]==="<"||he.text==="}}"&&be.text[0]==="{"&&be.text[1]==="{")||he.type===K.CONTROL_FLOW_CLOSE&&he.text==="}"&&be.text.endsWith("{")},V.prototype._reset=function(){this._current_tag_name=""},V.prototype._get_next_token=function(he,be){var Te=null;this._readWhitespace();var se=this._input.peek();return se===null?this._create_token(K.EOF,""):(Te=Te||this._read_open_handlebars(se,be),Te=Te||this._read_attribute(se,he,be),Te=Te||this._read_close(se,be),Te=Te||this._read_script_and_style(se,he),Te=Te||this._read_control_flows(se,be),Te=Te||this._read_raw_content(se,he,be),Te=Te||this._read_content_word(se,be),Te=Te||this._read_comment_or_cdata(se),Te=Te||this._read_processing(se),Te=Te||this._read_open(se,be),Te=Te||this._create_token(K.UNKNOWN,this._input.next()),Te)},V.prototype._read_comment_or_cdata=function(he){var be=null,Te=null,se=null;if(he==="<"){var Ee=this._input.peek(1);Ee==="!"&&(Te=this.__patterns.comment.read(),Te?(se=$.get_directives(Te),se&&se.ignore==="start"&&(Te+=$.readIgnored(this._input))):Te=this.__patterns.cdata.read()),Te&&(be=this._create_token(K.COMMENT,Te),be.directives=se)}return be},V.prototype._read_processing=function(he){var be=null,Te=null,se=null;if(he==="<"){var Ee=this._input.peek(1);(Ee==="!"||Ee==="?")&&(Te=this.__patterns.conditional_comment.read(),Te=Te||this.__patterns.processing.read()),Te&&(be=this._create_token(K.COMMENT,Te),be.directives=se)}return be},V.prototype._read_open=function(he,be){var Te=null,se=null;return(!be||be.type===K.CONTROL_FLOW_OPEN)&&he==="<"&&(Te=this._input.next(),this._input.peek()==="/"&&(Te+=this._input.next()),Te+=this.__patterns.element_name.read(),se=this._create_token(K.TAG_OPEN,Te)),se},V.prototype._read_open_handlebars=function(he,be){var Te=null,se=null;return(!be||be.type===K.CONTROL_FLOW_OPEN)&&(this._options.templating.includes("angular")||this._options.indent_handlebars)&&he==="{"&&this._input.peek(1)==="{"&&(this._options.indent_handlebars&&this._input.peek(2)==="!"?(Te=this.__patterns.handlebars_comment.read(),Te=Te||this.__patterns.handlebars.read(),se=this._create_token(K.COMMENT,Te)):(Te=this.__patterns.handlebars_open.read(),se=this._create_token(K.TAG_OPEN,Te))),se},V.prototype._read_control_flows=function(he,be){var Te="",se=null;if(!this._options.templating.includes("angular"))return se;if(he==="@"){if(Te=this.__patterns.angular_control_flow_start.read(),Te==="")return se;for(var Ee=Te.endsWith("(")?1:0,We=0;!(Te.endsWith("{")&&Ee===We);){var Ke=this._input.next();if(Ke===null)break;Ke==="("?Ee++:Ke===")"&&We++,Te+=Ke}se=this._create_token(K.CONTROL_FLOW_OPEN,Te)}else he==="}"&&be&&be.type===K.CONTROL_FLOW_OPEN&&(Te=this._input.next(),se=this._create_token(K.CONTROL_FLOW_CLOSE,Te));return se},V.prototype._read_close=function(he,be){var Te=null,se=null;return be&&be.type===K.TAG_OPEN&&(be.text[0]==="<"&&(he===">"||he==="/"&&this._input.peek(1)===">")?(Te=this._input.next(),he==="/"&&(Te+=this._input.next()),se=this._create_token(K.TAG_CLOSE,Te)):be.text[0]==="{"&&he==="}"&&this._input.peek(1)==="}"&&(this._input.next(),this._input.next(),se=this._create_token(K.TAG_CLOSE,"}}"))),se},V.prototype._read_attribute=function(he,be,Te){var se=null,Ee="";if(Te&&Te.text[0]==="<")if(he==="=")se=this._create_token(K.EQUALS,this._input.next());else if(he==='"'||he==="'"){var We=this._input.next();he==='"'?We+=this.__patterns.double_quote.read():We+=this.__patterns.single_quote.read(),se=this._create_token(K.VALUE,We)}else Ee=this.__patterns.attribute.read(),Ee&&(be.type===K.EQUALS?se=this._create_token(K.VALUE,Ee):se=this._create_token(K.ATTRIBUTE,Ee));return se},V.prototype._is_content_unformatted=function(he){return this._options.void_elements.indexOf(he)===-1&&(this._options.content_unformatted.indexOf(he)!==-1||this._options.unformatted.indexOf(he)!==-1)},V.prototype._read_raw_content=function(he,be,Te){var se="";if(Te&&Te.text[0]==="{")se=this.__patterns.handlebars_raw_close.read();else if(be.type===K.TAG_CLOSE&&be.opened.text[0]==="<"&&be.text[0]!=="/"){var Ee=be.opened.text.substr(1).toLowerCase();this._is_content_unformatted(Ee)&&(se=this._input.readUntil(new RegExp("</"+Ee+"[\\n\\r\\t ]*?>","ig")))}return se?this._create_token(K.TEXT,se):null},V.prototype._read_script_and_style=function(he,be){if(be.type===K.TAG_CLOSE&&be.opened.text[0]==="<"&&be.text[0]!=="/"){var Te=be.opened.text.substr(1).toLowerCase();if(Te==="script"||Te==="style"){var se=this._read_comment_or_cdata(he);if(se)return se.type=K.TEXT,se;var Ee=this._input.readUntil(new RegExp("</"+Te+"[\\n\\r\\t ]*?>","ig"));if(Ee)return this._create_token(K.TEXT,Ee)}}return null},V.prototype._read_content_word=function(he,be){var Te="";return this._options.unformatted_content_delimiter&&he===this._options.unformatted_content_delimiter[0]&&(Te=this.__patterns.unformatted_content_delimiter.read()),Te||(Te=be&&be.type===K.CONTROL_FLOW_OPEN?this.__patterns.word_control_flow_close_excluded.read():this.__patterns.word.read()),Te?this._create_token(K.TEXT,Te):null},R.exports.Tokenizer=V,R.exports.TOKEN=K}],P={};function f(R){var k=P[R];if(k!==void 0)return k.exports;var T=P[R]={exports:{}};return Ae[R](T,T.exports,f),T.exports}var ie=f(18);Ze=ie})();var pe=Ze;if(1)le=[re,re(58553),re(87804)],we=function(Ae){var P=re(58553),f=re(87804);return{html_beautify:function(ie,R){return pe(ie,R,P.js_beautify,f.css_beautify)}}}.apply(Bt,le),we!==void 0&&(Ci.exports=we);else var Z,S})()},58553:function(Ci,Bt){var re,le;(function(){var we;(function(){"use strict";var pe=[function(P,f,ie){var R=ie(1).Beautifier,k=ie(5).Options;function T(C,O){var Q=new R(C,O);return Q.beautify()}P.exports=T,P.exports.defaultOptions=function(){return new k}},function(P,f,ie){var R=ie(2).Output,k=ie(3).Token,T=ie(4),C=ie(5).Options,O=ie(7).Tokenizer,Q=ie(7).line_starters,H=ie(7).positionable_operators,q=ie(7).TOKEN;function K(D,G){return G.indexOf(D)!==-1}function $(D){return D.replace(/^\s+/g,"")}function V(D){for(var G={},de=0;de<D.length;de++)G[D[de].replace(/-/g,"_")]=D[de];return G}function he(D,G){return D&&D.type===q.RESERVED&&D.text===G}function be(D,G){return D&&D.type===q.RESERVED&&K(D.text,G)}var Te=["case","return","do","if","throw","else","await","break","continue","async"],se=["before-newline","after-newline","preserve-newline"],Ee=V(se),We=[Ee.before_newline,Ee.preserve_newline],Ke={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Rt(D,G){G.multiline_frame||G.mode===Ke.ForInitializer||G.mode===Ke.Conditional||D.remove_indent(G.start_line_index)}function te(D){D=D.replace(T.allLineBreaks,`
`);for(var G=[],de=D.indexOf(`
`);de!==-1;)G.push(D.substring(0,de)),D=D.substring(de+1),de=D.indexOf(`
`);return D.length&&G.push(D),G}function z(D){return D===Ke.ArrayLiteral}function X(D){return K(D,[Ke.Expression,Ke.ForInitializer,Ke.Conditional])}function ee(D,G){for(var de=0;de<D.length;de++){var ze=D[de].trim();if(ze.charAt(0)!==G)return!1}return!0}function fe(D,G){for(var de=0,ze=D.length,pt;de<ze;de++)if(pt=D[de],pt&&pt.indexOf(G)!==0)return!1;return!0}function ne(D,G){G=G||{},this._source_text=D||"",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 C(G)}ne.prototype.create_flags=function(D,G){var de=0;D&&(de=D.indentation_level,!this._output.just_added_newline()&&D.line_indent_level>de&&(de=D.line_indent_level));var ze={mode:G,parent:D,last_token:D?D.last_token:new k(q.START_BLOCK,""),last_word:D?D.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:de,alignment:0,line_indent_level:D?D.line_indent_level:de,start_line_index:this._output.get_line_number(),ternary_depth:0};return ze},ne.prototype._reset=function(D){var G=D.match(/^[\t ]*/)[0];this._last_last_text="",this._output=new R(this._options,G),this._output.raw=this._options.test_output_raw,this._flag_store=[],this.set_mode(Ke.BlockStatement);var de=new O(D,this._options);return this._tokens=de.tokenize(),D},ne.prototype.beautify=function(){if(this._options.disabled)return this._source_text;var D,G=this._reset(this._source_text),de=this._options.eol;this._options.eol==="auto"&&(de=`
`,G&&T.lineBreak.test(G||"")&&(de=G.match(T.lineBreak)[0]));for(var ze=this._tokens.next();ze;)this.handle_token(ze),this._last_last_text=this._flags.last_token.text,this._flags.last_token=ze,ze=this._tokens.next();return D=this._output.get_code(de),D},ne.prototype.handle_token=function(D,G){D.type===q.START_EXPR?this.handle_start_expr(D):D.type===q.END_EXPR?this.handle_end_expr(D):D.type===q.START_BLOCK?this.handle_start_block(D):D.type===q.END_BLOCK?this.handle_end_block(D):D.type===q.WORD?this.handle_word(D):D.type===q.RESERVED?this.handle_word(D):D.type===q.SEMICOLON?this.handle_semicolon(D):D.type===q.STRING?this.handle_string(D):D.type===q.EQUALS?this.handle_equals(D):D.type===q.OPERATOR?this.handle_operator(D):D.type===q.COMMA?this.handle_comma(D):D.type===q.BLOCK_COMMENT?this.handle_block_comment(D,G):D.type===q.COMMENT?this.handle_comment(D,G):D.type===q.DOT?this.handle_dot(D):D.type===q.EOF?this.handle_eof(D):D.type===q.UNKNOWN?this.handle_unknown(D,G):this.handle_unknown(D,G)},ne.prototype.handle_whitespace_and_comments=function(D,G){var de=D.newlines,ze=this._options.keep_array_indentation&&z(this._flags.mode);if(D.comments_before)for(var pt=D.comments_before.next();pt;)this.handle_whitespace_and_comments(pt,G),this.handle_token(pt,G),pt=D.comments_before.next();if(ze)for(var Ut=0;Ut<de;Ut+=1)this.print_newline(Ut>0,G);else if(this._options.max_preserve_newlines&&de>this._options.max_preserve_newlines&&(de=this._options.max_preserve_newlines),this._options.preserve_newlines&&de>1){this.print_newline(!1,G);for(var Ie=1;Ie<de;Ie+=1)this.print_newline(!0,G)}};var A=["async","break","continue","return","throw","yield"];ne.prototype.allow_wrap_or_preserved_newline=function(D,G){if(G=G===void 0?!1:G,!this._output.just_added_newline()){var de=this._options.preserve_newlines&&D.newlines||G,ze=K(this._flags.last_token.text,H)||K(D.text,H);if(ze){var pt=K(this._flags.last_token.text,H)&&K(this._options.operator_position,We)||K(D.text,H);de=de&&pt}if(de)this.print_newline(!1,!0);else if(this._options.wrap_line_length){if(be(this._flags.last_token,A))return;this._output.set_wrap_point()}}},ne.prototype.print_newline=function(D,G){if(!G&&this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==q.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))for(var de=this._tokens.peek();this._flags.mode===Ke.Statement&&!(this._flags.if_block&&he(de,"else"))&&!this._flags.do_block;)this.restore_mode();this._output.add_new_line(D)&&(this._flags.multiline_frame=!0)},ne.prototype.print_token_line_indentation=function(D){this._output.just_added_newline()&&(this._options.keep_array_indentation&&D.newlines&&(D.text==="["||z(this._flags.mode))?(this._output.current_line.set_indent(-1),this._output.current_line.push(D.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))},ne.prototype.print_token=function(D){if(this._output.raw){this._output.add_raw_token(D);return}if(this._options.comma_first&&D.previous&&D.previous.type===q.COMMA&&this._output.just_added_newline()&&this._output.previous_line.last()===","){var G=this._output.previous_line.pop();this._output.previous_line.is_empty()&&(this._output.previous_line.push(G),this._output.trim(!0),this._output.current_line.pop(),this._output.trim()),this.print_token_line_indentation(D),this._output.add_token(","),this._output.space_before_token=!0}this.print_token_line_indentation(D),this._output.non_breaking_space=!0,this._output.add_token(D.text),this._output.previous_token_wrapped&&(this._flags.multiline_frame=!0)},ne.prototype.indent=function(){this._flags.indentation_level+=1,this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ne.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))},ne.prototype.set_mode=function(D){this._flags?(this._flag_store.push(this._flags),this._previous_flags=this._flags):this._previous_flags=this.create_flags(null,D),this._flags=this.create_flags(this._previous_flags,D),this._output.set_indent(this._flags.indentation_level,this._flags.alignment)},ne.prototype.restore_mode=function(){this._flag_store.length>0&&(this._previous_flags=this._flags,this._flags=this._flag_store.pop(),this._previous_flags.mode===Ke.Statement&&Rt(this._output,this._previous_flags),this._output.set_indent(this._flags.indentation_level,this._flags.alignment))},ne.prototype.start_of_object_property=function(){return this._flags.parent.mode===Ke.ObjectLiteral&&this._flags.mode===Ke.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||be(this._flags.last_token,["get","set"]))},ne.prototype.start_of_statement=function(D){var G=!1;return G=G||be(this._flags.last_token,["var","let","const"])&&D.type===q.WORD,G=G||he(this._flags.last_token,"do"),G=G||!(this._flags.parent.mode===Ke.ObjectLiteral&&this._flags.mode===Ke.Statement)&&be(this._flags.last_token,A)&&!D.newlines,G=G||he(this._flags.last_token,"else")&&!(he(D,"if")&&!D.comments_before),G=G||this._flags.last_token.type===q.END_EXPR&&(this._previous_flags.mode===Ke.ForInitializer||this._previous_flags.mode===Ke.Conditional),G=G||this._flags.last_token.type===q.WORD&&this._flags.mode===Ke.BlockStatement&&!this._flags.in_case&&!(D.text==="--"||D.text==="++")&&this._last_last_text!=="function"&&D.type!==q.WORD&&D.type!==q.RESERVED,G=G||this._flags.mode===Ke.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||be(this._flags.last_token,["get","set"])),G?(this.set_mode(Ke.Statement),this.indent(),this.handle_whitespace_and_comments(D,!0),this.start_of_object_property()||this.allow_wrap_or_preserved_newline(D,be(D,["do","for","if","while"])),!0):!1},ne.prototype.handle_start_expr=function(D){this.start_of_statement(D)||this.handle_whitespace_and_comments(D);var G=Ke.Expression;if(D.text==="["){if(this._flags.last_token.type===q.WORD||this._flags.last_token.text===")"){be(this._flags.last_token,Q)&&(this._output.space_before_token=!0),this.print_token(D),this.set_mode(G),this.indent(),this._options.space_in_paren&&(this._output.space_before_token=!0);return}G=Ke.ArrayLiteral,z(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()),K(this._flags.last_token.type,[q.START_EXPR,q.END_EXPR,q.WORD,q.OPERATOR,q.DOT])||(this._output.space_before_token=!0)}else{if(this._flags.last_token.type===q.RESERVED)this._flags.last_token.text==="for"?(this._output.space_before_token=this._options.space_before_conditional,G=Ke.ForInitializer):K(this._flags.last_token.text,["if","while","switch"])?(this._output.space_before_token=this._options.space_before_conditional,G=Ke.Conditional):K(this._flags.last_word,["await","async"])?this._output.space_before_token=!0:this._flags.last_token.text==="import"&&D.whitespace_before===""?this._output.space_before_token=!1:(K(this._flags.last_token.text,Q)||this._flags.last_token.text==="catch")&&(this._output.space_before_token=!0);else if(this._flags.last_token.type===q.EQUALS||this._flags.last_token.type===q.OPERATOR)this.start_of_object_property()||this.allow_wrap_or_preserved_newline(D);else if(this._flags.last_token.type===q.WORD){this._output.space_before_token=!1;var de=this._tokens.peek(-3);if(this._options.space_after_named_function&&de){var ze=this._tokens.peek(-4);be(de,["async","function"])||de.text==="*"&&be(ze,["async","function"])?this._output.space_before_token=!0:this._flags.mode===Ke.ObjectLiteral?(de.text==="{"||de.text===","||de.text==="*"&&(ze.text==="{"||ze.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(D);(this._flags.last_token.type===q.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(K(this._last_last_text,["function","yield"])||this._flags.mode===Ke.ObjectLiteral&&K(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===q.START_BLOCK?this.print_newline():(this._flags.last_token.type===q.END_EXPR||this._flags.last_token.type===q.START_EXPR||this._flags.last_token.type===q.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===q.COMMA)&&this.allow_wrap_or_preserved_newline(D,D.newlines),this.print_token(D),this.set_mode(G),this._options.space_in_paren&&(this._output.space_before_token=!0),this.indent()},ne.prototype.handle_end_expr=function(D){for(;this._flags.mode===Ke.Statement;)this.restore_mode();this.handle_whitespace_and_comments(D),this._flags.multiline_frame&&this.allow_wrap_or_preserved_newline(D,D.text==="]"&&z(this._flags.mode)&&!this._options.keep_array_indentation),this._options.space_in_paren&&(this._flags.last_token.type===q.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(D),this.restore_mode(),Rt(this._output,this._previous_flags),this._flags.do_while&&this._previous_flags.mode===Ke.Conditional&&(this._previous_flags.mode=Ke.Expression,this._flags.do_block=!1,this._flags.do_while=!1)},ne.prototype.handle_start_block=function(D){this.handle_whitespace_and_comments(D);var G=this._tokens.peek(),de=this._tokens.peek(1);this._flags.last_word==="switch"&&this._flags.last_token.type===q.END_EXPR?(this.set_mode(Ke.BlockStatement),this._flags.in_case_statement=!0):this._flags.case_body?this.set_mode(Ke.BlockStatement):de&&(K(de.text,[":",","])&&K(G.type,[q.STRING,q.WORD,q.RESERVED])||K(G.text,["get","set","..."])&&K(de.type,[q.WORD,q.RESERVED]))?K(this._last_last_text,["class","interface"])&&!K(de.text,[":",","])?this.set_mode(Ke.BlockStatement):this.set_mode(Ke.ObjectLiteral):this._flags.last_token.type===q.OPERATOR&&this._flags.last_token.text==="=>"?this.set_mode(Ke.BlockStatement):K(this._flags.last_token.type,[q.EQUALS,q.START_EXPR,q.COMMA,q.OPERATOR])||be(this._flags.last_token,["return","throw","import","default"])?this.set_mode(Ke.ObjectLiteral):this.set_mode(Ke.BlockStatement),this._flags.last_token&&be(this._flags.last_token.previous,["class","extends"])&&(this._flags.class_start_block=!0);var ze=!G.comments_before&&G.text==="}",pt=ze&&this._flags.last_word==="function"&&this._flags.last_token.type===q.END_EXPR;if(this._options.brace_preserve_inline){var Ut=0,Ie=null;this._flags.inline_frame=!0;do if(Ut+=1,Ie=this._tokens.peek(Ut-1),Ie.newlines){this._flags.inline_frame=!1;break}while(Ie.type!==q.EOF&&!(Ie.type===q.END_BLOCK&&Ie.opened===D))}(this._options.brace_style==="expand"||this._options.brace_style==="none"&&D.newlines)&&!this._flags.inline_frame?this._flags.last_token.type!==q.OPERATOR&&(pt||this._flags.last_token.type===q.EQUALS||be(this._flags.last_token,Te)&&this._flags.last_token.text!=="else")?this._output.space_before_token=!0:this.print_newline(!1,!0):(z(this._previous_flags.mode)&&(this._flags.last_token.type===q.START_EXPR||this._flags.last_token.type===q.COMMA)&&((this._flags.last_token.type===q.COMMA||this._options.space_in_paren)&&(this._output.space_before_token=!0),(this._flags.last_token.type===q.COMMA||this._flags.last_token.type===q.START_EXPR&&this._flags.inline_frame)&&(this.allow_wrap_or_preserved_newline(D),this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame,this._flags.multiline_frame=!1)),this._flags.last_token.type!==q.OPERATOR&&this._flags.last_token.type!==q.START_EXPR&&(K(this._flags.last_token.type,[q.START_BLOCK,q.SEMICOLON])&&!this._flags.inline_frame?this.print_newline():this._output.space_before_token=!0)),this.print_token(D),this.indent(),!ze&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)&&this.print_newline()},ne.prototype.handle_end_block=function(D){for(this.handle_whitespace_and_comments(D);this._flags.mode===Ke.Statement;)this.restore_mode();var G=this._flags.last_token.type===q.START_BLOCK;this._flags.inline_frame&&!G?this._output.space_before_token=!0:this._options.brace_style==="expand"?G||this.print_newline():G||(z(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(D)},ne.prototype.handle_word=function(D){if(D.type===q.RESERVED){if(K(D.text,["set","get"])&&this._flags.mode!==Ke.ObjectLiteral)D.type=q.WORD;else if(D.text==="import"&&K(this._tokens.peek().text,["(","."]))D.type=q.WORD;else if(K(D.text,["as","from"])&&!this._flags.import_block)D.type=q.WORD;else if(this._flags.mode===Ke.ObjectLiteral){var G=this._tokens.peek();G.text===":"&&(D.type=q.WORD)}}if(this.start_of_statement(D)?be(this._flags.last_token,["var","let","const"])&&D.type===q.WORD&&(this._flags.declaration_statement=!0):D.newlines&&!X(this._flags.mode)&&(this._flags.last_token.type!==q.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")&&this._flags.last_token.type!==q.EQUALS&&(this._options.preserve_newlines||!be(this._flags.last_token,["var","let","const","set","get"]))?(this.handle_whitespace_and_comments(D),this.print_newline()):this.handle_whitespace_and_comments(D),this._flags.do_block&&!this._flags.do_while)if(he(D,"while")){this._output.space_before_token=!0,this.print_token(D),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&&he(D,"else"))this._flags.else_block=!0;else{for(;this._flags.mode===Ke.Statement;)this.restore_mode();this._flags.if_block=!1,this._flags.else_block=!1}if(this._flags.in_case_statement&&be(D,["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(D),this._flags.in_case=!0;return}if((this._flags.last_token.type===q.COMMA||this._flags.last_token.type===q.START_EXPR||this._flags.last_token.type===q.EQUALS||this._flags.last_token.type===q.OPERATOR)&&!this.start_of_object_property()&&!(K(this._flags.last_token.text,["+","-"])&&this._last_last_text===":"&&this._flags.parent.mode===Ke.ObjectLiteral)&&this.allow_wrap_or_preserved_newline(D),he(D,"function")){(K(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(K(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===q.OPERATOR))&&!this._output.just_added_blankline()&&!D.comments_before&&(this.print_newline(),this.print_newline(!0)),this._flags.last_token.type===q.RESERVED||this._flags.last_token.type===q.WORD?be(this._flags.last_token,["get","set","new","export"])||be(this._flags.last_token,A)?this._output.space_before_token=!0:he(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===q.OPERATOR||this._flags.last_token.text==="="?this._output.space_before_token=!0:!this._flags.multiline_frame&&(X(this._flags.mode)||z(this._flags.mode))||this.print_newline(),this.print_token(D),this._flags.last_word=D.text;return}var de="NONE";if(this._flags.last_token.type===q.END_BLOCK?this._previous_flags.inline_frame?de="SPACE":be(D,["else","catch","finally","from"])?this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&D.newlines?de="NEWLINE":(de="SPACE",this._output.space_before_token=!0):de="NEWLINE":this._flags.last_token.type===q.SEMICOLON&&this._flags.mode===Ke.BlockStatement?de="NEWLINE":this._flags.last_token.type===q.SEMICOLON&&X(this._flags.mode)?de="SPACE":this._flags.last_token.type===q.STRING?de="NEWLINE":this._flags.last_token.type===q.RESERVED||this._flags.last_token.type===q.WORD||this._flags.last_token.text==="*"&&(K(this._last_last_text,["function","yield"])||this._flags.mode===Ke.ObjectLiteral&&K(this._last_last_text,["{",","]))?de="SPACE":this._flags.last_token.type===q.START_BLOCK?this._flags.inline_frame?de="SPACE":de="NEWLINE":this._flags.last_token.type===q.END_EXPR&&(this._output.space_before_token=!0,de="NEWLINE"),be(D,Q)&&this._flags.last_token.text!==")"&&(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"?de="SPACE":de="NEWLINE"),be(D,["else","catch","finally"]))if((!(this._flags.last_token.type===q.END_BLOCK&&this._previous_flags.mode===Ke.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&D.newlines)&&!this._flags.inline_frame)this.print_newline();else{this._output.trim(!0);var ze=this._output.current_line;ze.last()!=="}"&&this.print_newline(),this._output.space_before_token=!0}else de==="NEWLINE"?be(this._flags.last_token,Te)?this._output.space_before_token=!0:this._flags.last_token.text==="declare"&&be(D,["var","let","const"])?this._output.space_before_token=!0:this._flags.last_token.type!==q.END_EXPR?(this._flags.last_token.type!==q.START_EXPR||!be(D,["var","let","const"]))&&this._flags.last_token.text!==":"&&(he(D,"if")&&he(D.previous,"else")?this._output.space_before_token=!0:this.print_newline()):be(D,Q)&&this._flags.last_token.text!==")"&&this.print_newline():this._flags.multiline_frame&&z(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"?this.print_newline():de==="SPACE"&&(this._output.space_before_token=!0);D.previous&&(D.previous.type===q.WORD||D.previous.type===q.RESERVED)&&(this._output.space_before_token=!0),this.print_token(D),this._flags.last_word=D.text,D.type===q.RESERVED&&(D.text==="do"?this._flags.do_block=!0:D.text==="if"?this._flags.if_block=!0:D.text==="import"?this._flags.import_block=!0:this._flags.import_block&&he(D,"from")&&(this._flags.import_block=!1))},ne.prototype.handle_semicolon=function(D){this.start_of_statement(D)?this._output.space_before_token=!1:this.handle_whitespace_and_comments(D);for(var G=this._tokens.peek();this._flags.mode===Ke.Statement&&!(this._flags.if_block&&he(G,"else"))&&!this._flags.do_block;)this.restore_mode();this._flags.import_block&&(this._flags.import_block=!1),this.print_token(D)},ne.prototype.handle_string=function(D){D.text.startsWith("`")&&D.newlines===0&&D.whitespace_before===""&&(D.previous.text===")"||this._flags.last_token.type===q.WORD)||(this.start_of_statement(D)?this._output.space_before_token=!0:(this.handle_whitespace_and_comments(D),this._flags.last_token.type===q.RESERVED||this._flags.last_token.type===q.WORD||this._flags.inline_frame?this._output.space_before_token=!0:this._flags.last_token.type===q.COMMA||this._flags.last_token.type===q.START_EXPR||this._flags.last_token.type===q.EQUALS||this._flags.last_token.type===q.OPERATOR?this.start_of_object_property()||this.allow_wrap_or_preserved_newline(D):D.text.startsWith("`")&&this._flags.last_token.type===q.END_EXPR&&(D.previous.text==="]"||D.previous.text===")")&&D.newlines===0?this._output.space_before_token=!0:this.print_newline())),this.print_token(D)},ne.prototype.handle_equals=function(D){this.start_of_statement(D)||this.handle_whitespace_and_comments(D),this._flags.declaration_statement&&(this._flags.declaration_assignment=!0),this._output.space_before_token=!0,this.print_token(D),this._output.space_before_token=!0},ne.prototype.handle_comma=function(D){this.handle_whitespace_and_comments(D,!0),this.print_token(D),this._output.space_before_token=!0,this._flags.declaration_statement?(X(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(D)):this._flags.mode===Ke.ObjectLiteral||this._flags.mode===Ke.Statement&&this._flags.parent.mode===Ke.ObjectLiteral?(this._flags.mode===Ke.Statement&&this.restore_mode(),this._flags.inline_frame||this.print_newline()):this._options.comma_first&&this.allow_wrap_or_preserved_newline(D)},ne.prototype.handle_operator=function(D){var G=D.text==="*"&&(be(this._flags.last_token,["function","yield"])||K(this._flags.last_token.type,[q.START_BLOCK,q.COMMA,q.END_BLOCK,q.SEMICOLON])),de=K(D.text,["-","+"])&&(K(this._flags.last_token.type,[q.START_BLOCK,q.START_EXPR,q.EQUALS,q.OPERATOR])||K(this._flags.last_token.text,Q)||this._flags.last_token.text===",");if(!this.start_of_statement(D)){var ze=!G;this.handle_whitespace_and_comments(D,ze)}if(D.text==="*"&&this._flags.last_token.type===q.DOT){this.print_token(D);return}if(D.text==="::"){this.print_token(D);return}if(K(D.text,["-","+"])&&this.start_of_object_property()){this.print_token(D);return}if(this._flags.last_token.type===q.OPERATOR&&K(this._options.operator_position,We)&&this.allow_wrap_or_preserved_newline(D),D.text===":"&&this._flags.in_case){this.print_token(D),this._flags.in_case=!1,this._flags.case_body=!0,this._tokens.peek().type!==q.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 pt=!0,Ut=!0,Ie=!1;if(D.text===":"?this._flags.ternary_depth===0?pt=!1:(this._flags.ternary_depth-=1,Ie=!0):D.text==="?"&&(this._flags.ternary_depth+=1),!de&&!G&&this._options.preserve_newlines&&K(D.text,H)){var qt=D.text===":",Ot=qt&&Ie,wt=qt&&!Ie;switch(this._options.operator_position){case Ee.before_newline:this._output.space_before_token=!wt,this.print_token(D),(!qt||Ot)&&this.allow_wrap_or_preserved_newline(D),this._output.space_before_token=!0;return;case Ee.after_newline:this._output.space_before_token=!0,!qt||Ot?this._tokens.peek().newlines?this.print_newline(!1,!0):this.allow_wrap_or_preserved_newline(D):this._output.space_before_token=!1,this.print_token(D),this._output.space_before_token=!0;return;case Ee.preserve_newline:wt||this.allow_wrap_or_preserved_newline(D),pt=!(this._output.just_added_newline()||wt),this._output.space_before_token=pt,this.print_token(D),this._output.space_before_token=!0;return}}if(G){this.allow_wrap_or_preserved_newline(D),pt=!1;var Ne=this._tokens.peek();Ut=Ne&&K(Ne.type,[q.WORD,q.RESERVED])}else if(D.text==="...")this.allow_wrap_or_preserved_newline(D),pt=this._flags.last_token.type===q.START_BLOCK,Ut=!1;else if(K(D.text,["--","++","!","~"])||de){if((this._flags.last_token.type===q.COMMA||this._flags.last_token.type===q.START_EXPR)&&this.allow_wrap_or_preserved_newline(D),pt=!1,Ut=!1,D.newlines&&(D.text==="--"||D.text==="++"||D.text==="~")){var tt=be(this._flags.last_token,Te)&&D.newlines;tt&&(this._previous_flags.if_block||this._previous_flags.else_block)&&this.restore_mode(),this.print_newline(tt,!0)}this._flags.last_token.text===";"&&X(this._flags.mode)&&(pt=!0),this._flags.last_token.type===q.RESERVED?pt=!0:this._flags.last_token.type===q.END_EXPR?pt=!(this._flags.last_token.text==="]"&&(D.text==="--"||D.text==="++")):this._flags.last_token.type===q.OPERATOR&&(pt=K(D.text,["--","-","++","+"])&&K(this._flags.last_token.text,["--","-","++","+"]),K(D.text,["+","-"])&&K(this._flags.last_token.text,["--","++"])&&(Ut=!0)),(this._flags.mode===Ke.BlockStatement&&!this._flags.inline_frame||this._flags.mode===Ke.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")&&this.print_newline()}this._output.space_before_token=this._output.space_before_token||pt,this.print_token(D),this._output.space_before_token=Ut},ne.prototype.handle_block_comment=function(D,G){if(this._output.raw){this._output.add_raw_token(D),D.directives&&D.directives.preserve==="end"&&(this._output.raw=this._options.test_output_raw);return}if(D.directives){this.print_newline(!1,G),this.print_token(D),D.directives.preserve==="start"&&(this._output.raw=!0),this.print_newline(!1,!0);return}if(!T.newline.test(D.text)&&!D.newlines){this._output.space_before_token=!0,this.print_token(D),this._output.space_before_token=!0;return}else this.print_block_commment(D,G)},ne.prototype.print_block_commment=function(D,G){var de=te(D.text),ze,pt=!1,Ut=!1,Ie=D.whitespace_before,qt=Ie.length;if(this.print_newline(!1,G),this.print_token_line_indentation(D),this._output.add_token(de[0]),this.print_newline(!1,G),de.length>1){for(de=de.slice(1),pt=ee(de,"*"),Ut=fe(de,Ie),pt&&(this._flags.alignment=1),ze=0;ze<de.length;ze++)pt?(this.print_token_line_indentation(D),this._output.add_token($(de[ze]))):Ut&&de[ze]?(this.print_token_line_indentation(D),this._output.add_token(de[ze].substring(qt))):(this._output.current_line.set_indent(-1),this._output.add_token(de[ze])),this.print_newline(!1,G);this._flags.alignment=0}},ne.prototype.handle_comment=function(D,G){D.newlines?this.print_newline(!1,G):this._output.trim(!0),this._output.space_before_token=!0,this.print_token(D),this.print_newline(!1,G)},ne.prototype.handle_dot=function(D){this.start_of_statement(D)||this.handle_whitespace_and_comments(D,!0),this._flags.last_token.text.match("^[0-9]+$")&&(this._output.space_before_token=!0),be(this._flags.last_token,Te)?this._output.space_before_token=!1:this.allow_wrap_or_preserved_newline(D,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(D)},ne.prototype.handle_unknown=function(D,G){this.print_token(D),D.text[D.text.length-1]===`
`&&this.print_newline(!1,G)},ne.prototype.handle_eof=function(D){for(;this._flags.mode===Ke.Statement;)this.restore_mode();this.handle_whitespace_and_comments(D)},P.exports.Beautifier=ne},function(P){function f(k){this.__parent=k,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=[]}f.prototype.clone_empty=function(){var k=new f(this.__parent);return k.set_indent(this.__indent_count,this.__alignment_count),k},f.prototype.item=function(k){return k<0?this.__items[this.__items.length+k]:this.__items[k]},f.prototype.has_match=function(k){for(var T=this.__items.length-1;T>=0;T--)if(this.__items[T].match(k))return!0;return!1},f.prototype.set_indent=function(k,T){this.is_empty()&&(this.__indent_count=k||0,this.__alignment_count=T||0,this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count))},f.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)},f.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},f.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var k=this.__parent.current_line;return k.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count),k.__items=this.__items.slice(this.__wrap_point_index),this.__items=this.__items.slice(0,this.__wrap_point_index),k.__character_count+=this.__character_count-this.__wrap_point_character_count,this.__character_count=this.__wrap_point_character_count,k.__items[0]===" "&&(k.__items.splice(0,1),k.__character_count-=1),!0}return!1},f.prototype.is_empty=function(){return this.__items.length===0},f.prototype.last=function(){return this.is_empty()?null:this.__items[this.__items.length-1]},f.prototype.push=function(k){this.__items.push(k);var T=k.lastIndexOf(`
`);T!==-1?this.__character_count=k.length-T:this.__character_count+=k.length},f.prototype.pop=function(){var k=null;return this.is_empty()||(k=this.__items.pop(),this.__character_count-=k.length),k},f.prototype._remove_indent=function(){this.__indent_count>0&&(this.__indent_count-=1,this.__character_count-=this.__parent.indent_size)},f.prototype._remove_wrap_indent=function(){this.__wrap_point_indent_count>0&&(this.__wrap_point_indent_count-=1)},f.prototype.trim=function(){for(;this.last()===" ";)this.__items.pop(),this.__character_count-=1},f.prototype.toString=function(){var k="";return this.is_empty()?this.__parent.indent_empty_lines&&(k=this.__parent.get_indent_string(this.__indent_count)):(k=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count),k+=this.__items.join("")),k};function ie(k,T){this.__cache=[""],this.__indent_size=k.indent_size,this.__indent_string=k.indent_char,k.indent_with_tabs||(this.__indent_string=new Array(k.indent_size+1).join(k.indent_char)),T=T||"",k.indent_level>0&&(T=new Array(k.indent_level+1).join(this.__indent_string)),this.__base_string=T,this.__base_string_length=T.length}ie.prototype.get_indent_size=function(k,T){var C=this.__base_string_length;return T=T||0,k<0&&(C=0),C+=k*this.__indent_size,C+=T,C},ie.prototype.get_indent_string=function(k,T){var C=this.__base_string;return T=T||0,k<0&&(k=0,C=""),T+=k*this.__indent_size,this.__ensure_cache(T),C+=this.__cache[T],C},ie.prototype.__ensure_cache=function(k){for(;k>=this.__cache.length;)this.__add_column()},ie.prototype.__add_column=function(){var k=this.__cache.length,T=0,C="";this.__indent_size&&k>=this.__indent_size&&(T=Math.floor(k/this.__indent_size),k-=T*this.__indent_size,C=new Array(T+1).join(this.__indent_string)),k&&(C+=new Array(k+1).join(" ")),this.__cache.push(C)};function R(k,T){this.__indent_cache=new ie(k,T),this.raw=!1,this._end_with_newline=k.end_with_newline,this.indent_size=k.indent_size,this.wrap_line_length=k.wrap_line_length,this.indent_empty_lines=k.indent_empty_lines,this.__lines=[],this.previous_line=null,this.current_line=null,this.next_line=new f(this),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1,this.__add_outputline()}R.prototype.__add_outputline=function(){this.previous_line=this.current_line,this.current_line=this.next_line.clone_empty(),this.__lines.push(this.current_line)},R.prototype.get_line_number=function(){return this.__lines.length},R.prototype.get_indent_string=function(k,T){return this.__indent_cache.get_indent_string(k,T)},R.prototype.get_indent_size=function(k,T){return this.__indent_cache.get_indent_size(k,T)},R.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()},R.prototype.add_new_line=function(k){return this.is_empty()||!k&&this.just_added_newline()?!1:(this.raw||this.__add_outputline(),!0)},R.prototype.get_code=function(k){this.trim(!0);var T=this.current_line.pop();T&&(T[T.length-1]===`
`&&(T=T.replace(/\n+$/g,"")),this.current_line.push(T)),this._end_with_newline&&this.__add_outputline();var C=this.__lines.join(`
`);return k!==`
`&&(C=C.replace(/[\n]/g,k)),C},R.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()},R.prototype.set_indent=function(k,T){return k=k||0,T=T||0,this.next_line.set_indent(k,T),this.__lines.length>1?(this.current_line.set_indent(k,T),!0):(this.current_line.set_indent(),!1)},R.prototype.add_raw_token=function(k){for(var T=0;T<k.newlines;T++)this.__add_outputline();this.current_line.set_indent(-1),this.current_line.push(k.whitespace_before),this.current_line.push(k.text),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=!1},R.prototype.add_token=function(k){this.__add_space_before_token(),this.current_line.push(k),this.space_before_token=!1,this.non_breaking_space=!1,this.previous_token_wrapped=this.current_line._allow_wrap()},R.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(" "))},R.prototype.remove_indent=function(k){for(var T=this.__lines.length;k<T;)this.__lines[k]._remove_indent(),k++;this.current_line._remove_wrap_indent()},R.prototype.trim=function(k){for(k=k===void 0?!1:k,this.current_line.trim();k&&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},R.prototype.just_added_newline=function(){return this.current_line.is_empty()},R.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()},R.prototype.ensure_empty_line_above=function(k,T){for(var C=this.__lines.length-2;C>=0;){var O=this.__lines[C];if(O.is_empty())break;if(O.item(0).indexOf(k)!==0&&O.item(-1)!==T){this.__lines.splice(C+1,0,new f(this)),this.previous_line=this.__lines[this.__lines.length-2];break}C--}},P.exports.Output=R},function(P){function f(ie,R,k,T){this.type=ie,this.text=R,this.comments_before=null,this.newlines=k||0,this.whitespace_before=T||"",this.parent=null,this.next=null,this.previous=null,this.opened=null,this.closed=null,this.directives=null}P.exports.Token=f},function(P,f){var ie="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a",R="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a",k="\\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",T="\\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",C="\\\\u[0-9a-fA-F]{4}|\\\\u\\{[0-9a-fA-F]+\\}",O="(?:"+C+"|["+ie+k+"])",Q="(?:"+C+"|["+R+k+T+"])*";f.identifier=new RegExp(O+Q,"g"),f.identifierStart=new RegExp(O),f.identifierMatch=new RegExp("(?:"+C+"|["+R+k+T+"])+");var H=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;f.newline=/[\n\r\u2028\u2029]/,f.lineBreak=new RegExp(`\r
|`+f.newline.source),f.allLineBreaks=new RegExp(f.lineBreak.source,"g")},function(P,f,ie){var R=ie(6).Options,k=["before-newline","after-newline","preserve-newline"];function T(C){R.call(this,C,"js");var O=this.raw_options.brace_style||null;O==="expand-strict"?this.raw_options.brace_style="expand":O==="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 Q=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=!1,this.brace_style="collapse";for(var H=0;H<Q.length;H++)Q[H]==="preserve-inline"?this.brace_preserve_inline=!0:this.brace_style=Q[H];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",k),this.test_output_raw=this._get_boolean("test_output_raw"),this.jslint_happy&&(this.space_after_anon_function=!0)}T.prototype=new R,P.exports.Options=T},function(P){function f(k,T){this.raw_options=ie(k,T),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"])}f.prototype._get_array=function(k,T){var C=this.raw_options[k],O=T||[];return typeof C=="object"?C!==null&&typeof C.concat=="function"&&(O=C.concat()):typeof C=="string"&&(O=C.split(/[^a-zA-Z0-9_\/\-]+/)),O},f.prototype._get_boolean=function(k,T){var C=this.raw_options[k],O=C===void 0?!!T:!!C;return O},f.prototype._get_characters=function(k,T){var C=this.raw_options[k],O=T||"";return typeof C=="string"&&(O=C.replace(/\\r/,"\r").replace(/\\n/,`
`).replace(/\\t/," ")),O},f.prototype._get_number=function(k,T){var C=this.raw_options[k];T=parseInt(T,10),isNaN(T)&&(T=0);var O=parseInt(C,10);return isNaN(O)&&(O=T),O},f.prototype._get_selection=function(k,T,C){var O=this._get_selection_list(k,T,C);if(O.length!==1)throw new Error("Invalid Option Value: The option '"+k+`' can only be one of the following values:
`+T+`
You passed in: '`+this.raw_options[k]+"'");return O[0]},f.prototype._get_selection_list=function(k,T,C){if(!T||T.length===0)throw new Error("Selection list cannot be empty.");if(C=C||[T[0]],!this._is_valid_selection(C,T))throw new Error("Invalid Default Value!");var O=this._get_array(k,C);if(!this._is_valid_selection(O,T))throw new Error("Invalid Option Value: The option '"+k+`' can contain only the following values:
`+T+`
You passed in: '`+this.raw_options[k]+"'");return O},f.prototype._is_valid_selection=function(k,T){return k.length&&T.length&&!k.some(function(C){return T.indexOf(C)===-1})};function ie(k,T){var C={};k=R(k);var O;for(O in k)O!==T&&(C[O]=k[O]);if(T&&k[T])for(O in k[T])C[O]=k[T][O];return C}function R(k){var T={},C;for(C in k){var O=C.replace(/-/g,"_");T[O]=k[C]}return T}P.exports.Options=f,P.exports.normalizeOpts=R,P.exports.mergeOpts=ie},function(P,f,ie){var R=ie(8).InputScanner,k=ie(9).Tokenizer,T=ie(9).TOKEN,C=ie(13).Directives,O=ie(4),Q=ie(12).Pattern,H=ie(14).TemplatablePattern;function q(ee,fe){return fe.indexOf(ee)!==-1}var K={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:T.START,RAW:T.RAW,EOF:T.EOF},$=new C(/\/\*/,/\*\//),V=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/,he=/[0-9]/,be=/[^\d\.]/,Te=">>> === !== &&= ??= ||= << && >= ** != == <= >> || ?? |> < / - + > : & % ? ^ | *".split(" "),se=">>>= ... >>= <<= === >>> !== **= &&= ??= ||= => ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> = ! ? > < : / ^ - + * & % ~ |";se=se.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&"),se="\\?\\.(?!\\d) "+se,se=se.replace(/ /g,"|");var Ee=new RegExp(se),We="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(","),Ke=We.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as","class","extends"]),Rt=new RegExp("^(?:"+Ke.join("|")+")$"),te,z=function(ee,fe){k.call(this,ee,fe),this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var ne=new Q(this._input),A=new H(this._input).read_options(this._options);this.__patterns={template:A,identifier:A.starting_with(O.identifier).matching(O.identifierMatch),number:ne.matching(V),punct:ne.matching(Ee),comment:ne.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:ne.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:ne.matching(/<!--/),html_comment_end:ne.matching(/-->/),include:ne.starting_with(/#include/).until_after(O.lineBreak),shebang:ne.starting_with(/#!/).until_after(O.lineBreak),xml:ne.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:A.until(/['\\\n\r\u2028\u2029]/),double_quote:A.until(/["\\\n\r\u2028\u2029]/),template_text:A.until(/[`\\$]/),template_expression:A.until(/[`}\\]/)}};z.prototype=new k,z.prototype._is_comment=function(ee){return ee.type===K.COMMENT||ee.type===K.BLOCK_COMMENT||ee.type===K.UNKNOWN},z.prototype._is_opening=function(ee){return ee.type===K.START_BLOCK||ee.type===K.START_EXPR},z.prototype._is_closing=function(ee,fe){return(ee.type===K.END_BLOCK||ee.type===K.END_EXPR)&&fe&&(ee.text==="]"&&fe.text==="["||ee.text===")"&&fe.text==="("||ee.text==="}"&&fe.text==="{")},z.prototype._reset=function(){te=!1},z.prototype._get_next_token=function(ee,fe){var ne=null;this._readWhitespace();var A=this._input.peek();return A===null?this._create_token(K.EOF,""):(ne=ne||this._read_non_javascript(A),ne=ne||this._read_string(A),ne=ne||this._read_pair(A,this._input.peek(1)),ne=ne||this._read_word(ee),ne=ne||this._read_singles(A),ne=ne||this._read_comment(A),ne=ne||this._read_regexp(A,ee),ne=ne||this._read_xml(A,ee),ne=ne||this._read_punctuation(),ne=ne||this._create_token(K.UNKNOWN,this._input.next()),ne)},z.prototype._read_word=function(ee){var fe;if(fe=this.__patterns.identifier.read(),fe!=="")return fe=fe.replace(O.allLineBreaks,`
`),!(ee.type===K.DOT||ee.type===K.RESERVED&&(ee.text==="set"||ee.text==="get"))&&Rt.test(fe)?(fe==="in"||fe==="of")&&(ee.type===K.WORD||ee.type===K.STRING)?this._create_token(K.OPERATOR,fe):this._create_token(K.RESERVED,fe):this._create_token(K.WORD,fe);if(fe=this.__patterns.number.read(),fe!=="")return this._create_token(K.WORD,fe)},z.prototype._read_singles=function(ee){var fe=null;return ee==="("||ee==="["?fe=this._create_token(K.START_EXPR,ee):ee===")"||ee==="]"?fe=this._create_token(K.END_EXPR,ee):ee==="{"?fe=this._create_token(K.START_BLOCK,ee):ee==="}"?fe=this._create_token(K.END_BLOCK,ee):ee===";"?fe=this._create_token(K.SEMICOLON,ee):ee==="."&&be.test(this._input.peek(1))?fe=this._create_token(K.DOT,ee):ee===","&&(fe=this._create_token(K.COMMA,ee)),fe&&this._input.next(),fe},z.prototype._read_pair=function(ee,fe){var ne=null;return ee==="#"&&fe==="{"&&(ne=this._create_token(K.START_BLOCK,ee+fe)),ne&&(this._input.next(),this._input.next()),ne},z.prototype._read_punctuation=function(){var ee=this.__patterns.punct.read();if(ee!=="")return ee==="="?this._create_token(K.EQUALS,ee):ee==="?."?this._create_token(K.DOT,ee):this._create_token(K.OPERATOR,ee)},z.prototype._read_non_javascript=function(ee){var fe="";if(ee==="#"){if(this._is_first_token()&&(fe=this.__patterns.shebang.read(),fe))return this._create_token(K.UNKNOWN,fe.trim()+`
`);if(fe=this.__patterns.include.read(),fe)return this._create_token(K.UNKNOWN,fe.trim()+`
`);ee=this._input.next();var ne="#";if(this._input.hasNext()&&this._input.testChar(he)){do ee=this._input.next(),ne+=ee;while(this._input.hasNext()&&ee!=="#"&&ee!=="=");return ee==="#"||(this._input.peek()==="["&&this._input.peek(1)==="]"?(ne+="[]",this._input.next(),this._input.next()):this._input.peek()==="{"&&this._input.peek(1)==="}"&&(ne+="{}",this._input.next(),this._input.next())),this._create_token(K.WORD,ne)}this._input.back()}else if(ee==="<"&&this._is_first_token()){if(fe=this.__patterns.html_comment_start.read(),fe){for(;this._input.hasNext()&&!this._input.testChar(O.newline);)fe+=this._input.next();return te=!0,this._create_token(K.COMMENT,fe)}}else if(te&&ee==="-"&&(fe=this.__patterns.html_comment_end.read(),fe))return te=!1,this._create_token(K.COMMENT,fe);return null},z.prototype._read_comment=function(ee){var fe=null;if(ee==="/"){var ne="";if(this._input.peek(1)==="*"){ne=this.__patterns.block_comment.read();var A=$.get_directives(ne);A&&A.ignore==="start"&&(ne+=$.readIgnored(this._input)),ne=ne.replace(O.allLineBreaks,`
`),fe=this._create_token(K.BLOCK_COMMENT,ne),fe.directives=A}else this._input.peek(1)==="/"&&(ne=this.__patterns.comment.read(),fe=this._create_token(K.COMMENT,ne))}return fe},z.prototype._read_string=function(ee){if(ee==="`"||ee==="'"||ee==='"'){var fe=this._input.next();return this.has_char_escapes=!1,ee==="`"?fe+=this._read_string_recursive("`",!0,"${"):fe+=this._read_string_recursive(ee),this.has_char_escapes&&this._options.unescape_strings&&(fe=X(fe)),this._input.peek()===ee&&(fe+=this._input.next()),fe=fe.replace(O.allLineBreaks,`
`),this._create_token(K.STRING,fe)}return null},z.prototype._allow_regexp_or_xml=function(ee){return ee.type===K.RESERVED&&q(ee.text,["return","case","throw","else","do","typeof","yield"])||ee.type===K.END_EXPR&&ee.text===")"&&ee.opened.previous.type===K.RESERVED&&q(ee.opened.previous.text,["if","while","for"])||q(ee.type,[K.COMMENT,K.START_EXPR,K.START_BLOCK,K.START,K.END_BLOCK,K.OPERATOR,K.EQUALS,K.EOF,K.SEMICOLON,K.COMMA])},z.prototype._read_regexp=function(ee,fe){if(ee==="/"&&this._allow_regexp_or_xml(fe)){for(var ne=this._input.next(),A=!1,D=!1;this._input.hasNext()&&(A||D||this._input.peek()!==ee)&&!this._input.testChar(O.newline);)ne+=this._input.peek(),A?A=!1:(A=this._input.peek()==="\\",this._input.peek()==="["?D=!0:this._input.peek()==="]"&&(D=!1)),this._input.next();return this._input.peek()===ee&&(ne+=this._input.next(),ne+=this._input.read(O.identifier)),this._create_token(K.STRING,ne)}return null},z.prototype._read_xml=function(ee,fe){if(this._options.e4x&&ee==="<"&&this._allow_regexp_or_xml(fe)){var ne="",A=this.__patterns.xml.read_match();if(A){for(var D=A[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}"),G=D.indexOf("{")===0,de=0;A;){var ze=!!A[1],pt=A[2],Ut=!!A[A.length-1]||pt.slice(0,8)==="![CDATA[";if(!Ut&&(pt===D||G&&pt.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))&&(ze?--de:++de),ne+=A[0],de<=0)break;A=this.__patterns.xml.read_match()}return A||(ne+=this._input.match(/[\s\S]*/g)[0]),ne=ne.replace(O.allLineBreaks,`
`),this._create_token(K.STRING,ne)}}return null};function X(ee){for(var fe="",ne=0,A=new R(ee),D=null;A.hasNext();)if(D=A.match(/([\s]|[^\\]|\\\\)+/g),D&&(fe+=D[0]),A.peek()==="\\"){if(A.next(),A.peek()==="x")D=A.match(/x([0-9A-Fa-f]{2})/g);else if(A.peek()==="u")D=A.match(/u([0-9A-Fa-f]{4})/g),D||(D=A.match(/u\{([0-9A-Fa-f]+)\}/g));else{fe+="\\",A.hasNext()&&(fe+=A.next());continue}if(!D||(ne=parseInt(D[1],16),ne>126&&ne<=255&&D[0].indexOf("x")===0))return ee;ne>=0&&ne<32||ne>1114111?fe+="\\"+D[0]:ne===34||ne===39||ne===92?fe+="\\"+String.fromCharCode(ne):fe+=String.fromCharCode(ne)}return fe}z.prototype._read_string_recursive=function(ee,fe,ne){var A,D;ee==="'"?D=this.__patterns.single_quote:ee==='"'?D=this.__patterns.double_quote:ee==="`"?D=this.__patterns.template_text:ee==="}"&&(D=this.__patterns.template_expression);for(var G=D.read(),de="";this._input.hasNext();){if(de=this._input.next(),de===ee||!fe&&O.newline.test(de)){this._input.back();break}else de==="\\"&&this._input.hasNext()?(A=this._input.peek(),A==="x"||A==="u"?this.has_char_escapes=!0:A==="\r"&&this._input.peek(1)===`
`&&this._input.next(),de+=this._input.next()):ne&&(ne==="${"&&de==="$"&&this._input.peek()==="{"&&(de+=this._input.next()),ne===de&&(ee==="`"?de+=this._read_string_recursive("}",fe,"`"):de+=this._read_string_recursive("`",fe,"${"),this._input.hasNext()&&(de+=this._input.next())));de+=D.read(),G+=de}return G},P.exports.Tokenizer=z,P.exports.TOKEN=K,P.exports.positionable_operators=Te.slice(),P.exports.line_starters=We.slice()},function(P){var f=RegExp.prototype.hasOwnProperty("sticky");function ie(R){this.__input=R||"",this.__input_length=this.__input.length,this.__position=0}ie.prototype.restart=function(){this.__position=0},ie.prototype.back=function(){this.__position>0&&(this.__position-=1)},ie.prototype.hasNext=function(){return this.__position<this.__input_length},ie.prototype.next=function(){var R=null;return this.hasNext()&&(R=this.__input.charAt(this.__position),this.__position+=1),R},ie.prototype.peek=function(R){var k=null;return R=R||0,R+=this.__position,R>=0&&R<this.__input_length&&(k=this.__input.charAt(R)),k},ie.prototype.__match=function(R,k){R.lastIndex=k;var T=R.exec(this.__input);return T&&!(f&&R.sticky)&&T.index!==k&&(T=null),T},ie.prototype.test=function(R,k){return k=k||0,k+=this.__position,k>=0&&k<this.__input_length?!!this.__match(R,k):!1},ie.prototype.testChar=function(R,k){var T=this.peek(k);return R.lastIndex=0,T!==null&&R.test(T)},ie.prototype.match=function(R){var k=this.__match(R,this.__position);return k?this.__position+=k[0].length:k=null,k},ie.prototype.read=function(R,k,T){var C="",O;return R&&(O=this.match(R),O&&(C+=O[0])),k&&(O||!R)&&(C+=this.readUntil(k,T)),C},ie.prototype.readUntil=function(R,k){var T="",C=this.__position;R.lastIndex=this.__position;var O=R.exec(this.__input);return O?(C=O.index,k&&(C+=O[0].length)):C=this.__input_length,T=this.__input.substring(this.__position,C),this.__position=C,T},ie.prototype.readUntilAfter=function(R){return this.readUntil(R,!0)},ie.prototype.get_regexp=function(R,k){var T=null,C="g";return k&&f&&(C="y"),typeof R=="string"&&R!==""?T=new RegExp(R,C):R&&(T=new RegExp(R.source,C)),T},ie.prototype.get_literal_regexp=function(R){return RegExp(R.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))},ie.prototype.peekUntilAfter=function(R){var k=this.__position,T=this.readUntilAfter(R);return this.__position=k,T},ie.prototype.lookBack=function(R){var k=this.__position-1;return k>=R.length&&this.__input.substring(k-R.length,k).toLowerCase()===R},P.exports.InputScanner=ie},function(P,f,ie){var R=ie(8).InputScanner,k=ie(3).Token,T=ie(10).TokenStream,C=ie(11).WhitespacePattern,O={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"},Q=function(H,q){this._input=new R(H),this._options=q||{},this.__tokens=null,this._patterns={},this._patterns.whitespace=new C(this._input)};Q.prototype.tokenize=function(){this._input.restart(),this.__tokens=new T,this._reset();for(var H,q=new k(O.START,""),K=null,$=[],V=new T;q.type!==O.EOF;){for(H=this._get_next_token(q,K);this._is_comment(H);)V.add(H),H=this._get_next_token(q,K);V.isEmpty()||(H.comments_before=V,V=new T),H.parent=K,this._is_opening(H)?($.push(K),K=H):K&&this._is_closing(H,K)&&(H.opened=K,K.closed=H,K=$.pop(),H.parent=K),H.previous=q,q.next=H,this.__tokens.add(H),q=H}return this.__tokens},Q.prototype._is_first_token=function(){return this.__tokens.isEmpty()},Q.prototype._reset=function(){},Q.prototype._get_next_token=function(H,q){this._readWhitespace();var K=this._input.read(/.+/g);return K?this._create_token(O.RAW,K):this._create_token(O.EOF,"")},Q.prototype._is_comment=function(H){return!1},Q.prototype._is_opening=function(H){return!1},Q.prototype._is_closing=function(H,q){return!1},Q.prototype._create_token=function(H,q){var K=new k(H,q,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return K},Q.prototype._readWhitespace=function(){return this._patterns.whitespace.read()},P.exports.Tokenizer=Q,P.exports.TOKEN=O},function(P){function f(ie){this.__tokens=[],this.__tokens_length=this.__tokens.length,this.__position=0,this.__parent_token=ie}f.prototype.restart=function(){this.__position=0},f.prototype.isEmpty=function(){return this.__tokens_length===0},f.prototype.hasNext=function(){return this.__position<this.__tokens_length},f.prototype.next=function(){var ie=null;return this.hasNext()&&(ie=this.__tokens[this.__position],this.__position+=1),ie},f.prototype.peek=function(ie){var R=null;return ie=ie||0,ie+=this.__position,ie>=0&&ie<this.__tokens_length&&(R=this.__tokens[ie]),R},f.prototype.add=function(ie){this.__parent_token&&(ie.parent=this.__parent_token),this.__tokens.push(ie),this.__tokens_length+=1},P.exports.TokenStream=f},function(P,f,ie){var R=ie(12).Pattern;function k(T,C){R.call(this,T,C),C?this._line_regexp=this._input.get_regexp(C._line_regexp):this.__set_whitespace_patterns("",""),this.newline_count=0,this.whitespace_before_token=""}k.prototype=new R,k.prototype.__set_whitespace_patterns=function(T,C){T+="\\t ",C+="\\n\\r",this._match_pattern=this._input.get_regexp("["+T+C+"]+",!0),this._newline_regexp=this._input.get_regexp("\\r\\n|["+C+"]")},k.prototype.read=function(){this.newline_count=0,this.whitespace_before_token="";var T=this._input.read(this._match_pattern);if(T===" ")this.whitespace_before_token=" ";else if(T){var C=this.__split(this._newline_regexp,T);this.newline_count=C.length-1,this.whitespace_before_token=C[this.newline_count]}return T},k.prototype.matching=function(T,C){var O=this._create();return O.__set_whitespace_patterns(T,C),O._update(),O},k.prototype._create=function(){return new k(this._input,this)},k.prototype.__split=function(T,C){T.lastIndex=0;for(var O=0,Q=[],H=T.exec(C);H;)Q.push(C.substring(O,H.index)),O=H.index+H[0].length,H=T.exec(C);return O<C.length?Q.push(C.substring(O,C.length)):Q.push(""),Q},P.exports.WhitespacePattern=k},function(P){function f(ie,R){this._input=ie,this._starting_pattern=null,this._match_pattern=null,this._until_pattern=null,this._until_after=!1,R&&(this._starting_pattern=this._input.get_regexp(R._starting_pattern,!0),this._match_pattern=this._input.get_regexp(R._match_pattern,!0),this._until_pattern=this._input.get_regexp(R._until_pattern),this._until_after=R._until_after)}f.prototype.read=function(){var ie=this._input.read(this._starting_pattern);return(!this._starting_pattern||ie)&&(ie+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)),ie},f.prototype.read_match=function(){return this._input.match(this._match_pattern)},f.prototype.until_after=function(ie){var R=this._create();return R._until_after=!0,R._until_pattern=this._input.get_regexp(ie),R._update(),R},f.prototype.until=function(ie){var R=this._create();return R._until_after=!1,R._until_pattern=this._input.get_regexp(ie),R._update(),R},f.prototype.starting_with=function(ie){var R=this._create();return R._starting_pattern=this._input.get_regexp(ie,!0),R._update(),R},f.prototype.matching=function(ie){var R=this._create();return R._match_pattern=this._input.get_regexp(ie,!0),R._update(),R},f.prototype._create=function(){return new f(this._input,this)},f.prototype._update=function(){},P.exports.Pattern=f},function(P){function f(ie,R){ie=typeof ie=="string"?ie:ie.source,R=typeof R=="string"?R:R.source,this.__directives_block_pattern=new RegExp(ie+/ beautify( \w+[:]\w+)+ /.source+R,"g"),this.__directive_pattern=/ (\w+)[:](\w+)/g,this.__directives_end_ignore_pattern=new RegExp(ie+/\sbeautify\signore:end\s/.source+R,"g")}f.prototype.get_directives=function(ie){if(!ie.match(this.__directives_block_pattern))return null;var R={};this.__directive_pattern.lastIndex=0;for(var k=this.__directive_pattern.exec(ie);k;)R[k[1]]=k[2],k=this.__directive_pattern.exec(ie);return R},f.prototype.readIgnored=function(ie){return ie.readUntilAfter(this.__directives_end_ignore_pattern)},P.exports.Directives=f},function(P,f,ie){var R=ie(12).Pattern,k={django:!1,erb:!1,handlebars:!1,php:!1,smarty:!1,angular:!1};function T(C,O){R.call(this,C,O),this.__template_pattern=null,this._disabled=Object.assign({},k),this._excluded=Object.assign({},k),O&&(this.__template_pattern=this._input.get_regexp(O.__template_pattern),this._excluded=Object.assign(this._excluded,O._excluded),this._disabled=Object.assign(this._disabled,O._disabled));var Q=new R(C);this.__patterns={handlebars_comment:Q.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:Q.starting_with(/{{{/).until_after(/}}}/),handlebars:Q.starting_with(/{{/).until_after(/}}/),php:Q.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:Q.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:Q.starting_with(/{%/).until_after(/%}/),django_value:Q.starting_with(/{{/).until_after(/}}/),django_comment:Q.starting_with(/{#/).until_after(/#}/),smarty:Q.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:Q.starting_with(/{\*/).until_after(/\*}/),smarty_literal:Q.starting_with(/{literal}/).until_after(/{\/literal}/)}}T.prototype=new R,T.prototype._create=function(){return new T(this._input,this)},T.prototype._update=function(){this.__set_templated_pattern()},T.prototype.disable=function(C){var O=this._create();return O._disabled[C]=!0,O._update(),O},T.prototype.read_options=function(C){var O=this._create();for(var Q in k)O._disabled[Q]=C.templating.indexOf(Q)===-1;return O._update(),O},T.prototype.exclude=function(C){var O=this._create();return O._excluded[C]=!0,O._update(),O},T.prototype.read=function(){var C="";this._match_pattern?C=this._input.read(this._starting_pattern):C=this._input.read(this._starting_pattern,this.__template_pattern);for(var O=this._read_template();O;)this._match_pattern?O+=this._input.read(this._match_pattern):O+=this._input.readUntil(this.__template_pattern),C+=O,O=this._read_template();return this._until_after&&(C+=this._input.readUntilAfter(this._until_pattern)),C},T.prototype.__set_templated_pattern=function(){var C=[];this._disabled.php||C.push(this.__patterns.php._starting_pattern.source),this._disabled.handlebars||C.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.angular||C.push(this.__patterns.handlebars._starting_pattern.source),this._disabled.erb||C.push(this.__patterns.erb._starting_pattern.source),this._disabled.django||(C.push(this.__patterns.django._starting_pattern.source),C.push(this.__patterns.django_value._starting_pattern.source),C.push(this.__patterns.django_comment._starting_pattern.source)),this._disabled.smarty||C.push(this.__patterns.smarty._starting_pattern.source),this._until_pattern&&C.push(this._until_pattern.source),this.__template_pattern=this._input.get_regexp("(?:"+C.join("|")+")")},T.prototype._read_template=function(){var C="",O=this._input.peek();if(O==="<"){var Q=this._input.peek(1);!this._disabled.php&&!this._excluded.php&&Q==="?"&&(C=C||this.__patterns.php.read()),!this._disabled.erb&&!this._excluded.erb&&Q==="%"&&(C=C||this.__patterns.erb.read())}else O==="{"&&(!this._disabled.handlebars&&!this._excluded.handlebars&&(C=C||this.__patterns.handlebars_comment.read(),C=C||this.__patterns.handlebars_unescaped.read(),C=C||this.__patterns.handlebars.read()),this._disabled.django||(!this._excluded.django&&!this._excluded.handlebars&&(C=C||this.__patterns.django_value.read()),this._excluded.django||(C=C||this.__patterns.django_comment.read(),C=C||this.__patterns.django.read())),this._disabled.smarty||this._disabled.django&&this._disabled.handlebars&&(C=C||this.__patterns.smarty_comment.read(),C=C||this.__patterns.smarty_literal.read(),C=C||this.__patterns.smarty.read()));return C},P.exports.TemplatablePattern=T}],Z={};function S(P){var f=Z[P];if(f!==void 0)return f.exports;var ie=Z[P]={exports:{}};return pe[P](ie,ie.exports,S),ie.exports}var Ae=S(0);we=Ae})();var Ze=we;re=[],le=function(){return{js_beautify:Ze}}.apply(Bt,re),le!==void 0&&(Ci.exports=le)})()},32834:function(Ci){(function(Bt,re){Ci.exports=re()})(this,function(){"use strict";function Bt(De,xe){for(var ke=0;ke<xe.length;ke++){var U=xe[ke];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(De,U.key,U)}}function re(De,xe,ke){return xe&&Bt(De.prototype,xe),ke&&Bt(De,ke),De}function le(De,xe){if(De){if(typeof De=="string")return we(De,xe);var ke=Object.prototype.toString.call(De).slice(8,-1);if(ke==="Object"&&De.constructor&&(ke=De.constructor.name),ke==="Map"||ke==="Set")return Array.from(De);if(ke==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ke))return we(De,xe)}}function we(De,xe){(xe==null||xe>De.length)&&(xe=De.length);for(var ke=0,U=new Array(xe);ke<xe;ke++)U[ke]=De[ke];return U}function Ze(De,xe){var ke=typeof Symbol!="undefined"&&De[Symbol.iterator]||De["@@iterator"];if(ke)return(ke=ke.call(De)).next.bind(ke);if(Array.isArray(De)||(ke=le(De))||xe&&De&&typeof De.length=="number"){ke&&(De=ke);var U=0;return function(){return U>=De.length?{done:!0}:{done:!1,value:De[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 pe={exports:{}};function Z(){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 S(De){pe.exports.defaults=De}pe.exports={defaults:Z(),getDefaults:Z,changeDefaults:S};var Ae=/[&<>"']/,P=/[&<>"']/g,f=/[<>"']|&(?!#?\w+;)/,ie=/[<>"']|&(?!#?\w+;)/g,R={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},k=function(xe){return R[xe]};function T(De,xe){if(xe){if(Ae.test(De))return De.replace(P,k)}else if(f.test(De))return De.replace(ie,k);return De}var C=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function O(De){return De.replace(C,function(xe,ke){return ke=ke.toLowerCase(),ke==="colon"?":":ke.charAt(0)==="#"?ke.charAt(1)==="x"?String.fromCharCode(parseInt(ke.substring(2),16)):String.fromCharCode(+ke.substring(1)):""})}var Q=/(^|[^\[])\^/g;function H(De,xe){De=De.source||De,xe=xe||"";var ke={replace:function(j,ae){return ae=ae.source||ae,ae=ae.replace(Q,"$1"),De=De.replace(j,ae),ke},getRegex:function(){return new RegExp(De,xe)}};return ke}var q=/[^\w:]/g,K=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function $(De,xe,ke){if(De){var U;try{U=decodeURIComponent(O(ke)).replace(q,"").toLowerCase()}catch(j){return null}if(U.indexOf("javascript:")===0||U.indexOf("vbscript:")===0||U.indexOf("data:")===0)return null}xe&&!K.test(ke)&&(ke=se(xe,ke));try{ke=encodeURI(ke).replace(/%25/g,"%")}catch(j){return null}return ke}var V={},he=/^[^:]+:\/*[^/]*$/,be=/^([^:]+:)[\s\S]*$/,Te=/^([^:]+:\/*[^/]*)[\s\S]*$/;function se(De,xe){V[" "+De]||(he.test(De)?V[" "+De]=De+"/":V[" "+De]=Rt(De,"/",!0)),De=V[" "+De];var ke=De.indexOf(":")===-1;return xe.substring(0,2)==="//"?ke?xe:De.replace(be,"$1")+xe:xe.charAt(0)==="/"?ke?xe:De.replace(Te,"$1")+xe:De+xe}var Ee={exec:function(){}};function We(De){for(var xe=1,ke,U;xe<arguments.length;xe++){ke=arguments[xe];for(U in ke)Object.prototype.hasOwnProperty.call(ke,U)&&(De[U]=ke[U])}return De}function Ke(De,xe){var ke=De.replace(/\|/g,function(ae,ue,ve){for(var ht=!1,_t=ue;--_t>=0&&ve[_t]==="\\";)ht=!ht;return ht?"|":" |"}),U=ke.split(/ \|/),j=0;if(U.length>xe)U.splice(xe);else for(;U.length<xe;)U.push("");for(;j<U.length;j++)U[j]=U[j].trim().replace(/\\\|/g,"|");return U}function Rt(De,xe,ke){var U=De.length;if(U===0)return"";for(var j=0;j<U;){var ae=De.charAt(U-j-1);if(ae===xe&&!ke)j++;else if(ae!==xe&&ke)j++;else break}return De.substr(0,U-j)}function te(De,xe){if(De.indexOf(xe[1])===-1)return-1;for(var ke=De.length,U=0,j=0;j<ke;j++)if(De[j]==="\\")j++;else if(De[j]===xe[0])U++;else if(De[j]===xe[1]&&(U--,U<0))return j;return-1}function z(De){De&&De.sanitize&&!De.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 X(De,xe){if(xe<1)return"";for(var ke="";xe>1;)xe&1&&(ke+=De),xe>>=1,De+=De;return ke+De}var ee={escape:T,unescape:O,edit:H,cleanUrl:$,resolveUrl:se,noopTest:Ee,merge:We,splitCells:Ke,rtrim:Rt,findClosingBracket:te,checkSanitizeDeprecation:z,repeatString:X},fe=pe.exports.defaults,ne=ee.rtrim,A=ee.splitCells,D=ee.escape,G=ee.findClosingBracket;function de(De,xe,ke){var U=xe.href,j=xe.title?D(xe.title):null,ae=De[1].replace(/\\([\[\]])/g,"$1");return De[0].charAt(0)!=="!"?{type:"link",raw:ke,href:U,title:j,text:ae}:{type:"image",raw:ke,href:U,title:j,text:D(ae)}}function ze(De,xe){var ke=De.match(/^(\s+)(?:```)/);if(ke===null)return xe;var U=ke[1];return xe.split(`
`).map(function(j){var ae=j.match(/^\s+/);if(ae===null)return j;var ue=ae[0];return ue.length>=U.length?j.slice(U.length):j}).join(`
`)}var pt=function(){function De(ke){this.options=ke||fe}var xe=De.prototype;return xe.space=function(U){var j=this.rules.block.newline.exec(U);if(j)return j[0].length>1?{type:"space",raw:j[0]}:{raw:`
`}},xe.code=function(U){var j=this.rules.block.code.exec(U);if(j){var ae=j[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:j[0],codeBlockStyle:"indented",text:this.options.pedantic?ae:ne(ae,`
`)}}},xe.fences=function(U){var j=this.rules.block.fences.exec(U);if(j){var ae=j[0],ue=ze(ae,j[3]||"");return{type:"code",raw:ae,lang:j[2]?j[2].trim():j[2],text:ue}}},xe.heading=function(U){var j=this.rules.block.heading.exec(U);if(j){var ae=j[2].trim();if(/#$/.test(ae)){var ue=ne(ae,"#");(this.options.pedantic||!ue||/ $/.test(ue))&&(ae=ue.trim())}return{type:"heading",raw:j[0],depth:j[1].length,text:ae}}},xe.nptable=function(U){var j=this.rules.block.nptable.exec(U);if(j){var ae={type:"table",header:A(j[1].replace(/^ *| *\| *$/g,"")),align:j[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:j[3]?j[3].replace(/\n$/,"").split(`
`):[],raw:j[0]};if(ae.header.length===ae.align.length){var ue=ae.align.length,ve;for(ve=0;ve<ue;ve++)/^ *-+: *$/.test(ae.align[ve])?ae.align[ve]="right":/^ *:-+: *$/.test(ae.align[ve])?ae.align[ve]="center":/^ *:-+ *$/.test(ae.align[ve])?ae.align[ve]="left":ae.align[ve]=null;for(ue=ae.cells.length,ve=0;ve<ue;ve++)ae.cells[ve]=A(ae.cells[ve],ae.header.length);return ae}}},xe.hr=function(U){var j=this.rules.block.hr.exec(U);if(j)return{type:"hr",raw:j[0]}},xe.blockquote=function(U){var j=this.rules.block.blockquote.exec(U);if(j){var ae=j[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:j[0],text:ae}}},xe.list=function(U){var j=this.rules.block.list.exec(U);if(j){var ae=j[0],ue=j[2],ve=ue.length>1,ht={type:"list",raw:ae,ordered:ve,start:ve?+ue.slice(0,-1):"",loose:!1,items:[]},_t=j[0].match(this.rules.block.item),lt=!1,Vt,ni,gi,ri,Dt,oi,Mi,Ei,Oi,vi=_t.length;gi=this.rules.block.listItemStart.exec(_t[0]);for(var di=0;di<vi;di++){if(Vt=_t[di],ae=Vt,this.options.pedantic||(Oi=Vt.match(new RegExp("\\n\\s*\\n {0,"+(gi[0].length-1)+"}\\S")),Oi&&(Dt=Vt.length-Oi.index+_t.slice(di+1).join(`
`).length,ht.raw=ht.raw.substring(0,ht.raw.length-Dt),Vt=Vt.substring(0,Oi.index),ae=Vt,vi=di+1)),di!==vi-1){if(ri=this.rules.block.listItemStart.exec(_t[di+1]),this.options.pedantic?ri[1].length>gi[1].length:ri[1].length>=gi[0].length||ri[1].length>3){_t.splice(di,2,_t[di]+(!this.options.pedantic&&ri[1].length<gi[0].length&&!_t[di].match(/\n$/)?"":`
`)+_t[di+1]),di--,vi--;continue}else(!this.options.pedantic||this.options.smartLists?ri[2][ri[2].length-1]!==ue[ue.length-1]:ve===(ri[2].length===1))&&(Dt=_t.slice(di+1).join(`
`).length,ht.raw=ht.raw.substring(0,ht.raw.length-Dt),di=vi-1);gi=ri}ni=Vt.length,Vt=Vt.replace(/^ *([*+-]|\d+[.)]) ?/,""),~Vt.indexOf(`
`)&&(ni-=Vt.length,Vt=this.options.pedantic?Vt.replace(/^ {1,4}/gm,""):Vt.replace(new RegExp("^ {1,"+ni+"}","gm"),"")),Vt=ne(Vt,`
`),di!==vi-1&&(ae=ae+`
`),oi=lt||/\n\n(?!\s*$)/.test(ae),di!==vi-1&&(lt=ae.slice(-2)===`
`,oi||(oi=lt)),oi&&(ht.loose=!0),this.options.gfm&&(Mi=/^\[[ xX]\] /.test(Vt),Ei=void 0,Mi&&(Ei=Vt[1]!==" ",Vt=Vt.replace(/^\[[ xX]\] +/,""))),ht.items.push({type:"list_item",raw:ae,task:Mi,checked:Ei,loose:oi,text:Vt})}return ht}},xe.html=function(U){var j=this.rules.block.html.exec(U);if(j)return{type:this.options.sanitize?"paragraph":"html",raw:j[0],pre:!this.options.sanitizer&&(j[1]==="pre"||j[1]==="script"||j[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(j[0]):D(j[0]):j[0]}},xe.def=function(U){var j=this.rules.block.def.exec(U);if(j){j[3]&&(j[3]=j[3].substring(1,j[3].length-1));var ae=j[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:ae,raw:j[0],href:j[2],title:j[3]}}},xe.table=function(U){var j=this.rules.block.table.exec(U);if(j){var ae={type:"table",header:A(j[1].replace(/^ *| *\| *$/g,"")),align:j[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:j[3]?j[3].replace(/\n$/,"").split(`
`):[]};if(ae.header.length===ae.align.length){ae.raw=j[0];var ue=ae.align.length,ve;for(ve=0;ve<ue;ve++)/^ *-+: *$/.test(ae.align[ve])?ae.align[ve]="right":/^ *:-+: *$/.test(ae.align[ve])?ae.align[ve]="center":/^ *:-+ *$/.test(ae.align[ve])?ae.align[ve]="left":ae.align[ve]=null;for(ue=ae.cells.length,ve=0;ve<ue;ve++)ae.cells[ve]=A(ae.cells[ve].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},xe.lheading=function(U){var j=this.rules.block.lheading.exec(U);if(j)return{type:"heading",raw:j[0],depth:j[2].charAt(0)==="="?1:2,text:j[1]}},xe.paragraph=function(U){var j=this.rules.block.paragraph.exec(U);if(j)return{type:"paragraph",raw:j[0],text:j[1].charAt(j[1].length-1)===`
`?j[1].slice(0,-1):j[1]}},xe.text=function(U){var j=this.rules.block.text.exec(U);if(j)return{type:"text",raw:j[0],text:j[0]}},xe.escape=function(U){var j=this.rules.inline.escape.exec(U);if(j)return{type:"escape",raw:j[0],text:D(j[1])}},xe.tag=function(U,j,ae){var ue=this.rules.inline.tag.exec(U);if(ue)return!j&&/^<a /i.test(ue[0])?j=!0:j&&/^<\/a>/i.test(ue[0])&&(j=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(ue[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ue[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:ue[0],inLink:j,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):D(ue[0]):ue[0]}},xe.link=function(U){var j=this.rules.inline.link.exec(U);if(j){var ae=j[2].trim();if(!this.options.pedantic&&/^</.test(ae)){if(!/>$/.test(ae))return;var ue=ne(ae.slice(0,-1),"\\");if((ae.length-ue.length)%2===0)return}else{var ve=G(j[2],"()");if(ve>-1){var ht=j[0].indexOf("!")===0?5:4,_t=ht+j[1].length+ve;j[2]=j[2].substring(0,ve),j[0]=j[0].substring(0,_t).trim(),j[3]=""}}var lt=j[2],Vt="";if(this.options.pedantic){var ni=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(lt);ni&&(lt=ni[1],Vt=ni[3])}else Vt=j[3]?j[3].slice(1,-1):"";return lt=lt.trim(),/^</.test(lt)&&(this.options.pedantic&&!/>$/.test(ae)?lt=lt.slice(1):lt=lt.slice(1,-1)),de(j,{href:lt&&lt.replace(this.rules.inline._escapes,"$1"),title:Vt&&Vt.replace(this.rules.inline._escapes,"$1")},j[0])}},xe.reflink=function(U,j){var ae;if((ae=this.rules.inline.reflink.exec(U))||(ae=this.rules.inline.nolink.exec(U))){var ue=(ae[2]||ae[1]).replace(/\s+/g," ");if(ue=j[ue.toLowerCase()],!ue||!ue.href){var ve=ae[0].charAt(0);return{type:"text",raw:ve,text:ve}}return de(ae,ue,ae[0])}},xe.emStrong=function(U,j,ae){ae===void 0&&(ae="");var ue=this.rules.inline.emStrong.lDelim.exec(U);if(ue&&!(ue[3]&&ae.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=ue[1]||ue[2]||"";if(!ve||ve&&(ae===""||this.rules.inline.punctuation.exec(ae))){var ht=ue[0].length-1,_t,lt,Vt=ht,ni=0,gi=ue[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(gi.lastIndex=0,j=j.slice(-1*U.length+ht);(ue=gi.exec(j))!=null;)if(_t=ue[1]||ue[2]||ue[3]||ue[4]||ue[5]||ue[6],!!_t){if(lt=_t.length,ue[3]||ue[4]){Vt+=lt;continue}else if((ue[5]||ue[6])&&ht%3&&!((ht+lt)%3)){ni+=lt;continue}if(Vt-=lt,!(Vt>0))return lt=Math.min(lt,lt+Vt+ni),Math.min(ht,lt)%2?{type:"em",raw:U.slice(0,ht+ue.index+lt+1),text:U.slice(1,ht+ue.index+lt)}:{type:"strong",raw:U.slice(0,ht+ue.index+lt+1),text:U.slice(2,ht+ue.index+lt-1)}}}}},xe.codespan=function(U){var j=this.rules.inline.code.exec(U);if(j){var ae=j[2].replace(/\n/g," "),ue=/[^ ]/.test(ae),ve=/^ /.test(ae)&&/ $/.test(ae);return ue&&ve&&(ae=ae.substring(1,ae.length-1)),ae=D(ae,!0),{type:"codespan",raw:j[0],text:ae}}},xe.br=function(U){var j=this.rules.inline.br.exec(U);if(j)return{type:"br",raw:j[0]}},xe.del=function(U){var j=this.rules.inline.del.exec(U);if(j)return{type:"del",raw:j[0],text:j[2]}},xe.autolink=function(U,j){var ae=this.rules.inline.autolink.exec(U);if(ae){var ue,ve;return ae[2]==="@"?(ue=D(this.options.mangle?j(ae[1]):ae[1]),ve="mailto:"+ue):(ue=D(ae[1]),ve=ue),{type:"link",raw:ae[0],text:ue,href:ve,tokens:[{type:"text",raw:ue,text:ue}]}}},xe.url=function(U,j){var ae;if(ae=this.rules.inline.url.exec(U)){var ue,ve;if(ae[2]==="@")ue=D(this.options.mangle?j(ae[0]):ae[0]),ve="mailto:"+ue;else{var ht;do ht=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(ht!==ae[0]);ue=D(ae[0]),ae[1]==="www."?ve="http://"+ue:ve=ue}return{type:"link",raw:ae[0],text:ue,href:ve,tokens:[{type:"text",raw:ue,text:ue}]}}},xe.inlineText=function(U,j,ae){var ue=this.rules.inline.text.exec(U);if(ue){var ve;return j?ve=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):D(ue[0]):ue[0]:ve=D(this.options.smartypants?ae(ue[0]):ue[0]),{type:"text",raw:ue[0],text:ve}}},De}(),Ut=ee.noopTest,Ie=ee.edit,qt=ee.merge,Ot={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:Ut,table:Ut,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};Ot._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,Ot._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,Ot.def=Ie(Ot.def).replace("label",Ot._label).replace("title",Ot._title).getRegex(),Ot.bullet=/(?:[*+-]|\d{1,9}[.)])/,Ot.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,Ot.item=Ie(Ot.item,"gm").replace(/bull/g,Ot.bullet).getRegex(),Ot.listItemStart=Ie(/^( *)(bull) */).replace("bull",Ot.bullet).getRegex(),Ot.list=Ie(Ot.list).replace(/bull/g,Ot.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Ot.def.source+")").getRegex(),Ot._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",Ot._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Ot.html=Ie(Ot.html,"i").replace("comment",Ot._comment).replace("tag",Ot._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ot.paragraph=Ie(Ot._paragraph).replace("hr",Ot.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",Ot._tag).getRegex(),Ot.blockquote=Ie(Ot.blockquote).replace("paragraph",Ot.paragraph).getRegex(),Ot.normal=qt({},Ot),Ot.gfm=qt({},Ot.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*|$)"}),Ot.gfm.nptable=Ie(Ot.gfm.nptable).replace("hr",Ot.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",Ot._tag).getRegex(),Ot.gfm.table=Ie(Ot.gfm.table).replace("hr",Ot.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",Ot._tag).getRegex(),Ot.pedantic=qt({},Ot.normal,{html:Ie(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ot._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:Ut,paragraph:Ie(Ot.normal._paragraph).replace("hr",Ot.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Ot.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var wt={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ut,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:Ut,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};wt._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",wt.punctuation=Ie(wt.punctuation).replace(/punctuation/g,wt._punctuation).getRegex(),wt.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,wt.escapedEmSt=/\\\*|\\_/g,wt._comment=Ie(Ot._comment).replace("(?:-->|$)","-->").getRegex(),wt.emStrong.lDelim=Ie(wt.emStrong.lDelim).replace(/punct/g,wt._punctuation).getRegex(),wt.emStrong.rDelimAst=Ie(wt.emStrong.rDelimAst,"g").replace(/punct/g,wt._punctuation).getRegex(),wt.emStrong.rDelimUnd=Ie(wt.emStrong.rDelimUnd,"g").replace(/punct/g,wt._punctuation).getRegex(),wt._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,wt._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,wt._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])?)+(?![-_])/,wt.autolink=Ie(wt.autolink).replace("scheme",wt._scheme).replace("email",wt._email).getRegex(),wt._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,wt.tag=Ie(wt.tag).replace("comment",wt._comment).replace("attribute",wt._attribute).getRegex(),wt._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,wt._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,wt._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,wt.link=Ie(wt.link).replace("label",wt._label).replace("href",wt._href).replace("title",wt._title).getRegex(),wt.reflink=Ie(wt.reflink).replace("label",wt._label).getRegex(),wt.reflinkSearch=Ie(wt.reflinkSearch,"g").replace("reflink",wt.reflink).replace("nolink",wt.nolink).getRegex(),wt.normal=qt({},wt),wt.pedantic=qt({},wt.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:Ie(/^!?\[(label)\]\((.*?)\)/).replace("label",wt._label).getRegex(),reflink:Ie(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wt._label).getRegex()}),wt.gfm=qt({},wt.normal,{escape:Ie(wt.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),wt.gfm.url=Ie(wt.gfm.url,"i").replace("email",wt.gfm._extended_email).getRegex(),wt.breaks=qt({},wt.gfm,{br:Ie(wt.br).replace("{2,}","*").getRegex(),text:Ie(wt.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var Ne={block:Ot,inline:wt},tt=pt,mt=pe.exports.defaults,ct=Ne.block,ei=Ne.inline,Ce=ee.repeatString;function Fe(De){return De.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 me(De){var xe="",ke,U,j=De.length;for(ke=0;ke<j;ke++)U=De.charCodeAt(ke),Math.random()>.5&&(U="x"+U.toString(16)),xe+="&#"+U+";";return xe}var Ye=function(){function De(ke){this.tokens=[],this.tokens.links=Object.create(null),this.options=ke||mt,this.options.tokenizer=this.options.tokenizer||new tt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var U={block:ct.normal,inline:ei.normal};this.options.pedantic?(U.block=ct.pedantic,U.inline=ei.pedantic):this.options.gfm&&(U.block=ct.gfm,this.options.breaks?U.inline=ei.breaks:U.inline=ei.gfm),this.tokenizer.rules=U}De.lex=function(U,j){var ae=new De(j);return ae.lex(U)},De.lexInline=function(U,j){var ae=new De(j);return ae.inlineTokens(U)};var xe=De.prototype;return xe.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},xe.blockTokens=function(U,j,ae){j===void 0&&(j=[]),ae===void 0&&(ae=!0),this.options.pedantic&&(U=U.replace(/^ +$/gm,""));for(var ue,ve,ht,_t;U;){if(ue=this.tokenizer.space(U)){U=U.substring(ue.raw.length),ue.type&&j.push(ue);continue}if(ue=this.tokenizer.code(U)){U=U.substring(ue.raw.length),_t=j[j.length-1],_t&&_t.type==="paragraph"?(_t.raw+=`
`+ue.raw,_t.text+=`
`+ue.text):j.push(ue);continue}if(ue=this.tokenizer.fences(U)){U=U.substring(ue.raw.length),j.push(ue);continue}if(ue=this.tokenizer.heading(U)){U=U.substring(ue.raw.length),j.push(ue);continue}if(ue=this.tokenizer.nptable(U)){U=U.substring(ue.raw.length),j.push(ue);continue}if(ue=this.tokenizer.hr(U)){U=U.substring(ue.raw.length),j.push(ue);continue}if(ue=this.tokenizer.blockquote(U)){U=U.substring(ue.raw.length),ue.tokens=this.blockTokens(ue.text,[],ae),j.push(ue);continue}if(ue=this.tokenizer.list(U)){for(U=U.substring(ue.raw.length),ht=ue.items.length,ve=0;ve<ht;ve++)ue.items[ve].tokens=this.blockTokens(ue.items[ve].text,[],!1);j.push(ue);continue}if(ue=this.tokenizer.html(U)){U=U.substring(ue.raw.length),j.push(ue);continue}if(ae&&(ue=this.tokenizer.def(U))){U=U.substring(ue.raw.length),this.tokens.links[ue.tag]||(this.tokens.links[ue.tag]={href:ue.href,title:ue.title});continue}if(ue=this.tokenizer.table(U)){U=U.substring(ue.raw.length),j.push(ue);continue}if(ue=this.tokenizer.lheading(U)){U=U.substring(ue.raw.length),j.push(ue);continue}if(ae&&(ue=this.tokenizer.paragraph(U))){U=U.substring(ue.raw.length),j.push(ue);continue}if(ue=this.tokenizer.text(U)){U=U.substring(ue.raw.length),_t=j[j.length-1],_t&&_t.type==="text"?(_t.raw+=`
`+ue.raw,_t.text+=`
`+ue.text):j.push(ue);continue}if(U){var lt="Infinite loop on byte: "+U.charCodeAt(0);if(this.options.silent){console.error(lt);break}else throw new Error(lt)}}return j},xe.inline=function(U){var j,ae,ue,ve,ht,_t,lt=U.length;for(j=0;j<lt;j++)switch(_t=U[j],_t.type){case"paragraph":case"text":case"heading":{_t.tokens=[],this.inlineTokens(_t.text,_t.tokens);break}case"table":{for(_t.tokens={header:[],cells:[]},ve=_t.header.length,ae=0;ae<ve;ae++)_t.tokens.header[ae]=[],this.inlineTokens(_t.header[ae],_t.tokens.header[ae]);for(ve=_t.cells.length,ae=0;ae<ve;ae++)for(ht=_t.cells[ae],_t.tokens.cells[ae]=[],ue=0;ue<ht.length;ue++)_t.tokens.cells[ae][ue]=[],this.inlineTokens(ht[ue],_t.tokens.cells[ae][ue]);break}case"blockquote":{this.inline(_t.tokens);break}case"list":{for(ve=_t.items.length,ae=0;ae<ve;ae++)this.inline(_t.items[ae].tokens);break}}return U},xe.inlineTokens=function(U,j,ae,ue){j===void 0&&(j=[]),ae===void 0&&(ae=!1),ue===void 0&&(ue=!1);var ve,ht,_t=U,lt,Vt,ni;if(this.tokens.links){var gi=Object.keys(this.tokens.links);if(gi.length>0)for(;(lt=this.tokenizer.rules.inline.reflinkSearch.exec(_t))!=null;)gi.includes(lt[0].slice(lt[0].lastIndexOf("[")+1,-1))&&(_t=_t.slice(0,lt.index)+"["+Ce("a",lt[0].length-2)+"]"+_t.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(lt=this.tokenizer.rules.inline.blockSkip.exec(_t))!=null;)_t=_t.slice(0,lt.index)+"["+Ce("a",lt[0].length-2)+"]"+_t.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(lt=this.tokenizer.rules.inline.escapedEmSt.exec(_t))!=null;)_t=_t.slice(0,lt.index)+"++"+_t.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;U;){if(Vt||(ni=""),Vt=!1,ve=this.tokenizer.escape(U)){U=U.substring(ve.raw.length),j.push(ve);continue}if(ve=this.tokenizer.tag(U,ae,ue)){U=U.substring(ve.raw.length),ae=ve.inLink,ue=ve.inRawBlock;var ri=j[j.length-1];ri&&ve.type==="text"&&ri.type==="text"?(ri.raw+=ve.raw,ri.text+=ve.text):j.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,ue)),j.push(ve);continue}if(ve=this.tokenizer.reflink(U,this.tokens.links)){U=U.substring(ve.raw.length);var Dt=j[j.length-1];ve.type==="link"?(ve.tokens=this.inlineTokens(ve.text,[],!0,ue),j.push(ve)):Dt&&ve.type==="text"&&Dt.type==="text"?(Dt.raw+=ve.raw,Dt.text+=ve.text):j.push(ve);continue}if(ve=this.tokenizer.emStrong(U,_t,ni)){U=U.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],ae,ue),j.push(ve);continue}if(ve=this.tokenizer.codespan(U)){U=U.substring(ve.raw.length),j.push(ve);continue}if(ve=this.tokenizer.br(U)){U=U.substring(ve.raw.length),j.push(ve);continue}if(ve=this.tokenizer.del(U)){U=U.substring(ve.raw.length),ve.tokens=this.inlineTokens(ve.text,[],ae,ue),j.push(ve);continue}if(ve=this.tokenizer.autolink(U,me)){U=U.substring(ve.raw.length),j.push(ve);continue}if(!ae&&(ve=this.tokenizer.url(U,me))){U=U.substring(ve.raw.length),j.push(ve);continue}if(ve=this.tokenizer.inlineText(U,ue,Fe)){U=U.substring(ve.raw.length),ve.raw.slice(-1)!=="_"&&(ni=ve.raw.slice(-1)),Vt=!0,ht=j[j.length-1],ht&&ht.type==="text"?(ht.raw+=ve.raw,ht.text+=ve.text):j.push(ve);continue}if(U){var oi="Infinite loop on byte: "+U.charCodeAt(0);if(this.options.silent){console.error(oi);break}else throw new Error(oi)}}return j},re(De,null,[{key:"rules",get:function(){return{block:ct,inline:ei}}}]),De}(),at=pe.exports.defaults,Xe=ee.cleanUrl,Y=ee.escape,ye=function(){function De(ke){this.options=ke||at}var xe=De.prototype;return xe.code=function(U,j,ae){var ue=(j||"").match(/\S*/)[0];if(this.options.highlight){var ve=this.options.highlight(U,ue);ve!=null&&ve!==U&&(ae=!0,U=ve)}return U=U.replace(/\n$/,"")+`
`,ue?'<pre><code class="'+this.options.langPrefix+Y(ue,!0)+'">'+(ae?U:Y(U,!0))+`</code></pre>
`:"<pre><code>"+(ae?U:Y(U,!0))+`</code></pre>
`},xe.blockquote=function(U){return`<blockquote>
`+U+`</blockquote>
`},xe.html=function(U){return U},xe.heading=function(U,j,ae,ue){return this.options.headerIds?"<h"+j+' id="'+this.options.headerPrefix+ue.slug(ae)+'">'+U+"</h"+j+`>
`:"<h"+j+">"+U+"</h"+j+`>
`},xe.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},xe.list=function(U,j,ae){var ue=j?"ol":"ul",ve=j&&ae!==1?' start="'+ae+'"':"";return"<"+ue+ve+`>
`+U+"</"+ue+`>
`},xe.listitem=function(U){return"<li>"+U+`</li>
`},xe.checkbox=function(U){return"<input "+(U?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},xe.paragraph=function(U){return"<p>"+U+`</p>
`},xe.table=function(U,j){return j&&(j="<tbody>"+j+"</tbody>"),`<table>
<thead>
`+U+`</thead>
`+j+`</table>
`},xe.tablerow=function(U){return`<tr>
`+U+`</tr>
`},xe.tablecell=function(U,j){var ae=j.header?"th":"td",ue=j.align?"<"+ae+' align="'+j.align+'">':"<"+ae+">";return ue+U+"</"+ae+`>
`},xe.strong=function(U){return"<strong>"+U+"</strong>"},xe.em=function(U){return"<em>"+U+"</em>"},xe.codespan=function(U){return"<code>"+U+"</code>"},xe.br=function(){return this.options.xhtml?"<br/>":"<br>"},xe.del=function(U){return"<del>"+U+"</del>"},xe.link=function(U,j,ae){if(U=Xe(this.options.sanitize,this.options.baseUrl,U),U===null)return ae;var ue='<a href="'+Y(U)+'"';return j&&(ue+=' title="'+j+'"'),ue+=">"+ae+"</a>",ue},xe.image=function(U,j,ae){if(U=Xe(this.options.sanitize,this.options.baseUrl,U),U===null)return ae;var ue='<img src="'+U+'" alt="'+ae+'"';return j&&(ue+=' title="'+j+'"'),ue+=this.options.xhtml?"/>":">",ue},xe.text=function(U){return U},De}(),Oe=function(){function De(){}var xe=De.prototype;return xe.strong=function(U){return U},xe.em=function(U){return U},xe.codespan=function(U){return U},xe.del=function(U){return U},xe.html=function(U){return U},xe.text=function(U){return U},xe.link=function(U,j,ae){return""+ae},xe.image=function(U,j,ae){return""+ae},xe.br=function(){return""},De}(),qe=function(){function De(){this.seen={}}var xe=De.prototype;return xe.serialize=function(U){return U.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},xe.getNextSafeSlug=function(U,j){var ae=U,ue=0;if(this.seen.hasOwnProperty(ae)){ue=this.seen[U];do ue++,ae=U+"-"+ue;while(this.seen.hasOwnProperty(ae))}return j||(this.seen[U]=ue,this.seen[ae]=0),ae},xe.slug=function(U,j){j===void 0&&(j={});var ae=this.serialize(U);return this.getNextSafeSlug(ae,j.dryrun)},De}(),ot=ye,vt=Oe,jt=qe,gt=pe.exports.defaults,Se=ee.unescape,yt=function(){function De(ke){this.options=ke||gt,this.options.renderer=this.options.renderer||new ot,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new vt,this.slugger=new jt}De.parse=function(U,j){var ae=new De(j);return ae.parse(U)},De.parseInline=function(U,j){var ae=new De(j);return ae.parseInline(U)};var xe=De.prototype;return xe.parse=function(U,j){j===void 0&&(j=!0);var ae="",ue,ve,ht,_t,lt,Vt,ni,gi,ri,Dt,oi,Mi,Ei,Oi,vi,di,zi,Wi,rn=U.length;for(ue=0;ue<rn;ue++)switch(Dt=U[ue],Dt.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(Dt.tokens),Dt.depth,Se(this.parseInline(Dt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(Dt.text,Dt.lang,Dt.escaped);continue}case"table":{for(gi="",ni="",_t=Dt.header.length,ve=0;ve<_t;ve++)ni+=this.renderer.tablecell(this.parseInline(Dt.tokens.header[ve]),{header:!0,align:Dt.align[ve]});for(gi+=this.renderer.tablerow(ni),ri="",_t=Dt.cells.length,ve=0;ve<_t;ve++){for(Vt=Dt.tokens.cells[ve],ni="",lt=Vt.length,ht=0;ht<lt;ht++)ni+=this.renderer.tablecell(this.parseInline(Vt[ht]),{header:!1,align:Dt.align[ht]});ri+=this.renderer.tablerow(ni)}ae+=this.renderer.table(gi,ri);continue}case"blockquote":{ri=this.parse(Dt.tokens),ae+=this.renderer.blockquote(ri);continue}case"list":{for(oi=Dt.ordered,Mi=Dt.start,Ei=Dt.loose,_t=Dt.items.length,ri="",ve=0;ve<_t;ve++)vi=Dt.items[ve],di=vi.checked,zi=vi.task,Oi="",vi.task&&(Wi=this.renderer.checkbox(di),Ei?vi.tokens.length>0&&vi.tokens[0].type==="text"?(vi.tokens[0].text=Wi+" "+vi.tokens[0].text,vi.tokens[0].tokens&&vi.tokens[0].tokens.length>0&&vi.tokens[0].tokens[0].type==="text"&&(vi.tokens[0].tokens[0].text=Wi+" "+vi.tokens[0].tokens[0].text)):vi.tokens.unshift({type:"text",text:Wi}):Oi+=Wi),Oi+=this.parse(vi.tokens,Ei),ri+=this.renderer.listitem(Oi,zi,di);ae+=this.renderer.list(ri,oi,Mi);continue}case"html":{ae+=this.renderer.html(Dt.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(Dt.tokens));continue}case"text":{for(ri=Dt.tokens?this.parseInline(Dt.tokens):Dt.text;ue+1<rn&&U[ue+1].type==="text";)Dt=U[++ue],ri+=`
`+(Dt.tokens?this.parseInline(Dt.tokens):Dt.text);ae+=j?this.renderer.paragraph(ri):ri;continue}default:{var Yi='Token with "'+Dt.type+'" type was not found.';if(this.options.silent){console.error(Yi);return}else throw new Error(Yi)}}return ae},xe.parseInline=function(U,j){j=j||this.renderer;var ae="",ue,ve,ht=U.length;for(ue=0;ue<ht;ue++)switch(ve=U[ue],ve.type){case"escape":{ae+=j.text(ve.text);break}case"html":{ae+=j.html(ve.text);break}case"link":{ae+=j.link(ve.href,ve.title,this.parseInline(ve.tokens,j));break}case"image":{ae+=j.image(ve.href,ve.title,ve.text);break}case"strong":{ae+=j.strong(this.parseInline(ve.tokens,j));break}case"em":{ae+=j.em(this.parseInline(ve.tokens,j));break}case"codespan":{ae+=j.codespan(ve.text);break}case"br":{ae+=j.br();break}case"del":{ae+=j.del(this.parseInline(ve.tokens,j));break}case"text":{ae+=j.text(ve.text);break}default:{var _t='Token with "'+ve.type+'" type was not found.';if(this.options.silent){console.error(_t);return}else throw new Error(_t)}}return ae},De}(),Wt=Ye,Gt=yt,Le=pt,Me=ye,rt=Oe,bt=qe,je=ee.merge,Mt=ee.checkSanitizeDeprecation,Ct=ee.escape,Et=pe.exports.getDefaults,Nt=pe.exports.changeDefaults,Xt=pe.exports.defaults;function Je(De,xe,ke){if(typeof De=="undefined"||De===null)throw new Error("marked(): input parameter is undefined or null");if(typeof De!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(De)+", string expected");if(typeof xe=="function"&&(ke=xe,xe=null),xe=je({},Je.defaults,xe||{}),Mt(xe),ke){var U=xe.highlight,j;try{j=Wt.lex(De,xe)}catch(ht){return ke(ht)}var ae=function(_t){var lt;if(!_t)try{xe.walkTokens&&Je.walkTokens(j,xe.walkTokens),lt=Gt.parse(j,xe)}catch(Vt){_t=Vt}return xe.highlight=U,_t?ke(_t):ke(null,lt)};if(!U||U.length<3||(delete xe.highlight,!j.length))return ae();var ue=0;Je.walkTokens(j,function(ht){ht.type==="code"&&(ue++,setTimeout(function(){U(ht.text,ht.lang,function(_t,lt){if(_t)return ae(_t);lt!=null&&lt!==ht.text&&(ht.text=lt,ht.escaped=!0),ue--,ue===0&&ae()})},0))}),ue===0&&ae();return}try{var ve=Wt.lex(De,xe);return xe.walkTokens&&Je.walkTokens(ve,xe.walkTokens),Gt.parse(ve,xe)}catch(ht){if(ht.message+=`
Please report this to https://github.com/markedjs/marked.`,xe.silent)return"<p>An error occurred:</p><pre>"+Ct(ht.message+"",!0)+"</pre>";throw ht}}Je.options=Je.setOptions=function(De){return je(Je.defaults,De),Nt(Je.defaults),Je},Je.getDefaults=Et,Je.defaults=Xt,Je.use=function(De){var xe=je({},De);if(De.renderer&&function(){var U=Je.defaults.renderer||new Me,j=function(ve){var ht=U[ve];U[ve]=function(){for(var _t=arguments.length,lt=new Array(_t),Vt=0;Vt<_t;Vt++)lt[Vt]=arguments[Vt];var ni=De.renderer[ve].apply(U,lt);return ni===!1&&(ni=ht.apply(U,lt)),ni}};for(var ae in De.renderer)j(ae);xe.renderer=U}(),De.tokenizer&&function(){var U=Je.defaults.tokenizer||new Le,j=function(ve){var ht=U[ve];U[ve]=function(){for(var _t=arguments.length,lt=new Array(_t),Vt=0;Vt<_t;Vt++)lt[Vt]=arguments[Vt];var ni=De.tokenizer[ve].apply(U,lt);return ni===!1&&(ni=ht.apply(U,lt)),ni}};for(var ae in De.tokenizer)j(ae);xe.tokenizer=U}(),De.walkTokens){var ke=Je.defaults.walkTokens;xe.walkTokens=function(U){De.walkTokens(U),ke&&ke(U)}}Je.setOptions(xe)},Je.walkTokens=function(De,xe){for(var ke=Ze(De),U;!(U=ke()).done;){var j=U.value;switch(xe(j),j.type){case"table":{for(var ae=Ze(j.tokens.header),ue;!(ue=ae()).done;){var ve=ue.value;Je.walkTokens(ve,xe)}for(var ht=Ze(j.tokens.cells),_t;!(_t=ht()).done;)for(var lt=_t.value,Vt=Ze(lt),ni;!(ni=Vt()).done;){var gi=ni.value;Je.walkTokens(gi,xe)}break}case"list":{Je.walkTokens(j.items,xe);break}default:j.tokens&&Je.walkTokens(j.tokens,xe)}}},Je.parseInline=function(De,xe){if(typeof De=="undefined"||De===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof De!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(De)+", string expected");xe=je({},Je.defaults,xe||{}),Mt(xe);try{var ke=Wt.lexInline(De,xe);return xe.walkTokens&&Je.walkTokens(ke,xe.walkTokens),Gt.parseInline(ke,xe)}catch(U){if(U.message+=`
Please report this to https://github.com/markedjs/marked.`,xe.silent)return"<p>An error occurred:</p><pre>"+Ct(U.message+"",!0)+"</pre>";throw U}},Je.Parser=Gt,Je.parser=Gt.parse,Je.Renderer=Me,Je.TextRenderer=rt,Je.Lexer=Wt,Je.lexer=Wt.lex,Je.Tokenizer=Le,Je.Slugger=bt,Je.parse=Je;var zt=Je;return zt})},11690:function(Ci){const Bt=/[&<>"']/,re=/[&<>"']/g,le=/[<>"']|&(?!#?\w+;)/,we=/[<>"']|&(?!#?\w+;)/g,Ze={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pe=se=>Ze[se];function Z(se,Ee){if(Ee){if(Bt.test(se))return se.replace(re,pe)}else if(le.test(se))return se.replace(we,pe);return se}const S=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Ae(se){return se.replace(S,(Ee,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 P=/(^|[^\[])\^/g;function f(se,Ee){se=se.source||se,Ee=Ee||"";const We={replace:(Ke,Rt)=>(Rt=Rt.source||Rt,Rt=Rt.replace(P,"$1"),se=se.replace(Ke,Rt),We),getRegex:()=>new RegExp(se,Ee)};return We}const ie=/[^\w:]/g,R=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(se,Ee,We){if(se){let Ke;try{Ke=decodeURIComponent(Ae(We)).replace(ie,"").toLowerCase()}catch(Rt){return null}if(Ke.indexOf("javascript:")===0||Ke.indexOf("vbscript:")===0||Ke.indexOf("data:")===0)return null}Ee&&!R.test(We)&&(We=H(Ee,We));try{We=encodeURI(We).replace(/%25/g,"%")}catch(Ke){return null}return We}const T={},C=/^[^:]+:\/*[^/]*$/,O=/^([^:]+:)[\s\S]*$/,Q=/^([^:]+:\/*[^/]*)[\s\S]*$/;function H(se,Ee){T[" "+se]||(C.test(se)?T[" "+se]=se+"/":T[" "+se]=V(se,"/",!0)),se=T[" "+se];const We=se.indexOf(":")===-1;return Ee.substring(0,2)==="//"?We?Ee:se.replace(O,"$1")+Ee:Ee.charAt(0)==="/"?We?Ee:se.replace(Q,"$1")+Ee:se+Ee}const q={exec:function(){}};function K(se){let Ee=1,We,Ke;for(;Ee<arguments.length;Ee++){We=arguments[Ee];for(Ke in We)Object.prototype.hasOwnProperty.call(We,Ke)&&(se[Ke]=We[Ke])}return se}function $(se,Ee){const We=se.replace(/\|/g,(te,z,X)=>{let ee=!1,fe=z;for(;--fe>=0&&X[fe]==="\\";)ee=!ee;return ee?"|":" |"}),Ke=We.split(/ \|/);let Rt=0;if(Ke.length>Ee)Ke.splice(Ee);else for(;Ke.length<Ee;)Ke.push("");for(;Rt<Ke.length;Rt++)Ke[Rt]=Ke[Rt].trim().replace(/\\\|/g,"|");return Ke}function V(se,Ee,We){const Ke=se.length;if(Ke===0)return"";let Rt=0;for(;Rt<Ke;){const te=se.charAt(Ke-Rt-1);if(te===Ee&&!We)Rt++;else if(te!==Ee&&We)Rt++;else break}return se.substr(0,Ke-Rt)}function he(se,Ee){if(se.indexOf(Ee[1])===-1)return-1;const We=se.length;let Ke=0,Rt=0;for(;Rt<We;Rt++)if(se[Rt]==="\\")Rt++;else if(se[Rt]===Ee[0])Ke++;else if(se[Rt]===Ee[1]&&(Ke--,Ke<0))return Rt;return-1}function be(se){se&&se.sanitize&&!se.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(se,Ee){if(Ee<1)return"";let We="";for(;Ee>1;)Ee&1&&(We+=se),Ee>>=1,se+=se;return We+se}Ci.exports={escape:Z,unescape:Ae,edit:f,cleanUrl:k,resolveUrl:H,noopTest:q,merge:K,splitCells:$,rtrim:V,findClosingBracket:he,checkSanitizeDeprecation:be,repeatString:Te}},75918:function(Ci,Bt,re){"use strict";re.d(Bt,{Wi:function(){return S},Z0:function(){return Ae},aU:function(){return Z},eZ:function(){return f},wY:function(){return P}});var le=re(4348),we=re(69323),Ze=re(13268),pe=function(ie,R,k,T){function C(O){return O instanceof k?O:new k(function(Q){Q(O)})}return new(k||(k=Promise))(function(O,Q){function H($){try{K(T.next($))}catch(V){Q(V)}}function q($){try{K(T.throw($))}catch(V){Q(V)}}function K($){$.done?O($.value):C($.value).then(H,q)}K((T=T.apply(ie,R||[])).next())})};class Z extends we.JT{constructor(R,k="",T="",C=!0,O){super(),this._onDidChange=this._register(new le.Q5),this.onDidChange=this._onDidChange.event,this._enabled=!0,this._id=R,this._label=k,this._cssClass=T,this._enabled=C,this._actionCallback=O}get id(){return this._id}get label(){return this._label}set label(R){this._setLabel(R)}_setLabel(R){this._label!==R&&(this._label=R,this._onDidChange.fire({label:R}))}get tooltip(){return this._tooltip||""}set tooltip(R){this._setTooltip(R)}_setTooltip(R){this._tooltip!==R&&(this._tooltip=R,this._onDidChange.fire({tooltip:R}))}get class(){return this._cssClass}set class(R){this._setClass(R)}_setClass(R){this._cssClass!==R&&(this._cssClass=R,this._onDidChange.fire({class:R}))}get enabled(){return this._enabled}set enabled(R){this._setEnabled(R)}_setEnabled(R){this._enabled!==R&&(this._enabled=R,this._onDidChange.fire({enabled:R}))}get checked(){return this._checked}set checked(R){this._setChecked(R)}_setChecked(R){this._checked!==R&&(this._checked=R,this._onDidChange.fire({checked:R}))}run(R,k){return pe(this,void 0,void 0,function*(){this._actionCallback&&(yield this._actionCallback(R))})}}class S extends we.JT{constructor(){super(...arguments),this._onBeforeRun=this._register(new le.Q5),this.onBeforeRun=this._onBeforeRun.event,this._onDidRun=this._register(new le.Q5),this.onDidRun=this._onDidRun.event}run(R,k){return pe(this,void 0,void 0,function*(){if(!R.enabled)return;this._onBeforeRun.fire({action:R});let T;try{yield this.runAction(R,k)}catch(C){T=C}this._onDidRun.fire({action:R,error:T})})}runAction(R,k){return pe(this,void 0,void 0,function*(){yield R.run(k)})}}class Ae extends Z{constructor(R){super(Ae.ID,R,R?"separator text":"separator"),this.checked=!1,this.enabled=!1}}Ae.ID="vs.actions.separator";class P{constructor(R,k,T,C){this.tooltip="",this.enabled=!0,this.checked=!1,this.id=R,this.label=k,this.class=C,this._actions=T}get actions(){return this._actions}dispose(){}run(){return pe(this,void 0,void 0,function*(){})}}class f extends Z{constructor(){super(f.ID,Ze.N("submenu.empty","(empty)"),void 0,!1)}}f.ID="vs.actions.empty"},76068:function(Ci,Bt,re){"use strict";re.d(Bt,{ok:function(){return le}});function le(we,Ze){if(!we)throw new Error(Ze?`Assertion failed (${Ze})`:"Assertion Failed")}},52615:function(Ci,Bt,re){"use strict";re.d(Bt,{CM:function(){return Z},JL:function(){return S},dT:function(){return P},fK:function(){return pe},lA:function(){return Ae}});var le=re(4348);class we{constructor(){this._icons=new Map,this._onDidRegister=new le.Q5}add(ie){const R=this._icons.get(ie.id);R?ie.description?R.description=ie.description:console.error(`Duplicate registration of codicon ${ie.id}`):(this._icons.set(ie.id,ie),this._onDidRegister.fire(ie))}get(ie){return this._icons.get(ie)}get all(){return this._icons.values()}get onDidRegister(){return this._onDidRegister.event}}const Ze=new we,pe=Ze;function Z(f,ie){return new Ae(f,ie)}function S(f){return f?f.replace(/\$\((.*?)\)/g,(ie,R)=>` ${R} `).trim():""}class Ae{constructor(ie,R,k){this.id=ie,this.definition=R,this.description=k,Ze.add(this)}get classNames(){return"codicon codicon-"+this.id}get classNamesArray(){return["codicon","codicon-"+this.id]}get cssSelector(){return".codicon.codicon-"+this.id}}var P;(function(f){f.iconNameSegment="[A-Za-z0-9]+",f.iconNameExpression="[A-Za-z0-9\\-]+",f.iconModifierExpression="~[A-Za-z]+";const ie=new RegExp(`^(${f.iconNameExpression})(${f.iconModifierExpression})?$`);function R(C){if(C instanceof Ae)return["codicon","codicon-"+C.id];const O=ie.exec(C.id);if(!O)return R(Ae.error);let[,Q,H]=O;const q=["codicon","codicon-"+Q];return H&&q.push("codicon-modifier-"+H.substr(1)),q}f.asClassNameArray=R;function k(C){return R(C).join(" ")}f.asClassName=k;function T(C){return"."+R(C).join(".")}f.asCSSSelector=T})(P||(P={})),function(f){f.add=new f("add",{fontCharacter:"\\ea60"}),f.plus=new f("plus",f.add.definition),f.gistNew=new f("gist-new",f.add.definition),f.repoCreate=new f("repo-create",f.add.definition),f.lightbulb=new f("lightbulb",{fontCharacter:"\\ea61"}),f.lightBulb=new f("light-bulb",{fontCharacter:"\\ea61"}),f.repo=new f("repo",{fontCharacter:"\\ea62"}),f.repoDelete=new f("repo-delete",{fontCharacter:"\\ea62"}),f.gistFork=new f("gist-fork",{fontCharacter:"\\ea63"}),f.repoForked=new f("repo-forked",{fontCharacter:"\\ea63"}),f.gitPullRequest=new f("git-pull-request",{fontCharacter:"\\ea64"}),f.gitPullRequestAbandoned=new f("git-pull-request-abandoned",{fontCharacter:"\\ea64"}),f.recordKeys=new f("record-keys",{fontCharacter:"\\ea65"}),f.keyboard=new f("keyboard",{fontCharacter:"\\ea65"}),f.tag=new f("tag",{fontCharacter:"\\ea66"}),f.tagAdd=new f("tag-add",{fontCharacter:"\\ea66"}),f.tagRemove=new f("tag-remove",{fontCharacter:"\\ea66"}),f.person=new f("person",{fontCharacter:"\\ea67"}),f.personFollow=new f("person-follow",{fontCharacter:"\\ea67"}),f.personOutline=new f("person-outline",{fontCharacter:"\\ea67"}),f.personFilled=new f("person-filled",{fontCharacter:"\\ea67"}),f.gitBranch=new f("git-branch",{fontCharacter:"\\ea68"}),f.gitBranchCreate=new f("git-branch-create",{fontCharacter:"\\ea68"}),f.gitBranchDelete=new f("git-branch-delete",{fontCharacter:"\\ea68"}),f.sourceControl=new f("source-control",{fontCharacter:"\\ea68"}),f.mirror=new f("mirror",{fontCharacter:"\\ea69"}),f.mirrorPublic=new f("mirror-public",{fontCharacter:"\\ea69"}),f.star=new f("star",{fontCharacter:"\\ea6a"}),f.starAdd=new f("star-add",{fontCharacter:"\\ea6a"}),f.starDelete=new f("star-delete",{fontCharacter:"\\ea6a"}),f.starEmpty=new f("star-empty",{fontCharacter:"\\ea6a"}),f.comment=new f("comment",{fontCharacter:"\\ea6b"}),f.commentAdd=new f("comment-add",{fontCharacter:"\\ea6b"}),f.alert=new f("alert",{fontCharacter:"\\ea6c"}),f.warning=new f("warning",{fontCharacter:"\\ea6c"}),f.search=new f("search",{fontCharacter:"\\ea6d"}),f.searchSave=new f("search-save",{fontCharacter:"\\ea6d"}),f.logOut=new f("log-out",{fontCharacter:"\\ea6e"}),f.signOut=new f("sign-out",{fontCharacter:"\\ea6e"}),f.logIn=new f("log-in",{fontCharacter:"\\ea6f"}),f.signIn=new f("sign-in",{fontCharacter:"\\ea6f"}),f.eye=new f("eye",{fontCharacter:"\\ea70"}),f.eyeUnwatch=new f("eye-unwatch",{fontCharacter:"\\ea70"}),f.eyeWatch=new f("eye-watch",{fontCharacter:"\\ea70"}),f.circleFilled=new f("circle-filled",{fontCharacter:"\\ea71"}),f.primitiveDot=new f("primitive-dot",{fontCharacter:"\\ea71"}),f.closeDirty=new f("close-dirty",{fontCharacter:"\\ea71"}),f.debugBreakpoint=new f("debug-breakpoint",{fontCharacter:"\\ea71"}),f.debugBreakpointDisabled=new f("debug-breakpoint-disabled",{fontCharacter:"\\ea71"}),f.debugHint=new f("debug-hint",{fontCharacter:"\\ea71"}),f.primitiveSquare=new f("primitive-square",{fontCharacter:"\\ea72"}),f.edit=new f("edit",{fontCharacter:"\\ea73"}),f.pencil=new f("pencil",{fontCharacter:"\\ea73"}),f.info=new f("info",{fontCharacter:"\\ea74"}),f.issueOpened=new f("issue-opened",{fontCharacter:"\\ea74"}),f.gistPrivate=new f("gist-private",{fontCharacter:"\\ea75"}),f.gitForkPrivate=new f("git-fork-private",{fontCharacter:"\\ea75"}),f.lock=new f("lock",{fontCharacter:"\\ea75"}),f.mirrorPrivate=new f("mirror-private",{fontCharacter:"\\ea75"}),f.close=new f("close",{fontCharacter:"\\ea76"}),f.removeClose=new f("remove-close",{fontCharacter:"\\ea76"}),f.x=new f("x",{fontCharacter:"\\ea76"}),f.repoSync=new f("repo-sync",{fontCharacter:"\\ea77"}),f.sync=new f("sync",{fontCharacter:"\\ea77"}),f.clone=new f("clone",{fontCharacter:"\\ea78"}),f.desktopDownload=new f("desktop-download",{fontCharacter:"\\ea78"}),f.beaker=new f("beaker",{fontCharacter:"\\ea79"}),f.microscope=new f("microscope",{fontCharacter:"\\ea79"}),f.vm=new f("vm",{fontCharacter:"\\ea7a"}),f.deviceDesktop=new f("device-desktop",{fontCharacter:"\\ea7a"}),f.file=new f("file",{fontCharacter:"\\ea7b"}),f.fileText=new f("file-text",{fontCharacter:"\\ea7b"}),f.more=new f("more",{fontCharacter:"\\ea7c"}),f.ellipsis=new f("ellipsis",{fontCharacter:"\\ea7c"}),f.kebabHorizontal=new f("kebab-horizontal",{fontCharacter:"\\ea7c"}),f.mailReply=new f("mail-reply",{fontCharacter:"\\ea7d"}),f.reply=new f("reply",{fontCharacter:"\\ea7d"}),f.organization=new f("organization",{fontCharacter:"\\ea7e"}),f.organizationFilled=new f("organization-filled",{fontCharacter:"\\ea7e"}),f.organizationOutline=new f("organization-outline",{fontCharacter:"\\ea7e"}),f.newFile=new f("new-file",{fontCharacter:"\\ea7f"}),f.fileAdd=new f("file-add",{fontCharacter:"\\ea7f"}),f.newFolder=new f("new-folder",{fontCharacter:"\\ea80"}),f.fileDirectoryCreate=new f("file-directory-create",{fontCharacter:"\\ea80"}),f.trash=new f("trash",{fontCharacter:"\\ea81"}),f.trashcan=new f("trashcan",{fontCharacter:"\\ea81"}),f.history=new f("history",{fontCharacter:"\\ea82"}),f.clock=new f("clock",{fontCharacter:"\\ea82"}),f.folder=new f("folder",{fontCharacter:"\\ea83"}),f.fileDirectory=new f("file-directory",{fontCharacter:"\\ea83"}),f.symbolFolder=new f("symbol-folder",{fontCharacter:"\\ea83"}),f.logoGithub=new f("logo-github",{fontCharacter:"\\ea84"}),f.markGithub=new f("mark-github",{fontCharacter:"\\ea84"}),f.github=new f("github",{fontCharacter:"\\ea84"}),f.terminal=new f("terminal",{fontCharacter:"\\ea85"}),f.console=new f("console",{fontCharacter:"\\ea85"}),f.repl=new f("repl",{fontCharacter:"\\ea85"}),f.zap=new f("zap",{fontCharacter:"\\ea86"}),f.symbolEvent=new f("symbol-event",{fontCharacter:"\\ea86"}),f.error=new f("error",{fontCharacter:"\\ea87"}),f.stop=new f("stop",{fontCharacter:"\\ea87"}),f.variable=new f("variable",{fontCharacter:"\\ea88"}),f.symbolVariable=new f("symbol-variable",{fontCharacter:"\\ea88"}),f.array=new f("array",{fontCharacter:"\\ea8a"}),f.symbolArray=new f("symbol-array",{fontCharacter:"\\ea8a"}),f.symbolModule=new f("symbol-module",{fontCharacter:"\\ea8b"}),f.symbolPackage=new f("symbol-package",{fontCharacter:"\\ea8b"}),f.symbolNamespace=new f("symbol-namespace",{fontCharacter:"\\ea8b"}),f.symbolObject=new f("symbol-object",{fontCharacter:"\\ea8b"}),f.symbolMethod=new f("symbol-method",{fontCharacter:"\\ea8c"}),f.symbolFunction=new f("symbol-function",{fontCharacter:"\\ea8c"}),f.symbolConstructor=new f("symbol-constructor",{fontCharacter:"\\ea8c"}),f.symbolBoolean=new f("symbol-boolean",{fontCharacter:"\\ea8f"}),f.symbolNull=new f("symbol-null",{fontCharacter:"\\ea8f"}),f.symbolNumeric=new f("symbol-numeric",{fontCharacter:"\\ea90"}),f.symbolNumber=new f("symbol-number",{fontCharacter:"\\ea90"}),f.symbolStructure=new f("symbol-structure",{fontCharacter:"\\ea91"}),f.symbolStruct=new f("symbol-struct",{fontCharacter:"\\ea91"}),f.symbolParameter=new f("symbol-parameter",{fontCharacter:"\\ea92"}),f.symbolTypeParameter=new f("symbol-type-parameter",{fontCharacter:"\\ea92"}),f.symbolKey=new f("symbol-key",{fontCharacter:"\\ea93"}),f.symbolText=new f("symbol-text",{fontCharacter:"\\ea93"}),f.symbolReference=new f("symbol-reference",{fontCharacter:"\\ea94"}),f.goToFile=new f("go-to-file",{fontCharacter:"\\ea94"}),f.symbolEnum=new f("symbol-enum",{fontCharacter:"\\ea95"}),f.symbolValue=new f("symbol-value",{fontCharacter:"\\ea95"}),f.symbolRuler=new f("symbol-ruler",{fontCharacter:"\\ea96"}),f.symbolUnit=new f("symbol-unit",{fontCharacter:"\\ea96"}),f.activateBreakpoints=new f("activate-breakpoints",{fontCharacter:"\\ea97"}),f.archive=new f("archive",{fontCharacter:"\\ea98"}),f.arrowBoth=new f("arrow-both",{fontCharacter:"\\ea99"}),f.arrowDown=new f("arrow-down",{fontCharacter:"\\ea9a"}),f.arrowLeft=new f("arrow-left",{fontCharacter:"\\ea9b"}),f.arrowRight=new f("arrow-right",{fontCharacter:"\\ea9c"}),f.arrowSmallDown=new f("arrow-small-down",{fontCharacter:"\\ea9d"}),f.arrowSmallLeft=new f("arrow-small-left",{fontCharacter:"\\ea9e"}),f.arrowSmallRight=new f("arrow-small-right",{fontCharacter:"\\ea9f"}),f.arrowSmallUp=new f("arrow-small-up",{fontCharacter:"\\eaa0"}),f.arrowUp=new f("arrow-up",{fontCharacter:"\\eaa1"}),f.bell=new f("bell",{fontCharacter:"\\eaa2"}),f.bold=new f("bold",{fontCharacter:"\\eaa3"}),f.book=new f("book",{fontCharacter:"\\eaa4"}),f.bookmark=new f("bookmark",{fontCharacter:"\\eaa5"}),f.debugBreakpointConditionalUnverified=new f("debug-breakpoint-conditional-unverified",{fontCharacter:"\\eaa6"}),f.debugBreakpointConditional=new f("debug-breakpoint-conditional",{fontCharacter:"\\eaa7"}),f.debugBreakpointConditionalDisabled=new f("debug-breakpoint-conditional-disabled",{fontCharacter:"\\eaa7"}),f.debugBreakpointDataUnverified=new f("debug-breakpoint-data-unverified",{fontCharacter:"\\eaa8"}),f.debugBreakpointData=new f("debug-breakpoint-data",{fontCharacter:"\\eaa9"}),f.debugBreakpointDataDisabled=new f("debug-breakpoint-data-disabled",{fontCharacter:"\\eaa9"}),f.debugBreakpointLogUnverified=new f("debug-breakpoint-log-unverified",{fontCharacter:"\\eaaa"}),f.debugBreakpointLog=new f("debug-breakpoint-log",{fontCharacter:"\\eaab"}),f.debugBreakpointLogDisabled=new f("debug-breakpoint-log-disabled",{fontCharacter:"\\eaab"}),f.briefcase=new f("briefcase",{fontCharacter:"\\eaac"}),f.broadcast=new f("broadcast",{fontCharacter:"\\eaad"}),f.browser=new f("browser",{fontCharacter:"\\eaae"}),f.bug=new f("bug",{fontCharacter:"\\eaaf"}),f.calendar=new f("calendar",{fontCharacter:"\\eab0"}),f.caseSensitive=new f("case-sensitive",{fontCharacter:"\\eab1"}),f.check=new f("check",{fontCharacter:"\\eab2"}),f.checklist=new f("checklist",{fontCharacter:"\\eab3"}),f.chevronDown=new f("chevron-down",{fontCharacter:"\\eab4"}),f.dropDownButton=new f("drop-down-button",f.chevronDown.definition),f.chevronLeft=new f("chevron-left",{fontCharacter:"\\eab5"}),f.chevronRight=new f("chevron-right",{fontCharacter:"\\eab6"}),f.chevronUp=new f("chevron-up",{fontCharacter:"\\eab7"}),f.chromeClose=new f("chrome-close",{fontCharacter:"\\eab8"}),f.chromeMaximize=new f("chrome-maximize",{fontCharacter:"\\eab9"}),f.chromeMinimize=new f("chrome-minimize",{fontCharacter:"\\eaba"}),f.chromeRestore=new f("chrome-restore",{fontCharacter:"\\eabb"}),f.circleOutline=new f("circle-outline",{fontCharacter:"\\eabc"}),f.debugBreakpointUnverified=new f("debug-breakpoint-unverified",{fontCharacter:"\\eabc"}),f.circleSlash=new f("circle-slash",{fontCharacter:"\\eabd"}),f.circuitBoard=new f("circuit-board",{fontCharacter:"\\eabe"}),f.clearAll=new f("clear-all",{fontCharacter:"\\eabf"}),f.clippy=new f("clippy",{fontCharacter:"\\eac0"}),f.closeAll=new f("close-all",{fontCharacter:"\\eac1"}),f.cloudDownload=new f("cloud-download",{fontCharacter:"\\eac2"}),f.cloudUpload=new f("cloud-upload",{fontCharacter:"\\eac3"}),f.code=new f("code",{fontCharacter:"\\eac4"}),f.collapseAll=new f("collapse-all",{fontCharacter:"\\eac5"}),f.colorMode=new f("color-mode",{fontCharacter:"\\eac6"}),f.commentDiscussion=new f("comment-discussion",{fontCharacter:"\\eac7"}),f.compareChanges=new f("compare-changes",{fontCharacter:"\\eafd"}),f.creditCard=new f("credit-card",{fontCharacter:"\\eac9"}),f.dash=new f("dash",{fontCharacter:"\\eacc"}),f.dashboard=new f("dashboard",{fontCharacter:"\\eacd"}),f.database=new f("database",{fontCharacter:"\\eace"}),f.debugContinue=new f("debug-continue",{fontCharacter:"\\eacf"}),f.debugDisconnect=new f("debug-disconnect",{fontCharacter:"\\ead0"}),f.debugPause=new f("debug-pause",{fontCharacter:"\\ead1"}),f.debugRestart=new f("debug-restart",{fontCharacter:"\\ead2"}),f.debugStart=new f("debug-start",{fontCharacter:"\\ead3"}),f.debugStepInto=new f("debug-step-into",{fontCharacter:"\\ead4"}),f.debugStepOut=new f("debug-step-out",{fontCharacter:"\\ead5"}),f.debugStepOver=new f("debug-step-over",{fontCharacter:"\\ead6"}),f.debugStop=new f("debug-stop",{fontCharacter:"\\ead7"}),f.debug=new f("debug",{fontCharacter:"\\ead8"}),f.deviceCameraVideo=new f("device-camera-video",{fontCharacter:"\\ead9"}),f.deviceCamera=new f("device-camera",{fontCharacter:"\\eada"}),f.deviceMobile=new f("device-mobile",{fontCharacter:"\\eadb"}),f.diffAdded=new f("diff-added",{fontCharacter:"\\eadc"}),f.diffIgnored=new f("diff-ignored",{fontCharacter:"\\eadd"}),f.diffModified=new f("diff-modified",{fontCharacter:"\\eade"}),f.diffRemoved=new f("diff-removed",{fontCharacter:"\\eadf"}),f.diffRenamed=new f("diff-renamed",{fontCharacter:"\\eae0"}),f.diff=new f("diff",{fontCharacter:"\\eae1"}),f.discard=new f("discard",{fontCharacter:"\\eae2"}),f.editorLayout=new f("editor-layout",{fontCharacter:"\\eae3"}),f.emptyWindow=new f("empty-window",{fontCharacter:"\\eae4"}),f.exclude=new f("exclude",{fontCharacter:"\\eae5"}),f.extensions=new f("extensions",{fontCharacter:"\\eae6"}),f.eyeClosed=new f("eye-closed",{fontCharacter:"\\eae7"}),f.fileBinary=new f("file-binary",{fontCharacter:"\\eae8"}),f.fileCode=new f("file-code",{fontCharacter:"\\eae9"}),f.fileMedia=new f("file-media",{fontCharacter:"\\eaea"}),f.filePdf=new f("file-pdf",{fontCharacter:"\\eaeb"}),f.fileSubmodule=new f("file-submodule",{fontCharacter:"\\eaec"}),f.fileSymlinkDirectory=new f("file-symlink-directory",{fontCharacter:"\\eaed"}),f.fileSymlinkFile=new f("file-symlink-file",{fontCharacter:"\\eaee"}),f.fileZip=new f("file-zip",{fontCharacter:"\\eaef"}),f.files=new f("files",{fontCharacter:"\\eaf0"}),f.filter=new f("filter",{fontCharacter:"\\eaf1"}),f.flame=new f("flame",{fontCharacter:"\\eaf2"}),f.foldDown=new f("fold-down",{fontCharacter:"\\eaf3"}),f.foldUp=new f("fold-up",{fontCharacter:"\\eaf4"}),f.fold=new f("fold",{fontCharacter:"\\eaf5"}),f.folderActive=new f("folder-active",{fontCharacter:"\\eaf6"}),f.folderOpened=new f("folder-opened",{fontCharacter:"\\eaf7"}),f.gear=new f("gear",{fontCharacter:"\\eaf8"}),f.gift=new f("gift",{fontCharacter:"\\eaf9"}),f.gistSecret=new f("gist-secret",{fontCharacter:"\\eafa"}),f.gist=new f("gist",{fontCharacter:"\\eafb"}),f.gitCommit=new f("git-commit",{fontCharacter:"\\eafc"}),f.gitCompare=new f("git-compare",{fontCharacter:"\\eafd"}),f.gitMerge=new f("git-merge",{fontCharacter:"\\eafe"}),f.githubAction=new f("github-action",{fontCharacter:"\\eaff"}),f.githubAlt=new f("github-alt",{fontCharacter:"\\eb00"}),f.globe=new f("globe",{fontCharacter:"\\eb01"}),f.grabber=new f("grabber",{fontCharacter:"\\eb02"}),f.graph=new f("graph",{fontCharacter:"\\eb03"}),f.gripper=new f("gripper",{fontCharacter:"\\eb04"}),f.heart=new f("heart",{fontCharacter:"\\eb05"}),f.home=new f("home",{fontCharacter:"\\eb06"}),f.horizontalRule=new f("horizontal-rule",{fontCharacter:"\\eb07"}),f.hubot=new f("hubot",{fontCharacter:"\\eb08"}),f.inbox=new f("inbox",{fontCharacter:"\\eb09"}),f.issueClosed=new f("issue-closed",{fontCharacter:"\\eba4"}),f.issueReopened=new f("issue-reopened",{fontCharacter:"\\eb0b"}),f.issues=new f("issues",{fontCharacter:"\\eb0c"}),f.italic=new f("italic",{fontCharacter:"\\eb0d"}),f.jersey=new f("jersey",{fontCharacter:"\\eb0e"}),f.json=new f("json",{fontCharacter:"\\eb0f"}),f.kebabVertical=new f("kebab-vertical",{fontCharacter:"\\eb10"}),f.key=new f("key",{fontCharacter:"\\eb11"}),f.law=new f("law",{fontCharacter:"\\eb12"}),f.lightbulbAutofix=new f("lightbulb-autofix",{fontCharacter:"\\eb13"}),f.linkExternal=new f("link-external",{fontCharacter:"\\eb14"}),f.link=new f("link",{fontCharacter:"\\eb15"}),f.listOrdered=new f("list-ordered",{fontCharacter:"\\eb16"}),f.listUnordered=new f("list-unordered",{fontCharacter:"\\eb17"}),f.liveShare=new f("live-share",{fontCharacter:"\\eb18"}),f.loading=new f("loading",{fontCharacter:"\\eb19"}),f.location=new f("location",{fontCharacter:"\\eb1a"}),f.mailRead=new f("mail-read",{fontCharacter:"\\eb1b"}),f.mail=new f("mail",{fontCharacter:"\\eb1c"}),f.markdown=new f("markdown",{fontCharacter:"\\eb1d"}),f.megaphone=new f("megaphone",{fontCharacter:"\\eb1e"}),f.mention=new f("mention",{fontCharacter:"\\eb1f"}),f.milestone=new f("milestone",{fontCharacter:"\\eb20"}),f.mortarBoard=new f("mortar-board",{fontCharacter:"\\eb21"}),f.move=new f("move",{fontCharacter:"\\eb22"}),f.multipleWindows=new f("multiple-windows",{fontCharacter:"\\eb23"}),f.mute=new f("mute",{fontCharacter:"\\eb24"}),f.noNewline=new f("no-newline",{fontCharacter:"\\eb25"}),f.note=new f("note",{fontCharacter:"\\eb26"}),f.octoface=new f("octoface",{fontCharacter:"\\eb27"}),f.openPreview=new f("open-preview",{fontCharacter:"\\eb28"}),f.package_=new f("package",{fontCharacter:"\\eb29"}),f.paintcan=new f("paintcan",{fontCharacter:"\\eb2a"}),f.pin=new f("pin",{fontCharacter:"\\eb2b"}),f.play=new f("play",{fontCharacter:"\\eb2c"}),f.run=new f("run",{fontCharacter:"\\eb2c"}),f.plug=new f("plug",{fontCharacter:"\\eb2d"}),f.preserveCase=new f("preserve-case",{fontCharacter:"\\eb2e"}),f.preview=new f("preview",{fontCharacter:"\\eb2f"}),f.project=new f("project",{fontCharacter:"\\eb30"}),f.pulse=new f("pulse",{fontCharacter:"\\eb31"}),f.question=new f("question",{fontCharacter:"\\eb32"}),f.quote=new f("quote",{fontCharacter:"\\eb33"}),f.radioTower=new f("radio-tower",{fontCharacter:"\\eb34"}),f.reactions=new f("reactions",{fontCharacter:"\\eb35"}),f.references=new f("references",{fontCharacter:"\\eb36"}),f.refresh=new f("refresh",{fontCharacter:"\\eb37"}),f.regex=new f("regex",{fontCharacter:"\\eb38"}),f.remoteExplorer=new f("remote-explorer",{fontCharacter:"\\eb39"}),f.remote=new f("remote",{fontCharacter:"\\eb3a"}),f.remove=new f("remove",{fontCharacter:"\\eb3b"}),f.replaceAll=new f("replace-all",{fontCharacter:"\\eb3c"}),f.replace=new f("replace",{fontCharacter:"\\eb3d"}),f.repoClone=new f("repo-clone",{fontCharacter:"\\eb3e"}),f.repoForcePush=new f("repo-force-push",{fontCharacter:"\\eb3f"}),f.repoPull=new f("repo-pull",{fontCharacter:"\\eb40"}),f.repoPush=new f("repo-push",{fontCharacter:"\\eb41"}),f.report=new f("report",{fontCharacter:"\\eb42"}),f.requestChanges=new f("request-changes",{fontCharacter:"\\eb43"}),f.rocket=new f("rocket",{fontCharacter:"\\eb44"}),f.rootFolderOpened=new f("root-folder-opened",{fontCharacter:"\\eb45"}),f.rootFolder=new f("root-folder",{fontCharacter:"\\eb46"}),f.rss=new f("rss",{fontCharacter:"\\eb47"}),f.ruby=new f("ruby",{fontCharacter:"\\eb48"}),f.saveAll=new f("save-all",{fontCharacter:"\\eb49"}),f.saveAs=new f("save-as",{fontCharacter:"\\eb4a"}),f.save=new f("save",{fontCharacter:"\\eb4b"}),f.screenFull=new f("screen-full",{fontCharacter:"\\eb4c"}),f.screenNormal=new f("screen-normal",{fontCharacter:"\\eb4d"}),f.searchStop=new f("search-stop",{fontCharacter:"\\eb4e"}),f.server=new f("server",{fontCharacter:"\\eb50"}),f.settingsGear=new f("settings-gear",{fontCharacter:"\\eb51"}),f.settings=new f("settings",{fontCharacter:"\\eb52"}),f.shield=new f("shield",{fontCharacter:"\\eb53"}),f.smiley=new f("smiley",{fontCharacter:"\\eb54"}),f.sortPrecedence=new f("sort-precedence",{fontCharacter:"\\eb55"}),f.splitHorizontal=new f("split-horizontal",{fontCharacter:"\\eb56"}),f.splitVertical=new f("split-vertical",{fontCharacter:"\\eb57"}),f.squirrel=new f("squirrel",{fontCharacter:"\\eb58"}),f.starFull=new f("star-full",{fontCharacter:"\\eb59"}),f.starHalf=new f("star-half",{fontCharacter:"\\eb5a"}),f.symbolClass=new f("symbol-class",{fontCharacter:"\\eb5b"}),f.symbolColor=new f("symbol-color",{fontCharacter:"\\eb5c"}),f.symbolConstant=new f("symbol-constant",{fontCharacter:"\\eb5d"}),f.symbolEnumMember=new f("symbol-enum-member",{fontCharacter:"\\eb5e"}),f.symbolField=new f("symbol-field",{fontCharacter:"\\eb5f"}),f.symbolFile=new f("symbol-file",{fontCharacter:"\\eb60"}),f.symbolInterface=new f("symbol-interface",{fontCharacter:"\\eb61"}),f.symbolKeyword=new f("symbol-keyword",{fontCharacter:"\\eb62"}),f.symbolMisc=new f("symbol-misc",{fontCharacter:"\\eb63"}),f.symbolOperator=new f("symbol-operator",{fontCharacter:"\\eb64"}),f.symbolProperty=new f("symbol-property",{fontCharacter:"\\eb65"}),f.wrench=new f("wrench",{fontCharacter:"\\eb65"}),f.wrenchSubaction=new f("wrench-subaction",{fontCharacter:"\\eb65"}),f.symbolSnippet=new f("symbol-snippet",{fontCharacter:"\\eb66"}),f.tasklist=new f("tasklist",{fontCharacter:"\\eb67"}),f.telescope=new f("telescope",{fontCharacter:"\\eb68"}),f.textSize=new f("text-size",{fontCharacter:"\\eb69"}),f.threeBars=new f("three-bars",{fontCharacter:"\\eb6a"}),f.thumbsdown=new f("thumbsdown",{fontCharacter:"\\eb6b"}),f.thumbsup=new f("thumbsup",{fontCharacter:"\\eb6c"}),f.tools=new f("tools",{fontCharacter:"\\eb6d"}),f.triangleDown=new f("triangle-down",{fontCharacter:"\\eb6e"}),f.triangleLeft=new f("triangle-left",{fontCharacter:"\\eb6f"}),f.triangleRight=new f("triangle-right",{fontCharacter:"\\eb70"}),f.triangleUp=new f("triangle-up",{fontCharacter:"\\eb71"}),f.twitter=new f("twitter",{fontCharacter:"\\eb72"}),f.unfold=new f("unfold",{fontCharacter:"\\eb73"}),f.unlock=new f("unlock",{fontCharacter:"\\eb74"}),f.unmute=new f("unmute",{fontCharacter:"\\eb75"}),f.unverified=new f("unverified",{fontCharacter:"\\eb76"}),f.verified=new f("verified",{fontCharacter:"\\eb77"}),f.versions=new f("versions",{fontCharacter:"\\eb78"}),f.vmActive=new f("vm-active",{fontCharacter:"\\eb79"}),f.vmOutline=new f("vm-outline",{fontCharacter:"\\eb7a"}),f.vmRunning=new f("vm-running",{fontCharacter:"\\eb7b"}),f.watch=new f("watch",{fontCharacter:"\\eb7c"}),f.whitespace=new f("whitespace",{fontCharacter:"\\eb7d"}),f.wholeWord=new f("whole-word",{fontCharacter:"\\eb7e"}),f.window=new f("window",{fontCharacter:"\\eb7f"}),f.wordWrap=new f("word-wrap",{fontCharacter:"\\eb80"}),f.zoomIn=new f("zoom-in",{fontCharacter:"\\eb81"}),f.zoomOut=new f("zoom-out",{fontCharacter:"\\eb82"}),f.listFilter=new f("list-filter",{fontCharacter:"\\eb83"}),f.listFlat=new f("list-flat",{fontCharacter:"\\eb84"}),f.listSelection=new f("list-selection",{fontCharacter:"\\eb85"}),f.selection=new f("selection",{fontCharacter:"\\eb85"}),f.listTree=new f("list-tree",{fontCharacter:"\\eb86"}),f.debugBreakpointFunctionUnverified=new f("debug-breakpoint-function-unverified",{fontCharacter:"\\eb87"}),f.debugBreakpointFunction=new f("debug-breakpoint-function",{fontCharacter:"\\eb88"}),f.debugBreakpointFunctionDisabled=new f("debug-breakpoint-function-disabled",{fontCharacter:"\\eb88"}),f.debugStackframeActive=new f("debug-stackframe-active",{fontCharacter:"\\eb89"}),f.debugStackframeDot=new f("debug-stackframe-dot",{fontCharacter:"\\eb8a"}),f.debugStackframe=new f("debug-stackframe",{fontCharacter:"\\eb8b"}),f.debugStackframeFocused=new f("debug-stackframe-focused",{fontCharacter:"\\eb8b"}),f.debugBreakpointUnsupported=new f("debug-breakpoint-unsupported",{fontCharacter:"\\eb8c"}),f.symbolString=new f("symbol-string",{fontCharacter:"\\eb8d"}),f.debugReverseContinue=new f("debug-reverse-continue",{fontCharacter:"\\eb8e"}),f.debugStepBack=new f("debug-step-back",{fontCharacter:"\\eb8f"}),f.debugRestartFrame=new f("debug-restart-frame",{fontCharacter:"\\eb90"}),f.callIncoming=new f("call-incoming",{fontCharacter:"\\eb92"}),f.callOutgoing=new f("call-outgoing",{fontCharacter:"\\eb93"}),f.menu=new f("menu",{fontCharacter:"\\eb94"}),f.expandAll=new f("expand-all",{fontCharacter:"\\eb95"}),f.feedback=new f("feedback",{fontCharacter:"\\eb96"}),f.groupByRefType=new f("group-by-ref-type",{fontCharacter:"\\eb97"}),f.ungroupByRefType=new f("ungroup-by-ref-type",{fontCharacter:"\\eb98"}),f.account=new f("account",{fontCharacter:"\\eb99"}),f.bellDot=new f("bell-dot",{fontCharacter:"\\eb9a"}),f.debugConsole=new f("debug-console",{fontCharacter:"\\eb9b"}),f.library=new f("library",{fontCharacter:"\\eb9c"}),f.output=new f("output",{fontCharacter:"\\eb9d"}),f.runAll=new f("run-all",{fontCharacter:"\\eb9e"}),f.syncIgnored=new f("sync-ignored",{fontCharacter:"\\eb9f"}),f.pinned=new f("pinned",{fontCharacter:"\\eba0"}),f.githubInverted=new f("github-inverted",{fontCharacter:"\\eba1"}),f.debugAlt=new f("debug-alt",{fontCharacter:"\\eb91"}),f.serverProcess=new f("server-process",{fontCharacter:"\\eba2"}),f.serverEnvironment=new f("server-environment",{fontCharacter:"\\eba3"}),f.pass=new f("pass",{fontCharacter:"\\eba4"}),f.stopCircle=new f("stop-circle",{fontCharacter:"\\eba5"}),f.playCircle=new f("play-circle",{fontCharacter:"\\eba6"}),f.record=new f("record",{fontCharacter:"\\eba7"}),f.debugAltSmall=new f("debug-alt-small",{fontCharacter:"\\eba8"}),f.vmConnect=new f("vm-connect",{fontCharacter:"\\eba9"}),f.cloud=new f("cloud",{fontCharacter:"\\ebaa"}),f.merge=new f("merge",{fontCharacter:"\\ebab"}),f.exportIcon=new f("export",{fontCharacter:"\\ebac"}),f.graphLeft=new f("graph-left",{fontCharacter:"\\ebad"}),f.magnet=new f("magnet",{fontCharacter:"\\ebae"}),f.notebook=new f("notebook",{fontCharacter:"\\ebaf"}),f.redo=new f("redo",{fontCharacter:"\\ebb0"}),f.checkAll=new f("check-all",{fontCharacter:"\\ebb1"}),f.pinnedDirty=new f("pinned-dirty",{fontCharacter:"\\ebb2"}),f.passFilled=new f("pass-filled",{fontCharacter:"\\ebb3"}),f.circleLargeFilled=new f("circle-large-filled",{fontCharacter:"\\ebb4"}),f.circleLargeOutline=new f("circle-large-outline",{fontCharacter:"\\ebb5"}),f.combine=new f("combine",{fontCharacter:"\\ebb6"}),f.gather=new f("gather",{fontCharacter:"\\ebb6"}),f.table=new f("table",{fontCharacter:"\\ebb7"}),f.variableGroup=new f("variable-group",{fontCharacter:"\\ebb8"}),f.typeHierarchy=new f("type-hierarchy",{fontCharacter:"\\ebb9"}),f.typeHierarchySub=new f("type-hierarchy-sub",{fontCharacter:"\\ebba"}),f.typeHierarchySuper=new f("type-hierarchy-super",{fontCharacter:"\\ebbb"}),f.gitPullRequestCreate=new f("git-pull-request-create",{fontCharacter:"\\ebbc"}),f.runAbove=new f("run-above",{fontCharacter:"\\ebbd"}),f.runBelow=new f("run-below",{fontCharacter:"\\ebbe"}),f.notebookTemplate=new f("notebook-template",{fontCharacter:"\\ebbf"}),f.debugRerun=new f("debug-rerun",{fontCharacter:"\\ebc0"}),f.workspaceTrusted=new f("workspace-trusted",{fontCharacter:"\\ebc1"}),f.workspaceUntrusted=new f("workspace-untrusted",{fontCharacter:"\\ebc2"}),f.workspaceUnspecified=new f("workspace-unspecified",{fontCharacter:"\\ebc3"}),f.terminalCmd=new f("terminal-cmd",{fontCharacter:"\\ebc4"}),f.terminalDebian=new f("terminal-debian",{fontCharacter:"\\ebc5"}),f.terminalLinux=new f("terminal-linux",{fontCharacter:"\\ebc6"}),f.terminalPowershell=new f("terminal-powershell",{fontCharacter:"\\ebc7"}),f.terminalTmux=new f("terminal-tmux",{fontCharacter:"\\ebc8"}),f.terminalUbuntu=new f("terminal-ubuntu",{fontCharacter:"\\ebc9"}),f.terminalBash=new f("terminal-bash",{fontCharacter:"\\ebca"}),f.arrowSwap=new f("arrow-swap",{fontCharacter:"\\ebcb"}),f.copy=new f("copy",{fontCharacter:"\\ebcc"}),f.personAdd=new f("person-add",{fontCharacter:"\\ebcd"}),f.filterFilled=new f("filter-filled",{fontCharacter:"\\ebce"}),f.wand=new f("wand",{fontCharacter:"\\ebcf"}),f.debugLineByLine=new f("debug-line-by-line",{fontCharacter:"\\ebd0"}),f.inspect=new f("inspect",{fontCharacter:"\\ebd1"}),f.layers=new f("layers",{fontCharacter:"\\ebd2"}),f.layersDot=new f("layers-dot",{fontCharacter:"\\ebd3"}),f.layersActive=new f("layers-active",{fontCharacter:"\\ebd4"}),f.compass=new f("compass",{fontCharacter:"\\ebd5"}),f.compassDot=new f("compass-dot",{fontCharacter:"\\ebd6"}),f.compassActive=new f("compass-active",{fontCharacter:"\\ebd7"}),f.azure=new f("azure",{fontCharacter:"\\ebd8"}),f.issueDraft=new f("issue-draft",{fontCharacter:"\\ebd9"}),f.gitPullRequestClosed=new f("git-pull-request-closed",{fontCharacter:"\\ebda"}),f.gitPullRequestDraft=new f("git-pull-request-draft",{fontCharacter:"\\ebdb"}),f.debugAll=new f("debug-all",{fontCharacter:"\\ebdc"}),f.debugCoverage=new f("debug-coverage",{fontCharacter:"\\ebdd"}),f.runErrors=new f("run-errors",{fontCharacter:"\\ebde"}),f.folderLibrary=new f("folder-library",{fontCharacter:"\\ebdf"}),f.debugContinueSmall=new f("debug-continue-small",{fontCharacter:"\\ebe0"}),f.beakerStop=new f("beaker-stop",{fontCharacter:"\\ebe1"}),f.graphLine=new f("graph-line",{fontCharacter:"\\ebe2"}),f.graphScatter=new f("graph-scatter",{fontCharacter:"\\ebe3"}),f.pieChart=new f("pie-chart",{fontCharacter:"\\ebe4"}),f.bracket=new f("bracket",f.json.definition),f.bracketDot=new f("bracket-dot",{fontCharacter:"\\ebe5"}),f.bracketError=new f("bracket-error",{fontCharacter:"\\ebe6"}),f.lockSmall=new f("lock-small",{fontCharacter:"\\ebe7"}),f.azureDevops=new f("azure-devops",{fontCharacter:"\\ebe8"}),f.verifiedFilled=new f("verified-filled",{fontCharacter:"\\ebe9"})}(Ae||(Ae={}))},79881:function(Ci,Bt,re){"use strict";re.d(Bt,{B8:function(){return R},Cp:function(){return pe},F0:function(){return P},L6:function(){return ie},VV:function(){return Ae},b1:function(){return f},dL:function(){return Ze},ri:function(){return Z}});class le{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(T){setTimeout(()=>{throw T.stack?new Error(T.message+`
`+T.stack):T},0)}}emit(T){this.listeners.forEach(C=>{C(T)})}onUnexpectedError(T){this.unexpectedErrorHandler(T),this.emit(T)}onUnexpectedExternalError(T){this.unexpectedErrorHandler(T)}}const we=new le;function Ze(k){Ae(k)||we.onUnexpectedError(k)}function pe(k){Ae(k)||we.onUnexpectedExternalError(k)}function Z(k){if(k instanceof Error){let{name:T,message:C}=k;const O=k.stacktrace||k.stack;return{$isError:!0,name:T,message:C,stack:O}}return k}const S="Canceled";function Ae(k){return k instanceof Error&&k.name===S&&k.message===S}function P(){const k=new Error(S);return k.name=k.message,k}function f(k){return k?new Error(`Illegal argument: ${k}`):new Error("Illegal argument")}function ie(k){return k?new Error(`Illegal state: ${k}`):new Error("Illegal state")}class R extends Error{constructor(T){super("NotSupported"),T&&(this.message=T)}}},4348:function(Ci,Bt,re){"use strict";re.d(Bt,{D0:function(){return R},E7:function(){return k},K3:function(){return ie},Q5:function(){return f},ZD:function(){return T},ju:function(){return Z}});var le=re(79881),we=re(69323),Ze=re(34502),pe=re(95830),Z;(function(C){C.None=()=>we.JT.None;function O(X){return(ee,fe=null,ne)=>{let A=!1,D;return D=X(G=>{if(!A)return D?D.dispose():A=!0,ee.call(fe,G)},null,ne),A&&D.dispose(),D}}C.once=O;function Q(X,ee){return he((fe,ne=null,A)=>X(D=>fe.call(ne,ee(D)),null,A))}C.map=Q;function H(X,ee){return he((fe,ne=null,A)=>X(D=>{ee(D),fe.call(ne,D)},null,A))}C.forEach=H;function q(X,ee){return he((fe,ne=null,A)=>X(D=>ee(D)&&fe.call(ne,D),null,A))}C.filter=q;function K(X){return X}C.signal=K;function $(...X){return(ee,fe=null,ne)=>(0,we.F8)(...X.map(A=>A(D=>ee.call(fe,D),null,ne)))}C.any=$;function V(X,ee,fe){let ne=fe;return Q(X,A=>(ne=ee(ne,A),ne))}C.reduce=V;function he(X){let ee;const fe=new f({onFirstListenerAdd(){ee=X(fe.fire,fe)},onLastListenerRemove(){ee.dispose()}});return fe.event}function be(X,ee,fe=100,ne=!1,A){let D,G,de,ze=0;const pt=new f({leakWarningThreshold:A,onFirstListenerAdd(){D=X(Ut=>{ze++,G=ee(G,Ut),ne&&!de&&(pt.fire(G),G=void 0),clearTimeout(de),de=setTimeout(()=>{const Ie=G;G=void 0,de=void 0,(!ne||ze>1)&&pt.fire(Ie),ze=0},fe)})},onLastListenerRemove(){D.dispose()}});return pt.event}C.debounce=be;function Te(X,ee=(fe,ne)=>fe===ne){let fe=!0,ne;return q(X,A=>{const D=fe||!ee(A,ne);return fe=!1,ne=A,D})}C.latch=Te;function se(X,ee){return[C.filter(X,ee),C.filter(X,fe=>!ee(fe))]}C.split=se;function Ee(X,ee=!1,fe=[]){let ne=fe.slice(),A=X(de=>{ne?ne.push(de):G.fire(de)});const D=()=>{ne&&ne.forEach(de=>G.fire(de)),ne=null},G=new f({onFirstListenerAdd(){A||(A=X(de=>G.fire(de)))},onFirstListenerDidAdd(){ne&&(ee?setTimeout(D):D())},onLastListenerRemove(){A&&A.dispose(),A=null}});return G.event}C.buffer=Ee;class We{constructor(ee){this.event=ee}map(ee){return new We(Q(this.event,ee))}forEach(ee){return new We(H(this.event,ee))}filter(ee){return new We(q(this.event,ee))}reduce(ee,fe){return new We(V(this.event,ee,fe))}latch(){return new We(Te(this.event))}debounce(ee,fe=100,ne=!1,A){return new We(be(this.event,ee,fe,ne,A))}on(ee,fe,ne){return this.event(ee,fe,ne)}once(ee,fe,ne){return O(this.event)(ee,fe,ne)}}function Ke(X){return new We(X)}C.chain=Ke;function Rt(X,ee,fe=ne=>ne){const ne=(...de)=>G.fire(fe(...de)),A=()=>X.on(ee,ne),D=()=>X.removeListener(ee,ne),G=new f({onFirstListenerAdd:A,onLastListenerRemove:D});return G.event}C.fromNodeEventEmitter=Rt;function te(X,ee,fe=ne=>ne){const ne=(...de)=>G.fire(fe(...de)),A=()=>X.addEventListener(ee,ne),D=()=>X.removeEventListener(ee,ne),G=new f({onFirstListenerAdd:A,onLastListenerRemove:D});return G.event}C.fromDOMEventEmitter=te;function z(X){return new Promise(ee=>O(X)(ee))}C.toPromise=z})(Z||(Z={}));class S{constructor(O){this._listenerCount=0,this._invocationCount=0,this._elapsedOverall=0,this._name=`${O}_${S._idPool++}`}start(O){this._stopWatch=new pe.G(!0),this._listenerCount=O}stop(){if(this._stopWatch){const O=this._stopWatch.elapsed();this._elapsedOverall+=O,this._invocationCount+=1,console.info(`did FIRE ${this._name}: elapsed_ms: ${O.toFixed(5)}, listener: ${this._listenerCount} (elapsed_overall: ${this._elapsedOverall.toFixed(2)}, invocations: ${this._invocationCount})`),this._stopWatch=void 0}}}S._idPool=0;let Ae=-1;class P{constructor(O,Q=Math.random().toString(18).slice(2,5)){this.customThreshold=O,this.name=Q,this._warnCountdown=0}dispose(){this._stacks&&this._stacks.clear()}check(O){let Q=Ae;if(typeof this.customThreshold=="number"&&(Q=this.customThreshold),Q<=0||O<Q)return;this._stacks||(this._stacks=new Map);const H=new Error().stack.split(`
`).slice(3).join(`
`),q=this._stacks.get(H)||0;if(this._stacks.set(H,q+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=Q*.5;let K,$=0;for(const[V,he]of this._stacks)(!K||$<he)&&(K=V,$=he);console.warn(`[${this.name}] potential listener LEAK detected, having ${O} listeners already. MOST frequent listener (${$}):`),console.warn(K)}return()=>{const K=this._stacks.get(H)||0;this._stacks.set(H,K-1)}}}class f{constructor(O){var Q;this._disposed=!1,this._options=O,this._leakageMon=Ae>0?new P(this._options&&this._options.leakWarningThreshold):void 0,this._perfMon=!((Q=this._options)===null||Q===void 0)&&Q._profName?new S(this._options._profName):void 0}get event(){return this._event||(this._event=(O,Q,H)=>{var q;this._listeners||(this._listeners=new Ze.S);const K=this._listeners.isEmpty();K&&this._options&&this._options.onFirstListenerAdd&&this._options.onFirstListenerAdd(this);const $=this._listeners.push(Q?[O,Q]:O);K&&this._options&&this._options.onFirstListenerDidAdd&&this._options.onFirstListenerDidAdd(this),this._options&&this._options.onListenerDidAdd&&this._options.onListenerDidAdd(this,O,Q);const V=(q=this._leakageMon)===null||q===void 0?void 0:q.check(this._listeners.size),he=(0,we.OF)(()=>{V&&V(),this._disposed||($(),this._options&&this._options.onLastListenerRemove&&(this._listeners&&!this._listeners.isEmpty()||this._options.onLastListenerRemove(this)))});return H instanceof we.SL?H.add(he):Array.isArray(H)&&H.push(he),he}),this._event}fire(O){var Q,H;if(this._listeners){this._deliveryQueue||(this._deliveryQueue=new Ze.S);for(let q of this._listeners)this._deliveryQueue.push([q,O]);for((Q=this._perfMon)===null||Q===void 0||Q.start(this._deliveryQueue.size);this._deliveryQueue.size>0;){const[q,K]=this._deliveryQueue.shift();try{typeof q=="function"?q.call(void 0,K):q[0].call(q[1],K)}catch($){(0,le.dL)($)}}(H=this._perfMon)===null||H===void 0||H.stop()}}dispose(){var O,Q,H,q,K;this._disposed||(this._disposed=!0,(O=this._listeners)===null||O===void 0||O.clear(),(Q=this._deliveryQueue)===null||Q===void 0||Q.clear(),(q=(H=this._options)===null||H===void 0?void 0:H.onLastListenerRemove)===null||q===void 0||q.call(H),(K=this._leakageMon)===null||K===void 0||K.dispose())}}class ie extends f{constructor(O){super(O),this._isPaused=0,this._eventQueue=new Ze.S,this._mergeFn=O==null?void 0:O.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){const O=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(O))}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(O){this._listeners&&(this._isPaused!==0?this._eventQueue.push(O):super.fire(O))}}class R extends ie{constructor(O){var Q;super(O),this._delay=(Q=O.delay)!==null&&Q!==void 0?Q:100}fire(O){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(O)}}class k{constructor(){this.buffers=[]}wrapEvent(O){return(Q,H,q)=>O(K=>{const $=this.buffers[this.buffers.length-1];$?$.push(()=>Q.call(H,K)):Q.call(H,K)},void 0,q)}bufferEvents(O){const Q=[];this.buffers.push(Q);const H=O();return this.buffers.pop(),Q.forEach(q=>q()),H}}class T{constructor(){this.listening=!1,this.inputEvent=Z.None,this.inputEventListener=we.JT.None,this.emitter=new f({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(O){this.inputEvent=O,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=O(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}},17845:function(Ci,Bt,re){"use strict";re.d(Bt,{I:function(){return le}});function le(we){const Ze=this;let pe=!1,Z;return function(){return pe||(pe=!0,Z=we.apply(Ze,arguments)),Z}}},88226:function(Ci,Bt,re){"use strict";re.d(Bt,{$:function(){return le}});var le;(function(we){function Ze($){return $&&typeof $=="object"&&typeof $[Symbol.iterator]=="function"}we.is=Ze;const pe=Object.freeze([]);function Z(){return pe}we.empty=Z;function*S($){yield $}we.single=S;function Ae($){return $||pe}we.from=Ae;function P($){return!$||$[Symbol.iterator]().next().done===!0}we.isEmpty=P;function f($){return $[Symbol.iterator]().next().value}we.first=f;function ie($,V){for(const he of $)if(V(he))return!0;return!1}we.some=ie;function R($,V){for(const he of $)if(V(he))return he}we.find=R;function*k($,V){for(const he of $)V(he)&&(yield he)}we.filter=k;function*T($,V){let he=0;for(const be of $)yield V(be,he++)}we.map=T;function*C(...$){for(const V of $)for(const he of V)yield he}we.concat=C;function*O($){for(const V of $)for(const he of V)yield he}we.concatNested=O;function Q($,V,he){let be=he;for(const Te of $)be=V(be,Te);return be}we.reduce=Q;function*H($,V,he=$.length){for(V<0&&(V+=$.length),he<0?he+=$.length:he>$.length&&(he=$.length);V<he;V++)yield $[V]}we.slice=H;function q($,V=Number.POSITIVE_INFINITY){const he=[];if(V===0)return[he,$];const be=$[Symbol.iterator]();for(let Te=0;Te<V;Te++){const se=be.next();if(se.done)return[he,we.empty()];he.push(se.value)}return[he,{[Symbol.iterator](){return be}}]}we.consume=q;function K($,V,he=(be,Te)=>be===Te){const be=$[Symbol.iterator](),Te=V[Symbol.iterator]();for(;;){const se=be.next(),Ee=Te.next();if(se.done!==Ee.done)return!1;if(se.done)return!0;if(!he(se.value,Ee.value))return!1}}we.equals=K})(le||(le={}))},69323:function(Ci,Bt,re){"use strict";re.d(Bt,{B9:function(){return T},F8:function(){return C},JT:function(){return H},Jz:function(){return K},OF:function(){return O},SL:function(){return Q},Wf:function(){return k},XK:function(){return q},dk:function(){return ie}});var le=re(17845),we=re(88226);const Ze=!1;let pe=null;function Z($){pe=$}if(Ze){const $="__is_disposable_tracked__";Z(new class{trackDisposable(V){const he=new Error("Potentially leaked disposable").stack;setTimeout(()=>{V[$]||console.log(he)},3e3)}setParent(V,he){if(V&&V!==H.None)try{V[$]=!0}catch(be){}}markAsDisposed(V){if(V&&V!==H.None)try{V[$]=!0}catch(he){}}markAsSingleton(V){}})}function S($){return pe==null||pe.trackDisposable($),$}function Ae($){pe==null||pe.markAsDisposed($)}function P($,V){pe==null||pe.setParent($,V)}function f($,V){if(pe)for(const he of $)pe.setParent(he,V)}function ie($){return pe==null||pe.markAsSingleton($),$}class R extends Error{constructor(V){super(`Encountered errors while disposing of store. Errors: [${V.join(", ")}]`),this.errors=V}}function k($){return typeof $.dispose=="function"&&$.dispose.length===0}function T($){if(we.$.is($)){let V=[];for(const he of $)if(he)try{he.dispose()}catch(be){V.push(be)}if(V.length===1)throw V[0];if(V.length>1)throw new R(V);return Array.isArray($)?[]:$}else if($)return $.dispose(),$}function C(...$){const V=O(()=>T($));return f($,V),V}function O($){const V=S({dispose:(0,le.I)(()=>{Ae(V),$()})});return V}class Q{constructor(){this._toDispose=new Set,this._isDisposed=!1,S(this)}dispose(){this._isDisposed||(Ae(this),this._isDisposed=!0,this.clear())}clear(){try{T(this._toDispose.values())}finally{this._toDispose.clear()}}add(V){if(!V)return V;if(V===this)throw new Error("Cannot register a disposable on itself!");return P(V,this),this._isDisposed?Q.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(V),V}}Q.DISABLE_DISPOSED_WARNING=!1;class H{constructor(){this._store=new Q,S(this),P(this._store,this)}dispose(){Ae(this),this._store.dispose()}_register(V){if(V===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(V)}}H.None=Object.freeze({dispose(){}});class q{constructor(){this._isDisposed=!1,S(this)}get value(){return this._isDisposed?void 0:this._value}set value(V){var he;this._isDisposed||V===this._value||((he=this._value)===null||he===void 0||he.dispose(),V&&P(V,this),this._value=V)}clear(){this.value=void 0}dispose(){var V;this._isDisposed=!0,Ae(this),(V=this._value)===null||V===void 0||V.dispose(),this._value=void 0}clearAndLeak(){const V=this._value;return this._value=void 0,V&&P(V,null),V}}class K{constructor(V){this.object=V}dispose(){}}},34502:function(Ci,Bt,re){"use strict";re.d(Bt,{S:function(){return we}});class le{constructor(pe){this.element=pe,this.next=le.Undefined,this.prev=le.Undefined}}le.Undefined=new le(void 0);class we{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let pe=this._first;for(;pe!==le.Undefined;){const Z=pe.next;pe.prev=le.Undefined,pe.next=le.Undefined,pe=Z}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(pe){return this._insert(pe,!1)}push(pe){return this._insert(pe,!0)}_insert(pe,Z){const S=new le(pe);if(this._first===le.Undefined)this._first=S,this._last=S;else if(Z){const P=this._last;this._last=S,S.prev=P,P.next=S}else{const P=this._first;this._first=S,S.next=P,P.prev=S}this._size+=1;let Ae=!1;return()=>{Ae||(Ae=!0,this._remove(S))}}shift(){if(this._first!==le.Undefined){const pe=this._first.element;return this._remove(this._first),pe}}pop(){if(this._last!==le.Undefined){const pe=this._last.element;return this._remove(this._last),pe}}_remove(pe){if(pe.prev!==le.Undefined&&pe.next!==le.Undefined){const Z=pe.prev;Z.next=pe.next,pe.next.prev=Z}else pe.prev===le.Undefined&&pe.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):pe.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):pe.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let pe=this._first;for(;pe!==le.Undefined;)yield pe.element,pe=pe.next}}},23345:function(Ci,Bt,re){"use strict";re.d(Bt,{$L:function(){return be},ED:function(){return K},IJ:function(){return V},OS:function(){return We},WE:function(){return se},dz:function(){return $},gn:function(){return Te},li:function(){return O},r:function(){return te},tY:function(){return he},xS:function(){return Ee}});var le=re(97671),we;const Ze="en";let pe=!1,Z=!1,S=!1,Ae=!1,P=!1,f=!1,ie=!1,R,k=null,T=null,C;const O=typeof self=="object"?self:typeof re.g=="object"?re.g:{};let Q;typeof O.vscode!="undefined"&&typeof O.vscode.process!="undefined"?Q=O.vscode.process:typeof le!="undefined"&&(Q=le);const H=typeof((we=Q==null?void 0:Q.versions)===null||we===void 0?void 0:we.electron)=="string"&&Q.type==="renderer";if(typeof navigator=="object"&&!H)C=navigator.userAgent,pe=C.indexOf("Windows")>=0,Z=C.indexOf("Macintosh")>=0,ie=(C.indexOf("Macintosh")>=0||C.indexOf("iPad")>=0||C.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,S=C.indexOf("Linux")>=0,f=!0,R=navigator.language,k=R;else if(typeof Q=="object"){pe=Q.platform==="win32",Z=Q.platform==="darwin",S=Q.platform==="linux",Ae=S&&!!Q.env.SNAP&&!!Q.env.SNAP_REVISION,R=Ze,k=Ze;const z=Q.env.VSCODE_NLS_CONFIG;if(z)try{const X=JSON.parse(z),ee=X.availableLanguages["*"];R=X.locale,k=ee||Ze,T=X._translationsConfigFile}catch(X){}P=!0}else console.error("Unable to resolve platform.");let q=0;Z?q=1:pe?q=3:S&&(q=2);const K=pe,$=Z,V=S,he=P,be=f,Te=ie,se=C,Ee=function(){if(O.setImmediate)return O.setImmediate.bind(O);if(typeof O.postMessage=="function"&&!O.importScripts){let ee=[];O.addEventListener("message",ne=>{if(ne.data&&ne.data.vscodeSetImmediateId)for(let A=0,D=ee.length;A<D;A++){const G=ee[A];if(G.id===ne.data.vscodeSetImmediateId){ee.splice(A,1),G.callback();return}}});let fe=0;return ne=>{const A=++fe;ee.push({id:A,callback:ne}),O.postMessage({vscodeSetImmediateId:A},"*")}}if(typeof(Q==null?void 0:Q.nextTick)=="function")return Q.nextTick.bind(Q);const X=Promise.resolve();return ee=>X.then(ee)}(),We=Z||ie?2:pe?1:3;let Ke=!0,Rt=!1;function te(){if(!Rt){Rt=!0;const z=new Uint8Array(2);z[0]=1,z[1]=2,Ke=new Uint16Array(z.buffer)[0]===513}return Ke}},95830:function(Ci,Bt,re){"use strict";re.d(Bt,{G:function(){return Ze}});var le=re(23345);const we=le.li.performance&&typeof le.li.performance.now=="function";class Ze{constructor(Z){this._highResolution=we&&Z,this._startTime=this._now(),this._stopTime=-1}static create(Z=!0){return new Ze(Z)}stop(){this._stopTime=this._now()}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}_now(){return this._highResolution?le.li.performance.now():Date.now()}}},82983:function(Ci,Bt,re){"use strict";re.d(Bt,{$i:function(){return ze},C8:function(){return Ot},GF:function(){return R},HO:function(){return fe},IO:function(){return k},K7:function(){return qt},Kw:function(){return tt},LC:function(){return O},Mh:function(){return Ee},P1:function(){return We},PJ:function(){return mt},Qe:function(){return pt},R1:function(){return ie},RP:function(){return G},S6:function(){return ct},TT:function(){return K},Ut:function(){return A},V8:function(){return Q},WU:function(){return Ze},YK:function(){return Rt},YU:function(){return pe},ZG:function(){return Ke},ZH:function(){return z},ab:function(){return Ut},c1:function(){return wt},df:function(){return be},ec:function(){return Z},fi:function(){return ei},fy:function(){return S},j3:function(){return Ae},j_:function(){return V},m5:function(){return le},mK:function(){return he},mr:function(){return T},oH:function(){return me},oL:function(){return P},ok:function(){return se},ow:function(){return H},qq:function(){return Te},qu:function(){return q},rL:function(){return te},uS:function(){return Ne},un:function(){return f},uq:function(){return C},vH:function(){return ee},xe:function(){return Ie},zY:function(){return $}});function le(Y){return!Y||typeof Y!="string"?!0:Y.trim().length===0}const we=/{(\d+)}/g;function Ze(Y,...ye){return ye.length===0?Y:Y.replace(we,function(Oe,qe){const ot=parseInt(qe,10);return isNaN(ot)||ot<0||ot>=ye.length?Oe:ye[ot]})}function pe(Y){return Y.replace(/[<>&]/g,function(ye){switch(ye){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return ye}})}function Z(Y){return Y.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function S(Y,ye=" "){const Oe=Ae(Y,ye);return P(Oe,ye)}function Ae(Y,ye){if(!Y||!ye)return Y;const Oe=ye.length;if(Oe===0||Y.length===0)return Y;let qe=0;for(;Y.indexOf(ye,qe)===qe;)qe=qe+Oe;return Y.substring(qe)}function P(Y,ye){if(!Y||!ye)return Y;const Oe=ye.length,qe=Y.length;if(Oe===0||qe===0)return Y;let ot=qe,vt=-1;for(;vt=Y.lastIndexOf(ye,ot-1),!(vt===-1||vt+Oe!==ot);){if(vt===0)return"";ot=vt}return Y.substring(0,ot)}function f(Y){return Y.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function ie(Y){return Y.replace(/\*/g,"")}function R(Y,ye,Oe={}){if(!Y)throw new Error("Cannot create regex from empty string");ye||(Y=Z(Y)),Oe.wholeWord&&(/\B/.test(Y.charAt(0))||(Y="\\b"+Y),/\B/.test(Y.charAt(Y.length-1))||(Y=Y+"\\b"));let qe="";return Oe.global&&(qe+="g"),Oe.matchCase||(qe+="i"),Oe.multiline&&(qe+="m"),Oe.unicode&&(qe+="u"),new RegExp(Y,qe)}function k(Y){return Y.source==="^"||Y.source==="^$"||Y.source==="$"||Y.source==="^\\s*$"?!1:!!(Y.exec("")&&Y.lastIndex===0)}function T(Y){return(Y.global?"g":"")+(Y.ignoreCase?"i":"")+(Y.multiline?"m":"")+(Y.unicode?"u":"")}function C(Y){return Y.split(/\r\n|\r|\n/)}function O(Y){for(let ye=0,Oe=Y.length;ye<Oe;ye++){const qe=Y.charCodeAt(ye);if(qe!==32&&qe!==9)return ye}return-1}function Q(Y,ye=0,Oe=Y.length){for(let qe=ye;qe<Oe;qe++){const ot=Y.charCodeAt(qe);if(ot!==32&&ot!==9)return Y.substring(ye,qe)}return Y.substring(ye,Oe)}function H(Y,ye=Y.length-1){for(let Oe=ye;Oe>=0;Oe--){const qe=Y.charCodeAt(Oe);if(qe!==32&&qe!==9)return Oe}return-1}function q(Y,ye){return Y<ye?-1:Y>ye?1:0}function K(Y,ye,Oe=0,qe=Y.length,ot=0,vt=ye.length){for(;Oe<qe&&ot<vt;Oe++,ot++){let Se=Y.charCodeAt(Oe),yt=ye.charCodeAt(ot);if(Se<yt)return-1;if(Se>yt)return 1}const jt=qe-Oe,gt=vt-ot;return jt<gt?-1:jt>gt?1:0}function $(Y,ye){return V(Y,ye,0,Y.length,0,ye.length)}function V(Y,ye,Oe=0,qe=Y.length,ot=0,vt=ye.length){for(;Oe<qe&&ot<vt;Oe++,ot++){let Se=Y.charCodeAt(Oe),yt=ye.charCodeAt(ot);if(Se===yt)continue;if(Se>=128||yt>=128)return K(Y.toLowerCase(),ye.toLowerCase(),Oe,qe,ot,vt);he(Se)&&(Se-=32),he(yt)&&(yt-=32);const Wt=Se-yt;if(Wt!==0)return Wt}const jt=qe-Oe,gt=vt-ot;return jt<gt?-1:jt>gt?1:0}function he(Y){return Y>=97&&Y<=122}function be(Y){return Y>=65&&Y<=90}function Te(Y,ye){return Y.length===ye.length&&V(Y,ye)===0}function se(Y,ye){const Oe=ye.length;return ye.length>Y.length?!1:V(Y,ye,0,Oe)===0}function Ee(Y,ye){let Oe,qe=Math.min(Y.length,ye.length);for(Oe=0;Oe<qe;Oe++)if(Y.charCodeAt(Oe)!==ye.charCodeAt(Oe))return Oe;return qe}function We(Y,ye){let Oe,qe=Math.min(Y.length,ye.length);const ot=Y.length-1,vt=ye.length-1;for(Oe=0;Oe<qe;Oe++)if(Y.charCodeAt(ot-Oe)!==ye.charCodeAt(vt-Oe))return Oe;return qe}function Ke(Y){return 55296<=Y&&Y<=56319}function Rt(Y){return 56320<=Y&&Y<=57343}function te(Y,ye){return(Y-55296<<10)+(ye-56320)+65536}function z(Y,ye,Oe){const qe=Y.charCodeAt(Oe);if(Ke(qe)&&Oe+1<ye){const ot=Y.charCodeAt(Oe+1);if(Rt(ot))return te(qe,ot)}return qe}function X(Y,ye){const Oe=Y.charCodeAt(ye-1);if(Rt(Oe)&&ye>1){const qe=Y.charCodeAt(ye-2);if(Ke(qe))return te(qe,Oe)}return Oe}function ee(Y,ye){const Oe=Ce.getInstance(),qe=ye,ot=Y.length,vt=z(Y,ot,ye);ye+=vt>=65536?2:1;let jt=Oe.getGraphemeBreakType(vt);for(;ye<ot;){const gt=z(Y,ot,ye),Se=Oe.getGraphemeBreakType(gt);if(ei(jt,Se))break;ye+=gt>=65536?2:1,jt=Se}return ye-qe}function fe(Y,ye){const Oe=Ce.getInstance(),qe=ye,ot=X(Y,ye);ye-=ot>=65536?2:1;let vt=Oe.getGraphemeBreakType(ot);for(;ye>0;){const jt=X(Y,ye),gt=Oe.getGraphemeBreakType(jt);if(ei(gt,vt))break;ye-=jt>=65536?2:1,vt=gt}return qe-ye}const ne=/(?:[\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 A(Y){return ne.test(Y)}const D=/(?:[\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 G(Y){return D.test(Y)}const de=/^[\t\n\r\x20-\x7E]*$/;function ze(Y){return de.test(Y)}const pt=/[\u2028\u2029]/;function Ut(Y){return pt.test(Y)}function Ie(Y){for(let ye=0,Oe=Y.length;ye<Oe;ye++)if(qt(Y.charCodeAt(ye)))return!0;return!1}function qt(Y){return Y=+Y,Y>=11904&&Y<=55215||Y>=63744&&Y<=64255||Y>=65281&&Y<=65374}function Ot(Y){return Y>=127462&&Y<=127487||Y===8986||Y===8987||Y===9200||Y===9203||Y>=9728&&Y<=10175||Y===11088||Y===11093||Y>=127744&&Y<=128591||Y>=128640&&Y<=128764||Y>=128992&&Y<=129003||Y>=129280&&Y<=129535||Y>=129648&&Y<=129750}const wt="\uFEFF";function Ne(Y){return!!(Y&&Y.length>0&&Y.charCodeAt(0)===65279)}function tt(Y,ye=!1){return Y?(ye&&(Y=Y.replace(/\\./g,"")),Y.toLowerCase()!==Y):!1}function mt(Y){return Y=Y%(2*26),Y<26?String.fromCharCode(97+Y):String.fromCharCode(65+Y-26)}function ct(Y){return Ce.getInstance().getGraphemeBreakType(Y)}function ei(Y,ye){return Y===0?ye!==5&&ye!==7:Y===2&&ye===3?!1:Y===4||Y===2||Y===3||ye===4||ye===2||ye===3?!0:!(Y===8&&(ye===8||ye===9||ye===11||ye===12)||(Y===11||Y===9)&&(ye===9||ye===10)||(Y===12||Y===10)&&ye===10||ye===5||ye===13||ye===7||Y===1||Y===13&&ye===14||Y===6&&ye===6)}class Ce{constructor(){this._data=Fe()}static getInstance(){return Ce._INSTANCE||(Ce._INSTANCE=new Ce),Ce._INSTANCE}getGraphemeBreakType(ye){if(ye<32)return ye===10?3:ye===13?2:4;if(ye<127)return 0;const Oe=this._data,qe=Oe.length/3;let ot=1;for(;ot<=qe;)if(ye<Oe[3*ot])ot=2*ot;else if(ye>Oe[3*ot+1])ot=2*ot+1;else return Oe[3*ot+2];return 0}}Ce._INSTANCE=null;function Fe(){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 me(Y,ye){if(Y===0)return 0;const Oe=Ye(Y,ye);if(Oe!==void 0)return Oe;const qe=X(ye,Y);return Y-=at(qe),Y}function Ye(Y,ye){let Oe=X(ye,Y);for(Y-=at(Oe);Xe(Oe)||Oe===65039||Oe===8419;){if(Y===0)return;Oe=X(ye,Y),Y-=at(Oe)}if(Ot(Oe)){if(Y>=0){const qe=X(ye,Y);qe===8205&&(Y-=at(qe))}return Y}}function at(Y){return Y>=65536?2:1}function Xe(Y){return 127995<=Y&&Y<=127999}},72999:function(Ci,Bt,re){"use strict";re.d(Bt,{$E:function(){return O},$K:function(){return Ae},D8:function(){return k},HD:function(){return we},IU:function(){return Q},Jp:function(){return P},Kn:function(){return Ze},cW:function(){return ie},f6:function(){return H},hj:function(){return pe},jn:function(){return Z},kJ:function(){return le},mf:function(){return R},o8:function(){return S},p_:function(){return f},vE:function(){return q}});function le(K){return Array.isArray(K)}function we(K){return typeof K=="string"}function Ze(K){return typeof K=="object"&&K!==null&&!Array.isArray(K)&&!(K instanceof RegExp)&&!(K instanceof Date)}function pe(K){return typeof K=="number"&&!isNaN(K)}function Z(K){return K===!0||K===!1}function S(K){return typeof K=="undefined"}function Ae(K){return!P(K)}function P(K){return S(K)||K===null}function f(K,$){if(!K)throw new Error($?`Unexpected type, expected '${$}'`:"Unexpected type")}function ie(K){if(P(K))throw new Error("Assertion Failed: argument is undefined or null");return K}function R(K){return typeof K=="function"}function k(K,$){const V=Math.min(K.length,$.length);for(let he=0;he<V;he++)T(K[he],$[he])}function T(K,$){if(we($)){if(typeof K!==$)throw new Error(`argument does not match constraint: typeof ${$}`)}else if(R($)){try{if(K instanceof $)return}catch(V){}if(!P(K)&&K.constructor===$||$.length===1&&$.call(void 0,K)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function C(K){let $=[],V=Object.getPrototypeOf(K);for(;Object.prototype!==V;)$=$.concat(Object.getOwnPropertyNames(V)),V=Object.getPrototypeOf(V);return $}function O(K){const $=[];for(const V of C(K))typeof K[V]=="function"&&$.push(V);return $}function Q(K,$){const V=be=>function(){const Te=Array.prototype.slice.call(arguments,0);return $(be,Te)};let he={};for(const be of K)he[be]=V(be);return he}function H(K){return K===null?void 0:K}function q(K,$="Unreachable"){throw new Error($)}},13268:function(Ci,Bt,re){"use strict";re.d(Bt,{N:function(){return we}});function le(Ze,pe){let Z;return pe.length===0?Z=Ze:Z=Ze.replace(/\{(\d+)\}/g,function(S,Ae){const P=Ae[0];return typeof pe[P]!="undefined"?pe[P]:S}),Z}function we(Ze,pe,...Z){return le(pe,Z)}},96236:function(Ci,Bt,re){"use strict";re.d(Bt,{BH:function(){return Q},NZ:function(){return H},U8:function(){return q},co:function(){return O},eH:function(){return C},vr:function(){return T}});var le=re(75918),we=re(52615),Ze=re(4348),pe=re(88226),Z=re(69323),S=re(34502),Ae=re(35884),P=re(90689),f=re(16925),ie=re(49055),R=function(K,$,V,he){var be=arguments.length,Te=be<3?$:he===null?he=Object.getOwnPropertyDescriptor($,V):he,se;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Te=Reflect.decorate(K,$,V,he);else for(var Ee=K.length-1;Ee>=0;Ee--)(se=K[Ee])&&(Te=(be<3?se(Te):be>3?se($,V,Te):se($,V))||Te);return be>3&&Te&&Object.defineProperty($,V,Te),Te},k=function(K,$){return function(V,he){$(V,he,K)}};function T(K){return K.command!==void 0}class C{constructor($){this.id=C._idPool++,this._debugName=$}}C._idPool=0,C.CommandPalette=new C("CommandPalette"),C.EditorContext=new C("EditorContext"),C.SimpleEditorContext=new C("SimpleEditorContext"),C.EditorContextCopy=new C("EditorContextCopy"),C.EditorContextPeek=new C("EditorContextPeek"),C.MenubarEditMenu=new C("MenubarEditMenu"),C.MenubarCopy=new C("MenubarCopy"),C.MenubarGoMenu=new C("MenubarGoMenu"),C.MenubarSelectionMenu=new C("MenubarSelectionMenu"),C.InlineCompletionsActions=new C("InlineCompletionsActions");const O=(0,f.yh)("menuService"),Q=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new Ze.Q5,this.onDidChangeMenu=this._onDidChangeMenu.event,this._commandPaletteChangeEvent={has:K=>K===C.CommandPalette}}addCommand(K){return this.addCommands(pe.$.single(K))}addCommands(K){for(const $ of K)this._commands.set($.id,$);return this._onDidChangeMenu.fire(this._commandPaletteChangeEvent),(0,Z.OF)(()=>{let $=!1;for(const V of K)$=this._commands.delete(V.id)||$;$&&this._onDidChangeMenu.fire(this._commandPaletteChangeEvent)})}getCommand(K){return this._commands.get(K)}getCommands(){const K=new Map;return this._commands.forEach(($,V)=>K.set(V,$)),K}appendMenuItem(K,$){return this.appendMenuItems(pe.$.single({id:K,item:$}))}appendMenuItems(K){const $=new Set,V=new S.S;for(const{id:he,item:be}of K){let Te=this._menuItems.get(he);Te||(Te=new S.S,this._menuItems.set(he,Te)),V.push(Te.push(be)),$.add(he)}return this._onDidChangeMenu.fire($),(0,Z.OF)(()=>{if(V.size>0){for(let he of V)he();this._onDidChangeMenu.fire($),V.clear()}})}getMenuItems(K){let $;return this._menuItems.has(K)?$=[...this._menuItems.get(K)]:$=[],K===C.CommandPalette&&this._appendImplicitItems($),$}_appendImplicitItems(K){const $=new Set;for(const V of K)T(V)&&($.add(V.command.id),V.alt&&$.add(V.alt.id));this._commands.forEach((V,he)=>{$.has(he)||K.push({command:V})})}};class H extends le.wY{constructor($,V,he,be){super(`submenuitem.${$.submenu.id}`,typeof $.title=="string"?$.title:$.title.value,[],"submenu"),this.item=$,this._menuService=V,this._contextKeyService=he,this._options=be}get actions(){const $=[],V=this._menuService.createMenu(this.item.submenu,this._contextKeyService),he=V.getActions(this._options);V.dispose();for(const[,be]of he)be.length>0&&($.push(...be),$.push(new le.Z0));return $.length&&$.pop(),$}}let q=class Np{constructor($,V,he,be,Te){var se,Ee;if(this._commandService=Te,this.id=$.id,this.label=he!=null&&he.renderShortTitle&&$.shortTitle?typeof $.shortTitle=="string"?$.shortTitle:$.shortTitle.value:typeof $.title=="string"?$.title:$.title.value,this.tooltip=(Ee=typeof $.tooltip=="string"?$.tooltip:(se=$.tooltip)===null||se===void 0?void 0:se.value)!==null&&Ee!==void 0?Ee:"",this.enabled=!$.precondition||be.contextMatchesRules($.precondition),this.checked=void 0,$.toggled){const We=$.toggled.condition?$.toggled:{condition:$.toggled};this.checked=be.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=$,this.alt=V?new Np(V,void 0,he,be,Te):void 0,this._options=he,ie.kS.isThemeIcon($.icon)&&(this.class=we.dT.asClassName($.icon))}dispose(){}run(...$){var V,he;let be=[];return!((V=this._options)===null||V===void 0)&&V.arg&&(be=[...be,this._options.arg]),!((he=this._options)===null||he===void 0)&&he.shouldForwardArgs&&(be=[...be,...$]),this._commandService.executeCommand(this.id,...be)}};q=R([k(3,P.i6),k(4,Ae.H)],q)},35884:function(Ci,Bt,re){"use strict";re.d(Bt,{H:function(){return Ae},P:function(){return P}});var le=re(4348),we=re(88226),Ze=re(69323),pe=re(34502),Z=re(72999),S=re(16925);const Ae=(0,S.yh)("commandService"),P=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new le.Q5,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(f,ie){if(!f)throw new Error("invalid command");if(typeof f=="string"){if(!ie)throw new Error("invalid command");return this.registerCommand({id:f,handler:ie})}if(f.description){const O=[];for(let H of f.description.args)O.push(H.constraint);const Q=f.handler;f.handler=function(H,...q){return(0,Z.D8)(q,O),Q(H,...q)}}const{id:R}=f;let k=this._commands.get(R);k||(k=new pe.S,this._commands.set(R,k));let T=k.unshift(f),C=(0,Ze.OF)(()=>{T();const O=this._commands.get(R);O!=null&&O.isEmpty()&&this._commands.delete(R)});return this._onDidRegisterCommand.fire(R),C}registerCommandAlias(f,ie){return P.registerCommand(f,(R,...k)=>R.get(Ae).executeCommand(ie,...k))}getCommand(f){const ie=this._commands.get(f);if(!(!ie||ie.isEmpty()))return we.$.first(ie)}getCommands(){const f=new Map;for(const ie of this._commands.keys()){const R=this.getCommand(ie);R&&f.set(ie,R)}return f}};P.registerCommand("noop",()=>{})},90689:function(Ci,Bt,re){"use strict";re.d(Bt,{Ao:function(){return Ae},Eq:function(){return te},Fb:function(){return P},K8:function(){return ee},i6:function(){return Rt},uy:function(){return Ke}});var le=re(23345),we=re(82983),Ze=re(16925);let pe=le.WE||"";const Z=new Map;Z.set("false",!1),Z.set("true",!0),Z.set("isMac",le.dz),Z.set("isLinux",le.IJ),Z.set("isWindows",le.ED),Z.set("isWeb",le.$L),Z.set("isMacNative",le.dz&&!le.$L),Z.set("isEdge",pe.indexOf("Edg/")>=0),Z.set("isFirefox",pe.indexOf("Firefox")>=0),Z.set("isChrome",pe.indexOf("Chrome")>=0),Z.set("isSafari",pe.indexOf("Safari")>=0);const S=Object.prototype.hasOwnProperty;class Ae{static has(A){return k.create(A)}static equals(A,D){return T.create(A,D)}static regex(A,D){return be.create(A,D)}static not(A){return H.create(A)}static and(...A){return Ee.create(A,null)}static or(...A){return We.create(A,null,!0)}static deserialize(A,D=!1){if(A)return this._deserializeOrExpression(A,D)}static _deserializeOrExpression(A,D){let G=A.split("||");return We.create(G.map(de=>this._deserializeAndExpression(de,D)),null,!0)}static _deserializeAndExpression(A,D){let G=A.split("&&");return Ee.create(G.map(de=>this._deserializeOne(de,D)),null)}static _deserializeOne(A,D){if(A=A.trim(),A.indexOf("!=")>=0){let G=A.split("!=");return Q.create(G[0].trim(),this._deserializeValue(G[1],D))}if(A.indexOf("==")>=0){let G=A.split("==");return T.create(G[0].trim(),this._deserializeValue(G[1],D))}if(A.indexOf("=~")>=0){let G=A.split("=~");return be.create(G[0].trim(),this._deserializeRegexValue(G[1],D))}if(A.indexOf(" in ")>=0){let G=A.split(" in ");return C.create(G[0].trim(),G[1].trim())}if(/^[^<=>]+>=[^<=>]+$/.test(A)){const G=A.split(">=");return $.create(G[0].trim(),G[1].trim())}if(/^[^<=>]+>[^<=>]+$/.test(A)){const G=A.split(">");return K.create(G[0].trim(),G[1].trim())}if(/^[^<=>]+<=[^<=>]+$/.test(A)){const G=A.split("<=");return he.create(G[0].trim(),G[1].trim())}if(/^[^<=>]+<[^<=>]+$/.test(A)){const G=A.split("<");return V.create(G[0].trim(),G[1].trim())}return/^\!\s*/.test(A)?H.create(A.substr(1).trim()):k.create(A)}static _deserializeValue(A,D){if(A=A.trim(),A==="true")return!0;if(A==="false")return!1;let G=/^'([^']*)'$/.exec(A);return G?G[1].trim():A}static _deserializeRegexValue(A,D){if((0,we.m5)(A)){if(D)throw new Error("missing regexp-value for =~-expression");return console.warn("missing regexp-value for =~-expression"),null}let G=A.indexOf("/"),de=A.lastIndexOf("/");if(G===de||G<0){if(D)throw new Error(`bad regexp-value '${A}', missing /-enclosure`);return console.warn(`bad regexp-value '${A}', missing /-enclosure`),null}let ze=A.slice(G+1,de),pt=A[de+1]==="i"?"i":"";try{return new RegExp(ze,pt)}catch(Ut){if(D)throw new Error(`bad regexp-value '${A}', parse error: ${Ut}`);return console.warn(`bad regexp-value '${A}', parse error: ${Ut}`),null}}}function P(ne,A){const D=ne?ne.substituteConstants():void 0,G=A?A.substituteConstants():void 0;return!D&&!G?!0:!D||!G?!1:D.equals(G)}function f(ne,A){return ne.cmp(A)}class ie{constructor(){this.type=0}cmp(A){return this.type-A.type}equals(A){return A.type===this.type}substituteConstants(){return this}evaluate(A){return!1}serialize(){return"false"}keys(){return[]}negate(){return R.INSTANCE}}ie.INSTANCE=new ie;class R{constructor(){this.type=1}cmp(A){return this.type-A.type}equals(A){return A.type===this.type}substituteConstants(){return this}evaluate(A){return!0}serialize(){return"true"}keys(){return[]}negate(){return ie.INSTANCE}}R.INSTANCE=new R;class k{constructor(A,D){this.key=A,this.negated=D,this.type=2}static create(A,D=null){const G=Z.get(A);return typeof G=="boolean"?G?R.INSTANCE:ie.INSTANCE:new k(A,D)}cmp(A){return A.type!==this.type?this.type-A.type:z(this.key,A.key)}equals(A){return A.type===this.type?this.key===A.key:!1}substituteConstants(){const A=Z.get(this.key);return typeof A=="boolean"?A?R.INSTANCE:ie.INSTANCE:this}evaluate(A){return!!A.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=H.create(this.key,this)),this.negated}}class T{constructor(A,D,G){this.key=A,this.value=D,this.negated=G,this.type=4}static create(A,D,G=null){if(typeof D=="boolean")return D?k.create(A,G):H.create(A,G);const de=Z.get(A);return typeof de=="boolean"?D===(de?"true":"false")?R.INSTANCE:ie.INSTANCE:new T(A,D,G)}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){const A=Z.get(this.key);if(typeof A=="boolean"){const D=A?"true":"false";return this.value===D?R.INSTANCE:ie.INSTANCE}return this}evaluate(A){return A.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Q.create(this.key,this.value,this)),this.negated}}class C{constructor(A,D){this.key=A,this.valueKey=D,this.type=10,this.negated=null}static create(A,D){return new C(A,D)}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.valueKey,A.key,A.valueKey)}equals(A){return A.type===this.type?this.key===A.key&&this.valueKey===A.valueKey:!1}substituteConstants(){return this}evaluate(A){const D=A.getValue(this.valueKey),G=A.getValue(this.key);return Array.isArray(D)?D.indexOf(G)>=0:typeof G=="string"&&typeof D=="object"&&D!==null?S.call(D,G):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=O.create(this)),this.negated}}class O{constructor(A){this._actual=A,this.type=11}static create(A){return new O(A)}cmp(A){return A.type!==this.type?this.type-A.type:this._actual.cmp(A._actual)}equals(A){return A.type===this.type?this._actual.equals(A._actual):!1}substituteConstants(){return this}evaluate(A){return!this._actual.evaluate(A)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}class Q{constructor(A,D,G){this.key=A,this.value=D,this.negated=G,this.type=5}static create(A,D,G=null){if(typeof D=="boolean")return D?H.create(A,G):k.create(A,G);const de=Z.get(A);return typeof de=="boolean"?D===(de?"true":"false")?ie.INSTANCE:R.INSTANCE:new Q(A,D,G)}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){const A=Z.get(this.key);if(typeof A=="boolean"){const D=A?"true":"false";return this.value===D?ie.INSTANCE:R.INSTANCE}return this}evaluate(A){return A.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 H{constructor(A,D){this.key=A,this.negated=D,this.type=3}static create(A,D=null){const G=Z.get(A);return typeof G=="boolean"?G?ie.INSTANCE:R.INSTANCE:new H(A,D)}cmp(A){return A.type!==this.type?this.type-A.type:z(this.key,A.key)}equals(A){return A.type===this.type?this.key===A.key:!1}substituteConstants(){const A=Z.get(this.key);return typeof A=="boolean"?A?ie.INSTANCE:R.INSTANCE:this}evaluate(A){return!A.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=k.create(this.key,this)),this.negated}}function q(ne,A){if(typeof ne=="string"){const D=parseFloat(ne);isNaN(D)||(ne=D)}return typeof ne=="string"||typeof ne=="number"?A(ne):ie.INSTANCE}class K{constructor(A,D,G){this.key=A,this.value=D,this.negated=G,this.type=12}static create(A,D,G=null){return q(D,de=>new K(A,de,G))}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=he.create(this.key,this.value,this)),this.negated}}class ${constructor(A,D,G){this.key=A,this.value=D,this.negated=G,this.type=13}static create(A,D,G=null){return q(D,de=>new $(A,de,G))}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=V.create(this.key,this.value,this)),this.negated}}class V{constructor(A,D,G){this.key=A,this.value=D,this.negated=G,this.type=14}static create(A,D,G=null){return q(D,de=>new V(A,de,G))}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=$.create(this.key,this.value,this)),this.negated}}class he{constructor(A,D,G){this.key=A,this.value=D,this.negated=G,this.type=15}static create(A,D,G=null){return q(D,de=>new he(A,de,G))}cmp(A){return A.type!==this.type?this.type-A.type:X(this.key,this.value,A.key,A.value)}equals(A){return A.type===this.type?this.key===A.key&&this.value===A.value:!1}substituteConstants(){return this}evaluate(A){return typeof this.value=="string"?!1:parseFloat(A.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=K.create(this.key,this.value,this)),this.negated}}class be{constructor(A,D){this.key=A,this.regexp=D,this.type=7,this.negated=null}static create(A,D){return new be(A,D)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.key<A.key)return-1;if(this.key>A.key)return 1;const D=this.regexp?this.regexp.source:"",G=A.regexp?A.regexp.source:"";return D<G?-1:D>G?1:0}equals(A){if(A.type===this.type){const D=this.regexp?this.regexp.source:"",G=A.regexp?A.regexp.source:"";return this.key===A.key&&D===G}return!1}substituteConstants(){return this}evaluate(A){let D=A.getValue(this.key);return this.regexp?this.regexp.test(D):!1}serialize(){const A=this.regexp?`/${this.regexp.source}/${this.regexp.ignoreCase?"i":""}`:"/invalid/";return`${this.key} =~ ${A}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Te.create(this)),this.negated}}class Te{constructor(A){this._actual=A,this.type=8}static create(A){return new Te(A)}cmp(A){return A.type!==this.type?this.type-A.type:this._actual.cmp(A._actual)}equals(A){return A.type===this.type?this._actual.equals(A._actual):!1}substituteConstants(){return this}evaluate(A){return!this._actual.evaluate(A)}serialize(){throw new Error("Method not implemented.")}keys(){return this._actual.keys()}negate(){return this._actual}}function se(ne){let A=null;for(let D=0,G=ne.length;D<G;D++){const de=ne[D].substituteConstants();if(ne[D]!==de&&A===null){A=[];for(let ze=0;ze<D;ze++)A[ze]=ne[ze]}A!==null&&(A[D]=de)}return A===null?ne:A}class Ee{constructor(A,D){this.expr=A,this.negated=D,this.type=6}static create(A,D){return Ee._normalizeArr(A,D)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.expr.length<A.expr.length)return-1;if(this.expr.length>A.expr.length)return 1;for(let D=0,G=this.expr.length;D<G;D++){const de=f(this.expr[D],A.expr[D]);if(de!==0)return de}return 0}equals(A){if(A.type===this.type){if(this.expr.length!==A.expr.length)return!1;for(let D=0,G=this.expr.length;D<G;D++)if(!this.expr[D].equals(A.expr[D]))return!1;return!0}return!1}substituteConstants(){const A=se(this.expr);return A===this.expr?this:Ee.create(A,this.negated)}evaluate(A){for(let D=0,G=this.expr.length;D<G;D++)if(!this.expr[D].evaluate(A))return!1;return!0}static _normalizeArr(A,D){const G=[];let de=!1;for(const ze of A)if(ze){if(ze.type===1){de=!0;continue}if(ze.type===0)return ie.INSTANCE;if(ze.type===6){G.push(...ze.expr);continue}G.push(ze)}if(G.length===0&&de)return R.INSTANCE;if(G.length!==0){if(G.length===1)return G[0];G.sort(f);for(let ze=1;ze<G.length;ze++)G[ze-1].equals(G[ze])&&(G.splice(ze,1),ze--);if(G.length===1)return G[0];for(;G.length>1;){const ze=G[G.length-1];if(ze.type!==9)break;G.pop();const pt=G.pop(),Ut=G.length===0,Ie=We.create(ze.expr.map(qt=>Ee.create([qt,pt],null)),null,Ut);Ie&&(G.push(Ie),G.sort(f))}return G.length===1?G[0]:new Ee(G,D)}}serialize(){return this.expr.map(A=>A.serialize()).join(" && ")}keys(){const A=[];for(let D of this.expr)A.push(...D.keys());return A}negate(){if(!this.negated){const A=[];for(let D of this.expr)A.push(D.negate());this.negated=We.create(A,this,!0)}return this.negated}}class We{constructor(A,D){this.expr=A,this.negated=D,this.type=9}static create(A,D,G){return We._normalizeArr(A,D,G)}cmp(A){if(A.type!==this.type)return this.type-A.type;if(this.expr.length<A.expr.length)return-1;if(this.expr.length>A.expr.length)return 1;for(let D=0,G=this.expr.length;D<G;D++){const de=f(this.expr[D],A.expr[D]);if(de!==0)return de}return 0}equals(A){if(A.type===this.type){if(this.expr.length!==A.expr.length)return!1;for(let D=0,G=this.expr.length;D<G;D++)if(!this.expr[D].equals(A.expr[D]))return!1;return!0}return!1}substituteConstants(){const A=se(this.expr);return A===this.expr?this:We.create(A,this.negated,!1)}evaluate(A){for(let D=0,G=this.expr.length;D<G;D++)if(this.expr[D].evaluate(A))return!0;return!1}static _normalizeArr(A,D,G){let de=[],ze=!1;if(A){for(let pt=0,Ut=A.length;pt<Ut;pt++){const Ie=A[pt];if(Ie){if(Ie.type===0){ze=!0;continue}if(Ie.type===1)return R.INSTANCE;if(Ie.type===9){de=de.concat(Ie.expr);continue}de.push(Ie)}}if(de.length===0&&ze)return ie.INSTANCE;de.sort(f)}if(de.length!==0){if(de.length===1)return de[0];for(let pt=1;pt<de.length;pt++)de[pt-1].equals(de[pt])&&(de.splice(pt,1),pt--);if(de.length===1)return de[0];if(G){for(let pt=0;pt<de.length;pt++)for(let Ut=pt+1;Ut<de.length;Ut++)ee(de[pt],de[Ut])&&(de.splice(Ut,1),Ut--);if(de.length===1)return de[0]}return new We(de,D)}}serialize(){return this.expr.map(A=>A.serialize()).join(" || ")}keys(){const A=[];for(let D of this.expr)A.push(...D.keys());return A}negate(){if(!this.negated){let A=[];for(let D of this.expr)A.push(D.negate());for(;A.length>1;){const D=A.shift(),G=A.shift(),de=[];for(const pt of fe(D))for(const Ut of fe(G))de.push(Ee.create([pt,Ut],null));const ze=A.length===0;A.unshift(We.create(de,null,ze))}this.negated=A[0]}return this.negated}}class Ke extends k{constructor(A,D,G){super(A,null),this._defaultValue=D,typeof G=="object"?Ke._info.push(Object.assign(Object.assign({},G),{key:A})):G!==!0&&Ke._info.push({key:A,description:G,type:D!=null?typeof D:void 0})}static all(){return Ke._info.values()}bindTo(A){return A.createKey(this.key,this._defaultValue)}getValue(A){return A.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(A){return T.create(this.key,A)}}Ke._info=[];const Rt=(0,Ze.yh)("contextKeyService"),te="setContext";function z(ne,A){return ne<A?-1:ne>A?1:0}function X(ne,A,D,G){return ne<D?-1:ne>D?1:A<G?-1:A>G?1:0}function ee(ne,A){if(A.type===6&&ne.type!==9&&ne.type!==6){for(const de of A.expr)if(ne.equals(de))return!0}const D=ne.negate(),G=fe(D).concat(fe(A));G.sort(f);for(let de=0;de<G.length;de++){const pt=G[de].negate();for(let Ut=de+1;Ut<G.length;Ut++){const Ie=G[Ut];if(pt.equals(Ie))return!0}}return!1}function fe(ne){return ne.type===9?ne.expr:[ne]}},16925:function(Ci,Bt,re){"use strict";re.d(Bt,{I8:function(){return le},TG:function(){return we},jt:function(){return Z},yh:function(){return pe}});var le;(function(S){S.serviceIds=new Map,S.DI_TARGET="$di$target",S.DI_DEPENDENCIES="$di$dependencies";function Ae(P){return P[S.DI_DEPENDENCIES]||[]}S.getServiceDependencies=Ae})(le||(le={}));const we=pe("instantiationService");function Ze(S,Ae,P,f){Ae[le.DI_TARGET]===Ae?Ae[le.DI_DEPENDENCIES].push({id:S,index:P,optional:f}):(Ae[le.DI_DEPENDENCIES]=[{id:S,index:P,optional:f}],Ae[le.DI_TARGET]=Ae)}function pe(S){if(le.serviceIds.has(S))return le.serviceIds.get(S);const Ae=function(P,f,ie){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ze(Ae,P,ie,!1)};return Ae.toString=()=>S,le.serviceIds.set(S,Ae),Ae}function Z(S){return function(Ae,P,f){if(arguments.length!==3)throw new Error("@optional-decorator can only be used to decorate a parameter");Ze(S,Ae,f,!0)}}},44650:function(Ci,Bt,re){"use strict";re.d(Bt,{B:function(){return pe}});var le=re(76068),we=re(72999);class Ze{constructor(){this.data=new Map}add(S,Ae){le.ok(we.HD(S)),le.ok(we.Kn(Ae)),le.ok(!this.data.has(S),"There is already an extension with this id"),this.data.set(S,Ae)}as(S){return this.data.get(S)||null}}const pe=new Ze},66213:function(Ci,Bt,re){"use strict";re.d(Bt,{e:function(){return le}});var le;(function(we){we.DARK="dark",we.LIGHT="light",we.HIGH_CONTRAST="hc"})(le||(le={}))},49055:function(Ci,Bt,re){"use strict";re.d(Bt,{EN:function(){return f},IP:function(){return k},Ic:function(){return O},XE:function(){return Ae},bB:function(){return Q},kS:function(){return ie},m6:function(){return R}});var le=re(52615),we=re(4348),Ze=re(69323),pe=re(16925),Z=re(44650),S=re(66213);const Ae=(0,pe.yh)("themeService");var P;(function(H){function q(K){return K&&typeof K=="object"&&typeof K.id=="string"}H.isThemeColor=q})(P||(P={}));function f(H){return{id:H}}var ie;(function(H){function q(Te){return Te&&typeof Te=="object"&&typeof Te.id=="string"&&(typeof Te.color=="undefined"||P.isThemeColor(Te.color))}H.isThemeIcon=q;const K=new RegExp(`^\\$\\((${le.dT.iconNameExpression}(?:${le.dT.iconModifierExpression})?)\\)$`);function $(Te){const se=K.exec(Te);if(!se)return;let[,Ee]=se;return{id:Ee}}H.fromString=$;function V(Te,se){let Ee=Te.id;const We=Ee.lastIndexOf("~");return We!==-1&&(Ee=Ee.substring(0,We)),se&&(Ee=`${Ee}~${se}`),{id:Ee}}H.modify=V;function he(Te,se){var Ee,We;return Te.id===se.id&&((Ee=Te.color)===null||Ee===void 0?void 0:Ee.id)===((We=se.color)===null||We===void 0?void 0:We.id)}H.isEqual=he;function be(Te,se){return{id:Te.id,color:se?f(se):void 0}}H.asThemeIcon=be,H.asClassNameArray=le.dT.asClassNameArray,H.asClassName=le.dT.asClassName,H.asCSSSelector=le.dT.asCSSSelector})(ie||(ie={}));function R(H){switch(H){case S.e.DARK:return"vs-dark";case S.e.HIGH_CONTRAST:return"hc-black";default:return"vs"}}const k={ThemingContribution:"base.contributions.theming"};class T{constructor(){this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=new we.Q5}onColorThemeChange(q){return this.themingParticipants.push(q),this.onThemingParticipantAddedEmitter.fire(q),(0,Ze.OF)(()=>{const K=this.themingParticipants.indexOf(q);this.themingParticipants.splice(K,1)})}getThemingParticipants(){return this.themingParticipants}}let C=new T;Z.B.add(k.ThemingContribution,C);function O(H){return C.onColorThemeChange(H)}class Q extends Ze.JT{constructor(q){super(),this.themeService=q,this.theme=q.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(K=>this.onThemeChange(K)))}onThemeChange(q){this.theme=q,this.updateStyles()}updateStyles(){}}},16632:function(Ci,Bt,re){"use strict";var le=re(32855),we=re(27247),Ze=re(74430),pe=re(11913),Z=re(43079),S=re(92310),Ae=re.n(S),P=re(18929),f=re(59301),ie=["prefixCls","className","style","checked","disabled","defaultChecked","type","title","onChange"],R=(0,f.forwardRef)(function(k,T){var C=k.prefixCls,O=C===void 0?"rc-checkbox":C,Q=k.className,H=k.style,q=k.checked,K=k.disabled,$=k.defaultChecked,V=$===void 0?!1:$,he=k.type,be=he===void 0?"checkbox":he,Te=k.title,se=k.onChange,Ee=(0,Z.Z)(k,ie),We=(0,f.useRef)(null),Ke=(0,f.useRef)(null),Rt=(0,P.Z)(V,{value:q}),te=(0,pe.Z)(Rt,2),z=te[0],X=te[1];(0,f.useImperativeHandle)(T,function(){return{focus:function(A){var D;(D=We.current)===null||D===void 0||D.focus(A)},blur:function(){var A;(A=We.current)===null||A===void 0||A.blur()},input:We.current,nativeElement:Ke.current}});var ee=Ae()(O,Q,(0,Ze.Z)((0,Ze.Z)({},"".concat(O,"-checked"),z),"".concat(O,"-disabled"),K)),fe=function(A){K||("checked"in k||X(A.target.checked),se==null||se({target:(0,we.Z)((0,we.Z)({},k),{},{type:be,checked:A.target.checked}),stopPropagation:function(){A.stopPropagation()},preventDefault:function(){A.preventDefault()},nativeEvent:A.nativeEvent}))};return f.createElement("span",{className:ee,title:Te,style:H,ref:Ke},f.createElement("input",(0,le.Z)({},Ee,{className:"".concat(O,"-input"),ref:We,onChange:fe,disabled:K,checked:!!z,type:be})),f.createElement("span",{className:"".concat(O,"-inner")}))});Bt.Z=R},96478:function(Ci,Bt,re){"use strict";re.d(Bt,{Z:function(){return Te}});var le=re(32855),we=re(74430),Ze=re(11913),pe=re(43079),Z=re(65030),S=re(92310),Ae=re.n(S),P=re(8654),f=re(59301),ie=re(10228),R=re(16089),k=ie.Z.ESC,T=ie.Z.TAB;function C(se){var Ee=se.visible,We=se.triggerRef,Ke=se.onVisibleChange,Rt=se.autoFocus,te=se.overlayRef,z=f.useRef(!1),X=function(){if(Ee){var A,D;(A=We.current)===null||A===void 0||(D=A.focus)===null||D===void 0||D.call(A),Ke==null||Ke(!1)}},ee=function(){var A;return(A=te.current)!==null&&A!==void 0&&A.focus?(te.current.focus(),z.current=!0,!0):!1},fe=function(A){switch(A.keyCode){case k:X();break;case T:{var D=!1;z.current||(D=ee()),D?A.preventDefault():X();break}}};f.useEffect(function(){return Ee?(window.addEventListener("keydown",fe),Rt&&(0,R.Z)(ee,3),function(){window.removeEventListener("keydown",fe),z.current=!1}):function(){z.current=!1}},[Ee])}var O=(0,f.forwardRef)(function(se,Ee){var We=se.overlay,Ke=se.arrow,Rt=se.prefixCls,te=(0,f.useMemo)(function(){var X;return typeof We=="function"?X=We():X=We,X},[We]),z=(0,P.sQ)(Ee,(0,P.C4)(te));return f.createElement(f.Fragment,null,Ke&&f.createElement("div",{className:"".concat(Rt,"-arrow")}),f.cloneElement(te,{ref:(0,P.Yr)(te)?z:void 0}))}),Q=O,H={adjustX:1,adjustY:1},q=[0,0],K={topLeft:{points:["bl","tl"],overflow:H,offset:[0,-4],targetOffset:q},top:{points:["bc","tc"],overflow:H,offset:[0,-4],targetOffset:q},topRight:{points:["br","tr"],overflow:H,offset:[0,-4],targetOffset:q},bottomLeft:{points:["tl","bl"],overflow:H,offset:[0,4],targetOffset:q},bottom:{points:["tc","bc"],overflow:H,offset:[0,4],targetOffset:q},bottomRight:{points:["tr","br"],overflow:H,offset:[0,4],targetOffset:q}},$=K,V=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function he(se,Ee){var We,Ke=se.arrow,Rt=Ke===void 0?!1:Ke,te=se.prefixCls,z=te===void 0?"rc-dropdown":te,X=se.transitionName,ee=se.animation,fe=se.align,ne=se.placement,A=ne===void 0?"bottomLeft":ne,D=se.placements,G=D===void 0?$:D,de=se.getPopupContainer,ze=se.showAction,pt=se.hideAction,Ut=se.overlayClassName,Ie=se.overlayStyle,qt=se.visible,Ot=se.trigger,wt=Ot===void 0?["hover"]:Ot,Ne=se.autoFocus,tt=se.overlay,mt=se.children,ct=se.onVisibleChange,ei=(0,pe.Z)(se,V),Ce=f.useState(),Fe=(0,Ze.Z)(Ce,2),me=Fe[0],Ye=Fe[1],at="visible"in se?qt:me,Xe=f.useRef(null),Y=f.useRef(null),ye=f.useRef(null);f.useImperativeHandle(Ee,function(){return Xe.current});var Oe=function(Gt){Ye(Gt),ct==null||ct(Gt)};C({visible:at,triggerRef:ye,onVisibleChange:Oe,autoFocus:Ne,overlayRef:Y});var qe=function(Gt){var Le=se.onOverlayClick;Ye(!1),Le&&Le(Gt)},ot=function(){return f.createElement(Q,{ref:Y,overlay:tt,prefixCls:z,arrow:Rt})},vt=function(){return typeof tt=="function"?ot:ot()},jt=function(){var Gt=se.minOverlayWidthMatchTrigger,Le=se.alignPoint;return"minOverlayWidthMatchTrigger"in se?Gt:!Le},gt=function(){var Gt=se.openClassName;return Gt!==void 0?Gt:"".concat(z,"-open")},Se=f.cloneElement(mt,{className:Ae()((We=mt.props)===null||We===void 0?void 0:We.className,at&&gt()),ref:(0,P.Yr)(mt)?(0,P.sQ)(ye,(0,P.C4)(mt)):void 0}),yt=pt;return!yt&&wt.indexOf("contextMenu")!==-1&&(yt=["click"]),f.createElement(Z.Z,(0,le.Z)({builtinPlacements:G},ei,{prefixCls:z,ref:Xe,popupClassName:Ae()(Ut,(0,we.Z)({},"".concat(z,"-show-arrow"),Rt)),popupStyle:Ie,action:wt,showAction:ze,hideAction:yt,popupPlacement:A,popupAlign:fe,popupTransitionName:X,popupAnimation:ee,popupVisible:at,stretch:jt()?"minWidth":"",popup:vt(),onPopupVisibleChange:Oe,onPopupClick:qe,getPopupContainer:de}),Se)}var be=f.forwardRef(he),Te=be},20922:function(Ci,Bt,re){"use strict";re.d(Bt,{Z:function(){return wt}});var le=re(32855),we=re(74430),Ze=re(34666),pe=re(11913),Z=re(43079),S=re(33377),Ae=re(93912);function P(){return typeof BigInt=="function"}function f(Ne){return!Ne&&Ne!==0&&!Number.isNaN(Ne)||!String(Ne).trim()}function ie(Ne){var tt=Ne.trim(),mt=tt.startsWith("-");mt&&(tt=tt.slice(1)),tt=tt.replace(/(\.\d*[^0])0*$/,"$1").replace(/\.0*$/,"").replace(/^0+/,""),tt.startsWith(".")&&(tt="0".concat(tt));var ct=tt||"0",ei=ct.split("."),Ce=ei[0]||"0",Fe=ei[1]||"0";Ce==="0"&&Fe==="0"&&(mt=!1);var me=mt?"-":"";return{negative:mt,negativeStr:me,trimStr:ct,integerStr:Ce,decimalStr:Fe,fullStr:"".concat(me).concat(ct)}}function R(Ne){var tt=String(Ne);return!Number.isNaN(Number(tt))&&tt.includes("e")}function k(Ne){var tt=String(Ne);if(R(Ne)){var mt=Number(tt.slice(tt.indexOf("e-")+2)),ct=tt.match(/\.(\d+)/);return ct!=null&&ct[1]&&(mt+=ct[1].length),mt}return tt.includes(".")&&C(tt)?tt.length-tt.indexOf(".")-1:0}function T(Ne){var tt=String(Ne);if(R(Ne)){if(Ne>Number.MAX_SAFE_INTEGER)return String(P()?BigInt(Ne).toString():Number.MAX_SAFE_INTEGER);if(Ne<Number.MIN_SAFE_INTEGER)return String(P()?BigInt(Ne).toString():Number.MIN_SAFE_INTEGER);tt=Ne.toFixed(k(tt))}return ie(tt).fullStr}function C(Ne){return typeof Ne=="number"?!Number.isNaN(Ne):Ne?/^\s*-?\d+(\.\d+)?\s*$/.test(Ne)||/^\s*-?\d+\.\s*$/.test(Ne)||/^\s*-?\.\d+\s*$/.test(Ne):!1}var O=function(){function Ne(tt){if((0,S.Z)(this,Ne),(0,we.Z)(this,"origin",""),(0,we.Z)(this,"negative",void 0),(0,we.Z)(this,"integer",void 0),(0,we.Z)(this,"decimal",void 0),(0,we.Z)(this,"decimalLen",void 0),(0,we.Z)(this,"empty",void 0),(0,we.Z)(this,"nan",void 0),f(tt)){this.empty=!0;return}if(this.origin=String(tt),tt==="-"||Number.isNaN(tt)){this.nan=!0;return}var mt=tt;if(R(mt)&&(mt=Number(mt)),mt=typeof mt=="string"?mt:T(mt),C(mt)){var ct=ie(mt);this.negative=ct.negative;var ei=ct.trimStr.split(".");this.integer=BigInt(ei[0]);var Ce=ei[1]||"0";this.decimal=BigInt(Ce),this.decimalLen=Ce.length}else this.nan=!0}return(0,Ae.Z)(Ne,[{key:"getMark",value:function(){return this.negative?"-":""}},{key:"getIntegerStr",value:function(){return this.integer.toString()}},{key:"getDecimalStr",value:function(){return this.decimal.toString().padStart(this.decimalLen,"0")}},{key:"alignDecimal",value:function(mt){var ct="".concat(this.getMark()).concat(this.getIntegerStr()).concat(this.getDecimalStr().padEnd(mt,"0"));return BigInt(ct)}},{key:"negate",value:function(){var mt=new Ne(this.toString());return mt.negative=!mt.negative,mt}},{key:"cal",value:function(mt,ct,ei){var Ce=Math.max(this.getDecimalStr().length,mt.getDecimalStr().length),Fe=this.alignDecimal(Ce),me=mt.alignDecimal(Ce),Ye=ct(Fe,me).toString(),at=ei(Ce),Xe=ie(Ye),Y=Xe.negativeStr,ye=Xe.trimStr,Oe="".concat(Y).concat(ye.padStart(at+1,"0"));return new Ne("".concat(Oe.slice(0,-at),".").concat(Oe.slice(-at)))}},{key:"add",value:function(mt){if(this.isInvalidate())return new Ne(mt);var ct=new Ne(mt);return ct.isInvalidate()?this:this.cal(ct,function(ei,Ce){return ei+Ce},function(ei){return ei})}},{key:"multi",value:function(mt){var ct=new Ne(mt);return this.isInvalidate()||ct.isInvalidate()?new Ne(NaN):this.cal(ct,function(ei,Ce){return ei*Ce},function(ei){return ei*2})}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return this.nan}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(mt){return this.toString()===(mt==null?void 0:mt.toString())}},{key:"lessEquals",value:function(mt){return this.add(mt.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.isNaN()?NaN:Number(this.toString())}},{key:"toString",value:function(){var mt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return mt?this.isInvalidate()?"":ie("".concat(this.getMark()).concat(this.getIntegerStr(),".").concat(this.getDecimalStr())).fullStr:this.origin}}]),Ne}(),Q=function(){function Ne(tt){if((0,S.Z)(this,Ne),(0,we.Z)(this,"origin",""),(0,we.Z)(this,"number",void 0),(0,we.Z)(this,"empty",void 0),f(tt)){this.empty=!0;return}this.origin=String(tt),this.number=Number(tt)}return(0,Ae.Z)(Ne,[{key:"negate",value:function(){return new Ne(-this.toNumber())}},{key:"add",value:function(mt){if(this.isInvalidate())return new Ne(mt);var ct=Number(mt);if(Number.isNaN(ct))return this;var ei=this.number+ct;if(ei>Number.MAX_SAFE_INTEGER)return new Ne(Number.MAX_SAFE_INTEGER);if(ei<Number.MIN_SAFE_INTEGER)return new Ne(Number.MIN_SAFE_INTEGER);var Ce=Math.max(k(this.number),k(ct));return new Ne(ei.toFixed(Ce))}},{key:"multi",value:function(mt){var ct=Number(mt);if(this.isInvalidate()||Number.isNaN(ct))return new Ne(NaN);var ei=this.number*ct;if(ei>Number.MAX_SAFE_INTEGER)return new Ne(Number.MAX_SAFE_INTEGER);if(ei<Number.MIN_SAFE_INTEGER)return new Ne(Number.MIN_SAFE_INTEGER);var Ce=Math.max(k(this.number),k(ct));return new Ne(ei.toFixed(Ce))}},{key:"isEmpty",value:function(){return this.empty}},{key:"isNaN",value:function(){return Number.isNaN(this.number)}},{key:"isInvalidate",value:function(){return this.isEmpty()||this.isNaN()}},{key:"equals",value:function(mt){return this.toNumber()===(mt==null?void 0:mt.toNumber())}},{key:"lessEquals",value:function(mt){return this.add(mt.negate().toString()).toNumber()<=0}},{key:"toNumber",value:function(){return this.number}},{key:"toString",value:function(){var mt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return mt?this.isInvalidate()?"":T(this.number):this.origin}}]),Ne}();function H(Ne){return P()?new O(Ne):new Q(Ne)}function q(Ne,tt,mt){var ct=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(Ne==="")return"";var ei=ie(Ne),Ce=ei.negativeStr,Fe=ei.integerStr,me=ei.decimalStr,Ye="".concat(tt).concat(me),at="".concat(Ce).concat(Fe);if(mt>=0){var Xe=Number(me[mt]);if(Xe>=5&&!ct){var Y=H(Ne).add("".concat(Ce,"0.").concat("0".repeat(mt)).concat(10-Xe));return q(Y.toString(),tt,mt,ct)}return mt===0?at:"".concat(at).concat(tt).concat(me.padEnd(mt,"0").slice(0,mt))}return Ye===".0"?at:"".concat(at).concat(Ye)}var K=H,$=re(92310),V=re.n($),he=re(36901),be=re(34280);function Te(Ne,tt){return typeof Proxy!="undefined"&&Ne?new Proxy(Ne,{get:function(ct,ei){if(tt[ei])return tt[ei];var Ce=ct[ei];return typeof Ce=="function"?Ce.bind(ct):Ce}}):Ne}var se=re(8654),Ee=re(59301),We=re(48736);function Ke(Ne,tt){var mt=(0,Ee.useRef)(null);function ct(){try{var Ce=Ne.selectionStart,Fe=Ne.selectionEnd,me=Ne.value,Ye=me.substring(0,Ce),at=me.substring(Fe);mt.current={start:Ce,end:Fe,value:me,beforeTxt:Ye,afterTxt:at}}catch(Xe){}}function ei(){if(Ne&&mt.current&&tt)try{var Ce=Ne.value,Fe=mt.current,me=Fe.beforeTxt,Ye=Fe.afterTxt,at=Fe.start,Xe=Ce.length;if(Ce.startsWith(me))Xe=me.length;else if(Ce.endsWith(Ye))Xe=Ce.length-mt.current.afterTxt.length;else{var Y=me[at-1],ye=Ce.indexOf(Y,at-1);ye!==-1&&(Xe=ye+1)}Ne.setSelectionRange(Xe,Xe)}catch(Oe){(0,We.ZP)(!1,"Something warning of cursor restore. Please fire issue about this: ".concat(Oe.message))}}return[ct,ei]}var Rt=re(49658),te=function(){var tt=(0,Ee.useState)(!1),mt=(0,pe.Z)(tt,2),ct=mt[0],ei=mt[1];return(0,be.Z)(function(){ei((0,Rt.Z)())},[]),ct},z=te,X=re(16089),ee=200,fe=600;function ne(Ne){var tt=Ne.prefixCls,mt=Ne.upNode,ct=Ne.downNode,ei=Ne.upDisabled,Ce=Ne.downDisabled,Fe=Ne.onStep,me=Ee.useRef(),Ye=Ee.useRef([]),at=Ee.useRef();at.current=Fe;var Xe=function(){clearTimeout(me.current)},Y=function(Se,yt){Se.preventDefault(),Xe(),at.current(yt);function Wt(){at.current(yt),me.current=setTimeout(Wt,ee)}me.current=setTimeout(Wt,fe)};Ee.useEffect(function(){return function(){Xe(),Ye.current.forEach(function(gt){return X.Z.cancel(gt)})}},[]);var ye=z();if(ye)return null;var Oe="".concat(tt,"-handler"),qe=V()(Oe,"".concat(Oe,"-up"),(0,we.Z)({},"".concat(Oe,"-up-disabled"),ei)),ot=V()(Oe,"".concat(Oe,"-down"),(0,we.Z)({},"".concat(Oe,"-down-disabled"),Ce)),vt=function(){return Ye.current.push((0,X.Z)(Xe))},jt={unselectable:"on",role:"button",onMouseUp:vt,onMouseLeave:vt};return Ee.createElement("div",{className:"".concat(Oe,"-wrap")},Ee.createElement("span",(0,le.Z)({},jt,{onMouseDown:function(Se){Y(Se,!0)},"aria-label":"Increase Value","aria-disabled":ei,className:qe}),mt||Ee.createElement("span",{unselectable:"on",className:"".concat(tt,"-handler-up-inner")})),Ee.createElement("span",(0,le.Z)({},jt,{onMouseDown:function(Se){Y(Se,!1)},"aria-label":"Decrease Value","aria-disabled":Ce,className:ot}),ct||Ee.createElement("span",{unselectable:"on",className:"".concat(tt,"-handler-down-inner")})))}function A(Ne){var tt=typeof Ne=="number"?T(Ne):ie(Ne).fullStr,mt=tt.includes(".");return mt?ie(tt.replace(/(\d)\.(\d)/g,"$1$2.")).fullStr:Ne+"0"}var D=re(30292),G=function(){var Ne=(0,Ee.useRef)(0),tt=function(){X.Z.cancel(Ne.current)};return(0,Ee.useEffect)(function(){return tt},[]),function(mt){tt(),Ne.current=(0,X.Z)(function(){mt()})}},de=["prefixCls","className","style","min","max","step","defaultValue","value","disabled","readOnly","upHandler","downHandler","keyboard","changeOnWheel","controls","classNames","stringMode","parser","formatter","precision","decimalSeparator","onChange","onInput","onPressEnter","onStep","changeOnBlur","domRef"],ze=["disabled","style","prefixCls","value","prefix","suffix","addonBefore","addonAfter","className","classNames"],pt=function(tt,mt){return tt||mt.isEmpty()?mt.toString():mt.toNumber()},Ut=function(tt){var mt=K(tt);return mt.isInvalidate()?null:mt},Ie=Ee.forwardRef(function(Ne,tt){var mt=Ne.prefixCls,ct=Ne.className,ei=Ne.style,Ce=Ne.min,Fe=Ne.max,me=Ne.step,Ye=me===void 0?1:me,at=Ne.defaultValue,Xe=Ne.value,Y=Ne.disabled,ye=Ne.readOnly,Oe=Ne.upHandler,qe=Ne.downHandler,ot=Ne.keyboard,vt=Ne.changeOnWheel,jt=vt===void 0?!1:vt,gt=Ne.controls,Se=gt===void 0?!0:gt,yt=Ne.classNames,Wt=Ne.stringMode,Gt=Ne.parser,Le=Ne.formatter,Me=Ne.precision,rt=Ne.decimalSeparator,bt=Ne.onChange,je=Ne.onInput,Mt=Ne.onPressEnter,Ct=Ne.onStep,Et=Ne.changeOnBlur,Nt=Et===void 0?!0:Et,Xt=Ne.domRef,Je=(0,Z.Z)(Ne,de),zt="".concat(mt,"-input"),De=Ee.useRef(null),xe=Ee.useState(!1),ke=(0,pe.Z)(xe,2),U=ke[0],j=ke[1],ae=Ee.useRef(!1),ue=Ee.useRef(!1),ve=Ee.useRef(!1),ht=Ee.useState(function(){return K(Xe!=null?Xe:at)}),_t=(0,pe.Z)(ht,2),lt=_t[0],Vt=_t[1];function ni(st){Xe===void 0&&Vt(st)}var gi=Ee.useCallback(function(st,ft){if(!ft)return Me>=0?Me:Math.max(k(st),k(Ye))},[Me,Ye]),ri=Ee.useCallback(function(st){var ft=String(st);if(Gt)return Gt(ft);var Pt=ft;return rt&&(Pt=Pt.replace(rt,".")),Pt.replace(/[^\w.-]+/g,"")},[Gt,rt]),Dt=Ee.useRef(""),oi=Ee.useCallback(function(st,ft){if(Le)return Le(st,{userTyping:ft,input:String(Dt.current)});var Pt=typeof st=="number"?T(st):st;if(!ft){var Jt=gi(Pt,ft);if(C(Pt)&&(rt||Jt>=0)){var pi=rt||".";Pt=q(Pt,pi,Jt)}}return Pt},[Le,gi,rt]),Mi=Ee.useState(function(){var st=at!=null?at:Xe;return lt.isInvalidate()&&["string","number"].includes((0,Ze.Z)(st))?Number.isNaN(st)?"":st:oi(lt.toString(),!1)}),Ei=(0,pe.Z)(Mi,2),Oi=Ei[0],vi=Ei[1];Dt.current=Oi;function di(st,ft){vi(oi(st.isInvalidate()?st.toString(!1):st.toString(!ft),ft))}var zi=Ee.useMemo(function(){return Ut(Fe)},[Fe,Me]),Wi=Ee.useMemo(function(){return Ut(Ce)},[Ce,Me]),rn=Ee.useMemo(function(){return!zi||!lt||lt.isInvalidate()?!1:zi.lessEquals(lt)},[zi,lt]),Yi=Ee.useMemo(function(){return!Wi||!lt||lt.isInvalidate()?!1:lt.lessEquals(Wi)},[Wi,lt]),Qn=Ke(De.current,U),Di=(0,pe.Z)(Qn,2),Ki=Di[0],vn=Di[1],Ri=function(ft){return zi&&!ft.lessEquals(zi)?zi:Wi&&!Wi.lessEquals(ft)?Wi:null},mn=function(ft){return!Ri(ft)},sn=function(ft,Pt){var Jt=ft,pi=mn(Jt)||Jt.isEmpty();if(!Jt.isEmpty()&&!Pt&&(Jt=Ri(Jt)||Jt,pi=!0),!ye&&!Y&&pi){var Zi=Jt.toString(),_i=gi(Zi,Pt);return _i>=0&&(Jt=K(q(Zi,".",_i)),mn(Jt)||(Jt=K(q(Zi,".",_i,!0)))),Jt.equals(lt)||(ni(Jt),bt==null||bt(Jt.isEmpty()?null:pt(Wt,Jt)),Xe===void 0&&di(Jt,Pt)),Jt}return lt},rr=G(),gn=function st(ft){if(Ki(),Dt.current=ft,vi(ft),!ue.current){var Pt=ri(ft),Jt=K(Pt);Jt.isNaN()||sn(Jt,!0)}je==null||je(ft),rr(function(){var pi=ft;Gt||(pi=ft.replace(/。/g,".")),pi!==ft&&st(pi)})},cr=function(){ue.current=!0},Qi=function(){ue.current=!1,gn(De.current.value)},ki=function(ft){gn(ft.target.value)},ii=function(ft){var Pt;if(!(ft&&rn||!ft&&Yi)){ae.current=!1;var Jt=K(ve.current?A(Ye):Ye);ft||(Jt=Jt.negate());var pi=(lt||K(0)).add(Jt.toString()),Zi=sn(pi,!1);Ct==null||Ct(pt(Wt,Zi),{offset:ve.current?A(Ye):Ye,type:ft?"up":"down"}),(Pt=De.current)===null||Pt===void 0||Pt.focus()}},Re=function(ft){var Pt=K(ri(Oi)),Jt;Pt.isNaN()?Jt=sn(lt,ft):Jt=sn(Pt,ft),Xe!==void 0?di(lt,!1):Jt.isNaN()||di(Jt,!1)},it=function(){ae.current=!0},xt=function(ft){var Pt=ft.key,Jt=ft.shiftKey;ae.current=!0,ve.current=Jt,Pt==="Enter"&&(ue.current||(ae.current=!1),Re(!1),Mt==null||Mt(ft)),ot!==!1&&!ue.current&&["Up","ArrowUp","Down","ArrowDown"].includes(Pt)&&(ii(Pt==="Up"||Pt==="ArrowUp"),ft.preventDefault())},nt=function(){ae.current=!1,ve.current=!1};Ee.useEffect(function(){if(jt&&U){var st=function(Jt){ii(Jt.deltaY<0),Jt.preventDefault()},ft=De.current;if(ft)return ft.addEventListener("wheel",st,{passive:!1}),function(){return ft.removeEventListener("wheel",st)}}});var At=function(){Nt&&Re(!1),j(!1),ae.current=!1};return(0,be.o)(function(){lt.isInvalidate()||di(lt,!1)},[Me,Le]),(0,be.o)(function(){var st=K(Xe);Vt(st);var ft=K(ri(Oi));(!st.equals(ft)||!ae.current||Le)&&di(st,ae.current)},[Xe]),(0,be.o)(function(){Le&&vn()},[Oi]),Ee.createElement("div",{ref:Xt,className:V()(mt,ct,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(mt,"-focused"),U),"".concat(mt,"-disabled"),Y),"".concat(mt,"-readonly"),ye),"".concat(mt,"-not-a-number"),lt.isNaN()),"".concat(mt,"-out-of-range"),!lt.isInvalidate()&&!mn(lt))),style:ei,onFocus:function(){j(!0)},onBlur:At,onKeyDown:xt,onKeyUp:nt,onCompositionStart:cr,onCompositionEnd:Qi,onBeforeInput:it},Se&&Ee.createElement(ne,{prefixCls:mt,upNode:Oe,downNode:qe,upDisabled:rn,downDisabled:Yi,onStep:ii}),Ee.createElement("div",{className:"".concat(zt,"-wrap")},Ee.createElement("input",(0,le.Z)({autoComplete:"off",role:"spinbutton","aria-valuemin":Ce,"aria-valuemax":Fe,"aria-valuenow":lt.isInvalidate()?null:lt.toString(),step:Ye},Je,{ref:(0,se.sQ)(De,tt),className:zt,value:Oi,onChange:ki,disabled:Y,readOnly:ye}))))}),qt=Ee.forwardRef(function(Ne,tt){var mt=Ne.disabled,ct=Ne.style,ei=Ne.prefixCls,Ce=ei===void 0?"rc-input-number":ei,Fe=Ne.value,me=Ne.prefix,Ye=Ne.suffix,at=Ne.addonBefore,Xe=Ne.addonAfter,Y=Ne.className,ye=Ne.classNames,Oe=(0,Z.Z)(Ne,ze),qe=Ee.useRef(null),ot=Ee.useRef(null),vt=Ee.useRef(null),jt=function(Se){vt.current&&(0,D.nH)(vt.current,Se)};return Ee.useImperativeHandle(tt,function(){return Te(vt.current,{focus:jt,nativeElement:qe.current.nativeElement||ot.current})}),Ee.createElement(he.BaseInput,{className:Y,triggerFocus:jt,prefixCls:Ce,value:Fe,disabled:mt,style:ct,prefix:me,suffix:Ye,addonAfter:Xe,addonBefore:at,classNames:ye,components:{affixWrapper:"div",groupWrapper:"div",wrapper:"div",groupAddon:"div"},ref:qe},Ee.createElement(Ie,(0,le.Z)({prefixCls:Ce,disabled:mt,ref:vt,domRef:ot,className:ye==null?void 0:ye.input},Oe)))}),Ot=qt,wt=Ot},66003:function(Ci,Bt,re){"use strict";re.d(Bt,{Z:function(){return Ae}});var le=re(43079),we=re(27247),Ze=re(34666),pe=re(59301),Z=["show"];function S(P,f){if(!f.max)return!0;var ie=f.strategy(P);return ie<=f.max}function Ae(P,f){return pe.useMemo(function(){var ie={};f&&(ie.show=(0,Ze.Z)(f)==="object"&&f.formatter?f.formatter:!!f),ie=(0,we.Z)((0,we.Z)({},ie),P);var R=ie,k=R.show,T=(0,le.Z)(R,Z);return(0,we.Z)((0,we.Z)({},T),{},{show:!!k,showFormatter:typeof k=="function"?k:void 0,strategy:T.strategy||function(C){return C.length}})},[P,f])}},36901:function(Ci,Bt,re){"use strict";re.r(Bt),re.d(Bt,{BaseInput:function(){return ie},default:function(){return $}});var le=re(27247),we=re(32855),Ze=re(74430),pe=re(34666),Z=re(92310),S=re.n(Z),Ae=re(59301),P=re(30292),f=Ae.forwardRef(function(V,he){var be,Te,se,Ee=V.inputElement,We=V.children,Ke=V.prefixCls,Rt=V.prefix,te=V.suffix,z=V.addonBefore,X=V.addonAfter,ee=V.className,fe=V.style,ne=V.disabled,A=V.readOnly,D=V.focused,G=V.triggerFocus,de=V.allowClear,ze=V.value,pt=V.handleReset,Ut=V.hidden,Ie=V.classes,qt=V.classNames,Ot=V.dataAttrs,wt=V.styles,Ne=V.components,tt=V.onClear,mt=We!=null?We:Ee,ct=(Ne==null?void 0:Ne.affixWrapper)||"span",ei=(Ne==null?void 0:Ne.groupWrapper)||"span",Ce=(Ne==null?void 0:Ne.wrapper)||"span",Fe=(Ne==null?void 0:Ne.groupAddon)||"span",me=(0,Ae.useRef)(null),Ye=function(rt){var bt;(bt=me.current)!==null&&bt!==void 0&&bt.contains(rt.target)&&(G==null||G())},at=(0,P.X3)(V),Xe=(0,Ae.cloneElement)(mt,{value:ze,className:S()((be=mt.props)===null||be===void 0?void 0:be.className,!at&&(qt==null?void 0:qt.variant))||null}),Y=(0,Ae.useRef)(null);if(Ae.useImperativeHandle(he,function(){return{nativeElement:Y.current||me.current}}),at){var ye=null;if(de){var Oe=!ne&&!A&&ze,qe="".concat(Ke,"-clear-icon"),ot=(0,pe.Z)(de)==="object"&&de!==null&&de!==void 0&&de.clearIcon?de.clearIcon:"\u2716";ye=Ae.createElement("button",{type:"button",tabIndex:-1,onClick:function(rt){pt==null||pt(rt),tt==null||tt()},onMouseDown:function(rt){return rt.preventDefault()},className:S()(qe,(0,Ze.Z)((0,Ze.Z)({},"".concat(qe,"-hidden"),!Oe),"".concat(qe,"-has-suffix"),!!te))},ot)}var vt="".concat(Ke,"-affix-wrapper"),jt=S()(vt,(0,Ze.Z)((0,Ze.Z)((0,Ze.Z)((0,Ze.Z)((0,Ze.Z)({},"".concat(Ke,"-disabled"),ne),"".concat(vt,"-disabled"),ne),"".concat(vt,"-focused"),D),"".concat(vt,"-readonly"),A),"".concat(vt,"-input-with-clear-btn"),te&&de&&ze),Ie==null?void 0:Ie.affixWrapper,qt==null?void 0:qt.affixWrapper,qt==null?void 0:qt.variant),gt=(te||de)&&Ae.createElement("span",{className:S()("".concat(Ke,"-suffix"),qt==null?void 0:qt.suffix),style:wt==null?void 0:wt.suffix},ye,te);Xe=Ae.createElement(ct,(0,we.Z)({className:jt,style:wt==null?void 0:wt.affixWrapper,onClick:Ye},Ot==null?void 0:Ot.affixWrapper,{ref:me}),Rt&&Ae.createElement("span",{className:S()("".concat(Ke,"-prefix"),qt==null?void 0:qt.prefix),style:wt==null?void 0:wt.prefix},Rt),Xe,gt)}if((0,P.He)(V)){var Se="".concat(Ke,"-group"),yt="".concat(Se,"-addon"),Wt="".concat(Se,"-wrapper"),Gt=S()("".concat(Ke,"-wrapper"),Se,Ie==null?void 0:Ie.wrapper,qt==null?void 0:qt.wrapper),Le=S()(Wt,(0,Ze.Z)({},"".concat(Wt,"-disabled"),ne),Ie==null?void 0:Ie.group,qt==null?void 0:qt.groupWrapper);Xe=Ae.createElement(ei,{className:Le,ref:Y},Ae.createElement(Ce,{className:Gt},z&&Ae.createElement(Fe,{className:yt},z),Xe,X&&Ae.createElement(Fe,{className:yt},X)))}return Ae.cloneElement(Xe,{className:S()((Te=Xe.props)===null||Te===void 0?void 0:Te.className,ee)||null,style:(0,le.Z)((0,le.Z)({},(se=Xe.props)===null||se===void 0?void 0:se.style),fe),hidden:Ut})}),ie=f,R=re(3300),k=re(11913),T=re(43079),C=re(18929),O=re(2738),Q=re(66003),H=["autoComplete","onChange","onFocus","onBlur","onPressEnter","onKeyDown","onKeyUp","prefixCls","disabled","htmlSize","className","maxLength","suffix","showCount","count","type","classes","classNames","styles","onCompositionStart","onCompositionEnd"],q=(0,Ae.forwardRef)(function(V,he){var be=V.autoComplete,Te=V.onChange,se=V.onFocus,Ee=V.onBlur,We=V.onPressEnter,Ke=V.onKeyDown,Rt=V.onKeyUp,te=V.prefixCls,z=te===void 0?"rc-input":te,X=V.disabled,ee=V.htmlSize,fe=V.className,ne=V.maxLength,A=V.suffix,D=V.showCount,G=V.count,de=V.type,ze=de===void 0?"text":de,pt=V.classes,Ut=V.classNames,Ie=V.styles,qt=V.onCompositionStart,Ot=V.onCompositionEnd,wt=(0,T.Z)(V,H),Ne=(0,Ae.useState)(!1),tt=(0,k.Z)(Ne,2),mt=tt[0],ct=tt[1],ei=(0,Ae.useRef)(!1),Ce=(0,Ae.useRef)(!1),Fe=(0,Ae.useRef)(null),me=(0,Ae.useRef)(null),Ye=function(zt){Fe.current&&(0,P.nH)(Fe.current,zt)},at=(0,C.Z)(V.defaultValue,{value:V.value}),Xe=(0,k.Z)(at,2),Y=Xe[0],ye=Xe[1],Oe=Y==null?"":String(Y),qe=(0,Ae.useState)(null),ot=(0,k.Z)(qe,2),vt=ot[0],jt=ot[1],gt=(0,Q.Z)(G,D),Se=gt.max||ne,yt=gt.strategy(Oe),Wt=!!Se&&yt>Se;(0,Ae.useImperativeHandle)(he,function(){var Je;return{focus:Ye,blur:function(){var De;(De=Fe.current)===null||De===void 0||De.blur()},setSelectionRange:function(De,xe,ke){var U;(U=Fe.current)===null||U===void 0||U.setSelectionRange(De,xe,ke)},select:function(){var De;(De=Fe.current)===null||De===void 0||De.select()},input:Fe.current,nativeElement:((Je=me.current)===null||Je===void 0?void 0:Je.nativeElement)||Fe.current}}),(0,Ae.useEffect)(function(){Ce.current&&(Ce.current=!1),ct(function(Je){return Je&&X?!1:Je})},[X]);var Gt=function(zt,De,xe){var ke=De;if(!ei.current&&gt.exceedFormatter&&gt.max&&gt.strategy(De)>gt.max){if(ke=gt.exceedFormatter(De,{max:gt.max}),De!==ke){var U,j;jt([((U=Fe.current)===null||U===void 0?void 0:U.selectionStart)||0,((j=Fe.current)===null||j===void 0?void 0:j.selectionEnd)||0])}}else if(xe.source==="compositionEnd")return;ye(ke),Fe.current&&(0,P.rJ)(Fe.current,zt,Te,ke)};(0,Ae.useEffect)(function(){if(vt){var Je;(Je=Fe.current)===null||Je===void 0||Je.setSelectionRange.apply(Je,(0,R.Z)(vt))}},[vt]);var Le=function(zt){Gt(zt,zt.target.value,{source:"change"})},Me=function(zt){ei.current=!1,Gt(zt,zt.currentTarget.value,{source:"compositionEnd"}),Ot==null||Ot(zt)},rt=function(zt){We&&zt.key==="Enter"&&!Ce.current&&(Ce.current=!0,We(zt)),Ke==null||Ke(zt)},bt=function(zt){zt.key==="Enter"&&(Ce.current=!1),Rt==null||Rt(zt)},je=function(zt){ct(!0),se==null||se(zt)},Mt=function(zt){Ce.current&&(Ce.current=!1),ct(!1),Ee==null||Ee(zt)},Ct=function(zt){ye(""),Ye(),Fe.current&&(0,P.rJ)(Fe.current,zt,Te)},Et=Wt&&"".concat(z,"-out-of-range"),Nt=function(){var zt=(0,O.Z)(V,["prefixCls","onPressEnter","addonBefore","addonAfter","prefix","suffix","allowClear","defaultValue","showCount","count","classes","htmlSize","styles","classNames","onClear"]);return Ae.createElement("input",(0,we.Z)({autoComplete:be},zt,{onChange:Le,onFocus:je,onBlur:Mt,onKeyDown:rt,onKeyUp:bt,className:S()(z,(0,Ze.Z)({},"".concat(z,"-disabled"),X),Ut==null?void 0:Ut.input),style:Ie==null?void 0:Ie.input,ref:Fe,size:ee,type:ze,onCompositionStart:function(xe){ei.current=!0,qt==null||qt(xe)},onCompositionEnd:Me}))},Xt=function(){var zt=Number(Se)>0;if(A||gt.show){var De=gt.showFormatter?gt.showFormatter({value:Oe,count:yt,maxLength:Se}):"".concat(yt).concat(zt?" / ".concat(Se):"");return Ae.createElement(Ae.Fragment,null,gt.show&&Ae.createElement("span",{className:S()("".concat(z,"-show-count-suffix"),(0,Ze.Z)({},"".concat(z,"-show-count-has-suffix"),!!A),Ut==null?void 0:Ut.count),style:(0,le.Z)({},Ie==null?void 0:Ie.count)},De),A)}return null};return Ae.createElement(ie,(0,we.Z)({},wt,{prefixCls:z,className:S()(fe,Et),handleReset:Ct,value:Oe,focused:mt,triggerFocus:Ye,suffix:Xt(),disabled:X,classes:pt,classNames:Ut,styles:Ie}),Nt())}),K=q,$=K},30292:function(Ci,Bt,re){"use strict";re.d(Bt,{He:function(){return le},X3:function(){return we},nH:function(){return Z},rJ:function(){return pe}});function le(S){return!!(S.addonBefore||S.addonAfter)}function we(S){return!!(S.prefix||S.suffix||S.allowClear)}function Ze(S,Ae,P){var f=Ae.cloneNode(!0),ie=Object.create(S,{target:{value:f},currentTarget:{value:f}});return f.value=P,typeof Ae.selectionStart=="number"&&typeof Ae.selectionEnd=="number"&&(f.selectionStart=Ae.selectionStart,f.selectionEnd=Ae.selectionEnd),f.setSelectionRange=function(){Ae.setSelectionRange.apply(Ae,arguments)},ie}function pe(S,Ae,P,f){if(P){var ie=Ae;if(Ae.type==="click"){ie=Ze(Ae,S,""),P(ie);return}if(S.type!=="file"&&f!==void 0){ie=Ze(Ae,S,f),P(ie);return}P(ie)}}function Z(S,Ae){if(S){S.focus(Ae);var P=Ae||{},f=P.cursor;if(f){var ie=S.value.length;switch(f){case"start":S.setSelectionRange(0,0);break;case"end":S.setSelectionRange(ie,ie);break;default:S.setSelectionRange(0,ie)}}}}},28321:function(Ci,Bt,re){"use strict";re.d(Bt,{iz:function(){return Yi},ck:function(){return ke},BW:function(){return vn},sN:function(){return ke},Wd:function(){return Wi},ZP:function(){return ii},Xl:function(){return We}});var le=re(32855),we=re(74430),Ze=re(27247),pe=re(3300),Z=re(11913),S=re(43079),Ae=re(92310),P=re.n(Ae),f=re(11780),ie=re(18929),R=re(13697),k=re(48736),T=re(59301),C=re(4676),O=T.createContext(null);function Q(Re,it){return Re===void 0?null:"".concat(Re,"-").concat(it)}function H(Re){var it=T.useContext(O);return Q(it,Re)}var q=re(80547),K=["children","locked"],$=T.createContext(null);function V(Re,it){var xt=(0,Ze.Z)({},Re);return Object.keys(it).forEach(function(nt){var At=it[nt];At!==void 0&&(xt[nt]=At)}),xt}function he(Re){var it=Re.children,xt=Re.locked,nt=(0,S.Z)(Re,K),At=T.useContext($),st=(0,q.Z)(function(){return V(At,nt)},[At,nt],function(ft,Pt){return!xt&&(ft[0]!==Pt[0]||!(0,R.Z)(ft[1],Pt[1],!0))});return T.createElement($.Provider,{value:st},it)}var be=[],Te=T.createContext(null);function se(){return T.useContext(Te)}var Ee=T.createContext(be);function We(Re){var it=T.useContext(Ee);return T.useMemo(function(){return Re!==void 0?[].concat((0,pe.Z)(it),[Re]):it},[it,Re])}var Ke=T.createContext(null),Rt=T.createContext({}),te=Rt,z=re(29194);function X(Re){var it=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if((0,z.Z)(Re)){var xt=Re.nodeName.toLowerCase(),nt=["input","select","textarea","button"].includes(xt)||Re.isContentEditable||xt==="a"&&!!Re.getAttribute("href"),At=Re.getAttribute("tabindex"),st=Number(At),ft=null;return At&&!Number.isNaN(st)?ft=st:nt&&ft===null&&(ft=0),nt&&Re.disabled&&(ft=null),ft!==null&&(ft>=0||it&&ft<0)}return!1}function ee(Re){var it=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,xt=(0,pe.Z)(Re.querySelectorAll("*")).filter(function(nt){return X(nt,it)});return X(Re,it)&&xt.unshift(Re),xt}var fe=null;function ne(){fe=document.activeElement}function A(){fe=null}function D(){if(fe)try{fe.focus()}catch(Re){}}function G(Re,it){if(it.keyCode===9){var xt=ee(Re),nt=xt[it.shiftKey?0:xt.length-1],At=nt===document.activeElement||Re===document.activeElement;if(At){var st=xt[it.shiftKey?xt.length-1:0];st.focus(),it.preventDefault()}}}var de=re(10228),ze=re(16089),pt=de.Z.LEFT,Ut=de.Z.RIGHT,Ie=de.Z.UP,qt=de.Z.DOWN,Ot=de.Z.ENTER,wt=de.Z.ESC,Ne=de.Z.HOME,tt=de.Z.END,mt=[Ie,qt,pt,Ut];function ct(Re,it,xt,nt){var At,st="prev",ft="next",Pt="children",Jt="parent";if(Re==="inline"&&nt===Ot)return{inlineTrigger:!0};var pi=(0,we.Z)((0,we.Z)({},Ie,st),qt,ft),Zi=(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},pt,xt?ft:st),Ut,xt?st:ft),qt,Pt),Ot,Pt),_i=(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},Ie,st),qt,ft),Ot,Pt),wt,Jt),pt,xt?Pt:Jt),Ut,xt?Jt:Pt),Fi={inline:pi,horizontal:Zi,vertical:_i,inlineSub:pi,horizontalSub:_i,verticalSub:_i},Pi=(At=Fi["".concat(Re).concat(it?"":"Sub")])===null||At===void 0?void 0:At[nt];switch(Pi){case st:return{offset:-1,sibling:!0};case ft:return{offset:1,sibling:!0};case Jt:return{offset:-1,sibling:!1};case Pt:return{offset:1,sibling:!1};default:return null}}function ei(Re){for(var it=Re;it;){if(it.getAttribute("data-menu-list"))return it;it=it.parentElement}return null}function Ce(Re,it){for(var xt=Re||document.activeElement;xt;){if(it.has(xt))return xt;xt=xt.parentElement}return null}function Fe(Re,it){var xt=ee(Re,!0);return xt.filter(function(nt){return it.has(nt)})}function me(Re,it,xt){var nt=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1;if(!Re)return null;var At=Fe(Re,it),st=At.length,ft=At.findIndex(function(Pt){return xt===Pt});return nt<0?ft===-1?ft=st-1:ft-=1:nt>0&&(ft+=1),ft=(ft+st)%st,At[ft]}var Ye=function(it,xt){var nt=new Set,At=new Map,st=new Map;return it.forEach(function(ft){var Pt=document.querySelector("[data-menu-id='".concat(Q(xt,ft),"']"));Pt&&(nt.add(Pt),st.set(Pt,ft),At.set(ft,Pt))}),{elements:nt,key2element:At,element2key:st}};function at(Re,it,xt,nt,At,st,ft,Pt,Jt,pi){var Zi=T.useRef(),_i=T.useRef();_i.current=it;var Fi=function(){ze.Z.cancel(Zi.current)};return T.useEffect(function(){return function(){Fi()}},[]),function(Pi){var Ni=Pi.which;if([].concat(mt,[Ot,wt,Ne,tt]).includes(Ni)){var Gi=st(),wi=Ye(Gi,nt),Bi=wi,un=Bi.elements,$i=Bi.key2element,Ai=Bi.element2key,Xi=$i.get(it),Hi=Ce(Xi,un),en=Ai.get(Hi),Nn=ct(Re,ft(en,!0).length===1,xt,Ni);if(!Nn&&Ni!==Ne&&Ni!==tt)return;(mt.includes(Ni)||[Ne,tt].includes(Ni))&&Pi.preventDefault();var cn=function(wn){if(wn){var gr=wn,an=wn.querySelector("a");an!=null&&an.getAttribute("href")&&(gr=an);var Ln=Ai.get(wn);Pt(Ln),Fi(),Zi.current=(0,ze.Z)(function(){_i.current===Ln&&gr.focus()})}};if([Ne,tt].includes(Ni)||Nn.sibling||!Hi){var tn;!Hi||Re==="inline"?tn=At.current:tn=ei(Hi);var ji,In=Fe(tn,un);Ni===Ne?ji=In[0]:Ni===tt?ji=In[In.length-1]:ji=me(tn,un,Hi,Nn.offset),cn(ji)}else if(Nn.inlineTrigger)Jt(en);else if(Nn.offset>0)Jt(en,!0),Fi(),Zi.current=(0,ze.Z)(function(){wi=Ye(Gi,nt);var xn=Hi.getAttribute("aria-controls"),wn=document.getElementById(xn),gr=me(wn,wi.elements);cn(gr)},5);else if(Nn.offset<0){var $n=ft(en,!0),Vi=$n[$n.length-2],bn=$i.get(Vi);Jt(Vi,!1),cn(bn)}}pi==null||pi(Pi)}}function Xe(Re){Promise.resolve().then(Re)}var Y="__RC_UTIL_PATH_SPLIT__",ye=function(it){return it.join(Y)},Oe=function(it){return it.split(Y)},qe="rc-menu-more";function ot(){var Re=T.useState({}),it=(0,Z.Z)(Re,2),xt=it[1],nt=(0,T.useRef)(new Map),At=(0,T.useRef)(new Map),st=T.useState([]),ft=(0,Z.Z)(st,2),Pt=ft[0],Jt=ft[1],pi=(0,T.useRef)(0),Zi=(0,T.useRef)(!1),_i=function(){Zi.current||xt({})},Fi=(0,T.useCallback)(function($i,Ai){var Xi=ye(Ai);At.current.set(Xi,$i),nt.current.set($i,Xi),pi.current+=1;var Hi=pi.current;Xe(function(){Hi===pi.current&&_i()})},[]),Pi=(0,T.useCallback)(function($i,Ai){var Xi=ye(Ai);At.current.delete(Xi),nt.current.delete($i)},[]),Ni=(0,T.useCallback)(function($i){Jt($i)},[]),Gi=(0,T.useCallback)(function($i,Ai){var Xi=nt.current.get($i)||"",Hi=Oe(Xi);return Ai&&Pt.includes(Hi[0])&&Hi.unshift(qe),Hi},[Pt]),wi=(0,T.useCallback)(function($i,Ai){return $i.filter(function(Xi){return Xi!==void 0}).some(function(Xi){var Hi=Gi(Xi,!0);return Hi.includes(Ai)})},[Gi]),Bi=function(){var Ai=(0,pe.Z)(nt.current.keys());return Pt.length&&Ai.push(qe),Ai},un=(0,T.useCallback)(function($i){var Ai="".concat(nt.current.get($i)).concat(Y),Xi=new Set;return(0,pe.Z)(At.current.keys()).forEach(function(Hi){Hi.startsWith(Ai)&&Xi.add(At.current.get(Hi))}),Xi},[]);return T.useEffect(function(){return function(){Zi.current=!0}},[]),{registerPath:Fi,unregisterPath:Pi,refreshOverflowKeys:Ni,isSubPathKey:wi,getKeyPath:Gi,getKeys:Bi,getSubPathKeys:un}}function vt(Re){var it=T.useRef(Re);it.current=Re;var xt=T.useCallback(function(){for(var nt,At=arguments.length,st=new Array(At),ft=0;ft<At;ft++)st[ft]=arguments[ft];return(nt=it.current)===null||nt===void 0?void 0:nt.call.apply(nt,[it].concat(st))},[]);return Re?xt:void 0}var jt=Math.random().toFixed(5).toString().slice(2),gt=0;function Se(Re){var it=(0,ie.Z)(Re,{value:Re}),xt=(0,Z.Z)(it,2),nt=xt[0],At=xt[1];return T.useEffect(function(){gt+=1;var st="".concat(jt,"-").concat(gt);At("rc-menu-uuid-".concat(st))},[]),nt}var yt=re(33377),Wt=re(93912),Gt=re(18881),Le=re(85461),Me=re(2738),rt=re(8654);function bt(Re,it,xt,nt){var At=T.useContext($),st=At.activeKey,ft=At.onActive,Pt=At.onInactive,Jt={active:st===Re};return it||(Jt.onMouseEnter=function(pi){xt==null||xt({key:Re,domEvent:pi}),ft(Re)},Jt.onMouseLeave=function(pi){nt==null||nt({key:Re,domEvent:pi}),Pt(Re)}),Jt}function je(Re){var it=T.useContext($),xt=it.mode,nt=it.rtl,At=it.inlineIndent;if(xt!=="inline")return null;var st=Re;return nt?{paddingRight:st*At}:{paddingLeft:st*At}}function Mt(Re){var it=Re.icon,xt=Re.props,nt=Re.children,At;return it===null||it===!1?null:(typeof it=="function"?At=T.createElement(it,(0,Ze.Z)({},xt)):typeof it!="boolean"&&(At=it),At||nt||null)}var Ct=["item"];function Et(Re){var it=Re.item,xt=(0,S.Z)(Re,Ct);return Object.defineProperty(xt,"item",{get:function(){return(0,k.ZP)(!1,"`info.item` is deprecated since we will move to function component that not provides React Node instance in future."),it}}),xt}var Nt=["title","attribute","elementRef"],Xt=["style","className","eventKey","warnKey","disabled","itemIcon","children","role","onMouseEnter","onMouseLeave","onClick","onKeyDown","onFocus"],Je=["active"],zt=function(Re){(0,Gt.Z)(xt,Re);var it=(0,Le.Z)(xt);function xt(){return(0,yt.Z)(this,xt),it.apply(this,arguments)}return(0,Wt.Z)(xt,[{key:"render",value:function(){var At=this.props,st=At.title,ft=At.attribute,Pt=At.elementRef,Jt=(0,S.Z)(At,Nt),pi=(0,Me.Z)(Jt,["eventKey","popupClassName","popupOffset","onTitleClick"]);return(0,k.ZP)(!ft,"`attribute` of Menu.Item is deprecated. Please pass attribute directly."),T.createElement(f.Z.Item,(0,le.Z)({},ft,{title:typeof st=="string"?st:void 0},pi,{ref:Pt}))}}]),xt}(T.Component),De=T.forwardRef(function(Re,it){var xt=Re.style,nt=Re.className,At=Re.eventKey,st=Re.warnKey,ft=Re.disabled,Pt=Re.itemIcon,Jt=Re.children,pi=Re.role,Zi=Re.onMouseEnter,_i=Re.onMouseLeave,Fi=Re.onClick,Pi=Re.onKeyDown,Ni=Re.onFocus,Gi=(0,S.Z)(Re,Xt),wi=H(At),Bi=T.useContext($),un=Bi.prefixCls,$i=Bi.onItemClick,Ai=Bi.disabled,Xi=Bi.overflowDisabled,Hi=Bi.itemIcon,en=Bi.selectedKeys,Nn=Bi.onActive,cn=T.useContext(te),tn=cn._internalRenderMenuItem,ji="".concat(un,"-item"),In=T.useRef(),$n=T.useRef(),Vi=Ai||ft,bn=(0,rt.x1)(it,$n),xn=We(At),wn=function(Pn){return{key:At,keyPath:(0,pe.Z)(xn).reverse(),item:In.current,domEvent:Pn}},gr=Pt||Hi,an=bt(At,Vi,Zi,_i),Ln=an.active,fr=(0,S.Z)(an,Je),Or=en.includes(At),dr=je(xn.length),Fr=function(Pn){if(!Vi){var pr=wn(Pn);Fi==null||Fi(Et(pr)),$i(pr)}},Dn=function(Pn){if(Pi==null||Pi(Pn),Pn.which===de.Z.ENTER){var pr=wn(Pn);Fi==null||Fi(Et(pr)),$i(pr)}},qn=function(Pn){Nn(At),Ni==null||Ni(Pn)},Ar={};Re.role==="option"&&(Ar["aria-selected"]=Or);var Lr=T.createElement(zt,(0,le.Z)({ref:In,elementRef:bn,role:pi===null?"none":pi||"menuitem",tabIndex:ft?null:-1,"data-menu-id":Xi&&wi?null:wi},(0,Me.Z)(Gi,["extra"]),fr,Ar,{component:"li","aria-disabled":ft,style:(0,Ze.Z)((0,Ze.Z)({},dr),xt),className:P()(ji,(0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(ji,"-active"),Ln),"".concat(ji,"-selected"),Or),"".concat(ji,"-disabled"),Vi),nt),onClick:Fr,onKeyDown:Dn,onFocus:qn}),Jt,T.createElement(Mt,{props:(0,Ze.Z)((0,Ze.Z)({},Re),{},{isSelected:Or}),icon:gr}));return tn&&(Lr=tn(Lr,Re,{selected:Or})),Lr});function xe(Re,it){var xt=Re.eventKey,nt=se(),At=We(xt);return T.useEffect(function(){if(nt)return nt.registerPath(xt,At),function(){nt.unregisterPath(xt,At)}},[At]),nt?null:T.createElement(De,(0,le.Z)({},Re,{ref:it}))}var ke=T.forwardRef(xe),U=["className","children"],j=function(it,xt){var nt=it.className,At=it.children,st=(0,S.Z)(it,U),ft=T.useContext($),Pt=ft.prefixCls,Jt=ft.mode,pi=ft.rtl;return T.createElement("ul",(0,le.Z)({className:P()(Pt,pi&&"".concat(Pt,"-rtl"),"".concat(Pt,"-sub"),"".concat(Pt,"-").concat(Jt==="inline"?"inline":"vertical"),nt),role:"menu"},st,{"data-menu-list":!0,ref:xt}),At)},ae=T.forwardRef(j);ae.displayName="SubMenuList";var ue=ae,ve=re(11592);function ht(Re,it){return(0,ve.Z)(Re).map(function(xt,nt){if(T.isValidElement(xt)){var At,st,ft=xt.key,Pt=(At=(st=xt.props)===null||st===void 0?void 0:st.eventKey)!==null&&At!==void 0?At:ft,Jt=Pt==null;Jt&&(Pt="tmp_key-".concat([].concat((0,pe.Z)(it),[nt]).join("-")));var pi={key:Pt,eventKey:Pt};return T.cloneElement(xt,pi)}return xt})}var _t=re(65030),lt={adjustX:1,adjustY:1},Vt={topLeft:{points:["bl","tl"],overflow:lt},topRight:{points:["br","tr"],overflow:lt},bottomLeft:{points:["tl","bl"],overflow:lt},bottomRight:{points:["tr","br"],overflow:lt},leftTop:{points:["tr","tl"],overflow:lt},leftBottom:{points:["br","bl"],overflow:lt},rightTop:{points:["tl","tr"],overflow:lt},rightBottom:{points:["bl","br"],overflow:lt}},ni={topLeft:{points:["bl","tl"],overflow:lt},topRight:{points:["br","tr"],overflow:lt},bottomLeft:{points:["tl","bl"],overflow:lt},bottomRight:{points:["tr","br"],overflow:lt},rightTop:{points:["tr","tl"],overflow:lt},rightBottom:{points:["br","bl"],overflow:lt},leftTop:{points:["tl","tr"],overflow:lt},leftBottom:{points:["bl","br"],overflow:lt}},gi=null;function ri(Re,it,xt){if(it)return it;if(xt)return xt[Re]||xt.other}var Dt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"};function oi(Re){var it=Re.prefixCls,xt=Re.visible,nt=Re.children,At=Re.popup,st=Re.popupStyle,ft=Re.popupClassName,Pt=Re.popupOffset,Jt=Re.disabled,pi=Re.mode,Zi=Re.onVisibleChange,_i=T.useContext($),Fi=_i.getPopupContainer,Pi=_i.rtl,Ni=_i.subMenuOpenDelay,Gi=_i.subMenuCloseDelay,wi=_i.builtinPlacements,Bi=_i.triggerSubMenuAction,un=_i.forceSubMenuRender,$i=_i.rootClassName,Ai=_i.motion,Xi=_i.defaultMotions,Hi=T.useState(!1),en=(0,Z.Z)(Hi,2),Nn=en[0],cn=en[1],tn=Pi?(0,Ze.Z)((0,Ze.Z)({},ni),wi):(0,Ze.Z)((0,Ze.Z)({},Vt),wi),ji=Dt[pi],In=ri(pi,Ai,Xi),$n=T.useRef(In);pi!=="inline"&&($n.current=In);var Vi=(0,Ze.Z)((0,Ze.Z)({},$n.current),{},{leavedClassName:"".concat(it,"-hidden"),removeOnLeave:!1,motionAppear:!0}),bn=T.useRef();return T.useEffect(function(){return bn.current=(0,ze.Z)(function(){cn(xt)}),function(){ze.Z.cancel(bn.current)}},[xt]),T.createElement(_t.Z,{prefixCls:it,popupClassName:P()("".concat(it,"-popup"),(0,we.Z)({},"".concat(it,"-rtl"),Pi),ft,$i),stretch:pi==="horizontal"?"minWidth":null,getPopupContainer:Fi,builtinPlacements:tn,popupPlacement:ji,popupVisible:Nn,popup:At,popupStyle:st,popupAlign:Pt&&{offset:Pt},action:Jt?[]:[Bi],mouseEnterDelay:Ni,mouseLeaveDelay:Gi,onPopupVisibleChange:Zi,forceRender:un,popupMotion:Vi,fresh:!0},nt)}var Mi=re(77900);function Ei(Re){var it=Re.id,xt=Re.open,nt=Re.keyPath,At=Re.children,st="inline",ft=T.useContext($),Pt=ft.prefixCls,Jt=ft.forceSubMenuRender,pi=ft.motion,Zi=ft.defaultMotions,_i=ft.mode,Fi=T.useRef(!1);Fi.current=_i===st;var Pi=T.useState(!Fi.current),Ni=(0,Z.Z)(Pi,2),Gi=Ni[0],wi=Ni[1],Bi=Fi.current?xt:!1;T.useEffect(function(){Fi.current&&wi(!1)},[_i]);var un=(0,Ze.Z)({},ri(st,pi,Zi));nt.length>1&&(un.motionAppear=!1);var $i=un.onVisibleChanged;return un.onVisibleChanged=function(Ai){return!Fi.current&&!Ai&&wi(!0),$i==null?void 0:$i(Ai)},Gi?null:T.createElement(he,{mode:st,locked:!Fi.current},T.createElement(Mi.default,(0,le.Z)({visible:Bi},un,{forceRender:Jt,removeOnLeave:!1,leavedClassName:"".concat(Pt,"-hidden")}),function(Ai){var Xi=Ai.className,Hi=Ai.style;return T.createElement(ue,{id:it,className:Xi,style:Hi},At)}))}var Oi=["style","className","title","eventKey","warnKey","disabled","internalPopupClose","children","itemIcon","expandIcon","popupClassName","popupOffset","popupStyle","onClick","onMouseEnter","onMouseLeave","onTitleClick","onTitleMouseEnter","onTitleMouseLeave"],vi=["active"],di=T.forwardRef(function(Re,it){var xt=Re.style,nt=Re.className,At=Re.title,st=Re.eventKey,ft=Re.warnKey,Pt=Re.disabled,Jt=Re.internalPopupClose,pi=Re.children,Zi=Re.itemIcon,_i=Re.expandIcon,Fi=Re.popupClassName,Pi=Re.popupOffset,Ni=Re.popupStyle,Gi=Re.onClick,wi=Re.onMouseEnter,Bi=Re.onMouseLeave,un=Re.onTitleClick,$i=Re.onTitleMouseEnter,Ai=Re.onTitleMouseLeave,Xi=(0,S.Z)(Re,Oi),Hi=H(st),en=T.useContext($),Nn=en.prefixCls,cn=en.mode,tn=en.openKeys,ji=en.disabled,In=en.overflowDisabled,$n=en.activeKey,Vi=en.selectedKeys,bn=en.itemIcon,xn=en.expandIcon,wn=en.onItemClick,gr=en.onOpenChange,an=en.onActive,Ln=T.useContext(te),fr=Ln._internalRenderSubMenuItem,Or=T.useContext(Ke),dr=Or.isSubPathKey,Fr=We(),Dn="".concat(Nn,"-submenu"),qn=ji||Pt,Ar=T.useRef(),Lr=T.useRef(),_r=Zi!=null?Zi:bn,Pn=_i!=null?_i:xn,pr=tn.includes(st),Kn=!In&&pr,Br=dr(Vi,st),Sn=bt(st,qn,$i,Ai),er=Sn.active,kr=(0,S.Z)(Sn,vi),mi=T.useState(!1),es=(0,Z.Z)(mi,2),Ji=es[0],bi=es[1],nn=function(sr){qn||bi(sr)},En=function(sr){nn(!0),wi==null||wi({key:st,domEvent:sr})},vr=function(sr){nn(!1),Bi==null||Bi({key:st,domEvent:sr})},Wn=T.useMemo(function(){return er||(cn!=="inline"?Ji||dr([$n],st):!1)},[cn,er,$n,Ji,st,dr]),qi=je(Fr.length),Un=function(sr){qn||(un==null||un({key:st,domEvent:sr}),cn==="inline"&&gr(st,!pr))},ls=vt(function(zn){Gi==null||Gi(Et(zn)),wn(zn)}),Dr=function(sr){cn!=="inline"&&gr(st,sr)},us=function(){an(st)},cs=Hi&&"".concat(Hi,"-popup"),rs=T.useMemo(function(){return T.createElement(Mt,{icon:cn!=="horizontal"?Pn:void 0,props:(0,Ze.Z)((0,Ze.Z)({},Re),{},{isOpen:Kn,isSubMenu:!0})},T.createElement("i",{className:"".concat(Dn,"-arrow")}))},[cn,Pn,Re,Kn,Dn]),tr=T.createElement("div",(0,le.Z)({role:"menuitem",style:qi,className:"".concat(Dn,"-title"),tabIndex:qn?null:-1,ref:Ar,title:typeof At=="string"?At:null,"data-menu-id":In&&Hi?null:Hi,"aria-expanded":Kn,"aria-haspopup":!0,"aria-controls":cs,"aria-disabled":qn,onClick:Un,onFocus:us},kr),At,rs),Wr=T.useRef(cn);if(cn!=="inline"&&Fr.length>1?Wr.current="vertical":Wr.current=cn,!In){var Nr=Wr.current;tr=T.createElement(oi,{mode:Nr,prefixCls:Dn,visible:!Jt&&Kn&&cn!=="inline",popupClassName:Fi,popupOffset:Pi,popupStyle:Ni,popup:T.createElement(he,{mode:Nr==="horizontal"?"vertical":Nr},T.createElement(ue,{id:cs,ref:Lr},pi)),disabled:qn,onVisibleChange:Dr},tr)}var hr=T.createElement(f.Z.Item,(0,le.Z)({ref:it,role:"none"},Xi,{component:"li",style:xt,className:P()(Dn,"".concat(Dn,"-").concat(cn),nt,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(Dn,"-open"),Kn),"".concat(Dn,"-active"),Wn),"".concat(Dn,"-selected"),Br),"".concat(Dn,"-disabled"),qn)),onMouseEnter:En,onMouseLeave:vr}),tr,!In&&T.createElement(Ei,{id:cs,open:Kn,keyPath:Fr},pi));return fr&&(hr=fr(hr,Re,{selected:Br,active:Wn,open:Kn,disabled:qn})),T.createElement(he,{onItemClick:ls,mode:cn==="horizontal"?"vertical":cn,itemIcon:_r,expandIcon:Pn},hr)}),zi=T.forwardRef(function(Re,it){var xt=Re.eventKey,nt=Re.children,At=We(xt),st=ht(nt,At),ft=se();T.useEffect(function(){if(ft)return ft.registerPath(xt,At),function(){ft.unregisterPath(xt,At)}},[At]);var Pt;return ft?Pt=st:Pt=T.createElement(di,(0,le.Z)({ref:it},Re),st),T.createElement(Ee.Provider,{value:At},Pt)}),Wi=zi,rn=re(34666);function Yi(Re){var it=Re.className,xt=Re.style,nt=T.useContext($),At=nt.prefixCls,st=se();return st?null:T.createElement("li",{role:"separator",className:P()("".concat(At,"-item-divider"),it),style:xt})}var Qn=["className","title","eventKey","children"],Di=T.forwardRef(function(Re,it){var xt=Re.className,nt=Re.title,At=Re.eventKey,st=Re.children,ft=(0,S.Z)(Re,Qn),Pt=T.useContext($),Jt=Pt.prefixCls,pi="".concat(Jt,"-item-group");return T.createElement("li",(0,le.Z)({ref:it,role:"presentation"},ft,{onClick:function(_i){return _i.stopPropagation()},className:P()(pi,xt)}),T.createElement("div",{role:"presentation",className:"".concat(pi,"-title"),title:typeof nt=="string"?nt:void 0},nt),T.createElement("ul",{role:"group",className:"".concat(pi,"-list")},st))}),Ki=T.forwardRef(function(Re,it){var xt=Re.eventKey,nt=Re.children,At=We(xt),st=ht(nt,At),ft=se();return ft?st:T.createElement(Di,(0,le.Z)({ref:it},(0,Me.Z)(Re,["warnKey"])),st)}),vn=Ki,Ri=["label","children","key","type","extra"];function mn(Re,it,xt){var nt=it.item,At=it.group,st=it.submenu,ft=it.divider;return(Re||[]).map(function(Pt,Jt){if(Pt&&(0,rn.Z)(Pt)==="object"){var pi=Pt,Zi=pi.label,_i=pi.children,Fi=pi.key,Pi=pi.type,Ni=pi.extra,Gi=(0,S.Z)(pi,Ri),wi=Fi!=null?Fi:"tmp-".concat(Jt);return _i||Pi==="group"?Pi==="group"?T.createElement(At,(0,le.Z)({key:wi},Gi,{title:Zi}),mn(_i,it,xt)):T.createElement(st,(0,le.Z)({key:wi},Gi,{title:Zi}),mn(_i,it,xt)):Pi==="divider"?T.createElement(ft,(0,le.Z)({key:wi},Gi)):T.createElement(nt,(0,le.Z)({key:wi},Gi,{extra:Ni}),Zi,(!!Ni||Ni===0)&&T.createElement("span",{className:"".concat(xt,"-item-extra")},Ni))}return null}).filter(function(Pt){return Pt})}function sn(Re,it,xt,nt,At){var st=Re,ft=(0,Ze.Z)({divider:Yi,item:ke,group:vn,submenu:Wi},nt);return it&&(st=mn(it,ft,At)),ht(st,xt)}var rr=["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"],gn=[],cr=T.forwardRef(function(Re,it){var xt,nt=Re,At=nt.prefixCls,st=At===void 0?"rc-menu":At,ft=nt.rootClassName,Pt=nt.style,Jt=nt.className,pi=nt.tabIndex,Zi=pi===void 0?0:pi,_i=nt.items,Fi=nt.children,Pi=nt.direction,Ni=nt.id,Gi=nt.mode,wi=Gi===void 0?"vertical":Gi,Bi=nt.inlineCollapsed,un=nt.disabled,$i=nt.disabledOverflow,Ai=nt.subMenuOpenDelay,Xi=Ai===void 0?.1:Ai,Hi=nt.subMenuCloseDelay,en=Hi===void 0?.1:Hi,Nn=nt.forceSubMenuRender,cn=nt.defaultOpenKeys,tn=nt.openKeys,ji=nt.activeKey,In=nt.defaultActiveFirst,$n=nt.selectable,Vi=$n===void 0?!0:$n,bn=nt.multiple,xn=bn===void 0?!1:bn,wn=nt.defaultSelectedKeys,gr=nt.selectedKeys,an=nt.onSelect,Ln=nt.onDeselect,fr=nt.inlineIndent,Or=fr===void 0?24:fr,dr=nt.motion,Fr=nt.defaultMotions,Dn=nt.triggerSubMenuAction,qn=Dn===void 0?"hover":Dn,Ar=nt.builtinPlacements,Lr=nt.itemIcon,_r=nt.expandIcon,Pn=nt.overflowedIndicator,pr=Pn===void 0?"...":Pn,Kn=nt.overflowedIndicatorPopupClassName,Br=nt.getPopupContainer,Sn=nt.onClick,er=nt.onOpenChange,kr=nt.onKeyDown,mi=nt.openAnimation,es=nt.openTransitionName,Ji=nt._internalRenderMenuItem,bi=nt._internalRenderSubMenuItem,nn=nt._internalComponents,En=(0,S.Z)(nt,rr),vr=T.useMemo(function(){return[sn(Fi,_i,gn,nn,st),sn(Fi,_i,gn,{},st)]},[Fi,_i,nn]),Wn=(0,Z.Z)(vr,2),qi=Wn[0],Un=Wn[1],ls=T.useState(!1),Dr=(0,Z.Z)(ls,2),us=Dr[0],cs=Dr[1],rs=T.useRef(),tr=Se(Ni),Wr=Pi==="rtl",Nr=(0,ie.Z)(cn,{value:tn,postState:function(Mn){return Mn||gn}}),hr=(0,Z.Z)(Nr,2),zn=hr[0],sr=hr[1],yr=function(Mn){var On=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;function ts(){sr(Mn),er==null||er(Mn)}On?(0,C.flushSync)(ts):ts()},ys=T.useState(zn),bs=(0,Z.Z)(ys,2),Ms=bs[0],Vn=bs[1],mr=T.useRef(!1),$s=T.useMemo(function(){return(wi==="inline"||wi==="vertical")&&Bi?["vertical",Bi]:[wi,!1]},[wi,Bi]),ui=(0,Z.Z)($s,2),Li=ui[0],Cn=ui[1],ar=Li==="inline",kn=T.useState(Li),hs=(0,Z.Z)(kn,2),or=hs[0],ss=hs[1],jr=T.useState(Cn),Sa=(0,Z.Z)(jr,2),hl=Sa[0],Ea=Sa[1];T.useEffect(function(){ss(Li),Ea(Cn),mr.current&&(ar?sr(Ms):yr(gn))},[Li,Cn]);var Ks=T.useState(0),la=(0,Z.Z)(Ks,2),lr=la[0],qr=la[1],ka=lr>=qi.length-1||or!=="horizontal"||$i;T.useEffect(function(){ar&&Vn(zn)},[zn]),T.useEffect(function(){return mr.current=!0,function(){mr.current=!1}},[]);var xs=ot(),Eo=xs.registerPath,ko=xs.unregisterPath,as=xs.refreshOverflowKeys,To=xs.isSubPathKey,Xl=xs.getKeyPath,qa=xs.getKeys,fl=xs.getSubPathKeys,dl=T.useMemo(function(){return{registerPath:Eo,unregisterPath:ko}},[Eo,ko]),ws=T.useMemo(function(){return{isSubPathKey:To}},[To]);T.useEffect(function(){as(ka?gn:qi.slice(lr+1).map(function(Zn){return Zn.key}))},[lr,ka]);var Ta=(0,ie.Z)(ji||In&&((xt=qi[0])===null||xt===void 0?void 0:xt.key),{value:ji}),Za=(0,Z.Z)(Ta,2),Is=Za[0],Ao=Za[1],pl=vt(function(Zn){Ao(Zn)}),ml=vt(function(){Ao(void 0)});(0,T.useImperativeHandle)(it,function(){return{list:rs.current,focus:function(Mn){var On,ts=qa(),Zr=Ye(ts,tr),Xs=Zr.elements,br=Zr.key2element,Cr=Zr.element2key,_l=Fe(rs.current,Xs),kt=Is!=null?Is:_l[0]?Cr.get(_l[0]):(On=qi.find(function(vl){return!vl.props.disabled}))===null||On===void 0?void 0:On.key,Js=br.get(kt);if(kt&&Js){var Ja;Js==null||(Ja=Js.focus)===null||Ja===void 0||Ja.call(Js,Mn)}}}});var Jl=(0,ie.Z)(wn||[],{value:gr,postState:function(Mn){return Array.isArray(Mn)?Mn:Mn==null?gn:[Mn]}}),Lo=(0,Z.Z)(Jl,2),ua=Lo[0],Do=Lo[1],Ys=function(Mn){if(Vi){var On=Mn.key,ts=ua.includes(On),Zr;xn?ts?Zr=ua.filter(function(br){return br!==On}):Zr=[].concat((0,pe.Z)(ua),[On]):Zr=[On],Do(Zr);var Xs=(0,Ze.Z)((0,Ze.Z)({},Mn),{},{selectedKeys:Zr});ts?Ln==null||Ln(Xs):an==null||an(Xs)}!xn&&zn.length&&or!=="inline"&&yr(gn)},Ya=vt(function(Zn){Sn==null||Sn(Et(Zn)),Ys(Zn)}),Co=vt(function(Zn,Mn){var On=zn.filter(function(Zr){return Zr!==Zn});if(Mn)On.push(Zn);else if(or!=="inline"){var ts=fl(Zn);On=On.filter(function(Zr){return!ts.has(Zr)})}(0,R.Z)(zn,On,!0)||yr(On,!0)}),gl=function(Mn,On){var ts=On!=null?On:!zn.includes(Mn);Co(Mn,ts)},Us=at(or,Is,Wr,tr,rs,qa,Xl,Ao,gl,kr);T.useEffect(function(){cs(!0)},[]);var Mo=T.useMemo(function(){return{_internalRenderMenuItem:Ji,_internalRenderSubMenuItem:bi}},[Ji,bi]),Xa=or!=="horizontal"||$i?qi:qi.map(function(Zn,Mn){return T.createElement(he,{key:Zn.key,overflowDisabled:Mn>lr},Zn)}),Aa=T.createElement(f.Z,(0,le.Z)({id:Ni,ref:rs,prefixCls:"".concat(st,"-overflow"),component:"ul",itemComponent:ke,className:P()(st,"".concat(st,"-root"),"".concat(st,"-").concat(or),Jt,(0,we.Z)((0,we.Z)({},"".concat(st,"-inline-collapsed"),hl),"".concat(st,"-rtl"),Wr),ft),dir:Pi,style:Pt,role:"menu",tabIndex:Zi,data:Xa,renderRawItem:function(Mn){return Mn},renderRawRest:function(Mn){var On=Mn.length,ts=On?qi.slice(-On):null;return T.createElement(Wi,{eventKey:qe,title:pr,disabled:ka,internalPopupClose:On===0,popupClassName:Kn},ts)},maxCount:or!=="horizontal"||$i?f.Z.INVALIDATE:f.Z.RESPONSIVE,ssr:"full","data-menu-list":!0,onVisibleChange:function(Mn){qr(Mn)},onKeyDown:Us},En));return T.createElement(te.Provider,{value:Mo},T.createElement(O.Provider,{value:tr},T.createElement(he,{prefixCls:st,rootClassName:ft,mode:or,openKeys:zn,rtl:Wr,disabled:un,motion:us?dr:null,defaultMotions:us?Fr:null,activeKey:Is,onActive:pl,onInactive:ml,selectedKeys:ua,inlineIndent:Or,subMenuOpenDelay:Xi,subMenuCloseDelay:en,forceSubMenuRender:Nn,builtinPlacements:Ar,triggerSubMenuAction:qn,getPopupContainer:Br,itemIcon:Lr,expandIcon:_r,onItemClick:Ya,onOpenChange:Co},T.createElement(Ke.Provider,{value:ws},Aa),T.createElement("div",{style:{display:"none"},"aria-hidden":!0},T.createElement(Te.Provider,{value:dl},Un)))))}),Qi=cr,ki=Qi;ki.Item=ke,ki.SubMenu=Wi,ki.ItemGroup=vn,ki.Divider=Yi;var ii=ki},11780:function(Ci,Bt,re){"use strict";re.d(Bt,{Z:function(){return ne}});var le=re(32855),we=re(27247),Ze=re(11913),pe=re(43079),Z=re(59301),S=re(92310),Ae=re.n(S),P=re(29301),f=re(34280),ie=["prefixCls","invalidate","item","renderItem","responsive","responsiveDisabled","registerSize","itemKey","className","style","children","display","order","component"],R=void 0;function k(A,D){var G=A.prefixCls,de=A.invalidate,ze=A.item,pt=A.renderItem,Ut=A.responsive,Ie=A.responsiveDisabled,qt=A.registerSize,Ot=A.itemKey,wt=A.className,Ne=A.style,tt=A.children,mt=A.display,ct=A.order,ei=A.component,Ce=ei===void 0?"div":ei,Fe=(0,pe.Z)(A,ie),me=Ut&&!mt;function Ye(Oe){qt(Ot,Oe)}Z.useEffect(function(){return function(){Ye(null)}},[]);var at=pt&&ze!==R?pt(ze,{index:ct}):tt,Xe;de||(Xe={opacity:me?0:1,height:me?0:R,overflowY:me?"hidden":R,order:Ut?ct:R,pointerEvents:me?"none":R,position:me?"absolute":R});var Y={};me&&(Y["aria-hidden"]=!0);var ye=Z.createElement(Ce,(0,le.Z)({className:Ae()(!de&&G,wt),style:(0,we.Z)((0,we.Z)({},Xe),Ne)},Y,Fe,{ref:D}),at);return Ut&&(ye=Z.createElement(P.Z,{onResize:function(qe){var ot=qe.offsetWidth;Ye(ot)},disabled:Ie},ye)),ye}var T=Z.forwardRef(k);T.displayName="Item";var C=T,O=re(6089),Q=re(4676),H=re(16089);function q(A){if(typeof MessageChannel=="undefined")(0,H.Z)(A);else{var D=new MessageChannel;D.port1.onmessage=function(){return A()},D.port2.postMessage(void 0)}}function K(){var A=Z.useRef(null),D=function(de){A.current||(A.current=[],q(function(){(0,Q.unstable_batchedUpdates)(function(){A.current.forEach(function(ze){ze()}),A.current=null})})),A.current.push(de)};return D}function $(A,D){var G=Z.useState(D),de=(0,Ze.Z)(G,2),ze=de[0],pt=de[1],Ut=(0,O.Z)(function(Ie){A(function(){pt(Ie)})});return[ze,Ut]}var V=Z.createContext(null),he=["component"],be=["className"],Te=["className"],se=function(D,G){var de=Z.useContext(V);if(!de){var ze=D.component,pt=ze===void 0?"div":ze,Ut=(0,pe.Z)(D,he);return Z.createElement(pt,(0,le.Z)({},Ut,{ref:G}))}var Ie=de.className,qt=(0,pe.Z)(de,be),Ot=D.className,wt=(0,pe.Z)(D,Te);return Z.createElement(V.Provider,{value:null},Z.createElement(C,(0,le.Z)({ref:G,className:Ae()(Ie,Ot)},qt,wt)))},Ee=Z.forwardRef(se);Ee.displayName="RawItem";var We=Ee,Ke=["prefixCls","data","renderItem","renderRawItem","itemKey","itemWidth","ssr","style","className","maxCount","renderRest","renderRawRest","suffix","component","itemComponent","onVisibleChange"],Rt="responsive",te="invalidate";function z(A){return"+ ".concat(A.length," ...")}function X(A,D){var G=A.prefixCls,de=G===void 0?"rc-overflow":G,ze=A.data,pt=ze===void 0?[]:ze,Ut=A.renderItem,Ie=A.renderRawItem,qt=A.itemKey,Ot=A.itemWidth,wt=Ot===void 0?10:Ot,Ne=A.ssr,tt=A.style,mt=A.className,ct=A.maxCount,ei=A.renderRest,Ce=A.renderRawRest,Fe=A.suffix,me=A.component,Ye=me===void 0?"div":me,at=A.itemComponent,Xe=A.onVisibleChange,Y=(0,pe.Z)(A,Ke),ye=Ne==="full",Oe=K(),qe=$(Oe,null),ot=(0,Ze.Z)(qe,2),vt=ot[0],jt=ot[1],gt=vt||0,Se=$(Oe,new Map),yt=(0,Ze.Z)(Se,2),Wt=yt[0],Gt=yt[1],Le=$(Oe,0),Me=(0,Ze.Z)(Le,2),rt=Me[0],bt=Me[1],je=$(Oe,0),Mt=(0,Ze.Z)(je,2),Ct=Mt[0],Et=Mt[1],Nt=$(Oe,0),Xt=(0,Ze.Z)(Nt,2),Je=Xt[0],zt=Xt[1],De=(0,Z.useState)(null),xe=(0,Ze.Z)(De,2),ke=xe[0],U=xe[1],j=(0,Z.useState)(null),ae=(0,Ze.Z)(j,2),ue=ae[0],ve=ae[1],ht=Z.useMemo(function(){return ue===null&&ye?Number.MAX_SAFE_INTEGER:ue||0},[ue,vt]),_t=(0,Z.useState)(!1),lt=(0,Ze.Z)(_t,2),Vt=lt[0],ni=lt[1],gi="".concat(de,"-item"),ri=Math.max(rt,Ct),Dt=ct===Rt,oi=pt.length&&Dt,Mi=ct===te,Ei=oi||typeof ct=="number"&&pt.length>ct,Oi=(0,Z.useMemo)(function(){var ki=pt;return oi?vt===null&&ye?ki=pt:ki=pt.slice(0,Math.min(pt.length,gt/wt)):typeof ct=="number"&&(ki=pt.slice(0,ct)),ki},[pt,wt,vt,ct,oi]),vi=(0,Z.useMemo)(function(){return oi?pt.slice(ht+1):pt.slice(Oi.length)},[pt,Oi,oi,ht]),di=(0,Z.useCallback)(function(ki,ii){var Re;return typeof qt=="function"?qt(ki):(Re=qt&&(ki==null?void 0:ki[qt]))!==null&&Re!==void 0?Re:ii},[qt]),zi=(0,Z.useCallback)(Ut||function(ki){return ki},[Ut]);function Wi(ki,ii,Re){ue===ki&&(ii===void 0||ii===ke)||(ve(ki),Re||(ni(ki<pt.length-1),Xe==null||Xe(ki)),ii!==void 0&&U(ii))}function rn(ki,ii){jt(ii.clientWidth)}function Yi(ki,ii){Gt(function(Re){var it=new Map(Re);return ii===null?it.delete(ki):it.set(ki,ii),it})}function Qn(ki,ii){Et(ii),bt(Ct)}function Di(ki,ii){zt(ii)}function Ki(ki){return Wt.get(di(Oi[ki],ki))}(0,f.Z)(function(){if(gt&&typeof ri=="number"&&Oi){var ki=Je,ii=Oi.length,Re=ii-1;if(!ii){Wi(0,null);return}for(var it=0;it<ii;it+=1){var xt=Ki(it);if(ye&&(xt=xt||0),xt===void 0){Wi(it-1,void 0,!0);break}if(ki+=xt,Re===0&&ki<=gt||it===Re-1&&ki+Ki(Re)<=gt){Wi(Re,null);break}else if(ki+ri>gt){Wi(it-1,ki-xt-Je+Ct);break}}Fe&&Ki(0)+Je>gt&&U(null)}},[gt,Wt,Ct,Je,di,Oi]);var vn=Vt&&!!vi.length,Ri={};ke!==null&&oi&&(Ri={position:"absolute",left:ke,top:0});var mn={prefixCls:gi,responsive:oi,component:at,invalidate:Mi},sn=Ie?function(ki,ii){var Re=di(ki,ii);return Z.createElement(V.Provider,{key:Re,value:(0,we.Z)((0,we.Z)({},mn),{},{order:ii,item:ki,itemKey:Re,registerSize:Yi,display:ii<=ht})},Ie(ki,ii))}:function(ki,ii){var Re=di(ki,ii);return Z.createElement(C,(0,le.Z)({},mn,{order:ii,key:Re,item:ki,renderItem:zi,itemKey:Re,registerSize:Yi,display:ii<=ht}))},rr={order:vn?ht:Number.MAX_SAFE_INTEGER,className:"".concat(gi,"-rest"),registerSize:Qn,display:vn},gn=ei||z,cr=Ce?Z.createElement(V.Provider,{value:(0,we.Z)((0,we.Z)({},mn),rr)},Ce(vi)):Z.createElement(C,(0,le.Z)({},mn,rr),typeof gn=="function"?gn(vi):gn),Qi=Z.createElement(Ye,(0,le.Z)({className:Ae()(!Mi&&de,mt),style:tt,ref:D},Y),Oi.map(sn),Ei?cr:null,Fe&&Z.createElement(C,(0,le.Z)({},mn,{responsive:Dt,responsiveDisabled:!oi,order:ht,className:"".concat(gi,"-suffix"),registerSize:Di,display:!0,style:Ri}),Fe));return Dt?Z.createElement(P.Z,{onResize:rn,disabled:!oi},Qi):Qi}var ee=Z.forwardRef(X);ee.displayName="Overflow",ee.Item=We,ee.RESPONSIVE=Rt,ee.INVALIDATE=te;var fe=ee,ne=fe},29301:function(Ci,Bt,re){"use strict";re.d(Bt,{Z:function(){return te}});var le=re(32855),we=re(59301),Ze=re(11592),pe=re(48736),Z=re(27247),S=re(34666),Ae=re(76846),P=re(8654),f=we.createContext(null);function ie(z){var X=z.children,ee=z.onBatchResize,fe=we.useRef(0),ne=we.useRef([]),A=we.useContext(f),D=we.useCallback(function(G,de,ze){fe.current+=1;var pt=fe.current;ne.current.push({size:G,element:de,data:ze}),Promise.resolve().then(function(){pt===fe.current&&(ee==null||ee(ne.current),ne.current=[])}),A==null||A(G,de,ze)},[ee,A]);return we.createElement(f.Provider,{value:D},X)}var R=re(76374),k=new Map;function T(z){z.forEach(function(X){var ee,fe=X.target;(ee=k.get(fe))===null||ee===void 0||ee.forEach(function(ne){return ne(fe)})})}var C=new R.Z(T),O=null,Q=null;function H(z,X){k.has(z)||(k.set(z,new Set),C.observe(z)),k.get(z).add(X)}function q(z,X){k.has(z)&&(k.get(z).delete(X),k.get(z).size||(C.unobserve(z),k.delete(z)))}var K=re(33377),$=re(93912),V=re(18881),he=re(85461),be=function(z){(0,V.Z)(ee,z);var X=(0,he.Z)(ee);function ee(){return(0,K.Z)(this,ee),X.apply(this,arguments)}return(0,$.Z)(ee,[{key:"render",value:function(){return this.props.children}}]),ee}(we.Component);function Te(z,X){var ee=z.children,fe=z.disabled,ne=we.useRef(null),A=we.useRef(null),D=we.useContext(f),G=typeof ee=="function",de=G?ee(ne):ee,ze=we.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),pt=!G&&we.isValidElement(de)&&(0,P.Yr)(de),Ut=pt?(0,P.C4)(de):null,Ie=(0,P.x1)(Ut,ne),qt=function(){var tt;return(0,Ae.ZP)(ne.current)||(ne.current&&(0,S.Z)(ne.current)==="object"?(0,Ae.ZP)((tt=ne.current)===null||tt===void 0?void 0:tt.nativeElement):null)||(0,Ae.ZP)(A.current)};we.useImperativeHandle(X,function(){return qt()});var Ot=we.useRef(z);Ot.current=z;var wt=we.useCallback(function(Ne){var tt=Ot.current,mt=tt.onResize,ct=tt.data,ei=Ne.getBoundingClientRect(),Ce=ei.width,Fe=ei.height,me=Ne.offsetWidth,Ye=Ne.offsetHeight,at=Math.floor(Ce),Xe=Math.floor(Fe);if(ze.current.width!==at||ze.current.height!==Xe||ze.current.offsetWidth!==me||ze.current.offsetHeight!==Ye){var Y={width:at,height:Xe,offsetWidth:me,offsetHeight:Ye};ze.current=Y;var ye=me===Math.round(Ce)?Ce:me,Oe=Ye===Math.round(Fe)?Fe:Ye,qe=(0,Z.Z)((0,Z.Z)({},Y),{},{offsetWidth:ye,offsetHeight:Oe});D==null||D(qe,Ne,ct),mt&&Promise.resolve().then(function(){mt(qe,Ne)})}},[]);return we.useEffect(function(){var Ne=qt();return Ne&&!fe&&H(Ne,wt),function(){return q(Ne,wt)}},[ne.current,fe]),we.createElement(be,{ref:A},pt?we.cloneElement(de,{ref:Ie}):de)}var se=we.forwardRef(Te),Ee=se,We="rc-observer-key";function Ke(z,X){var ee=z.children,fe=typeof ee=="function"?[ee]:(0,Ze.Z)(ee);return fe.map(function(ne,A){var D=(ne==null?void 0:ne.key)||"".concat(We,"-").concat(A);return we.createElement(Ee,(0,le.Z)({},z,{key:D,ref:A===0?X:void 0}),ne)})}var Rt=we.forwardRef(Ke);Rt.Collection=ie;var te=Rt},29443:function(Ci,Bt,re){"use strict";re.d(Bt,{Z:function(){return Gt}});var le=re(32855),we=re(74430),Ze=re(27247),pe=re(11913),Z=re(34666),S=re(43079),Ae=re(92310),P=re.n(Ae),f=re(18929),ie=re(49658),R=re(59301),k=(0,R.createContext)(null),T=re(3300),C=re(29301),O=re(6089),Q=re(8654),H=re(16089),q=function(Me){var rt=Me.activeTabOffset,bt=Me.horizontal,je=Me.rtl,Mt=Me.indicator,Ct=Mt===void 0?{}:Mt,Et=Ct.size,Nt=Ct.align,Xt=Nt===void 0?"center":Nt,Je=(0,R.useState)(),zt=(0,pe.Z)(Je,2),De=zt[0],xe=zt[1],ke=(0,R.useRef)(),U=R.useCallback(function(ae){return typeof Et=="function"?Et(ae):typeof Et=="number"?Et:ae},[Et]);function j(){H.Z.cancel(ke.current)}return(0,R.useEffect)(function(){var ae={};if(rt)if(bt){ae.width=U(rt.width);var ue=je?"right":"left";Xt==="start"&&(ae[ue]=rt[ue]),Xt==="center"&&(ae[ue]=rt[ue]+rt.width/2,ae.transform=je?"translateX(50%)":"translateX(-50%)"),Xt==="end"&&(ae[ue]=rt[ue]+rt.width,ae.transform="translateX(-100%)")}else ae.height=U(rt.height),Xt==="start"&&(ae.top=rt.top),Xt==="center"&&(ae.top=rt.top+rt.height/2,ae.transform="translateY(-50%)"),Xt==="end"&&(ae.top=rt.top+rt.height,ae.transform="translateY(-100%)");return j(),ke.current=(0,H.Z)(function(){xe(ae)}),j},[rt,bt,je,Xt,U]),{style:De}},K=q,$={width:0,height:0,left:0,top:0};function V(Le,Me,rt){return(0,R.useMemo)(function(){for(var bt,je=new Map,Mt=Me.get((bt=Le[0])===null||bt===void 0?void 0:bt.key)||$,Ct=Mt.left+Mt.width,Et=0;Et<Le.length;Et+=1){var Nt=Le[Et].key,Xt=Me.get(Nt);if(!Xt){var Je;Xt=Me.get((Je=Le[Et-1])===null||Je===void 0?void 0:Je.key)||$}var zt=je.get(Nt)||(0,Ze.Z)({},Xt);zt.right=Ct-zt.left-zt.width,je.set(Nt,zt)}return je},[Le.map(function(bt){return bt.key}).join("_"),Me,rt])}function he(Le,Me){var rt=R.useRef(Le),bt=R.useState({}),je=(0,pe.Z)(bt,2),Mt=je[1];function Ct(Et){var Nt=typeof Et=="function"?Et(rt.current):Et;Nt!==rt.current&&Me(Nt,rt.current),rt.current=Nt,Mt({})}return[rt.current,Ct]}var be=.1,Te=.01,se=20,Ee=Math.pow(.995,se);function We(Le,Me){var rt=(0,R.useState)(),bt=(0,pe.Z)(rt,2),je=bt[0],Mt=bt[1],Ct=(0,R.useState)(0),Et=(0,pe.Z)(Ct,2),Nt=Et[0],Xt=Et[1],Je=(0,R.useState)(0),zt=(0,pe.Z)(Je,2),De=zt[0],xe=zt[1],ke=(0,R.useState)(),U=(0,pe.Z)(ke,2),j=U[0],ae=U[1],ue=(0,R.useRef)();function ve(gi){var ri=gi.touches[0],Dt=ri.screenX,oi=ri.screenY;Mt({x:Dt,y:oi}),window.clearInterval(ue.current)}function ht(gi){if(je){var ri=gi.touches[0],Dt=ri.screenX,oi=ri.screenY;Mt({x:Dt,y:oi});var Mi=Dt-je.x,Ei=oi-je.y;Me(Mi,Ei);var Oi=Date.now();Xt(Oi),xe(Oi-Nt),ae({x:Mi,y:Ei})}}function _t(){if(je&&(Mt(null),ae(null),j)){var gi=j.x/De,ri=j.y/De,Dt=Math.abs(gi),oi=Math.abs(ri);if(Math.max(Dt,oi)<be)return;var Mi=gi,Ei=ri;ue.current=window.setInterval(function(){if(Math.abs(Mi)<Te&&Math.abs(Ei)<Te){window.clearInterval(ue.current);return}Mi*=Ee,Ei*=Ee,Me(Mi*se,Ei*se)},se)}}var lt=(0,R.useRef)();function Vt(gi){var ri=gi.deltaX,Dt=gi.deltaY,oi=0,Mi=Math.abs(ri),Ei=Math.abs(Dt);Mi===Ei?oi=lt.current==="x"?ri:Dt:Mi>Ei?(oi=ri,lt.current="x"):(oi=Dt,lt.current="y"),Me(-oi,-oi)&&gi.preventDefault()}var ni=(0,R.useRef)(null);ni.current={onTouchStart:ve,onTouchMove:ht,onTouchEnd:_t,onWheel:Vt},R.useEffect(function(){function gi(Mi){ni.current.onTouchStart(Mi)}function ri(Mi){ni.current.onTouchMove(Mi)}function Dt(Mi){ni.current.onTouchEnd(Mi)}function oi(Mi){ni.current.onWheel(Mi)}return document.addEventListener("touchmove",ri,{passive:!1}),document.addEventListener("touchend",Dt,{passive:!0}),Le.current.addEventListener("touchstart",gi,{passive:!0}),Le.current.addEventListener("wheel",oi,{passive:!1}),function(){document.removeEventListener("touchmove",ri),document.removeEventListener("touchend",Dt)}},[])}var Ke=re(34280);function Rt(Le){var Me=(0,R.useState)(0),rt=(0,pe.Z)(Me,2),bt=rt[0],je=rt[1],Mt=(0,R.useRef)(0),Ct=(0,R.useRef)();return Ct.current=Le,(0,Ke.o)(function(){var Et;(Et=Ct.current)===null||Et===void 0||Et.call(Ct)},[bt]),function(){Mt.current===bt&&(Mt.current+=1,je(Mt.current))}}function te(Le){var Me=(0,R.useRef)([]),rt=(0,R.useState)({}),bt=(0,pe.Z)(rt,2),je=bt[1],Mt=(0,R.useRef)(typeof Le=="function"?Le():Le),Ct=Rt(function(){var Nt=Mt.current;Me.current.forEach(function(Xt){Nt=Xt(Nt)}),Me.current=[],Mt.current=Nt,je({})});function Et(Nt){Me.current.push(Nt),Ct()}return[Mt.current,Et]}var z={width:0,height:0,left:0,top:0,right:0};function X(Le,Me,rt,bt,je,Mt,Ct){var Et=Ct.tabs,Nt=Ct.tabPosition,Xt=Ct.rtl,Je,zt,De;return["top","bottom"].includes(Nt)?(Je="width",zt=Xt?"right":"left",De=Math.abs(rt)):(Je="height",zt="top",De=-rt),(0,R.useMemo)(function(){if(!Et.length)return[0,0];for(var xe=Et.length,ke=xe,U=0;U<xe;U+=1){var j=Le.get(Et[U].key)||z;if(Math.floor(j[zt]+j[Je])>Math.floor(De+Me)){ke=U-1;break}}for(var ae=0,ue=xe-1;ue>=0;ue-=1){var ve=Le.get(Et[ue].key)||z;if(ve[zt]<De){ae=ue+1;break}}return ae>=ke?[0,0]:[ae,ke]},[Le,Me,bt,je,Mt,De,Nt,Et.map(function(xe){return xe.key}).join("_"),Xt])}function ee(Le){var Me;return Le instanceof Map?(Me={},Le.forEach(function(rt,bt){Me[bt]=rt})):Me=Le,JSON.stringify(Me)}var fe="TABS_DQ";function ne(Le){return String(Le).replace(/"/g,fe)}function A(Le,Me,rt,bt){return!(!rt||bt||Le===!1||Le===void 0&&(Me===!1||Me===null))}var D=R.forwardRef(function(Le,Me){var rt=Le.prefixCls,bt=Le.editable,je=Le.locale,Mt=Le.style;return!bt||bt.showAdd===!1?null:R.createElement("button",{ref:Me,type:"button",className:"".concat(rt,"-nav-add"),style:Mt,"aria-label":(je==null?void 0:je.addAriaLabel)||"Add tab",onClick:function(Et){bt.onEdit("add",{event:Et})}},bt.addIcon||"+")}),G=D,de=R.forwardRef(function(Le,Me){var rt=Le.position,bt=Le.prefixCls,je=Le.extra;if(!je)return null;var Mt,Ct={};return(0,Z.Z)(je)==="object"&&!R.isValidElement(je)?Ct=je:Ct.right=je,rt==="right"&&(Mt=Ct.right),rt==="left"&&(Mt=Ct.left),Mt?R.createElement("div",{className:"".concat(bt,"-extra-content"),ref:Me},Mt):null}),ze=de,pt=re(96478),Ut=re(28321),Ie=re(10228),qt=R.forwardRef(function(Le,Me){var rt=Le.prefixCls,bt=Le.id,je=Le.tabs,Mt=Le.locale,Ct=Le.mobile,Et=Le.more,Nt=Et===void 0?{}:Et,Xt=Le.style,Je=Le.className,zt=Le.editable,De=Le.tabBarGutter,xe=Le.rtl,ke=Le.removeAriaLabel,U=Le.onTabClick,j=Le.getPopupContainer,ae=Le.popupClassName,ue=(0,R.useState)(!1),ve=(0,pe.Z)(ue,2),ht=ve[0],_t=ve[1],lt=(0,R.useState)(null),Vt=(0,pe.Z)(lt,2),ni=Vt[0],gi=Vt[1],ri=Nt.icon,Dt=ri===void 0?"More":ri,oi="".concat(bt,"-more-popup"),Mi="".concat(rt,"-dropdown"),Ei=ni!==null?"".concat(oi,"-").concat(ni):null,Oi=Mt==null?void 0:Mt.dropdownAriaLabel;function vi(Di,Ki){Di.preventDefault(),Di.stopPropagation(),zt.onEdit("remove",{key:Ki,event:Di})}var di=R.createElement(Ut.ZP,{onClick:function(Ki){var vn=Ki.key,Ri=Ki.domEvent;U(vn,Ri),_t(!1)},prefixCls:"".concat(Mi,"-menu"),id:oi,tabIndex:-1,role:"listbox","aria-activedescendant":Ei,selectedKeys:[ni],"aria-label":Oi!==void 0?Oi:"expanded dropdown"},je.map(function(Di){var Ki=Di.closable,vn=Di.disabled,Ri=Di.closeIcon,mn=Di.key,sn=Di.label,rr=A(Ki,Ri,zt,vn);return R.createElement(Ut.sN,{key:mn,id:"".concat(oi,"-").concat(mn),role:"option","aria-controls":bt&&"".concat(bt,"-panel-").concat(mn),disabled:vn},R.createElement("span",null,sn),rr&&R.createElement("button",{type:"button","aria-label":ke||"remove",tabIndex:0,className:"".concat(Mi,"-menu-item-remove"),onClick:function(cr){cr.stopPropagation(),vi(cr,mn)}},Ri||zt.removeIcon||"\xD7"))}));function zi(Di){for(var Ki=je.filter(function(rr){return!rr.disabled}),vn=Ki.findIndex(function(rr){return rr.key===ni})||0,Ri=Ki.length,mn=0;mn<Ri;mn+=1){vn=(vn+Di+Ri)%Ri;var sn=Ki[vn];if(!sn.disabled){gi(sn.key);return}}}function Wi(Di){var Ki=Di.which;if(!ht){[Ie.Z.DOWN,Ie.Z.SPACE,Ie.Z.ENTER].includes(Ki)&&(_t(!0),Di.preventDefault());return}switch(Ki){case Ie.Z.UP:zi(-1),Di.preventDefault();break;case Ie.Z.DOWN:zi(1),Di.preventDefault();break;case Ie.Z.ESC:_t(!1);break;case Ie.Z.SPACE:case Ie.Z.ENTER:ni!==null&&U(ni,Di);break}}(0,R.useEffect)(function(){var Di=document.getElementById(Ei);Di&&Di.scrollIntoView&&Di.scrollIntoView(!1)},[ni]),(0,R.useEffect)(function(){ht||gi(null)},[ht]);var rn=(0,we.Z)({},xe?"marginRight":"marginLeft",De);je.length||(rn.visibility="hidden",rn.order=1);var Yi=P()((0,we.Z)({},"".concat(Mi,"-rtl"),xe)),Qn=Ct?null:R.createElement(pt.Z,(0,le.Z)({prefixCls:Mi,overlay:di,visible:je.length?ht:!1,onVisibleChange:_t,overlayClassName:P()(Yi,ae),mouseEnterDelay:.1,mouseLeaveDelay:.1,getPopupContainer:j},Nt),R.createElement("button",{type:"button",className:"".concat(rt,"-nav-more"),style:rn,"aria-haspopup":"listbox","aria-controls":oi,id:"".concat(bt,"-more"),"aria-expanded":ht,onKeyDown:Wi},Dt));return R.createElement("div",{className:P()("".concat(rt,"-nav-operations"),Je),style:Xt,ref:Me},Qn,R.createElement(G,{prefixCls:rt,locale:Mt,editable:zt}))}),Ot=R.memo(qt,function(Le,Me){return Me.tabMoving}),wt=function(Me){var rt=Me.prefixCls,bt=Me.id,je=Me.active,Mt=Me.focus,Ct=Me.tab,Et=Ct.key,Nt=Ct.label,Xt=Ct.disabled,Je=Ct.closeIcon,zt=Ct.icon,De=Me.closable,xe=Me.renderWrapper,ke=Me.removeAriaLabel,U=Me.editable,j=Me.onClick,ae=Me.onFocus,ue=Me.onBlur,ve=Me.onKeyDown,ht=Me.onMouseDown,_t=Me.onMouseUp,lt=Me.style,Vt=Me.tabCount,ni=Me.currentPosition,gi="".concat(rt,"-tab"),ri=A(De,Je,U,Xt);function Dt(vi){Xt||j(vi)}function oi(vi){vi.preventDefault(),vi.stopPropagation(),U.onEdit("remove",{key:Et,event:vi})}var Mi=R.useMemo(function(){return zt&&typeof Nt=="string"?R.createElement("span",null,Nt):Nt},[Nt,zt]),Ei=R.useRef(null);R.useEffect(function(){Mt&&Ei.current&&Ei.current.focus()},[Mt]);var Oi=R.createElement("div",{key:Et,"data-node-key":ne(Et),className:P()(gi,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(gi,"-with-remove"),ri),"".concat(gi,"-active"),je),"".concat(gi,"-disabled"),Xt),"".concat(gi,"-focus"),Mt)),style:lt,onClick:Dt},R.createElement("div",{ref:Ei,role:"tab","aria-selected":je,id:bt&&"".concat(bt,"-tab-").concat(Et),className:"".concat(gi,"-btn"),"aria-controls":bt&&"".concat(bt,"-panel-").concat(Et),"aria-disabled":Xt,tabIndex:Xt?null:je?0:-1,onClick:function(di){di.stopPropagation(),Dt(di)},onKeyDown:ve,onMouseDown:ht,onMouseUp:_t,onFocus:ae,onBlur:ue},Mt&&R.createElement("div",{"aria-live":"polite",style:{width:0,height:0,position:"absolute",overflow:"hidden",opacity:0}},"Tab ".concat(ni," of ").concat(Vt)),zt&&R.createElement("span",{className:"".concat(gi,"-icon")},zt),Nt&&Mi),ri&&R.createElement("button",{type:"button",role:"tab","aria-label":ke||"remove",tabIndex:je?0:-1,className:"".concat(gi,"-remove"),onClick:function(di){di.stopPropagation(),oi(di)}},Je||U.removeIcon||"\xD7"));return xe?xe(Oi):Oi},Ne=wt,tt=function(Me,rt){var bt=Me.offsetWidth,je=Me.offsetHeight,Mt=Me.offsetTop,Ct=Me.offsetLeft,Et=Me.getBoundingClientRect(),Nt=Et.width,Xt=Et.height,Je=Et.left,zt=Et.top;return Math.abs(Nt-bt)<1?[Nt,Xt,Je-rt.left,zt-rt.top]:[bt,je,Ct,Mt]},mt=function(Me){var rt=Me.current||{},bt=rt.offsetWidth,je=bt===void 0?0:bt,Mt=rt.offsetHeight,Ct=Mt===void 0?0:Mt;if(Me.current){var Et=Me.current.getBoundingClientRect(),Nt=Et.width,Xt=Et.height;if(Math.abs(Nt-je)<1)return[Nt,Xt]}return[je,Ct]},ct=function(Me,rt){return Me[rt?0:1]},ei=R.forwardRef(function(Le,Me){var rt=Le.className,bt=Le.style,je=Le.id,Mt=Le.animated,Ct=Le.activeKey,Et=Le.rtl,Nt=Le.extra,Xt=Le.editable,Je=Le.locale,zt=Le.tabPosition,De=Le.tabBarGutter,xe=Le.children,ke=Le.onTabClick,U=Le.onTabScroll,j=Le.indicator,ae=R.useContext(k),ue=ae.prefixCls,ve=ae.tabs,ht=(0,R.useRef)(null),_t=(0,R.useRef)(null),lt=(0,R.useRef)(null),Vt=(0,R.useRef)(null),ni=(0,R.useRef)(null),gi=(0,R.useRef)(null),ri=(0,R.useRef)(null),Dt=zt==="top"||zt==="bottom",oi=he(0,function(Ji,bi){Dt&&U&&U({direction:Ji>bi?"left":"right"})}),Mi=(0,pe.Z)(oi,2),Ei=Mi[0],Oi=Mi[1],vi=he(0,function(Ji,bi){!Dt&&U&&U({direction:Ji>bi?"top":"bottom"})}),di=(0,pe.Z)(vi,2),zi=di[0],Wi=di[1],rn=(0,R.useState)([0,0]),Yi=(0,pe.Z)(rn,2),Qn=Yi[0],Di=Yi[1],Ki=(0,R.useState)([0,0]),vn=(0,pe.Z)(Ki,2),Ri=vn[0],mn=vn[1],sn=(0,R.useState)([0,0]),rr=(0,pe.Z)(sn,2),gn=rr[0],cr=rr[1],Qi=(0,R.useState)([0,0]),ki=(0,pe.Z)(Qi,2),ii=ki[0],Re=ki[1],it=te(new Map),xt=(0,pe.Z)(it,2),nt=xt[0],At=xt[1],st=V(ve,nt,Ri[0]),ft=ct(Qn,Dt),Pt=ct(Ri,Dt),Jt=ct(gn,Dt),pi=ct(ii,Dt),Zi=Math.floor(ft)<Math.floor(Pt+Jt),_i=Zi?ft-pi:ft-Jt,Fi="".concat(ue,"-nav-operations-hidden"),Pi=0,Ni=0;Dt&&Et?(Pi=0,Ni=Math.max(0,Pt-_i)):(Pi=Math.min(0,_i-Pt),Ni=0);function Gi(Ji){return Ji<Pi?Pi:Ji>Ni?Ni:Ji}var wi=(0,R.useRef)(null),Bi=(0,R.useState)(),un=(0,pe.Z)(Bi,2),$i=un[0],Ai=un[1];function Xi(){Ai(Date.now())}function Hi(){wi.current&&clearTimeout(wi.current)}We(Vt,function(Ji,bi){function nn(En,vr){En(function(Wn){var qi=Gi(Wn+vr);return qi})}return Zi?(Dt?nn(Oi,Ji):nn(Wi,bi),Hi(),Xi(),!0):!1}),(0,R.useEffect)(function(){return Hi(),$i&&(wi.current=setTimeout(function(){Ai(0)},100)),Hi},[$i]);var en=X(st,_i,Dt?Ei:zi,Pt,Jt,pi,(0,Ze.Z)((0,Ze.Z)({},Le),{},{tabs:ve})),Nn=(0,pe.Z)(en,2),cn=Nn[0],tn=Nn[1],ji=(0,O.Z)(function(){var Ji=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ct,bi=st.get(Ji)||{width:0,height:0,left:0,right:0,top:0};if(Dt){var nn=Ei;Et?bi.right<Ei?nn=bi.right:bi.right+bi.width>Ei+_i&&(nn=bi.right+bi.width-_i):bi.left<-Ei?nn=-bi.left:bi.left+bi.width>-Ei+_i&&(nn=-(bi.left+bi.width-_i)),Wi(0),Oi(Gi(nn))}else{var En=zi;bi.top<-zi?En=-bi.top:bi.top+bi.height>-zi+_i&&(En=-(bi.top+bi.height-_i)),Oi(0),Wi(Gi(En))}}),In=(0,R.useState)(),$n=(0,pe.Z)(In,2),Vi=$n[0],bn=$n[1],xn=(0,R.useState)(!1),wn=(0,pe.Z)(xn,2),gr=wn[0],an=wn[1],Ln=ve.filter(function(Ji){return!Ji.disabled}).map(function(Ji){return Ji.key}),fr=function(bi){var nn=Ln.indexOf(Vi||Ct),En=Ln.length,vr=(nn+bi+En)%En,Wn=Ln[vr];bn(Wn)},Or=function(bi){var nn=bi.code,En=Et&&Dt,vr=Ln[0],Wn=Ln[Ln.length-1];switch(nn){case"ArrowLeft":{Dt&&fr(En?1:-1);break}case"ArrowRight":{Dt&&fr(En?-1:1);break}case"ArrowUp":{bi.preventDefault(),Dt||fr(-1);break}case"ArrowDown":{bi.preventDefault(),Dt||fr(1);break}case"Home":{bi.preventDefault(),bn(vr);break}case"End":{bi.preventDefault(),bn(Wn);break}case"Enter":case"Space":{bi.preventDefault(),ke(Ct,bi);break}case"Backspace":case"Delete":{var qi=Ln.indexOf(Vi),Un=ve.find(function(Dr){return Dr.key===Vi}),ls=A(Un==null?void 0:Un.closable,Un==null?void 0:Un.closeIcon,Xt,Un==null?void 0:Un.disabled);ls&&(bi.preventDefault(),bi.stopPropagation(),Xt.onEdit("remove",{key:Vi,event:bi}),qi===Ln.length-1?fr(-1):fr(1));break}}},dr={};Dt?dr[Et?"marginRight":"marginLeft"]=De:dr.marginTop=De;var Fr=ve.map(function(Ji,bi){var nn=Ji.key;return R.createElement(Ne,{id:je,prefixCls:ue,key:nn,tab:Ji,style:bi===0?void 0:dr,closable:Ji.closable,editable:Xt,active:nn===Ct,focus:nn===Vi,renderWrapper:xe,removeAriaLabel:Je==null?void 0:Je.removeAriaLabel,tabCount:Ln.length,currentPosition:bi+1,onClick:function(vr){ke(nn,vr)},onKeyDown:Or,onFocus:function(){gr||bn(nn),ji(nn),Xi(),Vt.current&&(Et||(Vt.current.scrollLeft=0),Vt.current.scrollTop=0)},onBlur:function(){bn(void 0)},onMouseDown:function(){an(!0)},onMouseUp:function(){an(!1)}})}),Dn=function(){return At(function(){var bi,nn=new Map,En=(bi=ni.current)===null||bi===void 0?void 0:bi.getBoundingClientRect();return ve.forEach(function(vr){var Wn,qi=vr.key,Un=(Wn=ni.current)===null||Wn===void 0?void 0:Wn.querySelector('[data-node-key="'.concat(ne(qi),'"]'));if(Un){var ls=tt(Un,En),Dr=(0,pe.Z)(ls,4),us=Dr[0],cs=Dr[1],rs=Dr[2],tr=Dr[3];nn.set(qi,{width:us,height:cs,left:rs,top:tr})}}),nn})};(0,R.useEffect)(function(){Dn()},[ve.map(function(Ji){return Ji.key}).join("_")]);var qn=Rt(function(){var Ji=mt(ht),bi=mt(_t),nn=mt(lt);Di([Ji[0]-bi[0]-nn[0],Ji[1]-bi[1]-nn[1]]);var En=mt(ri);cr(En);var vr=mt(gi);Re(vr);var Wn=mt(ni);mn([Wn[0]-En[0],Wn[1]-En[1]]),Dn()}),Ar=ve.slice(0,cn),Lr=ve.slice(tn+1),_r=[].concat((0,T.Z)(Ar),(0,T.Z)(Lr)),Pn=st.get(Ct),pr=K({activeTabOffset:Pn,horizontal:Dt,indicator:j,rtl:Et}),Kn=pr.style;(0,R.useEffect)(function(){ji()},[Ct,Pi,Ni,ee(Pn),ee(st),Dt]),(0,R.useEffect)(function(){qn()},[Et]);var Br=!!_r.length,Sn="".concat(ue,"-nav-wrap"),er,kr,mi,es;return Dt?Et?(kr=Ei>0,er=Ei!==Ni):(er=Ei<0,kr=Ei!==Pi):(mi=zi<0,es=zi!==Pi),R.createElement(C.Z,{onResize:qn},R.createElement("div",{ref:(0,Q.x1)(Me,ht),role:"tablist","aria-orientation":Dt?"horizontal":"vertical",className:P()("".concat(ue,"-nav"),rt),style:bt,onKeyDown:function(){Xi()}},R.createElement(ze,{ref:_t,position:"left",extra:Nt,prefixCls:ue}),R.createElement(C.Z,{onResize:qn},R.createElement("div",{className:P()(Sn,(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(Sn,"-ping-left"),er),"".concat(Sn,"-ping-right"),kr),"".concat(Sn,"-ping-top"),mi),"".concat(Sn,"-ping-bottom"),es)),ref:Vt},R.createElement(C.Z,{onResize:qn},R.createElement("div",{ref:ni,className:"".concat(ue,"-nav-list"),style:{transform:"translate(".concat(Ei,"px, ").concat(zi,"px)"),transition:$i?"none":void 0}},Fr,R.createElement(G,{ref:ri,prefixCls:ue,locale:Je,editable:Xt,style:(0,Ze.Z)((0,Ze.Z)({},Fr.length===0?void 0:dr),{},{visibility:Br?"hidden":null})}),R.createElement("div",{className:P()("".concat(ue,"-ink-bar"),(0,we.Z)({},"".concat(ue,"-ink-bar-animated"),Mt.inkBar)),style:Kn}))))),R.createElement(Ot,(0,le.Z)({},Le,{removeAriaLabel:Je==null?void 0:Je.removeAriaLabel,ref:gi,prefixCls:ue,tabs:_r,className:!Br&&Fi,tabMoving:!!$i})),R.createElement(ze,{ref:lt,position:"right",extra:Nt,prefixCls:ue})))}),Ce=ei,Fe=R.forwardRef(function(Le,Me){var rt=Le.prefixCls,bt=Le.className,je=Le.style,Mt=Le.id,Ct=Le.active,Et=Le.tabKey,Nt=Le.children;return R.createElement("div",{id:Mt&&"".concat(Mt,"-panel-").concat(Et),role:"tabpanel",tabIndex:Ct?0:-1,"aria-labelledby":Mt&&"".concat(Mt,"-tab-").concat(Et),"aria-hidden":!Ct,style:je,className:P()(rt,Ct&&"".concat(rt,"-active"),bt),ref:Me},Nt)}),me=Fe,Ye=["renderTabBar"],at=["label","key"],Xe=function(Me){var rt=Me.renderTabBar,bt=(0,S.Z)(Me,Ye),je=R.useContext(k),Mt=je.tabs;if(rt){var Ct=(0,Ze.Z)((0,Ze.Z)({},bt),{},{panes:Mt.map(function(Et){var Nt=Et.label,Xt=Et.key,Je=(0,S.Z)(Et,at);return R.createElement(me,(0,le.Z)({tab:Nt,key:Xt,tabKey:Xt},Je))})});return rt(Ct,Ce)}return R.createElement(Ce,bt)},Y=Xe,ye=re(77900),Oe=["key","forceRender","style","className","destroyInactiveTabPane"],qe=function(Me){var rt=Me.id,bt=Me.activeKey,je=Me.animated,Mt=Me.tabPosition,Ct=Me.destroyInactiveTabPane,Et=R.useContext(k),Nt=Et.prefixCls,Xt=Et.tabs,Je=je.tabPane,zt="".concat(Nt,"-tabpane");return R.createElement("div",{className:P()("".concat(Nt,"-content-holder"))},R.createElement("div",{className:P()("".concat(Nt,"-content"),"".concat(Nt,"-content-").concat(Mt),(0,we.Z)({},"".concat(Nt,"-content-animated"),Je))},Xt.map(function(De){var xe=De.key,ke=De.forceRender,U=De.style,j=De.className,ae=De.destroyInactiveTabPane,ue=(0,S.Z)(De,Oe),ve=xe===bt;return R.createElement(ye.default,(0,le.Z)({key:xe,visible:ve,forceRender:ke,removeOnLeave:!!(Ct||ae),leavedClassName:"".concat(zt,"-hidden")},je.tabPaneMotion),function(ht,_t){var lt=ht.style,Vt=ht.className;return R.createElement(me,(0,le.Z)({},ue,{prefixCls:zt,id:rt,tabKey:xe,animated:Je,active:ve,style:(0,Ze.Z)((0,Ze.Z)({},U),lt),className:P()(j,Vt),ref:_t}))})})))},ot=qe,vt=re(48736);function jt(){var Le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{inkBar:!0,tabPane:!1},Me;return Le===!1?Me={inkBar:!1,tabPane:!1}:Le===!0?Me={inkBar:!0,tabPane:!1}:Me=(0,Ze.Z)({inkBar:!0},(0,Z.Z)(Le)==="object"?Le:{}),Me.tabPaneMotion&&Me.tabPane===void 0&&(Me.tabPane=!0),!Me.tabPaneMotion&&Me.tabPane&&(Me.tabPane=!1),Me}var gt=["id","prefixCls","className","items","direction","activeKey","defaultActiveKey","editable","animated","tabPosition","tabBarGutter","tabBarStyle","tabBarExtraContent","locale","more","destroyInactiveTabPane","renderTabBar","onChange","onTabClick","onTabScroll","getPopupContainer","popupClassName","indicator"],Se=0,yt=R.forwardRef(function(Le,Me){var rt=Le.id,bt=Le.prefixCls,je=bt===void 0?"rc-tabs":bt,Mt=Le.className,Ct=Le.items,Et=Le.direction,Nt=Le.activeKey,Xt=Le.defaultActiveKey,Je=Le.editable,zt=Le.animated,De=Le.tabPosition,xe=De===void 0?"top":De,ke=Le.tabBarGutter,U=Le.tabBarStyle,j=Le.tabBarExtraContent,ae=Le.locale,ue=Le.more,ve=Le.destroyInactiveTabPane,ht=Le.renderTabBar,_t=Le.onChange,lt=Le.onTabClick,Vt=Le.onTabScroll,ni=Le.getPopupContainer,gi=Le.popupClassName,ri=Le.indicator,Dt=(0,S.Z)(Le,gt),oi=R.useMemo(function(){return(Ct||[]).filter(function(ii){return ii&&(0,Z.Z)(ii)==="object"&&"key"in ii})},[Ct]),Mi=Et==="rtl",Ei=jt(zt),Oi=(0,R.useState)(!1),vi=(0,pe.Z)(Oi,2),di=vi[0],zi=vi[1];(0,R.useEffect)(function(){zi((0,ie.Z)())},[]);var Wi=(0,f.Z)(function(){var ii;return(ii=oi[0])===null||ii===void 0?void 0:ii.key},{value:Nt,defaultValue:Xt}),rn=(0,pe.Z)(Wi,2),Yi=rn[0],Qn=rn[1],Di=(0,R.useState)(function(){return oi.findIndex(function(ii){return ii.key===Yi})}),Ki=(0,pe.Z)(Di,2),vn=Ki[0],Ri=Ki[1];(0,R.useEffect)(function(){var ii=oi.findIndex(function(it){return it.key===Yi});if(ii===-1){var Re;ii=Math.max(0,Math.min(vn,oi.length-1)),Qn((Re=oi[ii])===null||Re===void 0?void 0:Re.key)}Ri(ii)},[oi.map(function(ii){return ii.key}).join("_"),Yi,vn]);var mn=(0,f.Z)(null,{value:rt}),sn=(0,pe.Z)(mn,2),rr=sn[0],gn=sn[1];(0,R.useEffect)(function(){rt||(gn("rc-tabs-".concat(Se)),Se+=1)},[]);function cr(ii,Re){lt==null||lt(ii,Re);var it=ii!==Yi;Qn(ii),it&&(_t==null||_t(ii))}var Qi={id:rr,activeKey:Yi,animated:Ei,tabPosition:xe,rtl:Mi,mobile:di},ki=(0,Ze.Z)((0,Ze.Z)({},Qi),{},{editable:Je,locale:ae,more:ue,tabBarGutter:ke,onTabClick:cr,onTabScroll:Vt,extra:j,style:U,panes:null,getPopupContainer:ni,popupClassName:gi,indicator:ri});return R.createElement(k.Provider,{value:{tabs:oi,prefixCls:je}},R.createElement("div",(0,le.Z)({ref:Me,id:rt,className:P()(je,"".concat(je,"-").concat(xe),(0,we.Z)((0,we.Z)((0,we.Z)({},"".concat(je,"-mobile"),di),"".concat(je,"-editable"),Je),"".concat(je,"-rtl"),Mi),Mt)},Dt),R.createElement(Y,(0,le.Z)({},ki,{renderTabBar:ht})),R.createElement(ot,(0,le.Z)({destroyInactiveTabPane:ve},Qi,{animated:Ei}))))}),Wt=yt,Gt=Wt},29125:function(Ci,Bt,re){"use strict";re.d(Bt,{G:function(){return pe},Z:function(){return q}});var le=re(92310),we=re.n(le),Ze=re(59301);function pe(K){var $=K.children,V=K.prefixCls,he=K.id,be=K.overlayInnerStyle,Te=K.bodyClassName,se=K.className,Ee=K.style;return Ze.createElement("div",{className:we()("".concat(V,"-content"),se),style:Ee},Ze.createElement("div",{className:we()("".concat(V,"-inner"),Te),id:he,role:"tooltip",style:be},typeof $=="function"?$():$))}var Z=re(32855),S=re(27247),Ae=re(43079),P=re(65030),f={shiftX:64,adjustY:1},ie={adjustX:1,shiftY:!0},R=[0,0],k={left:{points:["cr","cl"],overflow:ie,offset:[-4,0],targetOffset:R},right:{points:["cl","cr"],overflow:ie,offset:[4,0],targetOffset:R},top:{points:["bc","tc"],overflow:f,offset:[0,-4],targetOffset:R},bottom:{points:["tc","bc"],overflow:f,offset:[0,4],targetOffset:R},topLeft:{points:["bl","tl"],overflow:f,offset:[0,-4],targetOffset:R},leftTop:{points:["tr","tl"],overflow:ie,offset:[-4,0],targetOffset:R},topRight:{points:["br","tr"],overflow:f,offset:[0,-4],targetOffset:R},rightTop:{points:["tl","tr"],overflow:ie,offset:[4,0],targetOffset:R},bottomRight:{points:["tr","br"],overflow:f,offset:[0,4],targetOffset:R},rightBottom:{points:["bl","br"],overflow:ie,offset:[4,0],targetOffset:R},bottomLeft:{points:["tl","bl"],overflow:f,offset:[0,4],targetOffset:R},leftBottom:{points:["br","bl"],overflow:ie,offset:[-4,0],targetOffset:R}},T=null,C=re(80402),O=["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","motion","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle","arrowContent","overlay","id","showArrow","classNames","styles"],Q=function($,V){var he=$.overlayClassName,be=$.trigger,Te=be===void 0?["hover"]:be,se=$.mouseEnterDelay,Ee=se===void 0?0:se,We=$.mouseLeaveDelay,Ke=We===void 0?.1:We,Rt=$.overlayStyle,te=$.prefixCls,z=te===void 0?"rc-tooltip":te,X=$.children,ee=$.onVisibleChange,fe=$.afterVisibleChange,ne=$.transitionName,A=$.animation,D=$.motion,G=$.placement,de=G===void 0?"right":G,ze=$.align,pt=ze===void 0?{}:ze,Ut=$.destroyTooltipOnHide,Ie=Ut===void 0?!1:Ut,qt=$.defaultVisible,Ot=$.getTooltipContainer,wt=$.overlayInnerStyle,Ne=$.arrowContent,tt=$.overlay,mt=$.id,ct=$.showArrow,ei=ct===void 0?!0:ct,Ce=$.classNames,Fe=$.styles,me=(0,Ae.Z)($,O),Ye=(0,C.Z)(mt),at=(0,Ze.useRef)(null);(0,Ze.useImperativeHandle)(V,function(){return at.current});var Xe=(0,S.Z)({},me);"visible"in $&&(Xe.popupVisible=$.visible);var Y=function(){return Ze.createElement(pe,{key:"content",prefixCls:z,id:Ye,bodyClassName:Ce==null?void 0:Ce.body,overlayInnerStyle:(0,S.Z)((0,S.Z)({},wt),Fe==null?void 0:Fe.body)},tt)},ye=function(){var qe=Ze.Children.only(X),ot=(qe==null?void 0:qe.props)||{},vt=(0,S.Z)((0,S.Z)({},ot),{},{"aria-describedby":tt?Ye:null});return Ze.cloneElement(X,vt)};return Ze.createElement(P.Z,(0,Z.Z)({popupClassName:we()(he,Ce==null?void 0:Ce.root),prefixCls:z,popup:Y,action:Te,builtinPlacements:k,popupPlacement:de,ref:at,popupAlign:pt,getPopupContainer:Ot,onPopupVisibleChange:ee,afterPopupVisibleChange:fe,popupTransitionName:ne,popupAnimation:A,popupMotion:D,defaultPopupVisible:qt,autoDestroy:Ie,mouseLeaveDelay:Ke,popupStyle:(0,S.Z)((0,S.Z)({},Rt),Fe==null?void 0:Fe.root),mouseEnterDelay:Ee,arrow:ei},Xe),ye())},H=(0,Ze.forwardRef)(Q),q=H},49658:function(Ci,Bt){"use strict";Bt.Z=function(){if(typeof navigator=="undefined"||typeof window=="undefined")return!1;var re=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(re)||/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(re==null?void 0:re.substr(0,4))}},83145:function(Ci,Bt,re){"use strict";Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.CopyToClipboard=void 0;var le=Ze(re(59301)),we=Ze(re(25769));function Ze(K){return K&&K.__esModule?K:{default:K}}function pe(K){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pe=function(V){return typeof V}:pe=function(V){return V&&typeof Symbol=="function"&&V.constructor===Symbol&&V!==Symbol.prototype?"symbol":typeof V},pe(K)}function Z(K,$){var V=Object.keys(K);if(Object.getOwnPropertySymbols){var he=Object.getOwnPropertySymbols(K);$&&(he=he.filter(function(be){return Object.getOwnPropertyDescriptor(K,be).enumerable})),V.push.apply(V,he)}return V}function S(K){for(var $=1;$<arguments.length;$++){var V=arguments[$]!=null?arguments[$]:{};$%2?Z(V,!0).forEach(function(he){H(K,he,V[he])}):Object.getOwnPropertyDescriptors?Object.defineProperties(K,Object.getOwnPropertyDescriptors(V)):Z(V).forEach(function(he){Object.defineProperty(K,he,Object.getOwnPropertyDescriptor(V,he))})}return K}function Ae(K,$){if(K==null)return{};var V=P(K,$),he,be;if(Object.getOwnPropertySymbols){var Te=Object.getOwnPropertySymbols(K);for(be=0;be<Te.length;be++)he=Te[be],!($.indexOf(he)>=0)&&Object.prototype.propertyIsEnumerable.call(K,he)&&(V[he]=K[he])}return V}function P(K,$){if(K==null)return{};var V={},he=Object.keys(K),be,Te;for(Te=0;Te<he.length;Te++)be=he[Te],!($.indexOf(be)>=0)&&(V[be]=K[be]);return V}function f(K,$){if(!(K instanceof $))throw new TypeError("Cannot call a class as a function")}function ie(K,$){for(var V=0;V<$.length;V++){var he=$[V];he.enumerable=he.enumerable||!1,he.configurable=!0,"value"in he&&(he.writable=!0),Object.defineProperty(K,he.key,he)}}function R(K,$,V){return $&&ie(K.prototype,$),V&&ie(K,V),K}function k(K,$){return $&&(pe($)==="object"||typeof $=="function")?$:C(K)}function T(K){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(V){return V.__proto__||Object.getPrototypeOf(V)},T(K)}function C(K){if(K===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return K}function O(K,$){if(typeof $!="function"&&$!==null)throw new TypeError("Super expression must either be null or a function");K.prototype=Object.create($&&$.prototype,{constructor:{value:K,writable:!0,configurable:!0}}),$&&Q(K,$)}function Q(K,$){return Q=Object.setPrototypeOf||function(he,be){return he.__proto__=be,he},Q(K,$)}function H(K,$,V){return $ in K?Object.defineProperty(K,$,{value:V,enumerable:!0,configurable:!0,writable:!0}):K[$]=V,K}var q=function(K){O($,K);function $(){var V,he;f(this,$);for(var be=arguments.length,Te=new Array(be),se=0;se<be;se++)Te[se]=arguments[se];return he=k(this,(V=T($)).call.apply(V,[this].concat(Te))),H(C(he),"onClick",function(Ee){var We=he.props,Ke=We.text,Rt=We.onCopy,te=We.children,z=We.options,X=le.default.Children.only(te),ee=(0,we.default)(Ke,z);Rt&&Rt(Ke,ee),X&&X.props&&typeof X.props.onClick=="function"&&X.props.onClick(Ee)}),he}return R($,[{key:"render",value:function(){var he=this.props,be=he.text,Te=he.onCopy,se=he.options,Ee=he.children,We=Ae(he,["text","onCopy","options","children"]),Ke=le.default.Children.only(Ee);return le.default.cloneElement(Ke,S({},We,{onClick:this.onClick}))}}]),$}(le.default.PureComponent);Bt.CopyToClipboard=q,H(q,"defaultProps",{onCopy:void 0,options:void 0})},56102:function(Ci,Bt,re){"use strict";var le=re(83145),we=le.CopyToClipboard;we.CopyToClipboard=we,Ci.exports=we},76374:function(Ci,Bt,re){"use strict";var le=function(){if(typeof Map!="undefined")return Map;function te(z,X){var ee=-1;return z.some(function(fe,ne){return fe[0]===X?(ee=ne,!0):!1}),ee}return function(){function z(){this.__entries__=[]}return Object.defineProperty(z.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),z.prototype.get=function(X){var ee=te(this.__entries__,X),fe=this.__entries__[ee];return fe&&fe[1]},z.prototype.set=function(X,ee){var fe=te(this.__entries__,X);~fe?this.__entries__[fe][1]=ee:this.__entries__.push([X,ee])},z.prototype.delete=function(X){var ee=this.__entries__,fe=te(ee,X);~fe&&ee.splice(fe,1)},z.prototype.has=function(X){return!!~te(this.__entries__,X)},z.prototype.clear=function(){this.__entries__.splice(0)},z.prototype.forEach=function(X,ee){ee===void 0&&(ee=null);for(var fe=0,ne=this.__entries__;fe<ne.length;fe++){var A=ne[fe];X.call(ee,A[1],A[0])}},z}()}(),we=typeof window!="undefined"&&typeof document!="undefined"&&window.document===document,Ze=function(){return typeof re.g!="undefined"&&re.g.Math===Math?re.g:typeof self!="undefined"&&self.Math===Math?self:typeof window!="undefined"&&window.Math===Math?window:Function("return this")()}(),pe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Ze):function(te){return setTimeout(function(){return te(Date.now())},1e3/60)}}(),Z=2;function S(te,z){var X=!1,ee=!1,fe=0;function ne(){X&&(X=!1,te()),ee&&D()}function A(){pe(ne)}function D(){var G=Date.now();if(X){if(G-fe<Z)return;ee=!0}else X=!0,ee=!1,setTimeout(A,z);fe=G}return D}var Ae=20,P=["top","right","bottom","left","width","height","size","weight"],f=typeof MutationObserver!="undefined",ie=function(){function te(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=S(this.refresh.bind(this),Ae)}return te.prototype.addObserver=function(z){~this.observers_.indexOf(z)||this.observers_.push(z),this.connected_||this.connect_()},te.prototype.removeObserver=function(z){var X=this.observers_,ee=X.indexOf(z);~ee&&X.splice(ee,1),!X.length&&this.connected_&&this.disconnect_()},te.prototype.refresh=function(){var z=this.updateObservers_();z&&this.refresh()},te.prototype.updateObservers_=function(){var z=this.observers_.filter(function(X){return X.gatherActive(),X.hasActive()});return z.forEach(function(X){return X.broadcastActive()}),z.length>0},te.prototype.connect_=function(){!we||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),f?(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)},te.prototype.disconnect_=function(){!we||!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)},te.prototype.onTransitionEnd_=function(z){var X=z.propertyName,ee=X===void 0?"":X,fe=P.some(function(ne){return!!~ee.indexOf(ne)});fe&&this.refresh()},te.getInstance=function(){return this.instance_||(this.instance_=new te),this.instance_},te.instance_=null,te}(),R=function(te,z){for(var X=0,ee=Object.keys(z);X<ee.length;X++){var fe=ee[X];Object.defineProperty(te,fe,{value:z[fe],enumerable:!1,writable:!1,configurable:!0})}return te},k=function(te){var z=te&&te.ownerDocument&&te.ownerDocument.defaultView;return z||Ze},T=be(0,0,0,0);function C(te){return parseFloat(te)||0}function O(te){for(var z=[],X=1;X<arguments.length;X++)z[X-1]=arguments[X];return z.reduce(function(ee,fe){var ne=te["border-"+fe+"-width"];return ee+C(ne)},0)}function Q(te){for(var z=["top","right","bottom","left"],X={},ee=0,fe=z;ee<fe.length;ee++){var ne=fe[ee],A=te["padding-"+ne];X[ne]=C(A)}return X}function H(te){var z=te.getBBox();return be(0,0,z.width,z.height)}function q(te){var z=te.clientWidth,X=te.clientHeight;if(!z&&!X)return T;var ee=k(te).getComputedStyle(te),fe=Q(ee),ne=fe.left+fe.right,A=fe.top+fe.bottom,D=C(ee.width),G=C(ee.height);if(ee.boxSizing==="border-box"&&(Math.round(D+ne)!==z&&(D-=O(ee,"left","right")+ne),Math.round(G+A)!==X&&(G-=O(ee,"top","bottom")+A)),!$(te)){var de=Math.round(D+ne)-z,ze=Math.round(G+A)-X;Math.abs(de)!==1&&(D-=de),Math.abs(ze)!==1&&(G-=ze)}return be(fe.left,fe.top,D,G)}var K=function(){return typeof SVGGraphicsElement!="undefined"?function(te){return te instanceof k(te).SVGGraphicsElement}:function(te){return te instanceof k(te).SVGElement&&typeof te.getBBox=="function"}}();function $(te){return te===k(te).document.documentElement}function V(te){return we?K(te)?H(te):q(te):T}function he(te){var z=te.x,X=te.y,ee=te.width,fe=te.height,ne=typeof DOMRectReadOnly!="undefined"?DOMRectReadOnly:Object,A=Object.create(ne.prototype);return R(A,{x:z,y:X,width:ee,height:fe,top:X,right:z+ee,bottom:fe+X,left:z}),A}function be(te,z,X,ee){return{x:te,y:z,width:X,height:ee}}var Te=function(){function te(z){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=be(0,0,0,0),this.target=z}return te.prototype.isActive=function(){var z=V(this.target);return this.contentRect_=z,z.width!==this.broadcastWidth||z.height!==this.broadcastHeight},te.prototype.broadcastRect=function(){var z=this.contentRect_;return this.broadcastWidth=z.width,this.broadcastHeight=z.height,z},te}(),se=function(){function te(z,X){var ee=he(X);R(this,{target:z,contentRect:ee})}return te}(),Ee=function(){function te(z,X,ee){if(this.activeObservations_=[],this.observations_=new le,typeof z!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=z,this.controller_=X,this.callbackCtx_=ee}return te.prototype.observe=function(z){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(z instanceof k(z).Element))throw new TypeError('parameter 1 is not of type "Element".');var X=this.observations_;X.has(z)||(X.set(z,new Te(z)),this.controller_.addObserver(this),this.controller_.refresh())}},te.prototype.unobserve=function(z){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element=="undefined"||!(Element instanceof Object))){if(!(z instanceof k(z).Element))throw new TypeError('parameter 1 is not of type "Element".');var X=this.observations_;X.has(z)&&(X.delete(z),X.size||this.controller_.removeObserver(this))}},te.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},te.prototype.gatherActive=function(){var z=this;this.clearActive(),this.observations_.forEach(function(X){X.isActive()&&z.activeObservations_.push(X)})},te.prototype.broadcastActive=function(){if(this.hasActive()){var z=this.callbackCtx_,X=this.activeObservations_.map(function(ee){return new se(ee.target,ee.broadcastRect())});this.callback_.call(z,X,z),this.clearActive()}},te.prototype.clearActive=function(){this.activeObservations_.splice(0)},te.prototype.hasActive=function(){return this.activeObservations_.length>0},te}(),We=typeof WeakMap!="undefined"?new WeakMap:new le,Ke=function(){function te(z){if(!(this instanceof te))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var X=ie.getInstance(),ee=new Ee(z,X,this);We.set(this,ee)}return te}();["observe","unobserve","disconnect"].forEach(function(te){Ke.prototype[te]=function(){var z;return(z=We.get(this))[te].apply(z,arguments)}});var Rt=function(){return typeof Ze.ResizeObserver!="undefined"?Ze.ResizeObserver:Ke}();Bt.Z=Rt},98040:function(Ci){Ci.exports=function(){var Bt=document.getSelection();if(!Bt.rangeCount)return function(){};for(var re=document.activeElement,le=[],we=0;we<Bt.rangeCount;we++)le.push(Bt.getRangeAt(we));switch(re.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":re.blur();break;default:re=null;break}return Bt.removeAllRanges(),function(){Bt.type==="Caret"&&Bt.removeAllRanges(),Bt.rangeCount||le.forEach(function(Ze){Bt.addRange(Ze)}),re&&re.focus()}}},68535:function(Ci,Bt,re){"use strict";re.d(Bt,{ZP:function(){return Ir}});const le=Number.isFinite||function(h){return typeof h=="number"&&isFinite(h)},we=Number.isSafeInteger||function(h){return typeof h=="number"&&Math.abs(h)<=Ze},Ze=Number.MAX_SAFE_INTEGER||9007199254740991;let pe=function(h){return h.NETWORK_ERROR="networkError",h.MEDIA_ERROR="mediaError",h.KEY_SYSTEM_ERROR="keySystemError",h.MUX_ERROR="muxError",h.OTHER_ERROR="otherError",h}({}),Z=function(h){return h.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",h.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",h.KEY_SYSTEM_NO_SESSION="keySystemNoSession",h.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",h.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",h.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",h.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",h.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",h.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",h.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",h.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",h.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",h.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",h.MANIFEST_LOAD_ERROR="manifestLoadError",h.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",h.MANIFEST_PARSING_ERROR="manifestParsingError",h.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",h.LEVEL_EMPTY_ERROR="levelEmptyError",h.LEVEL_LOAD_ERROR="levelLoadError",h.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",h.LEVEL_PARSING_ERROR="levelParsingError",h.LEVEL_SWITCH_ERROR="levelSwitchError",h.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",h.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",h.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",h.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",h.FRAG_LOAD_ERROR="fragLoadError",h.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",h.FRAG_DECRYPT_ERROR="fragDecryptError",h.FRAG_PARSING_ERROR="fragParsingError",h.FRAG_GAP="fragGap",h.REMUX_ALLOC_ERROR="remuxAllocError",h.KEY_LOAD_ERROR="keyLoadError",h.KEY_LOAD_TIMEOUT="keyLoadTimeOut",h.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",h.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",h.BUFFER_APPEND_ERROR="bufferAppendError",h.BUFFER_APPENDING_ERROR="bufferAppendingError",h.BUFFER_STALLED_ERROR="bufferStalledError",h.BUFFER_FULL_ERROR="bufferFullError",h.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",h.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",h.ASSET_LIST_LOAD_ERROR="assetListLoadError",h.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",h.ASSET_LIST_PARSING_ERROR="assetListParsingError",h.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",h.INTERNAL_EXCEPTION="internalException",h.INTERNAL_ABORTED="aborted",h.ATTACH_MEDIA_ERROR="attachMediaError",h.UNKNOWN="unknown",h}({}),S=function(h){return h.MEDIA_ATTACHING="hlsMediaAttaching",h.MEDIA_ATTACHED="hlsMediaAttached",h.MEDIA_DETACHING="hlsMediaDetaching",h.MEDIA_DETACHED="hlsMediaDetached",h.MEDIA_ENDED="hlsMediaEnded",h.STALL_RESOLVED="hlsStallResolved",h.BUFFER_RESET="hlsBufferReset",h.BUFFER_CODECS="hlsBufferCodecs",h.BUFFER_CREATED="hlsBufferCreated",h.BUFFER_APPENDING="hlsBufferAppending",h.BUFFER_APPENDED="hlsBufferAppended",h.BUFFER_EOS="hlsBufferEos",h.BUFFERED_TO_END="hlsBufferedToEnd",h.BUFFER_FLUSHING="hlsBufferFlushing",h.BUFFER_FLUSHED="hlsBufferFlushed",h.MANIFEST_LOADING="hlsManifestLoading",h.MANIFEST_LOADED="hlsManifestLoaded",h.MANIFEST_PARSED="hlsManifestParsed",h.LEVEL_SWITCHING="hlsLevelSwitching",h.LEVEL_SWITCHED="hlsLevelSwitched",h.LEVEL_LOADING="hlsLevelLoading",h.LEVEL_LOADED="hlsLevelLoaded",h.LEVEL_UPDATED="hlsLevelUpdated",h.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",h.LEVELS_UPDATED="hlsLevelsUpdated",h.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",h.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",h.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",h.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",h.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",h.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",h.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",h.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",h.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",h.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",h.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",h.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",h.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",h.CUES_PARSED="hlsCuesParsed",h.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",h.INIT_PTS_FOUND="hlsInitPtsFound",h.FRAG_LOADING="hlsFragLoading",h.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",h.FRAG_LOADED="hlsFragLoaded",h.FRAG_DECRYPTED="hlsFragDecrypted",h.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",h.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",h.FRAG_PARSING_METADATA="hlsFragParsingMetadata",h.FRAG_PARSED="hlsFragParsed",h.FRAG_BUFFERED="hlsFragBuffered",h.FRAG_CHANGED="hlsFragChanged",h.FPS_DROP="hlsFpsDrop",h.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",h.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",h.ERROR="hlsError",h.DESTROYING="hlsDestroying",h.KEY_LOADING="hlsKeyLoading",h.KEY_LOADED="hlsKeyLoaded",h.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",h.BACK_BUFFER_REACHED="hlsBackBufferReached",h.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",h.ASSET_LIST_LOADING="hlsAssetListLoading",h.ASSET_LIST_LOADED="hlsAssetListLoaded",h.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",h.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",h.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",h.INTERSTITIAL_STARTED="hlsInterstitialStarted",h.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",h.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",h.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",h.INTERSTITIAL_ENDED="hlsInterstitialEnded",h.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",h.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",h.EVENT_CUE_ENTER="hlsEventCueEnter",h}({});var Ae={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},P={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};class f{constructor(t,n=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=n,this.totalWeight_=s}sample(t,n){const s=Math.pow(this.alpha_,t);this.estimate_=n*(1-s)+s*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class ie{constructor(t,n,s,o=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new f(t),this.fast_=new f(n),this.defaultTTFB_=o,this.ttfb_=new f(t)}update(t,n){const{slow_:s,fast_:o,ttfb_:l}=this;s.halfLife!==t&&(this.slow_=new f(t,s.getEstimate(),s.getTotalWeight())),o.halfLife!==n&&(this.fast_=new f(n,o.getEstimate(),o.getTotalWeight())),l.halfLife!==t&&(this.ttfb_=new f(t,l.getEstimate(),l.getTotalWeight()))}sample(t,n){t=Math.max(t,this.minDelayMs_);const s=8*n,o=t/1e3,l=s/o;this.fast_.sample(o,l),this.slow_.sample(o,l)}sampleTTFB(t){const n=t/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(n,2)/2);this.ttfb_.sample(s,Math.max(t,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function R(h,t,n){return(t=Q(t))in h?Object.defineProperty(h,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):h[t]=n,h}function k(){return k=Object.assign?Object.assign.bind():function(h){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(h[s]=n[s])}return h},k.apply(null,arguments)}function T(h,t){var n=Object.keys(h);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(h);t&&(s=s.filter(function(o){return Object.getOwnPropertyDescriptor(h,o).enumerable})),n.push.apply(n,s)}return n}function C(h){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?T(Object(n),!0).forEach(function(s){R(h,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach(function(s){Object.defineProperty(h,s,Object.getOwnPropertyDescriptor(n,s))})}return h}function O(h,t){if(typeof h!="object"||!h)return h;var n=h[Symbol.toPrimitive];if(n!==void 0){var s=n.call(h,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(h)}function Q(h){var t=O(h,"string");return typeof t=="symbol"?t:t+""}class H{constructor(t,n){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const s=`[${t}]:`;this.trace=q,this.debug=n.debug.bind(null,s),this.log=n.log.bind(null,s),this.warn=n.warn.bind(null,s),this.info=n.info.bind(null,s),this.error=n.error.bind(null,s)}}const q=function(){},K={trace:q,debug:q,log:q,warn:q,info:q,error:q};function $(){return k({},K)}function V(h,t){const n=self.console[h];return n?n.bind(self.console,`${t?"["+t+"] ":""}[${h}] >`):q}function he(h,t,n){return t[h]?t[h].bind(t):V(h,n)}const be=$();function Te(h,t,n){const s=$();if(typeof console=="object"&&h===!0||typeof h=="object"){const o=["debug","log","info","warn","error"];o.forEach(l=>{s[l]=he(l,h,n)});try{s.log(`Debug logs enabled for "${t}" in hls.js version 1.6.11`)}catch(l){return $()}o.forEach(l=>{be[l]=he(l,h)})}else k(be,s);return s}const se=be;function Ee(h=!0){return typeof self=="undefined"?void 0:(h||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function We(h){return typeof self!="undefined"&&h===self.ManagedMediaSource}function Ke(h,t){const n=Object.keys(h),s=Object.keys(t),o=n.length,l=s.length;return!o||!l||o===l&&!n.some(c=>s.indexOf(c)===-1)}function Rt(h,t=!1){if(typeof TextDecoder!="undefined"){const g=new TextDecoder("utf-8").decode(h);if(t){const v=g.indexOf("\0");return v!==-1?g.substring(0,v):g}return g.replace(/\0/g,"")}const n=h.length;let s,o,l,c="",d=0;for(;d<n;){if(s=h[d++],s===0&&t)return c;if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(s);break;case 12:case 13:o=h[d++],c+=String.fromCharCode((s&31)<<6|o&63);break;case 14:o=h[d++],l=h[d++],c+=String.fromCharCode((s&15)<<12|(o&63)<<6|(l&63)<<0);break}}return c}function te(h){let t="";for(let n=0;n<h.length;n++){let s=h[n].toString(16);s.length<2&&(s="0"+s),t+=s}return t}function z(h){return Uint8Array.from(h.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function X(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}var ee={exports:{}},fe;function ne(){return fe||(fe=1,function(h,t){(function(n){var s=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,o=/^(?=([^\/?#]*))\1([^]*)$/,l=/(?:\/|^)\.(?=\/)/g,c=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,d={buildAbsoluteURL:function(_,g,v){if(v=v||{},_=_.trim(),g=g.trim(),!g){if(!v.alwaysNormalize)return _;var y=d.parseURL(_);if(!y)throw new Error("Error trying to parse base URL.");return y.path=d.normalizePath(y.path),d.buildURLFromParts(y)}var x=d.parseURL(g);if(!x)throw new Error("Error trying to parse relative URL.");if(x.scheme)return v.alwaysNormalize?(x.path=d.normalizePath(x.path),d.buildURLFromParts(x)):g;var L=d.parseURL(_);if(!L)throw new Error("Error trying to parse base URL.");if(!L.netLoc&&L.path&&L.path[0]!=="/"){var M=o.exec(L.path);L.netLoc=M[1],L.path=M[2]}L.netLoc&&!L.path&&(L.path="/");var B={scheme:L.scheme,netLoc:x.netLoc,path:null,params:x.params,query:x.query,fragment:x.fragment};if(!x.netLoc&&(B.netLoc=L.netLoc,x.path[0]!=="/"))if(!x.path)B.path=L.path,x.params||(B.params=L.params,x.query||(B.query=L.query));else{var F=L.path,W=F.substring(0,F.lastIndexOf("/")+1)+x.path;B.path=d.normalizePath(W)}return B.path===null&&(B.path=v.alwaysNormalize?d.normalizePath(x.path):x.path),d.buildURLFromParts(B)},parseURL:function(_){var g=s.exec(_);return g?{scheme:g[1]||"",netLoc:g[2]||"",path:g[3]||"",params:g[4]||"",query:g[5]||"",fragment:g[6]||""}:null},normalizePath:function(_){for(_=_.split("").reverse().join("").replace(l,"");_.length!==(_=_.replace(c,"")).length;);return _.split("").reverse().join("")},buildURLFromParts:function(_){return _.scheme+_.netLoc+_.path+_.params+_.query+_.fragment}};h.exports=d})()}(ee)),ee.exports}var A=ne();class D{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 G={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class de{constructor(t){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof t=="string"&&(t={url:t}),this.base=t,qt(this,"stats")}setByteRange(t,n){const s=t.split("@",2);let o;s.length===1?o=(n==null?void 0:n.byteRangeEndOffset)||0:o=parseInt(s[1]),this._byteRange=[o,parseInt(s[0])+o]}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={[G.AUDIO]:null,[G.VIDEO]:null,[G.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(t){this._streams=t}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new D),this._stats}set stats(t){this._stats=t}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=A.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[G.AUDIO]=null,t[G.VIDEO]=null,t[G.AUDIOVIDEO]=null}}function ze(h){return h.sn!=="initSegment"}class pt extends de{constructor(t,n){super(n),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=t}get byteLength(){if(this.hasStats){const t=this.stats.total;if(t)return t}if(this.byteRange.length){const t=this.byteRange[0],n=this.byteRange[1];if(le(t)&&le(n))return n-t}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(t){this._bitrate=t}get decryptdata(){const{levelkeys:t}=this;if(!t&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const n=this.levelkeys.identity;if(n)this._decryptdata=n.getDecryptData(this.sn);else{const s=Object.keys(this.levelkeys);if(s.length===1){const o=this._decryptdata=this.levelkeys[s[0]]||null;if(o)return o.getDecryptData(this.sn)}}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const t=le(this.duration)?this.duration:0;return this.programDateTime+t*1e3}get encrypted(){var t;if((t=this._decryptdata)!=null&&t.encrypted)return!0;if(this.levelkeys){var n;const s=Object.keys(this.levelkeys),o=s.length;if(o>1||o===1&&(n=this.levelkeys[s[0]])!=null&&n.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(t){if(!le(t)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=t}get ref(){return ze(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(t){this.setStart(this.start+t)}setStart(t){this.start=t,this._ref&&(this._ref.start=t)}setDuration(t){this.duration=t,this._ref&&(this._ref.duration=t)}setKeyFormat(t){if(this.levelkeys){const n=this.levelkeys[t];n&&!this._decryptdata&&(this._decryptdata=n.getDecryptData(this.sn))}}abortRequests(){var t,n;(t=this.loader)==null||t.abort(),(n=this.keyLoader)==null||n.abort()}setElementaryStreamInfo(t,n,s,o,l,c=!1){const{elementaryStreams:d}=this,_=d[t];if(!_){d[t]={startPTS:n,endPTS:s,startDTS:o,endDTS:l,partial:c};return}_.startPTS=Math.min(_.startPTS,n),_.endPTS=Math.max(_.endPTS,s),_.startDTS=Math.min(_.startDTS,o),_.endDTS=Math.max(_.endDTS,l)}}class Ut extends de{constructor(t,n,s,o,l){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=n,this.index=o;const c=t.enumeratedString("BYTERANGE");c&&this.setByteRange(c,l),l&&(this.fragOffset=l.fragOffset+l.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}function Ie(h,t){const n=Object.getPrototypeOf(h);if(n){const s=Object.getOwnPropertyDescriptor(n,t);return s||Ie(n,t)}}function qt(h,t){const n=Ie(h,t);n&&(n.enumerable=!0,Object.defineProperty(h,t,n))}const Ot=Math.pow(2,32)-1,wt=[].push,Ne={video:1,audio:2,id3:3,text:4};function tt(h){return String.fromCharCode.apply(null,h)}function mt(h,t){const n=h[t]<<8|h[t+1];return n<0?65536+n:n}function ct(h,t){const n=Ce(h,t);return n<0?4294967296+n:n}function ei(h,t){let n=ct(h,t);return n*=Math.pow(2,32),n+=ct(h,t+4),n}function Ce(h,t){return h[t]<<24|h[t+1]<<16|h[t+2]<<8|h[t+3]}function Fe(h){const t=h.byteLength;for(let n=0;n<t;){const s=ct(h,n);if(s>8&&h[n+4]===109&&h[n+5]===111&&h[n+6]===111&&h[n+7]===102)return!0;n=s>1?n+s:t}return!1}function me(h,t){const n=[];if(!t.length)return n;const s=h.byteLength;for(let o=0;o<s;){const l=ct(h,o),c=tt(h.subarray(o+4,o+8)),d=l>1?o+l:s;if(c===t[0])if(t.length===1)n.push(h.subarray(o+8,d));else{const _=me(h.subarray(o+8,d),t.slice(1));_.length&&wt.apply(n,_)}o=d}return n}function Ye(h){const t=[],n=h[0];let s=8;const o=ct(h,s);s+=4;let l=0,c=0;n===0?(l=ct(h,s),c=ct(h,s+4),s+=8):(l=ei(h,s),c=ei(h,s+8),s+=16),s+=2;let d=h.length+c;const _=mt(h,s);s+=2;for(let g=0;g<_;g++){let v=s;const y=ct(h,v);v+=4;const x=y&2147483647;if((y&2147483648)>>>31===1)return se.warn("SIDX has hierarchical references (not supported)"),null;const M=ct(h,v);v+=4,t.push({referenceSize:x,subsegmentDuration:M,info:{duration:M/o,start:d,end:d+x-1}}),d+=x,v+=4,s=v}return{earliestPresentationTime:l,timescale:o,version:n,referencesCount:_,references:t}}function at(h){const t=[],n=me(h,["moov","trak"]);for(let o=0;o<n.length;o++){const l=n[o],c=me(l,["tkhd"])[0];if(c){let d=c[0];const _=ct(c,d===0?12:20),g=me(l,["mdia","mdhd"])[0];if(g){d=g[0];const v=ct(g,d===0?12:20),y=me(l,["mdia","hdlr"])[0];if(y){const x=tt(y.subarray(8,12)),L={soun:G.AUDIO,vide:G.VIDEO}[x],M=me(l,["mdia","minf","stbl","stsd"])[0],B=Xe(M);L?(t[_]={timescale:v,type:L,stsd:B},t[L]=C({timescale:v,id:_},B)):t[_]={timescale:v,type:x,stsd:B}}}}}return me(h,["moov","mvex","trex"]).forEach(o=>{const l=ct(o,4),c=t[l];c&&(c.default={duration:ct(o,12),flags:ct(o,20)})}),t}function Xe(h){const t=h.subarray(8),n=t.subarray(86),s=tt(t.subarray(4,8));let o=s,l;const c=s==="enca"||s==="encv";if(c){const g=me(t,[s])[0].subarray(s==="enca"?28:78);me(g,["sinf"]).forEach(y=>{const x=me(y,["schm"])[0];if(x){const L=tt(x.subarray(4,8));if(L==="cbcs"||L==="cenc"){const M=me(y,["frma"])[0];M&&(o=tt(M))}}})}const d=o;switch(o){case"avc1":case"avc2":case"avc3":case"avc4":{const _=me(n,["avcC"])[0];_&&_.length>3&&(o+="."+qe(_[1])+qe(_[2])+qe(_[3]),l=Y(d==="avc1"?"dva1":"dvav",n));break}case"mp4a":{const _=me(t,[s])[0],g=me(_.subarray(28),["esds"])[0];if(g&&g.length>7){let v=4;if(g[v++]!==3)break;v=Oe(g,v),v+=2;const y=g[v++];if(y&128&&(v+=2),y&64&&(v+=g[v++]),g[v++]!==4)break;v=Oe(g,v);const x=g[v++];if(x===64)o+="."+qe(x);else break;if(v+=12,g[v++]!==5)break;v=Oe(g,v);const L=g[v++];let M=(L&248)>>3;M===31&&(M+=1+((L&7)<<3)+((g[v]&224)>>5)),o+="."+M}break}case"hvc1":case"hev1":{const _=me(n,["hvcC"])[0];if(_&&_.length>12){const g=_[1],v=["","A","B","C"][g>>6],y=g&31,x=ct(_,2),L=(g&32)>>5?"H":"L",M=_[12],B=_.subarray(6,12);o+="."+v+y,o+="."+ye(x).toString(16).toUpperCase(),o+="."+L+M;let F="";for(let W=B.length;W--;){const _e=B[W];(_e||F)&&(F="."+_e.toString(16).toUpperCase()+F)}o+=F}l=Y(d=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{o=Y(o,n)||o;break}case"vp09":{const _=me(n,["vpcC"])[0];if(_&&_.length>6){const g=_[4],v=_[5],y=_[6]>>4&15;o+="."+ot(g)+"."+ot(v)+"."+ot(y)}break}case"av01":{const _=me(n,["av1C"])[0];if(_&&_.length>2){const g=_[1]>>>5,v=_[1]&31,y=_[2]>>>7?"H":"M",x=(_[2]&64)>>6,L=(_[2]&32)>>5,M=g===2&&x?L?12:10:x?10:8,B=(_[2]&16)>>4,F=(_[2]&8)>>3,W=(_[2]&4)>>2,_e=_[2]&3;o+="."+g+"."+ot(v)+y+"."+ot(M)+"."+B+"."+F+W+_e+"."+ot(1)+"."+ot(1)+"."+ot(1)+"."+0,l=Y("dav1",n)}break}}return{codec:o,encrypted:c,supplemental:l}}function Y(h,t){const n=me(t,["dvvC"]),s=n.length?n[0]:me(t,["dvcC"])[0];if(s){const o=s[2]>>1&127,l=s[2]<<5&32|s[3]>>3&31;return h+"."+ot(o)+"."+ot(l)}}function ye(h){let t=0;for(let n=0;n<32;n++)t|=(h>>n&1)<<31-n;return t>>>0}function Oe(h,t){const n=t+5;for(;h[t++]&128&&t<n;);return t}function qe(h){return("0"+h.toString(16).toUpperCase()).slice(-2)}function ot(h){return(h<10?"0":"")+h}function vt(h,t){if(!h||!t)return;const n=t.keyId;n&&t.isCommonEncryption&&me(h,["moov","trak"]).forEach(o=>{const c=me(o,["mdia","minf","stbl","stsd"])[0].subarray(8);let d=me(c,["enca"]);const _=d.length>0;_||(d=me(c,["encv"])),d.forEach(g=>{const v=_?g.subarray(28):g.subarray(78);me(v,["sinf"]).forEach(x=>{const L=jt(x);if(L){const M=L.subarray(8,24);M.some(B=>B!==0)||(se.log(`[eme] Patching keyId in 'enc${_?"a":"v"}>sinf>>tenc' box: ${te(M)} -> ${te(n)}`),L.set(n,8))}})})})}function jt(h){const t=me(h,["schm"])[0];if(t){const n=tt(t.subarray(4,8));if(n==="cbcs"||n==="cenc")return me(h,["schi","tenc"])[0]}return null}function gt(h,t,n){const s={},o=me(h,["moof","traf"]);for(let l=0;l<o.length;l++){const c=o[l],d=me(c,["tfhd"])[0],_=ct(d,4),g=t[_];if(!g)continue;s[_]||(s[_]={start:NaN,duration:0,sampleCount:0,timescale:g.timescale,type:g.type});const v=s[_],y=me(c,["tfdt"])[0];if(y){const ce=y[0];let Pe=ct(y,4);ce===1&&(Pe===Ot?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(Pe*=Ot+1,Pe+=ct(y,8))),le(Pe)&&(!le(v.start)||Pe<v.start)&&(v.start=Pe)}const x=g.default,L=ct(d,0)|(x==null?void 0:x.flags);let M=(x==null?void 0:x.duration)||0;L&8&&(L&2?M=ct(d,12):M=ct(d,8));const B=me(c,["trun"]);let F=v.start||0,W=0,_e=M;for(let ce=0;ce<B.length;ce++){const Pe=B[ce],Ue=ct(Pe,4),dt=v.sampleCount;v.sampleCount+=Ue;const $e=Pe[3]&1,Qe=Pe[3]&4,et=Pe[2]&1,Be=Pe[2]&2,Tt=Pe[2]&4,ti=Pe[2]&8;let hi=8,Ti=Ue;for($e&&(hi+=4),Qe&&Ue&&(!(Pe[hi+1]&1)&&v.keyFrameIndex===void 0&&(v.keyFrameIndex=dt),hi+=4,et?(_e=ct(Pe,hi),hi+=4):_e=M,Be&&(hi+=4),ti&&(hi+=4),F+=_e,W+=_e,Ti--);Ti--;)et?(_e=ct(Pe,hi),hi+=4):_e=M,Be&&(hi+=4),Tt&&(Pe[hi+1]&1||v.keyFrameIndex===void 0&&(v.keyFrameIndex=v.sampleCount-(Ti+1),v.keyFrameStart=F),hi+=4),ti&&(hi+=4),F+=_e,W+=_e;!W&&M&&(W+=M*Ue)}v.duration+=W}if(!Object.keys(s).some(l=>s[l].duration)){let l=1/0,c=0;const d=me(h,["sidx"]);for(let _=0;_<d.length;_++){const g=Ye(d[_]);if(g!=null&&g.references){l=Math.min(l,g.earliestPresentationTime/g.timescale);const v=g.references.reduce((y,x)=>y+x.info.duration||0,0);c=Math.max(c,v+g.earliestPresentationTime/g.timescale)}}c&&le(c)&&Object.keys(s).forEach(_=>{s[_].duration||(s[_].duration=c*s[_].timescale-s[_].start)})}return s}function Se(h){const t={valid:null,remainder:null},n=me(h,["moof"]);if(n.length<2)return t.remainder=h,t;const s=n[n.length-1];return t.valid=h.slice(0,s.byteOffset-8),t.remainder=h.slice(s.byteOffset-8),t}function yt(h,t){const n=new Uint8Array(h.length+t.length);return n.set(h),n.set(t,h.length),n}function Wt(h,t){const n=[],s=t.samples,o=t.timescale,l=t.id;let c=!1;return me(s,["moof"]).map(_=>{const g=_.byteOffset-8;me(_,["traf"]).map(y=>{const x=me(y,["tfdt"]).map(L=>{const M=L[0];let B=ct(L,4);return M===1&&(B*=Math.pow(2,32),B+=ct(L,8)),B/o})[0];return x!==void 0&&(h=x),me(y,["tfhd"]).map(L=>{const M=ct(L,4),B=ct(L,0)&16777215,F=(B&1)!==0,W=(B&2)!==0,_e=(B&8)!==0;let ce=0;const Pe=(B&16)!==0;let Ue=0;const dt=(B&32)!==0;let $e=8;M===l&&(F&&($e+=8),W&&($e+=4),_e&&(ce=ct(L,$e),$e+=4),Pe&&(Ue=ct(L,$e),$e+=4),dt&&($e+=4),t.type==="video"&&(c=Gt(t.codec)),me(y,["trun"]).map(Qe=>{const et=Qe[0],Be=ct(Qe,0)&16777215,Tt=(Be&1)!==0;let ti=0;const hi=(Be&4)!==0,Ti=(Be&256)!==0;let ci=0;const Zt=(Be&512)!==0;let xi=0;const li=(Be&1024)!==0,Si=(Be&2048)!==0;let Ui=0;const Qt=ct(Qe,4);let Yt=8;Tt&&(ti=ct(Qe,Yt),Yt+=4),hi&&(Yt+=4);let hn=ti+g;for(let Fn=0;Fn<Qt;Fn++){if(Ti?(ci=ct(Qe,Yt),Yt+=4):ci=ce,Zt?(xi=ct(Qe,Yt),Yt+=4):xi=Ue,li&&(Yt+=4),Si&&(et===0?Ui=ct(Qe,Yt):Ui=Ce(Qe,Yt),Yt+=4),t.type===G.VIDEO){let dn=0;for(;dn<xi;){const _n=ct(s,hn);if(hn+=4,Le(c,s[hn])){const Xr=s.subarray(hn,hn+_n);Me(Xr,c?2:1,h+Ui/o,n)}hn+=_n,dn+=_n+4}}h+=ci/o}}))})})}),n}function Gt(h){if(!h)return!1;const t=h.substring(0,4);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function Le(h,t){if(h){const n=t>>1&63;return n===39||n===40}else return(t&31)===6}function Me(h,t,n,s){const o=rt(h);let l=0;l+=t;let c=0,d=0,_=0;for(;l<o.length;){c=0;do{if(l>=o.length)break;_=o[l++],c+=_}while(_===255);d=0;do{if(l>=o.length)break;_=o[l++],d+=_}while(_===255);const g=o.length-l;let v=l;if(d<g)l+=d;else if(d>g){se.error(`Malformed SEI payload. ${d} is too small, only ${g} bytes left to parse.`);break}if(c===4){if(o[v++]===181){const x=mt(o,v);if(v+=2,x===49){const L=ct(o,v);if(v+=4,L===1195456820){const M=o[v++];if(M===3){const B=o[v++],F=31&B,W=64&B,_e=W?2+F*3:0,ce=new Uint8Array(_e);if(W){ce[0]=B;for(let Pe=1;Pe<_e;Pe++)ce[Pe]=o[v++]}s.push({type:M,payloadType:c,pts:n,bytes:ce})}}}}}else if(c===5&&d>16){const y=[];for(let M=0;M<16;M++){const B=o[v++].toString(16);y.push(B.length==1?"0"+B:B),(M===3||M===5||M===7||M===9)&&y.push("-")}const x=d-16,L=new Uint8Array(x);for(let M=0;M<x;M++)L[M]=o[v++];s.push({payloadType:c,pts:n,uuid:y.join(""),userData:Rt(L),userDataBytes:L})}}}function rt(h){const t=h.byteLength,n=[];let s=1;for(;s<t-2;)h[s]===0&&h[s+1]===0&&h[s+2]===3?(n.push(s+2),s+=2):s++;if(n.length===0)return h;const o=t-n.length,l=new Uint8Array(o);let c=0;for(s=0;s<o;c++,s++)c===n[0]&&(c++,n.shift()),l[s]=h[c];return l}function bt(h){const t=h[0];let n="",s="",o=0,l=0,c=0,d=0,_=0,g=0;if(t===0){for(;tt(h.subarray(g,g+1))!=="\0";)n+=tt(h.subarray(g,g+1)),g+=1;for(n+=tt(h.subarray(g,g+1)),g+=1;tt(h.subarray(g,g+1))!=="\0";)s+=tt(h.subarray(g,g+1)),g+=1;s+=tt(h.subarray(g,g+1)),g+=1,o=ct(h,12),l=ct(h,16),d=ct(h,20),_=ct(h,24),g=28}else if(t===1){g+=4,o=ct(h,g),g+=4;const y=ct(h,g);g+=4;const x=ct(h,g);for(g+=4,c=wa(2,32)*y+x,we(c)||(c=Number.MAX_SAFE_INTEGER,se.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),d=ct(h,g),g+=4,_=ct(h,g),g+=4;tt(h.subarray(g,g+1))!=="\0";)n+=tt(h.subarray(g,g+1)),g+=1;for(n+=tt(h.subarray(g,g+1)),g+=1;tt(h.subarray(g,g+1))!=="\0";)s+=tt(h.subarray(g,g+1)),g+=1;s+=tt(h.subarray(g,g+1)),g+=1}const v=h.subarray(g,h.byteLength);return{schemeIdUri:n,value:s,timeScale:o,presentationTime:c,presentationTimeDelta:l,eventDuration:d,id:_,payload:v}}function je(h,...t){const n=t.length;let s=8,o=n;for(;o--;)s+=t[o].byteLength;const l=new Uint8Array(s);for(l[0]=s>>24&255,l[1]=s>>16&255,l[2]=s>>8&255,l[3]=s&255,l.set(h,4),o=0,s=8;o<n;o++)l.set(t[o],s),s+=t[o].byteLength;return l}function Mt(h,t,n){if(h.byteLength!==16)throw new RangeError("Invalid system id");let s,o;s=0,o=new Uint8Array;let l;s>0?(l=new Uint8Array(4),t.length>0&&new DataView(l.buffer).setUint32(0,t.length,!1)):l=new Uint8Array;const c=new Uint8Array(4);return n.byteLength>0&&new DataView(c.buffer).setUint32(0,n.byteLength,!1),je([112,115,115,104],new Uint8Array([s,0,0,0]),h,l,o,c,n)}const Ct=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Et={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Nt(h,t){const n=Et[t];return!!n&&!!n[h.slice(0,4)]}function Xt(h,t,n=!0){return!h.split(",").some(s=>!Je(s,t,n))}function Je(h,t,n=!0){var s;const o=Ee(n);return(s=o==null?void 0:o.isTypeSupported(zt(h,t)))!=null?s:!1}function zt(h,t){return`${t}/mp4;codecs=${h}`}function De(h){if(h){const t=h.substring(0,4);return Et.video[t]}return 2}function xe(h){const t=Ct();return h.split(",").reduce((n,s)=>{const l=t&&Gt(s)?9:Et.video[s];return l?(l*2+n)/(n?3:2):(Et.audio[s]+n)/(n?2:1)},0)}const ke={};function U(h,t=!0){if(ke[h])return ke[h];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[h];for(let o=0;o<n.length;o++){var s;if(Je(n[o],"audio",t))return ke[h]=n[o],n[o];if(n[o]==="mp3"&&(s=Ee(t))!=null&&s.isTypeSupported("audio/mpeg"))return""}return h}const j=/flac|opus|mp4a\.40\.34/i;function ae(h,t=!0){return h.replace(j,n=>U(n.toLowerCase(),t))}function ue(h,t){const n=[];if(h){const s=h.split(",");for(let o=0;o<s.length;o++)Nt(s[o],"video")||n.push(s[o])}return t&&n.push(t),n.join(",")}function ve(h,t){if(h&&(h.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(h)!==-1)&&(ht(h,"audio")||ht(h,"video")))return h;if(t){const n=t.split(",");if(n.length>1){if(h){for(let s=n.length;s--;)if(n[s].substring(0,4)===h.substring(0,4))return n[s]}return n[0]}}return t||h}function ht(h,t){return Nt(h,t)&&Je(h,t)}function _t(h){const t=h.split(",");for(let n=0;n<t.length;n++){const s=t[n].split(".");s.length>2&&s[0]==="avc1"&&(t[n]=`avc1.${parseInt(s[1]).toString(16)}${("000"+parseInt(s[2]).toString(16)).slice(-4)}`)}return t.join(",")}function lt(h){if(h.startsWith("av01.")){const t=h.split("."),n=["0","111","01","01","01","0"];for(let s=t.length;s>4&&s<10;s++)t[s]=n[s-4];return t.join(".")}return h}function Vt(h){const t=Ee(h)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function ni(h){return h.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const gi={supported:!0,powerEfficient:!0,smooth:!0},ri={supported:!1,smooth:!1,powerEfficient:!1},Dt={supported:!0,configurations:[],decodingInfoResults:[gi]};function oi(h,t){return{supported:!1,configurations:t,decodingInfoResults:[ri],error:h}}function Mi(h,t,n,s,o,l){const c=h.videoCodec,d=h.audioCodec?h.audioGroups:null,_=l==null?void 0:l.audioCodec,g=l==null?void 0:l.channels,v=g?parseInt(g):_?1/0:2;let y=null;if(d!=null&&d.length)try{d.length===1&&d[0]?y=t.groups[d[0]].channels:y=d.reduce((x,L)=>{if(L){const M=t.groups[L];if(!M)throw new Error(`Audio track group ${L} not found`);Object.keys(M.channels).forEach(B=>{x[B]=(x[B]||0)+M.channels[B]})}return x},{2:0})}catch(x){return!0}return c!==void 0&&(c.split(",").some(x=>Gt(x))||h.width>1920&&h.height>1088||h.height>1920&&h.width>1088||h.frameRate>Math.max(s,30)||h.videoRange!=="SDR"&&h.videoRange!==n||h.bitrate>Math.max(o,8e6))||!!y&&le(v)&&Object.keys(y).some(x=>parseInt(x)>v)}function Ei(h,t,n,s={}){const o=h.videoCodec;if(!o&&!h.audioCodec||!n)return Promise.resolve(Dt);const l=[],c=Oi(h),d=c.length,_=vi(h,t,d>0),g=_.length;for(let v=d||1*g||1;v--;){const y={type:"media-source"};if(d&&(y.video=c[v%d]),g){y.audio=_[v%g];const x=y.audio.bitrate;y.video&&x&&(y.video.bitrate-=x)}l.push(y)}if(o){const v=navigator.userAgent;if(o.split(",").some(y=>Gt(y))&&Ct())return Promise.resolve(oi(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${v})`),l))}return Promise.all(l.map(v=>{const y=Wi(v);return s[y]||(s[y]=n.decodingInfo(v))})).then(v=>({supported:!v.some(y=>!y.supported),configurations:l,decodingInfoResults:v})).catch(v=>({supported:!1,configurations:l,decodingInfoResults:[],error:v}))}function Oi(h){var t;const n=(t=h.videoCodec)==null?void 0:t.split(","),s=zi(h),o=h.width||640,l=h.height||480,c=h.frameRate||30,d=h.videoRange.toLowerCase();return n?n.map(_=>{const g={contentType:zt(lt(_),"video"),width:o,height:l,bitrate:s,framerate:c};return d!=="sdr"&&(g.transferFunction=d),g}):[]}function vi(h,t,n){var s;const o=(s=h.audioCodec)==null?void 0:s.split(","),l=zi(h);return o&&h.audioGroups?h.audioGroups.reduce((c,d)=>{var _;const g=d?(_=t.groups[d])==null?void 0:_.tracks:null;return g?g.reduce((v,y)=>{if(y.groupId===d){const x=parseFloat(y.channels||"");o.forEach(L=>{const M={contentType:zt(L,"audio"),bitrate:n?di(L,l):l};x&&(M.channels=""+x),v.push(M)})}return v},c):c},[]):[]}function di(h,t){if(t<=1)return 1;let n=128e3;return h==="ec-3"?n=768e3:h==="ac-3"&&(n=64e4),Math.min(t/2,n)}function zi(h){return Math.ceil(Math.max(h.bitrate*.9,h.averageBitrate)/1e3)*1e3||1}function Wi(h){let t="";const{audio:n,video:s}=h;if(s){const o=ni(s.contentType);t+=`${o}_r${s.height}x${s.width}f${Math.ceil(s.framerate)}${s.transferFunction||"sd"}_${Math.ceil(s.bitrate/1e5)}`}if(n){const o=ni(n.contentType);t+=`${s?"_":""}${o}_c${n.channels}`}return t}const rn=["NONE","TYPE-0","TYPE-1",null];function Yi(h){return rn.indexOf(h)>-1}const Qn=["SDR","PQ","HLG"];function Di(h){return!!h&&Qn.indexOf(h)>-1}var Ki={No:"",Yes:"YES",v2:"v2"};function vn(h){const{canSkipUntil:t,canSkipDateRanges:n,age:s}=h,o=s<t/2;return t&&o?n?Ki.v2:Ki.Yes:Ki.No}class Ri{constructor(t,n,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=n,this.skip=s}addDirectives(t){const n=new self.URL(t);return this.msn!==void 0&&n.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&n.searchParams.set("_HLS_part",this.part.toString()),this.skip&&n.searchParams.set("_HLS_skip",this.skip),n.href}}class mn{constructor(t){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter(s=>!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in t){var n;this.supplemental=t.supplemental;const s=(n=t.supplemental)==null?void 0:n.videoCodec;s&&s!==t.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(t){return sn(this._audioGroups,t)}hasSubtitleGroup(t){return sn(this._subtitleGroups,t)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(t,n){if(n){if(t==="audio"){let s=this._audioGroups;s||(s=this._audioGroups=[]),s.indexOf(n)===-1&&s.push(n)}else if(t==="text"){let s=this._subtitleGroups;s||(s=this._subtitleGroups=[]),s.indexOf(n)===-1&&s.push(n)}}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return(t=this.audioGroups)==null?void 0:t[0]}get textGroupId(){var t;return(t=this.subtitleGroups)==null?void 0:t[0]}addFallback(){}}function sn(h,t){return!t||!h?!1:h.indexOf(t)!==-1}function rr(){if(typeof matchMedia=="function"){const h=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(h.media!==t.media)return h.matches===!0}return!1}function gn(h,t){let n=!1,s=[];if(h&&(n=h!=="SDR",s=[h]),t){s=t.allowedVideoRanges||Qn.slice(0);const o=s.join("")!=="SDR"&&!t.videoCodec;n=t.preferHDR!==void 0?t.preferHDR:o&&rr(),n||(s=["SDR"])}return{preferHDR:n,allowedVideoRanges:s}}const cr=h=>{const t=new WeakSet;return(n,s)=>{if(h&&(s=h(n,s)),typeof s=="object"&&s!==null){if(t.has(s))return;t.add(s)}return s}},Qi=(h,t)=>JSON.stringify(h,cr(t));function ki(h,t,n,s,o){const l=Object.keys(h),c=s==null?void 0:s.channels,d=s==null?void 0:s.audioCodec,_=o==null?void 0:o.videoCodec,g=c&&parseInt(c)===2;let v=!1,y=!1,x=1/0,L=1/0,M=1/0,B=1/0,F=0,W=[];const{preferHDR:_e,allowedVideoRanges:ce}=gn(t,o);for(let Qe=l.length;Qe--;){const et=h[l[Qe]];v||(v=et.channels[2]>0),x=Math.min(x,et.minHeight),L=Math.min(L,et.minFramerate),M=Math.min(M,et.minBitrate),ce.filter(Tt=>et.videoRanges[Tt]>0).length>0&&(y=!0)}x=le(x)?x:0,L=le(L)?L:0;const Pe=Math.max(1080,x),Ue=Math.max(30,L);M=le(M)?M:n,n=Math.max(M,n),y||(t=void 0);const dt=l.length>1;return{codecSet:l.reduce((Qe,et)=>{const Be=h[et];if(et===Qe)return Qe;if(W=y?ce.filter(Tt=>Be.videoRanges[Tt]>0):[],dt){if(Be.minBitrate>n)return ii(et,`min bitrate of ${Be.minBitrate} > current estimate of ${n}`),Qe;if(!Be.hasDefaultAudio)return ii(et,"no renditions with default or auto-select sound found"),Qe;if(d&&et.indexOf(d.substring(0,4))%5!==0)return ii(et,`audio codec preference "${d}" not found`),Qe;if(c&&!g){if(!Be.channels[c])return ii(et,`no renditions with ${c} channel sound found (channels options: ${Object.keys(Be.channels)})`),Qe}else if((!d||g)&&v&&Be.channels[2]===0)return ii(et,"no renditions with stereo sound found"),Qe;if(Be.minHeight>Pe)return ii(et,`min resolution of ${Be.minHeight} > maximum of ${Pe}`),Qe;if(Be.minFramerate>Ue)return ii(et,`min framerate of ${Be.minFramerate} > maximum of ${Ue}`),Qe;if(!W.some(Tt=>Be.videoRanges[Tt]>0))return ii(et,`no variants with VIDEO-RANGE of ${Qi(W)} found`),Qe;if(_&&et.indexOf(_.substring(0,4))%5!==0)return ii(et,`video codec preference "${_}" not found`),Qe;if(Be.maxScore<F)return ii(et,`max score of ${Be.maxScore} < selected max of ${F}`),Qe}return Qe&&(xe(et)>=xe(Qe)||Be.fragmentError>h[Qe].fragmentError)?Qe:(B=Be.minIndex,F=Be.maxScore,et)},void 0),videoRanges:W,preferHDR:_e,minFramerate:L,minBitrate:M,minIndex:B}}function ii(h,t){se.log(`[abr] start candidates with "${h}" ignored because ${t}`)}function Re(h){return h.reduce((t,n)=>{let s=t.groups[n.groupId];s||(s=t.groups[n.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(n);const o=n.channels||"2";return s.channels[o]=(s.channels[o]||0)+1,s.hasDefault=s.hasDefault||n.default,s.hasAutoSelect=s.hasAutoSelect||n.autoselect,s.hasDefault&&(t.hasDefaultAudio=!0),s.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function it(h,t,n,s){return h.slice(n,s+1).reduce((o,l,c)=>{if(!l.codecSet)return o;const d=l.audioGroups;let _=o[l.codecSet];_||(o[l.codecSet]=_={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:c,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!d,fragmentError:0}),_.minBitrate=Math.min(_.minBitrate,l.bitrate);const g=Math.min(l.height,l.width);return _.minHeight=Math.min(_.minHeight,g),_.minFramerate=Math.min(_.minFramerate,l.frameRate),_.minIndex=Math.min(_.minIndex,c),_.maxScore=Math.max(_.maxScore,l.score),_.fragmentError+=l.fragmentError,_.videoRanges[l.videoRange]=(_.videoRanges[l.videoRange]||0)+1,d&&d.forEach(v=>{if(!v)return;const y=t.groups[v];y&&(_.hasDefaultAudio=_.hasDefaultAudio||t.hasDefaultAudio?y.hasDefault:y.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(y.channels).forEach(x=>{_.channels[x]=(_.channels[x]||0)+y.channels[x]}))}),o},{})}function xt(h){if(!h)return h;const{lang:t,assocLang:n,characteristics:s,channels:o,audioCodec:l}=h;return{lang:t,assocLang:n,characteristics:s,channels:o,audioCodec:l}}function nt(h,t,n){if("attrs"in h){const s=t.indexOf(h);if(s!==-1)return s}for(let s=0;s<t.length;s++){const o=t[s];if(At(h,o,n))return s}return-1}function At(h,t,n){const{groupId:s,name:o,lang:l,assocLang:c,default:d}=h,_=h.forced;return(s===void 0||t.groupId===s)&&(o===void 0||t.name===o)&&(l===void 0||st(l,t.lang))&&(l===void 0||t.assocLang===c)&&(d===void 0||t.default===d)&&(_===void 0||t.forced===_)&&(!("characteristics"in h)||ft(h.characteristics||"",t.characteristics))&&(n===void 0||n(h,t))}function st(h,t="--"){return h.length===t.length?h===t:h.startsWith(t)||t.startsWith(h)}function ft(h,t=""){const n=h.split(","),s=t.split(",");return n.length===s.length&&!n.some(o=>s.indexOf(o)===-1)}function Pt(h,t){const{audioCodec:n,channels:s}=h;return(n===void 0||(t.audioCodec||"").substring(0,4)===n.substring(0,4))&&(s===void 0||s===(t.channels||"2"))}function Jt(h,t,n,s,o){const l=t[s],d=t.reduce((x,L,M)=>{const B=L.uri;return(x[B]||(x[B]=[])).push(M),x},{})[l.uri];d.length>1&&(s=Math.max.apply(Math,d));const _=l.videoRange,g=l.frameRate,v=l.codecSet.substring(0,4),y=pi(t,s,x=>{if(x.videoRange!==_||x.frameRate!==g||x.codecSet.substring(0,4)!==v)return!1;const L=x.audioGroups,M=n.filter(B=>!L||L.indexOf(B.groupId)!==-1);return nt(h,M,o)>-1});return y>-1?y:pi(t,s,x=>{const L=x.audioGroups,M=n.filter(B=>!L||L.indexOf(B.groupId)!==-1);return nt(h,M,o)>-1})}function pi(h,t,n){for(let s=t;s>-1;s--)if(n(h[s]))return s;for(let s=t+1;s<h.length;s++)if(n(h[s]))return s;return-1}function Zi(h,t){var n;return!!h&&h!==((n=t.loadLevelObj)==null?void 0:n.uri)}class _i extends H{constructor(t){super("abr",t.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=n=>{var s;const{fragCurrent:o,partCurrent:l,hls:c}=this,{autoLevelEnabled:d,media:_}=c;if(!o||!_)return;const g=performance.now(),v=l?l.stats:o.stats,y=l?l.duration:o.duration,x=g-v.loading.start,L=c.minAutoLevel,M=o.level,B=this._nextAutoLevel;if(v.aborted||v.loaded&&v.loaded===v.total||M<=L){this.clearTimer(),this._nextAutoLevel=-1;return}if(!d)return;const F=B>-1&&B!==M,W=!!n||F;if(!W&&(_.paused||!_.playbackRate||!_.readyState))return;const _e=c.mainForwardBufferInfo;if(!W&&_e===null)return;const ce=this.bwEstimator.getEstimateTTFB(),Pe=Math.abs(_.playbackRate);if(x<=Math.max(ce,1e3*(y/(Pe*2))))return;const Ue=_e?_e.len/Pe:0,dt=v.loading.first?v.loading.first-v.loading.start:-1,$e=v.loaded&&dt>-1,Qe=this.getBwEstimate(),et=c.levels,Be=et[M],Tt=Math.max(v.loaded,Math.round(y*(o.bitrate||Be.averageBitrate)/8));let ti=$e?x-dt:x;ti<1&&$e&&(ti=Math.min(x,v.loaded*8/Qe));const hi=$e?v.loaded*1e3/ti:0,Ti=ce/1e3,ci=hi?(Tt-v.loaded)/hi:Tt*8/Qe+Ti;if(ci<=Ue)return;const Zt=hi?hi*8:Qe,xi=((s=(n==null?void 0:n.details)||this.hls.latestLevelDetails)==null?void 0:s.live)===!0,li=this.hls.config.abrBandWidthUpFactor;let Si=Number.POSITIVE_INFINITY,Ui;for(Ui=M-1;Ui>L;Ui--){const Fn=et[Ui].maxBitrate,dn=!et[Ui].details||xi;if(Si=this.getTimeToLoadFrag(Ti,Zt,y*Fn,dn),Si<Math.min(Ue,y+Ti))break}if(Si>=ci||Si>y*10)return;$e?this.bwEstimator.sample(x-Math.min(ce,dt),v.loaded):this.bwEstimator.sampleTTFB(x);const Qt=et[Ui].maxBitrate;this.getBwEstimate()*li>Qt&&this.resetEstimator(Qt);const Yt=this.findBestLevel(Qt,L,Ui,0,Ue,1,1);Yt>-1&&(Ui=Yt),this.warn(`Fragment ${o.sn}${l?" part "+l.index:""} of level ${M} is loading too slowly;
Fragment duration: ${o.duration.toFixed(3)}
Time to underbuffer: ${Ue.toFixed(3)} s
Estimated load time for current fragment: ${ci.toFixed(3)} s
Estimated load time for down switch fragment: ${Si.toFixed(3)} s
TTFB estimate: ${dt|0} ms
Current BW estimate: ${le(Qe)?Qe|0:"Unknown"} bps
New BW estimate: ${this.getBwEstimate()|0} bps
Switching to level ${Ui} @ ${Qt|0} bps`),c.nextLoadLevel=c.nextAutoLevel=Ui,this.clearTimer();const hn=()=>{if(this.clearTimer(),this.fragCurrent===o&&this.hls.loadLevel===Ui&&Ui>0){const Fn=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${Ui>0?"and switching down":""}
Fragment duration: ${o.duration.toFixed(3)} s
Time to underbuffer: ${Fn.toFixed(3)} s`),o.abortRequests(),this.fragCurrent=this.partCurrent=null,Ui>L){let dn=this.findBestLevel(this.hls.levels[L].bitrate,L,Ui,0,Fn,1,1);dn===-1&&(dn=L),this.hls.nextLoadLevel=this.hls.nextAutoLevel=dn,this.resetEstimator(this.hls.levels[dn].bitrate)}}};F||ci>Si*2?hn():this.timer=self.setInterval(hn,Si*1e3),c.trigger(S.FRAG_LOAD_EMERGENCY_ABORTED,{frag:o,part:l,stats:v})},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(t){t&&(this.log(`setting initial bwe to ${t}`),this.hls.config.abrEwmaDefaultEstimate=t),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const t=this.hls.config;return new ie(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)}registerListeners(){const{hls:t}=this;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.FRAG_LOADING,this.onFragLoading,this),t.on(S.FRAG_LOADED,this.onFragLoaded,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this),t.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.FRAG_LOADING,this.onFragLoading,this),t.off(S.FRAG_LOADED,this.onFragLoaded,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this),t.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off(S.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,n){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(t,n){const s=n.frag;if(!this.ignoreFragment(s)){if(!s.bitrateTest){var o;this.fragCurrent=s,this.partCurrent=(o=n.part)!=null?o:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(t,n){this.clearTimer()}onError(t,n){if(!n.fatal)switch(n.details){case Z.BUFFER_ADD_CODEC_ERROR:case Z.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Z.FRAG_LOAD_TIMEOUT:{const s=n.frag,{fragCurrent:o,partCurrent:l}=this;if(s&&o&&s.sn===o.sn&&s.level===o.level){const c=performance.now(),d=l?l.stats:s.stats,_=c-d.loading.start,g=d.loading.first?d.loading.first-d.loading.start:-1;if(d.loaded&&g>-1){const y=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(_-Math.min(y,g),d.loaded)}else this.bwEstimator.sampleTTFB(_)}break}}}getTimeToLoadFrag(t,n,s,o){const l=t+s/n,c=o?t+this.lastLevelLoadSec:0;return l+c}onLevelLoaded(t,n){const s=this.hls.config,{loading:o}=n.stats,l=o.end-o.first;le(l)&&(this.lastLevelLoadSec=l/1e3),n.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(n.levelInfo)}onFragLoaded(t,{frag:n,part:s}){const o=s?s.stats:n.stats;if(n.type===P.MAIN&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(n)){if(this.clearTimer(),n.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const l=s?s.duration:n.duration,c=this.hls.levels[n.level],d=(c.loaded?c.loaded.bytes:0)+o.loaded,_=(c.loaded?c.loaded.duration:0)+l;c.loaded={bytes:d,duration:_},c.realBitrate=Math.round(8*d/_)}if(n.bitrateTest){const l={stats:o,frag:n,part:s,id:n.type};this.onFragBuffered(S.FRAG_BUFFERED,l),n.bitrateTest=!1}else this.lastLoadedFragLevel=n.level}}onFragBuffered(t,n){const{frag:s,part:o}=n,l=o!=null&&o.stats.loaded?o.stats:s.stats;if(l.aborted||this.ignoreFragment(s))return;const c=l.parsing.end-l.loading.start-Math.min(l.loading.first-l.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(c,l.loaded),l.bwEstimate=this.getBwEstimate(),s.bitrateTest?this.bitrateTestDelay=c/1e3:this.bitrateTestDelay=0}ignoreFragment(t){return t.type!==P.MAIN||t.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:t,minAutoLevel:n}=this.hls,s=this.getBwEstimate(),o=this.hls.config.maxStarvationDelay,l=this.findBestLevel(s,n,t,0,o,1,1);if(l>-1)return l;const c=this.hls.firstLevel,d=Math.min(Math.max(c,n),t);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${c} clamped to ${d}`),d}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const t=this.forcedAutoLevel,s=this.bwEstimator.canEstimate(),o=this.lastLoadedFragLevel>-1;if(t!==-1&&(!s||!o||this.nextAutoLevelKey===this.getAutoLevelKey()))return t;const l=s&&o?this.getNextABRAutoLevel():this.firstAutoLevel;if(t!==-1){const c=this.hls.levels;if(c.length>Math.max(t,l)&&c[t].loadError<=c[l].loadError)return t}return this._nextAutoLevel=l,this.nextAutoLevelKey=this.getAutoLevelKey(),l}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:t,partCurrent:n,hls:s}=this;if(s.levels.length<=1)return s.loadLevel;const{maxAutoLevel:o,config:l,minAutoLevel:c}=s,d=n?n.duration:t?t.duration:0,_=this.getBwEstimate(),g=this.getStarvationDelay();let v=l.abrBandWidthFactor,y=l.abrBandWidthUpFactor;if(g){const F=this.findBestLevel(_,c,o,g,0,v,y);if(F>=0)return this.rebufferNotice=-1,F}let x=d?Math.min(d,l.maxStarvationDelay):l.maxStarvationDelay;if(!g){const F=this.bitrateTestDelay;F&&(x=(d?Math.min(d,l.maxLoadingDelay):l.maxLoadingDelay)-F,this.info(`bitrate test took ${Math.round(1e3*F)}ms, set first fragment max fetchDuration to ${Math.round(1e3*x)} ms`),v=y=1)}const L=this.findBestLevel(_,c,o,g,x,v,y);if(this.rebufferNotice!==L&&(this.rebufferNotice=L,this.info(`${g?"rebuffering expected":"buffer is empty"}, optimal quality level ${L}`)),L>-1)return L;const M=s.levels[c],B=s.loadLevelObj;return B&&(M==null?void 0:M.bitrate)<B.bitrate?c:s.loadLevel}getStarvationDelay(){const t=this.hls,n=t.media;if(!n)return 1/0;const s=n&&n.playbackRate!==0?Math.abs(n.playbackRate):1,o=t.mainForwardBufferInfo;return(o?o.len:0)/s}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(t,n,s,o,l,c,d){var _;const g=o+l,v=this.lastLoadedFragLevel,y=v===-1?this.hls.firstLevel:v,{fragCurrent:x,partCurrent:L}=this,{levels:M,allAudioTracks:B,loadLevel:F,config:W}=this.hls;if(M.length===1)return 0;const _e=M[y],ce=!!((_=this.hls.latestLevelDetails)!=null&&_.live),Pe=F===-1||v===-1;let Ue,dt="SDR",$e=(_e==null?void 0:_e.frameRate)||0;const{audioPreference:Qe,videoPreference:et}=W,Be=this.audioTracksByGroup||(this.audioTracksByGroup=Re(B));let Tt=-1;if(Pe){if(this.firstSelection!==-1)return this.firstSelection;const Zt=this.codecTiers||(this.codecTiers=it(M,Be,n,s)),xi=ki(Zt,dt,t,Qe,et),{codecSet:li,videoRanges:Si,minFramerate:Ui,minBitrate:Qt,minIndex:Yt,preferHDR:hn}=xi;Tt=Yt,Ue=li,dt=hn?Si[Si.length-1]:Si[0],$e=Ui,t=Math.max(t,Qt),this.log(`picked start tier ${Qi(xi)}`)}else Ue=_e==null?void 0:_e.codecSet,dt=_e==null?void 0:_e.videoRange;const ti=L?L.duration:x?x.duration:0,hi=this.bwEstimator.getEstimateTTFB()/1e3,Ti=[];for(let Zt=s;Zt>=n;Zt--){var ci;const xi=M[Zt],li=Zt>y;if(!xi)continue;if(W.useMediaCapabilities&&!xi.supportedResult&&!xi.supportedPromise){const dn=navigator.mediaCapabilities;typeof(dn==null?void 0:dn.decodingInfo)=="function"&&Mi(xi,Be,dt,$e,t,Qe)?(xi.supportedPromise=Ei(xi,Be,dn,this.supportedCache),xi.supportedPromise.then(_n=>{if(!this.hls)return;xi.supportedResult=_n;const Xr=this.hls.levels,zr=Xr.indexOf(xi);_n.error?this.warn(`MediaCapabilities decodingInfo error: "${_n.error}" for level ${zr} ${Qi(_n)}`):_n.supported?_n.decodingInfoResults.some(gs=>gs.smooth===!1||gs.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${zr} not smooth or powerEfficient: ${Qi(_n)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${zr} ${Qi(_n)}`),zr>-1&&Xr.length>1&&(this.log(`Removing unsupported level ${zr}`),this.hls.removeLevel(zr),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(_n=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${_n}`)})):xi.supportedResult=Dt}if((Ue&&xi.codecSet!==Ue||dt&&xi.videoRange!==dt||li&&$e>xi.frameRate||!li&&$e>0&&$e<xi.frameRate||(ci=xi.supportedResult)!=null&&(ci=ci.decodingInfoResults)!=null&&ci.some(dn=>dn.smooth===!1))&&(!Pe||Zt!==Tt)){Ti.push(Zt);continue}const Si=xi.details,Ui=(L?Si==null?void 0:Si.partTarget:Si==null?void 0:Si.averagetargetduration)||ti;let Qt;li?Qt=d*t:Qt=c*t;const Yt=ti&&o>=ti*2&&l===0?xi.averageBitrate:xi.maxBitrate,hn=this.getTimeToLoadFrag(hi,Qt,Yt*Ui,Si===void 0);if(Qt>=Yt&&(Zt===v||xi.loadError===0&&xi.fragmentError===0)&&(hn<=hi||!le(hn)||ce&&!this.bitrateTestDelay||hn<g)){const dn=this.forcedAutoLevel;return Zt!==F&&(dn===-1||dn!==F)&&(Ti.length&&this.trace(`Skipped level(s) ${Ti.join(",")} of ${s} max with CODECS and VIDEO-RANGE:"${M[Ti[0]].codecs}" ${M[Ti[0]].videoRange}; not compatible with "${Ue}" ${dt}`),this.info(`switch candidate:${y}->${Zt} adjustedbw(${Math.round(Qt)})-bitrate=${Math.round(Qt-Yt)} ttfb:${hi.toFixed(1)} avgDuration:${Ui.toFixed(1)} maxFetchDuration:${g.toFixed(1)} fetchDuration:${hn.toFixed(1)} firstSelection:${Pe} codecSet:${xi.codecSet} videoRange:${xi.videoRange} hls.loadLevel:${F}`)),Pe&&(this.firstSelection=Zt),Zt}}return-1}set nextAutoLevel(t){const n=this.deriveNextAutoLevel(t);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}deriveNextAutoLevel(t){const{maxAutoLevel:n,minAutoLevel:s}=this.hls;return Math.min(Math.max(t,s),n)}}const Fi={search:function(h,t){let n=0,s=h.length-1,o=null,l=null;for(;n<=s;){o=(n+s)/2|0,l=h[o];const c=t(l);if(c>0)n=o+1;else if(c<0)s=o-1;else return l}return null}};function Pi(h,t,n){if(t===null||!Array.isArray(h)||!h.length||!le(t))return null;const s=h[0].programDateTime;if(t<(s||0))return null;const o=h[h.length-1].endProgramDateTime;if(t>=(o||0))return null;for(let l=0;l<h.length;++l){const c=h[l];if(Bi(t,n,c))return c}return null}function Ni(h,t,n=0,s=0,o=.005){let l=null;if(h){l=t[1+h.sn-t[0].sn]||null;const d=h.endDTS-n;d>0&&d<15e-7&&(n+=15e-7),l&&h.level!==l.level&&l.end<=h.end&&(l=t[2+h.sn-t[0].sn]||null)}else n===0&&t[0].start===0&&(l=t[0]);if(l&&((!h||h.level===l.level)&&wi(n,s,l)===0||Gi(l,h,Math.min(o,s))))return l;const c=Fi.search(t,wi.bind(null,n,s));return c&&(c!==h||!l)?c:l}function Gi(h,t,n){if(t&&t.start===0&&t.level<h.level&&(t.endPTS||0)>0){const s=t.tagList.reduce((o,l)=>(l[0]==="INF"&&(o+=parseFloat(l[1])),o),n);return h.start<=s}return!1}function wi(h=0,t=0,n){if(n.start<=h&&n.start+n.duration>h)return 0;const s=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-s<=h?1:n.start-s>h&&n.start?-1:0}function Bi(h,t,n){const s=Math.min(t,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-s>h}function un(h,t,n){if(h&&h.startCC<=t&&h.endCC>=t){let s=h.fragments;const{fragmentHint:o}=h;o&&(s=s.concat(o));let l;return Fi.search(s,c=>c.cc<t?1:c.cc>t?-1:(l=c,c.end<=n?1:c.start>n?-1:0)),l||null}return null}function $i(h){switch(h.details){case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_TIMEOUT:case Z.LEVEL_LOAD_TIMEOUT:case Z.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Ai(h,t){const n=$i(t);return h.default[`${n?"timeout":"error"}Retry`]}function Xi(h,t){const n=h.backoff==="linear"?1:Math.pow(2,t);return Math.min(n*h.retryDelayMs,h.maxRetryDelayMs)}function Hi(h){return C(C({},h),{errorRetry:null,timeoutRetry:null})}function en(h,t,n,s){if(!h)return!1;const o=s==null?void 0:s.code,l=t<h.maxNumRetry&&(Nn(o)||!!n);return h.shouldRetry?h.shouldRetry(h,t,n,s,l):l}function Nn(h){return cn(h)||!!h&&(h<400||h>499)}function cn(h){return h===0&&navigator.onLine===!1}var tn={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},ji={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8};class In extends H{constructor(t){super("error-controller",t.logger),this.hls=void 0,this.playlistError=0,this.hls=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on(S.ERROR,this.onError,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const t=this.hls;t&&(t.off(S.ERROR,this.onError,this),t.off(S.ERROR,this.onErrorOut,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(t){}stopLoad(){this.playlistError=0}getVariantLevelIndex(t){return(t==null?void 0:t.type)===P.MAIN?t.level:this.getVariantIndex()}getVariantIndex(){var t;const n=this.hls,s=n.currentLevel;return(t=n.loadLevelObj)!=null&&t.details||s===-1?n.loadLevel:s}variantHasKey(t,n){if(t){var s;if((s=t.details)!=null&&s.hasKey(n))return!0;const o=t.audioGroups;if(o)return this.hls.allAudioTracks.filter(c=>o.indexOf(c.groupId)>=0).some(c=>{var d;return(d=c.details)==null?void 0:d.hasKey(n)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(t,n){var s;if(n.fatal)return;const o=this.hls,l=n.context;switch(n.details){case Z.FRAG_LOAD_ERROR:case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_ERROR:case Z.KEY_LOAD_TIMEOUT:n.errorAction=this.getFragRetryOrSwitchAction(n);return;case Z.FRAG_PARSING_ERROR:if((s=n.frag)!=null&&s.gap){n.errorAction=$n();return}case Z.FRAG_GAP:case Z.FRAG_DECRYPT_ERROR:{n.errorAction=this.getFragRetryOrSwitchAction(n),n.errorAction.action=tn.SendAlternateToPenaltyBox;return}case Z.LEVEL_EMPTY_ERROR:case Z.LEVEL_PARSING_ERROR:{var c;const _=n.parent===P.MAIN?n.level:o.loadLevel;n.details===Z.LEVEL_EMPTY_ERROR&&((c=n.context)!=null&&(c=c.levelDetails)!=null&&c.live)?n.errorAction=this.getPlaylistRetryOrSwitchAction(n,_):(n.levelRetry=!1,n.errorAction=this.getLevelSwitchAction(n,_))}return;case Z.LEVEL_LOAD_ERROR:case Z.LEVEL_LOAD_TIMEOUT:typeof(l==null?void 0:l.level)=="number"&&(n.errorAction=this.getPlaylistRetryOrSwitchAction(n,l.level));return;case Z.AUDIO_TRACK_LOAD_ERROR:case Z.AUDIO_TRACK_LOAD_TIMEOUT:case Z.SUBTITLE_LOAD_ERROR:case Z.SUBTITLE_TRACK_LOAD_TIMEOUT:if(l){const _=o.loadLevelObj;if(_&&(l.type===Ae.AUDIO_TRACK&&_.hasAudioGroup(l.groupId)||l.type===Ae.SUBTITLE_TRACK&&_.hasSubtitleGroup(l.groupId))){n.errorAction=this.getPlaylistRetryOrSwitchAction(n,o.loadLevel),n.errorAction.action=tn.SendAlternateToPenaltyBox,n.errorAction.flags=ji.MoveAllAlternatesMatchingHost;return}}return;case Z.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:n.errorAction={action:tn.SendAlternateToPenaltyBox,flags:ji.MoveAllAlternatesMatchingHDCP};return;case Z.KEY_SYSTEM_SESSION_UPDATE_FAILED:case Z.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case Z.KEY_SYSTEM_NO_SESSION:n.errorAction={action:tn.SendAlternateToPenaltyBox,flags:ji.MoveAllAlternatesMatchingKey};return;case Z.BUFFER_ADD_CODEC_ERROR:case Z.REMUX_ALLOC_ERROR:case Z.BUFFER_APPEND_ERROR:if(!n.errorAction){var d;n.errorAction=this.getLevelSwitchAction(n,(d=n.level)!=null?d:o.loadLevel)}return;case Z.INTERNAL_EXCEPTION:case Z.BUFFER_APPENDING_ERROR:case Z.BUFFER_FULL_ERROR:case Z.LEVEL_SWITCH_ERROR:case Z.BUFFER_STALLED_ERROR:case Z.BUFFER_SEEK_OVER_HOLE:case Z.BUFFER_NUDGE_ON_STALL:n.errorAction=$n();return}n.type===pe.KEY_SYSTEM_ERROR&&(n.levelRetry=!1,n.errorAction=$n())}getPlaylistRetryOrSwitchAction(t,n){const s=this.hls,o=Ai(s.config.playlistLoadPolicy,t),l=this.playlistError++;if(en(o,l,$i(t),t.response))return{action:tn.RetryRequest,flags:ji.None,retryConfig:o,retryCount:l};const d=this.getLevelSwitchAction(t,n);return o&&(d.retryConfig=o,d.retryCount=l),d}getFragRetryOrSwitchAction(t){const n=this.hls,s=this.getVariantLevelIndex(t.frag),o=n.levels[s],{fragLoadPolicy:l,keyLoadPolicy:c}=n.config,d=Ai(t.details.startsWith("key")?c:l,t),_=n.levels.reduce((v,y)=>v+y.fragmentError,0);if(o&&(t.details!==Z.FRAG_GAP&&o.fragmentError++,en(d,_,$i(t),t.response)))return{action:tn.RetryRequest,flags:ji.None,retryConfig:d,retryCount:_};const g=this.getLevelSwitchAction(t,s);return d&&(g.retryConfig=d,g.retryCount=_),g}getLevelSwitchAction(t,n){const s=this.hls;n==null&&(n=s.loadLevel);const o=this.hls.levels[n];if(o){var l,c;const g=t.details;o.loadError++,g===Z.BUFFER_APPEND_ERROR&&o.fragmentError++;let v=-1;const{levels:y,loadLevel:x,minAutoLevel:L,maxAutoLevel:M}=s;!s.autoLevelEnabled&&!s.config.preserveManualLevelOnError&&(s.loadLevel=-1);const B=(l=t.frag)==null?void 0:l.type,W=(B===P.AUDIO&&g===Z.FRAG_PARSING_ERROR||t.sourceBufferName==="audio"&&(g===Z.BUFFER_ADD_CODEC_ERROR||g===Z.BUFFER_APPEND_ERROR))&&y.some(({audioCodec:dt})=>o.audioCodec!==dt),ce=t.sourceBufferName==="video"&&(g===Z.BUFFER_ADD_CODEC_ERROR||g===Z.BUFFER_APPEND_ERROR)&&y.some(({codecSet:dt,audioCodec:$e})=>o.codecSet!==dt&&o.audioCodec===$e),{type:Pe,groupId:Ue}=(c=t.context)!=null?c:{};for(let dt=y.length;dt--;){const $e=(dt+x)%y.length;if($e!==x&&$e>=L&&$e<=M&&y[$e].loadError===0){var d,_;const Qe=y[$e];if(g===Z.FRAG_GAP&&B===P.MAIN&&t.frag){const et=y[$e].details;if(et){const Be=Ni(t.frag,et.fragments,t.frag.start);if(Be!=null&&Be.gap)continue}}else{if(Pe===Ae.AUDIO_TRACK&&Qe.hasAudioGroup(Ue)||Pe===Ae.SUBTITLE_TRACK&&Qe.hasSubtitleGroup(Ue))continue;if(B===P.AUDIO&&(d=o.audioGroups)!=null&&d.some(et=>Qe.hasAudioGroup(et))||B===P.SUBTITLE&&(_=o.subtitleGroups)!=null&&_.some(et=>Qe.hasSubtitleGroup(et))||W&&o.audioCodec===Qe.audioCodec||ce&&o.codecSet===Qe.codecSet||!W&&o.codecSet!==Qe.codecSet)continue}v=$e;break}}if(v>-1&&s.loadLevel!==v)return t.levelRetry=!0,this.playlistError=0,{action:tn.SendAlternateToPenaltyBox,flags:ji.None,nextAutoLevel:v}}return{action:tn.SendAlternateToPenaltyBox,flags:ji.MoveAllAlternatesMatchingHost}}onErrorOut(t,n){var s;switch((s=n.errorAction)==null?void 0:s.action){case tn.DoNothing:break;case tn.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(n),!n.errorAction.resolved&&n.details!==Z.FRAG_GAP?n.fatal=!0:/MediaSource readyState: ended/.test(n.error.message)&&(this.warn(`MediaSource ended after "${n.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break;case tn.RetryRequest:break}if(n.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(t){const n=this.hls,s=t.errorAction;if(!s)return;const{flags:o}=s,l=s.nextAutoLevel;switch(o){case ji.None:this.switchLevel(t,l);break;case ji.MoveAllAlternatesMatchingHDCP:{const _=this.getVariantLevelIndex(t.frag),g=n.levels[_],v=g==null?void 0:g.attrs["HDCP-LEVEL"];if(s.hdcpLevel=v,v){n.maxHdcpLevel=rn[rn.indexOf(v)-1],s.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${n.maxHdcpLevel}" or lower`);break}}case ji.MoveAllAlternatesMatchingKey:{const _=t.decryptdata;if(_){const g=this.hls.levels;for(let v=g.length;v--;)if(this.variantHasKey(g[v],_)){var c,d;this.log(`Banned key found in level ${v} (${g[v].bitrate}bps) or audio group "${(c=g[v].audioGroups)==null?void 0:c.join(",")}" (${(d=t.frag)==null?void 0:d.type} fragment) ${te(_.keyId||[])}`),g[v].fragmentError++,g[v].loadError++,this.log(`Removing level ${v} with key error (${t.error})`),this.hls.removeLevel(v)}g.length&&(s.resolved=!0)}break}}s.resolved||this.switchLevel(t,l)}switchLevel(t,n){if(n!==void 0&&t.errorAction&&(this.warn(`switching to level ${n} after ${t.details}`),this.hls.nextAutoLevel=n,t.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,t.details===Z.BUFFER_ADD_CODEC_ERROR&&t.mimeType&&t.sourceBufferName!=="audiovideo")){const s=ni(t.mimeType),o=this.hls.levels;for(let l=o.length;l--;)o[l][`${t.sourceBufferName}Codec`]===s&&(this.log(`Removing level ${l} for ${t.details} ("${s}" not supported)`),this.hls.removeLevel(l))}}}function $n(h){const t={action:tn.DoNothing,flags:ji.None};return h&&(t.resolved=!0),t}var Vi={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class bn{constructor(t){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=t,this._registerListeners()}_registerListeners(){const{hls:t}=this;t&&(t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.BUFFER_APPENDED,this.onBufferAppended,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this),t.on(S.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.BUFFER_APPENDED,this.onBufferAppended,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this),t.off(S.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,n){const s=this.activePartLists[n];if(s)for(let o=s.length;o--;){const l=s[o];if(!l)break;if(l.start<=t&&t<=l.end&&l.loaded)return l}return this.getBufferedFrag(t,n)}getBufferedFrag(t,n){return this.getFragAtPos(t,n,!0)}getFragAtPos(t,n,s){const{fragments:o}=this,l=Object.keys(o);for(let c=l.length;c--;){const d=o[l[c]];if((d==null?void 0:d.body.type)===n&&(!s||d.buffered)){const _=d.body;if(_.start<=t&&t<=_.end)return _}}return null}detectEvictedFragments(t,n,s,o,l){this.timeRanges&&(this.timeRanges[t]=n);const c=(o==null?void 0:o.fragment.sn)||-1;Object.keys(this.fragments).forEach(d=>{const _=this.fragments[d];if(!_||c>=_.body.sn)return;if(!_.buffered&&(!_.loaded||l)){_.body.type===s&&this.removeFragment(_.body);return}const g=_.range[t];if(g){if(g.time.length===0){this.removeFragment(_.body);return}g.time.some(v=>{const y=!this.isTimeBuffered(v.startPTS,v.endPTS,n);return y&&this.removeFragment(_.body),y})}})}detectPartialFragments(t){const n=this.timeRanges;if(!n||t.frag.sn==="initSegment")return;const s=t.frag,o=wn(s),l=this.fragments[o];if(!l||l.buffered&&s.gap)return;const c=!s.relurl;Object.keys(n).forEach(d=>{const _=s.elementaryStreams[d];if(!_)return;const g=n[d],v=c||_.partial===!0;l.range[d]=this.getBufferedTimes(s,t.part,v,g)}),l.loaded=null,Object.keys(l.range).length?(l.buffered=!0,(l.body.endList=s.endList||l.body.endList)&&(this.endListFragments[l.body.type]=l),xn(l)||this.removeParts(s.sn-1,s.type)):this.removeFragment(l.body)}removeParts(t,n){const s=this.activePartLists[n];s&&(this.activePartLists[n]=gr(s,o=>o.fragment.sn>=t))}fragBuffered(t,n){const s=wn(t);let o=this.fragments[s];!o&&n&&(o=this.fragments[s]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),o&&(o.loaded=null,o.buffered=!0)}getBufferedTimes(t,n,s,o){const l={time:[],partial:s},c=t.start,d=t.end,_=t.minEndPTS||d,g=t.maxStartPTS||c;for(let v=0;v<o.length;v++){const y=o.start(v)-this.bufferPadding,x=o.end(v)+this.bufferPadding;if(g>=y&&_<=x){l.time.push({startPTS:Math.max(c,o.start(v)),endPTS:Math.min(d,o.end(v))});break}else if(c<x&&d>y){const L=Math.max(c,o.start(v)),M=Math.min(d,o.end(v));M>L&&(l.partial=!0,l.time.push({startPTS:L,endPTS:M}))}else if(d<=y)break}return l}getPartialFragment(t){let n=null,s,o,l,c=0;const{bufferPadding:d,fragments:_}=this;return Object.keys(_).forEach(g=>{const v=_[g];v&&xn(v)&&(o=v.body.start-d,l=v.body.end+d,t>=o&&t<=l&&(s=Math.min(t-o,l-t),c<=s&&(n=v.body,c=s)))}),n}isEndListAppended(t){const n=this.endListFragments[t];return n!==void 0&&(n.buffered||xn(n))}getState(t){const n=wn(t),s=this.fragments[n];return s?s.buffered?xn(s)?Vi.PARTIAL:Vi.OK:Vi.APPENDING:Vi.NOT_LOADED}isTimeBuffered(t,n,s){let o,l;for(let c=0;c<s.length;c++){if(o=s.start(c)-this.bufferPadding,l=s.end(c)+this.bufferPadding,t>=o&&n<=l)return!0;if(n<=o)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(t,n){if(n.frag.sn==="initSegment"||n.frag.bitrateTest)return;const s=n.frag,o=n.part?null:n,l=wn(s);this.fragments[l]={body:s,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}onBufferAppended(t,n){const{frag:s,part:o,timeRanges:l,type:c}=n;if(s.sn==="initSegment")return;const d=s.type;if(o){let g=this.activePartLists[d];g||(this.activePartLists[d]=g=[]),g.push(o)}this.timeRanges=l;const _=l[c];this.detectEvictedFragments(c,_,d,o)}onFragBuffered(t,n){this.detectPartialFragments(n)}hasFragment(t){const n=wn(t);return!!this.fragments[n]}hasFragments(t){const{fragments:n}=this,s=Object.keys(n);if(!t)return s.length>0;for(let o=s.length;o--;){const l=n[s[o]];if((l==null?void 0:l.body.type)===t)return!0}return!1}hasParts(t){var n;return!!((n=this.activePartLists[t])!=null&&n.length)}removeFragmentsInRange(t,n,s,o,l){o&&!this.hasGaps||Object.keys(this.fragments).forEach(c=>{const d=this.fragments[c];if(!d)return;const _=d.body;_.type!==s||o&&!_.gap||_.start<n&&_.end>t&&(d.buffered||l)&&this.removeFragment(_)})}removeFragment(t){const n=wn(t);t.clearElementaryStreamInfo();const s=this.activePartLists[t.type];if(s){const o=t.sn;this.activePartLists[t.type]=gr(s,l=>l.fragment.sn!==o)}delete this.fragments[n],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){var t;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const n=(t=this.hls)==null||(t=t.latestLevelDetails)==null?void 0:t.partList;n&&n.forEach(s=>s.clearElementaryStreamInfo())}}function xn(h){var t,n,s;return h.buffered&&!!(h.body.gap||(t=h.range.video)!=null&&t.partial||(n=h.range.audio)!=null&&n.partial||(s=h.range.audiovideo)!=null&&s.partial)}function wn(h){return`${h.type}_${h.level}_${h.sn}`}function gr(h,t){return h.filter(n=>{const s=t(n);return s||n.clearElementaryStreamInfo(),s})}var an={cbc:0,ctr:1};class Ln{constructor(t,n,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=n,this.aesMode=s}decrypt(t,n){switch(this.aesMode){case an.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,t);case an.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},n,t);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function fr(h){const t=h.byteLength,n=t&&new DataView(h.buffer).getUint8(t-1);return n?h.slice(0,t-n):h}class Or{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(t){const n=new DataView(t),s=new Uint32Array(4);for(let o=0;o<4;o++)s[o]=n.getUint32(o*4);return s}initTable(){const t=this.sBox,n=this.invSBox,s=this.subMix,o=s[0],l=s[1],c=s[2],d=s[3],_=this.invSubMix,g=_[0],v=_[1],y=_[2],x=_[3],L=new Uint32Array(256);let M=0,B=0,F=0;for(F=0;F<256;F++)F<128?L[F]=F<<1:L[F]=F<<1^283;for(F=0;F<256;F++){let W=B^B<<1^B<<2^B<<3^B<<4;W=W>>>8^W&255^99,t[M]=W,n[W]=M;const _e=L[M],ce=L[_e],Pe=L[ce];let Ue=L[W]*257^W*16843008;o[M]=Ue<<24|Ue>>>8,l[M]=Ue<<16|Ue>>>16,c[M]=Ue<<8|Ue>>>24,d[M]=Ue,Ue=Pe*16843009^ce*65537^_e*257^M*16843008,g[W]=Ue<<24|Ue>>>8,v[W]=Ue<<16|Ue>>>16,y[W]=Ue<<8|Ue>>>24,x[W]=Ue,M?(M=_e^L[L[L[Pe^_e]]],B^=L[L[B]]):M=B=1}}expandKey(t){const n=this.uint8ArrayToUint32Array_(t);let s=!0,o=0;for(;o<n.length&&s;)s=n[o]===this.key[o],o++;if(s)return;this.key=n;const l=this.keySize=n.length;if(l!==4&&l!==6&&l!==8)throw new Error("Invalid aes key size="+l);const c=this.ksRows=(l+6+1)*4;let d,_;const g=this.keySchedule=new Uint32Array(c),v=this.invKeySchedule=new Uint32Array(c),y=this.sBox,x=this.rcon,L=this.invSubMix,M=L[0],B=L[1],F=L[2],W=L[3];let _e,ce;for(d=0;d<c;d++){if(d<l){_e=g[d]=n[d];continue}ce=_e,d%l===0?(ce=ce<<8|ce>>>24,ce=y[ce>>>24]<<24|y[ce>>>16&255]<<16|y[ce>>>8&255]<<8|y[ce&255],ce^=x[d/l|0]<<24):l>6&&d%l===4&&(ce=y[ce>>>24]<<24|y[ce>>>16&255]<<16|y[ce>>>8&255]<<8|y[ce&255]),g[d]=_e=(g[d-l]^ce)>>>0}for(_=0;_<c;_++)d=c-_,_&3?ce=g[d]:ce=g[d-4],_<4||d<=4?v[_]=ce:v[_]=M[y[ce>>>24]]^B[y[ce>>>16&255]]^F[y[ce>>>8&255]]^W[y[ce&255]],v[_]=v[_]>>>0}networkToHostOrderSwap(t){return t<<24|(t&65280)<<8|(t&16711680)>>8|t>>>24}decrypt(t,n,s){const o=this.keySize+6,l=this.invKeySchedule,c=this.invSBox,d=this.invSubMix,_=d[0],g=d[1],v=d[2],y=d[3],x=this.uint8ArrayToUint32Array_(s);let L=x[0],M=x[1],B=x[2],F=x[3];const W=new Int32Array(t),_e=new Int32Array(W.length);let ce,Pe,Ue,dt,$e,Qe,et,Be,Tt,ti,hi,Ti,ci,Zt;const xi=this.networkToHostOrderSwap;for(;n<W.length;){for(Tt=xi(W[n]),ti=xi(W[n+1]),hi=xi(W[n+2]),Ti=xi(W[n+3]),$e=Tt^l[0],Qe=Ti^l[1],et=hi^l[2],Be=ti^l[3],ci=4,Zt=1;Zt<o;Zt++)ce=_[$e>>>24]^g[Qe>>16&255]^v[et>>8&255]^y[Be&255]^l[ci],Pe=_[Qe>>>24]^g[et>>16&255]^v[Be>>8&255]^y[$e&255]^l[ci+1],Ue=_[et>>>24]^g[Be>>16&255]^v[$e>>8&255]^y[Qe&255]^l[ci+2],dt=_[Be>>>24]^g[$e>>16&255]^v[Qe>>8&255]^y[et&255]^l[ci+3],$e=ce,Qe=Pe,et=Ue,Be=dt,ci=ci+4;ce=c[$e>>>24]<<24^c[Qe>>16&255]<<16^c[et>>8&255]<<8^c[Be&255]^l[ci],Pe=c[Qe>>>24]<<24^c[et>>16&255]<<16^c[Be>>8&255]<<8^c[$e&255]^l[ci+1],Ue=c[et>>>24]<<24^c[Be>>16&255]<<16^c[$e>>8&255]<<8^c[Qe&255]^l[ci+2],dt=c[Be>>>24]<<24^c[$e>>16&255]<<16^c[Qe>>8&255]<<8^c[et&255]^l[ci+3],_e[n]=xi(ce^L),_e[n+1]=xi(dt^M),_e[n+2]=xi(Ue^B),_e[n+3]=xi(Pe^F),L=Tt,M=ti,B=hi,F=Ti,n=n+4}return _e.buffer}}class dr{constructor(t,n,s){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=n,this.aesMode=s}expandKey(){const t=Fr(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}function Fr(h){switch(h){case an.cbc:return"AES-CBC";case an.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${h}`)}}const Dn=16;class qn{constructor(t,{removePKCS7Padding:n=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=t.enableSoftwareAES,this.removePKCS7Padding=n,n)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(s){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:t,remainderData:n}=this;if(!t||n)return this.reset(),null;const s=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?fr(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(t,n,s,o){return this.useSoftware?new Promise((l,c)=>{const d=ArrayBuffer.isView(t)?t:new Uint8Array(t);this.softwareDecrypt(d,n,s,o);const _=this.flush();_?l(_.buffer):c(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(t),n,s,o)}softwareDecrypt(t,n,s,o){const{currentIV:l,currentResult:c,remainderData:d}=this;if(o!==an.cbc||n.byteLength!==16)return se.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),d&&(t=yt(d,t),this.remainderData=null);const _=this.getValidChunk(t);if(!_.length)return null;l&&(s=l);let g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new Or),g.expandKey(n);const v=c;return this.currentResult=g.decrypt(_.buffer,0,s),this.currentIV=_.slice(-16).buffer,v||null}webCryptoDecrypt(t,n,s,o){if(this.key!==n||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,n,s,o));this.key=n,this.fastAesKey=new dr(this.subtle,n,o)}return this.fastAesKey.expandKey().then(l=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Ln(this.subtle,new Uint8Array(s),o).decrypt(t.buffer,l)):Promise.reject(new Error("web crypto not initialized"))).catch(l=>(se.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${l.name}: ${l.message}`),this.onWebCryptoError(t,n,s,o)))}onWebCryptoError(t,n,s,o){const l=this.enableSoftwareAES;if(l){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,n,s,o);const c=this.flush();if(c)return c.buffer}throw new Error("WebCrypto"+(l?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(t){let n=t;const s=t.length-t.length%Dn;return s!==t.length&&(n=t.slice(0,s),this.remainderData=t.slice(s)),n}logOnce(t){this.logEnabled&&(se.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const Ar=Math.pow(2,17);class Lr{constructor(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(t,n){const s=t.url;if(!s)return Promise.reject(new Kn({type:pe.NETWORK_ERROR,details:Z.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error(`Fragment does not have a ${s?"part list":"url"}`),networkDetails:null}));this.abort();const o=this.config,l=o.fLoader,c=o.loader;return new Promise((d,_)=>{if(this.loader&&this.loader.destroy(),t.gap)if(t.tagList.some(M=>M[0]==="GAP")){_(Pn(t));return}else t.gap=!1;const g=this.loader=l?new l(o):new c(o),v=_r(t);t.loader=g;const y=Hi(o.fragLoadPolicy.default),x={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:t.sn==="initSegment"?1/0:Ar};t.stats=g.stats;const L={onSuccess:(M,B,F,W)=>{this.resetLoader(t,g);let _e=M.data;F.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(_e.slice(0,16)),_e=_e.slice(16)),d({frag:t,part:null,payload:_e,networkDetails:W})},onError:(M,B,F,W)=>{this.resetLoader(t,g),_(new Kn({type:pe.NETWORK_ERROR,details:Z.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:C({url:s,data:void 0},M),error:new Error(`HTTP Error ${M.code} ${M.text}`),networkDetails:F,stats:W}))},onAbort:(M,B,F)=>{this.resetLoader(t,g),_(new Kn({type:pe.NETWORK_ERROR,details:Z.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:F,stats:M}))},onTimeout:(M,B,F)=>{this.resetLoader(t,g),_(new Kn({type:pe.NETWORK_ERROR,details:Z.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${x.timeout}ms`),networkDetails:F,stats:M}))}};n&&(L.onProgress=(M,B,F,W)=>n({frag:t,part:null,payload:F,networkDetails:W})),g.load(v,x,L)})}loadPart(t,n,s){this.abort();const o=this.config,l=o.fLoader,c=o.loader;return new Promise((d,_)=>{if(this.loader&&this.loader.destroy(),t.gap||n.gap){_(Pn(t,n));return}const g=this.loader=l?new l(o):new c(o),v=_r(t,n);t.loader=g;const y=Hi(o.fragLoadPolicy.default),x={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Ar};n.stats=g.stats,g.load(v,x,{onSuccess:(L,M,B,F)=>{this.resetLoader(t,g),this.updateStatsFromPart(t,n);const W={frag:t,part:n,payload:L.data,networkDetails:F};s(W),d(W)},onError:(L,M,B,F)=>{this.resetLoader(t,g),_(new Kn({type:pe.NETWORK_ERROR,details:Z.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:n,response:C({url:v.url,data:void 0},L),error:new Error(`HTTP Error ${L.code} ${L.text}`),networkDetails:B,stats:F}))},onAbort:(L,M,B)=>{t.stats.aborted=n.stats.aborted,this.resetLoader(t,g),_(new Kn({type:pe.NETWORK_ERROR,details:Z.INTERNAL_ABORTED,fatal:!1,frag:t,part:n,error:new Error("Aborted"),networkDetails:B,stats:L}))},onTimeout:(L,M,B)=>{this.resetLoader(t,g),_(new Kn({type:pe.NETWORK_ERROR,details:Z.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:n,error:new Error(`Timeout after ${x.timeout}ms`),networkDetails:B,stats:L}))}})})}updateStatsFromPart(t,n){const s=t.stats,o=n.stats,l=o.total;if(s.loaded+=o.loaded,l){const _=Math.round(t.duration/n.duration),g=Math.min(Math.round(s.loaded/l),_),y=(_-g)*Math.round(s.loaded/g);s.total=s.loaded+y}else s.total=Math.max(s.loaded,s.total);const c=s.loading,d=o.loading;c.start?c.first+=d.first-d.start:(c.start=d.start,c.first=d.first),c.end=d.end}resetLoader(t,n){t.loader=null,this.loader===n&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),n.destroy()}}function _r(h,t=null){const n=t||h,s={frag:h,part:t,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},o=n.byteRangeStartOffset,l=n.byteRangeEndOffset;if(le(o)&&le(l)){var c;let d=o,_=l;if(h.sn==="initSegment"&&pr((c=h.decryptdata)==null?void 0:c.method)){const g=l-o;g%16&&(_=l+(16-g%16)),o!==0&&(s.resetIV=!0,d=o-16)}s.rangeStart=d,s.rangeEnd=_}return s}function Pn(h,t){const n=new Error(`GAP ${h.gap?"tag":"attribute"} found`),s={type:pe.MEDIA_ERROR,details:Z.FRAG_GAP,fatal:!1,frag:h,error:n,networkDetails:null};return t&&(s.part=t),(t||h).stats.aborted=!0,new Kn(s)}function pr(h){return h==="AES-128"||h==="AES-256"}class Kn extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class Br extends H{constructor(t,n){super(t,n),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(t){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!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 Sn{constructor(t,n,s,o=0,l=-1,c=!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=er(),this.buffering={audio:er(),video:er(),audiovideo:er()},this.level=t,this.sn=n,this.id=s,this.size=o,this.part=l,this.partial=c}}function er(){return{start:0,executeStart:0,executeEnd:0,end:0}}const kr={length:0,start:()=>0,end:()=>0};class mi{static isBuffered(t,n){if(t){const s=mi.getBuffered(t);for(let o=s.length;o--;)if(n>=s.start(o)&&n<=s.end(o))return!0}return!1}static bufferedRanges(t){if(t){const n=mi.getBuffered(t);return mi.timeRangesToArray(n)}return[]}static timeRangesToArray(t){const n=[];for(let s=0;s<t.length;s++)n.push({start:t.start(s),end:t.end(s)});return n}static bufferInfo(t,n,s){if(t){const o=mi.bufferedRanges(t);if(o.length)return mi.bufferedInfo(o,n,s)}return{len:0,start:n,end:n,bufferedIndex:-1}}static bufferedInfo(t,n,s){n=Math.max(0,n),t.length>1&&t.sort((v,y)=>v.start-y.start||y.end-v.end);let o=-1,l=[];if(s)for(let v=0;v<t.length;v++){n>=t[v].start&&n<=t[v].end&&(o=v);const y=l.length;if(y){const x=l[y-1].end;t[v].start-x<s?t[v].end>x&&(l[y-1].end=t[v].end):l.push(t[v])}else l.push(t[v])}else l=t;let c=0,d,_=n,g=n;for(let v=0;v<l.length;v++){const y=l[v].start,x=l[v].end;if(o===-1&&n>=y&&n<=x&&(o=v),n+s>=y&&n<x)_=y,g=x,c=g-n;else if(n+s<y){d=y;break}}return{len:c,start:_||0,end:g||0,nextStart:d,buffered:t,bufferedIndex:o}}static getBuffered(t){try{return t.buffered||kr}catch(n){return se.log("failed to get media.buffered",n),kr}}}const es=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ji(h){return es.test(h)}function bi(h,t){if(h.variableList!==null||h.hasVariableRefs){const n=h.variableList;return t.replace(es,s=>{const o=s.substring(2,s.length-1),l=n==null?void 0:n[o];return l===void 0?(h.playlistParsingError||(h.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${o}"`)),s):l})}return t}function nn(h,t,n){let s=h.variableList;s||(h.variableList=s={});let o,l;if("QUERYPARAM"in t){o=t.QUERYPARAM;try{const c=new self.URL(n).searchParams;if(c.has(o))l=c.get(o);else throw new Error(`"${o}" does not match any query parameter in URI: "${n}"`)}catch(c){h.playlistParsingError||(h.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${c.message}`))}}else o=t.NAME,l=t.VALUE;o in s?h.playlistParsingError||(h.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${o}"`)):s[o]=l||""}function En(h,t,n){const s=t.IMPORT;if(n&&s in n){let o=h.variableList;o||(h.variableList=o={}),o[s]=n[s]}else h.playlistParsingError||(h.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const vr=/^(\d+)x(\d+)$/,Wn=/(.+?)=(".*?"|.*?)(?:,|$)/g;class qi{constructor(t,n){typeof t=="string"&&(t=qi.parseAttrList(t,n)),k(this,t)}get clientAttrs(){return Object.keys(this).filter(t=>t.substring(0,2)==="X-")}decimalInteger(t){const n=parseInt(this[t],10);return n>Number.MAX_SAFE_INTEGER?1/0:n}hexadecimalInteger(t){if(this[t]){let n=(this[t]||"0x").slice(2);n=(n.length&1?"0":"")+n;const s=new Uint8Array(n.length/2);for(let o=0;o<n.length/2;o++)s[o]=parseInt(n.slice(o*2,o*2+2),16);return s}return null}hexadecimalIntegerAsNumber(t){const n=parseInt(this[t],16);return n>Number.MAX_SAFE_INTEGER?1/0:n}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,n){const s=this[t];return s?parseFloat(s):n}enumeratedString(t){return this[t]}enumeratedStringList(t,n){const s=this[t];return(s?s.split(/[ ,]+/):[]).reduce((o,l)=>(o[l.toLowerCase()]=!0,o),n)}bool(t){return this[t]==="YES"}decimalResolution(t){const n=vr.exec(this[t]);if(n!==null)return{width:parseInt(n[1],10),height:parseInt(n[2],10)}}static parseAttrList(t,n){let s;const o={},l='"';for(Wn.lastIndex=0;(s=Wn.exec(t))!==null;){const c=s[1].trim();let d=s[2];const _=d.indexOf(l)===0&&d.lastIndexOf(l)===d.length-1;let g=!1;if(_)d=d.slice(1,-1);else switch(c){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":g=!0}if(n&&(_||g))d=bi(n,d);else if(!g&&!_)switch(c){case"CLOSED-CAPTIONS":if(d==="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":se.warn(`${t}: attribute ${c} is missing quotes`)}o[c]=d}return o}}const Un="com.apple.hls.interstitial";function ls(h){return h!=="ID"&&h!=="CLASS"&&h!=="CUE"&&h!=="START-DATE"&&h!=="DURATION"&&h!=="END-DATE"&&h!=="END-ON-NEXT"}function Dr(h){return h==="SCTE35-OUT"||h==="SCTE35-IN"||h==="SCTE35-CMD"}class us{constructor(t,n,s=0){var o;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=(n==null?void 0:n.tagAnchor)||null,this.tagOrder=(o=n==null?void 0:n.tagOrder)!=null?o:s,n){const l=n.attr;for(const c in l)if(Object.prototype.hasOwnProperty.call(t,c)&&t[c]!==l[c]){se.warn(`DATERANGE tag attribute: "${c}" does not match for tags with ID: "${t.ID}"`),this._badValueForSameId=c;break}t=k(new qi({}),l,t)}if(this.attr=t,n?(this._startDate=n._startDate,this._cue=n._cue,this._endDate=n._endDate,this._dateAtEnd=n._dateAtEnd):this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){const l=(n==null?void 0:n.endDate)||new Date(this.attr["END-DATE"]);le(l.getTime())&&(this._endDate=l)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const t=this._cue;return t===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):t}get startTime(){const{tagAnchor:t}=this;return t===null||t.programDateTime===null?(se.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${t}`),NaN):t.start+(this.startDate.getTime()-t.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const t=this._endDate||this._dateAtEnd;if(t)return t;const n=this.duration;return n!==null?this._dateAtEnd=new Date(this._startDate.getTime()+n*1e3):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(le(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===Un}get isValid(){return!!this.id&&!this._badValueForSameId&&le(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 cs=10;class rs{constructor(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}reloaded(t){if(!t){this.advanced=!0,this.updated=!0;return}const n=this.lastPartSn-t.lastPartSn,s=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!s||!!n||!this.live,this.advanced=this.endSN>t.endSN||n>0||n===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(t.misses*.6):this.misses=t.misses+1}hasKey(t){return this.encryptedFragments.some(n=>{let s=n.decryptdata;return s||(n.setKeyFormat(t.keyFormat),s=n.decryptdata),!!s&&t.matches(s)})}get hasProgramDateTime(){return this.fragments.length?le(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||cs}get drift(){const t=this.driftEndTime-this.driftStartTime;return t>0?(this.driftEnd-this.driftStart)*1e3/t:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const t=this.partList;if(t){const n=this.lastPartIndex;if(n!==-1){for(let s=t.length;s--;)if(t[s].index>n)return t[s].index;return n}}return 0}get lastPartSn(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const t=this.partEnd-this.fragmentStart;return this.age>Math.max(t,this.totalduration)+this.levelTargetDuration}return!1}}function tr(h,t){return h.length===t.length?!h.some((n,s)=>n!==t[s]):!1}function Wr(h,t){return!h&&!t?!0:!h||!t?!1:tr(h,t)}function Nr(h){return h==="AES-128"||h==="AES-256"||h==="AES-256-CTR"}function hr(h){switch(h){case"AES-128":case"AES-256":return an.cbc;case"AES-256-CTR":return an.ctr;default:throw new Error(`invalid full segment method ${h}`)}}function zn(h){return Uint8Array.from(atob(h),t=>t.charCodeAt(0))}function sr(h){return Uint8Array.from(unescape(encodeURIComponent(h)),t=>t.charCodeAt(0))}function yr(h){const t=sr(h).subarray(0,16),n=new Uint8Array(16);return n.set(t,16-t.length),n}function ys(h){const t=function(s,o,l){const c=s[o];s[o]=s[l],s[l]=c};t(h,0,3),t(h,1,2),t(h,4,5),t(h,6,7)}function bs(h){const t=h.split(":");let n=null;if(t[0]==="data"&&t.length===2){const s=t[1].split(";"),o=s[s.length-1].split(",");if(o.length===2){const l=o[0]==="base64",c=o[1];l?(s.splice(-1,1),n=zn(c)):n=yr(c)}}return n}const Ms=typeof self!="undefined"?self:void 0;var Vn={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},mr={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function $s(h){switch(h){case mr.FAIRPLAY:return Vn.FAIRPLAY;case mr.PLAYREADY:return Vn.PLAYREADY;case mr.WIDEVINE:return Vn.WIDEVINE;case mr.CLEARKEY:return Vn.CLEARKEY}}function ui(h){switch(h){case Vn.FAIRPLAY:return mr.FAIRPLAY;case Vn.PLAYREADY:return mr.PLAYREADY;case Vn.WIDEVINE:return mr.WIDEVINE;case Vn.CLEARKEY:return mr.CLEARKEY}}function Li(h){const{drmSystems:t,widevineLicenseUrl:n}=h,s=t?[Vn.FAIRPLAY,Vn.WIDEVINE,Vn.PLAYREADY,Vn.CLEARKEY].filter(o=>!!t[o]):[];return!s[Vn.WIDEVINE]&&n&&s.push(Vn.WIDEVINE),s}const Cn=function(h){return Ms!=null&&(h=Ms.navigator)!=null&&h.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function ar(h,t,n,s){let o;switch(h){case Vn.FAIRPLAY:o=["cenc","sinf"];break;case Vn.WIDEVINE:case Vn.PLAYREADY:o=["cenc"];break;case Vn.CLEARKEY:o=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${h}`)}return kn(o,t,n,s)}function kn(h,t,n,s){return[{initDataTypes:h,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map(l=>({contentType:`audio/mp4; codecs=${l}`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null})),videoCapabilities:n.map(l=>({contentType:`video/mp4; codecs=${l}`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null}))}]}function hs(h){var t;return!!h&&(h.sessionType==="persistent-license"||!!((t=h.sessionTypes)!=null&&t.some(n=>n==="persistent-license")))}function or(h){const t=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/2),n=String.fromCharCode.apply(null,Array.from(t)),s=n.substring(n.indexOf("<"),n.length),c=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(c){const d=c.childNodes[0]?c.childNodes[0].nodeValue:c.getAttribute("VALUE");if(d){const _=zn(d).subarray(0,16);return ys(_),_}}return null}let ss={};class jr{static clearKeyUriToKeyIdMap(){ss={}}constructor(t,n,s,o=[1],l=null,c){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=n,this.keyFormat=s,this.keyFormatVersions=o,this.iv=l,this.encrypted=t?t!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!Nr(t),c!=null&&c.startsWith("0x")&&(this.keyId=new Uint8Array(z(c)))}matches(t){return t.uri===this.uri&&t.method===this.method&&t.encrypted===this.encrypted&&t.keyFormat===this.keyFormat&&tr(t.keyFormatVersions,this.keyFormatVersions)&&Wr(t.iv,this.iv)&&Wr(t.keyId,this.keyId)}isSupported(){if(this.method){if(Nr(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case mr.FAIRPLAY:case mr.WIDEVINE:case mr.PLAYREADY:case mr.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(t){if(!this.encrypted||!this.uri)return null;if(Nr(this.method)&&this.uri&&!this.iv){typeof t!="number"&&(se.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0);const s=Sa(t);return new jr(this.method,this.uri,"identity",this.keyFormatVersions,s)}if(this.pssh&&this.keyId)return this;const n=bs(this.uri);if(n)switch(this.keyFormat){case mr.WIDEVINE:if(this.pssh=n,!this.keyId&&n.length>=22){const s=n.length-22;this.keyId=n.subarray(s,s+16)}break;case mr.PLAYREADY:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Mt(s,null,n),this.keyId=or(n);break}default:{let s=n.subarray(0,16);if(s.length!==16){const o=new Uint8Array(16);o.set(s,16-s.length),s=o}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=ss[this.uri];if(!s){const o=Object.keys(ss).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,o),ss[this.uri]=s}this.keyId=s}return this}}function Sa(h){const t=new Uint8Array(16);for(let n=12;n<16;n++)t[n]=h>>8*(15-n)&255;return t}const hl=/#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,Ea=/#EXT-X-MEDIA:(.*)/g,Ks=/^#EXT(?:INF|-X-TARGETDURATION):/m,la=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),lr=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(t,n){for(let s=0;s<t.length;s++){const o=t[s];if(o.id===n)return o}}static resolve(t,n){return A.buildAbsoluteURL(n,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return Ks.test(t)}static parseMasterPlaylist(t,n){const s=Ji(t),o={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:s},l=[];hl.lastIndex=0;let c;for(;(c=hl.exec(t))!=null;)if(c[1]){var d;const g=new qi(c[1],o),v=bi(o,c[2]),y={attrs:g,bitrate:g.decimalInteger("BANDWIDTH")||g.decimalInteger("AVERAGE-BANDWIDTH"),name:g.NAME,url:qr.resolve(v,n)},x=g.decimalResolution("RESOLUTION");x&&(y.width=x.width,y.height=x.height),as(g.CODECS,y);const L=g["SUPPLEMENTAL-CODECS"];L&&(y.supplemental={},as(L,y.supplemental)),(d=y.unknownCodecs)!=null&&d.length||l.push(y),o.levels.push(y)}else if(c[3]){const g=c[3],v=c[4];switch(g){case"SESSION-DATA":{const y=new qi(v,o),x=y["DATA-ID"];x&&(o.sessionData===null&&(o.sessionData={}),o.sessionData[x]=y);break}case"SESSION-KEY":{const y=Eo(v,n,o);y.encrypted&&y.isSupported()?(o.sessionKeys===null&&(o.sessionKeys=[]),o.sessionKeys.push(y)):se.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${v}"`);break}case"DEFINE":{{const y=new qi(v,o);nn(o,y,n)}break}case"CONTENT-STEERING":{const y=new qi(v,o);o.contentSteering={uri:qr.resolve(y["SERVER-URI"],n),pathwayId:y["PATHWAY-ID"]||"."};break}case"START":{o.startTimeOffset=ko(v);break}}}const _=l.length>0&&l.length<o.levels.length;return o.levels=_?l:o.levels,o.levels.length===0&&(o.playlistParsingError=new Error("no levels found in manifest")),o}static parseMasterPlaylistMedia(t,n,s){let o;const l={},c=s.levels,d={AUDIO:c.map(g=>({id:g.attrs.AUDIO,audioCodec:g.audioCodec})),SUBTITLES:c.map(g=>({id:g.attrs.SUBTITLES,textCodec:g.textCodec})),"CLOSED-CAPTIONS":[]};let _=0;for(Ea.lastIndex=0;(o=Ea.exec(t))!==null;){const g=new qi(o[1],s),v=g.TYPE;if(v){const y=d[v],x=l[v]||[];l[v]=x;const L=g.LANGUAGE,M=g["ASSOC-LANGUAGE"],B=g.CHANNELS,F=g.CHARACTERISTICS,W=g["INSTREAM-ID"],_e={attrs:g,bitrate:0,id:_++,groupId:g["GROUP-ID"]||"",name:g.NAME||L||"",type:v,default:g.bool("DEFAULT"),autoselect:g.bool("AUTOSELECT"),forced:g.bool("FORCED"),lang:L,url:g.URI?qr.resolve(g.URI,n):""};if(M&&(_e.assocLang=M),B&&(_e.channels=B),F&&(_e.characteristics=F),W&&(_e.instreamId=W),y!=null&&y.length){const ce=qr.findGroup(y,_e.groupId)||y[0];To(_e,ce,"audioCodec"),To(_e,ce,"textCodec")}x.push(_e)}}return l}static parseLevelPlaylist(t,n,s,o,l,c){var d;const _={url:n},g=new rs(n),v=g.fragments,y=[];let x=null,L=0,M=0,B=0,F=0,W=0,_e=null,ce=new pt(o,_),Pe,Ue,dt,$e=-1,Qe=!1,et=null,Be;if(la.lastIndex=0,g.m3u8=t,g.hasVariableRefs=Ji(t),((d=la.exec(t))==null?void 0:d[0])!=="#EXTM3U")return g.playlistParsingError=new Error("Missing format identifier #EXTM3U"),g;for(;(Pe=la.exec(t))!==null;){Qe&&(Qe=!1,ce=new pt(o,_),ce.playlistOffset=B,ce.setStart(B),ce.sn=L,ce.cc=F,W&&(ce.bitrate=W),ce.level=s,x&&(ce.initSegment=x,x.rawProgramDateTime&&(ce.rawProgramDateTime=x.rawProgramDateTime,x.rawProgramDateTime=null),et&&(ce.setByteRange(et),et=null)));const Ti=Pe[1];if(Ti){ce.duration=parseFloat(Ti);const ci=(" "+Pe[2]).slice(1);ce.title=ci||null,ce.tagList.push(ci?["INF",Ti,ci]:["INF",Ti])}else if(Pe[3]){if(le(ce.duration)){ce.playlistOffset=B,ce.setStart(B),dt&&dl(ce,dt,g),ce.sn=L,ce.level=s,ce.cc=F,v.push(ce);const ci=(" "+Pe[3]).slice(1);ce.relurl=bi(g,ci),qa(ce,_e,y),_e=ce,B+=ce.duration,L++,M=0,Qe=!0}}else{if(Pe=Pe[0].match(lr),!Pe){se.warn("No matches on slow regex match for level playlist!");continue}for(Ue=1;Ue<Pe.length&&Pe[Ue]===void 0;Ue++);const ci=(" "+Pe[Ue]).slice(1),Zt=(" "+Pe[Ue+1]).slice(1),xi=Pe[Ue+2]?(" "+Pe[Ue+2]).slice(1):null;switch(ci){case"BYTERANGE":_e?ce.setByteRange(Zt,_e):ce.setByteRange(Zt);break;case"PROGRAM-DATE-TIME":ce.rawProgramDateTime=Zt,ce.tagList.push(["PROGRAM-DATE-TIME",Zt]),$e===-1&&($e=v.length);break;case"PLAYLIST-TYPE":g.type&&ws(g,ci,Pe),g.type=Zt.toUpperCase();break;case"MEDIA-SEQUENCE":g.startSN!==0?ws(g,ci,Pe):v.length>0&&Ta(g,ci,Pe),L=g.startSN=parseInt(Zt);break;case"SKIP":{g.skippedSegments&&ws(g,ci,Pe);const li=new qi(Zt,g),Si=li.decimalInteger("SKIPPED-SEGMENTS");if(le(Si)){g.skippedSegments+=Si;for(let Qt=Si;Qt--;)v.push(null);L+=Si}const Ui=li.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ui&&(g.recentlyRemovedDateranges=(g.recentlyRemovedDateranges||[]).concat(Ui.split(" ")));break}case"TARGETDURATION":g.targetduration!==0&&ws(g,ci,Pe),g.targetduration=Math.max(parseInt(Zt),1);break;case"VERSION":g.version!==null&&ws(g,ci,Pe),g.version=parseInt(Zt);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":g.live||ws(g,ci,Pe),g.live=!1;break;case"#":(Zt||xi)&&ce.tagList.push(xi?[Zt,xi]:[Zt]);break;case"DISCONTINUITY":F++,ce.tagList.push(["DIS"]);break;case"GAP":ce.gap=!0,ce.tagList.push([ci]);break;case"BITRATE":ce.tagList.push([ci,Zt]),W=parseInt(Zt)*1e3,le(W)?ce.bitrate=W:W=0;break;case"DATERANGE":{const li=new qi(Zt,g),Si=new us(li,g.dateRanges[li.ID],g.dateRangeTagCount);g.dateRangeTagCount++,Si.isValid||g.skippedSegments?g.dateRanges[Si.id]=Si:se.warn(`Ignoring invalid DATERANGE tag: "${Zt}"`),ce.tagList.push(["EXT-X-DATERANGE",Zt]);break}case"DEFINE":{{const li=new qi(Zt,g);"IMPORT"in li?En(g,li,c):nn(g,li,n)}break}case"DISCONTINUITY-SEQUENCE":g.startCC!==0?ws(g,ci,Pe):v.length>0&&Ta(g,ci,Pe),g.startCC=F=parseInt(Zt);break;case"KEY":{const li=Eo(Zt,n,g);if(li.isSupported()){if(li.method==="NONE"){dt=void 0;break}dt||(dt={});const Si=dt[li.keyFormat];Si!=null&&Si.matches(li)||(Si&&(dt=k({},dt)),dt[li.keyFormat]=li)}else se.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${Zt}"`);break}case"START":g.startTimeOffset=ko(Zt);break;case"MAP":{const li=new qi(Zt,g);if(ce.duration){const Si=new pt(o,_);fl(Si,li,s,dt),x=Si,ce.initSegment=x,x.rawProgramDateTime&&!ce.rawProgramDateTime&&(ce.rawProgramDateTime=x.rawProgramDateTime)}else{const Si=ce.byteRangeEndOffset;if(Si){const Ui=ce.byteRangeStartOffset;et=`${Si-Ui}@${Ui}`}else et=null;fl(ce,li,s,dt),x=ce,Qe=!0}x.cc=F;break}case"SERVER-CONTROL":{Be&&ws(g,ci,Pe),Be=new qi(Zt),g.canBlockReload=Be.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=Be.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&Be.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=Be.optionalFloat("PART-HOLD-BACK",0),g.holdBack=Be.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{g.partTarget&&ws(g,ci,Pe);const li=new qi(Zt);g.partTarget=li.decimalFloatingPoint("PART-TARGET");break}case"PART":{let li=g.partList;li||(li=g.partList=[]);const Si=M>0?li[li.length-1]:void 0,Ui=M++,Qt=new qi(Zt,g),Yt=new Ut(Qt,ce,_,Ui,Si);li.push(Yt),ce.duration+=Yt.duration;break}case"PRELOAD-HINT":{const li=new qi(Zt,g);g.preloadHint=li;break}case"RENDITION-REPORT":{const li=new qi(Zt,g);g.renditionReports=g.renditionReports||[],g.renditionReports.push(li);break}default:se.warn(`line parsed but not handled: ${Pe}`);break}}}_e&&!_e.relurl?(v.pop(),B-=_e.duration,g.partList&&(g.fragmentHint=_e)):g.partList&&(qa(ce,_e,y),ce.cc=F,g.fragmentHint=ce,dt&&dl(ce,dt,g)),g.targetduration||(g.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const Tt=v.length,ti=v[0],hi=v[Tt-1];if(B+=g.skippedSegments*g.targetduration,B>0&&Tt&&hi){g.averagetargetduration=B/Tt;const Ti=hi.sn;g.endSN=Ti!=="initSegment"?Ti:0,g.live||(hi.endList=!0),$e>0&&(Xl(v,$e),ti&&y.unshift(ti))}return g.fragmentHint&&(B+=g.fragmentHint.duration),g.totalduration=B,y.length&&g.dateRangeTagCount&&ti&&ka(y,g),g.endCC=F,g}}function ka(h,t){let n=h.length;if(!n)if(t.hasProgramDateTime){const d=t.fragments[t.fragments.length-1];h.push(d),n++}else return;const s=h[n-1],o=t.live?1/0:t.totalduration,l=Object.keys(t.dateRanges);for(let d=l.length;d--;){const _=t.dateRanges[l[d]],g=_.startDate.getTime();_.tagAnchor=s.ref;for(let v=n;v--;){var c;if(((c=h[v])==null?void 0:c.sn)<t.startSN)break;const y=xs(t,g,h,v,o);if(y!==-1){_.tagAnchor=t.fragments[y].ref;break}}}}function xs(h,t,n,s,o){const l=n[s];if(l){const d=l.programDateTime;if(t>=d||s===0){var c;const _=(((c=n[s+1])==null?void 0:c.start)||o)-l.start;if(t<=d+_*1e3){const g=n[s].sn-h.startSN;if(g<0)return-1;const v=h.fragments;if(v.length>n.length){const x=(n[s+1]||v[v.length-1]).sn-h.startSN;for(let L=x;L>g;L--){const M=v[L].programDateTime;if(t>=M&&t<M+v[L].duration*1e3)return L}}return g}}}return-1}function Eo(h,t,n){var s,o;const l=new qi(h,n),c=(s=l.METHOD)!=null?s:"",d=l.URI,_=l.hexadecimalInteger("IV"),g=l.KEYFORMATVERSIONS,v=(o=l.KEYFORMAT)!=null?o:"identity";d&&l.IV&&!_&&se.error(`Invalid IV: ${l.IV}`);const y=d?qr.resolve(d,t):"",x=(g||"1").split("/").map(Number).filter(Number.isFinite);return new jr(c,y,v,x,_,l.KEYID)}function ko(h){const n=new qi(h).decimalFloatingPoint("TIME-OFFSET");return le(n)?n:null}function as(h,t){let n=(h||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const o=n.filter(l=>Nt(l,s));o.length&&(t[`${s}Codec`]=o.map(l=>l.split("/")[0]).join(","),n=n.filter(l=>o.indexOf(l)===-1))}),t.unknownCodecs=n}function To(h,t,n){const s=t[n];s&&(h[n]=s)}function Xl(h,t){let n=h[t];for(let s=t;s--;){const o=h[s];if(!o)return;o.programDateTime=n.programDateTime-o.duration*1e3,n=o}}function qa(h,t,n){h.rawProgramDateTime?n.push(h):t!=null&&t.programDateTime&&(h.programDateTime=t.endProgramDateTime)}function fl(h,t,n,s){h.relurl=t.URI,t.BYTERANGE&&h.setByteRange(t.BYTERANGE),h.level=n,h.sn="initSegment",s&&(h.levelkeys=s),h.initSegment=null}function dl(h,t,n){h.levelkeys=t;const{encryptedFragments:s}=n;(!s.length||s[s.length-1].levelkeys!==t)&&Object.keys(t).some(o=>t[o].isCommonEncryption)&&s.push(h)}function ws(h,t,n){h.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${n[0]})`)}function Ta(h,t,n){h.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${n[0]})`)}function Za(h,t){const n=t.startPTS;if(le(n)){let s=0,o;t.sn>h.sn?(s=n-h.start,o=h):(s=h.start-n,o=t),o.duration!==s&&o.setDuration(s)}else t.sn>h.sn?h.cc===t.cc&&h.minEndPTS?t.setStart(h.start+(h.minEndPTS-h.start)):t.setStart(h.start+h.duration):t.setStart(Math.max(h.start-t.duration,0))}function Is(h,t,n,s,o,l,c){s-n<=0&&(c.warn("Fragment should have a positive duration",t),s=n+t.duration,l=o+t.duration);let _=n,g=s;const v=t.startPTS,y=t.endPTS;if(le(v)){const W=Math.abs(v-n);h&&W>h.totalduration?c.warn(`media timestamps and playlist times differ by ${W}s for level ${t.level} ${h.url}`):le(t.deltaPTS)?t.deltaPTS=Math.max(W,t.deltaPTS):t.deltaPTS=W,_=Math.max(n,v),n=Math.min(n,v),o=t.startDTS!==void 0?Math.min(o,t.startDTS):o,g=Math.min(s,y),s=Math.max(s,y),l=t.endDTS!==void 0?Math.max(l,t.endDTS):l}const x=n-t.start;t.start!==0&&t.setStart(n),t.setDuration(s-t.start),t.startPTS=n,t.maxStartPTS=_,t.startDTS=o,t.endPTS=s,t.minEndPTS=g,t.endDTS=l;const L=t.sn;if(!h||L<h.startSN||L>h.endSN)return 0;let M;const B=L-h.startSN,F=h.fragments;for(F[B]=t,M=B;M>0;M--)Za(F[M],F[M-1]);for(M=B;M<F.length-1;M++)Za(F[M],F[M+1]);return h.fragmentHint&&Za(F[F.length-1],h.fragmentHint),h.PTSKnown=h.alignedSliding=!0,x}function Ao(h,t,n){if(h===t)return;let s=null;const o=h.fragments;for(let v=o.length-1;v>=0;v--){const y=o[v].initSegment;if(y){s=y;break}}h.fragmentHint&&delete h.fragmentHint.endPTS;let l;Jl(h,t,(v,y,x,L)=>{if((!t.startCC||t.skippedSegments)&&y.cc!==v.cc){const M=v.cc-y.cc;for(let B=x;B<L.length;B++)L[B].cc+=M;t.endCC=L[L.length-1].cc}le(v.startPTS)&&le(v.endPTS)&&(y.setStart(y.startPTS=v.startPTS),y.startDTS=v.startDTS,y.maxStartPTS=v.maxStartPTS,y.endPTS=v.endPTS,y.endDTS=v.endDTS,y.minEndPTS=v.minEndPTS,y.setDuration(v.endPTS-v.startPTS),y.duration&&(l=y),t.PTSKnown=t.alignedSliding=!0),v.hasStreams&&(y.elementaryStreams=v.elementaryStreams),y.loader=v.loader,v.hasStats&&(y.stats=v.stats),v.initSegment&&(y.initSegment=v.initSegment,s=v.initSegment)});const c=t.fragments,d=t.fragmentHint?c.concat(t.fragmentHint):c;if(s&&d.forEach(v=>{var y;v&&(!v.initSegment||v.initSegment.relurl===((y=s)==null?void 0:y.relurl))&&(v.initSegment=s)}),t.skippedSegments){if(t.deltaUpdateFailed=c.some(v=>!v),t.deltaUpdateFailed){n.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let v=t.skippedSegments;v--;)c.shift();t.startSN=c[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=pl(h.dateRanges,t,n));const v=h.fragments.filter(y=>y.rawProgramDateTime);if(h.hasProgramDateTime&&!t.hasProgramDateTime)for(let y=1;y<d.length;y++)d[y].programDateTime===null&&qa(d[y],d[y-1],v);ka(v,t)}t.endCC=c[c.length-1].cc}if(!t.startCC){var _;const v=Ya(h,t.startSN-1);t.startCC=(_=v==null?void 0:v.cc)!=null?_:c[0].cc}ml(h.partList,t.partList,(v,y)=>{y.elementaryStreams=v.elementaryStreams,y.stats=v.stats}),l?Is(t,l,l.startPTS,l.endPTS,l.startDTS,l.endDTS,n):ua(h,t),c.length&&(t.totalduration=t.edge-c[0].start),t.driftStartTime=h.driftStartTime,t.driftStart=h.driftStart;const g=t.advancedDateTime;if(t.advanced&&g){const v=t.edge;t.driftStart||(t.driftStartTime=g,t.driftStart=v),t.driftEndTime=g,t.driftEnd=v}else t.driftEndTime=h.driftEndTime,t.driftEnd=h.driftEnd,t.advancedDateTime=h.advancedDateTime;t.requestScheduled===-1&&(t.requestScheduled=h.requestScheduled)}function pl(h,t,n){const{dateRanges:s,recentlyRemovedDateranges:o}=t,l=k({},h);o&&o.forEach(_=>{delete l[_]});const d=Object.keys(l).length;return d?(Object.keys(s).forEach(_=>{const g=l[_],v=new us(s[_].attr,g);v.isValid?(l[_]=v,g||(v.tagOrder+=d)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Qi(s[_].attr)}"`)}),l):s}function ml(h,t,n){if(h&&t){let s=0;for(let o=0,l=h.length;o<=l;o++){const c=h[o],d=t[o+s];c&&d&&c.index===d.index&&c.fragment.sn===d.fragment.sn?n(c,d):s--}}}function Jl(h,t,n){const s=t.skippedSegments,o=Math.max(h.startSN,t.startSN)-t.startSN,l=(h.fragmentHint?1:0)+(s?t.endSN:Math.min(h.endSN,t.endSN))-t.startSN,c=t.startSN-h.startSN,d=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,_=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;for(let g=o;g<=l;g++){const v=_[c+g];let y=d[g];if(s&&!y&&v&&(y=t.fragments[g]=v),v&&y){n(v,y,g,d);const x=v.relurl,L=y.relurl;if(x&&Mo(x,L)){t.playlistParsingError=Lo(`media sequence mismatch ${y.sn}:`,h,t,v,y);return}else if(v.cc!==y.cc){t.playlistParsingError=Lo(`discontinuity sequence mismatch (${v.cc}!=${y.cc})`,h,t,v,y);return}}}}function Lo(h,t,n,s,o){return new Error(`${h} ${o.url}
Playlist starting @${t.startSN}
${t.m3u8}
Playlist starting @${n.startSN}
${n.m3u8}`)}function ua(h,t,n=!0){const s=t.startSN+t.skippedSegments-h.startSN,o=h.fragments,l=s>=0;let c=0;if(l&&s<o.length)c=o[s].start;else if(l&&t.startSN===h.endSN+1)c=h.fragmentEnd;else if(l&&n)c=h.fragmentStart+s*t.levelTargetDuration;else if(!t.skippedSegments&&t.fragmentStart===0)c=h.fragmentStart;else return;Do(t,c)}function Do(h,t){if(t){const n=h.fragments;for(let s=h.skippedSegments;s<n.length;s++)n[s].addStart(t);h.fragmentHint&&h.fragmentHint.addStart(t)}}function Ys(h,t=1/0){let n=1e3*h.targetduration;if(h.updated){const s=h.fragments;if(s.length&&n*4>t){const l=s[s.length-1].duration*1e3;l<n&&(n=l)}}else n/=2;return Math.round(n)}function Ya(h,t,n){if(!h)return null;let s=h.fragments[t-h.startSN];return s||(s=h.fragmentHint,s&&s.sn===t)?s:t<h.startSN&&n&&n.sn===t?n:null}function Co(h,t,n){return h?gl(h.partList,t,n):null}function gl(h,t,n){if(h)for(let s=h.length;s--;){const o=h[s];if(o.index===n&&o.fragment.sn===t)return o}return null}function Us(h){h.forEach((t,n)=>{var s;(s=t.details)==null||s.fragments.forEach(o=>{o.level=n,o.initSegment&&(o.initSegment.level=n)})})}function Mo(h,t){return h!==t&&t?Xa(h)!==Xa(t):!1}function Xa(h){return h.replace(/\?[^?]*$/,"")}function Aa(h,t){for(let s=0,o=h.length;s<o;s++){var n;if(((n=h[s])==null?void 0:n.cc)===t)return h[s]}return null}function Zn(h,t){return!!(h&&t.startCC<h.endCC&&t.endCC>h.startCC)}function Mn(h,t){const n=h.start+t;h.startPTS=n,h.setStart(n),h.endPTS=n+h.duration}function On(h,t){const n=t.fragments;for(let s=0,o=n.length;s<o;s++)Mn(n[s],h);t.fragmentHint&&Mn(t.fragmentHint,h),t.alignedSliding=!0}function ts(h,t){h&&(Zr(t,h),t.alignedSliding||Xs(t,h),!t.alignedSliding&&!t.skippedSegments&&ua(h,t,!1))}function Zr(h,t){if(!Zn(t,h))return;const n=Math.min(t.endCC,h.endCC),s=Aa(t.fragments,n),o=Aa(h.fragments,n);if(!s||!o)return;se.log(`Aligning playlist at start of dicontinuity sequence ${n}`);const l=s.start-o.start;On(l,h)}function Xs(h,t){if(!h.hasProgramDateTime||!t.hasProgramDateTime)return;const n=h.fragments,s=t.fragments;if(!n.length||!s.length)return;let o,l;const c=Math.min(t.endCC,h.endCC);t.startCC<c&&h.startCC<c&&(o=Aa(s,c),l=Aa(n,c)),(!o||!l)&&(o=s[Math.floor(s.length/2)],l=Aa(n,o.cc)||n[Math.floor(n.length/2)]);const d=o.programDateTime,_=l.programDateTime;if(!d||!_)return;const g=(_-d)/1e3-(l.start-o.start);On(g,h)}function br(h,t,n){Cr(h,t,n),h.addEventListener(t,n)}function Cr(h,t,n){h.removeEventListener(t,n)}const _l={toString:function(h){let t="";const n=h.length;for(let s=0;s<n;s++)t+=`[${h.start(s).toFixed(3)}-${h.end(s).toFixed(3)}]`;return t}},kt={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 Js extends Br{constructor(t,n,s,o,l){super(o,t.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=kt.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:c,fragCurrent:d,media:_,mediaBuffer:g,state:v}=this,y=_?_.currentTime:0,x=mi.bufferInfo(g||_,y,c.maxBufferHole),L=!x.len;if(this.log(`Media seeking to ${le(y)?y.toFixed(3):y}, state: ${v}, ${L?"out of":"in"} buffer`),this.state===kt.ENDED)this.resetLoadingState();else if(d){const M=c.maxFragLookUpTolerance,B=d.start-M,F=d.start+d.duration+M;if(L||F<x.start||B>x.end){const W=y>F;(y<B||W)&&(W&&d.loader&&(this.log(`Cancelling fragment load for seek (sn: ${d.sn})`),d.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(_){this.fragmentTracker.removeFragmentsInRange(y,1/0,this.playlistType,!0);const M=this.lastCurrentTime;if(y>M&&(this.lastCurrentTime=y),!this.loadingParts){const B=Math.max(x.end,y),F=this.shouldLoadParts(this.getLevelDetails(),B);F&&(this.log(`LL-Part loading ON after seeking to ${y.toFixed(2)} with buffer @${B.toFixed(2)}`),this.loadingParts=F)}}this.hls.hasEnoughToStart||(this.log(`Setting ${L?"startPosition":"nextLoadPosition"} to ${y} for seek without enough to start`),this.nextLoadPosition=y,L&&(this.startPosition=y)),L&&this.state===kt.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=l,this.hls=t,this.fragmentLoader=new Lr(t.config),this.keyLoader=s,this.fragmentTracker=n,this.config=t.config,this.decrypter=new qn(t.config)}registerListeners(){const{hls:t}=this;t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){if(this.state===kt.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const t=this.fragCurrent;t!=null&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=kt.STOPPED}get startPositionValue(){const{nextLoadPosition:t,startPosition:n}=this;return n===-1&&t?t:n}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(t,n){if(n.live||!this.media)return!1;const s=t.end||0,o=this.config.timelineOffset||0;if(s<=o)return!1;const l=t.buffered;this.config.maxBufferHole&&l&&l.length>1&&(t=mi.bufferedInfo(l,t.start,0));const c=t.nextStart;if(c&&c>o&&c<n.edge||this.media.currentTime<t.start)return!1;const _=n.partList;if(_!=null&&_.length){const v=_[_.length-1];return mi.isBuffered(this.media,v.start+v.duration/2)}const g=n.fragments[n.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(g)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const t=this.config.timelineOffset;if(t){var n;return((n=this.getLevelDetails())==null?void 0:n.appliedTimelineOffset)||t}return 0}onMediaAttached(t,n){const s=this.media=this.mediaBuffer=n.media;br(s,"seeking",this.onMediaSeeking),br(s,"ended",this.onMediaEnded);const o=this.config;this.levels&&o.autoStartLoad&&this.state===kt.STOPPED&&this.startLoad(o.startPosition)}onMediaDetaching(t,n){const s=!!n.transferMedia,o=this.media;if(o!==null){if(o.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),Cr(o,"seeking",this.onMediaSeeking),Cr(o,"ended",this.onMediaEnded),this.keyLoader&&!s&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,s){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(t,n){}onManifestLoaded(t,n){this.startTimeOffset=n.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=kt.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(t,n,s){this.startFragRequested=!0,this._loadFragForPlayback(t,n,s)}_loadFragForPlayback(t,n,s){const o=l=>{const c=l.frag;if(this.fragContextChanged(c)){this.warn(`${c.type} sn: ${c.sn}${l.part?" part: "+l.part.index:""} of ${this.fragInfo(c,!1,l.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(c);return}c.stats.chunkCount++,this._handleFragmentLoadProgress(l)};this._doFragLoad(t,n,s,o).then(l=>{if(!l)return;const c=this.state,d=l.frag;if(this.fragContextChanged(d)){(c===kt.FRAG_LOADING||!this.fragCurrent&&c===kt.PARSING)&&(this.fragmentTracker.removeFragment(d),this.state=kt.IDLE);return}"payload"in l&&(this.log(`Loaded ${d.type} sn: ${d.sn} of ${this.playlistLabel()} ${d.level}`),this.hls.trigger(S.FRAG_LOADED,l)),this._handleFragmentLoadComplete(l)}).catch(l=>{this.state===kt.STOPPED||this.state===kt.ERROR||(this.warn(`Frag error: ${(l==null?void 0:l.message)||l}`),this.resetFragmentLoading(t))})}clearTrackerIfNeeded(t){var n;const{fragmentTracker:s}=this;if(s.getState(t)===Vi.APPENDING){const l=t.type,c=this.getFwdBufferInfo(this.mediaBuffer,l),d=Math.max(t.duration,c?c.len:this.config.maxBufferLength),_=this.backtrackFragment;((_?t.sn-_.sn:0)===1||this.reduceMaxBufferLength(d,t.duration))&&s.removeFragment(t)}else((n=this.mediaBuffer)==null?void 0:n.buffered.length)===0?s.removeAllFragments():s.hasParts(t.type)&&(s.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),s.getState(t)===Vi.PARTIAL&&s.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const n=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:n,part:null,stats:n.stats,id:n.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}waitForLive(t){const n=t.details;return(n==null?void 0:n.live)&&n.type!=="EVENT"&&(this.levelLastLoaded!==t||n.expired)}flushMainBuffer(t,n,s=null){if(!(t-n))return;const o={startOffset:t,endOffset:n,type:s};this.hls.trigger(S.BUFFER_FLUSHING,o)}_loadInitSegment(t,n){this._doFragLoad(t,n).then(s=>{const o=s==null?void 0:s.frag;if(!o||this.fragContextChanged(o)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:o}=this,{frag:l,payload:c}=s,d=l.decryptdata;if(c&&c.byteLength>0&&d!=null&&d.key&&d.iv&&Nr(d.method)){const _=self.performance.now();return this.decrypter.decrypt(new Uint8Array(c),d.key.buffer,d.iv.buffer,hr(d.method)).catch(g=>{throw o.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.FRAG_DECRYPT_ERROR,fatal:!1,error:g,reason:g.message,frag:l}),g}).then(g=>{const v=self.performance.now();return o.trigger(S.FRAG_DECRYPTED,{frag:l,payload:g,stats:{tstart:_,tdecrypt:v}}),s.payload=g,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state===kt.STOPPED||this.state===kt.ERROR||(this.warn(s),this.resetFragmentLoading(t))})}completeInitSegmentLoad(t){const{levels:n}=this;if(!n)throw new Error("init load aborted, missing levels");const s=t.frag.stats;this.state!==kt.STOPPED&&(this.state=kt.IDLE),t.frag.data=new Uint8Array(t.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(t,n){var s,o;const l=t.tracks;if(l&&!n.encrypted&&((s=l.audio)!=null&&s.encrypted||(o=l.video)!=null&&o.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const c=this.media,d=new Error(`Encrypted track with no key in ${this.fragInfo(n)} (media ${c?"attached mediaKeys: "+c.mediaKeys:"detached"})`);return this.warn(d.message),!c||c.mediaKeys?!1:(this.hls.trigger(S.ERROR,{type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_KEYS,fatal:!1,error:d,frag:n}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(t){const{fragCurrent:n}=this;return!t||!n||t.sn!==n.sn||t.level!==n.level}fragBufferedComplete(t,n){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${n?" part: "+n.index:""} of ${this.fragInfo(t,!1,n)} > buffer:${s?_l.toString(mi.getBuffered(s)):"(detached)"})`),ze(t)){var o;if(t.type!==P.SUBTITLE){const c=t.elementaryStreams;if(!Object.keys(c).some(d=>!!c[d])){this.state=kt.IDLE;return}}const l=(o=this.levels)==null?void 0:o[t.level];l!=null&&l.fragmentError&&(this.log(`Resetting level fragment error count of ${l.fragmentError} on frag buffered`),l.fragmentError=0)}this.state=kt.IDLE}_handleFragmentLoadComplete(t){const{transmuxer:n}=this;if(!n)return;const{frag:s,part:o,partsLoaded:l}=t,c=!l||l.length===0||l.some(_=>!_),d=new Sn(s.level,s.sn,s.stats.chunkCount+1,0,o?o.index:-1,!c);n.flush(d)}_handleFragmentLoadProgress(t){}_doFragLoad(t,n,s=null,o){var l;this.fragCurrent=t;const c=n.details;if(!this.levels||!c)throw new Error(`frag load aborted, missing level${c?"":" detail"}s`);let d=null;if(t.encrypted&&!((l=t.decryptdata)!=null&&l.key)){if(this.log(`Loading key for ${t.sn} of [${c.startSN}-${c.endSN}], ${this.playlistLabel()} ${t.level}`),this.state=kt.KEY_LOADING,this.fragCurrent=t,d=this.keyLoader.load(t).then(x=>{if(!this.fragContextChanged(x.frag))return this.hls.trigger(S.KEY_LOADED,x),this.state===kt.KEY_LOADING&&(this.state=kt.IDLE),x}),this.hls.trigger(S.KEY_LOADING,{frag:t}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else t.encrypted||(d=this.keyLoader.loadClear(t,c.encryptedFragments,this.startFragRequested),d&&this.log("[eme] blocking frag load until media-keys acquired"));const _=this.fragPrevious;if(ze(t)&&(!_||t.sn!==_.sn)){const x=this.shouldLoadParts(n.details,t.end);x!==this.loadingParts&&(this.log(`LL-Part loading ${x?"ON":"OFF"} loading sn ${_==null?void 0:_.sn}->${t.sn}`),this.loadingParts=x)}if(s=Math.max(t.start,s||0),this.loadingParts&&ze(t)){const x=c.partList;if(x&&o){s>c.fragmentEnd&&c.fragmentHint&&(t=c.fragmentHint);const L=this.getNextPart(x,t,s);if(L>-1){const M=x[L];t=this.fragCurrent=M.fragment,this.log(`Loading ${t.type} sn: ${t.sn} part: ${M.index} (${L}/${x.length-1}) of ${this.fragInfo(t,!1,M)}) cc: ${t.cc} [${c.startSN}-${c.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=M.start+M.duration,this.state=kt.FRAG_LOADING;let B;return d?B=d.then(F=>!F||this.fragContextChanged(F.frag)?null:this.doFragPartsLoad(t,M,n,o)).catch(F=>this.handleFragLoadError(F)):B=this.doFragPartsLoad(t,M,n,o).catch(F=>this.handleFragLoadError(F)),this.hls.trigger(S.FRAG_LOADING,{frag:t,part:M,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):B}else if(!t.url||this.loadedEndOfParts(x,s))return Promise.resolve(null)}}if(ze(t)&&this.loadingParts){var g;this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)} Check buffer at sn: ${t.sn} loaded parts: ${(g=c.partList)==null?void 0:g.filter(x=>x.loaded).map(x=>`[${x.start}-${x.end}]`)}`),this.loadingParts=!1}else if(!t.url)return Promise.resolve(null);this.log(`Loading ${t.type} sn: ${t.sn} of ${this.fragInfo(t,!1)}) cc: ${t.cc} ${"["+c.startSN+"-"+c.endSN+"]"}, target: ${parseFloat(s.toFixed(3))}`),le(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=kt.FRAG_LOADING;const v=this.config.progressive;let y;return v&&d?y=d.then(x=>!x||this.fragContextChanged(x.frag)?null:this.fragmentLoader.load(t,o)).catch(x=>this.handleFragLoadError(x)):y=Promise.all([this.fragmentLoader.load(t,v?o:void 0),d]).then(([x])=>(!v&&o&&o(x),x)).catch(x=>this.handleFragLoadError(x)),this.hls.trigger(S.FRAG_LOADING,{frag:t,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):y}doFragPartsLoad(t,n,s,o){return new Promise((l,c)=>{var d;const _=[],g=(d=s.details)==null?void 0:d.partList,v=y=>{this.fragmentLoader.loadPart(t,y,o).then(x=>{_[y.index]=x;const L=x.part;this.hls.trigger(S.FRAG_LOADED,x);const M=Co(s.details,t.sn,y.index+1)||gl(g,t.sn,y.index+1);if(M)v(M);else return l({frag:t,part:L,partsLoaded:_})}).catch(c)};v(n)})}handleFragLoadError(t){if("data"in t){const n=t.data;n.frag&&n.details===Z.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):n.frag&&n.type===pe.KEY_SYSTEM_ERROR?(n.frag.abortRequests(),this.resetFragmentLoading(n.frag)):this.hls.trigger(S.ERROR,n)}else this.hls.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const n=this.getCurrentContext(t);if(!n||this.state!==kt.PARSING){!this.fragCurrent&&this.state!==kt.STOPPED&&this.state!==kt.ERROR&&(this.state=kt.IDLE);return}const{frag:s,part:o,level:l}=n,c=self.performance.now();s.stats.parsing.end=c,o&&(o.stats.parsing.end=c);const d=this.getLevelDetails(),g=d&&s.sn>d.endSN||this.shouldLoadParts(d,s.end);g!==this.loadingParts&&(this.log(`LL-Part loading ${g?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=g),this.updateLevelTiming(s,o,l,t.partial)}shouldLoadParts(t,n){if(this.config.lowLatencyMode){if(!t)return this.loadingParts;if(t.partList){var s;const l=t.partList[0];if(l.fragment.type===P.SUBTITLE)return!1;const c=l.end+(((s=t.fragmentHint)==null?void 0:s.duration)||0);if(n>=c){var o;if((this.hls.hasEnoughToStart?((o=this.media)==null?void 0:o.currentTime)||this.lastCurrentTime:this.getLoadPosition())>l.start-l.fragment.duration)return!0}}}return!1}getCurrentContext(t){const{levels:n,fragCurrent:s}=this,{level:o,sn:l,part:c}=t;if(!(n!=null&&n[o]))return this.warn(`Levels object was unset while buffering fragment ${l} of ${this.playlistLabel()} ${o}. The current chunk will not be buffered.`),null;const d=n[o],_=d.details,g=c>-1?Co(_,l,c):null,v=g?g.fragment:Ya(_,l,s);return v?(s&&s!==v&&(v.stats=s.stats),{frag:v,part:g,level:d}):null}bufferFragmentData(t,n,s,o,l){if(this.state!==kt.PARSING)return;const{data1:c,data2:d}=t;let _=c;if(d&&(_=yt(c,d)),!_.length)return;const g=this.initPTS[n.cc],v=g?-g.baseTime/g.timescale:void 0,y={type:t.type,frag:n,part:s,chunkMeta:o,offset:v,parent:n.type,data:_};if(this.hls.trigger(S.BUFFER_APPENDING,y),t.dropped&&t.independent&&!s){if(l)return;this.flushBufferGap(n)}}flushBufferGap(t){const n=this.media;if(!n)return;if(!mi.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,t.start);return}const s=n.currentTime,o=mi.bufferInfo(n,s,0),l=t.duration,c=Math.min(this.config.maxFragLookUpTolerance*2,l*.25),d=Math.max(Math.min(t.start-c,o.end-c),s+c);t.start-d>c&&this.flushMainBuffer(d,t.start)}getFwdBufferInfo(t,n){var s;const o=this.getLoadPosition();if(!le(o))return null;const c=this.lastCurrentTime>o||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(t,o,n,c)}getFwdBufferInfoAtPos(t,n,s,o){const l=mi.bufferInfo(t,n,o);if(l.len===0&&l.nextStart!==void 0){const c=this.fragmentTracker.getBufferedFrag(n,s);if(c&&(l.nextStart<=c.end||c.gap)){const d=Math.max(Math.min(l.nextStart,c.end)-n,o);return mi.bufferInfo(t,n,d)}}return l}getMaxBufferLength(t){const{config:n}=this;let s;return t?s=Math.max(8*n.maxBufferSize/t,n.maxBufferLength):s=n.maxBufferLength,Math.min(s,n.maxMaxBufferLength)}reduceMaxBufferLength(t,n){const s=this.config,o=Math.max(Math.min(t-n,s.maxBufferLength),n),l=Math.max(t-n*3,s.maxMaxBufferLength/2,o);return l>=o?(s.maxMaxBufferLength=l,this.warn(`Reduce max buffer length to ${l}s`),!0):!1}getAppendedFrag(t,n=P.MAIN){const s=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(t,n):null;return s&&"fragment"in s?s.fragment:s}getNextFragment(t,n){const s=n.fragments,o=s.length;if(!o)return null;const{config:l}=this,c=s[0].start,d=l.lowLatencyMode&&!!n.partList;let _=null;if(n.live){const y=l.initialLiveManifestSize;if(o<y)return this.warn(`Not enough fragments to start playback (have: ${o}, need: ${y})`),null;if(!n.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||t<c){var g;d&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),_=this.getInitialLiveFragment(n);const x=this.hls.startPosition,L=this.hls.liveSyncPosition,M=_?(x!==-1&&x>=c?x:L)||_.start:t;this.log(`Setting startPosition to ${M} to match start frag at live edge. mainStart: ${x} liveSyncPosition: ${L} frag.start: ${(g=_)==null?void 0:g.start}`),this.startPosition=this.nextLoadPosition=M}}else t<=c&&(_=s[0]);if(!_){const y=this.loadingParts?n.partEnd:n.fragmentEnd;_=this.getFragmentAtPosition(t,y,n)}let v=this.filterReplacedPrimary(_,n);if(!v&&_){const y=_.sn-n.startSN;v=this.filterReplacedPrimary(s[y+1]||null,n)}return this.mapToInitFragWhenRequired(v)}isLoopLoading(t,n){const s=this.fragmentTracker.getState(t);return(s===Vi.OK||s===Vi.PARTIAL&&!!t.gap)&&this.nextLoadPosition>n}getNextFragmentLoopLoading(t,n,s,o,l){let c=null;if(t.gap&&(c=this.getNextFragment(this.nextLoadPosition,n),c&&!c.gap&&s.nextStart)){const d=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,o,0);if(d!==null&&s.len+d.len>=l){const _=c.sn;return this.loopSn!==_&&(this.log(`buffer full after gaps in "${o}" playlist starting at sn: ${_}`),this.loopSn=_),null}}return this.loopSn=void 0,c}get primaryPrefetch(){if(Ja(this.config)){var t;if((t=this.hls.interstitialsManager)==null||(t=t.playingItem)==null?void 0:t.event)return!0}return!1}filterReplacedPrimary(t,n){if(!t)return t;if(Ja(this.config)&&t.type!==P.SUBTITLE){const s=this.hls.interstitialsManager,o=s==null?void 0:s.bufferingItem;if(o){const c=o.event;if(c){if(c.appendInPlace||Math.abs(t.start-o.start)>1||o.start===0)return null}else if(t.end<=o.start&&(n==null?void 0:n.live)===!1||t.start>o.end&&o.nextEvent&&(o.nextEvent.appendInPlace||t.start-o.end>1))return null}const l=s==null?void 0:s.playerQueue;if(l)for(let c=l.length;c--;){const d=l[c].interstitial;if(d.appendInPlace&&t.start>=d.startTime&&t.end<=d.resumeTime)return null}}return t}mapToInitFragWhenRequired(t){return t!=null&&t.initSegment&&!t.initSegment.data&&!this.bitrateTest?t.initSegment:t}getNextPart(t,n,s){let o=-1,l=!1,c=!0;for(let d=0,_=t.length;d<_;d++){const g=t[d];if(c=c&&!g.independent,o>-1&&s<g.start)break;const v=g.loaded;v?o=-1:(l||(g.independent||c)&&g.fragment===n)&&(g.fragment!==n&&this.warn(`Need buffer at ${s} but next unloaded part starts at ${g.start}`),o=d),l=v}return o}loadedEndOfParts(t,n){let s;for(let o=t.length;o--;){if(s=t[o],!s.loaded)return!1;if(n>s.start)return!0}return!1}getInitialLiveFragment(t){const n=t.fragments,s=this.fragPrevious;let o=null;if(s){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),o=Pi(n,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!o){const l=s.sn+1;if(l>=t.startSN&&l<=t.endSN){const c=n[l-t.startSN];s.cc===c.cc&&(o=c,this.log(`Live playlist, switching playlist, load frag with next SN: ${o.sn}`))}o||(o=un(t,s.cc,s.end),o&&this.log(`Live playlist, switching playlist, load frag with same CC: ${o.sn}`))}}else{const l=this.hls.liveSyncPosition;l!==null&&(o=this.getFragmentAtPosition(l,this.bitrateTest?t.fragmentEnd:t.edge,t))}return o}getFragmentAtPosition(t,n,s){const{config:o}=this;let{fragPrevious:l}=this,{fragments:c,endSN:d}=s;const{fragmentHint:_}=s,{maxFragLookUpTolerance:g}=o,v=s.partList,y=!!(this.loadingParts&&v!=null&&v.length&&_);y&&!this.bitrateTest&&v[v.length-1].fragment.sn===_.sn&&(c=c.concat(_),d=_.sn);let x;if(t<n){var L;const B=t<this.lastCurrentTime||t>n-g||(L=this.media)!=null&&L.paused||!this.startFragRequested?0:g;x=Ni(l,c,t,B)}else x=c[c.length-1];if(x){const M=x.sn-s.startSN,B=this.fragmentTracker.getState(x);if((B===Vi.OK||B===Vi.PARTIAL&&x.gap)&&(l=x),l&&x.sn===l.sn&&(!y||v[0].fragment.sn>x.sn||!s.live)&&x.level===l.level){const W=c[M+1];x.sn<d&&this.fragmentTracker.getState(W)!==Vi.OK?x=W:x=null}}return x}alignPlaylists(t,n,s){const o=t.fragments.length;if(!o)return this.warn("No fragments in live playlist"),0;const l=t.fragmentStart,c=!n,d=t.alignedSliding&&le(l);if(c||!d&&!l){ts(s,t);const _=t.fragmentStart;return this.log(`Live playlist sliding: ${_.toFixed(2)} start-sn: ${n?n.startSN:"na"}->${t.startSN} fragments: ${o}`),_}return l}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,t.partTarget*3)}setStartPosition(t,n){let s=this.startPosition;s<n&&(s=-1);const o=this.timelineOffset;if(s===-1){const l=this.startTimeOffset!==null,c=l?this.startTimeOffset:t.startTimeOffset;c!==null&&le(c)?(s=n+c,c<0&&(s+=t.edge),s=Math.min(Math.max(n,s),n+t.totalduration),this.log(`Setting startPosition to ${s} for start time offset ${c} found in ${l?"multivariant":"media"} playlist`),this.startPosition=s):t.live?(s=this.hls.liveSyncPosition||n,this.log(`Setting startPosition to -1 to start at live edge ${s}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=s=0),this.lastCurrentTime=s+o}this.nextLoadPosition=s+o}getLoadPosition(){var t;const{media:n}=this;let s=0;return(t=this.hls)!=null&&t.hasEnoughToStart&&n?s=n.currentTime:this.nextLoadPosition>=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(t,n){this.transmuxer&&t.type===this.playlistType&&ze(t)&&t.stats.aborted&&(this.log(`Fragment ${t.sn}${n?" part "+n.index:""} of ${this.playlistLabel()} ${t.level} was aborted`),this.resetFragmentLoading(t))}resetFragmentLoading(t){(!this.fragCurrent||!this.fragContextChanged(t)&&this.state!==kt.FRAG_LOADING_WAITING_RETRY)&&(this.state=kt.IDLE)}onFragmentOrKeyLoadError(t,n){var s;if(n.chunkMeta&&!n.frag){const W=this.getCurrentContext(n.chunkMeta);W&&(n.frag=W.frag)}const o=n.frag;if(!o||o.type!==t||!this.levels)return;if(this.fragContextChanged(o)){var l;this.warn(`Frag load error must match current frag to retry ${o.url} > ${(l=this.fragCurrent)==null?void 0:l.url}`);return}const c=n.details===Z.FRAG_GAP;c&&this.fragmentTracker.fragBuffered(o,!0);const d=n.errorAction;if(!d){this.state=kt.ERROR;return}const{action:_,flags:g,retryCount:v=0,retryConfig:y}=d,x=!!y,L=x&&_===tn.RetryRequest,M=x&&!d.resolved&&g===ji.MoveAllAlternatesMatchingHost,B=(s=this.hls.latestLevelDetails)==null?void 0:s.live;if(!L&&M&&ze(o)&&!o.endList&&B)this.resetFragmentErrors(t),this.treatAsGap(o),d.resolved=!0;else if((L||M)&&v<y.maxNumRetry){var F;const W=cn((F=n.response)==null?void 0:F.code),_e=Xi(y,v);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+_e,this.state=kt.FRAG_LOADING_WAITING_RETRY,d.resolved=!0,W){this.log("Waiting for connection (offline)"),this.retryDate=1/0,n.reason="offline";return}this.warn(`Fragment ${o.sn} of ${t} ${o.level} errored with ${n.details}, retrying loading ${v+1}/${y.maxNumRetry} in ${_e}ms`)}else if(y)if(this.resetFragmentErrors(t),v<y.maxNumRetry)!c&&_!==tn.RemoveAlternatePermanently&&(d.resolved=!0);else{this.warn(`${n.details} reached or exceeded max retry (${v})`);return}else _===tn.SendAlternateToPenaltyBox?this.state=kt.WAITING_LEVEL:this.state=kt.ERROR;this.tickImmediate()}checkRetryDate(){const t=self.performance.now(),n=this.retryDate,s=n===1/0;(!n||t>=n||s&&!cn(0))&&(s&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=kt.IDLE)}reduceLengthAndFlushBuffer(t){if(this.state===kt.PARSING||this.state===kt.PARSED){const n=t.frag,s=t.parent,o=this.getFwdBufferInfo(this.mediaBuffer,s),l=o&&o.len>.5;l&&this.reduceMaxBufferLength(o.len,(n==null?void 0:n.duration)||10);const c=!l;return c&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${s} buffer`),n&&(this.fragmentTracker.removeFragment(n),this.nextLoadPosition=n.start),this.resetLoadingState(),c}return!1}resetFragmentErrors(t){t===P.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==kt.STOPPED&&(this.state=kt.IDLE)}afterBufferFlushed(t,n,s){if(!t)return;const o=mi.getBuffered(t);this.fragmentTracker.detectEvictedFragments(n,o,s),this.state===kt.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==kt.STOPPED&&(this.state=kt.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const t=this.levelLastLoaded,n=t?t.details:null;n!=null&&n.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(n,n.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(t){this.log(`Loading context changed while buffering sn ${t.sn} of ${this.playlistLabel()} ${t.level===-1?"<removed>":t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,n,s,o){const l=s.details;if(!l){this.warn("level.details undefined");return}if(!Object.keys(t.elementaryStreams).reduce((_,g)=>{const v=t.elementaryStreams[g];if(v){const y=v.endPTS-v.startPTS;if(y<=0)return this.warn(`Could not parse fragment ${t.sn} ${g} duration reliably (${y})`),_||!1;const x=o?0:Is(l,t,v.startPTS,v.endPTS,v.startDTS,v.endDTS,this);return this.hls.trigger(S.LEVEL_PTS_UPDATED,{details:l,level:s,drift:x,type:g,frag:t,start:v.startPTS,end:v.endPTS}),!0}return _},!1)){var d;if(s.fragmentError===0&&this.treatAsGap(t,s),((d=this.transmuxer)==null?void 0:d.error)===null){const _=new Error(`Found no media in fragment ${t.sn} of ${this.playlistLabel()} ${t.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(_.message),this.hls.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,fatal:!1,error:_,frag:t,reason:`Found no media in msn ${t.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=kt.PARSED,this.log(`Parsed ${t.type} sn: ${t.sn}${n?" part: "+n.index:""} of ${this.fragInfo(t,!1,n)})`),this.hls.trigger(S.FRAG_PARSED,{frag:t,part:n})}playlistLabel(){return this.playlistType===P.MAIN?"level":"track"}fragInfo(t,n=!0,s){var o,l;return`${this.playlistLabel()} ${t.level} (${s?"part":"frag"}:[${((o=n&&!s?t.startPTS:(s||t).start)!=null?o:NaN).toFixed(3)}-${((l=n&&!s?t.endPTS:(s||t).end)!=null?l:NaN).toFixed(3)}]${s&&t.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(t,n){n&&n.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)}resetTransmuxer(){var t;(t=this.transmuxer)==null||t.reset()}recoverWorkerError(t){t.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(t){const n=this._state;n!==t&&(this._state=t,this.log(`${n}->${t}`))}get state(){return this._state}}function Ja(h){return!!h.interstitialsController&&h.enableInterstitialPlayback!==!1}class vl{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:n}=this;let s;if(t.length)t.length===1?s=t[0]:s=ph(t,n);else return new Uint8Array(0);return this.reset(),s}reset(){this.chunks.length=0,this.dataLength=0}}function ph(h,t){const n=new Uint8Array(t);let s=0;for(let o=0;o<h.length;o++){const l=h[o];n.set(l,s),s+=l.length}return n}var Ql={exports:{}},Io;function mh(){return Io||(Io=1,function(h){var t=Object.prototype.hasOwnProperty,n="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(n=!1));function o(_,g,v){this.fn=_,this.context=g,this.once=v||!1}function l(_,g,v,y,x){if(typeof v!="function")throw new TypeError("The listener must be a function");var L=new o(v,y||_,x),M=n?n+g:g;return _._events[M]?_._events[M].fn?_._events[M]=[_._events[M],L]:_._events[M].push(L):(_._events[M]=L,_._eventsCount++),_}function c(_,g){--_._eventsCount===0?_._events=new s:delete _._events[g]}function d(){this._events=new s,this._eventsCount=0}d.prototype.eventNames=function(){var g=[],v,y;if(this._eventsCount===0)return g;for(y in v=this._events)t.call(v,y)&&g.push(n?y.slice(1):y);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(v)):g},d.prototype.listeners=function(g){var v=n?n+g:g,y=this._events[v];if(!y)return[];if(y.fn)return[y.fn];for(var x=0,L=y.length,M=new Array(L);x<L;x++)M[x]=y[x].fn;return M},d.prototype.listenerCount=function(g){var v=n?n+g:g,y=this._events[v];return y?y.fn?1:y.length:0},d.prototype.emit=function(g,v,y,x,L,M){var B=n?n+g:g;if(!this._events[B])return!1;var F=this._events[B],W=arguments.length,_e,ce;if(F.fn){switch(F.once&&this.removeListener(g,F.fn,void 0,!0),W){case 1:return F.fn.call(F.context),!0;case 2:return F.fn.call(F.context,v),!0;case 3:return F.fn.call(F.context,v,y),!0;case 4:return F.fn.call(F.context,v,y,x),!0;case 5:return F.fn.call(F.context,v,y,x,L),!0;case 6:return F.fn.call(F.context,v,y,x,L,M),!0}for(ce=1,_e=new Array(W-1);ce<W;ce++)_e[ce-1]=arguments[ce];F.fn.apply(F.context,_e)}else{var Pe=F.length,Ue;for(ce=0;ce<Pe;ce++)switch(F[ce].once&&this.removeListener(g,F[ce].fn,void 0,!0),W){case 1:F[ce].fn.call(F[ce].context);break;case 2:F[ce].fn.call(F[ce].context,v);break;case 3:F[ce].fn.call(F[ce].context,v,y);break;case 4:F[ce].fn.call(F[ce].context,v,y,x);break;default:if(!_e)for(Ue=1,_e=new Array(W-1);Ue<W;Ue++)_e[Ue-1]=arguments[Ue];F[ce].fn.apply(F[ce].context,_e)}}return!0},d.prototype.on=function(g,v,y){return l(this,g,v,y,!1)},d.prototype.once=function(g,v,y){return l(this,g,v,y,!0)},d.prototype.removeListener=function(g,v,y,x){var L=n?n+g:g;if(!this._events[L])return this;if(!v)return c(this,L),this;var M=this._events[L];if(M.fn)M.fn===v&&(!x||M.once)&&(!y||M.context===y)&&c(this,L);else{for(var B=0,F=[],W=M.length;B<W;B++)(M[B].fn!==v||x&&!M[B].once||y&&M[B].context!==y)&&F.push(M[B]);F.length?this._events[L]=F.length===1?F[0]:F:c(this,L)}return this},d.prototype.removeAllListeners=function(g){var v;return g?(v=n?n+g:g,this._events[v]&&c(this,v)):(this._events=new s,this._eventsCount=0),this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prefixed=n,d.EventEmitter=d,h.exports=d}(Ql)),Ql.exports}var gh=mh(),eu=X(gh);const Ro="1.6.11",Qa={};function Yr(){return typeof __HLS_WORKER_BUNDLE__=="function"}function ca(){const h=Qa[Ro];if(h)return h.clientCount++,h;const t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),n=self.URL.createObjectURL(t),o={worker:new self.Worker(n),objectURL:n,clientCount:1};return Qa[Ro]=o,o}function La(h){const t=Qa[h];if(t)return t.clientCount++,t;const n=new self.URL(h,self.location.href).href,o={worker:new self.Worker(n),scriptURL:n,clientCount:1};return Qa[h]=o,o}function _h(h){const t=Qa[h||Ro];if(t&&t.clientCount--===1){const{worker:s,objectURL:o}=t;delete Qa[h||Ro],o&&self.URL.revokeObjectURL(o),s.terminate()}}function tu(h,t){return t+10<=h.length&&h[t]===51&&h[t+1]===68&&h[t+2]===73&&h[t+3]<255&&h[t+4]<255&&h[t+6]<128&&h[t+7]<128&&h[t+8]<128&&h[t+9]<128}function iu(h,t){return t+10<=h.length&&h[t]===73&&h[t+1]===68&&h[t+2]===51&&h[t+3]<255&&h[t+4]<255&&h[t+6]<128&&h[t+7]<128&&h[t+8]<128&&h[t+9]<128}function yl(h,t){let n=0;return n=(h[t]&127)<<21,n|=(h[t+1]&127)<<14,n|=(h[t+2]&127)<<7,n|=h[t+3]&127,n}function eo(h,t){const n=t;let s=0;for(;iu(h,t);){s+=10;const o=yl(h,t+6);s+=o,tu(h,t+10)&&(s+=10),t+=s}if(s>0)return h.subarray(n,n+s)}function vh(h,t,n,s){const o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],l=t[n+2],c=l>>2&15;if(c>12){const L=new Error(`invalid ADTS sampling index:${c}`);h.emit(S.ERROR,S.ERROR,{type:pe.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,fatal:!0,error:L,reason:L.message});return}const d=(l>>6&3)+1,_=t[n+3]>>6&3|(l&1)<<2,g="mp4a.40."+d,v=o[c];let y=c;(d===5||d===29)&&(y-=3);const x=[d<<3|(y&14)>>1,(y&1)<<7|_<<3];return se.log(`manifest codec:${s}, parsed codec:${g}, channels:${_}, rate:${v} (ADTS object type:${d} sampling index:${c})`),{config:x,samplerate:v,channelCount:_,codec:g,parsedCodec:g,manifestCodec:s}}function ec(h,t){return h[t]===255&&(h[t+1]&246)===240}function tc(h,t){return h[t+1]&1?7:9}function Po(h,t){return(h[t+3]&3)<<11|h[t+4]<<3|(h[t+5]&224)>>>5}function yh(h,t){return t+5<h.length}function bl(h,t){return t+1<h.length&&ec(h,t)}function ic(h,t){return yh(h,t)&&ec(h,t)&&Po(h,t)<=h.length-t}function nc(h,t){if(bl(h,t)){const n=tc(h,t);if(t+n>=h.length)return!1;const s=Po(h,t);if(s<=n)return!1;const o=t+s;return o===h.length||bl(h,o)}return!1}function zs(h,t,n,s,o){if(!h.samplerate){const l=vh(t,n,s,o);if(!l)return;k(h,l)}}function nu(h){return 1024*9e4/h}function rc(h,t){const n=tc(h,t);if(t+n<=h.length){const s=Po(h,t)-n;if(s>0)return{headerLength:n,frameLength:s}}}function sc(h,t,n,s,o){const l=nu(h.samplerate),c=s+o*l,d=rc(t,n);let _;if(d){const{frameLength:y,headerLength:x}=d,L=x+y,M=Math.max(0,n+L-t.length);M?(_=new Uint8Array(L-x),_.set(t.subarray(n+x,t.length),0)):_=t.subarray(n+x,n+L);const B={unit:_,pts:c};return M||h.samples.push(B),{sample:B,length:L,missing:M}}const g=t.length-n;return _=new Uint8Array(g),_.set(t.subarray(n,t.length),0),{sample:{unit:_,pts:c},length:g,missing:-1}}function bh(h,t){return iu(h,t)&&yl(h,t+6)+10<=h.length-t}function xh(h){return h instanceof ArrayBuffer?h:h.byteOffset==0&&h.byteLength==h.buffer.byteLength?h.buffer:new Uint8Array(h).buffer}function ru(h,t=0,n=1/0){return ac(h,t,n,Uint8Array)}function ac(h,t,n,s){const o=wh(h);let l=1;"BYTES_PER_ELEMENT"in s&&(l=s.BYTES_PER_ELEMENT);const c=Sh(h)?h.byteOffset:0,d=(c+h.byteLength)/l,_=(c+t)/l,g=Math.floor(Math.max(0,Math.min(_,d))),v=Math.floor(Math.min(g+Math.max(n,0),d));return new s(o,g,v-g)}function wh(h){return h instanceof ArrayBuffer?h:h.buffer}function Sh(h){return h&&h.buffer instanceof ArrayBuffer&&h.byteLength!==void 0&&h.byteOffset!==void 0}function Eh(h){const t={key:h.type,description:"",data:"",mimeType:null,pictureType:null},n=3;if(h.size<2)return;if(h.data[0]!==n){console.log("Ignore frame with unrecognized character encoding");return}const s=h.data.subarray(1).indexOf(0);if(s===-1)return;const o=Rt(ru(h.data,1,s)),l=h.data[2+s],c=h.data.subarray(3+s).indexOf(0);if(c===-1)return;const d=Rt(ru(h.data,3+s,c));let _;return o==="-->"?_=Rt(ru(h.data,4+s+c)):_=xh(h.data.subarray(4+s+c)),t.mimeType=o,t.pictureType=l,t.description=d,t.data=_,t}function kh(h){if(h.size<2)return;const t=Rt(h.data,!0),n=new Uint8Array(h.data.subarray(t.length+1));return{key:h.type,info:t,data:n.buffer}}function Th(h){if(h.size<2)return;if(h.type==="TXXX"){let n=1;const s=Rt(h.data.subarray(n),!0);n+=s.length+1;const o=Rt(h.data.subarray(n));return{key:h.type,info:s,data:o}}const t=Rt(h.data.subarray(1));return{key:h.type,info:"",data:t}}function Ah(h){if(h.type==="WXXX"){if(h.size<2)return;let n=1;const s=Rt(h.data.subarray(n),!0);n+=s.length+1;const o=Rt(h.data.subarray(n));return{key:h.type,info:s,data:o}}const t=Rt(h.data);return{key:h.type,info:"",data:t}}function Qs(h){return h.type==="PRIV"?kh(h):h.type[0]==="W"?Ah(h):h.type==="APIC"?Eh(h):Th(h)}function oc(h){const t=String.fromCharCode(h[0],h[1],h[2],h[3]),n=yl(h,4),s=10;return{type:t,size:n,data:h.subarray(s,s+n)}}const Rs=10,Lh=10;function su(h){let t=0;const n=[];for(;iu(h,t);){const s=yl(h,t+6);h[t+5]>>6&1&&(t+=Rs),t+=Rs;const o=t+s;for(;t+Lh<o;){const l=oc(h.subarray(t)),c=Qs(l);c&&n.push(c),t+=l.size+Rs}tu(h,t)&&(t+=Rs)}return n}function au(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"}function Dh(h){if(h.data.byteLength===8){const t=new Uint8Array(h.data),n=t[3]&1;let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,n&&(s+=4772185884e-2),Math.round(s)}}function xl(h){const t=su(h);for(let n=0;n<t.length;n++){const s=t[n];if(au(s))return Dh(s)}}let fs=function(h){return h.audioId3="org.id3",h.dateRange="com.apple.quicktime.HLS",h.emsg="https://aomedia.org/emsg/ID3",h.misbklv="urn:misb:KLV:bin:1910.1",h}({});function Vs(h="",t=9e4){return{type:h,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class ou{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(t,n,s,o){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(t){this.initPTS=t,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(t,n){return!1}appendFrame(t,n,s){}demux(t,n){this.cachedData&&(t=yt(this.cachedData,t),this.cachedData=null);let s=eo(t,0),o=s?s.length:0,l;const c=this._audioTrack,d=this._id3Track,_=s?xl(s):void 0,g=t.length;for((this.basePTS===null||this.frameIndex===0&&le(_))&&(this.basePTS=Ch(_,n,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),s&&s.length>0&&d.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:fs.audioId3,duration:Number.POSITIVE_INFINITY});o<g;){if(this.canParse(t,o)){const v=this.appendFrame(c,t,o);v?(this.frameIndex++,this.lastPTS=v.sample.pts,o+=v.length,l=o):o=g}else bh(t,o)?(s=eo(t,o),d.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:fs.audioId3,duration:Number.POSITIVE_INFINITY}),o+=s.length,l=o):o++;if(o===g&&l!==g){const v=t.slice(l);this.cachedData?this.cachedData=yt(this.cachedData,v):this.cachedData=v}}return{audioTrack:c,videoTrack:Vs(),id3Track:d,textTrack:Vs()}}demuxSampleAes(t,n,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(t){const n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),{audioTrack:this._audioTrack,videoTrack:Vs(),id3Track:this._id3Track,textTrack:Vs()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const Ch=(h,t,n)=>{if(le(h))return h*90;const s=n?n.baseTime*9e4/n.timescale:0;return t*9e4+s};let wl=null;const Mh=[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],Ih=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Rh=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ph=[0,1,1,4];function Sl(h,t,n,s,o){if(n+24>t.length)return;const l=lc(t,n);if(l&&n+l.frameLength<=t.length){const c=l.samplesPerFrame*9e4/l.sampleRate,d=s+o*c,_={unit:t.subarray(n,n+l.frameLength),pts:d,dts:d};return h.config=[],h.channelCount=l.channelCount,h.samplerate=l.sampleRate,h.samples.push(_),{sample:_,length:l.frameLength,missing:0}}}function lc(h,t){const n=h[t+1]>>3&3,s=h[t+1]>>1&3,o=h[t+2]>>4&15,l=h[t+2]>>2&3;if(n!==1&&o!==0&&o!==15&&l!==3){const c=h[t+2]>>1&1,d=h[t+3]>>6,_=n===3?3-s:s===3?3:4,g=Mh[_*14+o-1]*1e3,y=Ih[(n===3?0:n===2?1:2)*3+l],x=d===3?1:2,L=Rh[n][s],M=Ph[s],B=L*8*M,F=Math.floor(L*g/y+c)*M;if(wl===null){const ce=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);wl=ce?parseInt(ce[1]):0}return!!wl&&wl<=87&&s===2&&g>=224e3&&d===0&&(h[t+3]=h[t+3]|128),{sampleRate:y,channelCount:x,frameLength:F,samplesPerFrame:B}}}function lu(h,t){return h[t]===255&&(h[t+1]&224)===224&&(h[t+1]&6)!==0}function uc(h,t){return t+1<h.length&&lu(h,t)}function Oh(h,t){return lu(h,t)&&4<=h.length-t}function cc(h,t){if(t+1<h.length&&lu(h,t)){const s=lc(h,t);let o=4;s!=null&&s.frameLength&&(o=s.frameLength);const l=t+o;return l===h.length||uc(h,l)}return!1}class Oo extends ou{constructor(t,n){super(),this.observer=void 0,this.config=void 0,this.observer=t,this.config=n}resetInitSegment(t,n,s,o){super.resetInitSegment(t,n,s,o),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:n,duration:o,inputTimeScale:9e4,dropped:0}}static probe(t,n){if(!t)return!1;const s=eo(t,0);let o=(s==null?void 0:s.length)||0;if(cc(t,o))return!1;for(let l=t.length;o<l;o++)if(nc(t,o))return n.log("ADTS sync word found !"),!0;return!1}canParse(t,n){return ic(t,n)}appendFrame(t,n,s){zs(t,this.observer,n,s,t.manifestCodec);const o=sc(t,n,s,this.basePTS,this.frameIndex);if(o&&o.missing===0)return o}}const to=(h,t)=>{let n=0,s=5;t+=s;const o=new Uint32Array(1),l=new Uint32Array(1),c=new Uint8Array(1);for(;s>0;){c[0]=h[t];const d=Math.min(s,8),_=8-d;l[0]=4278190080>>>24+_<<_,o[0]=(c[0]&l[0])>>_,n=n?n<<d|o[0]:o[0],t+=1,s-=d}return n};class hc extends ou{constructor(t){super(),this.observer=void 0,this.observer=t}resetInitSegment(t,n,s,o){super.resetInitSegment(t,n,s,o),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:n,duration:o,inputTimeScale:9e4,dropped:0}}canParse(t,n){return n+64<t.length}appendFrame(t,n,s){const o=fc(t,n,s,this.basePTS,this.frameIndex);if(o!==-1)return{sample:t.samples[t.samples.length-1],length:o,missing:0}}static probe(t){if(!t)return!1;const n=eo(t,0);if(!n)return!1;const s=n.length;return t[s]===11&&t[s+1]===119&&xl(n)!==void 0&&to(t,s)<16}}function fc(h,t,n,s,o){if(n+8>t.length||t[n]!==11||t[n+1]!==119)return-1;const l=t[n+4]>>6;if(l>=3)return-1;const d=[48e3,44100,32e3][l],_=t[n+4]&63,v=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][_*3+l]*2;if(n+v>t.length)return-1;const y=t[n+6]>>5;let x=0;y===2?x+=2:(y&1&&y!==1&&(x+=2),y&4&&(x+=2));const L=(t[n+6]<<8|t[n+7])>>12-x&1,B=[2,1,2,3,3,4,4,5][y]+L,F=t[n+5]>>3,W=t[n+5]&7,_e=new Uint8Array([l<<6|F<<1|W>>2,(W&3)<<6|y<<3|L<<2|_>>4,_<<4&224]),ce=1536/d*9e4,Pe=s+o*ce,Ue=t.subarray(n,n+v);return h.config=_e,h.channelCount=B,h.samplerate=d,h.samples.push({unit:Ue,pts:Pe}),v}class Fh extends ou{resetInitSegment(t,n,s,o){super.resetInitSegment(t,n,s,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:n,duration:o,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const n=eo(t,0);let s=(n==null?void 0:n.length)||0;if(n&&t[s]===11&&t[s+1]===119&&xl(n)!==void 0&&to(t,s)<=16)return!1;for(let o=t.length;s<o;s++)if(cc(t,s))return se.log("MPEG Audio sync word found !"),!0;return!1}canParse(t,n){return Oh(t,n)}appendFrame(t,n,s){if(this.basePTS!==null)return Sl(t,n,s,this.basePTS,this.frameIndex)}}const Bh=/\/emsg[-/]ID3/i;class Nh{constructor(t,n){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=n}resetTimeStamp(){}resetInitSegment(t,n,s,o){const l=this.videoTrack=Vs("video",1),c=this.audioTrack=Vs("audio",1),d=this.txtTrack=Vs("text",1);if(this.id3Track=Vs("id3",1),this.timeOffset=0,!(t!=null&&t.byteLength))return;const _=at(t);if(_.video){const{id:g,timescale:v,codec:y,supplemental:x}=_.video;l.id=g,l.timescale=d.timescale=v,l.codec=y,l.supplemental=x}if(_.audio){const{id:g,timescale:v,codec:y}=_.audio;c.id=g,c.timescale=v,c.codec=y}d.id=Ne.text,l.sampleDuration=0,l.duration=c.duration=o}resetContiguity(){this.remainderData=null}static probe(t){return Fe(t)}demux(t,n){this.timeOffset=n;let s=t;const o=this.videoTrack,l=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=yt(this.remainderData,t));const d=Se(s);this.remainderData=d.remainder,o.samples=d.valid||new Uint8Array}else o.samples=s;const c=this.extractID3Track(o,n);return l.samples=Wt(n,o),{videoTrack:o,audioTrack:this.audioTrack,id3Track:c,textTrack:this.txtTrack}}flush(){const t=this.timeOffset,n=this.videoTrack,s=this.txtTrack;n.samples=this.remainderData||new Uint8Array,this.remainderData=null;const o=this.extractID3Track(n,this.timeOffset);return s.samples=Wt(t,n),{videoTrack:n,audioTrack:Vs(),id3Track:o,textTrack:Vs()}}extractID3Track(t,n){const s=this.id3Track;if(t.samples.length){const o=me(t.samples,["emsg"]);o&&o.forEach(l=>{const c=bt(l);if(Bh.test(c.schemeIdUri)){const d=El(c,n);let _=c.eventDuration===4294967295?Number.POSITIVE_INFINITY:c.eventDuration/c.timeScale;_<=.001&&(_=Number.POSITIVE_INFINITY);const g=c.payload;s.samples.push({data:g,len:g.byteLength,dts:d,pts:d,type:fs.emsg,duration:_})}else if(this.config.enableEmsgKLVMetadata&&c.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const d=El(c,n);s.samples.push({data:c.payload,len:c.payload.byteLength,dts:d,pts:d,type:fs.misbklv,duration:Number.POSITIVE_INFINITY})}})}return s}demuxSampleAes(t,n,s){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 El(h,t){return le(h.presentationTime)?h.presentationTime/h.timeScale:t+h.presentationTimeDelta/h.timeScale}class $h{constructor(t,n,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new qn(n,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,an.cbc)}decryptAacSample(t,n,s){const o=t[n].unit;if(o.length<=16)return;const l=o.subarray(16,o.length-o.length%16),c=l.buffer.slice(l.byteOffset,l.byteOffset+l.length);this.decryptBuffer(c).then(d=>{const _=new Uint8Array(d);o.set(_,16),this.decrypter.isSync()||this.decryptAacSamples(t,n+1,s)}).catch(s)}decryptAacSamples(t,n,s){for(;;n++){if(n>=t.length){s();return}if(!(t[n].unit.length<32)&&(this.decryptAacSample(t,n,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(t){const n=Math.floor((t.length-48)/160)*16+16,s=new Int8Array(n);let o=0;for(let l=32;l<t.length-16;l+=160,o+=16)s.set(t.subarray(l,l+16),o);return s}getAvcDecryptedUnit(t,n){const s=new Uint8Array(n);let o=0;for(let l=32;l<t.length-16;l+=160,o+=16)t.set(s.subarray(o,o+16),l);return t}decryptAvcSample(t,n,s,o,l){const c=rt(l.data),d=this.getAvcEncryptedData(c);this.decryptBuffer(d.buffer).then(_=>{l.data=this.getAvcDecryptedUnit(c,_),this.decrypter.isSync()||this.decryptAvcSamples(t,n,s+1,o)}).catch(o)}decryptAvcSamples(t,n,s,o){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;n++,s=0){if(n>=t.length){o();return}const l=t[n].units;for(;!(s>=l.length);s++){const c=l[s];if(!(c.data.length<=48||c.type!==1&&c.type!==5)&&(this.decryptAvcSample(t,n,s,o,c),!this.decrypter.isSync()))return}}}}class dc{constructor(){this.VideoSample=null}createVideoSample(t,n,s){return{key:t,frame:!1,pts:n,dts:s,units:[],length:0}}getLastNalUnit(t){var n;let s=this.VideoSample,o;if((!s||s.units.length===0)&&(s=t[t.length-1]),(n=s)!=null&&n.units){const l=s.units;o=l[l.length-1]}return o}pushAccessUnit(t,n){if(t.units.length&&t.frame){if(t.pts===void 0){const s=n.samples,o=s.length;if(o){const l=s[o-1];t.pts=l.pts,t.dts=l.dts}else{n.dropped++;return}}n.samples.push(t)}}parseNALu(t,n,s){const o=n.byteLength;let l=t.naluState||0;const c=l,d=[];let _=0,g,v,y,x=-1,L=0;for(l===-1&&(x=0,L=this.getNALuType(n,0),l=0,_=1);_<o;){if(g=n[_++],!l){l=g?0:1;continue}if(l===1){l=g?0:2;continue}if(!g)l=3;else if(g===1){if(v=_-l-1,x>=0){const M={data:n.subarray(x,v),type:L};d.push(M)}else{const M=this.getLastNalUnit(t.samples);M&&(c&&_<=4-c&&M.state&&(M.data=M.data.subarray(0,M.data.byteLength-c)),v>0&&(M.data=yt(M.data,n.subarray(0,v)),M.state=0))}_<o?(y=this.getNALuType(n,_),x=_,L=y,l=0):l=-1}else l=0}if(x>=0&&l>=0){const M={data:n.subarray(x,o),type:L,state:l};d.push(M)}if(d.length===0){const M=this.getLastNalUnit(t.samples);M&&(M.data=yt(M.data,n))}return t.naluState=l,d}}class Fo{constructor(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const t=this.data,n=this.bytesAvailable,s=t.byteLength-n,o=new Uint8Array(4),l=Math.min(4,n);if(l===0)throw new Error("no bytes available");o.set(t.subarray(s,s+l)),this.word=new DataView(o.buffer).getUint32(0),this.bitsAvailable=l*8,this.bytesAvailable-=l}skipBits(t){let n;t=Math.min(t,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,n=t>>3,t-=n<<3,this.bytesAvailable-=n,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let n=Math.min(this.bitsAvailable,t);const s=this.word>>>32-n;if(t>32&&se.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=n,this.bitsAvailable>0)this.word<<=n;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return n=t-n,n>0&&this.bitsAvailable?s<<n|this.readBits(n):s}skipLZ(){let t;for(t=0;t<this.bitsAvailable;++t)if(this.word&2147483648>>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class Bo extends dc{parsePES(t,n,s,o){const l=this.parseNALu(t,s.data,o);let c=this.VideoSample,d,_=!1;s.data=null,c&&l.length&&!t.audFound&&(this.pushAccessUnit(c,t),c=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),l.forEach(g=>{var v,y;switch(g.type){case 1:{let B=!1;d=!0;const F=g.data;if(_&&F.length>4){const W=this.readSliceType(F);(W===2||W===4||W===7||W===9)&&(B=!0)}if(B){var x;(x=c)!=null&&x.frame&&!c.key&&(this.pushAccessUnit(c,t),c=this.VideoSample=null)}c||(c=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),c.frame=!0,c.key=B;break}case 5:d=!0,(v=c)!=null&&v.frame&&!c.key&&(this.pushAccessUnit(c,t),c=this.VideoSample=null),c||(c=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),c.key=!0,c.frame=!0;break;case 6:{d=!0,Me(g.data,1,s.pts,n.samples);break}case 7:{var L,M;d=!0,_=!0;const B=g.data,F=this.readSPS(B);if(!t.sps||t.width!==F.width||t.height!==F.height||((L=t.pixelRatio)==null?void 0:L[0])!==F.pixelRatio[0]||((M=t.pixelRatio)==null?void 0:M[1])!==F.pixelRatio[1]){t.width=F.width,t.height=F.height,t.pixelRatio=F.pixelRatio,t.sps=[B];const W=B.subarray(1,4);let _e="avc1.";for(let ce=0;ce<3;ce++){let Pe=W[ce].toString(16);Pe.length<2&&(Pe="0"+Pe),_e+=Pe}t.codec=_e}break}case 8:d=!0,t.pps=[g.data];break;case 9:d=!0,t.audFound=!0,(y=c)!=null&&y.frame&&(this.pushAccessUnit(c,t),c=null),c||(c=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:d=!0;break;default:d=!1;break}c&&d&&c.units.push(g)}),o&&c&&(this.pushAccessUnit(c,t),this.VideoSample=null)}getNALuType(t,n){return t[n]&31}readSliceType(t){const n=new Fo(t);return n.readUByte(),n.readUEG(),n.readUEG()}skipScalingList(t,n){let s=8,o=8,l;for(let c=0;c<t;c++)o!==0&&(l=n.readEG(),o=(s+l+256)%256),s=o===0?s:o}readSPS(t){const n=new Fo(t);let s=0,o=0,l=0,c=0,d,_,g;const v=n.readUByte.bind(n),y=n.readBits.bind(n),x=n.readUEG.bind(n),L=n.readBoolean.bind(n),M=n.skipBits.bind(n),B=n.skipEG.bind(n),F=n.skipUEG.bind(n),W=this.skipScalingList.bind(this);v();const _e=v();if(y(5),M(3),v(),F(),_e===100||_e===110||_e===122||_e===244||_e===44||_e===83||_e===86||_e===118||_e===128){const Qe=x();if(Qe===3&&M(1),F(),F(),M(1),L())for(_=Qe!==3?8:12,g=0;g<_;g++)L()&&(g<6?W(16,n):W(64,n))}F();const ce=x();if(ce===0)x();else if(ce===1)for(M(1),B(),B(),d=x(),g=0;g<d;g++)B();F(),M(1);const Pe=x(),Ue=x(),dt=y(1);dt===0&&M(1),M(1),L()&&(s=x(),o=x(),l=x(),c=x());let $e=[1,1];if(L()&&L())switch(v()){case 1:$e=[1,1];break;case 2:$e=[12,11];break;case 3:$e=[10,11];break;case 4:$e=[16,11];break;case 5:$e=[40,33];break;case 6:$e=[24,11];break;case 7:$e=[20,11];break;case 8:$e=[32,11];break;case 9:$e=[80,33];break;case 10:$e=[18,11];break;case 11:$e=[15,11];break;case 12:$e=[64,33];break;case 13:$e=[160,99];break;case 14:$e=[4,3];break;case 15:$e=[3,2];break;case 16:$e=[2,1];break;case 255:{$e=[v()<<8|v(),v()<<8|v()];break}}return{width:Math.ceil((Pe+1)*16-s*2-o*2),height:(2-dt)*(Ue+1)*16-(dt?2:4)*(l+c),pixelRatio:$e}}}class uu extends dc{constructor(...t){super(...t),this.initVPS=null}parsePES(t,n,s,o){const l=this.parseNALu(t,s.data,o);let c=this.VideoSample,d,_=!1;s.data=null,c&&l.length&&!t.audFound&&(this.pushAccessUnit(c,t),c=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),l.forEach(g=>{var v,y;switch(g.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:c||(c=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),c.frame=!0,d=!0;break;case 16:case 17:case 18:case 21:if(d=!0,_){var x;(x=c)!=null&&x.frame&&!c.key&&(this.pushAccessUnit(c,t),c=this.VideoSample=null)}c||(c=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),c.key=!0,c.frame=!0;break;case 19:case 20:d=!0,(v=c)!=null&&v.frame&&!c.key&&(this.pushAccessUnit(c,t),c=this.VideoSample=null),c||(c=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),c.key=!0,c.frame=!0;break;case 39:d=!0,Me(g.data,2,s.pts,n.samples);break;case 32:d=!0,t.vps||(typeof t.params!="object"&&(t.params={}),t.params=k(t.params,this.readVPS(g.data)),this.initVPS=g.data),t.vps=[g.data];break;case 33:if(d=!0,_=!0,t.vps!==void 0&&t.vps[0]!==this.initVPS&&t.sps!==void 0&&!this.matchSPS(t.sps[0],g.data)&&(this.initVPS=t.vps[0],t.sps=t.pps=void 0),!t.sps){const L=this.readSPS(g.data);t.width=L.width,t.height=L.height,t.pixelRatio=L.pixelRatio,t.codec=L.codecString,t.sps=[],typeof t.params!="object"&&(t.params={});for(const M in L.params)t.params[M]=L.params[M]}this.pushParameterSet(t.sps,g.data,t.vps),c||(c=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),c.key=!0;break;case 34:if(d=!0,typeof t.params=="object"){if(!t.pps){t.pps=[];const L=this.readPPS(g.data);for(const M in L)t.params[M]=L[M]}this.pushParameterSet(t.pps,g.data,t.vps)}break;case 35:d=!0,t.audFound=!0,(y=c)!=null&&y.frame&&(this.pushAccessUnit(c,t),c=null),c||(c=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:d=!1;break}c&&d&&c.units.push(g)}),o&&c&&(this.pushAccessUnit(c,t),this.VideoSample=null)}pushParameterSet(t,n,s){(s&&s[0]===this.initVPS||!s&&!t.length)&&t.push(n)}getNALuType(t,n){return(t[n]&126)>>>1}ebsp2rbsp(t){const n=new Uint8Array(t.byteLength);let s=0;for(let o=0;o<t.byteLength;o++)o>=2&&t[o]===3&&t[o-1]===0&&t[o-2]===0||(n[s]=t[o],s++);return new Uint8Array(n.buffer,0,s)}pushAccessUnit(t,n){super.pushAccessUnit(t,n),this.initVPS&&(this.initVPS=null)}readVPS(t){const n=new Fo(t);n.readUByte(),n.readUByte(),n.readBits(4),n.skipBits(2),n.readBits(6);const s=n.readBits(3),o=n.readBoolean();return{numTemporalLayers:s+1,temporalIdNested:o}}readSPS(t){const n=new Fo(this.ebsp2rbsp(t));n.readUByte(),n.readUByte(),n.readBits(4);const s=n.readBits(3);n.readBoolean();const o=n.readBits(2),l=n.readBoolean(),c=n.readBits(5),d=n.readUByte(),_=n.readUByte(),g=n.readUByte(),v=n.readUByte(),y=n.readUByte(),x=n.readUByte(),L=n.readUByte(),M=n.readUByte(),B=n.readUByte(),F=n.readUByte(),W=n.readUByte(),_e=[],ce=[];for(let Ii=0;Ii<s;Ii++)_e.push(n.readBoolean()),ce.push(n.readBoolean());if(s>0)for(let Ii=s;Ii<8;Ii++)n.readBits(2);for(let Ii=0;Ii<s;Ii++)_e[Ii]&&(n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte()),ce[Ii]&&n.readUByte();n.readUEG();const Pe=n.readUEG();Pe==3&&n.skipBits(1);const Ue=n.readUEG(),dt=n.readUEG(),$e=n.readBoolean();let Qe=0,et=0,Be=0,Tt=0;$e&&(Qe+=n.readUEG(),et+=n.readUEG(),Be+=n.readUEG(),Tt+=n.readUEG());const ti=n.readUEG(),hi=n.readUEG(),Ti=n.readUEG(),ci=n.readBoolean();for(let Ii=ci?0:s;Ii<=s;Ii++)n.skipUEG(),n.skipUEG(),n.skipUEG();if(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.readBoolean()&&n.readBoolean())for(let ns=0;ns<4;ns++)for(let As=0;As<(ns===3?2:6);As++)if(!n.readBoolean())n.readUEG();else{const _s=Math.min(64,1<<4+(ns<<1));ns>1&&n.readEG();for(let sl=0;sl<_s;sl++)n.readEG()}n.readBoolean(),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.skipUEG(),n.skipUEG(),n.readBoolean());const li=n.readUEG();let Si=0;for(let Ii=0;Ii<li;Ii++){let ns=!1;if(Ii!==0&&(ns=n.readBoolean()),ns){Ii===li&&n.readUEG(),n.readBoolean(),n.readUEG();let As=0;for(let Ls=0;Ls<=Si;Ls++){const _s=n.readBoolean();let sl=!1;_s||(sl=n.readBoolean()),(_s||sl)&&As++}Si=As}else{const As=n.readUEG(),Ls=n.readUEG();Si=As+Ls;for(let _s=0;_s<As;_s++)n.readUEG(),n.readBoolean();for(let _s=0;_s<Ls;_s++)n.readUEG(),n.readBoolean()}}if(n.readBoolean()){const Ii=n.readUEG();for(let ns=0;ns<Ii;ns++){for(let As=0;As<Ti+4;As++)n.readBits(1);n.readBits(1)}}let Qt=0,Yt=1,hn=1,Fn=!0,dn=1,_n=0;n.readBoolean(),n.readBoolean();let Xr=!1;if(n.readBoolean()){if(n.readBoolean()){const Ba=n.readUByte(),js=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Jr=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];Ba>0&&Ba<16?(Yt=js[Ba-1],hn=Jr[Ba-1]):Ba===255&&(Yt=n.readBits(16),hn=n.readBits(16))}if(n.readBoolean()&&n.readBoolean(),n.readBoolean()&&(n.readBits(3),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.readUByte(),n.readUByte())),n.readBoolean()&&(n.readUEG(),n.readUEG()),n.readBoolean(),n.readBoolean(),n.readBoolean(),Xr=n.readBoolean(),Xr&&(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG()),n.readBoolean()&&(dn=n.readBits(32),_n=n.readBits(32),n.readBoolean()&&n.readUEG(),n.readBoolean())){const Jr=n.readBoolean(),Ku=n.readBoolean();let ra=!1;(Jr||Ku)&&(ra=n.readBoolean(),ra&&(n.readUByte(),n.readBits(5),n.readBoolean(),n.readBits(5)),n.readBits(4),n.readBits(4),ra&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5));for(let Mf=0;Mf<=s;Mf++){Fn=n.readBoolean();const i0=Fn||n.readBoolean();let If=!1;i0?n.readEG():If=n.readBoolean();const Rf=If?1:n.readUEG()+1;if(Jr)for(let Na=0;Na<Rf;Na++)n.readUEG(),n.readUEG(),ra&&(n.readUEG(),n.readUEG()),n.skipBits(1);if(Ku)for(let Na=0;Na<Rf;Na++)n.readUEG(),n.readUEG(),ra&&(n.readUEG(),n.readUEG()),n.skipBits(1)}}n.readBoolean()&&(n.readBoolean(),n.readBoolean(),n.readBoolean(),Qt=n.readUEG())}let gs=Ue,Ws=dt;if($e){let Ii=1,ns=1;Pe===1?Ii=ns=2:Pe==2&&(Ii=2),gs=Ue-Ii*et-Ii*Qe,Ws=dt-ns*Tt-ns*Be}const yo=o?["A","B","C"][o]:"",Ts=d<<24|_<<16|g<<8|v;let Jc=0;for(let Ii=0;Ii<32;Ii++)Jc=(Jc|(Ts>>Ii&1)<<31-Ii)>>>0;let rl=Jc.toString(16);return c===1&&rl==="2"&&(rl="6"),{codecString:`hvc1.${yo}${c}.${rl}.${l?"H":"L"}${W}.B0`,params:{general_tier_flag:l,general_profile_idc:c,general_profile_space:o,general_profile_compatibility_flags:[d,_,g,v],general_constraint_indicator_flags:[y,x,L,M,B,F],general_level_idc:W,bit_depth:ti+8,bit_depth_luma_minus8:ti,bit_depth_chroma_minus8:hi,min_spatial_segmentation_idc:Qt,chroma_format_idc:Pe,frame_rate:{fixed:Fn,fps:_n/dn}},width:gs,height:Ws,pixelRatio:[Yt,hn]}}readPPS(t){const n=new Fo(this.ebsp2rbsp(t));n.readUByte(),n.readUByte(),n.skipUEG(),n.skipUEG(),n.skipBits(2),n.skipBits(3),n.skipBits(2),n.skipUEG(),n.skipUEG(),n.skipEG(),n.skipBits(2),n.readBoolean()&&n.skipUEG(),n.skipEG(),n.skipEG(),n.skipBits(4);const o=n.readBoolean(),l=n.readBoolean();let c=1;return l&&o?c=0:l?c=3:o&&(c=2),{parallelismType:c}}matchSPS(t,n){return String.fromCharCode.apply(null,t).substr(3)===String.fromCharCode.apply(null,n).substr(3)}}const Pr=188;class ea{constructor(t,n,s,o){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=n,this.typeSupported=s,this.logger=o,this.videoParser=null}static probe(t,n){const s=ea.syncOffset(t);return s>0&&n.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(t){const n=t.length;let s=Math.min(Pr*5,n-Pr)+1,o=0;for(;o<s;){let l=!1,c=-1,d=0;for(let _=o;_<n;_+=Pr)if(t[_]===71&&(n-_===Pr||t[_+Pr]===71)){if(d++,c===-1&&(c=_,c!==0&&(s=Math.min(c+Pr*99,t.length-Pr)+1)),l||(l=cu(t,_)===0),l&&d>1&&(c===0&&d>2||_+Pr>s))return c}else{if(d)return-1;break}o++}return-1}static createTrack(t,n){return{container:t==="video"||t==="audio"?"video/mp2t":void 0,type:t,id:Ne[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:t==="audio"?n:void 0}}resetInitSegment(t,n,s,o){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=ea.createTrack("video"),this._videoTrack.duration=o,this._audioTrack=ea.createTrack("audio",o),this._id3Track=ea.createTrack("id3"),this._txtTrack=ea.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:t,_videoTrack:n,_id3Track:s}=this;t&&(t.pesData=null),n&&(n.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,n,s=!1,o=!1){s||(this.sampleAes=null);let l;const c=this._videoTrack,d=this._audioTrack,_=this._id3Track,g=this._txtTrack;let v=c.pid,y=c.pesData,x=d.pid,L=_.pid,M=d.pesData,B=_.pesData,F=null,W=this.pmtParsed,_e=this._pmtId,ce=t.length;if(this.remainderData&&(t=yt(this.remainderData,t),ce=t.length,this.remainderData=null),ce<Pr&&!o)return this.remainderData=t,{audioTrack:d,videoTrack:c,id3Track:_,textTrack:g};const Pe=Math.max(0,ea.syncOffset(t));ce-=(ce-Pe)%Pr,ce<t.byteLength&&!o&&(this.remainderData=new Uint8Array(t.buffer,ce,t.buffer.byteLength-ce));let Ue=0;for(let $e=Pe;$e<ce;$e+=Pr)if(t[$e]===71){const Qe=!!(t[$e+1]&64),et=cu(t,$e),Be=(t[$e+3]&48)>>4;let Tt;if(Be>1){if(Tt=$e+5+t[$e+4],Tt===$e+Pr)continue}else Tt=$e+4;switch(et){case v:Qe&&(y&&(l=ha(y,this.logger))&&(this.readyVideoParser(c.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(c,g,l,!1)),y={data:[],size:0}),y&&(y.data.push(t.subarray(Tt,$e+Pr)),y.size+=$e+Pr-Tt);break;case x:if(Qe){if(M&&(l=ha(M,this.logger)))switch(d.segmentCodec){case"aac":this.parseAACPES(d,l);break;case"mp3":this.parseMPEGPES(d,l);break;case"ac3":this.parseAC3PES(d,l);break}M={data:[],size:0}}M&&(M.data.push(t.subarray(Tt,$e+Pr)),M.size+=$e+Pr-Tt);break;case L:Qe&&(B&&(l=ha(B,this.logger))&&this.parseID3PES(_,l),B={data:[],size:0}),B&&(B.data.push(t.subarray(Tt,$e+Pr)),B.size+=$e+Pr-Tt);break;case 0:Qe&&(Tt+=t[Tt]+1),_e=this._pmtId=Kh(t,Tt);break;case _e:{Qe&&(Tt+=t[Tt]+1);const ti=Uh(t,Tt,this.typeSupported,s,this.observer,this.logger);v=ti.videoPid,v>0&&(c.pid=v,c.segmentCodec=ti.segmentVideoCodec),x=ti.audioPid,x>0&&(d.pid=x,d.segmentCodec=ti.segmentAudioCodec),L=ti.id3Pid,L>0&&(_.pid=L),F!==null&&!W&&(this.logger.warn(`MPEG-TS PMT found at ${$e} after unknown PID '${F}'. Backtracking to sync byte @${Pe} to parse all TS packets.`),F=null,$e=Pe-188),W=this.pmtParsed=!0;break}case 17:case 8191:break;default:F=et;break}}else Ue++;Ue>0&&No(this.observer,new Error(`Found ${Ue} TS packet/s that do not start with 0x47`),void 0,this.logger),c.pesData=y,d.pesData=M,_.pesData=B;const dt={audioTrack:d,videoTrack:c,id3Track:_,textTrack:g};return o&&this.extractRemainingSamples(dt),dt}flush(){const{remainderData:t}=this;this.remainderData=null;let n;return t?n=this.demux(t,-1,!1,!0):n={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(n),this.sampleAes?this.decrypt(n,this.sampleAes):n}extractRemainingSamples(t){const{audioTrack:n,videoTrack:s,id3Track:o,textTrack:l}=t,c=s.pesData,d=n.pesData,_=o.pesData;let g;if(c&&(g=ha(c,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,l,g,!0),s.pesData=null)):s.pesData=c,d&&(g=ha(d,this.logger))){switch(n.segmentCodec){case"aac":this.parseAACPES(n,g);break;case"mp3":this.parseMPEGPES(n,g);break;case"ac3":this.parseAC3PES(n,g);break}n.pesData=null}else d!=null&&d.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),n.pesData=d;_&&(g=ha(_,this.logger))?(this.parseID3PES(o,g),o.pesData=null):o.pesData=_}demuxSampleAes(t,n,s){const o=this.demux(t,s,!0,!this.config.progressive),l=this.sampleAes=new $h(this.observer,this.config,n);return this.decrypt(o,l)}readyVideoParser(t){this.videoParser===null&&(t==="avc"?this.videoParser=new Bo:t==="hevc"&&(this.videoParser=new uu))}decrypt(t,n){return new Promise(s=>{const{audioTrack:o,videoTrack:l}=t;o.samples&&o.segmentCodec==="aac"?n.decryptAacSamples(o.samples,0,()=>{l.samples?n.decryptAvcSamples(l.samples,0,0,()=>{s(t)}):s(t)}):l.samples&&n.decryptAvcSamples(l.samples,0,0,()=>{s(t)})})}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(t,n){let s=0;const o=this.aacOverFlow;let l=n.data;if(o){this.aacOverFlow=null;const y=o.missing,x=o.sample.unit.byteLength;if(y===-1)l=yt(o.sample.unit,l);else{const L=x-y;o.sample.unit.set(l.subarray(0,y),L),t.samples.push(o.sample),s=o.missing}}let c,d;for(c=s,d=l.length;c<d-1&&!bl(l,c);c++);if(c!==s){let y;const x=c<d-1;if(x?y=`AAC PES did not start with ADTS header,offset:${c}`:y="No ADTS header found in AAC PES",No(this.observer,new Error(y),x,this.logger),!x)return}zs(t,this.observer,l,c,this.audioCodec);let _;if(n.pts!==void 0)_=n.pts;else if(o){const y=nu(t.samplerate);_=o.sample.pts+y}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let g=0,v;for(;c<d;)if(v=sc(t,l,c,_,g),c+=v.length,v.missing){this.aacOverFlow=v;break}else for(g++;c<d-1&&!bl(l,c);c++);}parseMPEGPES(t,n){const s=n.data,o=s.length;let l=0,c=0;const d=n.pts;if(d===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;c<o;)if(uc(s,c)){const _=Sl(t,s,c,d,l);if(_)c+=_.length,l++;else break}else c++}parseAC3PES(t,n){{const s=n.data,o=n.pts;if(o===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const l=s.length;let c=0,d=0,_;for(;d<l&&(_=fc(t,s,d,o,c++))>0;)d+=_}}parseID3PES(t,n){if(n.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const s=k({},n,{type:this._videoTrack?fs.emsg:fs.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(s)}}function cu(h,t){return((h[t+1]&31)<<8)+h[t+2]}function Kh(h,t){return(h[t+10]&31)<<8|h[t+11]}function Uh(h,t,n,s,o,l){const c={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},d=(h[t+1]&15)<<8|h[t+2],_=t+3+d-4,g=(h[t+10]&15)<<8|h[t+11];for(t+=12+g;t<_;){const v=cu(h,t),y=(h[t+3]&15)<<8|h[t+4];switch(h[t]){case 207:if(!s){$o("ADTS AAC",l);break}case 15:c.audioPid===-1&&(c.audioPid=v);break;case 21:c.id3Pid===-1&&(c.id3Pid=v);break;case 219:if(!s){$o("H.264",l);break}case 27:c.videoPid===-1&&(c.videoPid=v);break;case 3:case 4:!n.mpeg&&!n.mp3?l.log("MPEG audio found, not supported in this browser"):c.audioPid===-1&&(c.audioPid=v,c.segmentAudioCodec="mp3");break;case 193:if(!s){$o("AC-3",l);break}case 129:n.ac3?c.audioPid===-1&&(c.audioPid=v,c.segmentAudioCodec="ac3"):l.log("AC-3 audio found, not supported in this browser");break;case 6:if(c.audioPid===-1&&y>0){let x=t+5,L=y;for(;L>2;){switch(h[x]){case 106:n.ac3!==!0?l.log("AC-3 audio found, not supported in this browser for now"):(c.audioPid=v,c.segmentAudioCodec="ac3");break}const B=h[x+1]+2;x+=B,L-=B}}break;case 194:case 135:return No(o,new Error("Unsupported EC-3 in M2TS found"),void 0,l),c;case 36:c.videoPid===-1&&(c.videoPid=v,c.segmentVideoCodec="hevc",l.log("HEVC in M2TS found"));break}t+=y+5}return c}function No(h,t,n,s){s.warn(`parsing error: ${t.message}`),h.emit(S.ERROR,S.ERROR,{type:pe.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:t,reason:t.message})}function $o(h,t){t.log(`${h} with AES-128-CBC encryption found in unencrypted stream`)}function ha(h,t){let n=0,s,o,l,c,d;const _=h.data;if(!h||h.size===0)return null;for(;_[0].length<19&&_.length>1;)_[0]=yt(_[0],_[1]),_.splice(1,1);if(s=_[0],(s[0]<<16)+(s[1]<<8)+s[2]===1){if(o=(s[4]<<8)+s[5],o&&o>h.size-6)return null;const v=s[7];v&192&&(c=(s[9]&14)*536870912+(s[10]&255)*4194304+(s[11]&254)*16384+(s[12]&255)*128+(s[13]&254)/2,v&64?(d=(s[14]&14)*536870912+(s[15]&255)*4194304+(s[16]&254)*16384+(s[17]&255)*128+(s[18]&254)/2,c-d>60*9e4&&(t.warn(`${Math.round((c-d)/9e4)}s delta between PTS and DTS, align them`),c=d)):d=c),l=s[8];let y=l+9;if(h.size<=y)return null;h.size-=y;const x=new Uint8Array(h.size);for(let L=0,M=_.length;L<M;L++){s=_[L];let B=s.byteLength;if(y)if(y>B){y-=B;continue}else s=s.subarray(y),B-=y,y=0;x.set(s,n),n+=B}return o&&(o-=l+3),{data:x,pts:c,dts:d,len:o}}return null}class zh{static getSilentFrame(t,n){switch(t){case"mp4a.40.2":if(n===1)return new Uint8Array([0,200,0,128,35,128]);if(n===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(n===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(n===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(n===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(n===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(n===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(n===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(n===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 fa=Math.pow(2,32)-1;class Ge{static init(){Ge.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 t;for(t in Ge.types)Ge.types.hasOwnProperty(t)&&(Ge.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);const n=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]),s=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]);Ge.HDLR_TYPES={video:n,audio:s};const o=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),l=new Uint8Array([0,0,0,0,0,0,0,0]);Ge.STTS=Ge.STSC=Ge.STCO=l,Ge.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ge.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Ge.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Ge.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const c=new Uint8Array([105,115,111,109]),d=new Uint8Array([97,118,99,49]),_=new Uint8Array([0,0,0,1]);Ge.FTYP=Ge.box(Ge.types.ftyp,c,_,c,d),Ge.DINF=Ge.box(Ge.types.dinf,Ge.box(Ge.types.dref,o))}static box(t,...n){let s=8,o=n.length;const l=o;for(;o--;)s+=n[o].byteLength;const c=new Uint8Array(s);for(c[0]=s>>24&255,c[1]=s>>16&255,c[2]=s>>8&255,c[3]=s&255,c.set(t,4),o=0,s=8;o<l;o++)c.set(n[o],s),s+=n[o].byteLength;return c}static hdlr(t){return Ge.box(Ge.types.hdlr,Ge.HDLR_TYPES[t])}static mdat(t){return Ge.box(Ge.types.mdat,t)}static mdhd(t,n){n*=t;const s=Math.floor(n/(fa+1)),o=Math.floor(n%(fa+1));return Ge.box(Ge.types.mdhd,new Uint8Array([1,0,0,0,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,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&255,85,196,0,0]))}static mdia(t){return Ge.box(Ge.types.mdia,Ge.mdhd(t.timescale||0,t.duration||0),Ge.hdlr(t.type),Ge.minf(t))}static mfhd(t){return Ge.box(Ge.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255]))}static minf(t){return t.type==="audio"?Ge.box(Ge.types.minf,Ge.box(Ge.types.smhd,Ge.SMHD),Ge.DINF,Ge.stbl(t)):Ge.box(Ge.types.minf,Ge.box(Ge.types.vmhd,Ge.VMHD),Ge.DINF,Ge.stbl(t))}static moof(t,n,s){return Ge.box(Ge.types.moof,Ge.mfhd(t),Ge.traf(s,n))}static moov(t){let n=t.length;const s=[];for(;n--;)s[n]=Ge.trak(t[n]);return Ge.box.apply(null,[Ge.types.moov,Ge.mvhd(t[0].timescale||0,t[0].duration||0)].concat(s).concat(Ge.mvex(t)))}static mvex(t){let n=t.length;const s=[];for(;n--;)s[n]=Ge.trex(t[n]);return Ge.box.apply(null,[Ge.types.mvex,...s])}static mvhd(t,n){n*=t;const s=Math.floor(n/(fa+1)),o=Math.floor(n%(fa+1)),l=new Uint8Array([1,0,0,0,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,s>>24,s>>16&255,s>>8&255,s&255,o>>24,o>>16&255,o>>8&255,o&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 Ge.box(Ge.types.mvhd,l)}static sdtp(t){const n=t.samples||[],s=new Uint8Array(4+n.length);let o,l;for(o=0;o<n.length;o++)l=n[o].flags,s[o+4]=l.dependsOn<<4|l.isDependedOn<<2|l.hasRedundancy;return Ge.box(Ge.types.sdtp,s)}static stbl(t){return Ge.box(Ge.types.stbl,Ge.stsd(t),Ge.box(Ge.types.stts,Ge.STTS),Ge.box(Ge.types.stsc,Ge.STSC),Ge.box(Ge.types.stsz,Ge.STSZ),Ge.box(Ge.types.stco,Ge.STCO))}static avc1(t){let n=[],s=[],o,l,c;for(o=0;o<t.sps.length;o++)l=t.sps[o],c=l.byteLength,n.push(c>>>8&255),n.push(c&255),n=n.concat(Array.prototype.slice.call(l));for(o=0;o<t.pps.length;o++)l=t.pps[o],c=l.byteLength,s.push(c>>>8&255),s.push(c&255),s=s.concat(Array.prototype.slice.call(l));const d=Ge.box(Ge.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|t.sps.length].concat(n).concat([t.pps.length]).concat(s))),_=t.width,g=t.height,v=t.pixelRatio[0],y=t.pixelRatio[1];return Ge.box(Ge.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,_>>8&255,_&255,g>>8&255,g&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]),d,Ge.box(Ge.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ge.box(Ge.types.pasp,new Uint8Array([v>>24,v>>16&255,v>>8&255,v&255,y>>24,y>>16&255,y>>8&255,y&255])))}static esds(t){const n=t.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,...n,6,1,2])}static audioStsd(t){const n=t.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount||0,0,16,0,0,0,0,n>>8&255,n&255,0,0])}static mp4a(t){return Ge.box(Ge.types.mp4a,Ge.audioStsd(t),Ge.box(Ge.types.esds,Ge.esds(t)))}static mp3(t){return Ge.box(Ge.types[".mp3"],Ge.audioStsd(t))}static ac3(t){return Ge.box(Ge.types["ac-3"],Ge.audioStsd(t),Ge.box(Ge.types.dac3,t.config))}static stsd(t){const{segmentCodec:n}=t;if(t.type==="audio"){if(n==="aac")return Ge.box(Ge.types.stsd,Ge.STSD,Ge.mp4a(t));if(n==="ac3"&&t.config)return Ge.box(Ge.types.stsd,Ge.STSD,Ge.ac3(t));if(n==="mp3"&&t.codec==="mp3")return Ge.box(Ge.types.stsd,Ge.STSD,Ge.mp3(t))}else if(t.pps&&t.sps){if(n==="avc")return Ge.box(Ge.types.stsd,Ge.STSD,Ge.avc1(t));if(n==="hevc"&&t.vps)return Ge.box(Ge.types.stsd,Ge.STSD,Ge.hvc1(t))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${t.type} segment codec (${n}/${t.codec})`)}static tkhd(t){const n=t.id,s=(t.duration||0)*(t.timescale||0),o=t.width||0,l=t.height||0,c=Math.floor(s/(fa+1)),d=Math.floor(s%(fa+1));return Ge.box(Ge.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,c>>24,c>>16&255,c>>8&255,c&255,d>>24,d>>16&255,d>>8&255,d&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,o>>8&255,o&255,0,0,l>>8&255,l&255,0,0]))}static traf(t,n){const s=Ge.sdtp(t),o=t.id,l=Math.floor(n/(fa+1)),c=Math.floor(n%(fa+1));return Ge.box(Ge.types.traf,Ge.box(Ge.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255])),Ge.box(Ge.types.tfdt,new Uint8Array([1,0,0,0,l>>24,l>>16&255,l>>8&255,l&255,c>>24,c>>16&255,c>>8&255,c&255])),Ge.trun(t,s.length+16+20+8+16+8+8),s)}static trak(t){return t.duration=t.duration||4294967295,Ge.box(Ge.types.trak,Ge.tkhd(t),Ge.mdia(t))}static trex(t){const n=t.id;return Ge.box(Ge.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,n){const s=t.samples||[],o=s.length,l=12+16*o,c=new Uint8Array(l);let d,_,g,v,y,x;for(n+=8+l,c.set([t.type==="video"?1:0,0,15,1,o>>>24&255,o>>>16&255,o>>>8&255,o&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),d=0;d<o;d++)_=s[d],g=_.duration,v=_.size,y=_.flags,x=_.cts,c.set([g>>>24&255,g>>>16&255,g>>>8&255,g&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,y.isLeading<<2|y.dependsOn,y.isDependedOn<<6|y.hasRedundancy<<4|y.paddingValue<<1|y.isNonSync,y.degradPrio&61440,y.degradPrio&15,x>>>24&255,x>>>16&255,x>>>8&255,x&255],12+16*d);return Ge.box(Ge.types.trun,c)}static initSegment(t){Ge.types||Ge.init();const n=Ge.moov(t);return yt(Ge.FTYP,n)}static hvc1(t){const n=t.params,s=[t.vps,t.sps,t.pps],o=4,l=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),o-1|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),s.length]);let c=l.length;for(let M=0;M<s.length;M+=1){c+=3;for(let B=0;B<s[M].length;B+=1)c+=2+s[M][B].length}const d=new Uint8Array(c);d.set(l,0),c=l.length;const _=s.length-1;for(let M=0;M<s.length;M+=1){d.set(new Uint8Array([32+M|(M===_?128:0),0,s[M].length]),c),c+=3;for(let B=0;B<s[M].length;B+=1)d.set(new Uint8Array([s[M][B].length>>8,s[M][B].length&255]),c),c+=2,d.set(s[M][B],c),c+=s[M][B].length}const g=Ge.box(Ge.types.hvcC,d),v=t.width,y=t.height,x=t.pixelRatio[0],L=t.pixelRatio[1];return Ge.box(Ge.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,v>>8&255,v&255,y>>8&255,y&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]),g,Ge.box(Ge.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Ge.box(Ge.types.pasp,new Uint8Array([x>>24,x>>16&255,x>>8&255,x&255,L>>24,L>>16&255,L>>8&255,L&255])))}}Ge.types=void 0,Ge.HDLR_TYPES=void 0,Ge.STTS=void 0,Ge.STSC=void 0,Ge.STCO=void 0,Ge.STSZ=void 0,Ge.VMHD=void 0,Ge.SMHD=void 0,Ge.STSD=void 0,Ge.FTYP=void 0,Ge.DINF=void 0;const kl=9e4;function Ko(h,t,n=1,s=!1){const o=h*t*n;return s?Math.round(o):o}function hu(h,t,n=1,s=!1){return Ko(h,t,1/n,s)}function Da(h,t=!1){return Ko(h,1e3,1/kl,t)}function Vh(h,t=1){return Ko(h,kl,1/t)}const pc=10*1e3,fu=1024,Gh=1152,Hh=1536;let io=null,du=null;function Tl(h,t,n,s){return{duration:t,size:n,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:h?2:1,isNonSync:h?0:1}}}class si extends H{constructor(t,n,s,o){if(super("mp4-remuxer",o),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=t,this.config=n,this.typeSupported=s,this.ISGenerated=!1,io===null){const c=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);io=c?parseInt(c[1]):0}if(du===null){const l=navigator.userAgent.match(/Safari\/(\d+)/i);du=l?parseInt(l[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){this.log("initPTS & initDTS reset"),this._initPTS=this._initDTS=t}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(t){let n=!1;const s=t[0].pts,o=t.reduce((l,c)=>{let d=c.pts,_=d-l;return _<-4294967296&&(n=!0,d=xr(d,s),_=d-l),_>0?l:d},s);return n&&this.debug("PTS rollover detected"),o}remux(t,n,s,o,l,c,d,_){let g,v,y,x,L,M,B=l,F=l;const W=t.pid>-1,_e=n.pid>-1,ce=n.samples.length,Pe=t.samples.length>0,Ue=d&&ce>0||ce>1;if((!W||Pe)&&(!_e||Ue)||this.ISGenerated||d){if(this.ISGenerated){var $e,Qe,et,Be;const Ti=this.videoTrackConfig;(Ti&&(n.width!==Ti.width||n.height!==Ti.height||(($e=n.pixelRatio)==null?void 0:$e[0])!==((Qe=Ti.pixelRatio)==null?void 0:Qe[0])||((et=n.pixelRatio)==null?void 0:et[1])!==((Be=Ti.pixelRatio)==null?void 0:Be[1]))||!Ti&&Ue||this.nextAudioTs===null&&Pe)&&this.resetInitSegment()}this.ISGenerated||(y=this.generateIS(t,n,l,c));const Tt=this.isVideoContiguous;let ti=-1,hi;if(Ue&&(ti=Wh(n.samples),!Tt&&this.config.forceKeyFrameOnDiscontinuity))if(M=!0,ti>0){this.warn(`Dropped ${ti} out of ${ce} video samples due to a missing keyframe`);const Ti=this.getVideoStartPts(n.samples);n.samples=n.samples.slice(ti),n.dropped+=ti,F+=(n.samples[0].pts-Ti)/n.inputTimeScale,hi=F}else ti===-1&&(this.warn(`No keyframe found out of ${ce} video samples`),M=!1);if(this.ISGenerated){if(Pe&&Ue){const Ti=this.getVideoStartPts(n.samples),Zt=(xr(t.samples[0].pts,Ti)-Ti)/n.inputTimeScale;B+=Math.max(0,Zt),F+=Math.max(0,-Zt)}if(Pe){if(t.samplerate||(this.warn("regenerate InitSegment as audio detected"),y=this.generateIS(t,n,l,c)),v=this.remuxAudio(t,B,this.isAudioContiguous,c,_e||Ue||_===P.AUDIO?F:void 0),Ue){const Ti=v?v.endPTS-v.startPTS:0;n.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),y=this.generateIS(t,n,l,c)),g=this.remuxVideo(n,F,Tt,Ti)}}else Ue&&(g=this.remuxVideo(n,F,Tt,0));g&&(g.firstKeyFrame=ti,g.independent=ti!==-1,g.firstKeyFramePTS=hi)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(s.samples.length&&(L=mc(s,l,this._initPTS,this._initDTS)),o.samples.length&&(x=is(o,l,this._initPTS))),{audio:v,video:g,initSegment:y,independent:M,text:x,id3:L}}generateIS(t,n,s,o){const l=t.samples,c=n.samples,d=this.typeSupported,_={},g=this._initPTS;let v=!g||o,y="audio/mp4",x,L,M,B=-1;if(v&&(x=L=1/0),t.config&&l.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":d.mpeg?(y="audio/mpeg",t.codec=""):d.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3";break}_.audio={id:"audio",container:y,codec:t.codec,initSegment:t.segmentCodec==="mp3"&&d.mpeg?new Uint8Array(0):Ge.initSegment([t]),metadata:{channelCount:t.channelCount}},v&&(B=t.id,M=t.inputTimeScale,!g||M!==g.timescale?x=L=l[0].pts-Math.round(M*s):v=!1)}if(n.sps&&n.pps&&c.length){if(n.timescale=n.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:n.codec,initSegment:Ge.initSegment([n]),metadata:{width:n.width,height:n.height}},v)if(B=n.id,M=n.inputTimeScale,!g||M!==g.timescale){const F=this.getVideoStartPts(c),W=Math.round(M*s);L=Math.min(L,xr(c[0].dts,F)-W),x=Math.min(x,F-W)}else v=!1;this.videoTrackConfig={width:n.width,height:n.height,pixelRatio:n.pixelRatio}}if(Object.keys(_).length)return this.ISGenerated=!0,v?(g&&this.warn(`Timestamps at playlist time: ${o?"":"~"}${s} ${x/M} != initPTS: ${g.baseTime/g.timescale} (${g.baseTime}/${g.timescale}) trackId: ${g.trackId}`),this.log(`Found initPTS at playlist time: ${s} offset: ${x/M} (${x}/${M}) trackId: ${B}`),this._initPTS={baseTime:x,timescale:M,trackId:B},this._initDTS={baseTime:L,timescale:M,trackId:B}):x=M=void 0,{tracks:_,initPTS:x,timescale:M,trackId:B}}remuxVideo(t,n,s,o){const l=t.inputTimeScale,c=t.samples,d=[],_=c.length,g=this._initPTS,v=g.baseTime*l/g.timescale;let y=this.nextVideoTs,x=8,L=this.videoSampleDuration,M,B,F=Number.POSITIVE_INFINITY,W=Number.NEGATIVE_INFINITY,_e=!1;if(!s||y===null){const Qt=v+n*l,Yt=c[0].pts-xr(c[0].dts,c[0].pts);io&&y!==null&&Math.abs(Qt-Yt-(y+v))<15e3?s=!0:y=Qt-Yt-v}const ce=y+v;for(let Qt=0;Qt<_;Qt++){const Yt=c[Qt];Yt.pts=xr(Yt.pts,ce),Yt.dts=xr(Yt.dts,ce),Yt.dts<c[Qt>0?Qt-1:Qt].dts&&(_e=!0)}_e&&c.sort(function(Qt,Yt){const hn=Qt.dts-Yt.dts,Fn=Qt.pts-Yt.pts;return hn||Fn}),M=c[0].dts,B=c[c.length-1].dts;const Pe=B-M,Ue=Pe?Math.round(Pe/(_-1)):L||t.inputTimeScale/30;if(s){const Qt=M-ce,Yt=Qt>Ue,hn=Qt<-1;if((Yt||hn)&&(Yt?this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${Da(Qt,!0)} ms (${Qt}dts) hole between fragments detected at ${n.toFixed(3)}`):this.warn(`${(t.segmentCodec||"").toUpperCase()}: ${Da(-Qt,!0)} ms (${Qt}dts) overlapping between fragments detected at ${n.toFixed(3)}`),!hn||ce>=c[0].pts||io)){M=ce;const Fn=c[0].pts-Qt;if(Yt)c[0].dts=M,c[0].pts=Fn;else{let dn=!0;for(let _n=0;_n<c.length&&!(c[_n].dts>Fn&&dn);_n++){const Xr=c[_n].pts;if(c[_n].dts-=Qt,c[_n].pts-=Qt,_n<c.length-1){const zr=c[_n+1].pts,gs=c[_n].pts,Ws=zr<=gs,yo=zr<=Xr;dn=Ws==yo}}}this.log(`Video: Initial PTS/DTS adjusted: ${Da(Fn,!0)}/${Da(M,!0)}, delta: ${Da(Qt,!0)} ms`)}}M=Math.max(0,M);let dt=0,$e=0,Qe=M;for(let Qt=0;Qt<_;Qt++){const Yt=c[Qt],hn=Yt.units,Fn=hn.length;let dn=0;for(let _n=0;_n<Fn;_n++)dn+=hn[_n].data.length;$e+=dn,dt+=Fn,Yt.length=dn,Yt.dts<Qe?(Yt.dts=Qe,Qe+=Ue/4|0||1):Qe=Yt.dts,F=Math.min(Yt.pts,F),W=Math.max(Yt.pts,W)}B=c[_-1].dts;const et=$e+4*dt+8;let Be;try{Be=new Uint8Array(et)}catch(Qt){this.observer.emit(S.ERROR,S.ERROR,{type:pe.MUX_ERROR,details:Z.REMUX_ALLOC_ERROR,fatal:!1,error:Qt,bytes:et,reason:`fail allocating video mdat ${et}`});return}const Tt=new DataView(Be.buffer);Tt.setUint32(0,et),Be.set(Ge.types.mdat,4);let ti=!1,hi=Number.POSITIVE_INFINITY,Ti=Number.POSITIVE_INFINITY,ci=Number.NEGATIVE_INFINITY,Zt=Number.NEGATIVE_INFINITY;for(let Qt=0;Qt<_;Qt++){const Yt=c[Qt],hn=Yt.units;let Fn=0;for(let Xr=0,zr=hn.length;Xr<zr;Xr++){const gs=hn[Xr],Ws=gs.data,yo=gs.data.byteLength;Tt.setUint32(x,yo),x+=4,Be.set(Ws,x),x+=yo,Fn+=4+yo}let dn;if(Qt<_-1)L=c[Qt+1].dts-Yt.dts,dn=c[Qt+1].pts-Yt.pts;else{const Xr=this.config,zr=Qt>0?Yt.dts-c[Qt-1].dts:Ue;if(dn=Qt>0?Yt.pts-c[Qt-1].pts:Ue,Xr.stretchShortVideoTrack&&this.nextAudioTs!==null){const gs=Math.floor(Xr.maxBufferHole*l),Ws=(o?F+o*l:this.nextAudioTs+v)-Yt.pts;Ws>gs?(L=Ws-zr,L<0?L=zr:ti=!0,this.log(`It is approximately ${Ws/90} ms to the next segment; using duration ${L/90} ms for the last video frame.`)):L=zr}else L=zr}const _n=Math.round(Yt.pts-Yt.dts);hi=Math.min(hi,L),ci=Math.max(ci,L),Ti=Math.min(Ti,dn),Zt=Math.max(Zt,dn),d.push(Tl(Yt.key,L,Fn,_n))}if(d.length){if(io){if(io<70){const Qt=d[0].flags;Qt.dependsOn=2,Qt.isNonSync=0}}else if(du&&Zt-Ti<ci-hi&&Ue/ci<.025&&d[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let Qt=M;for(let Yt=0,hn=d.length;Yt<hn;Yt++){const Fn=Qt+d[Yt].duration,dn=Qt+d[Yt].cts;if(Yt<hn-1){const _n=Fn+d[Yt+1].cts;d[Yt].duration=_n-dn}else d[Yt].duration=Yt?d[Yt-1].duration:Ue;d[Yt].cts=0,Qt=Fn}}}L=ti||!L?Ue:L;const xi=B+L;this.nextVideoTs=y=xi-v,this.videoSampleDuration=L,this.isVideoContiguous=!0;const Ui={data1:Ge.moof(t.sequenceNumber++,M,k(t,{samples:d})),data2:Be,startPTS:(F-v)/l,endPTS:(W+L-v)/l,startDTS:(M-v)/l,endDTS:y/l,type:"video",hasAudio:!1,hasVideo:!0,nb:d.length,dropped:t.dropped};return t.samples=[],t.dropped=0,Ui}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return Gh;case"ac3":return Hh;default:return fu}}remuxAudio(t,n,s,o,l){const c=t.inputTimeScale,d=t.samplerate?t.samplerate:c,_=c/d,g=this.getSamplesPerFrame(t),v=g*_,y=this._initPTS,x=t.segmentCodec==="mp3"&&this.typeSupported.mpeg,L=[],M=l!==void 0;let B=t.samples,F=x?0:8,W=this.nextAudioTs||-1;const _e=y.baseTime*c/y.timescale,ce=_e+n*c;if(this.isAudioContiguous=s=s||B.length&&W>0&&(o&&Math.abs(ce-(W+_e))<9e3||Math.abs(xr(B[0].pts,ce)-(W+_e))<20*v),B.forEach(function(Zt){Zt.pts=xr(Zt.pts,ce)}),!s||W<0){if(B=B.filter(Zt=>Zt.pts>=0),!B.length)return;l===0?W=0:o&&!M?W=Math.max(0,ce-_e):W=B[0].pts-_e}if(t.segmentCodec==="aac"){const Zt=this.config.maxAudioFramesDrift;for(let xi=0,li=W+_e;xi<B.length;xi++){const Si=B[xi],Ui=Si.pts,Qt=Ui-li,Yt=Math.abs(1e3*Qt/c);if(Qt<=-Zt*v&&M)xi===0&&(this.warn(`Audio frame @ ${(Ui/c).toFixed(3)}s overlaps marker by ${Math.round(1e3*Qt/c)} ms.`),this.nextAudioTs=W=Ui-_e,li=Ui);else if(Qt>=Zt*v&&Yt<pc&&M){let hn=Math.round(Qt/v);for(li=Ui-hn*v;li<0&&hn&&v;)hn--,li+=v;xi===0&&(this.nextAudioTs=W=li-_e),this.warn(`Injecting ${hn} audio frames @ ${((li-_e)/c).toFixed(3)}s due to ${Math.round(1e3*Qt/c)} ms gap.`);for(let Fn=0;Fn<hn;Fn++){let dn=zh.getSilentFrame(t.parsedCodec||t.manifestCodec||t.codec,t.channelCount);dn||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),dn=Si.unit.subarray()),B.splice(xi,0,{unit:dn,pts:li}),li+=v,xi++}}Si.pts=li,li+=v}}let Pe=null,Ue=null,dt,$e=0,Qe=B.length;for(;Qe--;)$e+=B[Qe].unit.byteLength;for(let Zt=0,xi=B.length;Zt<xi;Zt++){const li=B[Zt],Si=li.unit;let Ui=li.pts;if(Ue!==null){const Yt=L[Zt-1];Yt.duration=Math.round((Ui-Ue)/_)}else if(s&&t.segmentCodec==="aac"&&(Ui=W+_e),Pe=Ui,$e>0){$e+=F;try{dt=new Uint8Array($e)}catch(Yt){this.observer.emit(S.ERROR,S.ERROR,{type:pe.MUX_ERROR,details:Z.REMUX_ALLOC_ERROR,fatal:!1,error:Yt,bytes:$e,reason:`fail allocating audio mdat ${$e}`});return}x||(new DataView(dt.buffer).setUint32(0,$e),dt.set(Ge.types.mdat,4))}else return;dt.set(Si,F);const Qt=Si.byteLength;F+=Qt,L.push(Tl(!0,g,Qt,0)),Ue=Ui}const et=L.length;if(!et)return;const Be=L[L.length-1];W=Ue-_e,this.nextAudioTs=W+_*Be.duration;const Tt=x?new Uint8Array(0):Ge.moof(t.sequenceNumber++,Pe/_,k({},t,{samples:L}));t.samples=[];const ti=(Pe-_e)/c,hi=W/c,ci={data1:Tt,data2:dt,startPTS:ti,endPTS:hi,startDTS:ti,endDTS:hi,type:"audio",hasAudio:!0,hasVideo:!1,nb:et};return this.isAudioContiguous=!0,ci}}function xr(h,t){let n;if(t===null)return h;for(t<h?n=-8589934592:n=8589934592;Math.abs(h-t)>4294967296;)h+=n;return h}function Wh(h){for(let t=0;t<h.length;t++)if(h[t].key)return t;return-1}function mc(h,t,n,s){const o=h.samples.length;if(!o)return;const l=h.inputTimeScale;for(let d=0;d<o;d++){const _=h.samples[d];_.pts=xr(_.pts-n.baseTime*l/n.timescale,t*l)/l,_.dts=xr(_.dts-s.baseTime*l/s.timescale,t*l)/l}const c=h.samples;return h.samples=[],{samples:c}}function is(h,t,n){const s=h.samples.length;if(!s)return;const o=h.inputTimeScale;for(let c=0;c<s;c++){const d=h.samples[c];d.pts=xr(d.pts-n.baseTime*o/n.timescale,t*o)/o}h.samples.sort((c,d)=>c.pts-d.pts);const l=h.samples;return h.samples=[],{samples:l}}class Al extends H{constructor(t,n,s,o){super("passthrough-remuxer",o),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(t){this.lastEndTime=null;const n=this.initPTS;n&&t&&n.baseTime===t.baseTime&&n.timescale===t.timescale||(this.initPTS=t)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(t,n,s,o){this.audioCodec=n,this.videoCodec=s,this.generateInitSegment(t,o),this.emitInitSegment=!0}generateInitSegment(t,n){let{audioCodec:s,videoCodec:o}=this;if(!(t!=null&&t.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:l,video:c}=this.initData=at(t);if(n)vt(t,n);else{const _=l||c;_!=null&&_.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${_.codec}")!`)}l&&(s=jh(l,G.AUDIO,this)),c&&(o=jh(c,G.VIDEO,this));const d={};l&&c?d.audiovideo={container:"video/mp4",codec:s+","+o,supplemental:c.supplemental,encrypted:c.encrypted,initSegment:t,id:"main"}:l?d.audio={container:"audio/mp4",codec:s,encrypted:l.encrypted,initSegment:t,id:"audio"}:c?d.video={container:"video/mp4",codec:o,supplemental:c.supplemental,encrypted:c.encrypted,initSegment:t,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=d}remux(t,n,s,o,l,c){var d,_;let{initPTS:g,lastEndTime:v}=this;const y={audio:void 0,video:void 0,text:o,id3:s,initSegment:void 0};le(v)||(v=this.lastEndTime=l||0);const x=n.samples;if(!x.length)return y;const L={initPTS:void 0,timescale:void 0,trackId:void 0};let M=this.initData;if((d=M)!=null&&d.length||(this.generateInitSegment(x),M=this.initData),!((_=M)!=null&&_.length))return this.warn("Failed to generate initSegment."),y;this.emitInitSegment&&(L.tracks=this.initTracks,this.emitInitSegment=!1);const B=gt(x,M,this),F=M.audio?B[M.audio.id]:null,W=M.video?B[M.video.id]:null,_e=Ll(W,1/0),ce=Ll(F,1/0),Pe=Ll(W,0,!0),Ue=Ll(F,0,!0);let dt=l,$e=0;const Qe=F&&(!W||!g&&ce<_e||g&&g.trackId===M.audio.id),et=Qe?F:W;if(et){const li=et.timescale,Si=et.start-l*li,Ui=Qe?M.audio.id:M.video.id;dt=et.start/li,$e=Qe?Ue-ce:Pe-_e,(c||!g)&&(nd(g,dt,l,$e)||li!==g.timescale)&&(g&&this.warn(`Timestamps at playlist time: ${c?"":"~"}${l} ${Si/li} != initPTS: ${g.baseTime/g.timescale} (${g.baseTime}/${g.timescale}) trackId: ${g.trackId}`),this.log(`Found initPTS at playlist time: ${l} offset: ${dt-l} (${Si}/${li}) trackId: ${Ui}`),g=null,L.initPTS=Si,L.timescale=li,L.trackId=Ui)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${l}`);g?(L.initPTS=g.baseTime,L.timescale=g.timescale,L.trackId=g.trackId):((!L.timescale||L.trackId===void 0||L.initPTS===void 0)&&(this.warn("Could not set initPTS"),L.initPTS=dt,L.timescale=1,L.trackId=-1),this.initPTS=g={baseTime:L.initPTS,timescale:L.timescale,trackId:L.trackId});const Be=dt-g.baseTime/g.timescale,Tt=Be+$e;$e>0?this.lastEndTime=Tt:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const ti=!!M.audio,hi=!!M.video;let Ti="";ti&&(Ti+="audio"),hi&&(Ti+="video");const ci=(M.audio?M.audio.encrypted:!1)||(M.video?M.video.encrypted:!1),Zt={data1:x,startPTS:Be,startDTS:Be,endPTS:Tt,endDTS:Tt,type:Ti,hasAudio:ti,hasVideo:hi,nb:1,dropped:0,encrypted:ci};y.audio=ti&&!hi?Zt:void 0,y.video=hi?Zt:void 0;const xi=W==null?void 0:W.sampleCount;if(xi){const li=W.keyFrameIndex,Si=li!==-1;Zt.nb=xi,Zt.dropped=li===0||this.isVideoContiguous?0:Si?li:xi,Zt.independent=Si,Zt.firstKeyFrame=li,Si&&W.keyFrameStart&&(Zt.firstKeyFramePTS=(W.keyFrameStart-g.baseTime)/g.timescale),this.isVideoContiguous||(y.independent=Si),this.isVideoContiguous||(this.isVideoContiguous=Si),Zt.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${li}/${xi} dropped: ${Zt.dropped} start: ${Zt.firstKeyFramePTS||"NA"}`)}return y.initSegment=L,y.id3=mc(s,l,g,g),o.samples.length&&(y.text=is(o,l,g)),y}}function Ll(h,t,n=!1){return(h==null?void 0:h.start)!==void 0?(h.start+(n?h.duration:0))/h.timescale:t}function nd(h,t,n,s){if(h===null)return!0;const o=Math.max(s,1),l=t-h.baseTime/h.timescale;return Math.abs(l-n)>o}function jh(h,t,n){const s=h.codec;return s&&s.length>4?s:t===G.AUDIO?s==="ec-3"||s==="ac-3"||s==="alac"?s:s==="fLaC"||s==="Opus"?ae(s,!1):(n.warn(`Unhandled audio codec "${s}" in mp4 MAP`),s||"mp4a"):(n.warn(`Unhandled video codec "${s}" in mp4 MAP`),s||"avc1")}let ds;try{ds=self.performance.now.bind(self.performance)}catch(h){ds=Date.now}const ps=[{demux:Nh,remux:Al},{demux:ea,remux:si},{demux:Oo,remux:si},{demux:Fh,remux:si}];ps.splice(2,0,{demux:hc,remux:si});class qh{constructor(t,n,s,o,l,c){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=t,this.typeSupported=n,this.config=s,this.id=l,this.logger=c}configure(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()}push(t,n,s,o){const l=s.transmuxing;l.executeStart=ds();let c=new Uint8Array(t);const{currentTransmuxState:d,transmuxConfig:_}=this;o&&(this.currentTransmuxState=o);const{contiguous:g,discontinuity:v,trackSwitch:y,accurateTimeOffset:x,timeOffset:L,initSegmentChange:M}=o||d,{audioCodec:B,videoCodec:F,defaultInitPts:W,duration:_e,initSegmentData:ce}=_,Pe=Ca(c,n);if(Pe&&Nr(Pe.method)){const Qe=this.getDecrypter(),et=hr(Pe.method);if(Qe.isSync()){let Be=Qe.softwareDecrypt(c,Pe.key.buffer,Pe.iv.buffer,et);if(s.part>-1){const ti=Qe.flush();Be=ti&&ti.buffer}if(!Be)return l.executeEnd=ds(),pu(s);c=new Uint8Array(Be)}else return this.asyncResult=!0,this.decryptionPromise=Qe.webCryptoDecrypt(c,Pe.key.buffer,Pe.iv.buffer,et).then(Be=>{const Tt=this.push(Be,null,s);return this.decryptionPromise=null,Tt}),this.decryptionPromise}const Ue=this.needsProbing(v,y);if(Ue){const Qe=this.configureTransmuxer(c);if(Qe)return this.logger.warn(`[transmuxer] ${Qe.message}`),this.observer.emit(S.ERROR,S.ERROR,{type:pe.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,fatal:!1,error:Qe,reason:Qe.message}),l.executeEnd=ds(),pu(s)}(v||y||M||Ue)&&this.resetInitSegment(ce,B,F,_e,n),(v||M||Ue)&&this.resetInitialTimestamp(W),g||this.resetContiguity();const dt=this.transmux(c,Pe,L,x,s);this.asyncResult=no(dt);const $e=this.currentTransmuxState;return $e.contiguous=!0,$e.discontinuity=!1,$e.trackSwitch=!1,l.executeEnd=ds(),dt}flush(t){const n=t.transmuxing;n.executeStart=ds();const{decrypter:s,currentTransmuxState:o,decryptionPromise:l}=this;if(l)return this.asyncResult=!0,l.then(()=>this.flush(t));const c=[],{timeOffset:d}=o;if(s){const y=s.flush();y&&c.push(this.push(y.buffer,null,t))}const{demuxer:_,remuxer:g}=this;if(!_||!g){n.executeEnd=ds();const y=[pu(t)];return this.asyncResult?Promise.resolve(y):y}const v=_.flush(d);return no(v)?(this.asyncResult=!0,v.then(y=>(this.flushRemux(c,y,t),c))):(this.flushRemux(c,v,t),this.asyncResult?Promise.resolve(c):c)}flushRemux(t,n,s){const{audioTrack:o,videoTrack:l,id3Track:c,textTrack:d}=n,{accurateTimeOffset:_,timeOffset:g}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===P.MAIN?"level":"track"} ${s.level}`);const v=this.remuxer.remux(o,l,c,d,g,_,!0,this.id);t.push({remuxResult:v,chunkMeta:s}),s.transmuxing.executeEnd=ds()}resetInitialTimestamp(t){const{demuxer:n,remuxer:s}=this;!n||!s||(n.resetTimeStamp(t),s.resetTimeStamp(t))}resetContiguity(){const{demuxer:t,remuxer:n}=this;!t||!n||(t.resetContiguity(),n.resetNextTimestamp())}resetInitSegment(t,n,s,o,l){const{demuxer:c,remuxer:d}=this;!c||!d||(c.resetInitSegment(t,n,s,o),d.resetInitSegment(t,n,s,l))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(t,n,s,o,l){let c;return n&&n.method==="SAMPLE-AES"?c=this.transmuxSampleAes(t,n,s,o,l):c=this.transmuxUnencrypted(t,s,o,l),c}transmuxUnencrypted(t,n,s,o){const{audioTrack:l,videoTrack:c,id3Track:d,textTrack:_}=this.demuxer.demux(t,n,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(l,c,d,_,n,s,!1,this.id),chunkMeta:o}}transmuxSampleAes(t,n,s,o,l){return this.demuxer.demuxSampleAes(t,n,s).then(c=>({remuxResult:this.remuxer.remux(c.audioTrack,c.videoTrack,c.id3Track,c.textTrack,s,o,!1,this.id),chunkMeta:l}))}configureTransmuxer(t){const{config:n,observer:s,typeSupported:o}=this;let l;for(let y=0,x=ps.length;y<x;y++){var c;if((c=ps[y].demux)!=null&&c.probe(t,this.logger)){l=ps[y];break}}if(!l)return new Error("Failed to find demuxer by probing fragment data");const d=this.demuxer,_=this.remuxer,g=l.remux,v=l.demux;(!_||!(_ instanceof g))&&(this.remuxer=new g(s,n,o,this.logger)),(!d||!(d instanceof v))&&(this.demuxer=new v(s,n,o,this.logger),this.probe=v.probe)}needsProbing(t,n){return!this.demuxer||!this.remuxer||t||n}getDecrypter(){let t=this.decrypter;return t||(t=this.decrypter=new qn(this.config)),t}}function Ca(h,t){let n=null;return h.byteLength>0&&(t==null?void 0:t.key)!=null&&t.iv!==null&&t.method!=null&&(n=t),n}const pu=h=>({remuxResult:{},chunkMeta:h});function no(h){return"then"in h&&h.then instanceof Function}class gc{constructor(t,n,s,o,l){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=n,this.initSegmentData=s,this.duration=o,this.defaultInitPts=l||null}}class Zh{constructor(t,n,s,o,l,c){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=t,this.contiguous=n,this.accurateTimeOffset=s,this.trackSwitch=o,this.timeOffset=l,this.initSegmentChange=c}}let ro=0;class mu{constructor(t,n,s,o){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=ro++,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=_=>{const g=_.data,v=this.hls;if(!(!v||!(g!=null&&g.event)||g.instanceNo!==this.instanceNo))switch(g.event){case"init":{var y;const x=(y=this.workerContext)==null?void 0:y.objectURL;x&&self.URL.revokeObjectURL(x);break}case"transmuxComplete":{this.handleTransmuxComplete(g.data);break}case"flush":{this.onFlush(g.data);break}case"workerLog":{v.logger[g.data.logType]&&v.logger[g.data.logType](g.data.message);break}default:{g.data=g.data||{},g.data.frag=this.frag,g.data.part=this.part,g.data.id=this.id,v.trigger(g.event,g.data);break}}},this.onWorkerError=_=>{if(!this.hls)return;const g=new Error(`${_.message} (${_.filename}:${_.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:g})};const l=t.config;this.hls=t,this.id=n,this.useWorker=!!l.enableWorker,this.onTransmuxComplete=s,this.onFlush=o;const c=(_,g)=>{g=g||{},g.frag=this.frag||void 0,_===S.ERROR&&(g=g,g.parent=this.id,g.part=this.part,this.error=g.error),this.hls.trigger(_,g)};this.observer=new eu,this.observer.on(S.FRAG_DECRYPTED,c),this.observer.on(S.ERROR,c);const d=Vt(l.preferManagedMediaSource);if(this.useWorker&&typeof Worker!="undefined"){const _=this.hls.logger;if(l.workerPath||Yr()){try{l.workerPath?(_.log(`loading Web Worker ${l.workerPath} for "${n}"`),this.workerContext=La(l.workerPath)):(_.log(`injecting Web Worker for "${n}"`),this.workerContext=ca());const{worker:v}=this.workerContext;v.addEventListener("message",this.onWorkerMessage),v.addEventListener("error",this.onWorkerError),v.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:d,id:n,config:Qi(l)})}catch(v){_.warn(`Error setting up "${n}" Web Worker, fallback to inline`,v),this.terminateWorker(),this.error=null,this.transmuxer=new qh(this.observer,d,l,"",n,t.logger)}return}}this.transmuxer=new qh(this.observer,d,l,"",n,t.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const t=this.instanceNo;this.instanceNo=ro++;const n=this.hls.config,s=Vt(n.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:t,typeSupported:s,id:this.id,config:Qi(n)})}}terminateWorker(){if(this.workerContext){const{worker:t}=this.workerContext;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError),_h(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const n=this.transmuxer;n&&(n.destroy(),this.transmuxer=null)}const t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(t,n,s,o,l,c,d,_,g,v){var y,x;g.transmuxing.start=self.performance.now();const{instanceNo:L,transmuxer:M}=this,B=c?c.start:l.start,F=l.decryptdata,W=this.frag,_e=!(W&&l.cc===W.cc),ce=!(W&&g.level===W.level),Pe=W?g.sn-W.sn:-1,Ue=this.part?g.part-this.part.index:-1,dt=Pe===0&&g.id>1&&g.id===(W==null?void 0:W.stats.chunkCount),$e=!ce&&(Pe===1||Pe===0&&(Ue===1||dt&&Ue<=0)),Qe=self.performance.now();(ce||Pe||l.stats.parsing.start===0)&&(l.stats.parsing.start=Qe),c&&(Ue||!$e)&&(c.stats.parsing.start=Qe);const et=!(W&&((y=l.initSegment)==null?void 0:y.url)===((x=W.initSegment)==null?void 0:x.url)),Be=new Zh(_e,$e,_,ce,B,et);if(!$e||_e||et){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${l.type} sn: ${g.sn}${g.part>-1?" part: "+g.part:""} ${this.id===P.MAIN?"level":"track"}: ${g.level} id: ${g.id}
discontinuity: ${_e}
trackSwitch: ${ce}
contiguous: ${$e}
accurateTimeOffset: ${_}
timeOffset: ${B}
initSegmentChange: ${et}`);const Tt=new gc(s,o,n,d,v);this.configureTransmuxer(Tt)}if(this.frag=l,this.part=c,this.workerContext)this.workerContext.worker.postMessage({instanceNo:L,cmd:"demux",data:t,decryptdata:F,chunkMeta:g,state:Be},t instanceof ArrayBuffer?[t]:[]);else if(M){const Tt=M.push(t,F,g,Be);no(Tt)?Tt.then(ti=>{this.handleTransmuxComplete(ti)}).catch(ti=>{this.transmuxerError(ti,g,"transmuxer-interface push error")}):this.handleTransmuxComplete(Tt)}}flush(t){t.transmuxing.start=self.performance.now();const{instanceNo:n,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:n,cmd:"flush",chunkMeta:t});else if(s){const o=s.flush(t);no(o)?o.then(l=>{this.handleFlushResult(l,t)}).catch(l=>{this.transmuxerError(l,t,"transmuxer-interface flush error")}):this.handleFlushResult(o,t)}}transmuxerError(t,n,s){this.hls&&(this.error=t,this.hls.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.FRAG_PARSING_ERROR,chunkMeta:n,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:t,err:t,reason:s}))}handleFlushResult(t,n){t.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(n)}configureTransmuxer(t){const{instanceNo:n,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:n,cmd:"configure",config:t}):s&&s.configure(t)}handleTransmuxComplete(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}const gu=100;class Yh extends Js{constructor(t,n,s){super(t,n,s,"audio-stream-controller",P.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:t}=this;t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(S.BUFFER_RESET,this.onBufferReset,this),t.on(S.BUFFER_CREATED,this.onBufferCreated,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(S.FRAG_LOADING,this.onFragLoading,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:t}=this;t&&(super.unregisterListeners(),t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(S.BUFFER_RESET,this.onBufferReset,this),t.off(S.BUFFER_CREATED,this.onBufferCreated,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(S.FRAG_LOADING,this.onFragLoading,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(t,{frag:n,id:s,initPTS:o,timescale:l,trackId:c}){if(s===P.MAIN){const d=n.cc,_=this.fragCurrent;if(this.initPTS[d]={baseTime:o,timescale:l,trackId:c},this.log(`InitPTS for cc: ${d} found from main: ${o/l} (${o}/${l}) trackId: ${c}`),this.mainAnchor=n,this.state===kt.WAITING_INIT_PTS){const g=this.waitingData;(!g&&!this.loadingParts||g&&g.frag.cc!==d)&&this.syncWithAnchor(n,g==null?void 0:g.frag)}else!this.hls.hasEnoughToStart&&_&&_.cc!==d?(_.abortRequests(),this.syncWithAnchor(n,_)):this.state===kt.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(t,n){var s;const o=((s=this.mainFragLoading)==null?void 0:s.frag)||null;if(n&&(o==null?void 0:o.cc)===n.cc)return;const l=(o||t).cc,c=this.getLevelDetails(),d=this.getLoadPosition(),_=un(c,l,d);_&&(this.log(`Syncing with main frag at ${_.start} cc ${_.cc}`),this.startFragRequested=!1,this.nextLoadPosition=_.start,this.resetLoadingState(),this.state===kt.IDLE&&this.doTickIdle())}startLoad(t,n){if(!this.levels){this.startPosition=t,this.state=kt.STOPPED;return}const s=this.lastCurrentTime;this.stopLoad(),this.setInterval(gu),s>0&&t===-1?(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),t=s,this.state=kt.IDLE):this.state=kt.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}doTick(){switch(this.state){case kt.IDLE:this.doTickIdle();break;case kt.WAITING_TRACK:{const{levels:t,trackId:n}=this,s=t==null?void 0:t[n],o=s==null?void 0:s.details;if(o&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(o))break;this.state=kt.WAITING_INIT_PTS}break}case kt.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case kt.WAITING_INIT_PTS:{const t=this.waitingData;if(t){const{frag:n,part:s,cache:o,complete:l}=t,c=this.mainAnchor;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.state=kt.FRAG_LOADING;const d=o.flush().buffer,_={frag:n,part:s,payload:d,networkDetails:null};this._handleFragmentLoadProgress(_),l&&super._handleFragmentLoadComplete(_)}else c&&c.cc!==t.frag.cc&&this.syncWithAnchor(c,t.frag)}else this.state=kt.IDLE}}this.onTickEnd()}resetLoadingState(){const t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:t}=this;t!=null&&t.readyState&&(this.lastCurrentTime=t.currentTime)}doTickIdle(){var t;const{hls:n,levels:s,media:o,trackId:l}=this,c=n.config;if(!this.buffering||!o&&!this.primaryPrefetch&&(this.startFragRequested||!c.startFragPrefetch)||!(s!=null&&s[l]))return;const d=s[l],_=d.details;if(!_||this.waitForLive(d)||this.waitForCdnTuneIn(_)){this.state=kt.WAITING_TRACK,this.startFragRequested=!1;return}const g=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&g&&(this.bufferFlushed=!1,this.afterBufferFlushed(g,G.AUDIO,P.AUDIO));const v=this.getFwdBufferInfo(g,P.AUDIO);if(v===null)return;if(!this.switchingTrack&&this._streamEnded(v,_)){n.trigger(S.BUFFER_EOS,{type:"audio"}),this.state=kt.ENDED;return}const y=v.len,x=n.maxBufferLength,L=_.fragments,M=L[0].start,B=this.getLoadPosition(),F=this.flushing?B:v.end;if(this.switchingTrack&&o){const ce=B;_.PTSKnown&&ce<M&&(v.end>M||v.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),o.currentTime=M+.05)}if(y>=x&&!this.switchingTrack&&F<L[L.length-1].start)return;let W=this.getNextFragment(F,_);if(W&&this.isLoopLoading(W,F)&&(W=this.getNextFragmentLoopLoading(W,_,v,P.MAIN,x)),!W){this.bufferFlushed=!0;return}let _e=((t=this.mainFragLoading)==null?void 0:t.frag)||null;if(!this.audioOnly&&this.startFragRequested&&_e&&ze(W)&&!W.endList&&(!_.live||!this.loadingParts&&F<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(_e)===Vi.OK&&(this.mainFragLoading=_e=null),_e&&ze(_e))){if(W.start>_e.end){const Pe=this.fragmentTracker.getFragAtPos(F,P.MAIN);Pe&&Pe.end>_e.end&&(_e=Pe,this.mainFragLoading={frag:Pe,targetBufferTime:null})}if(W.start>_e.end)return}this.loadFragment(W,d,F)}onMediaDetaching(t,n){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(t,n)}onAudioTracksUpdated(t,{audioTracks:n}){this.resetTransmuxer(),this.levels=n.map(s=>new mn(s))}onAudioTrackSwitching(t,n){const s=!!n.url;this.trackId=n.id;const{fragCurrent:o}=this;o&&(o.abortRequests(),this.removeUnbufferedFrags(o.start)),this.resetLoadingState(),s?(this.switchingTrack=n,this.flushAudioIfNeeded(n),this.state!==kt.STOPPED&&(this.setInterval(gu),this.state=kt.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=n,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(t,n){this.mainDetails=n.details;const s=this.cachedTrackLoadedData;s&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(S.AUDIO_TRACK_LOADED,s))}onAudioTrackLoaded(t,n){var s;const{levels:o}=this,{details:l,id:c,groupId:d,track:_}=n;if(!o){this.warn(`Audio tracks reset while loading track ${c} "${_.name}" of "${d}"`);return}const g=this.mainDetails;if(!g||l.endCC>g.endCC||g.expired){this.cachedTrackLoadedData=n,this.state!==kt.STOPPED&&(this.state=kt.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${c} "${_.name}" of "${d}" loaded [${l.startSN},${l.endSN}]${l.lastPartSn?`[part-${l.lastPartSn}-${l.lastPartIndex}]`:""},duration:${l.totalduration}`);const v=o[c];let y=0;if(l.live||(s=v.details)!=null&&s.live){if(this.checkLiveUpdate(l),l.deltaUpdateFailed)return;if(v.details){var x;y=this.alignPlaylists(l,v.details,(x=this.levelLastLoaded)==null?void 0:x.details)}l.alignedSliding||(Zr(l,g),l.alignedSliding||Xs(l,g),y=l.fragmentStart)}v.details=l,this.levelLastLoaded=v,this.startFragRequested||this.setStartPosition(g,y),this.hls.trigger(S.AUDIO_TRACK_UPDATED,{details:l,id:c,groupId:n.groupId}),this.state===kt.WAITING_TRACK&&!this.waitForCdnTuneIn(l)&&(this.state=kt.IDLE),this.tick()}_handleFragmentLoadProgress(t){var n;const s=t.frag,{part:o,payload:l}=t,{config:c,trackId:d,levels:_}=this;if(!_){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const g=_[d];if(!g){this.warn("Audio track is undefined on fragment load progress");return}const v=g.details;if(!v){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(s.start);return}const y=c.defaultAudioCodec||g.audioCodec||"mp4a.40.2";let x=this.transmuxer;x||(x=this.transmuxer=new mu(this.hls,P.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const L=this.initPTS[s.cc],M=(n=s.initSegment)==null?void 0:n.data;if(L!==void 0){const F=o?o.index:-1,W=F!==-1,_e=new Sn(s.level,s.sn,s.stats.chunkCount,l.byteLength,F,W);x.push(l,M,y,"",s,o,v.totalduration,!1,_e,L)}else{this.log(`Unknown video PTS for cc ${s.cc}, waiting for video PTS before demuxing audio frag ${s.sn} of [${v.startSN} ,${v.endSN}],track ${d}`);const{cache:B}=this.waitingData=this.waitingData||{frag:s,part:o,cache:new vl,complete:!1};B.push(new Uint8Array(l)),this.state!==kt.STOPPED&&(this.state=kt.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(t){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(t)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(t,n){this.bufferFlushed=this.flushing=!1;const s=n.tracks.audio;s&&(this.mediaBuffer=s.buffer||null)}onFragLoading(t,n){!this.audioOnly&&n.frag.type===P.MAIN&&ze(n.frag)&&(this.mainFragLoading=n,this.state===kt.IDLE&&this.tick())}onFragBuffered(t,n){const{frag:s,part:o}=n;if(s.type!==P.AUDIO){!this.audioOnly&&s.type===P.MAIN&&!s.elementaryStreams.video&&!s.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${o?" p: "+o.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(ze(s)){this.fragPrevious=s;const l=this.switchingTrack;l&&(this.bufferedTrack=l,this.switchingTrack=null,this.hls.trigger(S.AUDIO_TRACK_SWITCHED,C({},l)))}this.fragBufferedComplete(s,o),this.media&&this.tick()}onError(t,n){var s;if(n.fatal){this.state=kt.ERROR;return}switch(n.details){case Z.FRAG_GAP:case Z.FRAG_PARSING_ERROR:case Z.FRAG_DECRYPT_ERROR:case Z.FRAG_LOAD_ERROR:case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_ERROR:case Z.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.AUDIO,n);break;case Z.AUDIO_TRACK_LOAD_ERROR:case Z.AUDIO_TRACK_LOAD_TIMEOUT:case Z.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===kt.WAITING_TRACK&&((s=n.context)==null?void 0:s.type)===Ae.AUDIO_TRACK&&(this.state=kt.IDLE);break;case Z.BUFFER_ADD_CODEC_ERROR:case Z.BUFFER_APPEND_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)||this.resetLoadingState();break;case Z.BUFFER_FULL_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Z.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onBufferFlushing(t,{type:n}){n!==G.VIDEO&&(this.flushing=!0)}onBufferFlushed(t,{type:n}){if(n!==G.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===kt.ENDED&&(this.state=kt.IDLE);const s=this.mediaBuffer||this.media;s&&(this.afterBufferFlushed(s,n,P.AUDIO),this.tick())}}_handleTransmuxComplete(t){var n;const s="audio",{hls:o}=this,{remuxResult:l,chunkMeta:c}=t,d=this.getCurrentContext(c);if(!d){this.resetWhenMissingContext(c);return}const{frag:_,part:g,level:v}=d,{details:y}=v,{audio:x,text:L,id3:M,initSegment:B}=l;if(this.fragContextChanged(_)||!y){this.fragmentTracker.removeFragment(_);return}if(this.state=kt.PARSING,this.switchingTrack&&x&&this.completeAudioSwitch(this.switchingTrack),B!=null&&B.tracks){const F=_.initSegment||_;if(this.unhandledEncryptionError(B,_))return;this._bufferInitSegment(v,B.tracks,F,c),o.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:s,tracks:B.tracks})}if(x){const{startPTS:F,endPTS:W,startDTS:_e,endDTS:ce}=x;g&&(g.elementaryStreams[G.AUDIO]={startPTS:F,endPTS:W,startDTS:_e,endDTS:ce}),_.setElementaryStreamInfo(G.AUDIO,F,W,_e,ce),this.bufferFragmentData(x,_,g,c)}if(M!=null&&(n=M.samples)!=null&&n.length){const F=k({id:s,frag:_,details:y},M);o.trigger(S.FRAG_PARSING_METADATA,F)}if(L){const F=k({id:s,frag:_,details:y},L);o.trigger(S.FRAG_PARSING_USERDATA,F)}}_bufferInitSegment(t,n,s,o){if(this.state!==kt.PARSING||(n.video&&delete n.video,n.audiovideo&&delete n.audiovideo,!n.audio))return;const l=n.audio;l.id=P.AUDIO;const c=t.audioCodec;this.log(`Init audio buffer, container:${l.container}, codecs[level/parsed]=[${c}/${l.codec}]`),c&&c.split(",").length===1&&(l.levelCodec=c),this.hls.trigger(S.BUFFER_CODECS,n);const d=l.initSegment;if(d!=null&&d.byteLength){const _={type:"audio",frag:s,part:null,chunkMeta:o,parent:s.type,data:d};this.hls.trigger(S.BUFFER_APPENDING,_)}this.tickImmediate()}loadFragment(t,n,s){const o=this.fragmentTracker.getState(t);if(this.switchingTrack||o===Vi.NOT_LOADED||o===Vi.PARTIAL){var l;if(!ze(t))this._loadInitSegment(t,n);else if((l=n.details)!=null&&l.live&&!this.initPTS[t.cc]){this.log(`Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}`),this.state=kt.WAITING_INIT_PTS;const c=this.mainDetails;c&&c.fragmentStart!==n.details.fragmentStart&&Xs(n.details,c)}else super.loadFragment(t,n,s)}else this.clearTrackerIfNeeded(t)}flushAudioIfNeeded(t){if(this.media&&this.bufferedTrack){const{name:n,lang:s,assocLang:o,characteristics:l,audioCodec:c,channels:d}=this.bufferedTrack;At({name:n,lang:s,assocLang:o,characteristics:l,audioCodec:c,channels:d},t,Pt)||(Zi(t.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=t)}}completeAudioSwitch(t){const{hls:n}=this;this.flushAudioIfNeeded(t),this.bufferedTrack=t,this.switchingTrack=null,n.trigger(S.AUDIO_TRACK_SWITCHED,C({},t))}}class _c extends H{constructor(t,n){super(n,t.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=t}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(t,n,s){const o=n==null?void 0:n.renditionReports;if(o){let l=-1;for(let c=0;c<o.length;c++){const d=o[c];let _;try{_=new self.URL(d.URI,n.url).href}catch(g){this.warn(`Could not construct new URL for Rendition Report: ${g}`),_=d.URI||""}if(_===t){l=c;break}else _===t.substring(0,_.length)&&(l=c)}if(l!==-1){const c=o[l],d=parseInt(c["LAST-MSN"])||n.lastPartSn;let _=parseInt(c["LAST-PART"])||n.lastPartIndex;if(this.hls.config.lowLatencyMode){const v=Math.min(n.age-n.partTarget,n.targetduration);_>=0&&v>n.partTarget&&(_+=1)}const g=s&&vn(s);return new Ri(d,_>=0?_:void 0,g)}}}loadPlaylist(t){this.clearTimer()}loadingPlaylist(t,n){this.clearTimer()}shouldLoadPlaylist(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)}getUrlWithDirectives(t,n){if(n)try{return n.addDirectives(t)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return t}playlistLoaded(t,n,s){const{details:o,stats:l}=n,c=self.performance.now(),d=l.loading.first?Math.max(0,c-l.loading.first):0;o.advancedDateTime=Date.now()-d;const _=this.hls.config.timelineOffset;if(_!==o.appliedTimelineOffset){const v=Math.max(_||0,0);o.appliedTimelineOffset=v,o.fragments.forEach(y=>{y.setStart(y.playlistOffset+v)})}if(o.live||s!=null&&s.live){const v="levelInfo"in n?n.levelInfo:n.track;if(o.reloaded(s),s&&o.fragments.length>0){Ao(s,o,this);const _e=o.playlistParsingError;if(_e){this.warn(_e);const ce=this.hls;if(!ce.config.ignorePlaylistParsingErrors){var g;const{networkDetails:Pe}=n;ce.trigger(S.ERROR,{type:pe.NETWORK_ERROR,details:Z.LEVEL_PARSING_ERROR,fatal:!1,url:o.url,error:_e,reason:_e.message,level:n.level||void 0,parent:(g=o.fragments[0])==null?void 0:g.type,networkDetails:Pe,stats:l});return}o.playlistParsingError=null}}o.requestScheduled===-1&&(o.requestScheduled=l.loading.start);const y=this.hls.mainForwardBufferInfo,x=y?y.end-y.len:0,L=(o.edge-x)*1e3,M=Ys(o,L);if(o.requestScheduled+M<c?o.requestScheduled=c:o.requestScheduled+=M,this.log(`live playlist ${t} ${o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:o.updated?"UPDATED":"MISSED"}`),!this.canLoad||!o.live)return;let B,F,W;if(o.canBlockReload&&o.endSN&&o.advanced){const _e=this.hls.config.lowLatencyMode,ce=o.lastPartSn,Pe=o.endSN,Ue=o.lastPartIndex,dt=Ue!==-1,$e=ce===Pe;dt?$e?(F=Pe+1,W=_e?0:Ue):(F=ce,W=_e?Ue+1:o.maxPartIndex):F=Pe+1;const Qe=o.age,et=Qe+o.ageHeader;let Be=Math.min(et-o.partTarget,o.targetduration*1.5);if(Be>0){if(et>o.targetduration*3)this.log(`Playlist last advanced ${Qe.toFixed(2)}s ago. Omitting segment and part directives.`),F=void 0,W=void 0;else if(s!=null&&s.tuneInGoal&&et-o.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${Be} with playlist age: ${o.age}`),Be=0;else{const Tt=Math.floor(Be/o.targetduration);if(F+=Tt,W!==void 0){const ti=Math.round(Be%o.targetduration/o.partTarget);W+=ti}this.log(`CDN Tune-in age: ${o.ageHeader}s last advanced ${Qe.toFixed(2)}s goal: ${Be} skip sn ${Tt} to part ${W}`)}o.tuneInGoal=Be}if(B=this.getDeliveryDirectives(o,n.deliveryDirectives,F,W),_e||!$e){o.requestScheduled=c,this.loadingPlaylist(v,B);return}}else(o.canBlockReload||o.canSkipUntil)&&(B=this.getDeliveryDirectives(o,n.deliveryDirectives,F,W));B&&F!==void 0&&o.canBlockReload&&(o.requestScheduled=l.loading.first+Math.max(M-d*2,M/2)),this.scheduleLoading(v,B,o)}else this.clearTimer()}scheduleLoading(t,n,s){const o=s||t.details;if(!o){this.loadingPlaylist(t,n);return}const l=self.performance.now(),c=o.requestScheduled;if(l>=c){this.loadingPlaylist(t,n);return}const d=c-l;this.log(`reload live playlist ${t.name||t.bitrate+"bps"} in ${Math.round(d)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(t,n),d)}getDeliveryDirectives(t,n,s,o){let l=vn(t);return n!=null&&n.skip&&t.deltaUpdateFailed&&(s=n.msn,o=n.part,l=Ki.No),new Ri(s,o,l)}checkRetry(t){const n=t.details,s=$i(t),o=t.errorAction,{action:l,retryCount:c=0,retryConfig:d}=o||{},_=!!o&&!!d&&(l===tn.RetryRequest||!o.resolved&&l===tn.SendAlternateToPenaltyBox);if(_){var g;if(c>=d.maxNumRetry)return!1;if(s&&(g=t.context)!=null&&g.deliveryDirectives)this.warn(`Retrying playlist loading ${c+1}/${d.maxNumRetry} after "${n}" without delivery-directives`),this.loadPlaylist();else{const v=Xi(d,c);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),v),this.warn(`Retrying playlist loading ${c+1}/${d.maxNumRetry} after "${n}" in ${v}ms`)}t.levelRetry=!0,o.resolved=!0}return _}}function Xh(h,t){if(h.length!==t.length)return!1;for(let n=0;n<h.length;n++)if(!Dl(h[n].attrs,t[n].attrs))return!1;return!0}function Dl(h,t,n){const s=h["STABLE-RENDITION-ID"];return s&&!n?s===t["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(o=>h[o]!==t[o])}function Uo(h,t){return t.label.toLowerCase()===h.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(h.lang||"").toLowerCase())}class rd extends _c{constructor(t){super(t,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:t}=this;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVEL_LOADING,this.onLevelLoading,this),t.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(S.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(S.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(t,n){this.tracks=n.audioTracks||[]}onAudioTrackLoaded(t,n){const{id:s,groupId:o,details:l}=n,c=this.tracksInGroup[s];if(!c||c.groupId!==o){this.warn(`Audio track with id:${s} and group:${o} not found in active group ${c==null?void 0:c.groupId}`);return}const d=c.details;c.details=n.details,this.log(`Audio track ${s} "${c.name}" lang:${c.lang} group:${o} loaded [${l.startSN}-${l.endSN}]`),s===this.trackId&&this.playlistLoaded(s,n,d)}onLevelLoading(t,n){this.switchLevel(n.level)}onLevelSwitching(t,n){this.switchLevel(n.level)}switchLevel(t){const n=this.hls.levels[t];if(!n)return;const s=n.audioGroups||null,o=this.groupIds;let l=this.currentTrack;if(!s||(o==null?void 0:o.length)!==(s==null?void 0:s.length)||s!=null&&s.some(d=>(o==null?void 0:o.indexOf(d))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const d=this.tracks.filter(x=>!s||s.indexOf(x.groupId)!==-1);if(d.length)this.selectDefaultTrack&&!d.some(x=>x.default)&&(this.selectDefaultTrack=!1),d.forEach((x,L)=>{x.id=L});else if(!l&&!this.tracksInGroup.length)return;this.tracksInGroup=d;const _=this.hls.config.audioPreference;if(!l&&_){const x=nt(_,d,Pt);if(x>-1)l=d[x];else{const L=nt(_,this.tracks);l=this.tracks[L]}}let g=this.findTrackId(l);g===-1&&l&&(g=this.findTrackId(null));const v={audioTracks:d};this.log(`Updating audio tracks, ${d.length} track(s) found in group(s): ${s==null?void 0:s.join(",")}`),this.hls.trigger(S.AUDIO_TRACKS_UPDATED,v);const y=this.trackId;if(g!==-1&&y===-1)this.setAudioTrack(g);else if(d.length&&y===-1){var c;const x=new Error(`No audio track selected for current audio group-ID(s): ${(c=this.groupIds)==null?void 0:c.join(",")} track count: ${d.length}`);this.warn(x.message),this.hls.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:x})}}}onError(t,n){n.fatal||!n.context||n.context.type===Ae.AUDIO_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}setAudioOption(t){const n=this.hls;if(n.config.audioPreference=t,t){const s=this.allAudioTracks;if(this.selectDefaultTrack=!1,s.length){const o=this.currentTrack;if(o&&At(t,o,Pt))return o;const l=nt(t,this.tracksInGroup,Pt);if(l>-1){const c=this.tracksInGroup[l];return this.setAudioTrack(l),c}else if(o){let c=n.loadLevel;c===-1&&(c=n.firstAutoLevel);const d=Jt(t,n.levels,s,c,Pt);if(d===-1)return null;n.nextLoadLevel=d}if(t.channels||t.audioCodec){const c=nt(t,s);if(c>-1)return s[c]}}}return null}setAudioTrack(t){const n=this.tracksInGroup;if(t<0||t>=n.length){this.warn(`Invalid audio track id: ${t}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,o=n[t],l=o.details&&!o.details.live;if(t===this.trackId&&o===s&&l||(this.log(`Switching to audio-track ${t} "${o.name}" lang:${o.lang} group:${o.groupId} channels:${o.channels}`),this.trackId=t,this.currentTrack=o,this.hls.trigger(S.AUDIO_TRACK_SWITCHING,C({},o)),l))return;const c=this.switchParams(o.url,s==null?void 0:s.details,o.details);this.loadPlaylist(c)}findTrackId(t){const n=this.tracksInGroup;for(let s=0;s<n.length;s++){const o=n[s];if(!(this.selectDefaultTrack&&!o.default)&&(!t||At(t,o,Pt)))return s}if(t){const{name:s,lang:o,assocLang:l,characteristics:c,audioCodec:d,channels:_}=t;for(let g=0;g<n.length;g++){const v=n[g];if(At({name:s,lang:o,assocLang:l,characteristics:c,audioCodec:d,channels:_},v,Pt))return g}for(let g=0;g<n.length;g++){const v=n[g];if(Dl(t.attrs,v.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return g}for(let g=0;g<n.length;g++){const v=n[g];if(Dl(t.attrs,v.attrs,["LANGUAGE"]))return g}}return-1}loadPlaylist(t){super.loadPlaylist();const n=this.currentTrack;this.shouldLoadPlaylist(n)&&Zi(n.url,this.hls)&&this.scheduleLoading(n,t)}loadingPlaylist(t,n){super.loadingPlaylist(t,n);const s=t.id,o=t.groupId,l=this.getUrlWithDirectives(t.url,n),c=t.details,d=c==null?void 0:c.age;this.log(`Loading audio-track ${s} "${t.name}" lang:${t.lang} group:${o}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${d&&c.live?" age "+d.toFixed(1)+(c.type?" "+c.type||0:""):""} ${l}`),this.hls.trigger(S.AUDIO_TRACK_LOADING,{url:l,id:s,groupId:o,deliveryDirectives:n||null,track:t})}}class _u{constructor(t){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=t}destroy(){this.tracks=this.queues=null}append(t,n,s){if(this.queues===null||this.tracks===null)return;const o=this.queues[n];o.push(t),o.length===1&&!s&&this.executeNext(n)}appendBlocker(t){return new Promise(n=>{const s={label:"async-blocker",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,t)})}prependBlocker(t){return new Promise(n=>{if(this.queues){const s={label:"async-blocker-prepend",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[t].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(t=>{var n;const s=(n=t[0])==null?void 0:n.label;(s==="async-blocker"||s==="async-blocker-prepend")&&(t[0].execute(),t.splice(0,1))})}unblockAudio(t){if(this.queues===null)return;this.queues.audio[0]===t&&this.shiftAndExecuteNext("audio")}executeNext(t){if(this.queues===null||this.tracks===null)return;const n=this.queues[t];if(n.length){const o=n[0];try{o.execute()}catch(l){var s;if(o.onError(l),this.queues===null||this.tracks===null)return;const c=(s=this.tracks[t])==null?void 0:s.buffer;c!=null&&c.updating||this.shiftAndExecuteNext(t)}}}shiftAndExecuteNext(t){this.queues!==null&&(this.queues[t].shift(),this.executeNext(t))}current(t){var n;return((n=this.queues)==null?void 0:n[t][0])||null}toString(){const{queues:t,tracks:n}=this;return t===null||n===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(t){var n,s;return(n=this.queues)!=null&&n[t]||(s=this.tracks)!=null&&s[t]?`${t}: (${this.listSbInfo(t)}) ${this.listOps(t)}`:""}listSbInfo(t){var n;const s=(n=this.tracks)==null?void 0:n[t],o=s==null?void 0:s.buffer;return o?`SourceBuffer${o.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(t){var n;return((n=this.queues)==null?void 0:n[t].map(s=>s.label).join(", "))||""}}const vc=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,yc="HlsJsTrackRemovedError";class sd extends Error{constructor(t){super(t),this.name=yc}}class Jh extends H{constructor(t,n){super("buffer-controller",t.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=s=>{var o;this.hls&&((o=this.mediaSource)==null?void 0:o.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=s=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=s=>{const{media:o,mediaSource:l}=this;s&&this.log("Media source opened"),!(!o||!l)&&(l.removeEventListener("sourceopen",this._onMediaSourceOpen),o.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(S.MEDIA_ATTACHED,{media:o,mediaSource:l}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:s,_objectUrl:o}=this;s!==o&&this.error(`Media element src was set while attaching MediaSource (${o} > ${s})`)},this.hls=t,this.fragmentTracker=n,this.appendSource=We(Ee(t.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:t}=this;t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.BUFFER_RESET,this.onBufferReset,this),t.on(S.BUFFER_APPENDING,this.onBufferAppending,this),t.on(S.BUFFER_CODECS,this.onBufferCodecs,this),t.on(S.BUFFER_EOS,this.onBufferEos,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.FRAG_PARSED,this.onFragParsed,this),t.on(S.FRAG_CHANGED,this.onFragChanged,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.BUFFER_RESET,this.onBufferReset,this),t.off(S.BUFFER_APPENDING,this.onBufferAppending,this),t.off(S.BUFFER_CODECS,this.onBufferCodecs,this),t.off(S.BUFFER_EOS,this.onBufferEos,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.FRAG_PARSED,this.onFragParsed,this),t.off(S.FRAG_CHANGED,this.onFragChanged,this),t.off(S.ERROR,this.onError,this)}transferMedia(){const{media:t,mediaSource:n}=this;if(!t)return null;const s={};if(this.operationQueue){const l=this.isUpdating();l||this.operationQueue.removeBlockers();const c=this.isQueued();(l||c)&&this.warn(`Transfering MediaSource with${c?" operations in queue":""}${l?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const o=this.transferData;return!this.sourceBufferCount&&o&&o.mediaSource===n?k(s,o.tracks):this.sourceBuffers.forEach(l=>{const[c]=l;c&&(s[c]=k({},this.tracks[c]),this.removeBuffer(c)),l[0]=l[1]=null}),{media:t,mediaSource:n,tracks:s}}initTracks(){const t={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=t,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(t,n){var s;let o=2;(n.audio&&!n.video||!n.altAudio)&&(o=1),this.bufferCodecEventsTotal=o,this.log(`${o} bufferCodec event(s) expected.`),(s=this.transferData)!=null&&s.mediaSource&&this.sourceBufferCount&&o&&this.bufferCreated()}onMediaAttaching(t,n){const s=this.media=n.media;this.transferData=this.overrides=void 0;const o=Ee(this.appendSource);if(o){const l=!!n.mediaSource;(l||n.overrides)&&(this.transferData=n,this.overrides=n.overrides);const c=this.mediaSource=n.mediaSource||new o;if(this.assignMediaSource(c),l)this._objectUrl=s.src,this.attachTransferred();else{const d=this._objectUrl=self.URL.createObjectURL(c);if(this.appendSource)try{s.removeAttribute("src");const _=self.ManagedMediaSource;s.disableRemotePlayback=s.disableRemotePlayback||_&&c instanceof _,Qh(s),ad(s,d),s.load()}catch(_){s.src=d}else s.src=d}s.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(t){var n,s;this.log(`${((n=this.transferData)==null?void 0:n.mediaSource)===t?"transferred":"created"} media source: ${(s=t.constructor)==null?void 0:s.name}`),t.addEventListener("sourceopen",this._onMediaSourceOpen),t.addEventListener("sourceended",this._onMediaSourceEnded),t.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.addEventListener("startstreaming",this._onStartStreaming),t.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const t=this.media,n=this.transferData;if(!n||!t)return;const s=this.tracks,o=n.tracks,l=o?Object.keys(o):null,c=l?l.length:0,d=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(o&&l&&c){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: ${Qi(s,(_,g)=>_==="initSegment"?void 0:g)};
transfer tracks: ${Qi(o,(_,g)=>_==="initSegment"?void 0:g)}}`),!Ke(o,s)){n.mediaSource=null,n.tracks=void 0;const _=t.currentTime,g=this.details,v=Math.max(_,(g==null?void 0:g.fragments[0].start)||0);if(v-_>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${_} -> ${v}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(o)}"->"${Object.keys(s)}") start time: ${v} currentTime: ${_}`),this.onMediaDetaching(S.MEDIA_DETACHING,{}),this.onMediaAttaching(S.MEDIA_ATTACHING,n),t.currentTime=v;return}this.transferData=void 0,l.forEach(_=>{const g=_,v=o[g];if(v){const y=v.buffer;if(y){const x=this.fragmentTracker,L=v.id;if(x.hasFragments(L)||x.hasParts(L)){const F=mi.getBuffered(y);x.detectEvictedFragments(g,F,L,null,!0)}const M=zo(g),B=[g,y];this.sourceBuffers[M]=B,y.updating&&this.operationQueue&&this.operationQueue.prependBlocker(g),this.trackSourceBuffer(g,v)}}}),d(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),d()}get mediaSourceOpenOrEnded(){var t;const n=(t=this.mediaSource)==null?void 0:t.readyState;return n==="open"||n==="ended"}onMediaDetaching(t,n){const s=!!n.transferMedia;this.transferData=this.overrides=void 0;const{media:o,mediaSource:l,_objectUrl:c}=this;if(l){if(this.log(`media source ${s?"transferring":"detaching"}`),s)this.sourceBuffers.forEach(([d])=>{d&&this.removeBuffer(d)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const d=l.readyState==="open";try{const _=l.sourceBuffers;for(let g=_.length;g--;)d&&_[g].abort(),l.removeSourceBuffer(_[g]);d&&l.endOfStream()}catch(_){this.warn(`onMediaDetaching: ${_.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(l.removeEventListener("startstreaming",this._onStartStreaming),l.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}o&&(o.removeEventListener("emptied",this._onMediaEmptied),s||(c&&self.URL.revokeObjectURL(c),this.mediaSrc===c?(o.removeAttribute("src"),this.appendSource&&Qh(o),o.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(S.MEDIA_DETACHED,n)}onBufferReset(){this.sourceBuffers.forEach(([t])=>{t&&this.resetBuffer(t)}),this.initTracks()}resetBuffer(t){var n;const s=(n=this.tracks[t])==null?void 0:n.buffer;if(this.removeBuffer(t),s)try{var o;(o=this.mediaSource)!=null&&o.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(s)}catch(l){this.warn(`onBufferReset ${t}`,l)}delete this.tracks[t]}removeBuffer(t){this.removeBufferListeners(t),this.sourceBuffers[zo(t)]=[null,null];const n=this.tracks[t];n&&(n.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new _u(this.tracks)}onBufferCodecs(t,n){const s=this.tracks,o=Object.keys(n);this.log(`BUFFER_CODECS: "${o}" (current SB count ${this.sourceBufferCount})`);const l="audiovideo"in n&&(s.audio||s.video)||s.audiovideo&&("audio"in n||"video"in n),c=!l&&this.sourceBufferCount&&this.media&&o.some(d=>!s[d]);if(l||c){this.warn(`Unsupported transition between "${Object.keys(s)}" and "${o}" SourceBuffers`);return}o.forEach(d=>{var _,g;const v=n[d],{id:y,codec:x,levelCodec:L,container:M,metadata:B,supplemental:F}=v;let W=s[d];const _e=(_=this.transferData)==null||(_=_.tracks)==null?void 0:_[d],ce=_e!=null&&_e.buffer?_e:W,Pe=(ce==null?void 0:ce.pendingCodec)||(ce==null?void 0:ce.codec),Ue=ce==null?void 0:ce.levelCodec;W||(W=s[d]={buffer:void 0,listeners:[],codec:x,supplemental:F,container:M,levelCodec:L,metadata:B,id:y});const dt=ve(Pe,Ue),$e=dt==null?void 0:dt.replace(vc,"$1");let Qe=ve(x,L);const et=(g=Qe)==null?void 0:g.replace(vc,"$1");Qe&&dt&&$e!==et&&(d.slice(0,5)==="audio"&&(Qe=ae(Qe,this.appendSource)),this.log(`switching codec ${Pe} to ${Qe}`),Qe!==(W.pendingCodec||W.codec)&&(W.pendingCodec=Qe),W.container=M,this.appendChangeType(d,M,Qe))}),(this.tracksReady||this.sourceBufferCount)&&(n.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&this.mediaSourceOpenOrEnded&&this.checkPendingTracks()}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((t,n)=>{const s=this.tracks[n];return t[n]={id:s.id,container:s.container,codec:s.codec,levelCodec:s.levelCodec},t},{})}appendChangeType(t,n,s){const o=`${n};codecs=${s}`,l={label:`change-type=${o}`,execute:()=>{const c=this.tracks[t];if(c){const d=c.buffer;d!=null&&d.changeType&&(this.log(`changing ${t} sourceBuffer type to ${o}`),d.changeType(o),c.codec=s,c.container=n)}this.shiftAndExecuteNext(t)},onStart:()=>{},onComplete:()=>{},onError:c=>{this.warn(`Failed to change ${t} SourceBuffer type`,c)}};this.append(l,t,this.isPending(this.tracks[t]))}blockAudio(t){var n;const s=t.start,o=s+t.duration*.05;if(((n=this.fragmentTracker.getAppendedFrag(s,P.MAIN))==null?void 0:n.gap)===!0)return;const c={label:"block-audio",execute:()=>{var d;const _=this.tracks.video;(this.lastVideoAppendEnd>o||_!=null&&_.buffer&&mi.isBuffered(_.buffer,o)||((d=this.fragmentTracker.getAppendedFrag(o,P.MAIN))==null?void 0:d.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:d=>{this.warn("Error executing block-audio operation",d)}};this.blockedAudioAppend={op:c,frag:t},this.append(c,"audio",!0)}unblockAudio(){const{blockedAudioAppend:t,operationQueue:n}=this;t&&n&&(this.blockedAudioAppend=null,n.unblockAudio(t.op))}onBufferAppending(t,n){const{tracks:s}=this,{data:o,type:l,parent:c,frag:d,part:_,chunkMeta:g,offset:v}=n,y=g.buffering[l],{sn:x,cc:L}=d,M=self.performance.now();y.start=M;const B=d.stats.buffering,F=_?_.stats.buffering:null;B.start===0&&(B.start=M),F&&F.start===0&&(F.start=M);const W=s.audio;let _e=!1;l==="audio"&&(W==null?void 0:W.container)==="audio/mpeg"&&(_e=!this.lastMpegAudioChunk||g.id===1||this.lastMpegAudioChunk.sn!==g.sn,this.lastMpegAudioChunk=g);const ce=s.video,Pe=ce==null?void 0:ce.buffer;if(Pe&&x!=="initSegment"){const $e=_||d,Qe=this.blockedAudioAppend;if(l==="audio"&&c!=="main"&&!this.blockedAudioAppend&&!(ce.ending||ce.ended)){const Be=$e.start+$e.duration*.05,Tt=Pe.buffered,ti=this.currentOp("video");!Tt.length&&!ti?this.blockAudio($e):!ti&&!mi.isBuffered(Pe,Be)&&this.lastVideoAppendEnd<Be&&this.blockAudio($e)}else if(l==="video"){const et=$e.end;if(Qe){const Be=Qe.frag.start;(et>Be||et<this.lastVideoAppendEnd||mi.isBuffered(Pe,Be))&&this.unblockAudio()}this.lastVideoAppendEnd=et}}const Ue=(_||d).start,dt={label:`append-${l}`,execute:()=>{var $e;y.executeStart=self.performance.now();const Qe=($e=this.tracks[l])==null?void 0:$e.buffer;Qe&&(_e?this.updateTimestampOffset(Qe,Ue,.1,l,x,L):v!==void 0&&le(v)&&this.updateTimestampOffset(Qe,v,1e-6,l,x,L)),this.appendExecutor(o,l)},onStart:()=>{},onComplete:()=>{const $e=self.performance.now();y.executeEnd=y.end=$e,B.first===0&&(B.first=$e),F&&F.first===0&&(F.first=$e);const Qe={};this.sourceBuffers.forEach(([et,Be])=>{et&&(Qe[et]=mi.getBuffered(Be))}),this.appendErrors[l]=0,l==="audio"||l==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(S.BUFFER_APPENDED,{type:l,frag:d,part:_,chunkMeta:g,parent:d.type,timeRanges:Qe})},onError:$e=>{var Qe;const et={type:pe.MEDIA_ERROR,parent:d.type,details:Z.BUFFER_APPEND_ERROR,sourceBufferName:l,frag:d,part:_,chunkMeta:g,error:$e,err:$e,fatal:!1},Be=(Qe=this.media)==null?void 0:Qe.error;if($e.code===DOMException.QUOTA_EXCEEDED_ERR||$e.name=="QuotaExceededError"||"quota"in $e)et.details=Z.BUFFER_FULL_ERROR;else if($e.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!Be)et.errorAction=$n(!0);else if($e.name===yc&&this.sourceBufferCount===0)et.errorAction=$n(!0);else{const Tt=++this.appendErrors[l];this.warn(`Failed ${Tt}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${l}" sourceBuffer (${Be||"no media error"})`),(Tt>=this.hls.config.appendErrorMaxRetry||Be)&&(et.fatal=!0)}this.hls.trigger(S.ERROR,et)}};this.append(dt,l,this.isPending(this.tracks[l]))}getFlushOp(t,n,s){return this.log(`queuing "${t}" remove ${n}-${s}`),{label:"remove",execute:()=>{this.removeExecutor(t,n,s)},onStart:()=>{},onComplete:()=>{this.hls.trigger(S.BUFFER_FLUSHED,{type:t})},onError:o=>{this.warn(`Failed to remove ${n}-${s} from "${t}" SourceBuffer`,o)}}}onBufferFlushing(t,n){const{type:s,startOffset:o,endOffset:l}=n;s?this.append(this.getFlushOp(s,o,l),s):this.sourceBuffers.forEach(([c])=>{c&&this.append(this.getFlushOp(c,o,l),c)})}onFragParsed(t,n){const{frag:s,part:o}=n,l=[],c=o?o.elementaryStreams:s.elementaryStreams;c[G.AUDIOVIDEO]?l.push("audiovideo"):(c[G.AUDIO]&&l.push("audio"),c[G.VIDEO]&&l.push("video"));const d=()=>{const _=self.performance.now();s.stats.buffering.end=_,o&&(o.stats.buffering.end=_);const g=o?o.stats:s.stats;this.hls.trigger(S.FRAG_BUFFERED,{frag:s,part:o,stats:g,id:s.type})};l.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${s.type} level: ${s.level} sn: ${s.sn}`),this.blockBuffers(d,l).catch(_=>{this.warn(`Fragment buffered callback ${_}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(t,n){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([t])=>{if(t){const n=this.tracks[t];if(n)return!n.ended||n.ending}return!1})}onBufferEos(t,n){var s;this.sourceBuffers.forEach(([c])=>{if(c){const d=this.tracks[c];(!n.type||n.type===c)&&(d.ending=!0,d.ended||(d.ended=!0,this.log(`${c} buffer reached EOS`)))}});const o=((s=this.overrides)==null?void 0:s.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([c])=>{var d;return c&&!((d=this.tracks[c])!=null&&d.ended)})?o?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:c}=this;if(!c||c.readyState!=="open"){c&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${c.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),c.endOfStream(),this.hls.trigger(S.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(S.BUFFERED_TO_END,void 0)):n.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([t])=>{if(t!==null){const n=this.tracks[t];n&&(n.ending=!1)}})}onLevelUpdated(t,{details:n}){n.fragments.length&&(this.details=n,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const t=this.getDurationAndRange();t&&this.updateMediaSource(t)})}onError(t,n){if(n.details===Z.BUFFER_APPEND_ERROR&&n.frag){var s;const o=(s=n.errorAction)==null?void 0:s.nextAutoLevel;le(o)&&o!==n.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:t,details:n,media:s}=this;if(!s||n===null||!this.sourceBufferCount)return;const o=t.config,l=s.currentTime,c=n.levelTargetDuration,d=n.live&&o.liveBackBufferLength!==null?o.liveBackBufferLength:o.backBufferLength;if(le(d)&&d>=0){const g=Math.max(d,c),v=Math.floor(l/c)*c-g;this.flushBackBuffer(l,c,v)}const _=o.frontBufferFlushThreshold;if(le(_)&&_>0){const g=Math.max(o.maxBufferLength,_),v=Math.max(g,c),y=Math.floor(l/c)*c+v;this.flushFrontBuffer(l,c,y)}}flushBackBuffer(t,n,s){this.sourceBuffers.forEach(([o,l])=>{if(l){const d=mi.getBuffered(l);if(d.length>0&&s>d.start(0)){var c;this.hls.trigger(S.BACK_BUFFER_REACHED,{bufferEnd:s});const _=this.tracks[o];if((c=this.details)!=null&&c.live)this.hls.trigger(S.LIVE_BACK_BUFFER_REACHED,{bufferEnd:s});else if(_!=null&&_.ended){this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:s,type:o})}}})}flushFrontBuffer(t,n,s){this.sourceBuffers.forEach(([o,l])=>{if(l){const c=mi.getBuffered(l),d=c.length;if(d<2)return;const _=c.start(d-1),g=c.end(d-1);if(s>_||t>=_&&t<=g)return;this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:_,endOffset:1/0,type:o})}})}getDurationAndRange(){var t;const{details:n,mediaSource:s}=this;if(!n||!this.media||(s==null?void 0:s.readyState)!=="open")return null;const o=n.edge;if(n.live&&this.hls.config.liveDurationInfinity){if(n.fragments.length&&s.setLiveSeekableRange){const g=Math.max(0,n.fragmentStart),v=Math.max(g,o);return{duration:1/0,start:g,end:v}}return{duration:1/0}}const l=(t=this.overrides)==null?void 0:t.duration;if(l)return le(l)?{duration:l}:null;const c=this.media.duration,d=le(s.duration)?s.duration:0;return o>d&&o>c||!le(c)?{duration:o}:null}updateMediaSource({duration:t,start:n,end:s}){const o=this.mediaSource;!this.media||!o||o.readyState!=="open"||(o.duration!==t&&(le(t)&&this.log(`Updating MediaSource duration to ${t.toFixed(3)}`),o.duration=t),n!==void 0&&s!==void 0&&(this.log(`MediaSource duration is set to ${o.duration}. Setting seekable range to ${n}-${s}.`),o.setLiveSeekableRange(n,s)))}get tracksReady(){const t=this.pendingTrackCount;return t>0&&(t>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:t,pendingTrackCount:n,tracks:s}=this;if(this.log(`checkPendingTracks (pending: ${n} codec events expected: ${t}) ${Qi(s)}`),this.tracksReady){var o;const l=(o=this.transferData)==null?void 0:o.tracks;l&&Object.keys(l).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const t={};this.sourceBuffers.forEach(([n,s])=>{if(n){const o=this.tracks[n];t[n]={buffer:s,container:o.container,codec:o.codec,supplemental:o.supplemental,levelCodec:o.levelCodec,id:o.id,metadata:o.metadata}}}),this.hls.trigger(S.BUFFER_CREATED,{tracks:t}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([n])=>{this.executeNext(n)})}else{const t=new Error("could not create source buffer for media codec(s)");this.hls.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:t,reason:t.message})}}createSourceBuffers(){const{tracks:t,sourceBuffers:n,mediaSource:s}=this;if(!s)throw new Error("createSourceBuffers called when mediaSource was null");for(const l in t){const c=l,d=t[c];if(this.isPending(d)){const _=this.getTrackCodec(d,c),g=`${d.container};codecs=${_}`;d.codec=_,this.log(`creating sourceBuffer(${g})${this.currentOp(c)?" Queued":""} ${Qi(d)}`);try{const v=s.addSourceBuffer(g),y=zo(c),x=[c,v];n[y]=x,d.buffer=v}catch(v){var o;this.error(`error while trying to add sourceBuffer: ${v.message}`),this.shiftAndExecuteNext(c),(o=this.operationQueue)==null||o.removeBlockers(),delete this.tracks[c],this.hls.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:v,sourceBufferName:c,mimeType:g,parent:d.id});return}this.trackSourceBuffer(c,d)}}this.bufferCreated()}getTrackCodec(t,n){const s=t.supplemental;let o=t.codec;s&&(n==="video"||n==="audiovideo")&&Xt(s,"video")&&(o=ue(o,s));const l=ve(o,t.levelCodec);return l?n.slice(0,5)==="audio"?ae(l,this.appendSource):l:""}trackSourceBuffer(t,n){const s=n.buffer;if(!s)return;const o=this.getTrackCodec(n,t);this.tracks[t]={buffer:s,codec:o,container:n.container,levelCodec:n.levelCodec,supplemental:n.supplemental,metadata:n.metadata,id:n.id,listeners:[]},this.removeBufferListeners(t),this.addBufferListener(t,"updatestart",this.onSBUpdateStart),this.addBufferListener(t,"updateend",this.onSBUpdateEnd),this.addBufferListener(t,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(t,"bufferedchange",(l,c)=>{const d=c.removedRanges;d!=null&&d.length&&this.hls.trigger(S.BUFFER_FLUSHED,{type:l})})}get mediaSrc(){var t,n;const s=((t=this.media)==null||(n=t.querySelector)==null?void 0:n.call(t,"source"))||this.media;return s==null?void 0:s.src}onSBUpdateStart(t){const n=this.currentOp(t);n&&n.onStart()}onSBUpdateEnd(t){var n;if(((n=this.mediaSource)==null?void 0:n.readyState)==="closed"){this.resetBuffer(t);return}const s=this.currentOp(t);s&&(s.onComplete(),this.shiftAndExecuteNext(t))}onSBUpdateError(t,n){var s;const o=new Error(`${t} SourceBuffer error. MediaSource readyState: ${(s=this.mediaSource)==null?void 0:s.readyState}`);this.error(`${o}`,n),this.hls.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:o,fatal:!1});const l=this.currentOp(t);l&&l.onError(o)}updateTimestampOffset(t,n,s,o,l,c){const d=n-t.timestampOffset;Math.abs(d)>=s&&(this.log(`Updating ${o} SourceBuffer timestampOffset to ${n} (sn: ${l} cc: ${c})`),t.timestampOffset=n)}removeExecutor(t,n,s){const{media:o,mediaSource:l}=this,c=this.tracks[t],d=c==null?void 0:c.buffer;if(!o||!l||!d){this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(t);return}const _=le(o.duration)?o.duration:1/0,g=le(l.duration)?l.duration:1/0,v=Math.max(0,n),y=Math.min(s,_,g);y>v&&(!c.ending||c.ended)?(c.ended=!1,this.log(`Removing [${v},${y}] from the ${t} SourceBuffer`),d.remove(v,y)):this.shiftAndExecuteNext(t)}appendExecutor(t,n){const s=this.tracks[n],o=s==null?void 0:s.buffer;if(!o)throw new sd(`Attempting to append to the ${n} SourceBuffer, but it does not exist`);s.ending=!1,s.ended=!1,o.appendBuffer(t)}blockUntilOpen(t){if(this.isUpdating()||this.isQueued())this.blockBuffers(t).catch(n=>{this.warn(`SourceBuffer blocked callback ${n}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{t()}catch(n){this.warn(`Callback run without blocking ${this.operationQueue} ${n}`)}}isUpdating(){return this.sourceBuffers.some(([t,n])=>t&&n.updating)}isQueued(){return this.sourceBuffers.some(([t])=>t&&!!this.currentOp(t))}isPending(t){return!!t&&!t.buffer}blockBuffers(t,n=this.sourceBufferTypes){if(!n.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(t);const{operationQueue:s}=this,o=n.map(c=>this.appendBlocker(c));return n.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(o).then(c=>{s===this.operationQueue&&(t(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(t){t.forEach(n=>{var s;const o=(s=this.tracks[n])==null?void 0:s.buffer;!o||o.updating||this.shiftAndExecuteNext(n)})}append(t,n,s){this.operationQueue&&this.operationQueue.append(t,n,s)}appendBlocker(t){if(this.operationQueue)return this.operationQueue.appendBlocker(t)}currentOp(t){return this.operationQueue?this.operationQueue.current(t):null}executeNext(t){t&&this.operationQueue&&this.operationQueue.executeNext(t)}shiftAndExecuteNext(t){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(t)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((t,n)=>t+(this.isPending(this.tracks[n])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((t,[n])=>t+(n?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([t])=>t).filter(t=>!!t)}addBufferListener(t,n,s){const o=this.tracks[t];if(!o)return;const l=o.buffer;if(!l)return;const c=s.bind(this,t);o.listeners.push({event:n,listener:c}),l.addEventListener(n,c)}removeBufferListeners(t){const n=this.tracks[t];if(!n)return;const s=n.buffer;s&&(n.listeners.forEach(o=>{s.removeEventListener(o.event,o.listener)}),n.listeners.length=0)}}function Qh(h){const t=h.querySelectorAll("source");[].slice.call(t).forEach(n=>{h.removeChild(n)})}function ad(h,t){const n=self.document.createElement("source");n.type="video/mp4",n.src=t,h.appendChild(n)}function zo(h){return h==="audio"?1:0}class on{constructor(t){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=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(t){this.streamController=t}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:t}=this;t.on(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.BUFFER_CODECS,this.onBufferCodecs,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off(S.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.BUFFER_CODECS,this.onBufferCodecs,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(t,n){const s=this.hls.levels[n.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(t,n){this.media=n.media instanceof HTMLVideoElement?n.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(t,n){const s=this.hls;this.restrictedLevels=[],this.firstLevel=n.firstLevel,s.config.capLevelToPlayerSize&&n.video&&this.startCapping()}onLevelsUpdated(t,n){this.timer&&le(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(t,n){this.hls.config.capLevelToPlayerSize&&n.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 t=this.hls.levels;if(t.length){const n=this.hls,s=this.getMaxLevel(t.length-1);s!==this.autoLevelCapping&&n.logger.log(`Setting autoLevelCapping to ${s}: ${t[s].height}p@${t[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),n.autoLevelCapping=s,n.autoLevelEnabled&&n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}}}getMaxLevel(t){const n=this.hls.levels;if(!n.length)return-1;const s=n.filter((o,l)=>this.isLevelAllowed(o)&&l<=t);return this.clientRect=null,on.getMaxLevelByMediaSize(s,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 t=this.media,n={width:0,height:0};if(t){const s=t.getBoundingClientRect();n.width=s.width,n.height=s.height,!n.width&&!n.height&&(n.width=s.right-s.left||t.width||0,n.height=s.bottom-s.top||t.height||0)}return this.clientRect=n,n}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(n){}return Math.min(t,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(t){return!this.restrictedLevels.some(s=>t.bitrate===s.bitrate&&t.width===s.width&&t.height===s.height)}static getMaxLevelByMediaSize(t,n,s){if(!(t!=null&&t.length))return-1;const o=(d,_)=>_?d.width!==_.width||d.height!==_.height:!0;let l=t.length-1;const c=Math.max(n,s);for(let d=0;d<t.length;d+=1){const _=t[d];if((_.width>=c||_.height>=c)&&o(_,t[d+1])){l=d;break}}return l}}const Mr={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Ss={HLS:"h"};class Gs{constructor(t,n){Array.isArray(t)&&(t=t.map(s=>s instanceof Gs?s:new Gs(s))),this.value=t,this.params=n}}const Ma="Dict";function ef(h){return Array.isArray(h)?JSON.stringify(h):h instanceof Map?"Map{}":h instanceof Set?"Set{}":typeof h=="object"?JSON.stringify(h):String(h)}function ld(h,t,n,s){return new Error(`failed to ${h} "${ef(t)}" as ${n}`,{cause:s})}function ta(h,t,n){return ld("serialize",h,t,n)}class vu{constructor(t){this.description=t}}const Vo="Bare Item",Cl="Boolean";function $t(h){if(typeof h!="boolean")throw ta(h,Cl);return h?"?1":"?0"}function bc(h){return btoa(String.fromCharCode(...h))}const yu="Byte Sequence";function bu(h){if(ArrayBuffer.isView(h)===!1)throw ta(h,yu);return`:${bc(h)}:`}const xu="Integer";function ud(h){return h<-999999999999999||999999999999999<h}function tf(h){if(ud(h))throw ta(h,xu);return h.toString()}function cd(h){return`@${tf(h.getTime()/1e3)}`}function wr(h,t){if(h<0)return-wr(-h,t);const n=Math.pow(10,t);if(Math.abs(h*n%1-.5)<Number.EPSILON){const o=Math.floor(h*n);return(o%2===0?o:o+1)/n}else return Math.round(h*n)/n}const hd="Decimal";function xc(h){const t=wr(h,3);if(Math.floor(Math.abs(t)).toString().length>12)throw ta(h,hd);const n=t.toString();return n.includes(".")?n:`${n}.0`}const wu="String",Su=/[\x00-\x1f\x7f]+/;function so(h){if(Su.test(h))throw ta(h,wu);return`"${h.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Go(h){return h.description||h.toString().slice(7,-1)}const Es="Token";function Ia(h){const t=Go(h);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw ta(t,Es);return t}function $r(h){switch(typeof h){case"number":if(!le(h))throw ta(h,Vo);return Number.isInteger(h)?tf(h):xc(h);case"string":return so(h);case"symbol":return Ia(h);case"boolean":return $t(h);case"object":if(h instanceof Date)return cd(h);if(h instanceof Uint8Array)return bu(h);if(h instanceof vu)return Ia(h);default:throw ta(h,Vo)}}const Ra="Key";function ao(h){if(/^[a-z*][a-z0-9\-_.*]*$/.test(h)===!1)throw ta(h,Ra);return h}function Ps(h){return h==null?"":Object.entries(h).map(([t,n])=>n===!0?`;${ao(t)}`:`;${ao(t)}=${$r(n)}`).join("")}function wc(h){return h instanceof Gs?`${$r(h.value)}${Ps(h.params)}`:$r(h)}function nf(h){return`(${h.value.map(wc).join(" ")})${Ps(h.params)}`}function Sc(h,t={whitespace:!0}){if(typeof h!="object"||h==null)throw ta(h,Ma);const n=h instanceof Map?h.entries():Object.entries(h),s=t!=null&&t.whitespace?" ":"";return Array.from(n).map(([o,l])=>{l instanceof Gs||(l=new Gs(l));let c=ao(o);return l.value===!0?c+=Ps(l.params):(c+="=",Array.isArray(l.value)?c+=nf(l):c+=wc(l)),c}).join(`,${s}`)}function rf(h,t){return Sc(h,t)}const Yn="CMCD-Object",Rn="CMCD-Request",oo="CMCD-Session",da="CMCD-Status",Ec={br:Yn,ab:Yn,d:Yn,ot:Yn,tb:Yn,tpb:Yn,lb:Yn,tab:Yn,lab:Yn,url:Yn,pb:Rn,bl:Rn,tbl:Rn,dl:Rn,ltc:Rn,mtp:Rn,nor:Rn,nrr:Rn,rc:Rn,sn:Rn,sta:Rn,su:Rn,ttfb:Rn,ttfbb:Rn,ttlb:Rn,cmsdd:Rn,cmsds:Rn,smrt:Rn,df:Rn,cs:Rn,ts:Rn,cid:oo,pr:oo,sf:oo,sid:oo,st:oo,v:oo,msd:oo,bs:da,bsd:da,cdn:da,rtp:da,bg:da,pt:da,ec:da,e:da},fn={REQUEST:Rn};function Ho(h){return Object.keys(h).reduce((t,n)=>{var s;return(s=h[n])===null||s===void 0||s.forEach(o=>t[o]=n),t},{})}function lo(h,t){const n={};if(!h)return n;const s=Object.keys(h),o=t?Ho(t):{};return s.reduce((l,c)=>{var d;const _=Ec[c]||o[c]||fn.REQUEST,g=(d=l[_])!==null&&d!==void 0?d:l[_]={};return g[c]=h[c],l},n)}function Eu(h){return["ot","sf","st","e","sta"].includes(h)}function ut(h){return typeof h=="number"?le(h):h!=null&&h!==""&&h!==!1}const sf="event";function fd(h,t){const n=new URL(h),s=new URL(t);if(n.origin!==s.origin)return h;const o=n.pathname.split("/").slice(1),l=s.pathname.split("/").slice(1,-1);for(;o[0]===l[0];)o.shift(),l.shift();for(;l.length;)l.shift(),o.unshift("..");return o.join("/")+n.search+n.hash}const Wo=h=>Math.round(h),kc=(h,t)=>Array.isArray(h)?h.map(n=>kc(n,t)):h instanceof Gs&&typeof h.value=="string"?new Gs(kc(h.value,t),h.params):(t.baseUrl&&(h=fd(h,t.baseUrl)),t.version===1?encodeURIComponent(h):h),Pa=h=>Wo(h/100)*100,dd={br:Wo,d:Wo,bl:Pa,dl:Pa,mtp:Pa,nor:(h,t)=>{let n=h;return t.version>=2&&(h instanceof Gs&&typeof h.value=="string"?n=new Gs([h]):typeof h=="string"&&(n=[h])),kc(n,t)},rtp:Pa,tb:Wo},Kr="request",pa="response",jo=["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"],ku=["e"],pd=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function Tu(h){return pd.test(h)}function Tc(h){return jo.includes(h)||ku.includes(h)||Tu(h)}const Ac=["d","dl","nor","ot","rtp","su"];function Au(h){return jo.includes(h)||Ac.includes(h)||Tu(h)}const os=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function uo(h){return jo.includes(h)||Ac.includes(h)||os.includes(h)||Tu(h)}const af=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function of(h){return af.includes(h)||Tu(h)}const Lc={[pa]:uo,[sf]:Tc,[Kr]:Au};function lf(h,t={}){const n={};if(h==null||typeof h!="object")return n;const s=t.version||h.v||1,o=t.reportingMode||Kr,l=s===1?of:Lc[o];let c=Object.keys(h).filter(l);const d=t.filter;typeof d=="function"&&(c=c.filter(d));const _=o===pa||o===sf;_&&!c.includes("ts")&&c.push("ts"),s>1&&!c.includes("v")&&c.push("v");const g=k({},dd,t.formatters),v={version:s,reportingMode:o,baseUrl:t.baseUrl};return c.sort().forEach(y=>{let x=h[y];const L=g[y];if(typeof L=="function"&&(x=L(x,v)),y==="v"){if(s===1)return;x=s}y=="pr"&&x===1||(_&&y==="ts"&&!le(x)&&(x=Date.now()),ut(x)&&(Eu(y)&&typeof x=="string"&&(x=new vu(x)),n[y]=x))}),n}function md(h,t={}){const n={};if(!h)return n;const s=lf(h,t),o=lo(s,t==null?void 0:t.customHeaderMap);return Object.entries(o).reduce((l,[c,d])=>{const _=rf(d,{whitespace:!1});return _&&(l[c]=_),l},n)}function gd(h,t,n){return k(h,md(t,n))}const _d="CMCD";function uf(h,t={}){return h?rf(lf(h,t),{whitespace:!1}):""}function jn(h,t={}){if(!h)return"";const n=uf(h,t);return encodeURIComponent(n)}function vd(h,t={}){if(!h)return"";const n=jn(h,t);return`${_d}=${n}`}const cf=/CMCD=[^&#]+/;function co(h,t,n){const s=vd(t,n);if(!s)return h;if(cf.test(h))return h.replace(cf,s);const o=h.includes("?")?"&":"?";return`${h}${o}${s}`}class yd{constructor(t){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=o=>{try{this.apply(o,{ot:Mr.MANIFEST,su:!this.initialized})}catch(l){this.hls.logger.warn("Could not generate manifest CMCD data.",l)}},this.applyFragmentData=o=>{try{const{frag:l,part:c}=o,d=this.hls.levels[l.level],_=this.getObjectType(l),g={d:(c||l).duration*1e3,ot:_};(_===Mr.VIDEO||_===Mr.AUDIO||_==Mr.MUXED)&&(g.br=d.bitrate/1e3,g.tb=this.getTopBandwidth(_)/1e3,g.bl=this.getBufferLength(_));const v=c?this.getNextPart(c):this.getNextFrag(l);v!=null&&v.url&&v.url!==l.url&&(g.nor=v.url),this.apply(o,g)}catch(l){this.hls.logger.warn("Could not generate segment CMCD data.",l)}},this.hls=t;const n=this.config=t.config,{cmcd:s}=n;s!=null&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||t.sessionId,this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.includeKeys=s.includeKeys,this.registerListeners())}registerListeners(){const t=this.hls;t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHED,this.onMediaDetached,this),t.on(S.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const t=this.hls;t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHED,this.onMediaDetached,this),t.off(S.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(t,n){this.media=n.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(t,n){var s,o;this.audioBuffer=(s=n.tracks.audio)==null?void 0:s.buffer,this.videoBuffer=(o=n.tracks.video)==null?void 0:o.buffer}createData(){var t;return{v:1,sf:Ss.HLS,sid:this.sid,cid:this.cid,pr:(t=this.media)==null?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(t,n={}){k(n,this.createData());const s=n.ot===Mr.INIT||n.ot===Mr.VIDEO||n.ot===Mr.MUXED;this.starved&&s&&(n.bs=!0,n.su=!0,this.starved=!1),n.su==null&&(n.su=this.buffering);const{includeKeys:o}=this;o&&(n=Object.keys(n).reduce((c,d)=>(o.includes(d)&&(c[d]=n[d]),c),{}));const l={baseUrl:t.url};this.useHeaders?(t.headers||(t.headers={}),gd(t.headers,n,l)):t.url=co(t.url,n,l)}getNextFrag(t){var n;const s=(n=this.hls.levels[t.level])==null?void 0:n.details;if(s){const o=t.sn-s.startSN;return s.fragments[o+1]}}getNextPart(t){var n;const{index:s,fragment:o}=t,l=(n=this.hls.levels[o.level])==null||(n=n.details)==null?void 0:n.partList;if(l){const{sn:c}=o;for(let d=l.length-1;d>=0;d--){const _=l[d];if(_.index===s&&_.fragment.sn===c)return l[d+1]}}}getObjectType(t){const{type:n}=t;if(n==="subtitle")return Mr.TIMED_TEXT;if(t.sn==="initSegment")return Mr.INIT;if(n==="audio")return Mr.AUDIO;if(n==="main")return this.hls.audioTracks.length?Mr.VIDEO:Mr.MUXED}getTopBandwidth(t){let n=0,s;const o=this.hls;if(t===Mr.AUDIO)s=o.audioTracks;else{const l=o.maxAutoLevel,c=l>-1?l+1:o.levels.length;s=o.levels.slice(0,c)}return s.forEach(l=>{l.bitrate>n&&(n=l.bitrate)}),n>0?n:NaN}getBufferLength(t){const n=this.media,s=t===Mr.AUDIO?this.audioBuffer:this.videoBuffer;return!s||!n?NaN:mi.bufferInfo(s,n.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:t}=this.config,n=this.applyPlaylistData,s=t||this.config.loader;return class{constructor(l){this.loader=void 0,this.loader=new s(l)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(l,c,d){n(l),this.loader.load(l,c,d)}}}createFragmentLoader(){const{fLoader:t}=this.config,n=this.applyFragmentData,s=t||this.config.loader;return class{constructor(l){this.loader=void 0,this.loader=new s(l)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(l,c,d){n(l),this.loader.load(l,c,d)}}}}const Ml=3e5;class bd extends H{constructor(t){super("content-steering",t.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=t,this.registerListeners()}registerListeners(){const t=this.hls;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const t=this.hls;t&&(t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((t,n)=>(t.indexOf(n.pathwayId)===-1&&t.push(n.pathwayId),t),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(t){this.updatePathwayPriority(t)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const t=this.timeToLoad*1e3-(performance.now()-this.updated);if(t>0){this.scheduleRefresh(this.uri,t);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(t){const n=this.levels;n&&(this.levels=n.filter(s=>s!==t))}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(t,n){const{contentSteering:s}=n;s!==null&&(this.pathwayId=s.pathwayId,this.uri=s.uri,this.started&&this.startLoad())}onManifestParsed(t,n){this.audioTracks=n.audioTracks,this.subtitleTracks=n.subtitleTracks}onError(t,n){const{errorAction:s}=n;if((s==null?void 0:s.action)===tn.SendAlternateToPenaltyBox&&s.flags===ji.MoveAllAlternatesMatchingHost){const o=this.levels;let l=this._pathwayPriority,c=this.pathwayId;if(n.context){const{groupId:d,pathwayId:_,type:g}=n.context;d&&o?c=this.getPathwayForGroupId(d,g,c):_&&(c=_)}c in this.penalizedPathways||(this.penalizedPathways[c]=performance.now()),!l&&o&&(l=this.pathways()),l&&l.length>1&&(this.updatePathwayPriority(l),s.resolved=this.pathwayId!==c),n.details===Z.BUFFER_APPEND_ERROR&&!n.fatal?s.resolved=!0:s.resolved||this.warn(`Could not resolve ${n.details} ("${n.error.message}") with content-steering for Pathway: ${c} levels: ${o&&o.length} priorities: ${Qi(l)} penalized: ${Qi(this.penalizedPathways)}`)}}filterParsedLevels(t){this.levels=t;let n=this.getLevelsForPathway(this.pathwayId);if(n.length===0){const s=t[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${s}"`),n=this.getLevelsForPathway(s),this.pathwayId=s}return n.length!==t.length&&this.log(`Found ${n.length}/${t.length} levels in Pathway "${this.pathwayId}"`),n}getLevelsForPathway(t){return this.levels===null?[]:this.levels.filter(n=>t===n.pathwayId)}updatePathwayPriority(t){this._pathwayPriority=t;let n;const s=this.penalizedPathways,o=performance.now();Object.keys(s).forEach(l=>{o-s[l]>Ml&&delete s[l]});for(let l=0;l<t.length;l++){const c=t[l];if(c in s)continue;if(c===this.pathwayId)return;const d=this.hls.nextLoadLevel,_=this.hls.levels[d];if(n=this.getLevelsForPathway(c),n.length>0){this.log(`Setting Pathway to "${c}"`),this.pathwayId=c,Us(n),this.hls.trigger(S.LEVELS_UPDATED,{levels:n});const g=this.hls.levels[d];_&&g&&this.levels&&(g.attrs["STABLE-VARIANT-ID"]!==_.attrs["STABLE-VARIANT-ID"]&&g.bitrate!==_.bitrate&&this.log(`Unstable Pathways change from bitrate ${_.bitrate} to ${g.bitrate}`),this.hls.nextLoadLevel=d);break}}}getPathwayForGroupId(t,n,s){const o=this.getLevelsForPathway(s).concat(this.levels||[]);for(let l=0;l<o.length;l++)if(n===Ae.AUDIO_TRACK&&o[l].hasAudioGroup(t)||n===Ae.SUBTITLE_TRACK&&o[l].hasSubtitleGroup(t))return o[l].pathwayId;return s}clonePathways(t){const n=this.levels;if(!n)return;const s={},o={};t.forEach(l=>{const{ID:c,"BASE-ID":d,"URI-REPLACEMENT":_}=l;if(n.some(v=>v.pathwayId===c))return;const g=this.getLevelsForPathway(d).map(v=>{const y=new qi(v.attrs);y["PATHWAY-ID"]=c;const x=y.AUDIO&&`${y.AUDIO}_clone_${c}`,L=y.SUBTITLES&&`${y.SUBTITLES}_clone_${c}`;x&&(s[y.AUDIO]=x,y.AUDIO=x),L&&(o[y.SUBTITLES]=L,y.SUBTITLES=L);const M=Cc(v.uri,y["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",_),B=new mn({attrs:y,audioCodec:v.audioCodec,bitrate:v.bitrate,height:v.height,name:v.name,url:M,videoCodec:v.videoCodec,width:v.width});if(v.audioGroups)for(let F=1;F<v.audioGroups.length;F++)B.addGroupId("audio",`${v.audioGroups[F]}_clone_${c}`);if(v.subtitleGroups)for(let F=1;F<v.subtitleGroups.length;F++)B.addGroupId("text",`${v.subtitleGroups[F]}_clone_${c}`);return B});n.push(...g),Dc(this.audioTracks,s,_,c),Dc(this.subtitleTracks,o,_,c)})}loadSteeringManifest(t){const n=this.hls.config,s=n.loader;this.loader&&this.loader.destroy(),this.loader=new s(n);let o;try{o=new self.URL(t)}catch(v){this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${t}`);return}if(o.protocol!=="data:"){const v=(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate)|0;o.searchParams.set("_HLS_pathway",this.pathwayId),o.searchParams.set("_HLS_throughput",""+v)}const l={responseType:"json",url:o.href},c=n.steeringManifestLoadPolicy.default,d=c.errorRetry||c.timeoutRetry||{},_={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:d.maxNumRetry||0,retryDelay:d.retryDelayMs||0,maxRetryDelay:d.maxRetryDelayMs||0},g={onSuccess:(v,y,x,L)=>{this.log(`Loaded steering manifest: "${o}"`);const M=v.data;if((M==null?void 0:M.VERSION)!==1){this.log(`Steering VERSION ${M.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=M.TTL;const{"RELOAD-URI":B,"PATHWAY-CLONES":F,"PATHWAY-PRIORITY":W}=M;if(B)try{this.uri=new self.URL(B,o).href}catch(ce){this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${B}`);return}this.scheduleRefresh(this.uri||x.url),F&&this.clonePathways(F);const _e={steeringManifest:M,url:o.toString()};this.hls.trigger(S.STEERING_MANIFEST_LOADED,_e),W&&this.updatePathwayPriority(W)},onError:(v,y,x,L)=>{if(this.log(`Error loading steering manifest: ${v.code} ${v.text} (${y.url})`),this.stopLoad(),v.code===410){this.enabled=!1,this.log(`Steering manifest ${y.url} no longer available`);return}let M=this.timeToLoad*1e3;if(v.code===429){const B=this.loader;if(typeof(B==null?void 0:B.getResponseHeader)=="function"){const F=B.getResponseHeader("Retry-After");F&&(M=parseFloat(F)*1e3)}this.log(`Steering manifest ${y.url} rate limited`);return}this.scheduleRefresh(this.uri||y.url,M)},onTimeout:(v,y,x)=>{this.log(`Timeout loading steering manifest (${y.url})`),this.scheduleRefresh(this.uri||y.url)}};this.log(`Requesting steering manifest: ${o}`),this.loader.load(l,_,g)}scheduleRefresh(t,n=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var s;const o=(s=this.hls)==null?void 0:s.media;if(o&&!o.ended){this.loadSteeringManifest(t);return}this.scheduleRefresh(t,this.timeToLoad*1e3)},n)}}function Dc(h,t,n,s){h&&Object.keys(t).forEach(o=>{const l=h.filter(c=>c.groupId===o).map(c=>{const d=k({},c);return d.details=void 0,d.attrs=new qi(d.attrs),d.url=d.attrs.URI=Cc(c.url,c.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),d.groupId=d.attrs["GROUP-ID"]=t[o],d.attrs["PATHWAY-ID"]=s,d});h.push(...l)})}function Cc(h,t,n,s){const{HOST:o,PARAMS:l,[n]:c}=s;let d;t&&(d=c==null?void 0:c[t],d&&(h=d));const _=new self.URL(h);return o&&!d&&(_.host=o),l&&Object.keys(l).sort().forEach(g=>{g&&_.searchParams.set(g,l[g])}),_.href}class ia extends H{constructor(t){super("eme",t.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=ia.CDMCleanupPromise?[ia.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=n=>{const{initDataType:s,initData:o}=n,l=`"${n.type}" event: init data type: "${s}"`;if(this.debug(l),o!==null){if(!this.keyFormatPromise){let c=Object.keys(this.keySystemAccessPromises);c.length||(c=Li(this.config));const d=c.map(ui).filter(_=>!!_);this.keyFormatPromise=this.getKeyFormatPromise(d)}this.keyFormatPromise.then(c=>{const d=$s(c);if(s!=="sinf"||d!==Vn.FAIRPLAY){this.log(`Ignoring "${n.type}" event with init data type: "${s}" for selected key-system ${d}`);return}let _;try{const L=tt(new Uint8Array(o)),M=zn(JSON.parse(L).sinf),B=jt(M);if(!B)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");_=new Uint8Array(B.subarray(8,24))}catch(L){this.warn(`${l} Failed to parse sinf: ${L}`);return}const g=te(_),{keyIdToKeySessionPromise:v,mediaKeySessions:y}=this;let x=v[g];for(let L=0;L<y.length;L++){const M=y[L],B=M.decryptdata;if(!B.keyId)continue;const F=te(B.keyId);if(g===F||B.uri.replace(/-/g,"").indexOf(g)!==-1){if(x=v[F],!x)continue;if(B.pssh)break;delete v[F],B.pssh=new Uint8Array(o),B.keyId=_,x=v[g]=x.then(()=>this.generateRequestWithPreferredKeySession(M,s,o,"encrypted-event-key-match")),x.catch(W=>this.handleError(W));break}}x||this.handleError(new Error(`Key ID ${g} not encountered in playlist. Key-system sessions ${y.length}.`))}).catch(c=>this.handleError(c))}},this.onWaitingForKey=n=>{this.log(`"${n.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const t=this.config;t.requestMediaKeySystemAccessFunc=null,t.licenseXhrSetup=t.licenseResponseCallback=void 0,t.drmSystems=t.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(S.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(S.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(S.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(S.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(t){const{drmSystems:n,widevineLicenseUrl:s}=this.config,o=n==null?void 0:n[t];if(o)return o.licenseUrl;if(t===Vn.WIDEVINE&&s)return s}getLicenseServerUrlOrThrow(t){const n=this.getLicenseServerUrl(t);if(n===void 0)throw new Error(`no license server URL configured for key-system "${t}"`);return n}getServerCertificateUrl(t){const{drmSystems:n}=this.config,s=n==null?void 0:n[t];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const n=this.hls.levels,s=(c,d,_)=>!!c&&_.indexOf(c)===d,o=n.map(c=>c.audioCodec).filter(s),l=n.map(c=>c.videoCodec).filter(s);return o.length+l.length===0&&l.push("avc1.42e01e"),new Promise((c,d)=>{const _=g=>{const v=g.shift();this.getMediaKeysPromise(v,o,l).then(y=>c({keySystem:v,mediaKeys:y})).catch(y=>{g.length?_(g):y instanceof Hs?d(y):d(new Hs({type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_ACCESS,error:y,fatal:!0},y.message))})};_(t)})}requestMediaKeySystemAccess(t,n){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let o=`Configured requestMediaKeySystemAccess is not a function ${s}`;return Cn===null&&self.location.protocol==="http:"&&(o=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(o))}return s(t,n)}getMediaKeysPromise(t,n,s){var o;const l=ar(t,n,s,this.config.drmSystemOptions||{});let c=this.keySystemAccessPromises[t],d=(o=c)==null?void 0:o.keySystemAccess;if(!d){this.log(`Requesting encrypted media "${t}" key-system access with config: ${Qi(l)}`),d=this.requestMediaKeySystemAccess(t,l);const _=c=this.keySystemAccessPromises[t]={keySystemAccess:d};return d.catch(g=>{this.log(`Failed to obtain access to key-system "${t}": ${g}`)}),d.then(g=>{this.log(`Access for key-system "${g.keySystem}" obtained`);const v=this.fetchServerCertificate(t);this.log(`Create media-keys for "${t}"`);const y=_.mediaKeys=g.createMediaKeys().then(x=>(this.log(`Media-keys created for "${t}"`),_.hasMediaKeys=!0,v.then(L=>L?this.setMediaKeysServerCertificate(x,t,L):x)));return y.catch(x=>{this.error(`Failed to create media-keys for "${t}"}: ${x}`)}),y})}return d.then(()=>c.mediaKeys)}createMediaKeySessionContext({decryptdata:t,keySystem:n,mediaKeys:s}){this.log(`Creating key-system session "${n}" keyId: ${te(t.keyId||[])}`);const o=s.createSession(),l={decryptdata:t,keySystem:n,mediaKeys:s,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(l),l}renewKeySession(t){const n=t.decryptdata;if(n.pssh){const s=this.createMediaKeySessionContext(t),o=this.getKeyIdString(n),l="cenc";this.keyIdToKeySessionPromise[o]=this.generateRequestWithPreferredKeySession(s,l,n.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)}getKeyIdString(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(t.keyId===null)throw new Error("keyId is null");return te(t.keyId)}updateKeySession(t,n){const s=t.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyId ${te(t.decryptdata.keyId||[])}
} (data length: ${n.byteLength})`),s.update(n)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(t=>({keySystem:t,hasMediaKeys:this.keySystemAccessPromises[t].hasMediaKeys})).filter(({hasMediaKeys:t})=>!!t).map(({keySystem:t})=>ui(t)).filter(t=>!!t)}getKeySystemAccess(t){return this.getKeySystemSelectionPromise(t).then(({keySystem:n,mediaKeys:s})=>this.attemptSetMediaKeys(n,s))}selectKeySystem(t){return new Promise((n,s)=>{this.getKeySystemSelectionPromise(t).then(({keySystem:o})=>{const l=ui(o);l?n(l):s(new Error(`Unable to find format for key-system "${o}"`))}).catch(s)})}selectKeySystemFormat(t){const n=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)),this.keyFormatPromise}getKeyFormatPromise(t){const n=Li(this.config),s=t.map($s).filter(o=>!!o&&n.indexOf(o)!==-1);return this.selectKeySystem(s)}loadKey(t){const n=t.keyInfo.decryptdata,s=this.getKeyIdString(n),o=this.bannedKeyIds[s];if(o){const d=Mc(o,n);return this.handleError(d,t.frag),Promise.reject(d)}const l=`(keyId: ${s} format: "${n.keyFormat}" method: ${n.method} uri: ${n.uri})`;this.log(`Starting session for key ${l}`);const c=this.keyIdToKeySessionPromise[s];if(!c){const d=this.getKeySystemForKeyPromise(n).then(({keySystem:_,mediaKeys:g})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${l}`),this.attemptSetMediaKeys(_,g).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:_,mediaKeys:g,decryptdata:n}))))).then(_=>{const g="cenc",v=n.pssh?n.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(_,g,v,"playlist-key")});return d.catch(_=>this.handleError(_,t.frag)),this.keyIdToKeySessionPromise[s]=d,d}return c}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t,n){this.hls&&(this.error(t.message),t instanceof Hs?(n&&(t.data.frag=n),this.hls.trigger(S.ERROR,t.data)):this.hls.trigger(S.ERROR,{type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))}getKeySystemForKeyPromise(t){const n=this.getKeyIdString(t),s=this.keyIdToKeySessionPromise[n];if(!s){const o=$s(t.keyFormat),l=o?[o]:Li(this.config);return this.attemptKeySystemAccess(l)}return s}getKeySystemSelectionPromise(t){if(t.length||(t=Li(this.config)),t.length===0)throw new Hs({type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Qi({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}attemptSetMediaKeys(t,n){if(this.mediaKeys===n)return Promise.resolve();const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);const o=Promise.all(s).then(()=>{if(!this.media)throw this.mediaKeys=null,new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(n)});return this.mediaKeys=n,this.setMediaKeysQueue.push(o),o.then(()=>{this.log(`Media-keys set for "${t}"`),s.push(o),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(l=>s.indexOf(l)===-1)})}generateRequestWithPreferredKeySession(t,n,s,o){var l;const c=(l=this.config.drmSystems)==null||(l=l[t.keySystem])==null?void 0:l.generateRequest;if(c)try{const x=c.call(this.hls,n,s,t);if(!x)throw new Error("Invalid response from configured generateRequest filter");n=x.initDataType,s=x.initData?x.initData:null,t.decryptdata.pssh=s?new Uint8Array(s):null}catch(x){if(this.warn(x.message),this.hls&&this.hls.config.debug)throw x}if(s===null)return this.log(`Skipping key-session request for "${o}" (no initData)`),Promise.resolve(t);const d=this.getKeyIdString(t.decryptdata);this.log(`Generating key-session request for "${o}": ${d} (init data type: ${n} length: ${s.byteLength})`);const _=new eu,g=t._onmessage=x=>{const L=t.mediaKeysSession;if(!L){_.emit("error",new Error("invalid state"));return}const{messageType:M,message:B}=x;this.log(`"${M}" message event for session "${L.sessionId}" message size: ${B.byteLength}`),M==="license-request"||M==="license-renewal"?this.renewLicense(t,B).catch(F=>{_.eventNames().length?_.emit("error",F):this.handleError(F)}):M==="license-release"?t.keySystem===Vn.FAIRPLAY&&(this.updateKeySession(t,sr("acknowledged")),this.removeSession(t)):this.warn(`unhandled media key message type "${M}"`)},v=t._onkeystatuseschange=x=>{if(!t.mediaKeysSession){_.emit("error",new Error("invalid state"));return}const M=t.keyStatus;this.onKeyStatusChange(t);const B=t.keyStatus;B!==M&&(_.emit("keyStatus",B,t),B==="expired"&&(this.log(`${t.keySystem} expired for key ${d}`),this.renewKeySession(t)))};br(t.mediaKeysSession,"message",g),br(t.mediaKeysSession,"keystatuseschange",v);const y=new Promise((x,L)=>{_.on("error",L),_.on("keyStatus",(M,{decryptdata:B})=>{M.startsWith("usable")?x():M==="internal-error"||M==="output-restricted"?L(Mc(M,B)):M==="expired"?L(new Error(`key expired while generating request (keyId: ${d})`)):this.warn(`unhandled key status change "${M}" (keyId: ${d})`)})});return t.mediaKeysSession.generateRequest(n,s).then(()=>{this.log(`Request generated for key-session "${t.mediaKeysSession.sessionId}" keyId: ${d}`)}).catch(x=>{throw new Hs({type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_NO_SESSION,error:x,decryptdata:t.decryptdata,fatal:!1},`Error generating key-session request: ${x}`)}).then(()=>y).catch(x=>{throw _.removeAllListeners(),this.removeSession(t),x}).then(()=>(_.removeAllListeners(),t))}onKeyStatusChange(t){const n=te(new Uint8Array(t.decryptdata.keyId||[]));t.mediaKeysSession.keyStatuses.forEach((s,o)=>{if(typeof o=="string"&&typeof s=="object"){const d=o;o=s,s=d}const l=te("buffer"in o?new Uint8Array(o.buffer,o.byteOffset,o.byteLength):new Uint8Array(o));s==="internal-error"&&(this.bannedKeyIds[l]=s);const c=l===n;this.log(`${c?"":"un"}matched key status change "${s}" for keyStatuses keyId: ${l} session keyId: ${n} uri: ${t.decryptdata.uri}`),c&&(t.keyStatus=s)})}fetchServerCertificate(t){const n=this.config,s=n.loader,o=new s(n),l=this.getServerCertificateUrl(t);return l?(this.log(`Fetching server certificate for "${t}"`),new Promise((c,d)=>{const _={responseType:"arraybuffer",url:l},g=n.certLoadPolicy.default,v={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(x,L,M,B)=>{c(x.data)},onError:(x,L,M,B)=>{d(new Hs({type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:M,response:C({url:_.url,data:void 0},x)},`"${t}" certificate request failed (${l}). Status: ${x.code} (${x.text})`))},onTimeout:(x,L,M)=>{d(new Hs({type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:M,response:{url:_.url,data:void 0}},`"${t}" certificate request timed out (${l})`))},onAbort:(x,L,M)=>{d(new Error("aborted"))}};o.load(_,v,y)})):Promise.resolve()}setMediaKeysServerCertificate(t,n,s){return new Promise((o,l)=>{t.setServerCertificate(s).then(c=>{this.log(`setServerCertificate ${c?"success":"not supported by CDM"} (${s.byteLength}) on "${n}"`),o(t)}).catch(c=>{l(new Hs({type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:c,fatal:!0},c.message))})})}renewLicense(t,n){return this.requestLicense(t,new Uint8Array(n)).then(s=>this.updateKeySession(t,new Uint8Array(s)).catch(o=>{throw new Hs({type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:t.decryptdata,error:o,fatal:!1},o.message)}))}unpackPlayReadyKeyMessage(t,n){const s=String.fromCharCode.apply(null,new Uint16Array(n.buffer));if(!s.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),n;const o=new DOMParser().parseFromString(s,"application/xml"),l=o.querySelectorAll("HttpHeader");if(l.length>0){let v;for(let y=0,x=l.length;y<x;y++){var c,d;v=l[y];const L=(c=v.querySelector("name"))==null?void 0:c.textContent,M=(d=v.querySelector("value"))==null?void 0:d.textContent;L&&M&&t.setRequestHeader(L,M)}}const _=o.querySelector("Challenge"),g=_==null?void 0:_.textContent;if(!g)throw new Error("Cannot find <Challenge> in key message");return sr(atob(g))}setupLicenseXHR(t,n,s,o){const l=this.config.licenseXhrSetup;return l?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return l.call(this.hls,t,n,s,o)}).catch(c=>{if(!s.decryptdata)throw c;return t.open("POST",n,!0),l.call(this.hls,t,n,s,o)}).then(c=>(t.readyState||t.open("POST",n,!0),{xhr:t,licenseChallenge:c||o})):(t.open("POST",n,!0),Promise.resolve({xhr:t,licenseChallenge:o}))}requestLicense(t,n){const s=this.config.keyLoadPolicy.default;return new Promise((o,l)=>{const c=this.getLicenseServerUrlOrThrow(t.keySystem);this.log(`Sending license request to URL: ${c}`);const d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return l(new Error("invalid state"));if(d.readyState===4)if(d.status===200){this._requestLicenseFailureCount=0;let _=d.response;this.log(`License received ${_ instanceof ArrayBuffer?_.byteLength:_}`);const g=this.config.licenseResponseCallback;if(g)try{_=g.call(this.hls,d,c,t)}catch(v){this.error(v)}o(_)}else{const _=s.errorRetry,g=_?_.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>g||d.status>=400&&d.status<500)l(new Hs({type:pe.KEY_SYSTEM_ERROR,details:Z.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:t.decryptdata,fatal:!0,networkDetails:d,response:{url:c,data:void 0,code:d.status,text:d.statusText}},`License Request XHR failed (${c}). Status: ${d.status} (${d.statusText})`));else{const v=g-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${v} attempts left`),this.requestLicense(t,n).then(o,l)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=d,this.setupLicenseXHR(d,c,t,n).then(({xhr:_,licenseChallenge:g})=>{t.keySystem==Vn.PLAYREADY&&(g=this.unpackPlayReadyKeyMessage(_,g)),_.send(g)}).catch(l)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(t,n){if(!this.config.emeEnabled)return;const s=n.media;this.media=s,br(s,"encrypted",this.onMediaEncrypted),br(s,"waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media;t&&(Cr(t,"encrypted",this.onMediaEncrypted),Cr(t,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var t;if(this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={},!this.mediaKeys&&!this.mediaKeySessions.length)return;const n=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,jr.clearKeyUriToKeyIdMap();const o=s.length;ia.CDMCleanupPromise=Promise.all(s.map(l=>this.removeSession(l)).concat(n==null||(t=n.setMediaKeys(null))==null?void 0:t.catch(l=>{this.log(`Could not clear media keys: ${l}`),this.hls&&this.hls.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${l}`)})}))).catch(l=>{this.log(`Could not close sessions and clear media keys: ${l}`),this.hls&&this.hls.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${l}`)})}).then(()=>{o&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this.keyFormatPromise=null,this.bannedKeyIds={}}onManifestLoaded(t,{sessionKeys:n}){if(!(!n||!this.config.emeEnabled)&&!this.keyFormatPromise){const s=n.reduce((o,l)=>(o.indexOf(l.keyFormat)===-1&&o.push(l.keyFormat),o),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(t){const{mediaKeysSession:n,licenseXhr:s,decryptdata:o}=t;if(n){this.log(`Remove licenses and keys and close session "${n.sessionId}" keyId: ${te((o==null?void 0:o.keyId)||[])}`),t._onmessage&&(n.removeEventListener("message",t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(n.removeEventListener("keystatuseschange",t._onkeystatuseschange),t._onkeystatuseschange=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;const l=this.mediaKeySessions.indexOf(t);l>-1&&this.mediaKeySessions.splice(l,1);const{drmSystemOptions:c}=this.config;return(hs(c)?new Promise((_,g)=>{self.setTimeout(()=>g(new Error("MediaKeySession.remove() timeout")),8e3),n.remove().then(_).catch(g)}):Promise.resolve()).catch(_=>{this.log(`Could not remove session: ${_}`),this.hls&&this.hls.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${_}`)})}).then(()=>n.close()).catch(_=>{this.log(`Could not close session: ${_}`),this.hls&&this.hls.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${_}`)})})}}}ia.CDMCleanupPromise=void 0;class Hs extends Error{constructor(t,n){super(n),this.data=void 0,t.error||(t.error=new Error(n)),this.data=t,t.err=t.error}}function Mc(h,t){const n=h==="output-restricted",s=n?Z.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:Z.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Hs({type:pe.KEY_SYSTEM_ERROR,details:s,fatal:!1,decryptdata:t},n?"HDCP level output restricted":`key status changed to "${h}"`)}class Ic{constructor(t){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=t,this.registerListeners()}setStreamController(t){this.streamController=t}registerListeners(){this.hls.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(S.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(S.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(t,n){const s=this.hls.config;if(s.capLevelOnFPSDrop){const o=n.media instanceof self.HTMLVideoElement?n.media:null;this.media=o,o&&typeof o.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),s.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(t,n,s){const o=performance.now();if(n){if(this.lastTime){const l=o-this.lastTime,c=s-this.lastDroppedFrames,d=n-this.lastDecodedFrames,_=1e3*c/l,g=this.hls;if(g.trigger(S.FPS_DROP,{currentDropped:c,currentDecoded:d,totalDroppedFrames:s}),_>0&&c>g.config.fpsDroppedMonitoringThreshold*d){let v=g.currentLevel;g.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+v),v>0&&(g.autoLevelCapping===-1||g.autoLevelCapping>=v)&&(v=v-1,g.trigger(S.FPS_DROP_LEVEL_CAPPING,{level:v,droppedLevel:g.currentLevel}),g.autoLevelCapping=v,this.streamController.nextLevelSwitch())}}this.lastTime=o,this.lastDroppedFrames=s,this.lastDecodedFrames=n}}checkFPSInterval(){const t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){const n=t.getVideoPlaybackQuality();this.checkFPS(t,n.totalVideoFrames,n.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)}}function Rc(h,t){let n;try{n=new Event("addtrack")}catch(s){n=document.createEvent("Event"),n.initEvent("addtrack",!1,!1)}n.track=h,t.dispatchEvent(n)}function hf(h,t){const n=h.mode;if(n==="disabled"&&(h.mode="hidden"),h.cues&&!h.cues.getCueById(t.id))try{if(h.addCue(t),!h.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(s){se.debug(`[texttrack-utils]: ${s}`);try{const o=new self.TextTrackCue(t.startTime,t.endTime,t.text);o.id=t.id,h.addCue(o)}catch(o){se.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${o}`)}}n==="disabled"&&(h.mode=n)}function qo(h,t){const n=h.mode;if(n==="disabled"&&(h.mode="hidden"),h.cues)for(let s=h.cues.length;s--;)t&&h.cues[s].removeEventListener("enter",t),h.removeCue(h.cues[s]);n==="disabled"&&(h.mode=n)}function Pc(h,t,n,s){const o=h.mode;if(o==="disabled"&&(h.mode="hidden"),h.cues&&h.cues.length>0){const l=wd(h.cues,t,n);for(let c=0;c<l.length;c++)(!s||s(l[c]))&&h.removeCue(l[c])}o==="disabled"&&(h.mode=o)}function xd(h,t){if(t<=h[0].startTime)return 0;const n=h.length-1;if(t>h[n].endTime)return-1;let s=0,o=n,l;for(;s<=o;)if(l=Math.floor((o+s)/2),t<h[l].startTime)o=l-1;else if(t>h[l].startTime&&s<n)s=l+1;else return l;return h[s].startTime-t<t-h[o].startTime?s:o}function wd(h,t,n){const s=[],o=xd(h,t);if(o>-1)for(let l=o,c=h.length;l<c;l++){const d=h[l];if(d.startTime>=t&&d.endTime<=n)s.push(d);else if(d.startTime>n)return s}return s}function Lu(h){const t=[];for(let n=0;n<h.length;n++){const s=h[n];(s.kind==="subtitles"||s.kind==="captions")&&s.label&&t.push(h[n])}return t}class Sd extends _c{constructor(t){super(t,"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 n=null;const s=Lu(this.media.textTracks);for(let l=0;l<s.length;l++)if(s[l].mode==="hidden")n=s[l];else if(s[l].mode==="showing"){n=s[l];break}const o=this.findTrackForTextTrack(n);this.subtitleTrack!==o&&this.setSubtitleTrack(o)},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(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:t}=this;t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(S.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVEL_LOADING,this.onLevelLoading,this),t.off(S.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(S.ERROR,this.onError,this)}onMediaAttached(t,n){this.media=n.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(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,t)}onMediaDetaching(t,n){const s=this.media;if(!s)return;const o=!!n.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||s.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,o)return;Lu(s.textTracks).forEach(c=>{qo(c)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(t,n){this.tracks=n.subtitleTracks}onSubtitleTrackLoaded(t,n){const{id:s,groupId:o,details:l}=n,c=this.tracksInGroup[s];if(!c||c.groupId!==o){this.warn(`Subtitle track with id:${s} and group:${o} not found in active group ${c==null?void 0:c.groupId}`);return}const d=c.details;c.details=n.details,this.log(`Subtitle track ${s} "${c.name}" lang:${c.lang} group:${o} loaded [${l.startSN}-${l.endSN}]`),s===this.trackId&&this.playlistLoaded(s,n,d)}onLevelLoading(t,n){this.switchLevel(n.level)}onLevelSwitching(t,n){this.switchLevel(n.level)}switchLevel(t){const n=this.hls.levels[t];if(!n)return;const s=n.subtitleGroups||null,o=this.groupIds;let l=this.currentTrack;if(!s||(o==null?void 0:o.length)!==(s==null?void 0:s.length)||s!=null&&s.some(c=>(o==null?void 0:o.indexOf(c))===-1)){this.groupIds=s,this.trackId=-1,this.currentTrack=null;const c=this.tracks.filter(v=>!s||s.indexOf(v.groupId)!==-1);if(c.length)this.selectDefaultTrack&&!c.some(v=>v.default)&&(this.selectDefaultTrack=!1),c.forEach((v,y)=>{v.id=y});else if(!l&&!this.tracksInGroup.length)return;this.tracksInGroup=c;const d=this.hls.config.subtitlePreference;if(!l&&d){this.selectDefaultTrack=!1;const v=nt(d,c);if(v>-1)l=c[v];else{const y=nt(d,this.tracks);l=this.tracks[y]}}let _=this.findTrackId(l);_===-1&&l&&(_=this.findTrackId(null));const g={subtitleTracks:c};this.log(`Updating subtitle tracks, ${c.length} track(s) found in "${s==null?void 0:s.join(",")}" group-id`),this.hls.trigger(S.SUBTITLE_TRACKS_UPDATED,g),_!==-1&&this.trackId===-1&&this.setSubtitleTrack(_)}}findTrackId(t){const n=this.tracksInGroup,s=this.selectDefaultTrack;for(let o=0;o<n.length;o++){const l=n[o];if(!(s&&!l.default||!s&&!t)&&(!t||At(l,t)))return o}if(t){for(let o=0;o<n.length;o++){const l=n[o];if(Dl(t.attrs,l.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return o}for(let o=0;o<n.length;o++){const l=n[o];if(Dl(t.attrs,l.attrs,["LANGUAGE"]))return o}}return-1}findTrackForTextTrack(t){if(t){const n=this.tracksInGroup;for(let s=0;s<n.length;s++){const o=n[s];if(Uo(o,t))return s}}return-1}onError(t,n){n.fatal||!n.context||n.context.type===Ae.SUBTITLE_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(t){this.selectDefaultTrack=!1,this.setSubtitleTrack(t)}setSubtitleOption(t){if(this.hls.config.subtitlePreference=t,t){if(t.id===-1)return this.setSubtitleTrack(-1),null;const n=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,n.length){const s=this.currentTrack;if(s&&At(t,s))return s;const o=nt(t,this.tracksInGroup);if(o>-1){const l=this.tracksInGroup[o];return this.setSubtitleTrack(o),l}else{if(s)return null;{const l=nt(t,n);if(l>-1)return n[l]}}}}return null}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,t)}loadingPlaylist(t,n){super.loadingPlaylist(t,n);const s=t.id,o=t.groupId,l=this.getUrlWithDirectives(t.url,n),c=t.details,d=c==null?void 0:c.age;this.log(`Loading subtitle ${s} "${t.name}" lang:${t.lang} group:${o}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${d&&c.live?" age "+d.toFixed(1)+(c.type?" "+c.type||0:""):""} ${l}`),this.hls.trigger(S.SUBTITLE_TRACK_LOADING,{url:l,id:s,groupId:o,deliveryDirectives:n||null,track:t})}toggleTrackModes(){const{media:t}=this;if(!t)return;const n=Lu(t.textTracks),s=this.currentTrack;let o;if(s&&(o=n.filter(l=>Uo(s,l))[0],o||this.warn(`Unable to find subtitle TextTrack with name "${s.name}" and language "${s.lang}"`)),[].slice.call(n).forEach(l=>{l.mode!=="disabled"&&l!==o&&(l.mode="disabled")}),o){const l=this.subtitleDisplay?"showing":"hidden";o.mode!==l&&(o.mode=l)}}setSubtitleTrack(t){const n=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=t;return}if(t<-1||t>=n.length||!le(t)){this.warn(`Invalid subtitle track id: ${t}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,o=n[t]||null;if(this.trackId=t,this.currentTrack=o,this.toggleTrackModes(),!o){this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:t});return}const l=!!o.details&&!o.details.live;if(t===this.trackId&&o===s&&l)return;this.log(`Switching to subtitle-track ${t}`+(o?` "${o.name}" lang:${o.lang} group:${o.groupId}`:""));const{id:c,groupId:d="",name:_,type:g,url:v}=o;this.hls.trigger(S.SUBTITLE_TRACK_SWITCH,{id:c,groupId:d,name:_,type:g,url:v});const y=this.switchParams(o.url,s==null?void 0:s.details,o.details);this.loadPlaylist(y)}}function Ed(){try{return crypto.randomUUID()}catch(h){try{const t=URL.createObjectURL(new Blob),n=t.toString();return URL.revokeObjectURL(t),n.slice(n.lastIndexOf("/")+1)}catch(t){let n=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,o=>{const l=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(o=="x"?l:l&3|8).toString(16)})}}}function Os(h){let t=5381,n=h.length;for(;n;)t=t*33^h.charCodeAt(--n);return(t>>>0).toString()}const Fs=.025;let ma=function(h){return h[h.Point=0]="Point",h[h.Range=1]="Range",h}({});function ga(h,t,n){return`${h.identifier}-${n+1}-${Os(t)}`}class _a{constructor(t,n){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=n,this.dateRange=t,this.setDateRange(t)}setDateRange(t){this.dateRange=t,this.resumeOffset=t.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=t.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=t.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=t.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var t;this.appendInPlaceStarted=!1,(t=this.assetListLoader)==null||t.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(t){var n;if(t>0&&t>=this.assetList.length)return!0;const s=this.playoutLimit;return t<=0||isNaN(s)?!1:s===0?!0:(((n=this.assetList[t])==null?void 0:n.startOffset)||0)>s}findAssetIndex(t){return this.assetList.indexOf(t)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const t=this.dateRange.startTime;if(this.snapOptions.out){const n=this.dateRange.tagAnchor;if(n)return na(t,n)}return t}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const t=this.dateRange.tagAnchor;if(t){const n=this.dateRange.startTime,s=na(n,t);return n-s<.1}return!1}get resumptionOffset(){const t=this.resumeOffset,n=le(t)?t:this.duration;return this.cumulativeDuration+n}get resumeTime(){const t=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const n=this.resumeAnchor;if(n)return na(t,n)}return t}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(t){if(this.appendInPlaceStarted){this.resetOnResume=!t;return}this.appendInPlaceDisabled=!t}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(t){this._timelineStart=t}get duration(){const t=this.playoutLimit;let n;return this._duration!==null?n=this._duration:this.dateRange.duration?n=this.dateRange.duration:n=this.dateRange.plannedDuration||0,!isNaN(t)&&t<n&&(n=t),n}set duration(t){this._duration=t}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?ma.Range:ma.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 Du(this)}}function na(h,t){return h-t.start<t.duration/2&&!(Math.abs(h-(t.start+t.duration))<Fs)?t.start:t.start+t.duration}function Il(h,t,n){const s=new self.URL(h,n);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",t),s}function Zo(h,t){for(;(n=h.assetList[++t])!=null&&n.error;)var n;return t}function Du(h){return`["${h.identifier}" ${h.cue.pre?"<pre>":h.cue.post?"<post>":""}${h.timelineStart.toFixed(2)}-${h.resumeTime.toFixed(2)}]`}function va(h){const t=h.timelineStart,n=h.duration||0;return`["${h.identifier}" ${t.toFixed(2)}-${(t+n).toFixed(2)}]`}class kd{constructor(t,n,s,o){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(S.PLAYOUT_LIMIT_REACHED,{})};const l=this.hls=new t(n);this.interstitial=s,this.assetItem=o;const c=()=>{this.hasDetails=!0};l.once(S.LEVEL_LOADED,c),l.once(S.AUDIO_TRACK_LOADED,c),l.once(S.SUBTITLE_TRACK_LOADED,c),l.on(S.MEDIA_ATTACHING,(d,{media:_})=>{this.removeMediaListeners(),this.mediaAttached=_,this.interstitial.playoutLimit&&(_.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&l.on(S.BUFFER_APPENDED,()=>{const v=this.bufferedEnd;this.reachedPlayout(v)&&(this._bufferedEosTime=v,l.trigger(S.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const t=this.hls;if(t)if(t.url)t.levels.length&&!t.started&&t.startLoad(-1,!0);else{let n=this.assetItem.uri;try{n=Il(n,t.config.primarySessionId||"").href}catch(s){}t.loadSource(n)}}bufferedInPlaceToEnd(t){var n;if(!this.appendInPlace)return!1;if((n=this.hls)!=null&&n.bufferedToEnd)return!0;if(!t)return!1;const s=Math.min(this._bufferedEosTime||1/0,this.duration),o=this.timelineOffset,l=mi.bufferInfo(t,o,0);return this.getAssetTime(l.end)>=s-.02}reachedPlayout(t){const s=this.interstitial.playoutLimit;return this.startOffset+t>=s}get destroyed(){var t;return!((t=this.hls)!=null&&t.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var t;return((t=this.hls)==null?void 0:t.media)||null}get bufferedEnd(){const t=this.media||this.mediaAttached;if(!t)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const n=mi.bufferInfo(t,t.currentTime,.001);return this.getAssetTime(n.end)}get currentTime(){const t=this.media||this.mediaAttached;return t?this.getAssetTime(t.currentTime):this._currentTime||0}get duration(){const t=this.assetItem.duration;if(!t)return 0;const n=this.interstitial.playoutLimit;if(n){const s=n-this.startOffset;if(s>0&&s<t)return s}return t}get remaining(){const t=this.duration;return t?Math.max(0,t-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var t;return((t=this.hls)==null?void 0:t.config.timelineOffset)||0}set timelineOffset(t){const n=this.timelineOffset;if(t!==n){const s=t-n;if(Math.abs(s)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=t}}}getAssetTime(t){const n=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,t-n),s)}removeMediaListeners(){const t=this.mediaAttached;t&&(this._currentTime=t.currentTime,this.bufferSnapShot(),t.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var t;(t=this.hls)!=null&&t.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(t){var n;this.loadSource(),(n=this.hls)==null||n.attachMedia(t)}detachMedia(){var t;this.removeMediaListeners(),this.mediaAttached=null,(t=this.hls)==null||t.detachMedia()}resumeBuffering(){var t;(t=this.hls)==null||t.resumeBuffering()}pauseBuffering(){var t;(t=this.hls)==null||t.pauseBuffering()}transferMedia(){var t;return this.bufferSnapShot(),((t=this.hls)==null?void 0:t.transferMedia())||null}resetDetails(){const t=this.hls;if(t&&this.hasDetails){t.stopLoad();const n=s=>delete s.details;t.levels.forEach(n),t.allAudioTracks.forEach(n),t.allSubtitleTracks.forEach(n),this.hasDetails=!1}}on(t,n,s){var o;(o=this.hls)==null||o.on(t,n)}once(t,n,s){var o;(o=this.hls)==null||o.once(t,n)}off(t,n,s){var o;(o=this.hls)==null||o.off(t,n)}toString(){var t;return`HlsAssetPlayer: ${va(this.assetItem)} ${(t=this.hls)==null?void 0:t.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Oc=.033;class ff extends H{constructor(t,n){super("interstitials-sched",n),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=t}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(t=>t.reset()),this.events=this.items=null}resetErrorsInRange(t,n){return this.events?this.events.reduce((s,o)=>t<=o.startOffset&&n>o.startOffset?(delete o.error,s+1):s,0):0}get duration(){const t=this.items;return t?t[t.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(t){return t&&this.eventMap[t]||null}hasEvent(t){return t in this.eventMap}findItemIndex(t,n){if(t.event)return this.findEventIndex(t.event.identifier);let s=-1;t.nextEvent?s=this.findEventIndex(t.nextEvent.identifier)-1:t.previousEvent&&(s=this.findEventIndex(t.previousEvent.identifier)+1);const o=this.items;if(o)for(o[s]||(n===void 0&&(n=t.start),s=this.findItemIndexAtTime(n));s>=0&&(l=o[s])!=null&&l.event;){var l;s--}return s}findItemIndexAtTime(t,n){const s=this.items;if(s)for(let o=0;o<s.length;o++){let l=s[o];if(n&&n!=="primary"&&(l=l[n]),t===l.start||t>l.start&&t<l.end)return o}return-1}findJumpRestrictedIndex(t,n){const s=this.items;if(s)for(let o=t;o<=n&&s[o];o++){const l=s[o].event;if(l!=null&&l.restrictions.jump&&!l.appendInPlace)return o}return-1}findEventIndex(t){const n=this.items;if(n)for(let o=n.length;o--;){var s;if(((s=n[o].event)==null?void 0:s.identifier)===t)return o}return-1}findAssetIndex(t,n){const s=t.assetList,o=s.length;if(o>1)for(let l=0;l<o;l++){const c=s[l];if(!c.error){const d=c.timelineStart;if(n===d||n>d&&(n<d+(c.duration||0)||l===o-1))return l}}return 0}get assetIdAtEnd(){var t;const n=(t=this.items)==null||(t=t[this.length-1])==null?void 0:t.event;if(n){const s=n.assetList,o=s[s.length-1];if(o)return o.identifier}return null}parseInterstitialDateRanges(t,n){const s=t.main.details,{dateRanges:o}=s,l=this.events,c=this.parseDateRanges(o,{url:s.url},n),d=Object.keys(o),_=l?l.filter(g=>!d.includes(g.identifier)):[];c.length&&c.sort((g,v)=>{const y=g.cue.pre,x=g.cue.post,L=v.cue.pre,M=v.cue.post;if(y&&!L)return-1;if(L&&!y||x&&!M)return 1;if(M&&!x)return-1;if(!y&&!L&&!x&&!M){const B=g.startTime,F=v.startTime;if(B!==F)return B-F}return g.dateRange.tagOrder-v.dateRange.tagOrder}),this.events=c,_.forEach(g=>{this.removeEvent(g)}),this.updateSchedule(t,_)}updateSchedule(t,n=[],s=!1){const o=this.events||[];if(o.length||n.length||this.length<2){const l=this.items,c=this.parseSchedule(o,t);(s||n.length||(l==null?void 0:l.length)!==c.length||c.some((_,g)=>Math.abs(_.playout.start-l[g].playout.start)>.005||Math.abs(_.playout.end-l[g].playout.end)>.005))&&(this.items=c,this.onScheduleUpdate(n,l))}}parseDateRanges(t,n,s){const o=[],l=Object.keys(t);for(let c=0;c<l.length;c++){const d=l[c],_=t[d];if(_.isInterstitial){let g=this.eventMap[d];g?g.setDateRange(_):(g=new _a(_,n),this.eventMap[d]=g,s===!1&&(g.appendInPlace=s)),o.push(g)}}return o}parseSchedule(t,n){const s=[],o=n.main.details,l=o.live?1/0:o.edge;let c=0;if(t=t.filter(_=>!_.error&&!(_.cue.once&&_.hasPlayed)),t.length){this.resolveOffsets(t,n);let _=0,g=0;if(t.forEach((v,y)=>{const x=v.cue.pre,L=v.cue.post,M=t[y-1]||null,B=v.appendInPlace,F=L?l:v.startOffset,W=v.duration,_e=v.timelineOccupancy===ma.Range?W:0,ce=v.resumptionOffset,Pe=(M==null?void 0:M.startTime)===F,Ue=F+v.cumulativeDuration;let dt=B?Ue+W:F+ce;if(x||!L&&F<=0){const Qe=g;g+=_e,v.timelineStart=Ue;const et=c;c+=W,s.push({event:v,start:Ue,end:dt,playout:{start:et,end:c},integrated:{start:Qe,end:g}})}else if(F<=l){if(!Pe){const Be=F-_;if(Be>Oc){const Tt=_,ti=g;g+=Be;const hi=c;c+=Be;const Ti={previousEvent:t[y-1]||null,nextEvent:v,start:Tt,end:Tt+Be,playout:{start:hi,end:c},integrated:{start:ti,end:g}};s.push(Ti)}else Be>0&&M&&(M.cumulativeDuration+=Be,s[s.length-1].end=F)}L&&(dt=Ue),v.timelineStart=Ue;const Qe=g;g+=_e;const et=c;c+=W,s.push({event:v,start:Ue,end:dt,playout:{start:et,end:c},integrated:{start:Qe,end:g}})}else return;const $e=v.resumeTime;L||$e>l?_=l:_=$e}),_<l){var d;const v=_,y=g,x=l-_;g+=x;const L=c;c+=x,s.push({previousEvent:((d=s[s.length-1])==null?void 0:d.event)||null,nextEvent:null,start:_,end:v+x,playout:{start:L,end:c},integrated:{start:y,end:g}})}this.setDurations(l,c,g)}else s.push({previousEvent:null,nextEvent:null,start:0,end:l,playout:{start:0,end:l},integrated:{start:0,end:l}}),this.setDurations(l,l,l);return s}setDurations(t,n,s){this.durations={primary:t,playout:n,integrated:s}}resolveOffsets(t,n){const s=n.main.details,o=s.live?1/0:s.edge;let l=0,c=-1;t.forEach((d,_)=>{const g=d.cue.pre,v=d.cue.post,y=g?0:v?o:d.startTime;this.updateAssetDurations(d),c===y?d.cumulativeDuration=l:(l=0,c=y),!v&&d.snapOptions.in&&(d.resumeAnchor=Ni(null,s.fragments,d.startOffset+d.resumptionOffset,0,0)||void 0),d.appendInPlace&&!d.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(d,n)||(d.appendInPlace=!1)),!d.appendInPlace&&_+1<t.length&&t[_+1].startTime-t[_].resumeTime<Oc&&(t[_+1].appendInPlace=!1,t[_+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${d}`));const L=le(d.resumeOffset)?d.resumeOffset:d.duration;l+=L})}primaryCanResumeInPlaceAt(t,n){const s=t.resumeTime,o=t.startTime+t.resumptionOffset;return Math.abs(s-o)>Fs?(this.log(`"${t.identifier}" resumption ${s} not aligned with estimated timeline end ${o}`),!1):!Object.keys(n).some(c=>{const d=n[c].details,_=d.edge;if(s>=_)return this.log(`"${t.identifier}" resumption ${s} past ${c} playlist end ${_}`),!1;const g=Ni(null,d.fragments,s);if(!g)return this.log(`"${t.identifier}" resumption ${s} does not align with any fragments in ${c} playlist (${d.fragStart}-${d.fragmentEnd})`),!0;const v=c==="audio"?.175:0;return Math.abs(g.start-s)<Fs+v||Math.abs(g.end-s)<Fs+v?!1:(this.log(`"${t.identifier}" resumption ${s} not aligned with ${c} fragment bounds (${g.start}-${g.end} sn: ${g.sn} cc: ${g.cc})`),!0)})}updateAssetDurations(t){if(!t.assetListLoaded)return;const n=t.timelineStart;let s=0,o=!1,l=!1;for(let c=0;c<t.assetList.length;c++){const d=t.assetList[c],_=n+s;d.startOffset=s,d.timelineStart=_,o||(o=d.duration===null),l||(l=!!d.error);const g=d.error?0:d.duration||0;s+=g}o&&!l?t.duration=Math.max(s,t.duration):t.duration=s}removeEvent(t){t.reset(),delete this.eventMap[t.identifier]}}function Bs(h){return`[${h.event?'"'+h.event.identifier+'"':"primary"}: ${h.start.toFixed(2)}-${h.end.toFixed(2)}]`}class Td{constructor(t){this.hls=void 0,this.hls=t}destroy(){this.hls=null}loadAssetList(t,n){const s=t.assetListUrl;let o;try{o=Il(s,this.hls.sessionId,t.baseUrl)}catch(x){const L=this.assignAssetListError(t,Z.ASSET_LIST_LOAD_ERROR,x,s);this.hls.trigger(S.ERROR,L);return}n&&o.protocol!=="data:"&&o.searchParams.set("_HLS_start_offset",""+n);const l=this.hls.config,c=l.loader,d=new c(l),_={responseType:"json",url:o.href},g=l.interstitialAssetListLoadPolicy.default,v={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(x,L,M,B)=>{const F=x.data,W=F==null?void 0:F.ASSETS;if(!Array.isArray(W)){const _e=this.assignAssetListError(t,Z.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),M.url,L,B);this.hls.trigger(S.ERROR,_e);return}t.assetListResponse=F,this.hls.trigger(S.ASSET_LIST_LOADED,{event:t,assetListResponse:F,networkDetails:B})},onError:(x,L,M,B)=>{const F=this.assignAssetListError(t,Z.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${x.code} ${x.text} (${L.url})`),L.url,B,M);this.hls.trigger(S.ERROR,F)},onTimeout:(x,L,M)=>{const B=this.assignAssetListError(t,Z.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${L.url})`),L.url,x,M);this.hls.trigger(S.ERROR,B)}};return d.load(_,v,y),this.hls.trigger(S.ASSET_LIST_LOADING,{event:t}),d}assignAssetListError(t,n,s,o,l,c){return t.error=s,{type:pe.NETWORK_ERROR,details:n,fatal:!1,interstitial:t,url:o,error:s,networkDetails:c,stats:l}}}function Fc(h){h==null||h.play().catch(()=>{})}function Cu(h,t){return`[${h}] Advancing timeline position to ${t}`}class Ad extends H{constructor(t,n){super("interstitials",t.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 s=this.currentTime;if(s===void 0||this.playbackDisabled||!this.schedule)return;const o=s-this.timelinePos;if(Math.abs(o)<1/7056e5)return;const c=o<=-.01;this.timelinePos=s,this.bufferedPos=s;const d=this.playingItem;if(!d){this.checkBuffer();return}if(c&&this.schedule.resetErrorsInRange(s,s-o)&&this.updateSchedule(!0),this.checkBuffer(),c&&s<d.start||s>=d.end){var _;const L=this.findItemIndex(d);let M=this.schedule.findItemIndexAtTime(s);if(M===-1&&(M=L+(c?-1:1),this.log(`seeked ${c?"back ":""}to position not covered by schedule ${s} (resolving from ${L} to ${M})`)),!this.isInterstitial(d)&&(_=this.media)!=null&&_.paused&&(this.shouldPlay=!1),!c&&M>L){const B=this.schedule.findJumpRestrictedIndex(L+1,M);if(B>L){this.setSchedulePosition(B);return}}this.setSchedulePosition(M);return}const g=this.playingAsset;if(!g){if(this.playingLastItem&&this.isInterstitial(d)){const L=d.event.assetList[0];L&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(s,L))}return}const v=g.timelineStart,y=g.duration||0;if(c&&s<v||s>=v+y){var x;(x=d.event)!=null&&x.appendInPlace&&(this.clearInterstitial(d.event,d),this.flushFrontBuffer(s)),this.setScheduleToAssetAtTime(s,g)}},this.onTimeupdate=()=>{const s=this.currentTime;if(s===void 0||this.playbackDisabled)return;if(s>this.timelinePos)this.timelinePos=s,s>this.bufferedPos&&this.checkBuffer();else return;const o=this.playingItem;if(!o||this.playingLastItem)return;if(s>=o.end){this.timelinePos=o.end;const d=this.findItemIndex(o);this.setSchedulePosition(d+1)}const l=this.playingAsset;if(!l)return;const c=l.timelineStart+(l.duration||0);s>=c&&this.setScheduleToAssetAtTime(s,l)},this.onScheduleUpdate=(s,o)=>{const l=this.schedule;if(!l)return;const c=this.playingItem,d=l.events||[],_=l.items||[],g=l.durations,v=s.map(B=>B.identifier),y=!!(d.length||v.length);(y||o)&&this.log(`INTERSTITIALS_UPDATED (${d.length}): ${d}
Schedule: ${_.map(B=>Bs(B))} pos: ${this.timelinePos}`),v.length&&this.log(`Removed events ${v}`);let x=null,L=null;c&&(x=this.updateItem(c,this.timelinePos),this.itemsMatch(c,x)?this.playingItem=x:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const M=this.bufferingItem;if(M&&(L=this.updateItem(M,this.bufferedPos),this.itemsMatch(M,L)?this.bufferingItem=L:M.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(M.event,null))),s.forEach(B=>{B.assetList.forEach(F=>{this.clearAssetPlayer(F.identifier,null)})}),this.playerQueue.forEach(B=>{if(B.interstitial.appendInPlace){const F=B.assetItem.timelineStart,W=B.timelineOffset-F;if(W)try{B.timelineOffset=F}catch(_e){Math.abs(W)>Fs&&this.warn(`${_e} ("${B.assetId}" ${B.timelineOffset}->${F})`)}}}),y||o){if(this.hls.trigger(S.INTERSTITIALS_UPDATED,{events:d.slice(0),schedule:_.slice(0),durations:g,removedIds:v}),this.isInterstitial(c)&&v.includes(c.event.identifier)){this.warn(`Interstitial "${c.event.identifier}" removed while playing`),this.primaryFallback(c.event);return}c&&this.trimInPlace(x,c),M&&L!==x&&this.trimInPlace(L,M),this.checkBuffer()}},this.hls=t,this.HlsPlayerClass=n,this.assetListLoader=new Td(t),this.schedule=new ff(this.onScheduleUpdate,t.logger),this.registerListeners()}registerListeners(){const t=this.hls;t&&(t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.on(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.on(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.on(S.BUFFER_APPENDED,this.onBufferAppended,this),t.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(S.BUFFERED_TO_END,this.onBufferedToEnd,this),t.on(S.MEDIA_ENDED,this.onMediaEnded,this),t.on(S.ERROR,this.onError,this),t.on(S.DESTROYING,this.onDestroying,this))}unregisterListeners(){const t=this.hls;t&&(t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(S.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),t.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(S.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),t.off(S.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),t.off(S.ASSET_LIST_LOADED,this.onAssetListLoaded,this),t.off(S.BUFFER_CODECS,this.onBufferCodecs,this),t.off(S.BUFFER_APPENDED,this.onBufferAppended,this),t.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(S.BUFFERED_TO_END,this.onBufferedToEnd,this),t.off(S.MEDIA_ENDED,this.onMediaEnded,this),t.off(S.ERROR,this.onError,this),t.off(S.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var t;(t=this.getBufferingPlayer())==null||t.resumeBuffering()}pauseBuffering(){var t;(t=this.getBufferingPlayer())==null||t.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 t=this.primaryMedia||this.media;t&&this.removeMediaListeners(t)}removeMediaListeners(t){Cr(t,"play",this.onPlay),Cr(t,"pause",this.onPause),Cr(t,"seeking",this.onSeeking),Cr(t,"timeupdate",this.onTimeupdate)}onMediaAttaching(t,n){const s=this.media=n.media;br(s,"seeking",this.onSeeking),br(s,"timeupdate",this.onTimeupdate),br(s,"play",this.onPlay),br(s,"pause",this.onPause)}onMediaAttached(t,n){const s=this.effectivePlayingItem,o=this.detachedData;if(this.detachedData=null,s===null)this.checkStart();else if(!o){this.clearScheduleState();const l=this.findItemIndex(s);this.setSchedulePosition(l)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(t,n){const s=!!n.transferMedia,o=this.media;if(this.media=null,!s&&(o&&this.removeMediaListeners(o),this.detachedData)){const l=this.getBufferingPlayer();l&&(this.log(`Removing schedule state for detachedData and ${l}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,l.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const t=this,n=()=>t.bufferingItem||t.waitingItem,s=y=>y&&t.getAssetPlayer(y.identifier),o=(y,x,L,M,B)=>{if(y){let F=y[x].start;const W=y.event;if(W){if(x==="playout"||W.timelineOccupancy!==ma.Point){const _e=s(L);(_e==null?void 0:_e.interstitial)===W&&(F+=_e.assetItem.startOffset+_e[B])}}else{const _e=M==="bufferedPos"?c():t[M];F+=_e-y.start}return F}return 0},l=(y,x)=>{var L;if(y!==0&&x!=="primary"&&(L=t.schedule)!=null&&L.length){var M;const B=t.schedule.findItemIndexAtTime(y),F=(M=t.schedule.items)==null?void 0:M[B];if(F){const W=F[x].start-F.start;return y+W}}return y},c=()=>{const y=t.bufferedPos;return y===Number.MAX_VALUE?d("primary"):Math.max(y,0)},d=y=>{var x,L;return(x=t.primaryDetails)!=null&&x.live?t.primaryDetails.edge:((L=t.schedule)==null?void 0:L.durations[y])||0},_=(y,x)=>{var L,M;const B=t.effectivePlayingItem;if(B!=null&&(L=B.event)!=null&&L.restrictions.skip||!t.schedule)return;t.log(`seek to ${y} "${x}"`);const F=t.effectivePlayingItem,W=t.schedule.findItemIndexAtTime(y,x),_e=(M=t.schedule.items)==null?void 0:M[W],ce=t.getBufferingPlayer(),Pe=ce==null?void 0:ce.interstitial,Ue=Pe==null?void 0:Pe.appendInPlace,dt=F&&t.itemsMatch(F,_e);if(F&&(Ue||dt)){const $e=s(t.playingAsset),Qe=($e==null?void 0:$e.media)||t.primaryMedia;if(Qe){const et=x==="primary"?Qe.currentTime:o(F,x,t.playingAsset,"timelinePos","currentTime"),Be=y-et,Tt=(Ue?et:Qe.currentTime)+Be;if(Tt>=0&&(!$e||Ue||Tt<=$e.duration)){Qe.currentTime=Tt;return}}}if(_e){let $e=y;if(x!=="primary"){const et=_e[x].start,Be=y-et;$e=_e.start+Be}const Qe=!t.isInterstitial(_e);if((!t.isInterstitial(F)||F.event.appendInPlace)&&(Qe||_e.event.appendInPlace)){const et=t.media||(Ue?ce==null?void 0:ce.media:null);et&&(et.currentTime=$e)}else if(F){const et=t.findItemIndex(F);if(W>et){const Tt=t.schedule.findJumpRestrictedIndex(et+1,W);if(Tt>et){t.setSchedulePosition(Tt);return}}let Be=0;if(Qe)t.timelinePos=$e,t.checkBuffer();else{const Tt=_e.event.assetList,ti=y-(_e[x]||_e).start;for(let hi=Tt.length;hi--;){const Ti=Tt[hi];if(Ti.duration&&ti>=Ti.startOffset&&ti<Ti.startOffset+Ti.duration){Be=hi;break}}}t.setSchedulePosition(W,Be)}}},g=()=>{const y=t.effectivePlayingItem;if(t.isInterstitial(y))return y;const x=n();return t.isInterstitial(x)?x:null},v={get bufferedEnd(){const y=n(),x=t.bufferingItem;if(x&&x===y){var L;return o(x,"playout",t.bufferingAsset,"bufferedPos","bufferedEnd")-x.playout.start||((L=t.bufferingAsset)==null?void 0:L.startOffset)||0}return 0},get currentTime(){const y=g(),x=t.effectivePlayingItem;return x&&x===y?o(x,"playout",t.effectivePlayingAsset,"timelinePos","currentTime")-x.playout.start:0},set currentTime(y){const x=g(),L=t.effectivePlayingItem;L&&L===x&&_(y+L.playout.start,"playout")},get duration(){const y=g();return y?y.playout.end-y.playout.start:0},get assetPlayers(){var y;const x=(y=g())==null?void 0:y.event.assetList;return x?x.map(L=>t.getAssetPlayer(L.identifier)):[]},get playingIndex(){var y;const x=(y=g())==null?void 0:y.event;return x&&t.effectivePlayingAsset?x.findAssetIndex(t.effectivePlayingAsset):-1},get scheduleItem(){return g()}};return this.manager={get events(){var y;return((y=t.schedule)==null||(y=y.events)==null?void 0:y.slice(0))||[]},get schedule(){var y;return((y=t.schedule)==null||(y=y.items)==null?void 0:y.slice(0))||[]},get interstitialPlayer(){return g()?v:null},get playerQueue(){return t.playerQueue.slice(0)},get bufferingAsset(){return t.bufferingAsset},get bufferingItem(){return n()},get bufferingIndex(){const y=n();return t.findItemIndex(y)},get playingAsset(){return t.effectivePlayingAsset},get playingItem(){return t.effectivePlayingItem},get playingIndex(){const y=t.effectivePlayingItem;return t.findItemIndex(y)},primary:{get bufferedEnd(){return c()},get currentTime(){const y=t.timelinePos;return y>0?y:0},set currentTime(y){_(y,"primary")},get duration(){return d("primary")},get seekableStart(){var y;return((y=t.primaryDetails)==null?void 0:y.fragmentStart)||0}},integrated:{get bufferedEnd(){return o(n(),"integrated",t.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return o(t.effectivePlayingItem,"integrated",t.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(y){_(y,"integrated")},get duration(){return d("integrated")},get seekableStart(){var y;return l(((y=t.primaryDetails)==null?void 0:y.fragmentStart)||0,"integrated")}},skip:()=>{const y=t.effectivePlayingItem,x=y==null?void 0:y.event;if(x&&!x.restrictions.skip){const L=t.findItemIndex(y);if(x.appendInPlace){const M=y.playout.start+y.event.duration;_(M+.001,"playout")}else t.advanceAfterAssetEnded(x,L,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var t;const n=this.playingItem,s=(t=this.schedule)==null?void 0:t.items;return!this.playbackStarted||!n||!s?!1:this.findItemIndex(n)===s.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var t,n;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let o=this.media;!o&&(t=this.bufferingItem)!=null&&(t=t.event)!=null&&t.appendInPlace&&(o=this.primaryMedia);const l=(n=o)==null?void 0:n.currentTime;if(!(l===void 0||!le(l)))return l}get primaryMedia(){var t;return this.media||((t=this.detachedData)==null?void 0:t.media)||null}isInterstitial(t){return!!(t!=null&&t.event)}retreiveMediaSource(t,n){const s=this.getAssetPlayer(t);s&&this.transferMediaFromPlayer(s,n)}transferMediaFromPlayer(t,n){const s=t.interstitial.appendInPlace,o=t.media;if(s&&o===this.primaryMedia){if(this.bufferingAsset=null,(!n||this.isInterstitial(n)&&!n.event.appendInPlace)&&n&&o){this.detachedData={media:o};return}const l=t.transferMedia();this.log(`transfer MediaSource from ${t} ${Qi(l)}`),this.detachedData=l}else n&&o&&(this.shouldPlay||(this.shouldPlay=!o.paused))}transferMediaTo(t,n){var s,o;if(t.media===n)return;let l=null;const c=this.hls,d=t!==c,_=d&&t.interstitial.appendInPlace,g=(s=this.detachedData)==null?void 0:s.mediaSource;let v;if(c.media)_&&(l=c.transferMedia(),this.detachedData=l),v="Primary";else if(g){const M=this.getBufferingPlayer();M?(l=M.transferMedia(),v=`${M}`):v="detached MediaSource"}else v="detached media";if(!l){if(g)l=this.detachedData,this.log(`using detachedData: MediaSource ${Qi(l)}`);else if(!this.detachedData||c.media===n){const M=this.playerQueue;M.length>1&&M.forEach(B=>{if(d&&B.interstitial.appendInPlace!==_){const F=B.interstitial;this.clearInterstitial(B.interstitial,null),F.appendInPlace=!1,F.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${F}`)}}),this.hls.detachMedia(),this.detachedData={media:n}}}const y=l&&"mediaSource"in l&&((o=l.mediaSource)==null?void 0:o.readyState)!=="closed",x=y&&l?l:n;this.log(`${y?"transfering MediaSource":"attaching media"} to ${d?t:"Primary"} from ${v} (media.currentTime: ${n.currentTime})`);const L=this.schedule;if(x===l&&L){const M=d&&t.assetId===L.assetIdAtEnd;x.overrides={duration:L.duration,endOfStream:!d||M,cueRemoval:!d}}t.attachMedia(x)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const t=this.schedule,n=t==null?void 0:t.events;if(!n||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,o=this.effectivePlayingItem;if(s===-1){const l=this.hls.startPosition;if(this.log(Cu("checkStart",l)),this.timelinePos=l,n.length&&n[0].cue.pre){const c=t.findEventIndex(n[0].identifier);this.setSchedulePosition(c)}else if(l>=0||!this.primaryLive){const c=this.timelinePos=l>0?l:0,d=t.findItemIndexAtTime(c);this.setSchedulePosition(d)}}else if(o&&!this.playingItem){const l=t.findItemIndex(o);this.setSchedulePosition(l)}}advanceAssetBuffering(t,n){const s=t.event,o=s.findAssetIndex(n),l=Zo(s,o);if(!s.isAssetPastPlayoutLimit(l))this.bufferedToEvent(t,l);else if(this.schedule){var c;const d=(c=this.schedule.items)==null?void 0:c[this.findItemIndex(t)+1];d&&this.bufferedToItem(d)}}advanceAfterAssetEnded(t,n,s){const o=Zo(t,s);if(t.isAssetPastPlayoutLimit(o)){if(this.schedule){const l=this.schedule.items;if(l){const c=n+1,d=l.length;if(c>=d){this.setSchedulePosition(-1);return}const _=t.resumeTime;this.timelinePos<_&&(this.log(Cu("advanceAfterAssetEnded",_)),this.timelinePos=_,t.appendInPlace&&this.advanceInPlace(_),this.checkBuffer(this.bufferedPos<_)),this.setSchedulePosition(c)}}}else{if(t.appendInPlace){const l=t.assetList[o];l&&this.advanceInPlace(l.timelineStart)}this.setSchedulePosition(n,o)}}setScheduleToAssetAtTime(t,n){const s=this.schedule;if(!s)return;const o=n.parentIdentifier,l=s.getEvent(o);if(l){const c=s.findEventIndex(o),d=s.findAssetIndex(l,t);this.advanceAfterAssetEnded(l,c,d-1)}}setSchedulePosition(t,n){var s;const o=(s=this.schedule)==null?void 0:s.items;if(!o||this.playbackDisabled)return;const l=t>=0?o[t]:null;this.log(`setSchedulePosition ${t}, ${n} (${l&&Bs(l)}) pos: ${this.timelinePos}`);const c=this.waitingItem||this.playingItem,d=this.playingLastItem;if(this.isInterstitial(c)){const v=c.event,y=this.playingAsset,x=y==null?void 0:y.identifier,L=x?this.getAssetPlayer(x):null;if(L&&x&&(!this.eventItemsMatch(c,l)||n!==void 0&&x!==v.assetList[n].identifier)){var _;const M=v.findAssetIndex(y);if(this.log(`INTERSTITIAL_ASSET_ENDED ${M+1}/${v.assetList.length} ${va(y)}`),this.endedAsset=y,this.playingAsset=null,this.hls.trigger(S.INTERSTITIAL_ASSET_ENDED,{asset:y,assetListIndex:M,event:v,schedule:o.slice(0),scheduleIndex:t,player:L}),c!==this.playingItem){this.itemsMatch(c,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(v,this.findItemIndex(this.playingItem),M);return}this.retreiveMediaSource(x,l),L.media&&!((_=this.detachedData)!=null&&_.mediaSource)&&L.detachMedia()}if(!this.eventItemsMatch(c,l)&&(this.endedItem=c,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${v} ${Bs(c)}`),v.hasPlayed=!0,this.hls.trigger(S.INTERSTITIAL_ENDED,{event:v,schedule:o.slice(0),scheduleIndex:t}),v.cue.once)){var g;this.updateSchedule();const M=(g=this.schedule)==null?void 0:g.items;if(l&&M){const B=this.findItemIndex(l);this.advanceSchedule(B,M,n,c,d)}return}}this.advanceSchedule(t,o,n,c,d)}advanceSchedule(t,n,s,o,l){const c=this.schedule;if(!c)return;const d=n[t]||null,_=this.primaryMedia,g=this.playerQueue;if(g.length&&g.forEach(v=>{const y=v.interstitial,x=c.findEventIndex(y.identifier);(x<t||x>t+1)&&this.clearInterstitial(y,d)}),this.isInterstitial(d)){this.timelinePos=Math.min(Math.max(this.timelinePos,d.start),d.end);const v=d.event;if(s===void 0){s=c.findAssetIndex(v,this.timelinePos);const M=Zo(v,s-1);if(v.isAssetPastPlayoutLimit(M)||v.appendInPlace&&this.timelinePos===d.end){this.advanceAfterAssetEnded(v,t,s);return}s=M}const y=this.waitingItem;this.assetsBuffered(d,_)||this.setBufferingItem(d);let x=this.preloadAssets(v,s);if(this.eventItemsMatch(d,y||o)||(this.waitingItem=d,this.log(`INTERSTITIAL_STARTED ${Bs(d)} ${v.appendInPlace?"append in place":""}`),this.hls.trigger(S.INTERSTITIAL_STARTED,{event:v,schedule:n.slice(0),scheduleIndex:t})),!v.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${v}`);return}if(v.assetListLoader&&(v.assetListLoader.destroy(),v.assetListLoader=void 0),!_){this.log(`Waiting for attachMedia to start Interstitial ${v}`);return}this.waitingItem=this.endedItem=null,this.playingItem=d;const L=v.assetList[s];if(!L){this.advanceAfterAssetEnded(v,t,s||0);return}if(x||(x=this.getAssetPlayer(L.identifier)),x===null||x.destroyed){const M=v.assetList.length;this.warn(`asset ${s+1}/${M} player destroyed ${v}`),x=this.createAssetPlayer(v,L,s),x.loadSource()}if(!this.eventItemsMatch(d,this.bufferingItem)&&v.appendInPlace&&this.isAssetBuffered(L))return;this.startAssetPlayer(x,s,n,t,_),this.shouldPlay&&Fc(x.media)}else d?(this.resumePrimary(d,t,o),this.shouldPlay&&Fc(this.hls.media)):l&&this.isInterstitial(o)&&(this.endedItem=null,this.playingItem=o,o.event.appendInPlace||this.attachPrimary(c.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var t;return(t=this.mediaSelection)==null?void 0:t.main.details}get primaryLive(){var t;return!!((t=this.primaryDetails)!=null&&t.live)}resumePrimary(t,n,s){var o,l;if(this.playingItem=t,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(t),this.log(`resuming ${Bs(t)}`),!((o=this.detachedData)!=null&&o.mediaSource)){let d=this.timelinePos;(d<t.start||d>=t.end)&&(d=this.getPrimaryResumption(t,n),this.log(Cu("resumePrimary",d)),this.timelinePos=d),this.attachPrimary(d,t)}if(!s)return;const c=(l=this.schedule)==null?void 0:l.items;c&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Bs(t)}`),this.hls.trigger(S.INTERSTITIALS_PRIMARY_RESUMED,{schedule:c.slice(0),scheduleIndex:n}),this.checkBuffer())}getPrimaryResumption(t,n){const s=t.start;if(this.primaryLive){const o=this.primaryDetails;if(n===0)return this.hls.startPosition;if(o&&(s<o.fragmentStart||s>o.edge))return this.hls.liveSyncPosition||-1}return s}isAssetBuffered(t){const n=this.getAssetPlayer(t.identifier);return n!=null&&n.hls?n.hls.bufferedToEnd:mi.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=t.timelineStart+(t.duration||0)}attachPrimary(t,n,s){n?this.setBufferingItem(n):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const o=this.primaryMedia;if(!o)return;const l=this.hls;l.media?this.checkBuffer():(this.transferMediaTo(l,o),s&&this.startLoadingPrimaryAt(t,s)),s||(this.log(Cu("attachPrimary",t)),this.timelinePos=t,this.startLoadingPrimaryAt(t,s))}startLoadingPrimaryAt(t,n){var s;const o=this.hls;!o.loadingEnabled||!o.media||Math.abs((((s=o.mainForwardBufferInfo)==null?void 0:s.start)||o.media.currentTime)-t)>.5?o.startLoad(t,n):o.bufferingEnabled||o.resumeBuffering()}onManifestLoading(){var t;this.stopLoad(),(t=this.schedule)==null||t.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(S.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(S.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(t,n){if(n.level===-1||!this.schedule)return;const s=this.hls.levels[n.level],o=C(C({},this.mediaSelection||this.altSelection),{},{main:s});this.mediaSelection=o,this.schedule.parseInterstitialDateRanges(o,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(t,n){const s=this.hls.audioTracks[n.id],o=this.mediaSelection;if(!o){this.altSelection=C(C({},this.altSelection),{},{audio:s});return}const l=C(C({},o),{},{audio:s});this.mediaSelection=l}onSubtitleTrackUpdated(t,n){const s=this.hls.subtitleTracks[n.id],o=this.mediaSelection;if(!o){this.altSelection=C(C({},this.altSelection),{},{subtitles:s});return}const l=C(C({},o),{},{subtitles:s});this.mediaSelection=l}onAudioTrackSwitching(t,n){const s=xt(n);this.playerQueue.forEach(({hls:o})=>o&&(o.setAudioOption(n)||o.setAudioOption(s)))}onSubtitleTrackSwitch(t,n){const s=xt(n);this.playerQueue.forEach(({hls:o})=>o&&(o.setSubtitleOption(n)||n.id!==-1&&o.setSubtitleOption(s)))}onBufferCodecs(t,n){const s=n.tracks;s&&(this.requiredTracks=s)}onBufferAppended(t,n){this.checkBuffer()}onBufferFlushed(t,n){const s=this.playingItem;if(s&&!this.itemsMatch(s,this.bufferingItem)&&!this.isInterstitial(s)){const o=this.timelinePos;this.bufferedPos=o,this.checkBuffer()}}onBufferedToEnd(t){if(!this.schedule)return;const n=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&n){for(let o=0;o<n.length;o++){const l=n[o];if(l.cue.post){var s;const c=this.schedule.findEventIndex(l.identifier),d=(s=this.schedule.items)==null?void 0:s[c];this.isInterstitial(d)&&this.eventItemsMatch(d,this.bufferingItem)&&this.bufferedToItem(d,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(t){const n=this.playingItem;if(!this.playingLastItem&&n){const s=this.findItemIndex(n);this.setSchedulePosition(s+1)}else this.shouldPlay=!1}updateItem(t,n){var s;const o=(s=this.schedule)==null?void 0:s.items;if(t&&o){const l=this.findItemIndex(t,n);return o[l]||null}return null}trimInPlace(t,n){if(this.isInterstitial(t)&&t.event.appendInPlace&&n.end-t.end>.25){t.event.assetList.forEach((l,c)=>{t.event.isAssetPastPlayoutLimit(c)&&this.clearAssetPlayer(l.identifier,null)});const s=t.end+.25,o=mi.bufferInfo(this.primaryMedia,s,0);(o.end>s||(o.nextStart||0)>s)&&(this.log(`trim buffered interstitial ${Bs(t)} (was ${Bs(n)})`),this.attachPrimary(s,null,!0),this.flushFrontBuffer(s))}}itemsMatch(t,n){return!!n&&(t===n||t.event&&n.event&&this.eventItemsMatch(t,n)||!t.event&&!n.event&&this.findItemIndex(t)===this.findItemIndex(n))}eventItemsMatch(t,n){var s;return!!n&&(t===n||t.event.identifier===((s=n.event)==null?void 0:s.identifier))}findItemIndex(t,n){return t&&this.schedule?this.schedule.findItemIndex(t,n):-1}updateSchedule(t=!1){var n;const s=this.mediaSelection;s&&((n=this.schedule)==null||n.updateSchedule(s,[],t))}checkBuffer(t){var n;const s=(n=this.schedule)==null?void 0:n.items;if(!s)return;const o=mi.bufferInfo(this.primaryMedia,this.timelinePos,0);t&&(this.bufferedPos=this.timelinePos),t||(t=o.len<1),this.updateBufferedPos(o.end,s,t)}updateBufferedPos(t,n,s){const o=this.schedule,l=this.bufferingItem;if(this.bufferedPos>t||!o)return;if(n.length===1&&this.itemsMatch(n[0],l)){this.bufferedPos=t;return}const c=this.playingItem,d=this.findItemIndex(c);let _=o.findItemIndexAtTime(t);if(this.bufferedPos<t){var g;const v=this.findItemIndex(l),y=Math.min(v+1,n.length-1),x=n[y];if((_===-1&&l&&t>=l.end||(g=x.event)!=null&&g.appendInPlace&&t+.01>=x.start)&&(_=y),this.isInterstitial(l)){const L=l.event;if(y-d>1&&L.appendInPlace===!1||L.assetList.length===0&&L.assetListLoader)return}if(this.bufferedPos=t,_>v&&_>d)this.bufferedToItem(x);else{const L=this.primaryDetails;this.primaryLive&&L&&t>L.edge-L.targetduration&&x.start<L.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(x)&&this.preloadAssets(x.event,0)}}else s&&c&&!this.itemsMatch(c,l)&&(_===d?this.bufferedToItem(c):_===d+1&&this.bufferedToItem(n[_]))}assetsBuffered(t,n){return t.event.assetList.length===0?!1:!t.event.assetList.some(o=>{const l=this.getAssetPlayer(o.identifier);return!(l!=null&&l.bufferedInPlaceToEnd(n))})}setBufferingItem(t){const n=this.bufferingItem,s=this.schedule;if(!this.itemsMatch(t,n)&&s){const{items:o,events:l}=s;if(!o||!l)return n;const c=this.isInterstitial(t),d=this.getBufferingPlayer();this.bufferingItem=t,this.bufferedPos=Math.max(t.start,Math.min(t.end,this.timelinePos));const _=d?d.remaining:n?n.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Bs(t)}`+(n?` (${_.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(c){const g=s.findAssetIndex(t.event,this.bufferedPos);t.event.assetList.forEach((v,y)=>{const x=this.getAssetPlayer(v.identifier);x&&(y===g&&x.loadSource(),x.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(g=>g.pauseBuffering());this.hls.trigger(S.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:l.slice(0),schedule:o.slice(0),bufferingIndex:this.findItemIndex(t),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==t&&(this.bufferingItem=t);return n}bufferedToItem(t,n=0){const s=this.setBufferingItem(t);if(!this.playbackDisabled){if(this.isInterstitial(t))this.bufferedToEvent(t,n);else if(s!==null){this.bufferingAsset=null;const o=this.detachedData;o?o.mediaSource?this.attachPrimary(t.start,t,!0):this.preloadPrimary(t):this.preloadPrimary(t)}}}preloadPrimary(t){const n=this.findItemIndex(t),s=this.getPrimaryResumption(t,n);this.startLoadingPrimaryAt(s)}bufferedToEvent(t,n){const s=t.event,o=s.assetList.length===0&&!s.assetListLoader,l=s.cue.once;if(o||!l){const c=this.preloadAssets(s,n);if(c!=null&&c.interstitial.appendInPlace){const d=this.primaryMedia;d&&this.bufferAssetPlayer(c,d)}}}preloadAssets(t,n){const s=t.assetUrl,o=t.assetList.length,l=o===0&&!t.assetListLoader,c=t.cue.once;if(l){const _=t.timelineStart;if(t.appendInPlace){var d;const x=this.playingItem;!this.isInterstitial(x)&&(x==null||(d=x.nextEvent)==null?void 0:d.identifier)===t.identifier&&this.flushFrontBuffer(_+.25)}let g,v=0;if(!this.playingItem&&this.primaryLive&&(v=this.hls.startPosition,v===-1&&(v=this.hls.liveSyncPosition||0)),v&&!(t.cue.pre||t.cue.post)){const x=v-_;x>0&&(g=Math.round(x*1e3)/1e3)}if(this.log(`Load interstitial asset ${n+1}/${s?1:o} ${t}${g?` live-start: ${v} start-offset: ${g}`:""}`),s)return this.createAsset(t,0,0,_,t.duration,s);const y=this.assetListLoader.loadAssetList(t,g);y&&(t.assetListLoader=y)}else if(!c&&o){for(let g=n;g<o;g++){const v=t.assetList[g],y=this.getAssetPlayerQueueIndex(v.identifier);(y===-1||this.playerQueue[y].destroyed)&&!v.error&&this.createAssetPlayer(t,v,g)}const _=t.assetList[n];if(_){const g=this.getAssetPlayer(_.identifier);return g&&g.loadSource(),g}}return null}flushFrontBuffer(t){const n=this.requiredTracks;if(!n)return;this.log(`Removing front buffer starting at ${t}`),Object.keys(n).forEach(o=>{this.hls.trigger(S.BUFFER_FLUSHING,{startOffset:t,endOffset:1/0,type:o})})}getAssetPlayerQueueIndex(t){const n=this.playerQueue;for(let s=0;s<n.length;s++)if(t===n[s].assetId)return s;return-1}getAssetPlayer(t){const n=this.getAssetPlayerQueueIndex(t);return this.playerQueue[n]||null}getBufferingPlayer(){const{playerQueue:t,primaryMedia:n}=this;if(n){for(let s=0;s<t.length;s++)if(t[s].media===n)return t[s]}return null}createAsset(t,n,s,o,l,c){const d={parentIdentifier:t.identifier,identifier:ga(t,c,n),duration:l,startOffset:s,timelineStart:o,uri:c};return this.createAssetPlayer(t,d,n)}createAssetPlayer(t,n,s){const o=this.hls,l=o.userConfig;let c=l.videoPreference;const d=o.loadLevelObj||o.levels[o.currentLevel];(c||d)&&(c=k({},c),d.videoCodec&&(c.videoCodec=d.videoCodec),d.videoRange&&(c.allowedVideoRanges=[d.videoRange]));const _=o.audioTracks[o.audioTrack],g=o.subtitleTracks[o.subtitleTrack];let v=0;if(this.primaryLive||t.appendInPlace){const Pe=this.timelinePos-n.timelineStart;if(Pe>1){const Ue=n.duration;Ue&&Pe<Ue&&(v=Pe)}}const y=n.identifier,x=C(C({},l),{},{maxMaxBufferLength:Math.min(180,o.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:o.sessionId,assetPlayerId:y,abrEwmaDefaultEstimate:o.bandwidthEstimate,interstitialsController:void 0,startPosition:v,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:c,audioPreference:_||l.audioPreference,subtitlePreference:g||l.subtitlePreference});t.appendInPlace&&(t.appendInPlaceStarted=!0,n.timelineStart&&(x.timelineOffset=n.timelineStart));const L=x.cmcd;L!=null&&L.sessionId&&L.contentId&&(x.cmcd=k({},L,{contentId:Os(n.uri)})),this.getAssetPlayer(y)&&this.warn(`Duplicate date range identifier ${t} and asset ${y}`);const M=new kd(this.HlsPlayerClass,x,t,n);this.playerQueue.push(M),t.assetList[s]=n;let B=!0;const F=Pe=>{if(Pe.live){var Ue;const Qe=new Error(`Interstitials MUST be VOD assets ${t}`),et={fatal:!0,type:pe.OTHER_ERROR,details:Z.INTERSTITIAL_ASSET_ITEM_ERROR,error:Qe},Be=((Ue=this.schedule)==null?void 0:Ue.findEventIndex(t.identifier))||-1;this.handleAssetItemError(et,t,Be,s,Qe.message);return}const dt=Pe.edge-Pe.fragmentStart,$e=n.duration;(B||$e===null||dt>$e)&&(B=!1,this.log(`Interstitial asset "${y}" duration change ${$e} > ${dt}`),n.duration=dt,this.updateSchedule())};M.on(S.LEVEL_UPDATED,(Pe,{details:Ue})=>F(Ue)),M.on(S.LEVEL_PTS_UPDATED,(Pe,{details:Ue})=>F(Ue)),M.on(S.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const W=(Pe,Ue)=>{const dt=this.getAssetPlayer(y);if(dt&&Ue.tracks){dt.off(S.BUFFER_CODECS,W),dt.tracks=Ue.tracks;const $e=this.primaryMedia;this.bufferingAsset===dt.assetItem&&$e&&!dt.media&&this.bufferAssetPlayer(dt,$e)}};M.on(S.BUFFER_CODECS,W);const _e=()=>{var Pe;const Ue=this.getAssetPlayer(y);if(this.log(`buffered to end of asset ${Ue}`),!Ue||!this.schedule)return;const dt=this.schedule.findEventIndex(t.identifier),$e=(Pe=this.schedule.items)==null?void 0:Pe[dt];this.isInterstitial($e)&&this.advanceAssetBuffering($e,n)};M.on(S.BUFFERED_TO_END,_e);const ce=Pe=>()=>{if(!this.getAssetPlayer(y)||!this.schedule)return;this.shouldPlay=!0;const dt=this.schedule.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,dt,Pe)};return M.once(S.MEDIA_ENDED,ce(s)),M.once(S.PLAYOUT_LIMIT_REACHED,ce(1/0)),M.on(S.ERROR,(Pe,Ue)=>{if(!this.schedule)return;const dt=this.getAssetPlayer(y);if(Ue.details===Z.BUFFER_STALLED_ERROR){if(dt!=null&&dt.appendInPlace){this.handleInPlaceStall(t);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(Ue,t,this.schedule.findEventIndex(t.identifier),s,`Asset player error ${Ue.error} ${t}`)}),M.on(S.DESTROYING,()=>{if(!this.getAssetPlayer(y)||!this.schedule)return;const Ue=new Error(`Asset player destroyed unexpectedly ${y}`),dt={fatal:!0,type:pe.OTHER_ERROR,details:Z.INTERSTITIAL_ASSET_ITEM_ERROR,error:Ue};this.handleAssetItemError(dt,t,this.schedule.findEventIndex(t.identifier),s,Ue.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${va(n)}`),this.hls.trigger(S.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:n,assetListIndex:s,event:t,player:M}),M}clearInterstitial(t,n){t.assetList.forEach(s=>{this.clearAssetPlayer(s.identifier,n)}),t.reset()}resetAssetPlayer(t){const n=this.getAssetPlayerQueueIndex(t);if(n!==-1){this.log(`reset asset player "${t}" after error`);const s=this.playerQueue[n];this.transferMediaFromPlayer(s,null),s.resetDetails()}}clearAssetPlayer(t,n){const s=this.getAssetPlayerQueueIndex(t);if(s!==-1){const o=this.playerQueue[s];this.log(`clear ${o} toSegment: ${n&&Bs(n)}`),this.transferMediaFromPlayer(o,n),this.playerQueue.splice(s,1),o.destroy()}}emptyPlayerQueue(){let t;for(;t=this.playerQueue.pop();)t.destroy();this.playerQueue=[]}startAssetPlayer(t,n,s,o,l){const{interstitial:c,assetItem:d,assetId:_}=t,g=c.assetList.length,v=this.playingAsset;this.endedAsset=null,this.playingAsset=d,(!v||v.identifier!==_)&&(v&&(this.clearAssetPlayer(v.identifier,s[o]),delete v.error),this.log(`INTERSTITIAL_ASSET_STARTED ${n+1}/${g} ${va(d)}`),this.hls.trigger(S.INTERSTITIAL_ASSET_STARTED,{asset:d,assetListIndex:n,event:c,schedule:s.slice(0),scheduleIndex:o,player:t})),this.bufferAssetPlayer(t,l)}bufferAssetPlayer(t,n){var s,o;if(!this.schedule)return;const{interstitial:l,assetItem:c}=t,d=this.schedule.findEventIndex(l.identifier),_=(s=this.schedule.items)==null?void 0:s[d];if(!_)return;t.loadSource(),this.setBufferingItem(_),this.bufferingAsset=c;const g=this.getBufferingPlayer();if(g===t)return;const v=l.appendInPlace;if(v&&(g==null?void 0:g.interstitial.appendInPlace)===!1)return;const y=(g==null?void 0:g.tracks)||((o=this.detachedData)==null?void 0:o.tracks)||this.requiredTracks;if(v&&c!==this.playingAsset){if(!t.tracks){this.log(`Waiting for track info before buffering ${t}`);return}if(y&&!Ke(y,t.tracks)){const x=new Error(`Asset ${va(c)} SourceBuffer tracks ('${Object.keys(t.tracks)}') are not compatible with primary content tracks ('${Object.keys(y)}')`),L={fatal:!0,type:pe.OTHER_ERROR,details:Z.INTERSTITIAL_ASSET_ITEM_ERROR,error:x},M=l.findAssetIndex(c);this.handleAssetItemError(L,l,d,M,x.message);return}}this.transferMediaTo(t,n)}handleInPlaceStall(t){const n=this.schedule,s=this.primaryMedia;if(!n||!s)return;const o=s.currentTime,l=n.findAssetIndex(t,o),c=t.assetList[l];if(c){const d=this.getAssetPlayer(c.identifier);if(d){const _=d.currentTime||o-c.timelineStart,g=d.duration-_;if(this.warn(`Stalled at ${_} of ${_+g} in ${d} ${t} (media.currentTime: ${o})`),_&&(g/s.playbackRate<.5||d.bufferedInPlaceToEnd(s))&&d.hls){const v=n.findEventIndex(t.identifier);this.advanceAfterAssetEnded(t,v,l)}}}}advanceInPlace(t){const n=this.primaryMedia;n&&n.currentTime<t&&(n.currentTime=t)}handleAssetItemError(t,n,s,o,l){if(t.details===Z.BUFFER_STALLED_ERROR)return;const c=n.assetList[o]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${c&&va(c)} ${t.error}`),!this.schedule)return;const d=(c==null?void 0:c.identifier)||"",_=this.getAssetPlayerQueueIndex(d),g=this.playerQueue[_]||null,v=this.schedule.items,y=k({},t,{fatal:!1,errorAction:$n(!0),asset:c,assetListIndex:o,event:n,schedule:v,scheduleIndex:s,player:g});if(this.hls.trigger(S.INTERSTITIAL_ASSET_ERROR,y),!t.fatal)return;const x=this.playingAsset,L=this.bufferingAsset,M=new Error(l);if(c&&(this.clearAssetPlayer(d,null),c.error=M),!n.assetList.some(B=>!B.error))n.error=M;else for(let B=o;B<n.assetList.length;B++)this.resetAssetPlayer(n.assetList[B].identifier);this.updateSchedule(!0),n.error?this.primaryFallback(n):x&&x.identifier===d?this.advanceAfterAssetEnded(n,s,o):L&&L.identifier===d&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,L)}primaryFallback(t){const n=t.timelineStart,s=this.effectivePlayingItem;if(s){this.log(`Fallback to primary from event "${t.identifier}" start: ${n} pos: ${this.timelinePos} playing: ${Bs(s)} error: ${t.error}`);let o=this.timelinePos;o===-1&&(o=this.hls.startPosition);const l=this.updateItem(s,o);if(this.itemsMatch(s,l)&&this.clearInterstitial(t,null),t.appendInPlace&&(this.attachPrimary(n,null),this.flushFrontBuffer(n)),!this.schedule)return;const c=this.schedule.findItemIndexAtTime(o);this.setSchedulePosition(c)}else this.checkStart()}onAssetListLoaded(t,n){var s,o;const l=n.event,c=l.identifier,d=n.assetListResponse.ASSETS;if(!((s=this.schedule)!=null&&s.hasEvent(c)))return;const _=l.timelineStart,g=l.duration;let v=0;d.forEach((B,F)=>{const W=parseFloat(B.DURATION);this.createAsset(l,F,v,_+v,W,B.URI),v+=W}),l.duration=v,this.log(`Loaded asset-list with duration: ${v} (was: ${g}) ${l}`);const y=this.waitingItem,x=(y==null?void 0:y.event.identifier)===c;this.updateSchedule();const L=(o=this.bufferingItem)==null?void 0:o.event;if(x){var M;const B=this.schedule.findEventIndex(c),F=(M=this.schedule.items)==null?void 0:M[B];if(F){if(!this.playingItem&&this.timelinePos>F.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==B){l.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${l}`),this.updateSchedule(!0),this.primaryFallback(l);return}this.setBufferingItem(F)}this.setSchedulePosition(B)}else if((L==null?void 0:L.identifier)===c){const B=l.assetList[0];if(B){const F=this.getAssetPlayer(B.identifier);if(L.appendInPlace){const W=this.primaryMedia;F&&W&&this.bufferAssetPlayer(F,W)}else F&&F.loadSource()}}}onError(t,n){if(this.schedule)switch(n.details){case Z.ASSET_LIST_PARSING_ERROR:case Z.ASSET_LIST_LOAD_ERROR:case Z.ASSET_LIST_LOAD_TIMEOUT:{const s=n.interstitial;s&&(this.updateSchedule(!0),this.primaryFallback(s));break}case Z.BUFFER_STALLED_ERROR:{const s=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&s.event.appendInPlace){this.handleInPlaceStall(s.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}const df=500;class Ld extends Js{constructor(t,n,s){super(t,n,s,"subtitle-stream-controller",P.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:t}=this;t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(S.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(S.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(S.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(t,n){this.stopLoad(),this.state=kt.IDLE,this.setInterval(df),this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(t,n){this.tracksBuffered=[],super.onMediaDetaching(t,n)}onLevelLoaded(t,n){this.mainDetails=n.details}onSubtitleFragProcessed(t,n){const{frag:s,success:o}=n;if(this.fragContextChanged(s)||(ze(s)&&(this.fragPrevious=s),this.state=kt.IDLE),!o)return;const l=this.tracksBuffered[this.currentTrackId];if(!l)return;let c;const d=s.start;for(let g=0;g<l.length;g++)if(d>=l[g].start&&d<=l[g].end){c=l[g];break}const _=s.start+s.duration;c?c.end=_:(c={start:d,end:_},l.push(c)),this.fragmentTracker.fragBuffered(s),this.fragBufferedComplete(s,null),this.media&&this.tick()}onBufferFlushing(t,n){const{startOffset:s,endOffset:o}=n;if(s===0&&o!==Number.POSITIVE_INFINITY){const l=o-1;if(l<=0)return;n.endOffsetSubtitles=Math.max(0,l),this.tracksBuffered.forEach(c=>{for(let d=0;d<c.length;){if(c[d].end<=l){c.shift();continue}else if(c[d].start<l)c[d].start=l;else break;d++}}),this.fragmentTracker.removeFragmentsInRange(s,l,P.SUBTITLE)}}onError(t,n){const s=n.frag;(s==null?void 0:s.type)===P.SUBTITLE&&(n.details===Z.FRAG_GAP&&this.fragmentTracker.fragBuffered(s,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==kt.STOPPED&&(this.state=kt.IDLE))}onSubtitleTracksUpdated(t,{subtitleTracks:n}){if(this.levels&&Xh(this.levels,n)){this.levels=n.map(s=>new mn(s));return}this.tracksBuffered=[],this.levels=n.map(s=>{const o=new mn(s);return this.tracksBuffered[o.id]=[],o}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,P.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(t,n){var s;if(this.currentTrackId=n.id,!((s=this.levels)!=null&&s.length)||this.currentTrackId===-1){this.clearInterval();return}const o=this.levels[this.currentTrackId];o!=null&&o.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,o&&this.state!==kt.STOPPED&&this.setInterval(df)}onSubtitleTrackLoaded(t,n){var s;const{currentTrackId:o,levels:l}=this,{details:c,id:d}=n;if(!l){this.warn(`Subtitle tracks were reset while loading level ${d}`);return}const _=l[d];if(d>=l.length||!_)return;this.log(`Subtitle track ${d} loaded [${c.startSN},${c.endSN}]${c.lastPartSn?`[part-${c.lastPartSn}-${c.lastPartIndex}]`:""},duration:${c.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let g=0;if(c.live||(s=_.details)!=null&&s.live){if(c.deltaUpdateFailed)return;const y=this.mainDetails;if(!y){this.startFragRequested=!1;return}const x=y.fragments[0];if(!_.details)c.hasProgramDateTime&&y.hasProgramDateTime?(Xs(c,y),g=c.fragmentStart):x&&(g=x.start,Do(c,g));else{var v;g=this.alignPlaylists(c,_.details,(v=this.levelLastLoaded)==null?void 0:v.details),g===0&&x&&(g=x.start,Do(c,g))}y&&!this.startFragRequested&&this.setStartPosition(y,g)}_.details=c,this.levelLastLoaded=_,d===o&&(this.hls.trigger(S.SUBTITLE_TRACK_UPDATED,{details:c,id:d,groupId:n.groupId}),this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===kt.IDLE&&(Ni(null,c.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),_.details=void 0)))}_handleFragmentLoadComplete(t){const{frag:n,payload:s}=t,o=n.decryptdata,l=this.hls;if(!this.fragContextChanged(n)&&s&&s.byteLength>0&&o!=null&&o.key&&o.iv&&Nr(o.method)){const c=performance.now();this.decrypter.decrypt(new Uint8Array(s),o.key.buffer,o.iv.buffer,hr(o.method)).catch(d=>{throw l.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:n}),d}).then(d=>{const _=performance.now();l.trigger(S.FRAG_DECRYPTED,{frag:n,payload:d,stats:{tstart:c,tdecrypt:_}})}).catch(d=>{this.warn(`${d.name}: ${d.message}`),this.state=kt.IDLE})}}doTick(){if(!this.media){this.state=kt.IDLE;return}if(this.state===kt.IDLE){const{currentTrackId:t,levels:n}=this,s=n==null?void 0:n[t];if(!s||!n.length||!s.details||this.waitForLive(s))return;const{config:o}=this,l=this.getLoadPosition(),c=mi.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],l,o.maxBufferHole),{end:d,len:_}=c,g=s.details,v=this.hls.maxBufferLength+g.levelTargetDuration;if(_>v)return;const y=g.fragments,x=y.length,L=g.edge;let M=null;const B=this.fragPrevious;if(d<L){const _e=o.maxFragLookUpTolerance,ce=d>L-_e?0:_e;M=Ni(B,y,Math.max(y[0].start,d),ce),!M&&B&&B.start<y[0].start&&(M=y[0])}else M=y[x-1];if(M=this.filterReplacedPrimary(M,s.details),!M)return;const F=M.sn-g.startSN,W=y[F-1];if(W&&W.cc===M.cc&&this.fragmentTracker.getState(W)===Vi.NOT_LOADED&&(M=W),this.fragmentTracker.getState(M)===Vi.NOT_LOADED){const _e=this.mapToInitFragWhenRequired(M);_e&&this.loadFragment(_e,s,d)}}}loadFragment(t,n,s){ze(t)?super.loadFragment(t,n,s):this._loadInitSegment(t,n)}get mediaBufferTimeRanges(){return new Dd(this.tracksBuffered[this.currentTrackId]||[])}}class Dd{constructor(t){this.buffered=void 0;const n=(s,o,l)=>{if(o=o>>>0,o>l-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${o}) is greater than the maximum bound (${l})`);return t[o][s]};this.buffered={get length(){return t.length},end(s){return n("end",s,t.length)},start(s){return n("start",s,t.length)}}}}const Cd={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},pf=h=>String.fromCharCode(Cd[h]||h),ms=15,ks=100,ho={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},ya={17:2,18:4,21:6,22:8,23:10,19:13,20:15},mf={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},gf={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Md{constructor(){this.time=null,this.verboseLevel=0}log(t,n){if(this.verboseLevel>=t){const s=typeof n=="function"?n():n;se.log(`${this.time} [${t}] ${s}`)}}}const fo=function(t){const n=[];for(let s=0;s<t.length;s++)n.push(t[s].toString(16));return n};class Bc{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(t){const n=["foreground","underline","italics","background","flash"];for(let s=0;s<n.length;s++){const o=n[s];t.hasOwnProperty(o)&&(this[o]=t[o])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}copy(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class Id{constructor(){this.uchar=" ",this.penState=new Bc}reset(){this.uchar=" ",this.penState.reset()}setChar(t,n){this.uchar=t,this.penState.copy(n)}setPenState(t){this.penState.copy(t)}equals(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}copy(t){this.uchar=t.uchar,this.penState.copy(t.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class Rd{constructor(t){this.chars=[],this.pos=0,this.currPenState=new Bc,this.cueStartTime=null,this.logger=void 0;for(let n=0;n<ks;n++)this.chars.push(new Id);this.logger=t}equals(t){for(let n=0;n<ks;n++)if(!this.chars[n].equals(t.chars[n]))return!1;return!0}copy(t){for(let n=0;n<ks;n++)this.chars[n].copy(t.chars[n])}isEmpty(){let t=!0;for(let n=0;n<ks;n++)if(!this.chars[n].isEmpty()){t=!1;break}return t}setCursor(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>ks&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=ks)}moveCursor(t){const n=this.pos+t;if(t>1)for(let s=this.pos+1;s<n+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(n)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(t){t>=144&&this.backSpace();const n=pf(t);if(this.pos>=ks){this.logger.log(0,()=>"Cannot insert "+t.toString(16)+" ("+n+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(n,this.currPenState),this.moveCursor(1)}clearFromPos(t){let n;for(n=t;n<ks;n++)this.chars[n].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const t=[];let n=!0;for(let s=0;s<ks;s++){const o=this.chars[s].uchar;o!==" "&&(n=!1),t.push(o)}return n?"":t.join("")}setPenStyles(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)}}class Nc{constructor(t){this.rows=[],this.currRow=ms-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let n=0;n<ms;n++)this.rows.push(new Rd(t));this.logger=t}reset(){for(let t=0;t<ms;t++)this.rows[t].clear();this.currRow=ms-1}equals(t){let n=!0;for(let s=0;s<ms;s++)if(!this.rows[s].equals(t.rows[s])){n=!1;break}return n}copy(t){for(let n=0;n<ms;n++)this.rows[n].copy(t.rows[n])}isEmpty(){let t=!0;for(let n=0;n<ms;n++)if(!this.rows[n].isEmpty()){t=!1;break}return t}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(t){this.rows[this.currRow].insertChar(t)}setPen(t){this.rows[this.currRow].setPenStyles(t)}moveCursor(t){this.rows[this.currRow].moveCursor(t)}setCursor(t){this.logger.log(2,"setCursor: "+t),this.rows[this.currRow].setCursor(t)}setPAC(t){this.logger.log(2,()=>"pacData = "+Qi(t));let n=t.row-1;if(this.nrRollUpRows&&n<this.nrRollUpRows-1&&(n=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==n){for(let d=0;d<ms;d++)this.rows[d].clear();const l=this.currRow+1-this.nrRollUpRows,c=this.lastOutputScreen;if(c){const d=c.rows[l].cueStartTime,_=this.logger.time;if(d!==null&&_!==null&&d<_)for(let g=0;g<this.nrRollUpRows;g++)this.rows[n-this.nrRollUpRows+g+1].copy(c.rows[l+g])}}this.currRow=n;const s=this.rows[this.currRow];if(t.indent!==null){const l=t.indent,c=Math.max(l-1,0);s.setCursor(t.indent),t.color=s.chars[c].penState.foreground}const o={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(o)}setBkgData(t){this.logger.log(2,()=>"bkgData = "+Qi(t)),this.backSpace(),this.setPen(t),this.insertChar(32)}setRollUpRows(t){this.nrRollUpRows=t}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const t=this.currRow+1-this.nrRollUpRows,n=this.rows.splice(t,1)[0];n.clear(),this.rows.splice(this.currRow,0,n),this.logger.log(2,"Rolling up")}getDisplayText(t){t=t||!1;const n=[];let s="",o=-1;for(let l=0;l<ms;l++){const c=this.rows[l].getTextString();c&&(o=l+1,t?n.push("Row "+o+": '"+c+"'"):n.push(c.trim()))}return n.length>0&&(t?s="["+n.join(" | ")+"]":s=n.join(`
`)),s}getTextAndFormat(){return this.rows}}class Tn{constructor(t,n,s){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=t,this.outputFilter=n,this.mode=null,this.verbose=0,this.displayedMemory=new Nc(s),this.nonDisplayedMemory=new Nc(s),this.lastOutputScreen=new Nc(s),this.currRollUpRow=this.displayedMemory.rows[ms-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[ms-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(t){this.outputFilter=t}setPAC(t){this.writeScreen.setPAC(t)}setBkgData(t){this.writeScreen.setBkgData(t)}setMode(t){t!==this.mode&&(this.mode=t,this.logger.log(2,()=>"MODE="+t),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=t)}insertChars(t){for(let s=0;s<t.length;s++)this.writeScreen.insertChar(t[s]);const n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>n+": "+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(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}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 t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}ccMIDROW(t){const n={flash:!1};if(n.underline=t%2===1,n.italics=t>=46,n.italics)n.foreground="white";else{const s=Math.floor(t/2)-16,o=["white","green","blue","cyan","red","yellow","magenta"];n.foreground=o[s]}this.logger.log(2,"MIDROW: "+Qi(n)),this.writeScreen.setPen(n)}outputDataUpdate(t=!1){const n=this.logger.time;n!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=n:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,n,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:n),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}class Rl{constructor(t,n,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory=Oa(),this.logger=void 0;const o=this.logger=new Md;this.channels=[null,new Tn(t,n,o),new Tn(t+1,s,o)]}getHandler(t){return this.channels[t].getHandler()}setHandler(t,n){this.channels[t].setHandler(n)}addData(t,n){this.logger.time=t;for(let s=0;s<n.length;s+=2){const o=n[s]&127,l=n[s+1]&127;let c=!1,d=null;if(o===0&&l===0)continue;this.logger.log(3,()=>"["+fo([n[s],n[s+1]])+"] -> ("+fo([o,l])+")");const _=this.cmdHistory;if(o>=16&&o<=31){if(Pd(o,l,_)){po(null,null,_),this.logger.log(3,()=>"Repeated command ("+fo([o,l])+") is dropped");continue}po(o,l,this.cmdHistory),c=this.parseCmd(o,l),c||(c=this.parseMidrow(o,l)),c||(c=this.parsePAC(o,l)),c||(c=this.parseBackgroundAttributes(o,l))}else po(null,null,_);if(!c&&(d=this.parseChars(o,l),d)){const v=this.currentChannel;v&&v>0?this.channels[v].insertChars(d):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!c&&!d&&this.logger.log(2,()=>"Couldn't parse cleaned data "+fo([o,l])+" orig: "+fo([n[s],n[s+1]]))}}parseCmd(t,n){const s=(t===20||t===28||t===21||t===29)&&n>=32&&n<=47,o=(t===23||t===31)&&n>=33&&n<=35;if(!(s||o))return!1;const l=t===20||t===21||t===23?1:2,c=this.channels[l];return t===20||t===21||t===28||t===29?n===32?c.ccRCL():n===33?c.ccBS():n===34?c.ccAOF():n===35?c.ccAON():n===36?c.ccDER():n===37?c.ccRU(2):n===38?c.ccRU(3):n===39?c.ccRU(4):n===40?c.ccFON():n===41?c.ccRDC():n===42?c.ccTR():n===43?c.ccRTD():n===44?c.ccEDM():n===45?c.ccCR():n===46?c.ccENM():n===47&&c.ccEOC():c.ccTO(n-32),this.currentChannel=l,!0}parseMidrow(t,n){let s=0;if((t===17||t===25)&&n>=32&&n<=47){if(t===17?s=1:s=2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const o=this.channels[s];return o?(o.ccMIDROW(n),this.logger.log(3,()=>"MIDROW ("+fo([t,n])+")"),!0):!1}return!1}parsePAC(t,n){let s;const o=(t>=17&&t<=23||t>=25&&t<=31)&&n>=64&&n<=127,l=(t===16||t===24)&&n>=64&&n<=95;if(!(o||l))return!1;const c=t<=23?1:2;n>=64&&n<=95?s=c===1?ho[t]:mf[t]:s=c===1?ya[t]:gf[t];const d=this.channels[c];return d?(d.setPAC(this.interpretPAC(s,n)),this.currentChannel=c,!0):!1}interpretPAC(t,n){let s;const o={color:null,italics:!1,indent:null,underline:!1,row:t};return n>95?s=n-96:s=n-64,o.underline=(s&1)===1,s<=13?o.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(o.italics=!0,o.color="white"):o.indent=Math.floor((s-16)/2)*4,o}parseChars(t,n){let s,o=null,l=null;if(t>=25?(s=2,l=t-8):(s=1,l=t),l>=17&&l<=19){let c;l===17?c=n+80:l===18?c=n+112:c=n+144,this.logger.log(2,()=>"Special char '"+pf(c)+"' in channel "+s),o=[c]}else t>=32&&t<=127&&(o=n===0?[t]:[t,n]);return o&&this.logger.log(3,()=>"Char codes = "+fo(o).join(",")),o}parseBackgroundAttributes(t,n){const s=(t===16||t===24)&&n>=32&&n<=47,o=(t===23||t===31)&&n>=45&&n<=47;if(!(s||o))return!1;let l;const c={};t===16||t===24?(l=Math.floor((n-32)/2),c.background=_f[l],n%2===1&&(c.background=c.background+"_semi")):n===45?c.background="transparent":(c.foreground="black",n===47&&(c.underline=!0));const d=t<=23?1:2;return this.channels[d].setBkgData(c),!0}reset(){for(let t=0;t<Object.keys(this.channels).length;t++){const n=this.channels[t];n&&n.reset()}po(null,null,this.cmdHistory)}cueSplitAtTime(t){for(let n=0;n<this.channels.length;n++){const s=this.channels[n];s&&s.cueSplitAtTime(t)}}}function po(h,t,n){n.a=h,n.b=t}function Pd(h,t,n){return n.a===h&&n.b===t}function Oa(){return{a:null,b:null}}var Mu=function(){if(Ms!=null&&Ms.VTTCue)return self.VTTCue;const h=["","lr","rl"],t=["start","middle","end","left","right"];function n(d,_){if(typeof _!="string"||!Array.isArray(d))return!1;const g=_.toLowerCase();return~d.indexOf(g)?g:!1}function s(d){return n(h,d)}function o(d){return n(t,d)}function l(d,..._){let g=1;for(;g<arguments.length;g++){const v=arguments[g];for(const y in v)d[y]=v[y]}return d}function c(d,_,g){const v=this,y={enumerable:!0};v.hasBeenReset=!1;let x="",L=!1,M=d,B=_,F=g,W=null,_e="",ce=!0,Pe="auto",Ue="start",dt=50,$e="middle",Qe=50,et="middle";Object.defineProperty(v,"id",l({},y,{get:function(){return x},set:function(Be){x=""+Be}})),Object.defineProperty(v,"pauseOnExit",l({},y,{get:function(){return L},set:function(Be){L=!!Be}})),Object.defineProperty(v,"startTime",l({},y,{get:function(){return M},set:function(Be){if(typeof Be!="number")throw new TypeError("Start time must be set to a number.");M=Be,this.hasBeenReset=!0}})),Object.defineProperty(v,"endTime",l({},y,{get:function(){return B},set:function(Be){if(typeof Be!="number")throw new TypeError("End time must be set to a number.");B=Be,this.hasBeenReset=!0}})),Object.defineProperty(v,"text",l({},y,{get:function(){return F},set:function(Be){F=""+Be,this.hasBeenReset=!0}})),Object.defineProperty(v,"region",l({},y,{get:function(){return W},set:function(Be){W=Be,this.hasBeenReset=!0}})),Object.defineProperty(v,"vertical",l({},y,{get:function(){return _e},set:function(Be){const Tt=s(Be);if(Tt===!1)throw new SyntaxError("An invalid or illegal string was specified.");_e=Tt,this.hasBeenReset=!0}})),Object.defineProperty(v,"snapToLines",l({},y,{get:function(){return ce},set:function(Be){ce=!!Be,this.hasBeenReset=!0}})),Object.defineProperty(v,"line",l({},y,{get:function(){return Pe},set:function(Be){if(typeof Be!="number"&&Be!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Pe=Be,this.hasBeenReset=!0}})),Object.defineProperty(v,"lineAlign",l({},y,{get:function(){return Ue},set:function(Be){const Tt=o(Be);if(!Tt)throw new SyntaxError("An invalid or illegal string was specified.");Ue=Tt,this.hasBeenReset=!0}})),Object.defineProperty(v,"position",l({},y,{get:function(){return dt},set:function(Be){if(Be<0||Be>100)throw new Error("Position must be between 0 and 100.");dt=Be,this.hasBeenReset=!0}})),Object.defineProperty(v,"positionAlign",l({},y,{get:function(){return $e},set:function(Be){const Tt=o(Be);if(!Tt)throw new SyntaxError("An invalid or illegal string was specified.");$e=Tt,this.hasBeenReset=!0}})),Object.defineProperty(v,"size",l({},y,{get:function(){return Qe},set:function(Be){if(Be<0||Be>100)throw new Error("Size must be between 0 and 100.");Qe=Be,this.hasBeenReset=!0}})),Object.defineProperty(v,"align",l({},y,{get:function(){return et},set:function(Be){const Tt=o(Be);if(!Tt)throw new SyntaxError("An invalid or illegal string was specified.");et=Tt,this.hasBeenReset=!0}})),v.displayState=void 0}return c.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},c}();class mo{decode(t,n){if(!t)return"";if(typeof t!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function $c(h){function t(s,o,l,c){return(s|0)*3600+(o|0)*60+(l|0)+parseFloat(c||0)}const n=h.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?t(n[2],n[3],0,n[4]):t(n[1],n[2],n[3],n[4]):null}class ur{constructor(){this.values=Object.create(null)}set(t,n){!this.get(t)&&n!==""&&(this.values[t]=n)}get(t,n,s){return s?this.has(t)?this.values[t]:n[s]:this.has(t)?this.values[t]:n}has(t){return t in this.values}alt(t,n,s){for(let o=0;o<s.length;++o)if(n===s[o]){this.set(t,n);break}}integer(t,n){/^-?\d+$/.test(n)&&this.set(t,parseInt(n,10))}percent(t,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){const s=parseFloat(n);if(s>=0&&s<=100)return this.set(t,s),!0}return!1}}function Kc(h,t,n,s){const o=s?h.split(s):[h];for(const l in o){if(typeof o[l]!="string")continue;const c=o[l].split(n);if(c.length!==2)continue;const d=c[0],_=c[1];t(d,_)}}const Iu=new Mu(0,0,""),Ru=Iu.align==="middle"?"middle":"center";function vf(h,t,n){const s=h;function o(){const d=$c(h);if(d===null)throw new Error("Malformed timestamp: "+s);return h=h.replace(/^[^\sa-zA-Z-]+/,""),d}function l(d,_){const g=new ur;Kc(d,function(x,L){let M;switch(x){case"region":for(let B=n.length-1;B>=0;B--)if(n[B].id===L){g.set(x,n[B].region);break}break;case"vertical":g.alt(x,L,["rl","lr"]);break;case"line":M=L.split(","),g.integer(x,M[0]),g.percent(x,M[0])&&g.set("snapToLines",!1),g.alt(x,M[0],["auto"]),M.length===2&&g.alt("lineAlign",M[1],["start",Ru,"end"]);break;case"position":M=L.split(","),g.percent(x,M[0]),M.length===2&&g.alt("positionAlign",M[1],["start",Ru,"end","line-left","line-right","auto"]);break;case"size":g.percent(x,L);break;case"align":g.alt(x,L,["start",Ru,"end","left","right"]);break}},/:/,/\s/),_.region=g.get("region",null),_.vertical=g.get("vertical","");let v=g.get("line","auto");v==="auto"&&Iu.line===-1&&(v=-1),_.line=v,_.lineAlign=g.get("lineAlign","start"),_.snapToLines=g.get("snapToLines",!0),_.size=g.get("size",100),_.align=g.get("align",Ru);let y=g.get("position","auto");y==="auto"&&Iu.position===50&&(y=_.align==="start"||_.align==="left"?0:_.align==="end"||_.align==="right"?100:50),_.position=y}function c(){h=h.replace(/^\s+/,"")}if(c(),t.startTime=o(),c(),h.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);h=h.slice(3),c(),t.endTime=o(),c(),l(h,t)}function Pl(h){return h.replace(/<br(?: \/)?>/gi,`
`)}class Yo{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new mo,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(t){const n=this;t&&(n.buffer+=n.decoder.decode(t,{stream:!0}));function s(){let l=n.buffer,c=0;for(l=Pl(l);c<l.length&&l[c]!=="\r"&&l[c]!==`
`;)++c;const d=l.slice(0,c);return l[c]==="\r"&&++c,l[c]===`
`&&++c,n.buffer=l.slice(c),d}function o(l){Kc(l,function(c,d){},/:/)}try{let l="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;l=s();const d=l.match(/^()?WEBVTT([ \t].*)?$/);if(!(d!=null&&d[0]))throw new Error("Malformed WebVTT signature.");n.state="HEADER"}let c=!1;for(;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;switch(c?c=!1:l=s(),n.state){case"HEADER":/:/.test(l)?o(l):l||(n.state="ID");continue;case"NOTE":l||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){n.state="NOTE";break}if(!l)continue;if(n.cue=new Mu(0,0,""),n.state="CUE",l.indexOf("-->")===-1){n.cue.id=l;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{vf(l,n.cue,n.regionList)}catch(d){n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{const d=l.indexOf("-->")!==-1;if(!l||d&&(c=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
`),n.cue.text+=l}continue;case"BADCUE":l||(n.state="ID")}}}catch(l){n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const t=this;try{if((t.cue||t.state==="HEADER")&&(t.buffer+=`
`,t.parse()),t.state==="INITIAL"||t.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){t.onparsingerror&&t.onparsingerror(n)}return t.onflush&&t.onflush(),this}}const yf=/\r\n|\n\r|\n|\r/g,Ur=function(t,n,s=0){return t.slice(s,s+n.length)===n},bf=function(t){let n=parseInt(t.slice(-3));const s=parseInt(t.slice(-6,-4)),o=parseInt(t.slice(-9,-7)),l=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!le(n)||!le(s)||!le(o)||!le(l))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`);return n+=1e3*s,n+=60*1e3*o,n+=60*60*1e3*l,n};function Pu(h,t,n){return Os(h.toString())+Os(t.toString())+Os(n)}const It=function(t,n,s){let o=t[n],l=t[o.prevCC];if(!l||!l.new&&o.new){t.ccOffset=t.presentationOffset=o.start,o.new=!1;return}for(;(c=l)!=null&&c.new;){var c;t.ccOffset+=o.start-l.start,o.new=!1,o=l,l=t[o.prevCC]}t.presentationOffset=s};function Xn(h,t,n,s,o,l,c){const d=new Yo,_=Rt(new Uint8Array(h)).trim().replace(yf,`
`).split(`
`),g=[],v=t?Vh(t.baseTime,t.timescale):0;let y="00:00.000",x=0,L=0,M,B=!0;d.oncue=function(F){const W=n[s];let _e=n.ccOffset;const ce=(x-v)/9e4;if(W!=null&&W.new&&(L!==void 0?_e=n.ccOffset=W.start:It(n,s,ce)),ce){if(!t){M=new Error("Missing initPTS for VTT MPEGTS");return}_e=ce-n.presentationOffset}const Pe=F.endTime-F.startTime,Ue=xr((F.startTime+_e-L)*9e4,o*9e4)/9e4;F.startTime=Math.max(Ue,0),F.endTime=Math.max(Ue+Pe,0);const dt=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(dt)),F.id||(F.id=Pu(F.startTime,F.endTime,dt)),F.endTime>0&&g.push(F)},d.onparsingerror=function(F){M=F},d.onflush=function(){if(M){c(M);return}l(g)},_.forEach(F=>{if(B)if(Ur(F,"X-TIMESTAMP-MAP=")){B=!1,F.slice(16).split(",").forEach(W=>{Ur(W,"LOCAL:")?y=W.slice(6):Ur(W,"MPEGTS:")&&(x=parseInt(W.slice(7)))});try{L=bf(y)/1e3}catch(W){M=W}return}else F===""&&(B=!1);d.parse(F+`
`)}),d.flush()}const xf="stpp.ttml.im1t",Od=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Uc=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,wf={left:"start",center:"center",right:"end",start:"start",end:"end"};function Xo(h,t,n,s){const o=me(new Uint8Array(h),["mdat"]);if(o.length===0){s(new Error("Could not parse IMSC1 mdat"));return}const l=o.map(d=>Rt(d)),c=hu(t.baseTime,1,t.timescale);try{l.forEach(d=>n(Ou(d,c)))}catch(d){s(d)}}function Ou(h,t){const o=new DOMParser().parseFromString(h,"text/xml").getElementsByTagName("tt")[0];if(!o)throw new Error("Invalid ttml");const l={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},c=Object.keys(l).reduce((y,x)=>(y[x]=o.getAttribute(`ttp:${x}`)||l[x],y),{}),d=o.getAttribute("xml:space")!=="preserve",_=Sf(zc(o,"styling","style")),g=Sf(zc(o,"layout","region")),v=zc(o,"body","[begin]");return[].map.call(v,y=>{const x=Vc(y,d);if(!x||!y.hasAttribute("begin"))return null;const L=Ol(y.getAttribute("begin"),c),M=Ol(y.getAttribute("dur"),c);let B=Ol(y.getAttribute("end"),c);if(L===null)throw Qo(y);if(B===null){if(M===null)throw Qo(y);B=L+M}const F=new Mu(L-t,B-t,x);F.id=Pu(F.startTime,F.endTime,F.text);const W=g[y.getAttribute("region")],_e=_[y.getAttribute("style")],ce=Jo(W,_e,_),{textAlign:Pe}=ce;if(Pe){const Ue=wf[Pe];Ue&&(F.lineAlign=Ue),F.align=Pe}return k(F,ce),F}).filter(y=>y!==null)}function zc(h,t,n){const s=h.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(n)):[]}function Sf(h){return h.reduce((t,n)=>{const s=n.getAttribute("xml:id");return s&&(t[s]=n),t},{})}function Vc(h,t){return[].slice.call(h.childNodes).reduce((n,s,o)=>{var l;return s.nodeName==="br"&&o?n+`
`:(l=s.childNodes)!=null&&l.length?Vc(s,t):t?n+s.textContent.trim().replace(/\s+/g," "):n+s.textContent},"")}function Jo(h,t,n){const s="http://www.w3.org/ns/ttml#styling";let o=null;const l=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],c=h!=null&&h.hasAttribute("style")?h.getAttribute("style"):null;return c&&n.hasOwnProperty(c)&&(o=n[c]),l.reduce((d,_)=>{const g=Tr(t,s,_)||Tr(h,s,_)||Tr(o,s,_);return g&&(d[_]=g),d},{})}function Tr(h,t,n){return h&&h.hasAttributeNS(t,n)?h.getAttributeNS(t,n):null}function Qo(h){return new Error(`Could not parse ttml timestamp ${h}`)}function Ol(h,t){if(!h)return null;let n=$c(h);return n===null&&(Od.test(h)?n=go(h,t):Uc.test(h)&&(n=Ns(h,t))),n}function go(h,t){const n=Od.exec(h),s=(n[4]|0)+(n[5]|0)/t.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+s/t.frameRate}function Ns(h,t){const n=Uc.exec(h),s=Number(n[1]);switch(n[2]){case"h":return s*3600;case"m":return s*60;case"ms":return s*1e3;case"f":return s/t.frameRate;case"t":return s/t.tickRate}return s}class Fu{constructor(t,n){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=n}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(t,n,s){(this.startTime===null||this.startTime>t)&&(this.startTime=t),this.endTime=n,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class Fl{constructor(t){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=Bl(),this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.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}},t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(S.FRAG_LOADING,this.onFragLoading,this),t.on(S.FRAG_LOADED,this.onFragLoaded,this),t.on(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(S.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:t}=this;t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(S.FRAG_LOADING,this.onFragLoading,this),t.off(S.FRAG_LOADED,this.onFragLoaded,this),t.off(S.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(S.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(S.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(S.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const t=new Fu(this,"textTrack1"),n=new Fu(this,"textTrack2"),s=new Fu(this,"textTrack3"),o=new Fu(this,"textTrack4");this.cea608Parser1=new Rl(1,t,n),this.cea608Parser2=new Rl(3,s,o)}addCues(t,n,s,o,l){let c=!1;for(let d=l.length;d--;){const _=l[d],g=Fd(_[0],_[1],n,s);if(g>=0&&(_[0]=Math.min(_[0],n),_[1]=Math.max(_[1],s),c=!0,g/(s-n)>.5))return}if(c||l.push([n,s]),this.config.renderTextTracksNatively){const d=this.captionsTracks[t];this.Cues.newCue(d,n,s,o)}else{const d=this.Cues.newCue(null,n,s,o);this.hls.trigger(S.CUES_PARSED,{type:"captions",cues:d,track:t})}}onInitPtsFound(t,{frag:n,id:s,initPTS:o,timescale:l,trackId:c}){const{unparsedVttFrags:d}=this;s===P.MAIN&&(this.initPTS[n.cc]={baseTime:o,timescale:l,trackId:c}),d.length&&(this.unparsedVttFrags=[],d.forEach(_=>{this.initPTS[_.frag.cc]?this.onFragLoaded(S.FRAG_LOADED,_):this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:_.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(t,n){const{media:s}=this;if(s)for(let o=0;o<s.textTracks.length;o++){const l=s.textTracks[o];if(Gc(l,{name:t,lang:n,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return l}return null}createCaptionsTrack(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)}createNativeTrack(t){if(this.captionsTracks[t])return;const{captionsProperties:n,captionsTracks:s,media:o}=this,{label:l,languageCode:c}=n[t],d=this.getExistingTrack(l,c);if(d)s[t]=d,qo(s[t]),Rc(s[t],o);else{const _=this.createTextTrack("captions",l,c);_&&(_[t]=!0,s[t]=_)}}createNonNativeTrack(t){if(this.nonNativeCaptionsTracks[t])return;const n=this.captionsProperties[t];if(!n)return;const s=n.label,o={_id:t,label:s,kind:"captions",default:n.media?!!n.media.default:!1,closedCaptions:n.media};this.nonNativeCaptionsTracks[t]=o,this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[o]})}createTextTrack(t,n,s){const o=this.media;if(o)return o.addTextTrack(t,n,s)}onMediaAttaching(t,n){this.media=n.media,n.mediaSource||this._cleanTracks()}onMediaDetaching(t,n){const s=!!n.transferMedia;if(this.media=null,s)return;const{captionsTracks:o}=this;Object.keys(o).forEach(l=>{qo(o[l]),delete o[l]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Bl(),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:t}=this;if(!t)return;const n=t.textTracks;if(n)for(let s=0;s<n.length;s++)qo(n[s])}onSubtitleTracksUpdated(t,n){const s=n.subtitleTracks||[],o=s.some(l=>l.textCodec===xf);if(this.config.enableWebVTT||o&&this.config.enableIMSC1){if(Xh(this.tracks,s)){this.tracks=s;return}if(this.textTracks=[],this.tracks=s,this.config.renderTextTracksNatively){const c=this.media,d=c?Lu(c.textTracks):null;if(this.tracks.forEach((_,g)=>{let v;if(d){let y=null;for(let x=0;x<d.length;x++)if(d[x]&&Gc(d[x],_)){y=d[x],d[x]=null;break}y&&(v=y)}if(v)qo(v);else{const y=el(_);v=this.createTextTrack(y,_.name,_.lang),v&&(v.mode="disabled")}v&&this.textTracks.push(v)}),d!=null&&d.length){const _=d.filter(g=>g!==null).map(g=>g.label);_.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${_.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const c=this.tracks.map(d=>({label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}));this.hls.trigger(S.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}}onManifestLoaded(t,n){this.config.enableCEA708Captions&&n.captions&&n.captions.forEach(s=>{const o=/(?:CC|SERVICE)([1-4])/.exec(s.instreamId);if(!o)return;const l=`textTrack${o[1]}`,c=this.captionsProperties[l];c&&(c.label=s.name,s.lang&&(c.languageCode=s.lang),c.media=s)})}closedCaptionsForLevel(t){const n=this.hls.levels[t.level];return n==null?void 0:n.attrs["CLOSED-CAPTIONS"]}onFragLoading(t,n){if(this.enabled&&n.frag.type===P.MAIN){var s,o;const{cea608Parser1:l,cea608Parser2:c,lastSn:d}=this,{cc:_,sn:g}=n.frag,v=(s=(o=n.part)==null?void 0:o.index)!=null?s:-1;l&&c&&(g!==d+1||g===d&&v!==this.lastPartIndex+1||_!==this.lastCc)&&(l.reset(),c.reset()),this.lastCc=_,this.lastSn=g,this.lastPartIndex=v}}onFragLoaded(t,n){const{frag:s,payload:o}=n;if(s.type===P.SUBTITLE)if(o.byteLength){const l=s.decryptdata,c="stats"in n;if(l==null||!l.encrypted||c){const d=this.tracks[s.level],_=this.vttCCs;_[s.cc]||(_[s.cc]={start:s.start,prevCC:this.prevCC,new:!0},this.prevCC=s.cc),d&&d.textCodec===xf?this._parseIMSC1(s,o):this._parseVTTs(n)}}else this.hls.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:new Error("Empty subtitle payload")})}_parseIMSC1(t,n){const s=this.hls;Xo(n,this.initPTS[t.cc],o=>{this._appendCues(o,t.level),s.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})},o=>{s.logger.log(`Failed to parse IMSC1: ${o}`),s.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:o})})}_parseVTTs(t){var n;const{frag:s,payload:o}=t,{initPTS:l,unparsedVttFrags:c}=this,d=l.length-1;if(!l[s.cc]&&d===-1){c.push(t);return}const _=this.hls,g=(n=s.initSegment)!=null&&n.data?yt(s.initSegment.data,new Uint8Array(o)).buffer:o;Xn(g,this.initPTS[s.cc],this.vttCCs,s.cc,s.start,v=>{this._appendCues(v,s.level),_.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},v=>{const y=v.message==="Missing initPTS for VTT MPEGTS";y?c.push(t):this._fallbackToIMSC1(s,o),_.logger.log(`Failed to parse VTT cue: ${v}`),!(y&&d>s.cc)&&_.trigger(S.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:v})})}_fallbackToIMSC1(t,n){const s=this.tracks[t.level];s.textCodec||Xo(n,this.initPTS[t.cc],()=>{s.textCodec=xf,this._parseIMSC1(t,n)},()=>{s.textCodec="wvtt"})}_appendCues(t,n){const s=this.hls;if(this.config.renderTextTracksNatively){const o=this.textTracks[n];if(!o||o.mode==="disabled")return;t.forEach(l=>hf(o,l))}else{const o=this.tracks[n];if(!o)return;const l=o.default?"default":"subtitles"+n;s.trigger(S.CUES_PARSED,{type:"subtitles",cues:t,track:l})}}onFragDecrypted(t,n){const{frag:s}=n;s.type===P.SUBTITLE&&this.onFragLoaded(S.FRAG_LOADED,n)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(t,n){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:s,samples:o}=n;if(!(s.type===P.MAIN&&this.closedCaptionsForLevel(s)==="NONE"))for(let l=0;l<o.length;l++){const c=o[l].bytes;if(c){this.cea608Parser1||this.initCea608Parsers();const d=this.extractCea608Data(c);this.cea608Parser1.addData(o[l].pts,d[0]),this.cea608Parser2.addData(o[l].pts,d[1])}}}onBufferFlushing(t,{startOffset:n,endOffset:s,endOffsetSubtitles:o,type:l}){const{media:c}=this;if(!(!c||c.currentTime<s)){if(!l||l==="video"){const{captionsTracks:d}=this;Object.keys(d).forEach(_=>Pc(d[_],n,s))}if(this.config.renderTextTracksNatively&&n===0&&o!==void 0){const{textTracks:d}=this;Object.keys(d).forEach(_=>Pc(d[_],n,o))}}}extractCea608Data(t){const n=[[],[]],s=t[0]&31;let o=2;for(let l=0;l<s;l++){const c=t[o++],d=127&t[o++],_=127&t[o++];if(d===0&&_===0)continue;if((4&c)!==0){const v=3&c;(v===0||v===1)&&(n[v].push(d),n[v].push(_))}}return n}}function el(h){return h.characteristics&&/transcribes-spoken-dialog/gi.test(h.characteristics)&&/describes-music-and-sound/gi.test(h.characteristics)?"captions":"subtitles"}function Gc(h,t){return!!h&&h.kind===el(t)&&Uo(t,h)}function Fd(h,t,n,s){return Math.min(t,s)-Math.max(h,n)}function Bl(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const Bd=/\s/,Nd={newCue(h,t,n,s){const o=[];let l,c,d,_,g;const v=self.VTTCue||self.TextTrackCue;for(let x=0;x<s.rows.length;x++)if(l=s.rows[x],d=!0,_=0,g="",!l.isEmpty()){var y;for(let B=0;B<l.chars.length;B++)Bd.test(l.chars[B].uchar)&&d?_++:(g+=l.chars[B].uchar,d=!1);l.cueStartTime=t,t===n&&(n+=1e-4),_>=16?_--:_++;const L=Pl(g.trim()),M=Pu(t,n,L);h!=null&&(y=h.cues)!=null&&y.getCueById(M)||(c=new v(t,n,L),c.id=M,c.line=x+1,c.align="left",c.position=10+Math.min(80,Math.floor(_*8/32)*10),o.push(c))}return h&&o.length&&(o.sort((x,L)=>x.line==="auto"||L.line==="auto"?0:x.line>8&&L.line>8?L.line-x.line:x.line-L.line),o.forEach(x=>hf(h,x))),o}};function $d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}const Nl=/(\d+)-(\d+)\/(\d+)/;class tl{constructor(t){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=t.fetchSetup||Kd,this.controller=new self.AbortController,this.stats=new D}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 t;this.abortInternal(),(t=this.callbacks)!=null&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(t,n,s){const o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();const l=Hc(t,this.controller.signal),c=t.responseType==="arraybuffer",d=c?"byteLength":"length",{maxTimeToFirstByteMs:_,maxLoadTimeMs:g}=n.loadPolicy;this.context=t,this.config=n,this.callbacks=s,this.request=this.fetchSetup(t,l),self.clearTimeout(this.requestTimeout),n.timeout=_&&le(_)?_:g,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(o,t,this.response))},n.timeout),(no(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(y=>{var x;this.response=this.loader=y;const L=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(this.requestTimeout),n.timeout=g,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(o,t,this.response))},g-(L-o.loading.start)),!y.ok){const{status:B,statusText:F}=y;throw new Ef(F||"fetch, bad network response",B,y)}o.loading.first=L,o.total=Fa(y.headers)||o.total;const M=(x=this.callbacks)==null?void 0:x.onProgress;return M&&le(n.highWaterMark)?this.loadProgressively(y,o,t,n.highWaterMark,M):c?y.arrayBuffer():t.responseType==="json"?y.json():y.text()}).then(y=>{var x,L;const M=this.response;if(!M)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);const B=y[d];B&&(o.loaded=o.total=B);const F={url:M.url,data:y,code:M.status},W=(x=this.callbacks)==null?void 0:x.onProgress;W&&!le(n.highWaterMark)&&W(o,t,y,M),(L=this.callbacks)==null||L.onSuccess(F,o,t,M)}).catch(y=>{var x;if(self.clearTimeout(this.requestTimeout),o.aborted)return;const L=y&&y.code||0,M=y?y.message:null;(x=this.callbacks)==null||x.onError({code:L,text:M},t,y?y.details:null,o)})}getCacheAge(){let t=null;if(this.response){const n=this.response.headers.get("age");t=n?parseFloat(n):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,n,s,o=0,l){const c=new vl,d=t.body.getReader(),_=()=>d.read().then(g=>{if(g.done)return c.dataLength&&l(n,s,c.flush().buffer,t),Promise.resolve(new ArrayBuffer(0));const v=g.value,y=v.length;return n.loaded+=y,y<o||c.dataLength?(c.push(v),c.dataLength>=o&&l(n,s,c.flush().buffer,t)):l(n,s,v.buffer,t),_()}).catch(()=>Promise.reject());return _()}}function Hc(h,t){const n={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(k({},h.headers))};return h.rangeEnd&&n.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),n}function _o(h){const t=Nl.exec(h);if(t)return parseInt(t[2])-parseInt(t[1])+1}function Fa(h){const t=h.get("Content-Range");if(t){const s=_o(t);if(le(s))return s}const n=h.get("Content-Length");if(n)return parseInt(n)}function Kd(h,t){return new self.Request(h.url,t)}class Ef extends Error{constructor(t,n,s){super(t),this.code=void 0,this.details=void 0,this.code=n,this.details=s}}const Wc=/^age:\s*[\d.]+\s*$/im;class jc{constructor(t){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=t&&t.xhrSetup||null,this.stats=new D,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,t.readyState!==4&&(this.stats.aborted=!0,t.abort()))}abort(){var t;this.abortInternal(),(t=this.callbacks)!=null&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(t,n,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=n,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:t,context:n}=this;if(!t||!n)return;const s=this.loader=new self.XMLHttpRequest,o=this.stats;o.loading.first=0,o.loaded=0,o.aborted=!1;const l=this.xhrSetup;l?Promise.resolve().then(()=>{if(!(this.loader!==s||this.stats.aborted))return l(s,n.url)}).catch(c=>{if(!(this.loader!==s||this.stats.aborted))return s.open("GET",n.url,!0),l(s,n.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,n,t)}).catch(c=>{var d;(d=this.callbacks)==null||d.onError({code:s.status,text:c.message},n,s,o)}):this.openAndSendXhr(s,n,t)}openAndSendXhr(t,n,s){t.readyState||t.open("GET",n.url,!0);const o=n.headers,{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=s.loadPolicy;if(o)for(const d in o)t.setRequestHeader(d,o[d]);n.rangeEnd&&t.setRequestHeader("Range","bytes="+n.rangeStart+"-"+(n.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=n.responseType,self.clearTimeout(this.requestTimeout),s.timeout=l&&le(l)?l:c,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),t.send()}readystatechange(){const{context:t,loader:n,stats:s}=this;if(!t||!n)return;const o=n.readyState,l=this.config;if(!s.aborted&&o>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),l.timeout!==l.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),l.timeout=l.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),l.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),o===4)){self.clearTimeout(this.requestTimeout),n.onreadystatechange=null,n.onprogress=null;const g=n.status,v=n.responseType==="text"?n.responseText:null;if(g>=200&&g<300){const M=v!=null?v:n.response;if(M!=null){var c,d;s.loading.end=Math.max(self.performance.now(),s.loading.first);const B=n.responseType==="arraybuffer"?M.byteLength:M.length;s.loaded=s.total=B,s.bwEstimate=s.total*8e3/(s.loading.end-s.loading.first);const F=(c=this.callbacks)==null?void 0:c.onProgress;F&&F(s,t,M,n);const W={url:n.responseURL,data:M,code:g};(d=this.callbacks)==null||d.onSuccess(W,s,t,n);return}}const y=l.loadPolicy.errorRetry,x=s.retry,L={url:t.url,data:void 0,code:g};if(en(y,x,!1,L))this.retry(y);else{var _;se.error(`${g} while loading ${t.url}`),(_=this.callbacks)==null||_.onError({code:g,text:n.statusText},t,n,s)}}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry,n=this.stats.retry;if(en(t,n,!0))this.retry(t);else{var s;se.warn(`timeout while loading ${(s=this.context)==null?void 0:s.url}`);const o=this.callbacks;o&&(this.abortInternal(),o.onTimeout(this.stats,this.context,this.loader))}}retry(t){const{context:n,stats:s}=this;this.retryDelay=Xi(t,s.retry),s.retry++,se.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${n==null?void 0:n.url}, retrying ${s.retry}/${t.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(t){const n=this.stats;n.loaded=t.loaded,t.lengthComputable&&(n.total=t.total)}getCacheAge(){let t=null;if(this.loader&&Wc.test(this.loader.getAllResponseHeaders())){const n=this.loader.getResponseHeader("age");t=n?parseFloat(n):null}return t}getResponseHeader(t){return this.loader&&new RegExp(`^${t}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}const Ud={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},zd=C(C({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:jc,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:_i,bufferController:Jh,capLevelController:on,errorController:In,fpsController:Ic,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:Cn,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:Ud},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},Vd()),{},{subtitleStreamController:Ld,subtitleTrackController:Sd,timelineController:Fl,audioStreamController:Yh,audioTrackController:rd,emeController:ia,cmcdController:yd,contentSteeringController:bd,interstitialsController:Ad});function Vd(){return{cueHandler:Nd,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 Gd(h,t,n){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(t.liveMaxLatencyDurationCount!==void 0&&(t.liveSyncDurationCount===void 0||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(t.liveMaxLatencyDuration!==void 0&&(t.liveSyncDuration===void 0||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const s=qc(h),o=["manifest","level","frag"],l=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return o.forEach(c=>{const d=`${c==="level"?"playlist":c}LoadPolicy`,_=t[d]===void 0,g=[];l.forEach(v=>{const y=`${c}Loading${v}`,x=t[y];if(x!==void 0&&_){g.push(y);const L=s[d].default;switch(t[d]={default:L},v){case"TimeOut":L.maxLoadTimeMs=x,L.maxTimeToFirstByteMs=x;break;case"MaxRetry":L.errorRetry.maxNumRetry=x,L.timeoutRetry.maxNumRetry=x;break;case"RetryDelay":L.errorRetry.retryDelayMs=x,L.timeoutRetry.retryDelayMs=x;break;case"MaxRetryTimeout":L.errorRetry.maxRetryDelayMs=x,L.timeoutRetry.maxRetryDelayMs=x;break}}}),g.length&&n.warn(`hls.js config: "${g.join('", "')}" setting(s) are deprecated, use "${d}": ${Qi(t[d])}`)}),C(C({},s),t)}function qc(h){return h&&typeof h=="object"?Array.isArray(h)?h.map(qc):Object.keys(h).reduce((t,n)=>(t[n]=qc(h[n]),t),{}):h}function kf(h,t){const n=h.loader;n!==tl&&n!==jc?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1):$d()&&(h.loader=tl,h.progressive=!0,h.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}const Bu=2,Hd=.1,Wd=.05,jd=100;class qd extends Br{constructor(t,n){super("gap-controller",t.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 s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var s;this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1})}},this.hls=t,this.fragmentTracker=n,this.registerListeners()}registerListeners(){const{hls:t}=this;t&&(t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(t,n){this.setInterval(jd),this.mediaSource=n.mediaSource;const s=this.media=n.media;br(s,"playing",this.onMediaPlaying),br(s,"waiting",this.onMediaWaiting),br(s,"ended",this.onMediaEnded)}onMediaDetaching(t,n){this.clearInterval();const{media:s}=this;s&&(Cr(s,"playing",this.onMediaPlaying),Cr(s,"waiting",this.onMediaWaiting),Cr(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(t,n){this.buffered=n.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var t;if(!((t=this.media)!=null&&t.readyState)||!this.hasBuffered)return;const n=this.media.currentTime;this.poll(n,this.lastCurrentTime),this.lastCurrentTime=n}poll(t,n){var s,o;const l=(s=this.hls)==null?void 0:s.config;if(!l)return;const c=this.media;if(!c)return;const{seeking:d}=c,_=this.seeking&&!d,g=!this.seeking&&d,v=c.paused&&!d||c.ended||c.playbackRate===0;if(this.seeking=d,t!==n){n&&(this.ended=0),this.moved=!0,d||(this.nudgeRetry=0,l.nudgeOnVideoHole&&!v&&t>n&&this.nudgeOnVideoHole(t,n)),this.waiting===0&&this.stallResolved(t);return}if(g||_){_&&this.stallResolved(t);return}if(v){this.nudgeRetry=0,this.stallResolved(t),!this.ended&&c.ended&&this.hls&&(this.ended=t||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!1}));return}if(!mi.getBuffered(c).length){this.nudgeRetry=0;return}const y=mi.bufferInfo(c,t,0),x=y.nextStart||0,L=this.fragmentTracker;if(d&&L&&this.hls){const dt=Zc(this.hls.inFlightFragments,t),$e=y.len>Bu,Qe=!x||dt||x-t>Bu&&!L.getPartialFragment(t);if($e||Qe)return;this.moved=!1}const M=(o=this.hls)==null?void 0:o.latestLevelDetails;if(!this.moved&&this.stalled!==null&&L){if(!(y.len>0)&&!x)return;const $e=Math.max(x,y.start||0)-t,et=!!(M!=null&&M.live)?M.targetduration*2:Bu,Be=Nu(t,L);if($e>0&&($e<=et||Be)){c.paused||this._trySkipBufferHole(Be);return}}const B=l.detectStallWithCurrentTimeMs,F=self.performance.now(),W=this.waiting;let _e=this.stalled;if(_e===null)if(W>0&&F-W<B)_e=this.stalled=W;else{this.stalled=F;return}const ce=F-_e;if(!d&&(ce>=B||W)&&this.hls){var Pe;if(((Pe=this.mediaSource)==null?void 0:Pe.readyState)==="ended"&&!(M!=null&&M.live)&&Math.abs(t-((M==null?void 0:M.edge)||0))<1){if(this.ended)return;this.ended=t||1,this.hls.trigger(S.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(y),!this.media||!this.hls)return}const Ue=mi.bufferInfo(c,t,l.maxBufferHole);this._tryFixBufferStall(Ue,ce,t)}stallResolved(t){const n=this.stalled;if(n&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-n;this.log(`playback not stuck anymore @${t}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(S.STALL_RESOLVED,{})}}nudgeOnVideoHole(t,n){var s;const o=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&o&&o.length>1&&t>o.end(0)){const l=mi.bufferedInfo(mi.timeRangesToArray(this.buffered.audio),t,0);if(l.len>1&&n>=l.start){const c=mi.timeRangesToArray(o),d=mi.bufferedInfo(c,n,0).bufferedIndex;if(d>-1&&d<c.length-1){const _=mi.bufferedInfo(c,t,0).bufferedIndex,g=c[d].end,v=c[d+1].start;if((_===-1||_>d)&&v-g<1&&t-g<2){const y=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${t} hole: ${g} -> ${v} buffered index: ${_}`);this.warn(y.message),this.media.currentTime+=1e-6;let x=Nu(t,this.fragmentTracker);x&&"fragment"in x?x=x.fragment:x||(x=void 0);const L=mi.bufferInfo(this.media,t,0);this.hls.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:x,buffer:L.len,bufferInfo:L})}}}}}_tryFixBufferStall(t,n,s){var o,l;const{fragmentTracker:c,media:d}=this,_=(o=this.hls)==null?void 0:o.config;if(!d||!c||!_)return;const g=(l=this.hls)==null?void 0:l.latestLevelDetails,v=Nu(s,c);if((v||g!=null&&g.live&&s<g.fragmentStart)&&(this._trySkipBufferHole(v)||!this.media))return;const y=t.buffered,x=this.adjacentTraversal(t,s);(y&&y.length>1&&t.len>_.maxBufferHole||t.nextStart&&(t.nextStart-s<_.maxBufferHole||x))&&(n>_.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(t))}adjacentTraversal(t,n){const s=this.fragmentTracker,o=t.nextStart;if(s&&o){const l=s.getFragAtPos(n,P.MAIN),c=s.getFragAtPos(o,P.MAIN);if(l&&c)return c.sn-l.sn<2}return!1}_reportStall(t){const{hls:n,media:s,stallReported:o,stalled:l}=this;if(!o&&l!==null&&s&&n){this.stallReported=!0;const c=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${Qi(t)})`);this.warn(c.message),n.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.BUFFER_STALLED_ERROR,fatal:!1,error:c,buffer:t.len,bufferInfo:t,stalled:{start:l}})}}_trySkipBufferHole(t){var n;const{fragmentTracker:s,media:o}=this,l=(n=this.hls)==null?void 0:n.config;if(!o||!s||!l)return 0;const c=o.currentTime,d=mi.bufferInfo(o,c,0),_=c<d.start?d.start:d.nextStart;if(_&&this.hls){const v=d.len<=l.maxBufferHole,y=d.len>0&&d.len<1&&o.readyState<3,x=_-c;if(x>0&&(v||y)){if(x>l.maxBufferHole){let M=!1;if(c===0){const B=s.getAppendedFrag(0,P.MAIN);B&&_<B.end&&(M=!0)}if(!M&&t){var g;if(!((g=this.hls.loadLevelObj)!=null&&g.details)||Zc(this.hls.inFlightFragments,_))return 0;let F=!1,W=t.end;for(;W<_;){const _e=Nu(W,s);if(_e)W+=_e.duration;else{F=!0;break}}if(F)return 0}}const L=Math.max(_+Wd,c+Hd);if(this.warn(`skipping hole, adjusting currentTime from ${c} to ${L}`),this.moved=!0,o.currentTime=L,!(t!=null&&t.gap)){const M=new Error(`fragment loaded with buffer holes, seeking from ${c} to ${L}`),B={type:pe.MEDIA_ERROR,details:Z.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:M,reason:M.message,buffer:d.len,bufferInfo:d};t&&("fragment"in t?B.part=t:B.frag=t),this.hls.trigger(S.ERROR,B)}return L}}return 0}_tryNudgeBuffer(t){const{hls:n,media:s,nudgeRetry:o}=this,l=n==null?void 0:n.config;if(!s||!l)return 0;const c=s.currentTime;if(this.nudgeRetry++,o<l.nudgeMaxRetry){const d=c+(o+1)*l.nudgeOffset,_=new Error(`Nudging 'currentTime' from ${c} to ${d}`);this.warn(_.message),s.currentTime=d,n.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.BUFFER_NUDGE_ON_STALL,error:_,fatal:!1,buffer:t.len,bufferInfo:t})}else{const d=new Error(`Playhead still not moving while enough data buffered @${c} after ${l.nudgeMaxRetry} nudges`);this.error(d.message),n.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.BUFFER_STALLED_ERROR,error:d,fatal:!0,buffer:t.len,bufferInfo:t})}}}function Zc(h,t){const n=Tf(h.main);if(n&&n.start<=t)return n;const s=Tf(h.audio);return s&&s.start<=t?s:null}function Tf(h){if(!h)return null;switch(h.state){case kt.IDLE:case kt.STOPPED:case kt.ENDED:case kt.ERROR:return null}return h.frag}function Nu(h,t){return t.getAppendedFrag(h,P.MAIN)||t.getPartialFragment(h)}const Zd=.25;function $l(){if(typeof self!="undefined")return self.VTTCue||self.TextTrackCue}function $u(h,t,n,s,o){let l=new h(t,n,"");try{l.value=s,o&&(l.type=o)}catch(c){l=new h(t,n,Qi(o?C({type:o},s):s))}return l}const Kl=(()=>{const h=$l();try{h&&new h(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Yd{constructor(t){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(S.EVENT_CUE_ENTER,{})},this.hls=t,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:t}=this;t&&(t.on(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(S.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(t,n){var s;this.media=n.media,((s=n.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var t;const n=(t=this.hls)==null?void 0:t.latestLevelDetails;n&&this.updateDateRangeCues(n)}onMediaDetaching(t,n){this.media=null,!n.transferMedia&&(this.id3Track&&(this.removeCues&&qo(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(t){const n=this.getID3Track(t.textTracks);return n.mode="hidden",n}getID3Track(t){if(this.media){for(let n=0;n<t.length;n++){const s=t[n];if(s.kind==="metadata"&&s.label==="id3")return Rc(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(t,n){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:s,enableID3MetadataCues:o}=this.hls.config;if(!s&&!o)return;const{samples:l}=n;this.id3Track||(this.id3Track=this.createTrack(this.media));const c=$l();if(c)for(let d=0;d<l.length;d++){const _=l[d].type;if(_===fs.emsg&&!s||!o)continue;const g=su(l[d].data),v=l[d].pts;let y=v+l[d].duration;y>Kl&&(y=Kl),y-v<=0&&(y=v+Zd);for(let L=0;L<g.length;L++){const M=g[L];if(!au(M)){this.updateId3CueEnds(v,_);const B=$u(c,v,y,M,_);B&&this.id3Track.addCue(B)}}}}updateId3CueEnds(t,n){var s;const o=(s=this.id3Track)==null?void 0:s.cues;if(o)for(let l=o.length;l--;){const c=o[l];c.type===n&&c.startTime<t&&c.endTime===Kl&&(c.endTime=t)}}onBufferFlushing(t,{startOffset:n,endOffset:s,type:o}){const{id3Track:l,hls:c}=this;if(!c)return;const{config:{enableEmsgMetadataCues:d,enableID3MetadataCues:_}}=c;if(l&&(d||_)){let g;o==="audio"?g=v=>v.type===fs.audioId3&&_:o==="video"?g=v=>v.type===fs.emsg&&d:g=v=>v.type===fs.audioId3&&_||v.type===fs.emsg&&d,Pc(l,n,s,g)}}onLevelUpdated(t,{details:n}){this.updateDateRangeCues(n,!0)}onLevelPtsUpdated(t,n){Math.abs(n.drift)>.01&&this.updateDateRangeCues(n.details)}updateDateRangeCues(t,n){if(!this.hls||!this.media)return;const{assetPlayerId:s,timelineOffset:o,enableDateRangeMetadataCues:l,interstitialsController:c}=this.hls.config;if(!l)return;const d=$l();if(s&&o&&!c){const{fragmentStart:B,fragmentEnd:F}=t;let W=this.assetCue;W?(W.startTime=B,W.endTime=F):d&&(W=this.assetCue=$u(d,B,F,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),W&&(W.id=s,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(W),W.addEventListener("enter",this.onEventCueEnter)))}if(!t.hasProgramDateTime)return;const{id3Track:_}=this,{dateRanges:g}=t,v=Object.keys(g);let y=this.dateRangeCuesAppended;if(_&&n){var x;if((x=_.cues)!=null&&x.length){const B=Object.keys(y).filter(F=>!v.includes(F));for(let F=B.length;F--;){var L;const W=B[F],_e=(L=y[W])==null?void 0:L.cues;delete y[W],_e&&Object.keys(_e).forEach(ce=>{const Pe=_e[ce];if(Pe){Pe.removeEventListener("enter",this.onEventCueEnter);try{_.removeCue(Pe)}catch(Ue){}}})}}else y=this.dateRangeCuesAppended={}}const M=t.fragments[t.fragments.length-1];if(!(v.length===0||!le(M==null?void 0:M.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let B=0;B<v.length;B++){const F=v[B],W=g[F],_e=W.startTime,ce=y[F],Pe=(ce==null?void 0:ce.cues)||{};let Ue=(ce==null?void 0:ce.durationKnown)||!1,dt=Kl;const{duration:$e,endDate:Qe}=W;if(Qe&&$e!==null)dt=_e+$e,Ue=!0;else if(W.endOnNext&&!Ue){const Be=v.reduce((Tt,ti)=>{if(ti!==W.id){const hi=g[ti];if(hi.class===W.class&&hi.startDate>W.startDate&&(!Tt||W.startDate<Tt.startDate))return hi}return Tt},null);Be&&(dt=Be.startTime,Ue=!0)}const et=Object.keys(W.attr);for(let Be=0;Be<et.length;Be++){const Tt=et[Be];if(!ls(Tt))continue;const ti=Pe[Tt];if(ti)Ue&&!(ce!=null&&ce.durationKnown)?ti.endTime=dt:Math.abs(ti.startTime-_e)>.01&&(ti.startTime=_e,ti.endTime=dt);else if(d){let hi=W.attr[Tt];Dr(Tt)&&(hi=z(hi));const ci=$u(d,_e,dt,{key:Tt,data:hi},fs.dateRange);ci&&(ci.id=F,this.id3Track.addCue(ci),Pe[Tt]=ci,c&&(Tt==="X-ASSET-LIST"||Tt==="X-ASSET-URL")&&ci.addEventListener("enter",this.onEventCueEnter))}}y[F]={cues:Pe,dateRange:W,durationKnown:Ue}}}}}class Xd{constructor(t){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:n}=this,s=this.levelDetails;if(!n||!s)return;this.currentTime=n.currentTime;const o=this.computeLatency();if(o===null)return;this._latency=o;const{lowLatencyMode:l,maxLiveSyncPlaybackRate:c}=this.config;if(!l||c===1||!s.live)return;const d=this.targetLatency;if(d===null)return;const _=o-d,g=Math.min(this.maxLatency,d+s.targetduration);if(_<g&&_>.05&&this.forwardBufferLength>1){const y=Math.min(2,Math.max(1,c)),x=Math.round(2/(1+Math.exp(-.75*_-this.edgeStalled))*20)/20,L=Math.min(y,Math.max(1,x));this.changeMediaPlaybackRate(n,L)}else n.playbackRate!==1&&n.playbackRate!==0&&this.changeMediaPlaybackRate(n,1)},this.hls=t,this.config=t.config,this.registerListeners()}get levelDetails(){var t;return((t=this.hls)==null?void 0:t.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:t}=this;if(t.liveMaxLatencyDuration!==void 0)return t.liveMaxLatencyDuration;const n=this.levelDetails;return n?t.liveMaxLatencyDurationCount*n.targetduration:0}get targetLatency(){const t=this.levelDetails;if(t===null||this.hls===null)return null;const{holdBack:n,partHoldBack:s,targetduration:o}=t,{liveSyncDuration:l,liveSyncDurationCount:c,lowLatencyMode:d}=this.config,_=this.hls.userConfig;let g=d&&s||n;(this._targetLatencyUpdated||_.liveSyncDuration||_.liveSyncDurationCount||g===0)&&(g=l!==void 0?l:c*o);const v=o;return g+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,v)}set targetLatency(t){this.stallCount=0,this.config.liveSyncDuration=t,this._targetLatencyUpdated=!0}get liveSyncPosition(){const t=this.estimateLiveEdge(),n=this.targetLatency;if(t===null||n===null)return null;const s=this.levelDetails;if(s===null)return null;const o=s.edge,l=t-n-this.edgeStalled,c=o-s.totalduration,d=o-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(c,l),d)}get drift(){const t=this.levelDetails;return t===null?1:t.drift}get edgeStalled(){const t=this.levelDetails;if(t===null)return 0;const n=(this.config.lowLatencyMode&&t.partTarget||t.targetduration)*3;return Math.max(t.age-n,0)}get forwardBufferLength(){const{media:t}=this,n=this.levelDetails;if(!t||!n)return 0;const s=t.buffered.length;return(s?t.buffered.end(s-1):n.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:t}=this;t&&(t.on(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(S.ERROR,this.onError,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(S.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(S.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(S.ERROR,this.onError,this))}onMediaAttached(t,n){this.media=n.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(t,{details:n}){n.advanced&&this.onTimeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(t,n){var s;n.details===Z.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(t,n){var s,o;t.playbackRate!==n&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(o=this.targetLatency)==null?void 0:o.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${t.playbackRate} to ${n}`),t.playbackRate=n)}estimateLiveEdge(){const t=this.levelDetails;return t===null?null:t.edge+t.age}computeLatency(){const t=this.estimateLiveEdge();return t===null?null:t-this.currentTime}}class Jd extends _c{constructor(t,n){super(t,"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=n,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this),t.on(S.ERROR,this.onError,this)}_unregisterListeners(){const{hls:t}=this;t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this),t.off(S.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(n=>{n.loadError=0,n.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(t,n){this.resetLevels()}onManifestLoaded(t,n){const s=this.hls.config.preferManagedMediaSource,o=[],l={},c={};let d=!1,_=!1,g=!1;n.levels.forEach(v=>{const y=v.attrs;let{audioCodec:x,videoCodec:L}=v;x&&(v.audioCodec=x=ae(x,s)||void 0),L&&(L=v.videoCodec=_t(L));const{width:M,height:B,unknownCodecs:F}=v;let W=F?F.length:0;if(F)for(let Be=W;Be--;){const Tt=F[Be];this.isAudioSupported(Tt)?(v.audioCodec=x=x?`${x},${Tt}`:Tt,W--,Et.audio[x.substring(0,4)]=2):this.isVideoSupported(Tt)&&(v.videoCodec=L=L?`${L},${Tt}`:Tt,W--,Et.video[L.substring(0,4)]=2)}if(d||(d=!!(M&&B)),_||(_=!!L),g||(g=!!x),W||x&&!this.isAudioSupported(x)||L&&!this.isVideoSupported(L)){this.log(`Some or all CODECS not supported "${y.CODECS}"`);return}const{CODECS:_e,"FRAME-RATE":ce,"HDCP-LEVEL":Pe,"PATHWAY-ID":Ue,RESOLUTION:dt,"VIDEO-RANGE":$e}=y,et=`${`${Ue||"."}-`}${v.bitrate}-${dt}-${ce}-${_e}-${$e}-${Pe}`;if(l[et])if(l[et].uri!==v.url&&!v.attrs["PATHWAY-ID"]){const Be=c[et]+=1;v.attrs["PATHWAY-ID"]=new Array(Be+1).join(".");const Tt=this.createLevel(v);l[et]=Tt,o.push(Tt)}else l[et].addGroupId("audio",y.AUDIO),l[et].addGroupId("text",y.SUBTITLES);else{const Be=this.createLevel(v);l[et]=Be,c[et]=1,o.push(Be)}}),this.filterAndSortMediaOptions(o,n,d,_,g)}createLevel(t){const n=new mn(t),s=t.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){const o=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(o.message),n.supportedResult=oi(o,[])}return n}isAudioSupported(t){return Xt(t,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(t){return Xt(t,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(t,n,s,o,l){let c=[],d=[],_=t;if((s||o)&&l&&(_=_.filter(({videoCodec:F,videoRange:W,width:_e,height:ce})=>(!!F||!!(_e&&ce))&&Di(W))),_.length===0){Promise.resolve().then(()=>{if(this.hls){let F="no level with compatible codecs found in manifest",W=F;n.levels.length&&(W=`one or more CODECS in variant not supported: ${Qi(n.levels.map(ce=>ce.attrs.CODECS).filter((ce,Pe,Ue)=>Ue.indexOf(ce)===Pe))}`,this.warn(W),F+=` (${W})`);const _e=new Error(F);this.hls.trigger(S.ERROR,{type:pe.MEDIA_ERROR,details:Z.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:n.url,error:_e,reason:W})}});return}n.audioTracks&&(c=n.audioTracks.filter(F=>!F.audioCodec||this.isAudioSupported(F.audioCodec)),Af(c)),n.subtitles&&(d=n.subtitles,Af(d));const g=_.slice(0);_.sort((F,W)=>{if(F.attrs["HDCP-LEVEL"]!==W.attrs["HDCP-LEVEL"])return(F.attrs["HDCP-LEVEL"]||"")>(W.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&F.height!==W.height)return F.height-W.height;if(F.frameRate!==W.frameRate)return F.frameRate-W.frameRate;if(F.videoRange!==W.videoRange)return Qn.indexOf(F.videoRange)-Qn.indexOf(W.videoRange);if(F.videoCodec!==W.videoCodec){const _e=De(F.videoCodec),ce=De(W.videoCodec);if(_e!==ce)return ce-_e}if(F.uri===W.uri&&F.codecSet!==W.codecSet){const _e=xe(F.codecSet),ce=xe(W.codecSet);if(_e!==ce)return ce-_e}return F.averageBitrate!==W.averageBitrate?F.averageBitrate-W.averageBitrate:0});let v=g[0];if(this.steering&&(_=this.steering.filterParsedLevels(_),_.length!==g.length)){for(let F=0;F<g.length;F++)if(g[F].pathwayId===_[0].pathwayId){v=g[F];break}}this._levels=_;for(let F=0;F<_.length;F++)if(_[F]===v){var y;this._firstLevel=F;const W=v.bitrate,_e=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${_.length} level(s) found, first bitrate: ${W}`),((y=this.hls.userConfig)==null?void 0:y.abrEwmaDefaultEstimate)===void 0){const ce=Math.min(W,this.hls.config.abrEwmaDefaultEstimateMax);ce>_e&&_e===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=ce)}break}const x=l&&!o,L=this.hls.config,M=!!(L.audioStreamController&&L.audioTrackController),B={levels:_,audioTracks:c,subtitleTracks:d,sessionData:n.sessionData,sessionKeys:n.sessionKeys,firstLevel:this._firstLevel,stats:n.stats,audio:l,video:o,altAudio:M&&!x&&c.some(F=>!!F.url)};this.hls.trigger(S.MANIFEST_PARSED,B)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(t){const n=this._levels;if(n.length===0)return;if(t<0||t>=n.length){const v=new Error("invalid level idx"),y=t<0;if(this.hls.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.LEVEL_SWITCH_ERROR,level:t,fatal:y,error:v,reason:v.message}),y)return;t=Math.min(t,n.length-1)}const s=this.currentLevelIndex,o=this.currentLevel,l=o?o.attrs["PATHWAY-ID"]:void 0,c=n[t],d=c.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=c,s===t&&o&&l===d)return;this.log(`Switching to level ${t} (${c.height?c.height+"p ":""}${c.videoRange?c.videoRange+" ":""}${c.codecSet?c.codecSet+" ":""}@${c.bitrate})${d?" with Pathway "+d:""} from level ${s}${l?" with Pathway "+l:""}`);const _={level:t,attrs:c.attrs,details:c.details,bitrate:c.bitrate,averageBitrate:c.averageBitrate,maxBitrate:c.maxBitrate,realBitrate:c.realBitrate,width:c.width,height:c.height,codecSet:c.codecSet,audioCodec:c.audioCodec,videoCodec:c.videoCodec,audioGroups:c.audioGroups,subtitleGroups:c.subtitleGroups,loaded:c.loaded,loadError:c.loadError,fragmentError:c.fragmentError,name:c.name,id:c.id,uri:c.uri,url:c.url,urlId:0,audioGroupIds:c.audioGroupIds,textGroupIds:c.textGroupIds};this.hls.trigger(S.LEVEL_SWITCHING,_);const g=c.details;if(!g||g.live){const v=this.switchParams(c.uri,o==null?void 0:o.details,g);this.loadPlaylist(v)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(t){this.manualLevelIndex=t,this._startLevel===void 0&&(this._startLevel=t),t!==-1&&(this.level=t)}get firstLevel(){return this._firstLevel}set firstLevel(t){this._firstLevel=t}get startLevel(){if(this._startLevel===void 0){const t=this.hls.config.startLevel;return t!==void 0?t:this.hls.firstAutoLevel}return this._startLevel}set startLevel(t){this._startLevel=t}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(t){if(this.steering){const n=this.steering.pathways(),s=t.filter(o=>n.indexOf(o)!==-1);if(t.length<1){this.warn(`pathwayPriority ${t} should contain at least one pathway from list: ${n}`);return}this.steering.pathwayPriority=s}}onError(t,n){n.fatal||!n.context||n.context.type===Ae.LEVEL&&n.context.level===this.level&&this.checkRetry(n)}onFragBuffered(t,{frag:n}){if(n!==void 0&&n.type===P.MAIN){const s=n.elementaryStreams;if(!Object.keys(s).some(l=>!!s[l]))return;const o=this._levels[n.level];o!=null&&o.loadError&&(this.log(`Resetting level error count of ${o.loadError} on frag buffered`),o.loadError=0)}}onLevelLoaded(t,n){var s;const{level:o,details:l}=n,c=n.levelInfo;if(!c){var d;this.warn(`Invalid level index ${o}`),(d=n.deliveryDirectives)!=null&&d.skip&&(l.deltaUpdateFailed=!0);return}if(c===this.currentLevel||n.withoutMultiVariant){c.fragmentError===0&&(c.loadError=0);let _=c.details;_===n.details&&_.advanced&&(_=void 0),this.playlistLoaded(o,n,_)}else(s=n.deliveryDirectives)!=null&&s.skip&&(l.deltaUpdateFailed=!0)}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,t)}loadingPlaylist(t,n){super.loadingPlaylist(t,n);const s=this.getUrlWithDirectives(t.uri,n),o=this.currentLevelIndex,l=t.attrs["PATHWAY-ID"],c=t.details,d=c==null?void 0:c.age;this.log(`Loading level index ${o}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${l?" Pathway "+l:""}${d&&c.live?" age "+d.toFixed(1)+(c.type?" "+c.type||0:""):""} ${s}`),this.hls.trigger(S.LEVEL_LOADING,{url:s,level:o,levelInfo:t,pathwayId:t.attrs["PATHWAY-ID"],id:0,deliveryDirectives:n||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(t){this.level=t,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=t)}removeLevel(t){var n;if(this._levels.length===1)return;const s=this._levels.filter((l,c)=>c!==t?!0:(this.steering&&this.steering.removeLevel(l),l===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,l.details&&l.details.fragments.forEach(d=>d.level=-1)),!1));Us(s),this._levels=s,this.currentLevelIndex>-1&&(n=this.currentLevel)!=null&&n.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const o=s.length-1;this._firstLevel=Math.min(this._firstLevel,o),this._startLevel&&(this._startLevel=Math.min(this._startLevel,o)),this.hls.trigger(S.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(t,{levels:n}){this._levels=n}checkMaxAutoUpdated(){const{autoLevelCapping:t,maxAutoLevel:n,maxHdcpLevel:s}=this.hls;this._maxAutoLevel!==n&&(this._maxAutoLevel=n,this.hls.trigger(S.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:n,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function Af(h){const t={};h.forEach(n=>{const s=n.groupId||"";n.id=t[s]=t[s]||0,t[s]++})}function Lf(){return self.SourceBuffer||self.WebKitSourceBuffer}function Df(){if(!Ee())return!1;const t=Lf();return!t||t.prototype&&typeof t.prototype.appendBuffer=="function"&&typeof t.prototype.remove=="function"}function Qd(){if(!Df())return!1;const h=Ee();return typeof(h==null?void 0:h.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>h.isTypeSupported(zt(t,"video")))||["mp4a.40.2","fLaC"].some(t=>h.isTypeSupported(zt(t,"audio"))))}function e0(){var h;const t=Lf();return typeof(t==null||(h=t.prototype)==null?void 0:h.changeType)=="function"}const t0=100;class Cf extends Js{constructor(t,n,s){super(t,n,s,"stream-controller",P.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 o=this.media,l=o?o.currentTime:null;if(l===null||!le(l)||(this.log(`Media seeked to ${l.toFixed(3)}`),!this.getBufferedFrag(l)))return;const c=this.getFwdBufferInfoAtPos(o,l,P.MAIN,0);if(c===null||c.len===0){this.warn(`Main forward buffer length at ${l} on "seeked" event ${c?c.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:t}=this;t.on(S.MANIFEST_PARSED,this.onManifestParsed,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.LEVEL_LOADED,this.onLevelLoaded,this),t.on(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(S.BUFFER_CREATED,this.onBufferCreated,this),t.on(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(S.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(S.MANIFEST_PARSED,this.onManifestParsed,this),t.off(S.LEVEL_LOADED,this.onLevelLoaded,this),t.off(S.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(S.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(S.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(S.BUFFER_CREATED,this.onBufferCreated,this),t.off(S.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(S.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(t,n){if(this.levels){const{lastCurrentTime:s,hls:o}=this;if(this.stopLoad(),this.setInterval(t0),this.level=-1,!this.startFragRequested){let l=o.startLevel;l===-1&&(o.config.testBandwidth&&this.levels.length>1?(l=0,this.bitrateTest=!0):l=o.firstAutoLevel),o.nextLoadLevel=l,this.level=o.loadLevel,this._hasEnoughToStart=!!n}s>0&&t===-1&&!n&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),t=s),this.state=kt.IDLE,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=n?-1:t,this.tick()}else this._forceStartLoad=!0,this.state=kt.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case kt.WAITING_LEVEL:{const{levels:t,level:n}=this,s=t==null?void 0:t[n],o=s==null?void 0:s.details;if(o&&(!o.live||this.levelLastLoaded===s&&!this.waitForLive(s))){if(this.waitForCdnTuneIn(o))break;this.state=kt.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=kt.IDLE;break}break}case kt.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===kt.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var t;super.onTickEnd(),(t=this.media)!=null&&t.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:t,levelLastLoaded:n,levels:s,media:o}=this;if(n===null||!o&&!this.primaryPrefetch&&(this.startFragRequested||!t.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const l=this.buffering?t.nextLoadLevel:t.loadLevel;if(!(s!=null&&s[l]))return;const c=s[l],d=this.getMainFwdBufferInfo();if(d===null)return;const _=this.getLevelDetails();if(_&&this._streamEnded(d,_)){const B={};this.altAudio===2&&(B.type="video"),this.hls.trigger(S.BUFFER_EOS,B),this.state=kt.ENDED;return}if(!this.buffering)return;t.loadLevel!==l&&t.manualLevel===-1&&this.log(`Adapting to level ${l} from level ${this.level}`),this.level=t.nextLoadLevel=l;const g=c.details;if(!g||this.state===kt.WAITING_LEVEL||this.waitForLive(c)){this.level=l,this.state=kt.WAITING_LEVEL,this.startFragRequested=!1;return}const v=d.len,y=this.getMaxBufferLength(c.maxBitrate);if(v>=y)return;this.backtrackFragment&&this.backtrackFragment.start>d.end&&(this.backtrackFragment=null);const x=this.backtrackFragment?this.backtrackFragment.start:d.end;let L=this.getNextFragment(x,g);if(this.couldBacktrack&&!this.fragPrevious&&L&&ze(L)&&this.fragmentTracker.getState(L)!==Vi.OK){var M;const F=((M=this.backtrackFragment)!=null?M:L).sn-g.startSN,W=g.fragments[F-1];W&&L.cc===W.cc&&(L=W,this.fragmentTracker.removeFragment(W))}else this.backtrackFragment&&d.len&&(this.backtrackFragment=null);if(L&&this.isLoopLoading(L,x)){if(!L.gap){const F=this.audioOnly&&!this.altAudio?G.AUDIO:G.VIDEO,W=(F===G.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;W&&this.afterBufferFlushed(W,F,P.MAIN)}L=this.getNextFragmentLoopLoading(L,g,d,P.MAIN,y)}L&&(L.initSegment&&!L.initSegment.data&&!this.bitrateTest&&(L=L.initSegment),this.loadFragment(L,c,x))}loadFragment(t,n,s){const o=this.fragmentTracker.getState(t);o===Vi.NOT_LOADED||o===Vi.PARTIAL?ze(t)?this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(t,n)):super.loadFragment(t,n,s):this._loadInitSegment(t,n):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,P.MAIN)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:n}=this;if(n!=null&&n.readyState){let s;const o=this.getAppendedFrag(n.currentTime);o&&o.start>1&&this.flushMainBuffer(0,o.start-1);const l=this.getLevelDetails();if(l!=null&&l.live){const d=this.getMainFwdBufferInfo();if(!d||d.len<l.targetduration*2)return}if(!n.paused&&t){const d=this.hls.nextLoadLevel,_=t[d],g=this.fragLastKbps;g&&this.fragCurrent?s=this.fragCurrent.duration*_.maxBitrate/(1e3*g)+1:s=0}else s=0;const c=this.getBufferedFrag(n.currentTime+s);if(c){const d=this.followingBufferedFrag(c);if(d){this.abortCurrentFrag();const _=d.maxStartPTS?d.maxStartPTS:d.start,g=d.duration,v=Math.max(c.end,_+Math.min(Math.max(g-this.config.maxFragLookUpTolerance,g*(this.couldBacktrack?.5:.125)),g*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(v,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case kt.KEY_LOADING:case kt.FRAG_LOADING:case kt.FRAG_LOADING_WAITING_RETRY:case kt.PARSING:case kt.PARSED:this.state=kt.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(t,n){super.flushMainBuffer(t,n,this.altAudio===2?"video":null)}onMediaAttached(t,n){super.onMediaAttached(t,n);const s=n.media;br(s,"playing",this.onMediaPlaying),br(s,"seeked",this.onMediaSeeked)}onMediaDetaching(t,n){const{media:s}=this;s&&(Cr(s,"playing",this.onMediaPlaying),Cr(s,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(t,n),!n.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(S.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(t,n){let s=!1,o=!1;for(let l=0;l<n.levels.length;l++){const c=n.levels[l].audioCodec;c&&(s=s||c.indexOf("mp4a.40.2")!==-1,o=o||c.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=s&&o&&!e0(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=n.levels,this.startFragRequested=!1}onLevelLoading(t,n){const{levels:s}=this;if(!s||this.state!==kt.IDLE)return;const o=n.levelInfo;(!o.details||o.details.live&&(this.levelLastLoaded!==o||o.details.expired)||this.waitForCdnTuneIn(o.details))&&(this.state=kt.WAITING_LEVEL)}onLevelLoaded(t,n){var s;const{levels:o,startFragRequested:l}=this,c=n.level,d=n.details,_=d.totalduration;if(!o){this.warn(`Levels were reset while loading level ${c}`);return}this.log(`Level ${c} loaded [${d.startSN},${d.endSN}]${d.lastPartSn?`[part-${d.lastPartSn}-${d.lastPartIndex}]`:""}, cc [${d.startCC}, ${d.endCC}] duration:${_}`);const g=n.levelInfo,v=this.fragCurrent;v&&(this.state===kt.FRAG_LOADING||this.state===kt.FRAG_LOADING_WAITING_RETRY)&&v.level!==n.level&&v.loader&&this.abortCurrentFrag();let y=0;if(d.live||(s=g.details)!=null&&s.live){var x;if(this.checkLiveUpdate(d),d.deltaUpdateFailed)return;y=this.alignPlaylists(d,g.details,(x=this.levelLastLoaded)==null?void 0:x.details)}if(g.details=d,this.levelLastLoaded=g,l||this.setStartPosition(d,y),this.hls.trigger(S.LEVEL_UPDATED,{details:d,level:c}),this.state===kt.WAITING_LEVEL){if(this.waitForCdnTuneIn(d))return;this.state=kt.IDLE}l&&d.live&&this.synchronizeToLiveEdge(d),this.tick()}synchronizeToLiveEdge(t){const{config:n,media:s}=this;if(!s)return;const o=this.hls.liveSyncPosition,l=this.getLoadPosition(),c=t.fragmentStart,d=t.edge,_=l>=c-n.maxFragLookUpTolerance&&l<=d;if(o!==null&&s.duration>o&&(l<o||!_)){const v=n.liveMaxLatencyDuration!==void 0?n.liveMaxLatencyDuration:n.liveMaxLatencyDurationCount*t.targetduration;if((!_&&s.readyState<4||l<d-v)&&(this._hasEnoughToStart||(this.nextLoadPosition=o),s.readyState))if(this.warn(`Playback: ${l.toFixed(3)} is located too far from the end of live sliding playlist: ${d}, reset currentTime to : ${o.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var g;const y=mi.bufferInfo(s,o,0);if(!((g=y.buffered)!=null&&g.length)){s.currentTime=o;return}if(y.start<=l){s.currentTime=o;return}const{nextStart:L}=mi.bufferedInfo(y.buffered,l,0);L&&(s.currentTime=L)}else s.currentTime=o}}_handleFragmentLoadProgress(t){var n;const s=t.frag,{part:o,payload:l}=t,{levels:c}=this;if(!c){this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);return}const d=c[s.level];if(!d){this.warn(`Level ${s.level} not found on progress`);return}const _=d.details;if(!_){this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),this.fragmentTracker.removeFragment(s);return}const g=d.videoCodec,v=_.PTSKnown||!_.live,y=(n=s.initSegment)==null?void 0:n.data,x=this._getAudioCodec(d),L=this.transmuxer=this.transmuxer||new mu(this.hls,P.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),M=o?o.index:-1,B=M!==-1,F=new Sn(s.level,s.sn,s.stats.chunkCount,l.byteLength,M,B),W=this.initPTS[s.cc];L.push(l,y,x,g,s,o,_.totalduration,v,F,W)}onAudioTrackSwitching(t,n){const s=this.hls,o=this.altAudio===2;if(Zi(n.url,s))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 c=this.fragCurrent;c&&(this.log("Switching to main audio track, cancel main fragment load"),c.abortRequests(),this.fragmentTracker.removeFragment(c)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(o){this.fragmentTracker.removeAllFragments(),s.once(S.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(S.AUDIO_TRACK_SWITCHED,n)}),s.trigger(S.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}s.trigger(S.AUDIO_TRACK_SWITCHED,n)}}onAudioTrackSwitched(t,n){const s=Zi(n.url,this.hls);if(s){const o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=s?2:0,this.tick()}onBufferCreated(t,n){const s=n.tracks;let o,l,c=!1;for(const d in s){const _=s[d];if(_.id==="main"){if(l=d,o=_,d==="video"){const g=s[d];g&&(this.videoBuffer=g.buffer)}}else c=!0}c&&o?(this.log(`Alternate track found, use ${l}.buffered to schedule main fragment loading`),this.mediaBuffer=o.buffer):this.mediaBuffer=this.media}onFragBuffered(t,n){const{frag:s,part:o}=n,l=s.type===P.MAIN;if(l){if(this.fragContextChanged(s)){this.warn(`Fragment ${s.sn}${o?" p: "+o.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),this.state===kt.PARSED&&(this.state=kt.IDLE);return}const d=o?o.stats:s.stats;this.fragLastKbps=Math.round(8*d.total/(d.buffering.end-d.loading.first)),ze(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,o)}const c=this.media;c&&(!this._hasEnoughToStart&&mi.getBuffered(c).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),l&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(t,n){var s;if(n.fatal){this.state=kt.ERROR;return}switch(n.details){case Z.FRAG_GAP:case Z.FRAG_PARSING_ERROR:case Z.FRAG_DECRYPT_ERROR:case Z.FRAG_LOAD_ERROR:case Z.FRAG_LOAD_TIMEOUT:case Z.KEY_LOAD_ERROR:case Z.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(P.MAIN,n);break;case Z.LEVEL_LOAD_ERROR:case Z.LEVEL_LOAD_TIMEOUT:case Z.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===kt.WAITING_LEVEL&&((s=n.context)==null?void 0:s.type)===Ae.LEVEL&&(this.state=kt.IDLE);break;case Z.BUFFER_ADD_CODEC_ERROR:case Z.BUFFER_APPEND_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.resetLoadingState();break;case Z.BUFFER_FULL_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case Z.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onFragLoadEmergencyAborted(){this.state=kt.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(t,{type:n}){if(n!==G.AUDIO||!this.altAudio){const s=(n===G.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,n,P.MAIN),this.tick())}}onLevelsUpdated(t,n){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=n.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const n=t.currentTime;let s=this.startPosition;if(s>=0&&n<s){if(t.seeking){this.log(`could not seek to ${s}, already seeking at ${n}`);return}const o=this.timelineOffset;o&&s&&(s+=o);const l=this.getLevelDetails(),c=mi.getBuffered(t),d=c.length?c.start(0):0,_=d-s,g=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||_>0&&(_<g||this.loadingParts&&_<2*((l==null?void 0:l.partTarget)||0)))&&(this.log(`adjusting start position by ${_} to match buffer start`),s+=_,this.startPosition=s),n<s&&(this.log(`seek to target start position ${s} from current time ${n} buffer start ${d}`),t.currentTime=s)}}_getAudioCodec(t){let n=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&n&&(this.log("Swapping audio codec"),n.indexOf("mp4a.40.5")!==-1?n="mp4a.40.2":n="mp4a.40.5"),n}_loadBitrateTestFrag(t,n){t.bitrateTest=!0,this._doFragLoad(t,n).then(s=>{const{hls:o}=this,l=s==null?void 0:s.frag;if(!l||this.fragContextChanged(l))return;n.fragmentError=0,this.state=kt.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const c=l.stats;c.parsing.start=c.parsing.end=c.buffering.start=c.buffering.end=self.performance.now(),o.trigger(S.FRAG_LOADED,s),l.bitrateTest=!1}).catch(s=>{this.state===kt.STOPPED||this.state===kt.ERROR||(this.warn(s),this.resetFragmentLoading(t))})}_handleTransmuxComplete(t){const n=this.playlistType,{hls:s}=this,{remuxResult:o,chunkMeta:l}=t,c=this.getCurrentContext(l);if(!c){this.resetWhenMissingContext(l);return}const{frag:d,part:_,level:g}=c,{video:v,text:y,id3:x,initSegment:L}=o,{details:M}=g,B=this.altAudio?void 0:o.audio;if(this.fragContextChanged(d)){this.fragmentTracker.removeFragment(d);return}if(this.state=kt.PARSING,L){const F=L.tracks;if(F){const Pe=d.initSegment||d;if(this.unhandledEncryptionError(L,d))return;this._bufferInitSegment(g,F,Pe,l),s.trigger(S.FRAG_PARSING_INIT_SEGMENT,{frag:Pe,id:n,tracks:F})}const W=L.initPTS,_e=L.timescale,ce=this.initPTS[d.cc];if(le(W)&&(!ce||ce.baseTime!==W||ce.timescale!==_e)){const Pe=L.trackId;this.initPTS[d.cc]={baseTime:W,timescale:_e,trackId:Pe},s.trigger(S.INIT_PTS_FOUND,{frag:d,id:n,initPTS:W,timescale:_e,trackId:Pe})}}if(v&&M){B&&v.type==="audiovideo"&&this.logMuxedErr(d);const F=M.fragments[d.sn-1-M.startSN],W=d.sn===M.startSN,_e=!F||d.cc>F.cc;if(o.independent!==!1){const{startPTS:ce,endPTS:Pe,startDTS:Ue,endDTS:dt}=v;if(_)_.elementaryStreams[v.type]={startPTS:ce,endPTS:Pe,startDTS:Ue,endDTS:dt};else if(v.firstKeyFrame&&v.independent&&l.id===1&&!_e&&(this.couldBacktrack=!0),v.dropped&&v.independent){const $e=this.getMainFwdBufferInfo(),Qe=($e?$e.end:this.getLoadPosition())+this.config.maxBufferHole,et=v.firstKeyFramePTS?v.firstKeyFramePTS:ce;if(!W&&Qe<et-this.config.maxBufferHole&&!_e){this.backtrack(d);return}else _e&&(d.gap=!0);d.setElementaryStreamInfo(v.type,d.start,Pe,d.start,dt,!0)}else W&&ce-(M.appliedTimelineOffset||0)>Bu&&(d.gap=!0);d.setElementaryStreamInfo(v.type,ce,Pe,Ue,dt),this.backtrackFragment&&(this.backtrackFragment=d),this.bufferFragmentData(v,d,_,l,W||_e)}else if(W||_e)d.gap=!0;else{this.backtrack(d);return}}if(B){const{startPTS:F,endPTS:W,startDTS:_e,endDTS:ce}=B;_&&(_.elementaryStreams[G.AUDIO]={startPTS:F,endPTS:W,startDTS:_e,endDTS:ce}),d.setElementaryStreamInfo(G.AUDIO,F,W,_e,ce),this.bufferFragmentData(B,d,_,l)}if(M&&x!=null&&x.samples.length){const F={id:n,frag:d,details:M,samples:x.samples};s.trigger(S.FRAG_PARSING_METADATA,F)}if(M&&y){const F={id:n,frag:d,details:M,samples:y.samples};s.trigger(S.FRAG_PARSING_USERDATA,F)}}logMuxedErr(t){this.warn(`${ze(t)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${t.url}`)}_bufferInitSegment(t,n,s,o){if(this.state!==kt.PARSING)return;this.audioOnly=!!n.audio&&!n.video,this.altAudio&&!this.audioOnly&&(delete n.audio,n.audiovideo&&this.logMuxedErr(s));const{audio:l,video:c,audiovideo:d}=n;if(l){const g=t.audioCodec;let v=ve(l.codec,g);v==="mp4a"&&(v="mp4a.40.5");const y=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){v&&(v.indexOf("mp4a.40.5")!==-1?v="mp4a.40.2":v="mp4a.40.5");const x=l.metadata;x&&"channelCount"in x&&(x.channelCount||1)!==1&&y.indexOf("firefox")===-1&&(v="mp4a.40.5")}v&&v.indexOf("mp4a.40.5")!==-1&&y.indexOf("android")!==-1&&l.container!=="audio/mpeg"&&(v="mp4a.40.2",this.log(`Android: force audio codec to ${v}`)),g&&g!==v&&this.log(`Swapping manifest audio codec "${g}" for "${v}"`),l.levelCodec=v,l.id=P.MAIN,this.log(`Init audio buffer, container:${l.container}, codecs[selected/level/parsed]=[${v||""}/${g||""}/${l.codec}]`),delete n.audiovideo}if(c){c.levelCodec=t.videoCodec,c.id=P.MAIN;const g=c.codec;if((g==null?void 0:g.length)===4)switch(g){case"hvc1":case"hev1":c.codec="hvc1.1.6.L120.90";break;case"av01":c.codec="av01.0.04M.08";break;case"avc1":c.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${c.container}, codecs[level/parsed]=[${t.videoCodec||""}/${g}]${c.codec!==g?" parsed-corrected="+c.codec:""}${c.supplemental?" supplemental="+c.supplemental:""}`),delete n.audiovideo}d&&(this.log(`Init audiovideo buffer, container:${d.container}, codecs[level/parsed]=[${t.codecs}/${d.codec}]`),delete n.video,delete n.audio);const _=Object.keys(n);if(_.length){if(this.hls.trigger(S.BUFFER_CODECS,n),!this.hls)return;_.forEach(g=>{const y=n[g].initSegment;y!=null&&y.byteLength&&this.hls.trigger(S.BUFFER_APPENDING,{type:g,data:y,frag:s,part:null,chunkMeta:o,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const t=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(t,P.MAIN)}get maxBufferLength(){const{levels:t,level:n}=this,s=t==null?void 0:t[n];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=kt.IDLE}checkFragmentChanged(){const t=this.media;let n=null;if(t&&t.readyState>1&&t.seeking===!1){const s=t.currentTime;if(mi.isBuffered(t,s)?n=this.getAppendedFrag(s):mi.isBuffered(t,s+.1)&&(n=this.getAppendedFrag(s+.1)),n){this.backtrackFragment=null;const o=this.fragPlaying,l=n.level;(!o||n.sn!==o.sn||o.level!==l)&&(this.fragPlaying=n,this.hls.trigger(S.FRAG_CHANGED,{frag:n}),(!o||o.level!==l)&&this.hls.trigger(S.LEVEL_SWITCHED,{level:l}))}}}get nextLevel(){const t=this.nextBufferedFrag;return t?t.level:-1}get currentFrag(){var t;if(this.fragPlaying)return this.fragPlaying;const n=((t=this.media)==null?void 0:t.currentTime)||this.lastCurrentTime;return le(n)?this.getAppendedFrag(n):null}get currentProgramDateTime(){var t;const n=((t=this.media)==null?void 0:t.currentTime)||this.lastCurrentTime;if(le(n)){const s=this.getLevelDetails(),o=this.currentFrag||(s?Ni(null,s.fragments,n):null);if(o){const l=o.programDateTime;if(l!==null){const c=l+(n-o.start)*1e3;return new Date(c)}}}return null}get currentLevel(){const t=this.currentFrag;return t?t.level:-1}get nextBufferedFrag(){const t=this.currentFrag;return t?this.followingBufferedFrag(t):null}get forceStartLoad(){return this._forceStartLoad}}class il extends H{constructor(t,n){super("key-loader",n),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const s in this.keyIdToKeyInfo){const o=this.keyIdToKeyInfo[s].loader;if(o){var n;if(t&&t!==((n=o.context)==null?void 0:n.frag.type))return;o.abort()}}}detach(){for(const t in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[t];(n.mediaKeySessionContext||n.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[t].loader;n&&n.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(t,n=Z.KEY_LOAD_ERROR,s,o,l){return new Kn({type:pe.NETWORK_ERROR,details:n,fatal:!1,frag:t,response:l,error:s,networkDetails:o})}loadClear(t,n,s){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(n.length)for(let o=0,l=n.length;o<l;o++){const c=n[o];if(t.cc<=c.cc&&(!ze(t)||!ze(c)||t.sn<c.sn)||!s&&o==l-1)return this.emeController.selectKeySystemFormat(c).then(d=>{if(!this.emeController)return;c.setKeyFormat(d);const _=$s(d);if(_)return this.emeController.getKeySystemAccess([_])})}if(this.config.requireKeySystemAccessOnStart){const o=Li(this.config);if(o.length)return this.emeController.getKeySystemAccess(o)}}return null}load(t){return!t.decryptdata&&t.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(t).then(n=>this.loadInternal(t,n)):this.loadInternal(t)}loadInternal(t,n){var s,o;n&&t.setKeyFormat(n);const l=t.decryptdata;if(!l){const v=new Error(n?`Expected frag.decryptdata to be defined after setting format ${n}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(t,Z.KEY_LOAD_ERROR,v))}const c=l.uri;if(!c)return Promise.reject(this.createKeyLoadError(t,Z.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${c}"`)));const d=Yc(l);let _=this.keyIdToKeyInfo[d];if((s=_)!=null&&s.decryptdata.key)return l.key=_.decryptdata.key,Promise.resolve({frag:t,keyInfo:_});if((o=_)!=null&&o.keyLoadPromise){var g;switch((g=_.mediaKeySessionContext)==null?void 0:g.keyStatus){case"usable":case"usable-in-future":return _.keyLoadPromise.then(y=>{const{keyInfo:x}=y;return l.key=x.decryptdata.key,{frag:t,keyInfo:x}})}}switch(this.log(`Loading key ${te(l.keyId||[])} from ${t.type} ${t.level}`),_=this.keyIdToKeyInfo[d]={decryptdata:l,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},l.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return l.keyFormat==="identity"?this.loadKeyHTTP(_,t):this.loadKeyEME(_,t);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(_,t);default:return Promise.reject(this.createKeyLoadError(t,Z.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${l.method}"`)))}}loadKeyEME(t,n){const s={frag:n,keyInfo:t};if(this.emeController&&this.config.emeEnabled){const o=this.emeController.loadKey(s);return(t.keyLoadPromise=o.then(l=>(t.mediaKeySessionContext=l,s))).catch(l=>{throw t.keyLoadPromise=null,l.data&&(l.data.frag=n),l})}return Promise.resolve(s)}loadKeyHTTP(t,n){const s=this.config,o=s.loader,l=new o(s);return n.keyLoader=t.loader=l,t.keyLoadPromise=new Promise((c,d)=>{const _={keyInfo:t,frag:n,responseType:"arraybuffer",url:t.decryptdata.uri},g=s.keyLoadPolicy.default,v={loadPolicy:g,timeout:g.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},y={onSuccess:(x,L,M,B)=>{const{frag:F,keyInfo:W,url:_e}=M,ce=Yc(W.decryptdata)||_e;if(!F.decryptdata||W!==this.keyIdToKeyInfo[ce])return d(this.createKeyLoadError(F,Z.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),B));W.decryptdata.key=F.decryptdata.key=new Uint8Array(x.data),F.keyLoader=null,W.loader=null,c({frag:F,keyInfo:W})},onError:(x,L,M,B)=>{this.resetLoader(L),d(this.createKeyLoadError(n,Z.KEY_LOAD_ERROR,new Error(`HTTP Error ${x.code} loading key ${x.text}`),M,C({url:_.url,data:void 0},x)))},onTimeout:(x,L,M)=>{this.resetLoader(L),d(this.createKeyLoadError(n,Z.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),M))},onAbort:(x,L,M)=>{this.resetLoader(L),d(this.createKeyLoadError(n,Z.INTERNAL_ABORTED,new Error("key loading aborted"),M))}};l.load(_,v,y)})}resetLoader(t){const{frag:n,keyInfo:s,url:o}=t,l=s.loader;n.keyLoader===l&&(n.keyLoader=null,s.loader=null);const c=Yc(s.decryptdata)||o;delete this.keyIdToKeyInfo[c],l&&l.destroy()}}function Yc(h){const t=h.keyId;return t?te(t):h.uri}function nl(h){const{type:t}=h;switch(t){case Ae.AUDIO_TRACK:return P.AUDIO;case Ae.SUBTITLE_TRACK:return P.SUBTITLE;default:return P.MAIN}}function vo(h,t){let n=h.url;return(n===void 0||n.indexOf("data:")===0)&&(n=t.url),n}class Xc{constructor(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=t,this.registerListeners()}startLoad(t){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:t}=this;t.on(S.MANIFEST_LOADING,this.onManifestLoading,this),t.on(S.LEVEL_LOADING,this.onLevelLoading,this),t.on(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.on(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:t}=this;t.off(S.MANIFEST_LOADING,this.onManifestLoading,this),t.off(S.LEVEL_LOADING,this.onLevelLoading,this),t.off(S.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(S.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.off(S.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(t){const n=this.hls.config,s=n.pLoader,o=n.loader,l=s||o,c=new l(n);return this.loaders[t.type]=c,c}getInternalLoader(t){return this.loaders[t.type]}resetInternalLoader(t){this.loaders[t]&&delete this.loaders[t]}destroyInternalLoaders(){for(const t in this.loaders){const n=this.loaders[t];n&&n.destroy(),this.resetInternalLoader(t)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(t,n){const{url:s}=n;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ae.MANIFEST,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(t,n){const{id:s,level:o,pathwayId:l,url:c,deliveryDirectives:d,levelInfo:_}=n;this.load({id:s,level:o,pathwayId:l,responseType:"text",type:Ae.LEVEL,url:c,deliveryDirectives:d,levelOrTrack:_})}onAudioTrackLoading(t,n){const{id:s,groupId:o,url:l,deliveryDirectives:c,track:d}=n;this.load({id:s,groupId:o,level:null,responseType:"text",type:Ae.AUDIO_TRACK,url:l,deliveryDirectives:c,levelOrTrack:d})}onSubtitleTrackLoading(t,n){const{id:s,groupId:o,url:l,deliveryDirectives:c,track:d}=n;this.load({id:s,groupId:o,level:null,responseType:"text",type:Ae.SUBTITLE_TRACK,url:l,deliveryDirectives:c,levelOrTrack:d})}onLevelsUpdated(t,n){const s=this.loaders[Ae.LEVEL];if(s){const o=s.context;o&&!n.levels.some(l=>l===o.levelOrTrack)&&(s.abort(),delete this.loaders[Ae.LEVEL])}}load(t){var n;const s=this.hls.config;let o=this.getInternalLoader(t);if(o){const g=this.hls.logger,v=o.context;if(v&&v.levelOrTrack===t.levelOrTrack&&(v.url===t.url||v.deliveryDirectives&&!t.deliveryDirectives)){v.url===t.url?g.log(`[playlist-loader]: ignore ${t.url} ongoing request`):g.log(`[playlist-loader]: ignore ${t.url} in favor of ${v.url}`);return}g.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),o.abort()}let l;if(t.type===Ae.MANIFEST?l=s.manifestLoadPolicy.default:l=k({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),o=this.createInternalLoader(t),le((n=t.deliveryDirectives)==null?void 0:n.part)){let g;if(t.type===Ae.LEVEL&&t.level!==null?g=this.hls.levels[t.level].details:t.type===Ae.AUDIO_TRACK&&t.id!==null?g=this.hls.audioTracks[t.id].details:t.type===Ae.SUBTITLE_TRACK&&t.id!==null&&(g=this.hls.subtitleTracks[t.id].details),g){const v=g.partTarget,y=g.targetduration;if(v&&y){const x=Math.max(v*3,y*.8)*1e3;l=k({},l,{maxTimeToFirstByteMs:Math.min(x,l.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(x,l.maxTimeToFirstByteMs)})}}}const c=l.errorRetry||l.timeoutRetry||{},d={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:c.maxNumRetry||0,retryDelay:c.retryDelayMs||0,maxRetryDelay:c.maxRetryDelayMs||0},_={onSuccess:(g,v,y,x)=>{const L=this.getInternalLoader(y);this.resetInternalLoader(y.type);const M=g.data;if(M.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(g,y,new Error("no EXTM3U delimiter"),x||null,v);return}v.parsing.start=performance.now(),qr.isMediaPlaylist(M)||y.type!==Ae.MANIFEST?this.handleTrackOrLevelPlaylist(g,v,y,x||null,L):this.handleMasterPlaylist(g,v,y,x)},onError:(g,v,y,x)=>{this.handleNetworkError(v,y,!1,g,x)},onTimeout:(g,v,y)=>{this.handleNetworkError(v,y,!0,void 0,g)}};o.load(t,d,_)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:t,startPosition:n},forceStartLoad:s}=this.hls;(t||s)&&(this.hls.logger.log(`${t?"auto":"force"} startLoad with configured startPosition ${n}`),this.hls.startLoad(n))}handleMasterPlaylist(t,n,s,o){const l=this.hls,c=t.data,d=vo(t,s),_=qr.parseMasterPlaylist(c,d);if(_.playlistParsingError){this.handleManifestParsingError(t,s,_.playlistParsingError,o,n);return}const{contentSteering:g,levels:v,sessionData:y,sessionKeys:x,startTimeOffset:L,variableList:M}=_;this.variableList=M;const{AUDIO:B=[],SUBTITLES:F,"CLOSED-CAPTIONS":W}=qr.parseMasterPlaylistMedia(c,d,_);B.length&&!B.some(ce=>!ce.url)&&v[0].audioCodec&&!v[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),B.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new qi({}),bitrate:0,url:""})),l.trigger(S.MANIFEST_LOADED,{levels:v,audioTracks:B,subtitles:F,captions:W,contentSteering:g,url:d,stats:n,networkDetails:o,sessionData:y,sessionKeys:x,startTimeOffset:L,variableList:M})}handleTrackOrLevelPlaylist(t,n,s,o,l){const c=this.hls,{id:d,level:_,type:g}=s,v=vo(t,s),y=le(_)?_:le(d)?d:0,x=nl(s),L=qr.parseLevelPlaylist(t.data,v,y,x,0,this.variableList);if(g===Ae.MANIFEST){const M={attrs:new qi({}),bitrate:0,details:L,name:"",url:v};L.requestScheduled=n.loading.start+Ys(L,0),c.trigger(S.MANIFEST_LOADED,{levels:[M],audioTracks:[],url:v,stats:n,networkDetails:o,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}n.parsing.end=performance.now(),s.levelDetails=L,this.handlePlaylistLoaded(L,t,n,s,o,l)}handleManifestParsingError(t,n,s,o,l){this.hls.trigger(S.ERROR,{type:pe.NETWORK_ERROR,details:Z.MANIFEST_PARSING_ERROR,fatal:n.type===Ae.MANIFEST,url:t.url,err:s,error:s,reason:s.message,response:t,context:n,networkDetails:o,stats:l})}handleNetworkError(t,n,s=!1,o,l){let c=`A network ${s?"timeout":"error"+(o?" (status "+o.code+")":"")} occurred while loading ${t.type}`;t.type===Ae.LEVEL?c+=`: ${t.level} id: ${t.id}`:(t.type===Ae.AUDIO_TRACK||t.type===Ae.SUBTITLE_TRACK)&&(c+=` id: ${t.id} group-id: "${t.groupId}"`);const d=new Error(c);this.hls.logger.warn(`[playlist-loader]: ${c}`);let _=Z.UNKNOWN,g=!1;const v=this.getInternalLoader(t);switch(t.type){case Ae.MANIFEST:_=s?Z.MANIFEST_LOAD_TIMEOUT:Z.MANIFEST_LOAD_ERROR,g=!0;break;case Ae.LEVEL:_=s?Z.LEVEL_LOAD_TIMEOUT:Z.LEVEL_LOAD_ERROR,g=!1;break;case Ae.AUDIO_TRACK:_=s?Z.AUDIO_TRACK_LOAD_TIMEOUT:Z.AUDIO_TRACK_LOAD_ERROR,g=!1;break;case Ae.SUBTITLE_TRACK:_=s?Z.SUBTITLE_TRACK_LOAD_TIMEOUT:Z.SUBTITLE_LOAD_ERROR,g=!1;break}v&&this.resetInternalLoader(t.type);const y={type:pe.NETWORK_ERROR,details:_,fatal:g,url:t.url,loader:v,context:t,error:d,networkDetails:n,stats:l};if(o){const x=(n==null?void 0:n.url)||t.url;y.response=C({url:x,data:void 0},o)}this.hls.trigger(S.ERROR,y)}handlePlaylistLoaded(t,n,s,o,l,c){const d=this.hls,{type:_,level:g,id:v,groupId:y,deliveryDirectives:x}=o,L=vo(n,o),M=nl(o),B=typeof o.level=="number"&&M===P.MAIN?g:void 0;if(!t.fragments.length){const W=t.playlistParsingError=new Error("No Segments found in Playlist");d.trigger(S.ERROR,{type:pe.NETWORK_ERROR,details:Z.LEVEL_EMPTY_ERROR,fatal:!1,url:L,error:W,reason:W.message,response:n,context:o,level:B,parent:M,networkDetails:l,stats:s});return}t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));const F=t.playlistParsingError;if(F){if(this.hls.logger.warn(`${F} ${t.url}`),!d.config.ignorePlaylistParsingErrors){d.trigger(S.ERROR,{type:pe.NETWORK_ERROR,details:Z.LEVEL_PARSING_ERROR,fatal:!1,url:L,error:F,reason:F.message,response:n,context:o,level:B,parent:M,networkDetails:l,stats:s});return}t.playlistParsingError=null}switch(t.live&&c&&(c.getCacheAge&&(t.ageHeader=c.getCacheAge()||0),(!c.getCacheAge||isNaN(t.ageHeader))&&(t.ageHeader=0)),_){case Ae.MANIFEST:case Ae.LEVEL:d.trigger(S.LEVEL_LOADED,{details:t,levelInfo:o.levelOrTrack||d.levels[0],level:B||0,id:v||0,stats:s,networkDetails:l,deliveryDirectives:x,withoutMultiVariant:_===Ae.MANIFEST});break;case Ae.AUDIO_TRACK:d.trigger(S.AUDIO_TRACK_LOADED,{details:t,track:o.levelOrTrack,id:v||0,groupId:y||"",stats:s,networkDetails:l,deliveryDirectives:x});break;case Ae.SUBTITLE_TRACK:d.trigger(S.SUBTITLE_TRACK_LOADED,{details:t,track:o.levelOrTrack,id:v||0,groupId:y||"",stats:s,networkDetails:l,deliveryDirectives:x});break}}}class Ir{static get version(){return Ro}static isMSESupported(){return Df()}static isSupported(){return Qd()}static getMediaSource(){return Ee()}static get Events(){return S}static get MetadataSchema(){return fs}static get ErrorTypes(){return pe}static get ErrorDetails(){return Z}static get DefaultConfig(){return Ir.defaultConfig?Ir.defaultConfig:zd}static set DefaultConfig(t){Ir.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new eu,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 n=this.logger=Te(t.debug||!1,"Hls instance",t.assetPlayerId),s=this.config=Gd(Ir.DefaultConfig,t,n);this.userConfig=t,s.progressive&&kf(s,n);const{abrController:o,bufferController:l,capLevelController:c,errorController:d,fpsController:_}=s,g=new d(this),v=this.abrController=new o(this),y=new bn(this),x=s.interstitialsController,L=x?this.interstitialsController=new x(this,Ir):null,M=this.bufferController=new l(this,y),B=this.capLevelController=new c(this),F=new _(this),W=new Xc(this),_e=s.contentSteeringController,ce=_e?new _e(this):null,Pe=this.levelController=new Jd(this,ce),Ue=new Yd(this),dt=new il(this.config,this.logger),$e=this.streamController=new Cf(this,y,dt),Qe=this.gapController=new qd(this,y);B.setStreamController($e),F.setStreamController($e);const et=[W,Pe,$e];L&&et.splice(1,0,L),ce&&et.splice(1,0,ce),this.networkControllers=et;const Be=[v,M,Qe,B,F,Ue,y];this.audioTrackController=this.createController(s.audioTrackController,et);const Tt=s.audioStreamController;Tt&&et.push(this.audioStreamController=new Tt(this,y,dt)),this.subtitleTrackController=this.createController(s.subtitleTrackController,et);const ti=s.subtitleStreamController;ti&&et.push(this.subtititleStreamController=new ti(this,y,dt)),this.createController(s.timelineController,Be),dt.emeController=this.emeController=this.createController(s.emeController,Be),this.cmcdController=this.createController(s.cmcdController,Be),this.latencyController=this.createController(Xd,Be),this.coreComponents=Be,et.push(g);const hi=g.onErrorOut;typeof hi=="function"&&this.on(S.ERROR,hi,g),this.on(S.MANIFEST_LOADED,W.onManifestLoaded,W)}createController(t,n){if(t){const s=new t(this);return n&&n.push(s),s}return null}on(t,n,s=this){this._emitter.on(t,n,s)}once(t,n,s=this){this._emitter.once(t,n,s)}removeAllListeners(t){this._emitter.removeAllListeners(t)}off(t,n,s=this,o){this._emitter.off(t,n,s,o)}listeners(t){return this._emitter.listeners(t)}emit(t,n,s){return this._emitter.emit(t,n,s)}trigger(t,n){if(this.config.debug)return this.emit(t,t,n);try{return this.emit(t,t,n)}catch(s){if(this.logger.error("An internal error happened while handling event "+t+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const o=t===S.ERROR;this.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.INTERNAL_EXCEPTION,fatal:o,event:t,error:s}),this.triggeringException=!1}}return!1}listenerCount(t){return this._emitter.listenerCount(t)}destroy(){this.logger.log("destroy"),this.trigger(S.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(n=>n.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(n=>n.destroy()),this.coreComponents.length=0;const t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){if(!t||"media"in t&&!t.media){const l=new Error(`attachMedia failed: invalid argument (${t})`);this.trigger(S.ERROR,{type:pe.OTHER_ERROR,details:Z.ATTACH_MEDIA_ERROR,fatal:!0,error:l});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const n="media"in t,s=n?t.media:t,o=n?t:{media:s};this._media=s,this.trigger(S.MEDIA_ATTACHING,o)}detachMedia(){this.logger.log("detachMedia"),this.trigger(S.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const t=this.bufferController.transferMedia();return this.trigger(S.MEDIA_DETACHING,{transferMedia:t}),t}loadSource(t){this.stopLoad();const n=this.media,s=this._url,o=this._url=A.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${o}`),n&&s&&(s!==o||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(n)),this.trigger(S.MANIFEST_LOADING,{url:t})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(t=-1,n){this.logger.log(`startLoad(${t+(n?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s<this.networkControllers.length&&(this.networkControllers[s].startLoad(t,n),!(!this.started||!this.networkControllers));s++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].stopLoad(),!(this.started||!this.networkControllers));t++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(t=>{t.resumeBuffering&&t.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(t=>{t.pauseBuffering&&t.pauseBuffering()}))}get inFlightFragments(){const t={[P.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(t[P.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(t[P.SUBTITLE]=this.subtititleStreamController.inFlightFrag),t}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const t=this._media,n=t==null?void 0:t.currentTime;this.detachMedia(),t&&(this.attachMedia(t),n&&this.startLoad(n))}removeLevel(t){this.levelController.removeLevel(t)}get sessionId(){let t=this._sessionId;return t||(t=this._sessionId=Ed()),t}get levels(){const t=this.levelController.levels;return t||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){this.logger.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){this.logger.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){this.logger.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){this.logger.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){const t=this.levelController.startLevel;return t===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){this.logger.log(`set startLevel:${t}`),t!==-1&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){const n=!!t;n!==this.config.capLevelToPlayerSize&&(n?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=n)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get abrEwmaDefaultEstimate(){const{bwEstimator:t}=this.abrController;return t?t.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this._autoLevelCapping!==t&&(this.logger.log(`set autoLevelCapping:${t}`),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(t){Yi(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:t,config:{minAutoBitrate:n}}=this;if(!t)return 0;const s=t.length;for(let o=0;o<s;o++)if(t[o].maxBitrate>=n)return o;return 0}get maxAutoLevel(){const{levels:t,autoLevelCapping:n,maxHdcpLevel:s}=this;let o;if(n===-1&&t!=null&&t.length?o=t.length-1:o=n,s)for(let l=o;l--;){const c=t[l].attrs["HDCP-LEVEL"];if(c&&c<=s)return l}return o}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(t){var n;return((n=this.audioTrackController)==null?void 0:n.setAudioOption(t))||null}setSubtitleOption(t){var n;return((n=this.subtitleTrackController)==null?void 0:n.setSubtitleOption(t))||null}get allAudioTracks(){const t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){const t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){const t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){const n=this.audioTrackController;n&&(n.audioTrack=t)}get allSubtitleTracks(){const t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){const t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){const t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(t){const n=this.subtitleTrackController;n&&(n.subtitleTrack=t)}get subtitleDisplay(){const t=this.subtitleTrackController;return t?t.subtitleDisplay:!1}set subtitleDisplay(t){const n=this.subtitleTrackController;n&&(n.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}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(t){this.latencyController.targetLatency=t}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(t){this.levelController.pathwayPriority=t}get bufferedToEnd(){var t;return!!((t=this.bufferController)!=null&&t.bufferedToEnd)}get interstitialsManager(){var t;return((t=this.interstitialsController)==null?void 0:t.interstitialsManager)||null}getMediaDecodingInfo(t,n=this.allAudioTracks){const s=Re(n);return Ei(t,s,navigator.mediaCapabilities)}}Ir.defaultConfig=void 0},48136:function(Ci,Bt,re){"use strict";var le=Object.defineProperty,we=Object.defineProperties,Ze=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,Ae=(e,i,r)=>i in e?le(e,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[i]=r,P=(e,i)=>{for(var r in i||(i={}))Z.call(i,r)&&Ae(e,r,i[r]);if(pe)for(var r of pe(i))S.call(i,r)&&Ae(e,r,i[r]);return e},f=(e,i)=>we(e,Ze(i)),ie=e=>typeof e=="symbol"?e:e+"",R=(e,i)=>{var r={};for(var a in e)Z.call(e,a)&&i.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&pe)for(var a of pe(e))i.indexOf(a)<0&&S.call(e,a)&&(r[a]=e[a]);return r};function k(e){return Array.isArray(e)}var T={en:{"keyboard.tooltip.symbols":"\u7B26\u53F7","keyboard.tooltip.greek":"\u5E0C\u814A\u5B57\u6BCD","keyboard.tooltip.numeric":"\u6570\u5B57","keyboard.tooltip.alphabetic":"\u7F57\u9A6C\u5B57\u6BCD","tooltip.cut to clipboard":"\u526A\u5207\u5230\u526A\u8D34\u677F","tooltip.copy to clipboard":"\u590D\u5236\u5230\u526A\u8D34\u677F","tooltip.paste from clipboard":"\u7C98\u8D34","tooltip.redo":"\u91CD\u505A","tooltip.toggle virtual keyboard":"\u5207\u6362\u865A\u62DF\u952E\u76D8","tooltip.undo":"\u64A4\u6D88","menu.insert matrix":"\u63D2\u5165\u77E9\u9635","menu.borders":"\u77E9\u9635\u5206\u9694\u7B26","menu.array.add row above":"\u5728\u540E\u9762\u6DFB\u52A0\u884C","menu.array.add row below":"\u5728\u524D\u9762\u6DFB\u52A0\u884C","menu.array.add column after":"\u5728\u540E\u9762\u6DFB\u52A0\u5217r","menu.array.add column before":"\u5728\u524D\u9762\u6DFB\u52A0\u5217","menu.array.delete row":"\u5220\u9664\u884C","menu.array.delete rows":"\u5220\u9664\u9009\u5B9A\u884C","menu.array.delete column":"\u5220\u9664\u5217","menu.array.delete columns":"\u5220\u9664\u9009\u5B9A\u7684\u5217","menu.mode":"\u6A21\u5F0F","menu.mode-math":"\u6570\u5B66","menu.mode-text":"\u6587\u672C","menu.mode-latex":"LaTeX","tooltip.blackboard":"\u9ED1\u677F","tooltip.bold":"\u7C97\u4F53","tooltip.italic":"\u659C\u4F53","tooltip.fraktur":"Fraktur","tooltip.script":"\u811A\u672C","tooltip.caligraphic":"\u8349\u4E66","tooltip.typewriter":"\u6253\u5B57\u673A","tooltip.roman-upright":"\u7F57\u9A6C\u76F4\u7ACB","tooltip.row-by-col":"%@ \xD7 %@","menu.font-style":"\u5B57\u4F53\u6837\u5F0F","menu.accent":"\u91CD\u97F3","menu.decoration":"\u88C5\u9970","menu.color":"\u989C\u8272","menu.background-color":"\u80CC\u666F","menu.evaluate":"\u8BA1\u7B97","menu.simplify":"\u7B80\u5316","menu.solve":"\u6C42\u89E3","menu.solve-for":"\u6C42\u89E3 %@","menu.cut":"\u526A\u5207","menu.copy":"\u590D\u5236","menu.copy-as-latex":"\u590D\u5236\u4E3A LaTeX","menu.copy-as-ascii-math":"\u590D\u5236\u4E3A ASCII Math","menu.copy-as-mathml":"\u590D\u5236\u4E3A MathML","menu.paste":"\u7C98\u8D34","menu.select-all":"\u5168\u9009","color.red":"\u7EA2\u8272","color.orange":"\u6A59\u8272","color.yellow":"\u9EC4\u8272","color.lime":"\u7EFF\u9EC4\u8272","color.green":"\u7EFF\u8272","color.teal":"\u9752\u8272","color.cyan":"\u84DD\u7EFF\u8272","color.blue":"\u84DD\u8272","color.indigo":"\u975B\u84DD\u8272","color.purple":"\u7D2B\u8272","color.magenta":"\u6D0B\u7EA2\u8272","color.black":"\u9ED1\u8272","color.dark-grey":"\u6DF1\u7070\u8272","color.grey":"\u7070\u8272","color.light-grey":"\u6D45\u7070\u8272","color.white":"\u767D\u8272"}};function C(){return"window"in globalThis&&"document"in globalThis}function O(){return"matchMedia"in window?window.matchMedia("(pointer: coarse)").matches:"ontouchstart"in window||navigator.maxTouchPoints>0}function Q(){return typeof navigator.vibrate=="function"}function H(){var e,i;if(!C())return"other";const r=(i=(e=navigator.userAgentData)==null?void 0:e.platform)!=null?i:navigator.platform;return/^mac/i.test(r)?navigator.maxTouchPoints===5?"ios":"macos":/^win/i.test(r)?"windows":/android/i.test(navigator.userAgent)?"android":/iphone|ipod|ipad/i.test(navigator.userAgent)?"ios":/\bcros\b/i.test(navigator.userAgent)?"chromeos":"other"}function q(){if(!C())return!0;if(/firefox/i.test(navigator.userAgent)){const e=navigator.userAgent.match(/firefox\/(\d+)/i);return e?parseInt(e[1])>=78:!1}if(/trident/i.test(navigator.userAgent))return!1;if(/edge/i.test(navigator.userAgent)){const e=navigator.userAgent.match(/edg\/(\d+)/i);return e?parseInt(e[1])>=79:!1}return!0}function K(){return HTMLElement.prototype.hasOwnProperty("popover")}var $={strings:T,_locale:"",_dirty:!1,_subscribers:[],_numberFormatter:void 0,get locale(){return $._locale||($._locale=C()?navigator.language.slice(0,5):"en-US"),$._locale},set locale(e){$._locale=e,$._numberFormatter=void 0,$.dirty=!0},get numberFormatter(){return $._numberFormatter||($._numberFormatter=new Intl.NumberFormat($.locale)),$._numberFormatter},merge(e,i){if(typeof e=="string"&&i)$.strings[e]=P(P({},$.strings[e]),i),$.dirty=!0;else for(const r of Object.keys(e))$.merge(r,e[r])},get dirty(){return $._dirty},set dirty(e){$._dirty||$._dirty===e||($._dirty=!0,setTimeout(()=>{$._dirty=!1,this._subscribers.forEach(i=>i==null?void 0:i())},0))},subscribe(e){return $._subscribers.push(e),$._subscribers.length-1},unsubscribe(e){e<0||e>=$._subscribers.length||($._subscribers[e]=void 0)},update(e){let i=e.querySelectorAll("[data-l10n-tooltip]");for(const r of i){const a=r.getAttribute("data-l10n-tooltip");if(a){const u=V(a);u&&r.setAttribute("data-tooltip",u)}}i=e.querySelectorAll("[data-l10n-arial-label]");for(const r of i){const a=r.getAttribute("data-l10n-arial-label");if(a){const u=V(a);u&&r.setAttribute("aria-label",u)}}}};function V(e,...i){if(e===void 0)return;let r="";const a=$.locale;$.strings[a]&&(r=$.strings[a][e]);const u=a.slice(0,2);if(!r&&$.strings[u]&&(r=$.strings[u][e]),r||(r=$.strings.en[e]),!r)return;const p=/(%@|%([0-9]+)\$@)/g;let m=p.exec(r),b=0;for(;m;){if(i[b++]){const E=m[2]?parseInt(m[2],10)-1:b-1;let I=i[E];typeof I=="number"&&(I=$.numberFormatter.format(I)),r=r.replace(m[1],I)}m=p.exec(r)}return r=r.replace(/%%/g,"%"),r}var he={m0:"#3F3D99",m1:"#993D71",m2:"#998B3D",m3:"#3D9956",m4:"#3D5A99",m5:"#993D90",m6:"#996D3D",m7:"#43993D",m8:"#3D7999",m9:"#843D99"},be={blue:"#0072BD",orange:"#D95319",yellow:"#EDB120",purple:"#7E2F8E",green:"#77AC30",cyan:"#4DBEEE",red:"#A2142F"},Te={red:"#fbbbb6",orange:"#ffe0c2",yellow:"#fff1c2",lime:"#d0e8b9",green:"#bceac4",teal:"#b9f1f1",cyan:"#b8e5c9",blue:"#b6d9fb",indigo:"#d1c2f0",purple:"#e3baf8",magenta:"#f9c8e0",black:"#353535","dark-grey":"#8C8C8C",grey:"#D0D0D0","light-grey":"#F0F0F0",white:"#ffffff"},se={red:"#d7170b",orange:"#fe8a2b",yellow:"#ffc02b",lime:"#63b215",green:"#21ba3a",teal:"#17cfcf",cyan:"#13a7ec",blue:"#0d80f2",indigo:"#63c",purple:"#a219e6",magenta:"#eb4799",black:"#000","dark-grey":"#666",grey:"#A6A6A6","light-grey":"#d4d5d2",white:"#ffffff"},Ee={Red:"red",Orange:"orange",Yellow:"yellow",LimeGreen:"lime",Green:"green",TealBlue:"teal",Blue:"blue",Violet:"indigo",Purple:"purple",Magenta:"magenta",Black:"black",Gray:"grey",White:"white"},We={Apricot:"#FBB982",Aquamarine:"#00B5BE",Bittersweet:"#C04F17",Black:"#221E1F",Blue:"#2D2F92",BlueGreen:"#00B3B8",BlueViolet:"#473992",BrickRed:"#B6321C",Brown:"#792500",BurntOrange:"#F7921D",CadetBlue:"#74729A",CarnationPink:"#F282B4",Cerulean:"#00A2E3",CornflowerBlue:"#41B0E4",Cyan:"#00AEEF",Dandelion:"#FDBC42",DarkOrchid:"#A4538A",Emerald:"#00A99D",ForestGreen:"#009B55",Fuchsia:"#8C368C",Goldenrod:"#FFDF42",Gray:"#949698",Green:"#00A64F",GreenYellow:"#DFE674",JungleGreen:"#00A99A",Lavender:"#F49EC4",Limegreen:"#8DC73E",Magenta:"#EC008C",Mahogany:"#A9341F",Maroon:"#AF3235",Melon:"#F89E7B",MidnightBlue:"#006795",Mulberry:"#A93C93",NavyBlue:"#006EB8",OliveGreen:"#3C8031",Orange:"#F58137",OrangeRed:"#ED135A",Orchid:"#AF72B0",Peach:"#F7965A",Periwinkle:"#7977B8",PineGreen:"#008B72",Plum:"#92268F",ProcessBlue:"#00B0F0",Purple:"#99479B",RawSienna:"#974006",Red:"#ED1B23",RedOrange:"#F26035",RedViolet:"#A1246B",Rhodamine:"#EF559F",RoyalBlue:"#0071BC",RoyalPurple:"#613F99",RubineRed:"#ED017D",Salmon:"#F69289",SeaGreen:"#3FBC9D",Sepia:"#671800",SkyBlue:"#46C5DD",SpringGreen:"#C6DC67",Tan:"#DA9D76",TealBlue:"#00AEB3",Thistle:"#D883B7",Turquoise:"#00B4CE",Violet:"#58429B",VioletRed:"#EF58A0",White:"#FFFFFF",WildStrawberry:"#EE2967",Yellow:"#FFF200",YellowGreen:"#98CC70",YellowOrange:"#FAA21A"};function Ke(e){var i,r,a,u,p,m;const b=e.split("!");let w,E,I,N=255,J=255,oe=255,ge=-1;const He=b.length>0&&b[0].startsWith("-");He&&(b[0]=b[0].slice(1));for(let Ft=0;Ft<b.length;Ft++){w=N,E=J,I=oe;const Ve=(i=b[Ft].trim().match(/^([A-Za-z\d-]+)/))==null?void 0:i[1],St=Ve==null?void 0:Ve.toLowerCase(),Kt=Ve&&(m=(p=(u=(a=(r=se[St])!=null?r:se[Ee[Ve]])!=null?a:be[Ve])!=null?u:We[Ve])!=null?p:he[Ve])!=null?m:b[Ft].trim();let Lt=Kt.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(Lt!=null&&Lt[1]&&Lt[2]&&Lt[3])N=Math.max(0,Math.min(255,Number.parseInt(Lt[1],16))),J=Math.max(0,Math.min(255,Number.parseInt(Lt[2],16))),oe=Math.max(0,Math.min(255,Number.parseInt(Lt[3],16)));else if(Lt=Kt.match(/^#([\da-f]{3})$/i),Lt!=null&&Lt[1]){const ai=Number.parseInt(Lt[1][0],16),yi=Number.parseInt(Lt[1][1],16),fi=Number.parseInt(Lt[1][2],16);N=Math.max(0,Math.min(255,ai*16+ai)),J=Math.max(0,Math.min(255,yi*16+yi)),oe=Math.max(0,Math.min(255,fi*16+fi))}else if(Lt=Kt.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i),Lt!=null&&Lt[1]&&Lt[2]&&Lt[3])N=Math.max(0,Math.min(255,Number.parseInt(Lt[1]))),J=Math.max(0,Math.min(255,Number.parseInt(Lt[2]))),oe=Math.max(0,Math.min(255,Number.parseInt(Lt[3])));else return;ge>=0&&(N=(1-ge)*N+ge*w,J=(1-ge)*J+ge*E,oe=(1-ge)*oe+ge*I,ge=-1),Ft+1<b.length&&(ge=Math.max(0,Math.min(100,Number.parseInt(b[++Ft])))/100)}return ge>=0&&(N=ge*N+(1-ge)*w,J=ge*J+(1-ge)*E,oe=ge*oe+(1-ge)*I),He&&(N=255-N,J=255-J,oe=255-oe),"#"+("00"+Math.round(N).toString(16)).slice(-2)+("00"+Math.round(J).toString(16)).slice(-2)+("00"+Math.round(oe).toString(16)).slice(-2)}function Rt(e){var i,r;return e=e.trim(),(r=(i=Te[e.toLowerCase()])!=null?i:Te[Ee[e]])!=null?r:Ke(e)}function te(e){if(!e||e[0]!=="#")return;e=e.slice(1);let i;return e.length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},e.length===4&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},e.length===8&&(i.a=parseInt(e[6]+e[7],16)/255)),i&&i.a===void 0&&(i.a=1),i}function z(e,i,r){return r<0&&(r+=6),r>=6&&(r-=6),r<1?(i-e)*r+e:r<3?i:r<4?(i-e)*(4-r)+e:e}function X(e){let[i,r,a]=[e.h,e.s,e.l];i=(i+360)%360/60,a=Math.max(0,Math.min(a,1)),r=Math.max(0,Math.min(r,1));const u=a<=.5?a*(r+1):a+r-a*r,p=a*2-u;return{r:Math.round(255*z(p,u,i+2)),g:Math.round(255*z(p,u,i)),b:Math.round(255*z(p,u,i-2))}}function ee(e){return e<0?0:e>255?255:Math.round(e)}function fe(e){const{r:i,g:r,b:a}=e;let u=((1<<24)+(ee(i)<<16)+(ee(r)<<8)+ee(a)).toString(16).slice(1);return u[0]===u[1]&&u[2]===u[3]&&u[4]===u[5]&&u[6]===u[7]&&(u=u[0]+u[2]+u[4]),"#"+u}function ne(e){let{r:i,g:r,b:a}=e;i=i/255,r=r/255,a=a/255;const u=Math.min(i,r,a),p=Math.max(i,r,a),m=p-u;let b,w;p===u?b=0:i===p?b=(r-a)/m:r===p?b=2+(a-i)/m:a===p&&(b=4+(i-r)/m),b=Math.min(b*60,360),b<0&&(b+=360);const E=(u+p)/2;return p===u?w=0:E<=.5?w=m/(p+u):w=m/(2-p-u),{h:b,s:w,l:E}}function A(e){let i=te(e);if(!i)return e;let{h:r,s:a,l:u}=ne(i);return a+=.1,u-=.1,fe(X({h:r,s:a,l:u}))}var D={60:"\\lt",62:"\\gt",111:"o",38:"\\&",123:"\\lbrace",125:"\\rbrace",91:"\\lbrack",93:"\\rbrack",58:"\\colon",160:"~",172:"\\neg",183:"\\cdot",188:"\\frac{1}{4}",189:"\\frac{1}{2}",190:"\\frac{3}{4}",8304:"^{0}",8305:"^{i}",185:"^{1}",178:"^{2}",179:"^{3}",8224:"\\dagger",8225:"\\ddagger",8230:"\\ldots",8308:"^{4}",8309:"^{5}",8310:"^{6}",8311:"^{7}",8312:"^{8}",8313:"^{9}",8314:"^{+}",8315:"^{-}",8316:"^{=}",8319:"^{n}",8320:"_{0}",8321:"_{1}",8322:"_{2}",8323:"_{3}",8324:"_{4}",8325:"_{5}",8326:"_{6}",8327:"_{7}",8328:"_{8}",8329:"_{9}",8330:"_{+}",8331:"_{-}",8332:"_{=}",8336:"_{a}",8337:"_{e}",8338:"_{o}",8339:"_{x}",8242:"\\prime",39:"\\prime",8592:"\\gets",8594:"\\to",9651:"\\triangle",9661:"\\triangledown",8715:"\\owns",8727:"\\ast",8739:"\\vert",8741:"\\Vert",8743:"\\land",8744:"\\lor",8901:"\\cdot",8904:"\\bowtie",8800:"\\ne",8804:"\\le",8805:"\\ge",8869:"\\bot",10231:"\\biconditional",10232:"\\impliedby",10233:"\\implies",10234:"\\iff",8450:"\\mathbb{C}",8469:"\\mathbb{N}",8473:"\\mathbb{P}",8474:"\\mathbb{Q}",8477:"\\mathbb{R}",8484:"\\mathbb{Z}",8461:"\\mathbb{H}",8476:"\\Re",8465:"\\Im",42:"\\ast",11036:"\\square",9633:"\\square",8720:"\\coprod",8716:"\\not\\ni",9671:"\\diamond",8846:"\\uplus",8851:"\\sqcap",8852:"\\sqcup",8768:"\\wr",8750:"\\oint",8226:"\\textbullet",8722:"-",978:"\\Upsilon"},G={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},de=[{start:119808,len:26,offset:65,style:"bold"},{start:119834,len:26,offset:97,style:"bold"},{start:119860,len:26,offset:65,style:"italic"},{start:119886,len:26,offset:97,style:"italic"},{start:119912,len:26,offset:65,style:"bolditalic"},{start:119938,len:26,offset:97,style:"bolditalic"},{start:119964,len:26,offset:65,variant:"script"},{start:119990,len:26,offset:97,variant:"script"},{start:120016,len:26,offset:65,variant:"script",style:"bold"},{start:120042,len:26,offset:97,variant:"script",style:"bold"},{start:120068,len:26,offset:65,variant:"fraktur"},{start:120094,len:26,offset:97,variant:"fraktur"},{start:120172,len:26,offset:65,variant:"fraktur",style:"bold"},{start:120198,len:26,offset:97,variant:"fraktur",style:"bold"},{start:120120,len:26,offset:65,variant:"double-struck"},{start:120146,len:26,offset:97,variant:"double-struck"},{start:120224,len:26,offset:65,variant:"sans-serif"},{start:120250,len:26,offset:97,variant:"sans-serif"},{start:120276,len:26,offset:65,variant:"sans-serif",style:"bold"},{start:120302,len:26,offset:97,variant:"sans-serif",style:"bold"},{start:120328,len:26,offset:65,variant:"sans-serif",style:"italic"},{start:120354,len:26,offset:97,variant:"sans-serif",style:"italic"},{start:120380,len:26,offset:65,variant:"sans-serif",style:"bolditalic"},{start:120406,len:26,offset:97,variant:"sans-serif",style:"bolditalic"},{start:120432,len:26,offset:65,variant:"monospace"},{start:120458,len:26,offset:97,variant:"monospace"},{start:120488,len:25,offset:913,style:"bold"},{start:120514,len:25,offset:945,style:"bold"},{start:120546,len:25,offset:913,style:"italic"},{start:120572,len:25,offset:945,style:"italic"},{start:120604,len:25,offset:913,style:"bolditalic"},{start:120630,len:25,offset:945,style:"bolditalic"},{start:120662,len:25,offset:913,variant:"sans-serif",style:"bold"},{start:120688,len:25,offset:945,variant:"sans-serif",style:"bold"},{start:120720,len:25,offset:913,variant:"sans-serif",style:"bolditalic"},{start:120746,len:25,offset:945,variant:"sans-serif",style:"bolditalic"},{start:120782,len:10,offset:48,variant:"main",style:"bold"},{start:120792,len:10,offset:48,variant:"double-struck"},{start:120803,len:10,offset:48,variant:"sans-serif"},{start:120812,len:10,offset:48,variant:"sans-serif",style:"bold"},{start:120822,len:10,offset:48,variant:"monospace"}];function ze(e,i,r){if(!/[A-Za-z\d]/.test(e)||(r==="up"&&(r=void 0),!i&&!r))return e;const a=e.codePointAt(0);if(a===void 0)return e;for(const u of de)if((!i||u.variant===i)&&(!r||u.style===r)&&a>=u.offset&&a<u.offset+u.len){const p=u.start+a-u.offset;return String.fromCodePoint(G[p]||p)}return e}function pt(e){var i;if((e<119808||e>120831)&&(e<8448||e>8527))return{char:String.fromCodePoint(e)};for(const r in G)if(G[r]===e){e=(i=r.codePointAt(0))!=null?i:0;break}for(const r of de)if(e>=r.start&&e<r.start+r.len)return{char:String.fromCodePoint(e-r.start+r.offset),variant:r.variant,style:r.style};return{char:String.fromCodePoint(e)}}function Ut(e){var i;let r="";for(const a of e){if("{}<>[]$&#^_%:'\u02DC".includes(a)){r+=a;continue}const u=(i=a.codePointAt(0))!=null?i:0;let p=D[u];if(p)p.startsWith("\\")?r+=p+" ":r+=p;else{const{char:m,variant:b,style:w}=pt(u);switch(p=m,b){case"double-struck":p=`\\mathbb{${p}}`;break;case"fraktur":p=`\\mathfrak{${p}}`;break;case"script":p=`\\mathscr{${p}}`;break;case"sans-serif":p=`\\mathsf{${p}}`;break;case"monospace":p=`\\mathtt{${p}}`;break;case"calligraphic":p=`\\mathcal{${p}}`;break}switch(w){case"bold":p=`\\mathbf{${p}}`;break;case"italic":p=`\\mathit{${p}}`;break;case"bolditalic":p=`\\mathbfit{${p}}`;break}r+=p}}return r}function Ie(e){return e?Array.isArray(e)?e:typeof e=="object"&&"group"in e?e.group:[]:[]}var qt={},Ot=P({},D),wt={},Ne={},tt={darr:"\\downarrow",dArr:"\\Downarrow",Darr:"\\Downarrow",lang:"\\langle",rang:"\\rangle",uarr:"\\uparrow",uArr:"\\Uparrow",Uarr:"\\Uparrow",N:"\\mathbb{N}",R:"\\mathbb{R}",Z:"\\mathbb{Z}",alef:"\\aleph",alefsym:"\\aleph",Alpha:"\\mathrm{A}",Beta:"\\mathrm{B}",bull:"\\bullet",Chi:"\\mathrm{X}",clubs:"\\clubsuit",cnums:"\\mathbb{C}",Complex:"\\mathbb{C}",Dagger:"\\ddagger",diamonds:"\\diamondsuit",empty:"\\emptyset",Epsilon:"\\mathrm{E}",Eta:"\\mathrm{H}",exist:"\\exists",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",Harr:"\\Leftrightarrow",hearts:"\\heartsuit",image:"\\Im",infin:"\\infty",Iota:"\\mathrm{I}",isin:"\\in",Kappa:"\\mathrm{K}",larr:"\\leftarrow",lArr:"\\Leftarrow",Larr:"\\Leftarrow",lrarr:"\\leftrightarrow",lrArr:"\\Leftrightarrow",Lrarr:"\\Leftrightarrow",Mu:"\\mathrm{M}",natnums:"\\mathbb{N}",Nu:"\\mathrm{N}",Omicron:"\\mathrm{O}",plusmn:"\\pm",rarr:"\\rightarrow",rArr:"\\Rightarrow",Rarr:"\\Rightarrow",real:"\\Re",reals:"\\mathbb{R}",Reals:"\\mathbb{R}",Rho:"\\mathrm{P}",sdot:"\\cdot",sect:"\\S",spades:"\\spadesuit",sub:"\\subset",sube:"\\subseteq",supe:"\\supseteq",Tau:"\\mathrm{T}",thetasym:"\\vartheta",weierp:"\\wp",Zeta:"\\mathrm{Z}"},mt={varGamma:"\\mathit{\\Gamma}",varDelta:"\\mathit{\\Delta}",varTheta:"\\mathit{\\Theta}",varLambda:"\\mathit{\\Lambda}",varXi:"\\mathit{\\Xi}",varPi:"\\mathit{\\Pi}",varSigma:"\\mathit{\\Sigma}",varUpsilon:"\\mathit{\\Upsilon}",varPhi:"\\mathit{\\Phi}",varPsi:"\\mathit{\\Psi}",varOmega:"\\mathit{\\Omega}",pmod:{def:"\\quad(\\operatorname{mod}\\ #1)",args:1,expand:!1,captureSelection:!1},mod:{def:"\\quad\\operatorname{mod}\\,\\,#1",args:1,expand:!1},bmod:{def:"\\;\\mathbin{\\operatorname{mod }}",expand:!1}},ct={bra:{def:"\\mathinner{\\langle{#1}|}",args:1,captureSelection:!1},ket:{def:"\\mathinner{|{#1}\\rangle}",args:1,captureSelection:!1},braket:{def:"\\mathinner{\\langle{#1}\\rangle}",args:1,captureSelection:!1},set:{def:"\\mathinner{\\lbrace #1 \\rbrace}",args:1,captureSelection:!1},Bra:{def:"\\left\\langle #1\\right|",args:1,captureSelection:!1},Ket:{def:"\\left|#1\\right\\rangle",args:1,captureSelection:!1},Braket:{def:"\\left\\langle{#1}\\right\\rangle",args:1,captureSelection:!1},Set:{def:"\\left\\lbrace #1 \\right\\rbrace",args:1,captureSelection:!1}},ei={iff:{primitive:!0,captureSelection:!0,def:"\\;\u27FA\\;"},nicefrac:"^{#1}\\!\\!/\\!_{#2}",phase:{def:"\\enclose{phasorangle}{#1}",args:1,captureSelection:!1},rd:"\\mathrm{d}",rD:"\\mathrm{D}",doubleStruckCapitalN:"\\mathbb{N}",doubleStruckCapitalR:"\\mathbb{R}",doubleStruckCapitalQ:"\\mathbb{Q}",doubleStruckCapitalZ:"\\mathbb{Z}",doubleStruckCapitalP:"\\mathbb{P}",scriptCapitalE:"\\mathscr{E}",scriptCapitalH:"\\mathscr{H}",scriptCapitalL:"\\mathscr{L}",gothicCapitalC:"\\mathfrak{C}",gothicCapitalH:"\\mathfrak{H}",gothicCapitalI:"\\mathfrak{I}",gothicCapitalR:"\\mathfrak{R}",imaginaryI:"\\mathrm{i}",imaginaryJ:"\\mathrm{j}",exponentialE:"\\mathrm{e}",differentialD:"\\mathrm{d}",capitalDifferentialD:"\\mathrm{D}",mathstrut:{def:"\\vphantom{(}",primitive:!0},angl:"\\enclose{actuarial}{#1}",angln:"\\enclose{actuarial}{n}",anglr:"\\enclose{actuarial}{r}",anglk:"\\enclose{actuarial}{k}",mathtools:{primitive:!0,package:{ordinarycolon:":",vcentcolon:"\\mathrel{\\mathop\\ordinarycolon}",dblcolon:'{\\mathop{\\char"2237}}',coloneqq:'{\\mathop{\\char"2254}}',Coloneqq:'{\\mathop{\\char"2237\\char"3D}}',coloneq:'{\\mathop{\\char"3A\\char"2212}}',Coloneq:'{\\mathop{\\char"2237\\char"2212}}',eqqcolon:'{\\mathop{\\char"2255}}',Eqqcolon:'{\\mathop{\\char"3D\\char"2237}}',eqcolon:'{\\mathop{\\char"2239}}',Eqcolon:'{\\mathop{\\char"2212\\char"2237}}',colonapprox:'{\\mathop{\\char"003A\\char"2248}}',Colonapprox:'{\\mathop{\\char"2237\\char"2248}}',colonsim:'{\\mathop{\\char"3A\\char"223C}}',Colonsim:'{\\mathop{\\char"2237\\char"223C}}',colondash:"\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",Colondash:"\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}",dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Dashcolon:"\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}"}},ratio:"\\vcentcolon",coloncolon:"\\dblcolon",colonequals:"\\coloneq",coloncolonequals:"\\Coloneq",equalscolon:"\\eqcolon",equalscoloncolon:"\\Eqcolon",colonminus:"\\colondash",coloncolonminus:"\\Colondash",minuscolon:"\\dashcolon",minuscoloncolon:"\\Dashcolon",coloncolonapprox:"\\Colonapprox",coloncolonsim:"\\Colonsim",simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Simcolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",simcoloncolon:"\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}",Approxcolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",approxcoloncolon:"\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}",notni:"\\mathrel{\\char`\u220C}",limsup:"\\operatorname*{lim\\,sup}",liminf:"\\operatorname*{lim\\,inf}",injlim:"\\operatorname*{inj\\,lim}",projlim:"\\operatorname*{proj\\,lim}",varlimsup:"\\operatorname*{\\overline{lim}}",varliminf:"\\operatorname*{\\underline{lim}}",varinjlim:"\\operatorname*{\\underrightarrow{lim}}",varprojlim:"\\operatorname*{\\underleftarrow{lim}}",argmin:"\\operatorname*{arg\\,min}",argmax:"\\operatorname*{arg\\,max}",plim:"\\mathop{\\operatorname{plim}}\\limits",tripledash:{def:"\\vphantom{-}\\raise{4mu}{\\mkern1.5mu\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2.25mu}\\rule{2mu}{1.5mu}\\mkern{2mu}}",expand:!0},"braket.sty":{package:ct},"amsmath.sty":{package:mt,primitive:!0},"texvc.sty":{package:tt,primitive:!1}},Ce={" ":32,"\\!":33,"\\#":35,"\\$":36,"\\%":37,"\\&":38,"-":45,"\\textunderscore":95,"\\euro":8364,"\\maltese":10016,"\\{":123,"\\}":125,"\\textbraceleft":123,"\\textbraceright":125,"\\lbrace":123,"\\rbrace":125,"\\lbrack":91,"\\rbrack":93,"\\nobreakspace":160,"\\ldots":8230,"\\textellipsis":8230,"\\backslash":92,"`":8216,"'":8217,"``":8220,"''":8221,"\\degree":176,"\\textasciicircum":94,"\\textasciitilde":126,"\\textasteriskcentered":42,"\\textbackslash":92,"\\textbullet":8226,"\\textdollar":36,"\\textsterling":163,"\\textdagger":8224,"\\textdaggerdbl":8225,"\u2013":8211,"\u2014":8212,"\u2018":8216,"\u2019":8217,"\u201C":8220,"\u201D":8221,'"':8221,"\\ss":223,"\\ae":230,"\\oe":339,"\\AE":198,"\\OE":338,"\\O":216,"\\i":305,"\\j":567,"\\aa":229,"\\AA":197},Fe=/[\w!@*()-=+{}\[\]\\';:?/.,~<>`|$%#&^" ]/,me,Ye;q()?(me=new RegExp("\\p{Letter}","u"),Ye=new RegExp("[0-9\\p{Letter}]","u")):(me=/[a-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/,Ye=/[\da-zA-ZаАбБвВгГдДеЕёЁжЖзЗиИйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяĄąĆćĘꣳŃńÓóŚśŹźŻżàâäôéèëêïîçùûüÿæœÀÂÄÔÉÈËÊÏΟÇÙÛÜÆŒößÖẞìíòúÌÍÒÚáñÁÑ]/);function at(e,i,r="mord",a){i!==void 0&&(qt[e]={definitionType:"symbol",type:r,variant:a,codepoint:i},Ot[i]||(Ot[i]=e))}function Xe(e,i,r){if(typeof e=="string"){for(let a=0;a<e.length;a++){const u=e.charAt(a);at(u,u.codePointAt(0))}return}for(const[a,u,p,m]of e)at(a,u,p!=null?p:i,m!=null?m:r)}function Y(e,i){for(let r=e;r<=i;r++)at(String.fromCodePoint(r),r)}function ye(e){var i;return(i=Ne[e])!=null?i:null}function Oe(e,i){var r,a;if(i.length===0||i==="\\"||!i.startsWith("\\"))return[];const u=[];for(const m in wt)m.startsWith(i)&&!wt[m].infix&&u.push({match:m,frequency:(r=wt[m].frequency)!=null?r:0});for(const m in qt)m.startsWith(i)&&u.push({match:m,frequency:(a=qt[m].frequency)!=null?a:0});const p=i.substring(1);for(const m of Object.keys(e.options.macros))m.startsWith(p)&&u.push({match:"\\"+m,frequency:0});return u.sort((m,b)=>{var w,E;return m.frequency===b.frequency?m.match.length===b.match.length?m.match<b.match?-1:1:m.match.length-b.match.length:((w=b.frequency)!=null?w:0)-((E=m.frequency)!=null?E:0)}),u.map(m=>m.match)}function qe(e){let i="auto";const r=e.match(/:([^=]+)/);return r&&(i=r[1].trim()),i}function ot(e){if(!e)return[];const i=[];let r=e.split("]");if(r[0].startsWith("[")){i.push({isOptional:!0,type:qe(r[0].slice(1))});for(let a=1;a<=r.length;a++)i.push(...ot(r[a]))}else if(r=e.split("}"),r[0].startsWith("{")){i.push({isOptional:!1,type:qe(r[0].slice(1))});for(let a=1;a<=r.length;a++)i.push(...ot(r[a]))}return i}function vt(e){if(!e)return"";let i="",r=!0;for(const a of e)typeof a.value=="string"?i+=a.value:r=!1;return r?i:""}function jt(e,i){typeof e=="string"&&(e=[e]);const r={tabular:!1,params:[],createAtom:i};for(const a of e)Ne[a]=r}function gt(e,i,r){typeof e=="string"&&(e=[e]);const u={tabular:!0,params:ot(i),createAtom:r};for(const p of e)Ne[p]=u}function Se(e,i,r){var a,u;r||(r={});const p={definitionType:"function",params:ot(i),ifMode:r.ifMode,isFunction:(a=r.isFunction)!=null?a:!1,applyMode:r.applyMode,infix:(u=r.infix)!=null?u:!1,parse:r.parse,createAtom:r.createAtom,applyStyle:r.applyStyle,serialize:r.serialize,render:r.render};if(typeof e=="string")wt["\\"+e]=p;else for(const m of e)wt["\\"+m]=p}var yt;function Wt(e){return yt||(yt=Le(ei)),e?Le(P(P({},yt),e)):yt}function Gt(e,i){var r,a,u,p;if(typeof e=="string"){let m=0;const b=e;return/(^|[^\\])#1/.test(b)&&(m=1),/(^|[^\\])#2/.test(b)&&(m=2),/(^|[^\\])#3/.test(b)&&(m=3),/(^|[^\\])#4/.test(b)&&(m=4),/(^|[^\\])#5/.test(b)&&(m=5),/(^|[^\\])#6/.test(b)&&(m=6),/(^|[^\\])#7/.test(b)&&(m=7),/(^|[^\\])#8/.test(b)&&(m=8),/(^|[^\\])#9/.test(b)&&(m=9),{expand:(r=i==null?void 0:i.expand)!=null?r:!0,captureSelection:(a=i==null?void 0:i.captureSelection)!=null?a:!0,args:m,def:b}}return P({expand:(u=i==null?void 0:i.expand)!=null?u:!0,captureSelection:(p=i==null?void 0:i.captureSelection)!=null?p:!0,args:0},e)}function Le(e){if(!e)return{};const i={};for(const r of Object.keys(e)){const a=e[r];if(a==null)delete i[r];else if(typeof a=="object"&&"package"in a)for(const u of Object.keys(a.package))i[u]=Gt(a.package[u],{expand:!a.primitive,captureSelection:a.captureSelection});else i[r]=Gt(a)}return i}function Me(e,i="math"){if(!e||e.length===0)return null;let r=null;if(e.startsWith("\\")){if(r=wt[e],r)return!r.ifMode||r.ifMode===i?r:null;i==="math"?r=qt[e]:Ce[e]&&(r={definitionType:"symbol",type:"mord",codepoint:Ce[e]})}else if(i==="math"){if(r=qt[e],!r&&e.length===1){const a=bt("math",e.codePointAt(0));return a.startsWith("\\")?f(P({},Me(a,"math")),{command:a}):null}}else Ce[e]?r={definitionType:"symbol",type:"mord",codepoint:Ce[e]}:i==="text"&&(r={definitionType:"symbol",type:"mord",codepoint:e.codePointAt(0)});return r!=null?r:null}function rt(e,i){if(!e.startsWith("\\"))return null;const r=e.slice(1);return i[r]}function bt(e,i){if(i===void 0)return"";if(e==="math"&&Ot[i])return Ot[i];if(e==="text"){const r=Object.keys(Ce).find(a=>Ce[a]===i);return r||String.fromCodePoint(i)}return String.fromCodePoint(i)}var je=[0,.68889,0,0,.72222],Mt=[0,.68889,0,0,.66667],Ct=[0,.68889,0,0,.77778],Et=[0,.68889,0,0,.61111],Nt=[.16667,.68889,0,0,.77778],Xt=[0,.68889,0,0,.55556],Je=[0,0,0,0,.25],zt=[0,.825,0,0,2.33334],De=[0,.9,0,0,2.33334],xe=[0,.68889,0,0,.54028],ke=[-.03598,.46402,0,0,.5],U=[-.13313,.36687,0,0,1],j=[.01354,.52239,0,0,1],ae=[.01354,.52239,0,0,1.11111],ue=[0,.54986,0,0,1],ve=[0,.69224,0,0,.5],ht=[0,.43056,0,0,1],_t=[.08198,.58198,0,0,.77778],lt=[.19444,.69224,0,0,.41667],Vt=[.1808,.675,0,0,1],ni=[.19444,.69224,0,0,.83334],gi=[.13667,.63667,0,0,1],ri=[-.064,.437,0,0,1.334],Dt=[.08167,.58167,0,0,.77778],oi=[0,.69224,0,0,.72222],Mi=[0,.69224,0,0,.66667],Ei=[-.13313,.36687,0,0,.77778],Oi=[.06062,.54986,0,0,.77778],vi=[0,.69224,0,0,.77778],di=[.25583,.75583,0,0,.77778],zi=[.25142,.75726,0,0,.77778],Wi=[.20576,.70576,0,0,.77778],rn=[.30274,.79383,0,0,.77778],Yi=[.22958,.72958,0,0,.77778],Qn=[.1808,.675,0,0,.77778],Di=[.13667,.63667,0,0,.77778],Ki=[.13597,.63597,0,0,.77778],vn=[.03517,.54986,0,0,.77778],Ri=[0,.675,0,0,.77778],mn=[.19444,.69224,0,0,.61111],sn=[0,.54986,0,0,.76042],rr=[0,.54986,0,0,.66667],gn=[.0391,.5391,0,0,.77778],cr=[.03517,.54986,0,0,1.33334],Qi=[.38569,.88569,0,0,.77778],ki=[.23222,.74111,0,0,.77778],ii=[.19444,.69224,0,0,.77778],Re=[0,.37788,0,0,.5],it=[0,.54986,0,0,.72222],xt=[0,.69224,0,0,.83334],nt=[.11111,.69224,0,0,.66667],At=[.26167,.75726,0,0,.77778],st=[.48256,.98256,0,0,.77778],ft=[.28481,.79383,0,0,.77778],Pt=[.08167,.58167,0,0,.22222],Jt=[.08167,.58167,0,0,.38889],pi=[0,.43056,.04028,0,.66667],Zi=[.41951,.91951,0,0,.77778],_i=[.24982,.74947,0,0,.38865],Fi=[.08319,.58283,0,0,.75623],Pi=[0,.10803,0,0,.27764],Ni=[0,.47534,0,0,.50181],Gi=[.18906,.47534,0,0,.50181],wi=[0,.69141,0,0,.50181],Bi=[.24982,.74947,0,0,.27764],un=[0,.69141,0,0,.21471],$i=[.25,.75,0,0,.44722],Ai=[0,.64444,0,0,.575],Xi=[.08556,.58556,0,0,.89444],Hi=[0,.69444,0,0,.89444],en=[0,.68611,0,0,.9],Nn=[0,.68611,0,0,.86944],cn=[.25,.75,0,0,.575],tn=[.25,.75,0,0,.31944],ji=[0,.69444,0,0,.63889],In=[0,.69444,0,0,.31944],$n=[0,.44444,0,0,.63889],Vi=[0,.44444,0,0,.51111],bn=[0,.69444,0,0,.575],xn=[.13333,.63333,0,0,.89444],wn=[0,.44444,0,0,.31944],gr=[0,.69444,0,0,.86944],an=[0,.68611,0,0,.69166],Ln=[0,.68611,0,0,.83055],fr=[0,.68611,0,0,.89444],Or=[0,.69444,0,0,.60278],dr=[.19444,.69444,0,0,.51111],Fr=[0,.69444,0,0,.83055],Dn=[-.10889,.39111,0,0,1.14999],qn=[.19444,.69444,0,0,.575],Ar=[.19444,.69444,0,0,1.14999],Lr=[.19444,.69444,0,0,.70277],_r=[.05556,.75,0,0,.575],Pn=[0,.68611,0,0,.95833],pr=[.08556,.58556,0,0,.76666],Kn=[-.02639,.47361,0,0,.575],Br=[0,.44444,0,0,.89444],Sn=[0,.55556,0,0,.76666],er=[-.10889,.39111,0,0,.89444],kr=[.00222,.50222,0,0,.89444],mi=[.19667,.69667,0,0,.89444],es=[.08556,.58556,0,0,1.14999],Ji=[0,.69444,0,0,.70277],bi=[-.02778,.47222,0,0,.575],nn=[.25,.75,0,0,.51111],En=[-.13889,.36111,0,0,1.14999],vr=[.19444,.69444,0,0,1.02222],Wn=[.12963,.69444,0,0,.89444],qi=[.19444,.69444,0,0,.44722],Un=[0,.64444,.13167,0,.59111],ls=[.19444,.64444,.13167,0,.59111],Dr=[0,.68611,.17208,0,.8961],us=[.19444,.44444,.105,0,.53222],cs=[0,.44444,.085,0,.82666],rs=[0,.69444,.06709,0,.59111],tr=[0,.69444,.12945,0,.35555],Wr=[0,.69444,0,0,.94888],Nr=[0,.69444,.11472,0,.59111],hr=[0,.68611,.10778,0,.88555],zn=[0,.69444,.07939,0,.62055],sr=[0,.69444,.12417,0,.30667],yr=[0,.64444,.13556,0,.51111],ys=[.19444,.64444,.13556,0,.51111],bs=[0,.68333,.16389,0,.74333],Ms=[.19444,.43056,.08847,0,.46],Vn=[0,.43056,.07514,0,.71555],mr=[0,.69444,.06646,0,.51111],$s=[0,.69444,0,0,.83129],ui=[0,.69444,.1225,0,.51111],Li=[0,.68333,.09403,0,.76666],Cn=[0,.68333,.11111,0,.76666],ar=[0,.69444,.06961,0,.51444],kn=[0,.69444,0,0,.27778],hs=[.25,.75,0,0,.38889],or=[0,.64444,0,0,.5],ss=[0,.69444,0,0,.77778],jr=[0,.68333,0,0,.75],Sa=[0,.68333,0,0,.77778],hl=[0,.68333,0,0,.68056],Ea=[0,.68333,0,0,.72222],Ks=[.25,.75,0,0,.5],la=[.25,.75,0,0,.27778],lr=[0,.69444,0,0,.5],qr=[0,.69444,0,0,.55556],ka=[0,.43056,0,0,.44445],xs=[0,.43056,0,0,.5],Eo=[.19444,.43056,0,0,.55556],ko=[0,.43056,0,0,.55556],as=[.08333,.58333,0,0,.77778],To=[0,.43056,0,0,.27778],Xl=[0,.66786,0,0,.27778],qa=[0,.69444,0,0,.75],fl=[0,.66786,0,0,.5],dl=[0,.68333,0,0,.625],ws=[.19444,.69444,0,0,.44445],Ta=[0,.69444,0,0,.72222],Za=[.19444,.69444,0,0,.5],Is=[.19444,.69444,0,0,1],Ao=[.011,.511,0,0,1.126],pl=[.19444,.69444,0,0,.61111],ml=[.05556,.75,0,0,.5],Jl=[0,.68333,0,0,.83334],Lo=[.0391,.5391,0,0,.66667],ua=[-.05555,.44445,0,0,.5],Do=[0,.43056,0,0,.77778],Ys=[0,.55556,0,0,.66667],Ya=[-.03625,.46375,0,0,.77778],Co=[-.01688,.48312,0,0,.77778],gl=[.0391,.5391,0,0,1],Us=[0,.69444,0,0,.61111],Mo=[-.03472,.46528,0,0,.5],Xa=[.25,.75,0,0,.44445],Aa=[-.14236,.35764,0,0,1],Zn=[.244,.744,0,0,.412],Mn=[.19444,.69444,0,0,.88889],On=[.12963,.69444,0,0,.77778],ts=[.19444,.69444,0,0,.38889],Zr=[.011,.511,0,0,1.638],Xs=[.19444,.69444,0,0,0],br=[0,.44444,0,0,.575],Cr=[.19444,.44444,0,0,.575],_l=[0,.68611,0,0,.75555],kt=[0,.69444,0,0,.66759],Js=[0,.68611,0,0,.80555],Ja=[0,.68611,.08229,0,.98229],vl=[0,.68611,0,0,.76666],ph=[0,.44444,0,0,.58472],Ql=[.19444,.44444,0,0,.6118],Io=[.19444,.43056,0,0,.5],mh=[0,.68333,.02778,.08334,.76278],gh=[0,.68333,.08125,.05556,.83125],eu=[0,.43056,0,.05556,.48472],Ro=[.19444,.43056,0,.08334,.51702],Qa=[.25,.75,0,0,.42778],Yr=[0,.69444,0,0,.55],ca=[0,.69444,0,0,.73334],La=[0,.69444,0,0,.79445],_h=[0,.69444,0,0,.51945],tu=[0,.69444,0,0,.70278],iu=[0,.69444,0,0,.76389],yl=[.25,.75,0,0,.34306],eo=[0,.69444,0,0,.56111],vh=[0,.69444,0,0,.25556],ec=[.19444,.45833,0,0,.56111],tc=[0,.45833,0,0,.56111],Po=[0,.69444,0,0,.30556],yh=[0,.69444,0,0,.58056],bl=[0,.69444,0,0,.67223],ic=[0,.69444,0,0,.85556],nc=[0,.69444,0,0,.55834],zs=[0,.65556,.11156,0,.5],nu=[0,.69444,.08094,0,.70834],rc=[.17014,0,0,0,.44445],sc=[0,.69444,.0799,0,.5],bh=[0,.69444,0,0,.73752],xh=[0,.69444,.09205,0,.5],ru=[0,.69444,.09031,0,.77778],ac=[0,.69444,.07816,0,.27778],wh=[0,.69444,.00316,0,.5],Sh=[.19444,.69444,0,0,.83334],Eh=[.05556,.75,0,0,.83334],kh=[0,.75,0,0,.5],Th=[.125,.08333,0,0,.27778],Ah=[0,.08333,0,0,.27778],Qs=[0,.65556,0,0,.5],oc=[0,.69444,0,0,.47222],Rs=[0,.69444,0,0,.66667],Lh=[0,.69444,0,0,.59722],su=[0,.69444,0,0,.54167],au=[0,.69444,0,0,.70834],Dh=[.25,.75,0,0,.28889],xl=[0,.69444,0,0,.51667],fs=[0,.44444,0,0,.44445],Vs=[.19444,.44444,0,0,.51667],ou=[0,.44444,0,0,.38333],Ch=[0,.44444,0,0,.51667],wl=[0,.69444,0,0,.83334],Mh=[.35001,.85,0,0,.45834],Ih=[.35001,.85,0,0,.57778],Rh=[.35001,.85,0,0,.41667],Ph=[.35001,.85,0,0,.58334],Sl=[0,.72222,0,0,.55556],lc=[1e-5,.6,0,0,.66667],lu=[1e-5,.6,0,0,.77778],uc=[.25001,.75,0,0,.94445],Oh=[.306,.805,.19445,0,.47222],cc=[.30612,.805,.19445,0,.47222],Oo=[.25001,.75,0,0,.83334],to=[.35001,.85,0,0,.47222],hc=[.25001,.75,0,0,1.11111],fc=[.65002,1.15,0,0,.59722],Fh=[.65002,1.15,0,0,.81111],Bh=[.65002,1.15,0,0,.47222],Nh=[.65002,1.15,0,0,.66667],El=[0,.75,0,0,1],$h=[.55001,1.05,0,0,1.27778],dc=[.862,1.36,.44445,0,.55556],Fo=[.86225,1.36,.44445,0,.55556],Bo=[.55001,1.05,0,0,1.11111],uu=[.65002,1.15,0,0,.52778],Pr=[.65002,1.15,0,0,.61111],ea=[.55001,1.05,0,0,1.51112],cu=[.95003,1.45,0,0,.73611],Kh=[.95003,1.45,0,0,1.04445],Uh=[.95003,1.45,0,0,.52778],No=[.95003,1.45,0,0,.75],$o=[0,.75,0,0,1.44445],ha=[.95003,1.45,0,0,.58334],zh=[1.25003,1.75,0,0,.79167],fa=[1.25003,1.75,0,0,1.27778],Ge=[1.25003,1.75,0,0,.58334],kl=[1.25003,1.75,0,0,.80556],Ko=[0,.825,0,0,1.8889],hu=[1.25003,1.75,0,0,.63889],Da=[.64502,1.155,0,0,.875],Vh=[1e-5,.6,0,0,.875],pc=[-99e-5,.601,0,0,.66667],fu=[.64502,1.155,0,0,.66667],Gh=[1e-5,.9,0,0,.88889],Hh=[.65002,1.15,0,0,.88889],io=[.90001,0,0,0,.88889],du=[-.00499,.605,0,0,1.05556],Tl=[0,.12,0,0,.45],si=[0,.61111,0,0,.525],xr=[.08333,.69444,0,0,.525],Wh=[-.08056,.53055,0,0,.525],mc=[-.05556,.55556,0,0,.525],is=[0,.43056,0,0,.525],Al=[.22222,.43056,0,0,.525],Ll=[0,0,0,0,.525],nd={"AMS-Regular":{32:Je,65:je,66:Mt,67:je,68:je,69:Mt,70:Et,71:Ct,72:Ct,73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:Ct,76:Mt,77:[0,.68889,0,0,.94445],78:je,79:Nt,80:Et,81:Nt,82:je,83:Xt,84:Mt,85:je,86:je,87:[0,.68889,0,0,1],88:je,89:je,90:Mt,107:Xt,160:Je,165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:Xt,295:xe,710:zt,732:De,770:zt,771:De,989:Dt,1008:pi,8245:[0,.54986,0,0,.275],8463:xe,8487:je,8498:Xt,8502:Mt,8503:[0,.68889,0,0,.44445],8504:Mt,8513:[0,.68889,0,0,.63889],8592:ke,8594:ke,8602:U,8603:U,8606:j,8608:j,8610:ae,8611:ae,8619:ue,8620:ue,8621:[-.13313,.37788,0,0,1.38889],8622:U,8624:ve,8625:ve,8630:ht,8631:ht,8634:_t,8635:_t,8638:lt,8639:lt,8642:lt,8643:lt,8644:Vt,8646:Vt,8647:Vt,8648:ni,8649:Vt,8650:ni,8651:j,8652:j,8653:U,8654:U,8655:U,8666:gi,8667:gi,8669:[-.13313,.37788,0,0,1],8672:ri,8674:ri,8705:[0,.825,0,0,.5],8708:Xt,8709:Dt,8717:[0,.43056,0,0,.42917],8722:ke,8724:[.08198,.69224,0,0,.77778],8726:Dt,8733:vi,8736:oi,8737:oi,8738:[.03517,.52239,0,0,.72222],8739:Pt,8740:[.25142,.74111,0,0,.27778],8741:Jt,8742:[.25142,.74111,0,0,.5],8756:Mi,8757:Mi,8764:Ei,8765:[-.13313,.37788,0,0,.77778],8769:Ei,8770:Ya,8774:rn,8776:Co,8778:Dt,8782:Oi,8783:Oi,8785:_t,8786:_t,8787:_t,8790:vi,8791:Yi,8796:[.08198,.91667,0,0,.77778],8806:di,8807:di,8808:zi,8809:zi,8812:[.25583,.75583,0,0,.5],8814:Wi,8815:Wi,8816:rn,8817:rn,8818:Yi,8819:Yi,8822:Qn,8823:Qn,8828:Di,8829:Di,8830:Yi,8831:Yi,8832:Wi,8833:Wi,8840:rn,8841:rn,8842:Ki,8843:Ki,8847:vn,8848:vn,8858:_t,8859:_t,8861:_t,8862:Ri,8863:Ri,8864:Ri,8865:Ri,8872:[0,.69224,0,0,.61111],8873:oi,8874:[0,.69224,0,0,.88889],8876:Et,8877:Et,8878:je,8879:je,8882:vn,8883:vn,8884:Di,8885:Di,8888:[0,.54986,0,0,1.11111],8890:Eo,8891:mn,8892:mn,8901:[0,.54986,0,0,.27778],8903:Dt,8905:Dt,8906:Dt,8907:vi,8908:vi,8909:[-.03598,.46402,0,0,.77778],8910:sn,8911:sn,8912:vn,8913:vn,8914:rr,8915:rr,8916:Mi,8918:gn,8919:gn,8920:cr,8921:cr,8922:Qi,8923:Qi,8926:Di,8927:Di,8928:rn,8929:rn,8934:ki,8935:ki,8936:ki,8937:ki,8938:Wi,8939:Wi,8940:rn,8941:rn,8994:ii,8995:ii,9416:[.15559,.69224,0,0,.90222],9484:ve,9488:ve,9492:Re,9496:Re,9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:Ri,9633:Ri,9650:it,9651:it,9654:vn,9660:it,9661:it,9664:vn,9674:nt,9733:[.19444,.69224,0,0,.94445],10003:xt,10016:xt,10731:nt,10846:[.19444,.75583,0,0,.61111],10877:Di,10878:Di,10885:di,10886:di,10887:Ki,10888:Ki,10889:At,10890:At,10891:st,10892:st,10901:Di,10902:Di,10933:zi,10934:zi,10935:At,10936:At,10937:At,10938:At,10949:di,10950:di,10955:ft,10956:ft,57350:Pt,57351:Jt,57352:Dt,57353:pi,57356:zi,57357:zi,57358:Zi,57359:rn,57360:rn,57361:Zi,57366:zi,57367:zi,57368:zi,57369:zi,57370:Ki,57371:Ki},"Caligraphic-Regular":{32:Je,65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:Je},"Fraktur-Regular":{32:Je,33:[0,.69141,0,0,.29574],34:un,38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:_i,41:_i,42:[0,.62119,0,0,.27764],43:Fi,44:Pi,45:Fi,46:Pi,47:[.24982,.74947,0,0,.50181],48:Ni,49:Ni,50:Ni,51:Gi,52:Gi,53:Gi,54:wi,55:Gi,56:wi,57:Gi,58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:Bi,93:Bi,94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:Je,8216:un,8217:un,58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:Je,33:[0,.69444,0,0,.35],34:Or,35:[.19444,.69444,0,0,.95833],36:_r,37:[.05556,.75,0,0,.95833],38:Hi,39:In,40:$i,41:$i,42:[0,.75,0,0,.575],43:xn,44:[.19444,.15556,0,0,.31944],45:ou,46:[0,.15556,0,0,.31944],47:cn,48:Ai,49:Ai,50:Ai,51:Ai,52:Ai,53:Ai,54:Ai,55:Ai,56:Ai,57:Ai,58:wn,59:[.19444,.44444,0,0,.31944],60:Xi,61:er,62:Xi,63:[0,.69444,0,0,.54305],64:Hi,65:Nn,66:[0,.68611,0,0,.81805],67:Ln,68:[0,.68611,0,0,.88194],69:_l,70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:en,73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:an,77:[0,.68611,0,0,1.09166],78:en,79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:Nn,89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:tn,92:cn,93:tn,94:bn,95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:ji,99:Vi,100:ji,101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:ji,105:In,106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:In,109:[0,.44444,0,0,.95833],110:$n,111:br,112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:$n,118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:Vi,123:cn,124:tn,125:cn,126:[.35,.34444,0,0,.575],160:Je,163:[0,.69444,0,0,.86853],168:bn,172:[0,.44444,0,0,.76666],176:gr,177:xn,184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:xn,216:[.04861,.73472,0,0,.89444],223:Lh,230:[0,.44444,0,0,.83055],247:xn,248:[.09722,.54167,0,0,.575],305:wn,338:[0,.68611,0,0,1.16944],339:Br,567:[.19444,.44444,0,0,.35139],710:bn,711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:bn,715:bn,728:bn,729:In,730:gr,732:bn,733:bn,915:an,916:Pn,920:fr,923:Js,926:vl,928:en,931:Ln,933:fr,934:Ln,936:fr,937:Ln,8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:In,8217:In,8220:Or,8221:Or,8224:dr,8225:dr,8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:kt,8465:Fr,8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:Fr,8501:Ji,8592:Dn,8593:qn,8594:Dn,8595:qn,8596:Dn,8597:cn,8598:Ar,8599:Ar,8600:Ar,8601:Ar,8636:Dn,8637:Dn,8640:Dn,8641:Dn,8656:Dn,8657:Lr,8658:Dn,8659:Lr,8660:Dn,8661:[.25,.75,0,0,.70277],8704:ji,8706:[0,.69444,.06389,0,.62847],8707:ji,8709:_r,8711:Pn,8712:pr,8715:pr,8722:xn,8723:xn,8725:cn,8726:cn,8727:bi,8728:Kn,8729:Kn,8730:[.18,.82,0,0,.95833],8733:Br,8734:[0,.44444,0,0,1.14999],8736:oi,8739:tn,8741:cn,8743:Sn,8744:Sn,8745:Sn,8746:Sn,8747:[.19444,.69444,.12778,0,.56875],8764:er,8768:[.19444,.69444,0,0,.31944],8771:kr,8776:[.02444,.52444,0,0,.89444],8781:kr,8801:kr,8804:mi,8805:mi,8810:es,8811:es,8826:Xi,8827:Xi,8834:Xi,8835:Xi,8838:mi,8839:mi,8846:Sn,8849:mi,8850:mi,8851:Sn,8852:Sn,8853:xn,8854:xn,8855:xn,8856:xn,8857:xn,8866:Ji,8867:Ji,8868:Hi,8869:Hi,8900:Kn,8901:[-.02639,.47361,0,0,.31944],8902:bi,8968:nn,8969:nn,8970:nn,8971:nn,8994:En,8995:En,9651:vr,9657:bi,9661:vr,9667:bi,9711:Ar,9824:Wn,9825:Wn,9826:Wn,9827:Wn,9837:[0,.75,0,0,.44722],9838:qi,9839:qi,10216:$i,10217:$i,10815:en,10927:mi,10928:mi,57376:Xs},"Main-BoldItalic":{32:Je,33:[0,.69444,.11417,0,.38611],34:zn,35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:tr,40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:Un,49:Un,50:Un,51:Un,52:ls,53:Un,54:Un,55:ls,56:Un,57:Un,58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:Nr,64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:Dr,73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:Dr,79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:rs,95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:us,104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:us,114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:Je,168:[0,.69444,.11473,0,.59111],176:Wr,184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:cs,248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:cs,567:[.19444,.44444,.04611,0,.385],710:rs,711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:tr,730:Wr,732:Nr,733:Nr,915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:Dr,931:[0,.68611,.11431,0,.82666],933:hr,934:[0,.68611,.05632,0,.82666],936:hr,937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:tr,8217:tr,8220:[0,.69444,.16772,0,.62055],8221:zn},"Main-Italic":{32:Je,33:sr,34:ar,35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:sr,40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:yr,49:yr,50:yr,51:yr,52:ys,53:yr,54:yr,55:ys,56:yr,57:yr,58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:ui,64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:bs,73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:bs,79:Li,80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:bs,86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:mr,95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:Ms,104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:Ms,114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:Je,168:[0,.66786,.10474,0,.51111],176:$s,184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:Vn,248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:Vn,710:mr,711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:$s,732:[0,.66786,.11585,0,.51111],733:ui,915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:Li,923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:bs,931:[0,.68333,.12028,0,.71555],933:Cn,934:[0,.68333,.05986,0,.71555],936:Cn,937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:sr,8217:sr,8220:[0,.69444,.1685,0,.51444],8221:ar,8463:xe},"Main-Regular":{32:Je,33:kn,34:lr,35:Sh,36:ml,37:Eh,38:ss,39:kn,40:hs,41:hs,42:kh,43:as,44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:Ks,48:or,49:or,50:or,51:or,52:or,53:or,54:or,55:or,56:or,57:or,58:To,59:[.19444,.43056,0,0,.27778],60:gn,61:Ei,62:gn,63:oc,64:ss,65:jr,66:[0,.68333,0,0,.70834],67:Ea,68:[0,.68333,0,0,.76389],69:hl,70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:jr,73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:Sa,76:dl,77:[0,.68333,0,0,.91667],78:jr,79:Sa,80:hl,81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:Ea,85:jr,86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:jr,89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:la,92:Ks,93:la,94:lr,95:[.31,.12056,.02778,0,.5],97:xs,98:qr,99:ka,100:qr,101:ka,102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:qr,105:Xl,106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:kn,109:[0,.43056,0,0,.83334],110:ko,111:xs,112:Eo,113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:ko,118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:ka,123:Ks,124:la,125:Ks,126:[.35,.31786,0,0,.5],160:Je,163:[0,.69444,0,0,.76909],167:ws,168:fl,172:[0,.43056,0,0,.66667],176:qa,177:as,182:pl,184:rc,198:[0,.68333,0,0,.90278],215:as,216:[.04861,.73194,0,0,.77778],223:lr,230:[0,.43056,0,0,.72222],247:as,248:[.09722,.52778,0,0,.5],305:To,338:[0,.68333,0,0,1.01389],339:Do,567:[.19444,.43056,0,0,.30556],710:lr,711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:lr,715:lr,728:lr,729:Xl,730:qa,732:fl,733:lr,915:dl,916:Jl,920:Sa,923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:jr,931:Ea,933:Sa,934:Ea,936:Sa,937:Ea,8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:kn,8217:kn,8220:lr,8221:lr,8224:ws,8225:ws,8230:[0,.12,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:xe,8465:Ta,8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:Ta,8501:Us,8592:U,8593:Za,8594:U,8595:Za,8596:U,8597:Ks,8598:Is,8599:Is,8600:Is,8601:Is,8614:[.011,.511,0,0,1],8617:Ao,8618:Ao,8636:U,8637:U,8640:U,8641:U,8652:[.011,.671,0,0,1],8656:U,8657:pl,8658:U,8659:pl,8660:U,8661:[.25,.75,0,0,.61111],8704:qr,8706:[0,.69444,.05556,.08334,.5309],8707:qr,8709:ml,8711:Jl,8712:Lo,8715:Lo,8722:as,8723:as,8725:Ks,8726:Ks,8727:Mo,8728:ua,8729:ua,8730:[.2,.8,0,0,.83334],8733:Do,8734:ht,8736:oi,8739:la,8741:Ks,8743:Ys,8744:Ys,8745:Ys,8746:Ys,8747:[.19444,.69444,.11111,0,.41667],8764:Ei,8768:[.19444,.69444,0,0,.27778],8771:Ya,8773:[-.022,.589,0,0,1],8776:Co,8781:Ya,8784:[-.133,.67,0,0,.778],8801:Ya,8804:Ki,8805:Ki,8810:gl,8811:gl,8826:gn,8827:gn,8834:gn,8835:gn,8838:Ki,8839:Ki,8846:Ys,8849:Ki,8850:Ki,8851:Ys,8852:Ys,8853:as,8854:as,8855:as,8856:as,8857:as,8866:Us,8867:Us,8868:ss,8869:ss,8872:[.249,.75,0,0,.867],8900:ua,8901:[-.05555,.44445,0,0,.27778],8902:Mo,8904:[.005,.505,0,0,.9],8942:[.03,.9,0,0,.278],8943:[-.19,.31,0,0,1.172],8945:[-.1,.82,0,0,1.282],8968:Xa,8969:Xa,8970:Xa,8971:Xa,8994:Aa,8995:Aa,9136:Zn,9137:Zn,9651:Mn,9657:Mo,9661:Mn,9667:Mo,9711:Is,9824:On,9825:On,9826:On,9827:On,9837:[0,.75,0,0,.38889],9838:ts,9839:ts,10216:hs,10217:hs,10222:Zn,10223:Zn,10229:[.011,.511,0,0,1.609],10230:Zr,10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:Zr,10815:jr,10927:Ki,10928:Ki,57376:Xs},"Math-BoldItalic":{32:Je,48:br,49:br,50:br,51:Cr,52:Cr,53:Cr,54:Ai,55:Cr,56:Ai,57:Cr,65:Nn,66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:Ja,73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:_l,77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:kt,105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:ph,112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:Je,915:[0,.68611,.15972,0,.65694],916:Pn,920:[0,.68611,.03194,0,.86722],923:Js,926:[0,.68611,.07458,0,.84125],928:Ja,931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:vl,936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:ph,960:[0,.44444,.03704,0,.68241],961:Ql,962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:Ql,1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:Je,48:xs,49:xs,50:xs,51:Io,52:Io,53:Io,54:or,55:Io,56:or,57:Io,65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:gh,73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:mh,80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:eu,112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:Je,915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:mh,923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:gh,931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:eu,960:[0,.43056,.03588,0,.57003],961:Ro,962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:Ro,1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:Je,33:[0,.69444,0,0,.36667],34:nc,35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:Po,40:Qa,41:Qa,42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:Yr,49:Yr,50:Yr,51:Yr,52:Yr,53:Yr,54:Yr,55:Yr,56:Yr,57:Yr,58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:_h,64:ca,65:ca,66:ca,67:tu,68:La,69:[0,.69444,0,0,.64167],70:Us,71:ca,72:La,73:[0,.69444,0,0,.33056],74:_h,75:iu,76:yh,77:[0,.69444,0,0,.97778],78:La,79:La,80:tu,81:[.10556,.69444,0,0,.79445],82:tu,83:Us,84:ca,85:iu,86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:ca,89:[0,.69444,.0275,0,.73334],90:bl,91:yl,93:yl,94:Yr,95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:eo,99:[0,.45833,0,0,.48889],100:eo,101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:eo,105:vh,106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:vh,109:[0,.45833,0,0,.86667],110:tc,111:[0,.45833,0,0,.55],112:ec,113:ec,114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:tc,118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:Je,168:Yr,176:ca,180:Yr,184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:Yr,711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:Yr,729:Po,730:ca,732:Yr,733:Yr,915:yh,916:[0,.69444,0,0,.91667],920:ic,923:bl,926:ca,928:La,931:La,933:ic,934:La,936:ic,937:La,8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:Po,8217:Po,8220:nc,8221:nc},"SansSerif-Italic":{32:Je,33:[0,.69444,.05733,0,.31945],34:wh,35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:ac,40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:Th,45:[0,.44444,.01946,0,.33333],46:Ah,47:[.25,.75,.13164,0,.5],48:zs,49:zs,50:zs,51:zs,52:zs,53:zs,54:zs,55:zs,56:zs,57:zs,58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:Rs,66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:nu,73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:su,77:[0,.69444,.08094,0,.875],78:nu,79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:sc,95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:Je,168:[0,.67937,.06385,0,.5],176:bh,184:rc,305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:sc,711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:xh,715:lr,728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:bh,732:[0,.67659,.08826,0,.5],733:xh,915:[0,.69444,.13372,0,.54167],916:wl,920:[0,.69444,.07555,0,.77778],923:Us,926:[0,.69444,.12816,0,.66667],928:nu,931:[0,.69444,.11983,0,.72222],933:ru,934:[0,.69444,.04603,0,.72222],936:ru,937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:ac,8217:ac,8220:[0,.69444,.14205,0,.5],8221:wh},"SansSerif-Regular":{32:Je,33:[0,.69444,0,0,.31945],34:lr,35:Sh,36:ml,37:Eh,38:[0,.69444,0,0,.75834],39:kn,40:hs,41:hs,42:kh,43:as,44:Th,45:[0,.44444,0,0,.33333],46:Ah,47:Ks,48:Qs,49:Qs,50:Qs,51:Qs,52:Qs,53:Qs,54:Qs,55:Qs,56:Qs,57:Qs,58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:oc,64:Rs,65:Rs,66:Rs,67:ji,68:[0,.69444,0,0,.72223],69:Lh,70:[0,.69444,0,0,.56945],71:Rs,72:au,73:kn,74:oc,75:[0,.69444,0,0,.69445],76:su,77:[0,.69444,0,0,.875],78:au,79:[0,.69444,0,0,.73611],80:ji,81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:qr,84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:Rs,89:[0,.69444,.025,0,.66667],90:Us,91:Dh,93:Dh,94:lr,95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:xl,99:fs,100:xl,101:fs,102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:xl,105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:Ch,111:[0,.44444,0,0,.5],112:Vs,113:Vs,114:[0,.44444,.01389,0,.34167],115:ou,116:[0,.57143,0,0,.36111],117:Ch,118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:Je,168:[0,.67937,0,0,.5],176:Rs,184:rc,305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:lr,711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:lr,715:lr,728:lr,729:[0,.67937,0,0,.27778],730:Rs,732:[0,.67659,0,0,.5],733:lr,915:su,916:wl,920:ss,923:Us,926:Rs,928:au,931:Ta,933:ss,934:Ta,936:ss,937:Ta,8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:kn,8217:kn,8220:lr,8221:lr},"Script-Regular":{32:Je,65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:Je},"Size1-Regular":{32:Je,40:Mh,41:Mh,47:Ih,91:Rh,92:Ih,93:Rh,123:Ph,125:Ph,160:Je,710:Sl,732:Sl,770:Sl,771:Sl,8214:[-99e-5,.601,0,0,.77778],8593:lc,8595:lc,8657:lu,8659:lu,8719:uc,8720:uc,8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:cc,8748:Oh,8749:Oh,8750:cc,8896:Oo,8897:Oo,8898:Oo,8899:Oo,8968:to,8969:to,8970:to,8971:to,9168:pc,10216:to,10217:to,10752:hc,10753:hc,10754:hc,10756:Oo,10758:Oo},"Size2-Regular":{32:Je,40:fc,41:fc,47:Fh,91:Bh,92:Fh,93:Bh,123:Nh,125:Nh,160:Je,710:El,732:El,770:El,771:El,8719:$h,8720:$h,8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:Fo,8748:dc,8749:dc,8750:Fo,8896:Bo,8897:Bo,8898:Bo,8899:Bo,8968:uu,8969:uu,8970:uu,8971:uu,10216:Pr,10217:Pr,10752:ea,10753:ea,10754:ea,10756:Bo,10758:Bo},"Size3-Regular":{32:Je,40:cu,41:cu,47:Kh,91:Uh,92:Kh,93:Uh,123:No,125:No,160:Je,710:$o,732:$o,770:$o,771:$o,8730:[.95003,1.45,0,0,1],8968:ha,8969:ha,8970:ha,8971:ha,10216:No,10217:No},"Size4-Regular":{32:Je,40:zh,41:zh,47:fa,91:Ge,92:fa,93:Ge,123:kl,125:kl,160:Je,710:Ko,732:Ko,770:Ko,771:Ko,8730:[1.25003,1.75,0,0,1],8968:hu,8969:hu,8970:hu,8971:hu,9115:Da,9116:Vh,9117:Da,9118:Da,9119:Vh,9120:Da,9121:fu,9122:pc,9123:fu,9124:fu,9125:pc,9126:fu,9127:Gh,9128:Hh,9129:io,9130:[0,.3,0,0,.88889],9131:Gh,9132:Hh,9133:io,9143:[.88502,.915,0,0,1.05556],10216:kl,10217:kl,57344:du,57345:du,57680:Tl,57681:Tl,57682:Tl,57683:Tl},"Typewriter-Regular":{32:Ll,33:si,34:si,35:si,36:xr,37:xr,38:si,39:si,40:xr,41:xr,42:[0,.52083,0,0,.525],43:Wh,44:[.13889,.125,0,0,.525],45:Wh,46:[0,.125,0,0,.525],47:xr,48:si,49:si,50:si,51:si,52:si,53:si,54:si,55:si,56:si,57:si,58:is,59:[.13889,.43056,0,0,.525],60:mc,61:[-.19549,.41562,0,0,.525],62:mc,63:si,64:si,65:si,66:si,67:si,68:si,69:si,70:si,71:si,72:si,73:si,74:si,75:si,76:si,77:si,78:si,79:si,80:si,81:[.13889,.61111,0,0,.525],82:si,83:si,84:si,85:si,86:si,87:si,88:si,89:si,90:si,91:xr,92:xr,93:xr,94:si,95:[.09514,0,0,0,.525],96:si,97:is,98:si,99:is,100:si,101:is,102:si,103:Al,104:si,105:si,106:[.22222,.61111,0,0,.525],107:si,108:si,109:is,110:is,111:is,112:Al,113:Al,114:is,115:is,116:[0,.55358,0,0,.525],117:is,118:is,119:is,120:is,121:Al,122:is,123:xr,124:xr,125:xr,126:si,127:si,160:Ll,176:si,184:[.19445,0,0,0,.525],305:is,567:Al,711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:si,715:si,728:si,730:si,770:si,771:si,776:si,915:si,916:si,920:si,923:si,926:si,928:si,931:si,933:si,934:si,936:si,937:si,8216:si,8217:si,8242:si,9251:[.11111,.21944,0,0,.525]}},jh=/[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FAF]|[\uAC00-\uD7AF]/,ds=10,ps=.25,qh=1.2,Ca=.431,pu={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[Ca,Ca,Ca],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.5,.732,.925],num2:[.394,.384,.5],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[ps,ps,ps],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04]},no=[0,.5,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],gc=5,Zh={"\xA0":" ","\u200B":" ",\u00C5:"A",\u00C7:"C",\u00D0:"D",\u00DE:"o",\u00E5:"a",\u00E7:"c",\u00F0:"d",\u00FE:"o",\u0410:"A",\u0411:"B",\u0412:"B",\u0413:"F",\u0414:"A",\u0415:"E",\u0416:"K",\u0417:"3",\u0418:"N",\u0419:"N",\u041A:"K",\u041B:"N",\u041C:"M",\u041D:"H",\u041E:"O",\u041F:"N",\u0420:"P",\u0421:"C",\u0422:"T",\u0423:"y",\u0424:"O",\u0425:"X",\u0426:"U",\u0427:"h",\u0428:"W",\u0429:"W",\u042A:"B",\u042B:"X",\u042C:"B",\u042D:"3",\u042E:"X",\u042F:"R",\u0430:"a",\u0431:"b",\u0432:"a",\u0433:"r",\u0434:"y",\u0435:"e",\u0436:"m",\u0437:"e",\u0438:"n",\u0439:"n",\u043A:"n",\u043B:"n",\u043C:"m",\u043D:"n",\u043E:"o",\u043F:"n",\u0440:"p",\u0441:"c",\u0442:"o",\u0443:"y",\u0444:"b",\u0445:"x",\u0446:"n",\u0447:"n",\u0448:"w",\u0449:"w",\u044A:"a",\u044B:"m",\u044C:"a",\u044D:"e",\u044E:"m",\u044F:"r"};function ro(e,i){e===void 0&&(e=77);const r=nd[i][e];if(r)return{defaultMetrics:!1,depth:r[0],height:r[1],italic:r[2],skew:r[3],width:r[4]};if(e===11034)return{defaultMetrics:!0,depth:.2,height:.8,italic:0,skew:0,width:.8};const a=String.fromCodePoint(e);if(a in Zh)e=Zh[a].codePointAt(0);else if(jh.test(a))return e=77,{defaultMetrics:!0,depth:.2,height:.9,italic:0,skew:0,width:1};return{defaultMetrics:!0,depth:.2,height:.7,italic:0,skew:0,width:.8}}var mu={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],longrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],longleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],longleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],longrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],longleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],longleftrightarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],longRightleftharpoons:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716],longLeftrightharpoons:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},gu={widehat1:[1062,239,.24],widehat2:[2364,300,.3],widehat3:[2364,360,.36],widehat4:[2364,420,.42],widecheck1:[1062,239,.24],widecheck2:[2364,300,.3],widecheck3:[2364,360,.36],widecheck4:[2364,420,.42],widetilde1:[600,260,.26],widetilde2:[1033,286,.286],widetilde3:[2339,306,.306],widetilde4:[2340,312,.34],overarc:[1061,159,.3],underarc:[1061,159,.3]},Yh={doubleleftarrow:`M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,overarc:"M529 0c179 0 524 115 524 115 5 1 9 5 9 10 0 1-1 2-1 3l-4 22c-1 5-5 9-11 9h-2s-338-93-512-92c-174 0-513 92-513 92h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13 0 0 342-115 520-115z",underarc:`m 529 160
c -179 0 -524 -115 -524 -115
c -5 -1 -9 -5 -9 -10
c 0 -1 1 -2 1 -3
l 4 -22
c 1 -5 5 -9 11 -9
h 2
s 338 93 512 92
c 174 0 513 -92 513 -92
h 2
c 5 0 9 4 11 9
l 5 22
c 1 6 -2 12 -8 13
c 0 0 -342 115 -520 115
z
`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,widetilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,widetilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
181.476 676 181.476c-149 0-189-126.21-332-126.21z`,widetilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
-338 0-409-156.573-744-156.573z`,widetilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
-175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`};function _c(e){if(gu[e]){const[E,I,N]=gu[e],J=`<span class="stretchy" style="height:${N}em"><svg width="100%" height="${N}em" viewBox="0 0 ${E} ${I}" preserveAspectRatio="none" ><path fill="currentcolor" d="${Yh[e]}"></path></svg></span>`;return`<span style="display:inline-block;height:${Math.floor(100*N/2)/100}em;min-width:0">${J}</span>`}const[i,r,a,u]=mu[e];let p,m;const b=a/1e3;i.length===3?(p=["slice-1-of-3","slice-2-of-3","slice-3-of-3"],m=["xMinYMin","xMidYMin","xMaxYMin"]):i.length===2?(p=["slice-1-of-2","slice-2-of-2"],m=["xMinYMin","xMaxYMin"]):(p=["slice-1-of-1"],m=[u]);const w=i.map((E,I)=>`<span class="${p[I]}" style=height:${b}em><svg width=400em height=${b}em viewBox="0 0 400000 ${a}" preserveAspectRatio="${m[I]} slice"><path fill="currentcolor" d="${Yh[E]}"></path></svg></span>`).join("");return`<span style="display:inline-block;height:${b}em;min-width:${r}em;">${w}</span>`}function Xh(e){return mu[e]?mu[e][2]/1e3:gu[e][2]}function Dl(e){const i=[];for(let r=0;r<e.length;r++){let a=e.charCodeAt(r);if(a===13&&e.charCodeAt(r+1)===10&&(a=10,r++),(a===13||a===12)&&(a=10),a===0&&(a=65533),a>=55296&&a<=56319){const u=e.charCodeAt(r+1);if(u>=56320&&u<=57343){const p=a-55296,m=u-56320;a=wa(2,16)+p*wa(2,10)+m,r++}}i.push(a)}return i}var Uo=8205,rd=[[Uo,1],[65038,2],[127995,5],[129456,4],[917536,96]],_u,vc=[127462,127487];function yc(e){var i;if(_u===void 0){_u={};for(const r of rd)for(let a=r[0];a<=r[0]+r[1]-1;a++)_u[a]=!0}return(i=_u[e])!=null?i:!1}function sd(e){return e>=vc[0]&&e<=vc[1]}function Jh(e){if(/^[\u0020-\u00FF]*$/.test(e))return e;const i=[],r=Dl(e);let a=0;for(;a<r.length;){const u=r[a++],p=r[a];if(p===Uo){const m=a-1;for(a+=2;r[a]===Uo;)a+=2;i.push(String.fromCodePoint(...r.slice(m,a-m+1)))}else if(yc(p)){const m=a-1;for(;yc(r[a]);)a+=r[a]===Uo?2:1;i.push(String.fromCodePoint(...r.slice(m,2*a-m-1)))}else sd(u)?(a+=1,i.push(String.fromCodePoint(...r.slice(a-2,2)))):i.push(String.fromCodePoint(u))}return i}var Qh=class{constructor(e){this.obeyspaces=!1,this.pos=0,this.s=Jh(e)}end(){return this.pos>=this.s.length}get(){return this.pos<this.s.length?this.s[this.pos++]:""}peek(){return this.s[this.pos]}match(e){const i=typeof this.s=="string"?e.exec(this.s.slice(this.pos)):e.exec(this.s.slice(this.pos).join(""));return i!=null&&i[0]?(this.pos+=i[0].length,i[0]):""}next(){if(this.end())return null;if(!this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]+/)||this.obeyspaces&&this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]/))return"<space>";const e=this.get();if(e==="\\"){if(!this.end()){let i=this.match(/^[a-zA-Z\*]+/);return i?this.match(/^[ \f\n\r\t\v\u00A0\u2028\u2029]*/):i=this.get(),"\\"+i}}else{if(e==="{")return"<{>";if(e==="}")return"<}>";if(e==="^"){if(this.peek()==="^"){this.get();const i=this.match(/^(\^(\^(\^(\^[\da-f])?[\da-f])?[\da-f])?[\da-f])?[\da-f]{2}/);if(i)return String.fromCodePoint(Number.parseInt(i.slice(i.lastIndexOf("^")+1),16))}return e}else if(e==="#"){if(!this.end()){let i=!1;if(/[\d?@]/.test(this.peek())&&(i=!0,this.pos+1<this.s.length)){const r=this.s[this.pos+1];i=/[^\dA-Za-z]/.test(r)}return i?"#"+this.get():"#"}}else if(e==="$")return this.peek()==="$"?(this.get(),"<$$>"):"<$>"}return e}};function ad(e,i){var r,a,u,p;const m=[];let b=e.next();if(b&&b!=="\\relax"){if(b==="\\noexpand")b=e.next(),b&&m.push(b);else if(b==="\\obeyspaces")e.obeyspaces=!0;else if(b==="\\bgroup")m.push("<{>");else if(b==="\\egroup")m.push("<}>");else if(b==="\\string"){if(b=e.next(),b)if(b.startsWith("\\"))for(const w of b)m.push(w==="\\"?"\\backslash":w);else b==="<{>"?m.push("\\{"):b==="<space>"?m.push("~"):b==="<}>"&&m.push("\\}")}else if(b==="\\csname"){for(;e.peek()==="<space>";)e.next();let w="",E=!1,I=[];do{if(I.length===0)if(/^#[\d?@]$/.test(e.peek())){const N=e.get().slice(1);I=zo((a=(r=i==null?void 0:i(N))!=null?r:i==null?void 0:i("?"))!=null?a:"\\placeholder{}",i),b=I[0]}else b=e.next(),I=b?[b]:[];E=I.length===0,!E&&b==="\\endcsname"&&(E=!0,I.shift()),E||(E=b==="<$>"||b==="<$$>"||b==="<{>"||b==="<}>"||typeof b=="string"&&b.length>1&&b.startsWith("\\")),E||(w+=I.shift())}while(!E);w&&m.push("\\"+w),m.push(...I)}else if(b!=="\\endcsname")if(b.length>1&&b.startsWith("#")){const w=b.slice(1);m.push(...zo((p=(u=i==null?void 0:i(w))!=null?u:i==null?void 0:i("?"))!=null?p:"\\placeholder{}",i))}else m.push(b)}return m}function zo(e,i=null){const r=[];let a="";for(const m of e.toString().split(/\r?\n/)){a&&r.push(a),a=" ";const b=m.match(/((?:\\%)|[^%])*/);b!==null&&r.push(b[0])}const u=new Qh(Ut(r.join(""))),p=[];do p.push(...ad(u,i));while(!u.end());return p}function on(e){let i="";const r=[];for(const a of e)a&&(i&&/^[a-zA-Z\*]/.test(a)&&r.push(i),r.push(a),/^\\[a-zA-Z]+\*?[\"\'][^\ ]+$/.test(a)&&r.push(" "),i=/\\[a-zA-Z]+\*?$/.test(a)?" ":"");return r.join("")}function ir(e,...i){return console.assert(e.startsWith("\\")),i.length===0?e:on([e,...i.map(r=>`{${r}}`)])}function Mr(e){return on(e.map(i=>{var r;return(r={"<space>":" ","<$$>":"$$","<$>":"$","<{>":"{","<}>":"}"}[i])!=null?r:i}))}var od=class dh{constructor(i){dh._registry[i]=this}static createAtom(i,r,a){return dh._registry[i].createAtom(r,Me(r,i),a)}static serialize(i,r){var a;if(!i||i.length===0)return"";if((a=r.skipStyles)!=null&&a){const u=[];for(const p of Gs(i)){const m=dh._registry[p[0].mode];u.push(...m.serialize(p,r))}return on(u)}return on(ta(i,r))}static getFont(i,r,a){return dh._registry[i].getFont(r,a)}};od._registry={};var Ss=od;function Gs(e){const i=[];let r=[],a="NONE";for(const u of e)u.type!=="first"&&(u.mode!==a?(r.length>0&&i.push(r),r=[u],a=u.mode):r.push(u));return r.length>0&&i.push(r),i}function Ma(e,i){const r=[];let a=[],u;for(const p of e)if(p.type!=="first"&&p.style){let m;i==="variant"?(m=p.style.variant,p.style.variantStyle&&p.style.variantStyle!=="up"&&(m+="-"+p.style.variantStyle)):m=p.style[i],m===u?a.push(p):(a.length>0&&r.push(a),a=[p],u=m)}return a.length>0&&r.push(a),r}function ef(e,i){var r;const{parent:a}=e[0],u=a==null?void 0:a.computedStyle.color,p=[];for(const m of Gs(e)){const b=i.defaultMode;for(const w of Ma(m,"color")){const E=w[0].computedStyle,I=Ss._registry[w[0].mode].serialize(w,f(P({},i),{defaultMode:b==="text"?"text":"math"}));!i.skipStyles&&E.color&&E.color!=="none"&&(!a||u!==E.color)?p.push(ir("\\textcolor",(r=E.verbatimColor)!=null?r:E.color,on(I))):p.push(on(I))}}return p}function ld(e,i){const{parent:r}=e[0],a=r==null?void 0:r.computedStyle.backgroundColor;return Ma(e,"backgroundColor").map(u=>{var p;if(u.length>0||u[0].type!=="box"){const m=u[0].computedStyle;if(m.backgroundColor&&m.backgroundColor!=="none"&&(!r||a!==m.backgroundColor))return ir("\\colorbox",(p=m.verbatimBackgroundColor)!=null?p:m.backgroundColor,on(ef(u,f(P({},i),{defaultMode:"text"}))))}return on(ef(u,i))})}function ta(e,i){if(e.length===0)return[];const{parent:r}=e[0],a=r==null?void 0:r.computedStyle.fontSize,u=[];for(const p of Ma(e,"fontSize")){const m=p[0].computedStyle.fontSize,b=ld(p,i);b&&(m&&m!=="auto"&&(!r||a!==m)?u.push(["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][m],...b):u.push(...b))}return u}function vu(e){return e?{mord:"ord",mbin:"bin",mop:"op",mrel:"rel",mopen:"open",mclose:"close",mpunct:"punct",minner:"inner",spacing:"ignore",latex:"latex",composition:"inner",error:"inner",placeholder:"ord",supsub:"ignore"}[e]:void 0}function Vo(e){if(e.length===0)return"ord";const i=vu(e[0].type),r=vu(e[e.length-1].type);return i&&i===r?i:"ord"}function Cl(e,i){if(typeof e=="string")return e;if(typeof e=="number"){console.assert(Number.isFinite(e));const r=Math.ceil(100*e)/100;return r===0?"0":r.toString()+(i!=null?i:"")}return""}var $t=class $p{constructor(i,r){var a,u,p,m,b;if(typeof i=="number"?this.value=String.fromCodePoint(i):typeof i=="string"?this.value=i:k(i)?this.children=i.filter(E=>E!==null):i&&i instanceof $p&&(this.children=[i]),this.children)for(const E of this.children)E.parent=this;this.type=(a=r==null?void 0:r.type)!=null?a:"ignore",this.isSelected=(r==null?void 0:r.isSelected)===!0,r!=null&&r.caret&&(this.caret=r.caret),this.classes=(u=r==null?void 0:r.classes)!=null?u:"",this.isTight=(p=r==null?void 0:r.isTight)!=null?p:!1,r!=null&&r.attributes&&(this.attributes=r.attributes);let w=r==null?void 0:r.fontFamily;r!=null&&r.style&&this.value&&(w=(b=Ss.getFont((m=r.mode)!=null?m:"math",this,f(P({variant:"normal"},r.style),{letterShapeStyle:r.letterShapeStyle})))!=null?b:void 0),w||(w="Main-Regular"),this._height=0,this._depth=0,this._width=0,this.hasExplicitWidth=!1,this.skew=0,this.italic=0,this.maxFontSize=0,this.scale=1,(r==null?void 0:r.maxFontSize)!==void 0&&(this.maxFontSize=r.maxFontSize),ud(this,w)}set atomID(i){i===void 0||i.length===0||(this.id=i)}selected(i){if(this.isSelected!==i&&(this.isSelected=i,this.children))for(const r of this.children)r.selected(i)}setStyle(i,r,a){if(r===void 0)return;const u=Cl(r,a);u.length>0&&(this.cssProperties||(this.cssProperties={}),this.cssProperties[i]=u)}setTop(i){Number.isFinite(i)&&Math.abs(i)>.01&&(this.cssProperties||(this.cssProperties={}),this.cssProperties.top=Cl(i,"em"),this.height-=i,this.depth+=i)}get left(){var i;return(i=this.cssProperties)!=null&&i["margin-left"]?Number.parseFloat(this.cssProperties["margin-left"]):0}set left(i){Number.isFinite(i)&&(i===0?this.cssProperties&&delete this.cssProperties["margin-left"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-left"]=Cl(i,"em")))}set right(i){Number.isFinite(i)&&(i===0?this.cssProperties&&delete this.cssProperties["margin-right"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-right"]=Cl(i,"em")))}set bottom(i){Number.isFinite(i)&&(i===0?this.cssProperties&&delete this.cssProperties["margin-bottom"]:(this.cssProperties||(this.cssProperties={}),this.cssProperties["margin-bottom"]=Cl(i,"em")))}get width(){return this._width*this.scale}set width(i){this._width=i,this.hasExplicitWidth=!0}set softWidth(i){}get height(){return this._height*this.scale}set height(i){this._height=i}get depth(){return this._depth*this.scale}set depth(i){this._depth=i}wrap(i){const r=i.parent;if(!r)return this;i.isPhantom&&this.setStyle("opacity",0);const a=i.color;a&&a!==r.color&&this.setStyle("color",a);let u=i.backgroundColor;this.isSelected&&(u=A(u)),u&&u!==r.backgroundColor&&(this.setStyle("background-color",u),this.setStyle("display","inline-block"));const p=i.scalingFactor;return this.scale=p,this.skew*=p,this.italic*=p,this}toMarkup(){var i,r,a,u;let p=(i=this.value)!=null?i:"";if(this.children)for(const oe of this.children)p+=oe.toMarkup();let m="";if(this.svgBody)m=_c(this.svgBody);else if(this.svgOverlay){m='<span style="',m+="display: inline-block;",m+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`,m+=`vertical-align:${Math.floor(100*this.depth)/100}em;`,m+='">',m+=p,m+="</span>",m+='<svg style="position:absolute;overflow:visible;',m+=`height:${Math.floor(100*(this.height+this.depth))/100}em;`;const oe=(r=this.cssProperties)==null?void 0:r.padding;oe?(m+=`top:${oe};`,m+=`left:${oe};`,m+=`width:calc(100% - 2 * ${oe} );`):m+="top:0;left:0;width:100%;",m+="z-index:2;",m+='"',this.svgStyle&&(m+=this.svgStyle),m+=` viewBox="0 0 ${Math.floor(100*this.width)/100} ${Math.floor(100*(this.height+this.depth))/100}"`,m+=`>${this.svgOverlay}</svg>`}let b="";const w=this.classes.split(" ");w.push((a={latex:"ML__raw-latex",placeholder:"ML__placeholder",error:"ML__error"}[this.type])!=null?a:""),this.caret==="latex"&&w.push("ML__latex-caret"),this.isSelected&&w.push("ML__selected");const E=w.length===1?w[0]:w.filter((oe,ge,He)=>oe.length>0&&He.indexOf(oe)===ge).join(" ");if(E.length>0&&(b+=` class="${E}"`),this.id&&(b+=` data-atom-id=${this.id}`),this.cssId&&(b+=` id="${this.cssId.replace(/ /g,"-")}" `),this.attributes&&(b+=" "+Object.keys(this.attributes).map(oe=>`${oe}="${this.attributes[oe]}"`).join(" ")),this.htmlData){const oe=this.htmlData.split(",");for(const ge of oe){const He=ge.match(/([^=]+)=(.+$)/);if(He){const Ft=He[1].trim().replace(/ /g,"-");Ft&&(b+=` data-${Ft}="${He[2]}" `)}else{const Ft=ge.trim().replace(/ /g,"-");Ft&&(b+=` data-${Ft} `)}}}const I=(u=this.cssProperties)!=null?u:{};this.hasExplicitWidth&&I.width===void 0&&(I.width=`${Math.ceil(this._width*100)/100}em`);const N=Object.keys(I).map(oe=>`${oe}:${I[oe]}`);if(this.scale!==void 0&&this.scale!==1&&(p.length>0||m.length>0)&&N.push(`font-size: ${Math.ceil(this.scale*1e4)/100}%`),this.htmlStyle){const oe=this.htmlStyle.split(";");let ge="";for(const He of oe){const Ft=He.match(/([^=]+):(.+$)/);if(Ft){const Ve=Ft[1].trim().replace(/ /g,"-");Ve&&(ge+=`${Ve}:${Ft[2]};`)}}ge&&(b+=` style="${ge}"`)}N.length>0&&(b+=` style="${N.join(";")}"`);let J="";return b.length>0||m.length>0?J=`<span${b}>${p}${m}</span>`:J=p,this.caret==="text"?J+='<span class="ML__text-caret"></span>':this.caret==="math"&&(J+='<span class="ML__caret"></span>'),J}tryCoalesceWith(i){if(this.svgBody||!this.value||i.svgBody||!i.value)return!1;const r=this.children&&this.children.length>0,a=i.children&&i.children.length>0;if(r||a)return!1;if(i.cssProperties||this.cssProperties){for(const w of["border","border-left","border-right","border-right-width","left","margin","margin-left","margin-right","padding","position","width"])if(i.cssProperties&&w in i.cssProperties||this.cssProperties&&w in this.cssProperties)return!1}const u=this.cssProperties?Object.keys(this.cssProperties).length:0,p=i.cssProperties?Object.keys(i.cssProperties).length:0;if(u!==p)return!1;if(u>0){for(const w of Object.keys(this.cssProperties))if(this.cssProperties[w]!==i.cssProperties[w])return!1}const m=this.classes.trim().replace(/\s+/g," ").split(" "),b=i.classes.trim().replace(/\s+/g," ").split(" ");if(m.length!==b.length)return!1;m.sort(),b.sort();for(const[w,E]of m.entries())if(E==="vertical-separator"||E!==b[w])return!1;return this.value+=i.value,this.height=Math.max(this.height,i.height),this.depth=Math.max(this.depth,i.depth),this._width=this._width+i._width,this.maxFontSize=Math.max(this.maxFontSize,i.maxFontSize),this.italic=i.italic,!0}};function bc(e){if(!e||e.length===0)return[];e[0].children=bc(e[0].children);const i=[e[0]];for(let r=1;r<e.length;r++)i[i.length-1].tryCoalesceWith(e[r])||(e[r].children=bc(e[r].children),i.push(e[r]));return i}function yu(e){return e.children&&(e.children=bc(e.children)),e}function bu(e,i){if(!e)return new $t(null,i);const r=new $t(null,{classes:"ML__strut",type:"ignore"});r.setStyle("height",Math.max(0,e.height),"em");const a=[r];if(e.depth!==0){const u=new $t(null,{classes:"ML__strut--bottom",type:"ignore"});u.setStyle("height",e.height+e.depth,"em"),u.setStyle("vertical-align",-e.depth,"em"),a.push(u)}return a.push(e),new $t(a,f(P({},i),{type:"lift"}))}function xu(e){const i=Xh(e)/2,r=new $t(null,{maxFontSize:0});return r.height=i+.166,r.depth=i-.166,r.svgBody=e,r}function ud(e,i){var r;if(e.type==="latex"){e.height=.9,e.depth=.2,e._width=1;return}if(e.value){e.height=-1/0,e.depth=-1/0,e._width=0,e.skew=-1/0,e.italic=-1/0;for(let a=0;a<e.value.length;a++){const u=ro(e.value.codePointAt(a),i);e.height=Math.max(e.height,u.height),e.depth=Math.max(e.depth,u.depth),e._width+=u.width,e.skew=u.skew,e.italic=u.italic}return}if(e.children&&e.children.length>0){let a=-1/0,u=-1/0,p=0;for(const m of e.children)m.height>a&&(a=m.height),m.depth>u&&(u=m.depth),p=Math.max(p,(r=m.maxFontSize)!=null?r:0);e.height=a,e.depth=u,e._width=e.children.reduce((m,b)=>m+b.width,0),e.maxFontSize=p}}function tf(e){if("individualShift"in e){const i=e.individualShift;let r=i[0];const a=[r],u=-r.shift-r.box.depth;let p=u;for(let m=1;m<i.length;m++){const b=i[m],w=-b.shift-p-b.box.depth,E=w-(r.box.height+r.box.depth);p=p+w,a.push(E),a.push(b),r=b}return[a,u]}if("top"in e){let i=e.top;for(const r of e.children)i-=typeof r=="number"?r:r.box.height+r.box.depth;return[e.children,i]}else{if("bottom"in e)return[e.children,-e.bottom];if("firstBaseline"in e){const i=e.firstBaseline[0];if(typeof i=="number")throw new Error("First child must be an element.");return[e.firstBaseline,-i.box.depth]}else if("shift"in e){const i=e.children[0];if(typeof i=="number")throw new Error("First child must be an element.");return[e.children,-i.box.depth-e.shift]}}return[null,0]}function cd(e){var i;const[r,a]=tf(e);if(!r)return[[],0,0];const u=new $t(null,{classes:"pstrut"});let p=0;for(const ge of r)if(typeof ge!="number"){const He=ge.box;p=Math.max(p,He.maxFontSize,He.height)}p+=2,u.height=p,u.setStyle("height",p,"em");const m=[];let b=a,w=a,E=a,I=0;for(const ge of r){if(typeof ge=="number")E+=ge;else{const He=ge.box,Ft=(i=ge.classes)!=null?i:[],Ve=new $t([u,He],{classes:Ft.join(" "),style:ge.style});He.setStyle("height",He.height+He.depth,"em"),He.setStyle("display","inline-block"),Ve.setStyle("top",-p-E-He.depth,"em"),ge.marginLeft&&Ve.setStyle("margin-left",ge.marginLeft,"em"),ge.marginRight&&Ve.setStyle("margin-right",ge.marginRight,"em"),m.push(Ve),E+=He.height+He.depth,I=Math.max(I,Ve.width)}b=Math.min(b,E),w=Math.max(w,E)}m.forEach(ge=>{ge.softWidth=I});const N=new $t(m,{classes:"vlist"});if(N.softWidth=I,N.height=w,N.setStyle("height",w,"em"),b>=0)return[[new $t(N,{classes:"vlist-r"})],w,-b];const J=new $t(new $t(null),{classes:"vlist"});J.height=-b,J.setStyle("height",-b,"em");const oe=new $t(8203,{classes:"vlist-s",maxFontSize:0});return oe.softWidth=0,oe.height=0,oe.depth=0,[[new $t([N,oe],{classes:"vlist-r"}),new $t(J,{classes:"vlist-r"})],w,-b]}var wr=class extends $t{constructor(e,i){var r;const[a,u,p]=cd(e);super(a.length===1?a[0]:a,{type:i==null?void 0:i.type,classes:((r=i==null?void 0:i.classes)!=null?r:"")+" vlist-t"+(a.length===2?" vlist-t2":"")}),this.height=u,this.depth=p,this.softWidth=a.reduce((m,b)=>Math.max(m,b.width),0)}};function hd(e,i){var r,a,u,p,m;const b=e.metrics,w=new $t(i.base),E=(r=i.baseShift)!=null?r:0,I=(a=i.slant)!=null?a:0;let N=0,J=0;i.above&&(N=(u=i.aboveShift)!=null?u:Math.max(b.bigOpSpacing1,b.bigOpSpacing3-i.above.depth)),i.below&&(J=(p=i.belowShift)!=null?p:Math.max(b.bigOpSpacing2,b.bigOpSpacing4-i.below.height));let oe=null;if(i.below&&i.above){const ge=b.bigOpSpacing5+i.below.height+i.below.depth+J+w.depth+E;oe=new wr({bottom:ge,children:[b.bigOpSpacing5,{box:i.below,marginLeft:-I,classes:["ML__center"]},J,{box:w,classes:["ML__center"]},N,{box:i.above,marginLeft:I,classes:["ML__center"]},b.bigOpSpacing5]}).wrap(e)}else if(i.below&&!i.above)oe=new wr({top:w.height-E,children:[b.bigOpSpacing5,{box:i.below,marginLeft:-I,classes:["ML__center"]},J,{box:w,classes:["ML__center"]}]}).wrap(e);else if(!i.below&&i.above){const ge=w.depth+E;oe=new wr({bottom:ge,children:[{box:w,classes:["ML__center"]},N,{box:i.above,marginLeft:I,classes:["ML__center"]},b.bigOpSpacing5]}).wrap(e)}else{const ge=w.depth+E;oe=new wr({bottom:ge,children:[{box:w},b.bigOpSpacing5]}).wrap(e)}return new $t(oe,{type:(m=i.type)!=null?m:"op"})}var xc=7,wu=6,Su=5,so=4,Go=3,Es=2,Ia=1,$r=0,Ra=class{constructor(e,i,r){this.id=e,this.sizeDelta=i,this.cramped=r;const a={"-4":2,"-3":1,0:0}[i];this.metrics=Object.keys(pu).reduce((u,p)=>f(P({},u),{[p]:pu[p][a]}),{})}getFontSize(e){return Math.max(1,e+this.sizeDelta)}get sup(){return Ps[[$r,Ia,$r,Ia,Es,Go,Es,Go][this.id]]}get sub(){return Ps[[$r,$r,$r,$r,Es,Es,Es,Es][this.id]]}get fracNum(){return Ps[[$r,Ia,$r,Ia,Es,Go,so,Su][this.id]]}get fracDen(){return Ps[[$r,$r,$r,$r,Es,Es,so,so][this.id]]}get cramp(){return Ps[[$r,$r,Es,Es,so,so,wu,wu][this.id]]}get isTight(){return this.sizeDelta<0}},ao={7:new Ra(xc,0,!1),6:new Ra(wu,0,!0),5:new Ra(Su,0,!1),4:new Ra(so,0,!0),3:new Ra(Go,-3,!1),2:new Ra(Es,-3,!0),1:new Ra(Ia,-4,!1),0:new Ra($r,-4,!0)},Ps=f(P({},ao),{displaystyle:ao[xc],textstyle:ao[Su],scriptstyle:ao[Go],scriptscriptstyle:ao[Ia]});function wc(e,i){var r;if(!e)return 0;const a={pt:1,mm:7227/2540,cm:7227/254,ex:35271/8192,px:3/4,em:ds,bp:803/800,dd:1238/1157,pc:12,in:72.27,mu:10/18}[(r=e.unit)!=null?r:"pt"];if(Number.isFinite(i)){const u=wa(10,i);return Math.round(e.dimension/ds*a*u)/u}return e.dimension*a}function nf(e,i){if(e===null)return 0;const r=wc(e)/ds;if(Number.isFinite(i)){const a=wa(10,i);return Math.round(r*a)/a}return r}function Sc(e){var i;return`${e.dimension}${(i=e.unit)!=null?i:"pt"}`}function rf(e){let i=Sc(e.glue);return e.grow&&e.grow.dimension!==0&&(i+=` plus ${Sc(e.grow)}`),e.shrink&&e.shrink.dimension!==0&&(i+=` minus ${Sc(e.shrink)}`),i}function Yn(e){var i,r;if(e==null)return null;let a="";if("dimension"in e&&(a=`${e.dimension}${(i=e.unit)!=null?i:"pt"}`),"glue"in e&&(a=rf(e)),"number"in e)if(!("base"in e)||e.base==="decimal")a=Number(e.number).toString();else if(e.base==="alpha")a=`\`${String.fromCodePoint(e.number)}`;else{const u=Math.round(e.number)>>>0;e.base==="hexadecimal"?(a=Number(u).toString(16).toUpperCase(),u<=255?a=a.padStart(2,"0"):u<=65535?a=a.padStart(4,"0"):u<=16777215?a=a.padStart(6,"0"):a=a.padStart(8,"0"),a=`"${a}`):e.base==="octal"&&(a=Number(u).toString(8),u<=63?a=a.padStart(2,"0"):u<=30583?a=a.padStart(4,"0"):a=a.padStart(8,"0"),a=`'${a}`)}return"register"in e&&("factor"in e&&(e.factor===-1?a="-":e.factor!==1&&(a=Number(e.factor).toString())),"global"in e&&e.global&&(a+="\\global"),a+=`\\${e.register}`),"string"in e&&(a=e.string),(r=e.relax)!=null&&r&&(a+="\\relax"),a}function Rn(e,i){return e==null?null:"number"in e?f(P({},e),{number:e.number*i}):"register"in e?"factor"in e&&e.factor?f(P({},e),{factor:e.factor*i}):f(P({},e),{factor:i}):"dimension"in e?f(P({},e),{dimension:e.dimension*i}):"glue"in e?e.shrink&&e.grow?{glue:Rn(e.glue,i),shrink:Rn(e.shrink,i),grow:Rn(e.grow,i)}:e.shrink?{glue:Rn(e.glue,i),shrink:Rn(e.shrink,i)}:e.grow?{glue:Rn(e.glue,i),grow:Rn(e.grow,i)}:{glue:Rn(e.glue,i)}:null}var oo={"p@":{dimension:1},"z@":{dimension:0},maxdimen:{dimension:16383.99999},hfuzz:{dimension:.1},vfuzz:{dimension:.1},overfullrule:{dimension:5},hsize:{dimension:6.5,unit:"in"},vsize:{dimension:8.9,unit:"in"},parindent:{dimension:20},maxdepth:{dimension:4},splitmaxdepth:{register:"maxdimen"},boxmaxdepth:{register:"maxdimen"},delimitershortfall:{dimension:5},nulldelimiterspace:{dimension:1.2,unit:"pt"},scriptspace:{dimension:.5},topskip:{dimension:10},splittopskip:{dimension:10},normalbaselineskip:{dimension:12},normallineskip:{dimension:1},normallineskiplimit:{dimension:0},jot:{dimension:3},doublerulesep:{dimension:2},arrayrulewidth:{dimension:.4},arraycolsep:{dimension:5},fboxsep:{dimension:3},fboxrule:{dimension:.4},"z@skip":{glue:{dimension:0},shrink:{dimension:0},grow:{dimension:0}},hideskip:{glue:{dimension:-1e3},grow:{dimension:1,unit:"fill"}},"@flushglue":{glue:{dimension:0},grow:{dimension:1,unit:"fill"}},parskip:{glue:{dimension:0},grow:{dimension:1}},abovedisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},abovedisplayshortskip:{glue:{dimension:0},grow:{dimension:3}},belowdisplayskip:{glue:{dimension:12},grow:{dimension:3},shrink:{dimension:9}},belowdisplayshortskip:{glue:{dimension:7},grow:{dimension:3},shrink:{dimension:4}},parfillskip:{glue:{dimension:0},grow:{dimension:1,unit:"fil"}},thinmuskip:{glue:{dimension:3,unit:"mu"}},medmuskip:{glue:{dimension:4,unit:"mu"},grow:{dimension:2,unit:"mu"},shrink:{dimension:4,unit:"mu"}},thickmuskip:{glue:{dimension:5,unit:"mu"},grow:{dimension:5,unit:"mu"}},smallskipamount:{glue:{dimension:3},grow:{dimension:1},shrink:{dimension:1}},medskipamount:{glue:{dimension:6},grow:{dimension:2},shrink:{dimension:3}},bigskipamount:{glue:{dimension:12},grow:{dimension:2},shrink:{dimension:4}},pretolerance:100,tolerance:200,hbadness:1e3,vbadness:1e3,linepenalty:10,hyphenpenalty:50,exhyphenpenalty:50,binoppenalty:700,relpenalty:500,clubpenalty:150,widowpenalty:150,displaywidowpenalty:50,brokenpenalty:100,predisplaypenalty:1e4,doublehyphendemerits:1e4,finalhyphendemerits:5e3,adjdemerits:1e4,tracinglostchars:1,uchyph:1,delimiterfactor:901,defaulthyphenchar:"\\-",defaultskewchar:-1,newlinechar:-1,showboxbreadth:5,showboxdepth:3,errorcontextlines:5,interdisplaylinepenalty:100,interfootnotelinepenalty:100,baselineSkip:1.2,arraystretch:1,month:new Date().getMonth()+1,day:new Date().getDate(),year:new Date().getFullYear()};function da(){return P({},oo)}function Ec(){return{registers:da(),smartFence:!1,renderPlaceholder:void 0,placeholderSymbol:"\u25A2",letterShapeStyle:$.locale.startsWith("fr")?"french":"tex",minFontScale:0,colorMap:Ke,backgroundColorMap:Rt,getMacro:e=>rt(e,Wt())}}var fn=class Kp{constructor(i,r){var a,u,p,m,b,w,E,I,N,J,oe,ge,He,Ft,Ve;let St;i!=null&&i.parent?(this.parent=i.parent,St=i.parent,this.registers={}):(St=P(P({},Ec()),(a=i==null?void 0:i.from)!=null?a:{}),this.registers=St.registers),St.atomIdsSettings&&(this.atomIdsSettings=P({},St.atomIdsSettings)),this.renderPlaceholder=St.renderPlaceholder,this.isPhantom=(m=(p=i==null?void 0:i.isPhantom)!=null?p:(u=this.parent)==null?void 0:u.isPhantom)!=null?m:!1,this.letterShapeStyle=St.letterShapeStyle,this.minFontScale=St.minFontScale,r!=null&&r.color&&r.color!=="none"?this.color=r.color:this.color=(w=(b=this.parent)==null?void 0:b.color)!=null?w:"",r!=null&&r.backgroundColor&&r.backgroundColor!=="none"?this.backgroundColor=r.backgroundColor:this.backgroundColor=(I=(E=this.parent)==null?void 0:E.backgroundColor)!=null?I:"",r!=null&&r.fontSize&&r.fontSize!=="auto"&&r.fontSize!==((N=this.parent)==null?void 0:N.size)?this.size=r.fontSize:this.size=(oe=(J=this.parent)==null?void 0:J.size)!=null?oe:gc;let Kt=(He=(ge=this.parent)==null?void 0:ge.mathstyle)!=null?He:Ps.displaystyle;if(typeof(i==null?void 0:i.mathstyle)=="string"){if(St instanceof Kp)switch(i.mathstyle){case"cramp":Kt=Kt.cramp;break;case"superscript":Kt=Kt.sup;break;case"subscript":Kt=Kt.sub;break;case"numerator":Kt=Kt.fracNum;break;case"denominator":Kt=Kt.fracDen;break}switch(i.mathstyle){case"textstyle":Kt=Ps.textstyle;break;case"displaystyle":Kt=Ps.displaystyle;break;case"scriptstyle":Kt=Ps.scriptstyle;break;case"scriptscriptstyle":Kt=Ps.scriptscriptstyle;break;case"":case"auto":break}}this.mathstyle=Kt,this.smartFence=St.smartFence,this.placeholderSymbol=St.placeholderSymbol,this.colorMap=(Ft=St.colorMap)!=null?Ft:Lt=>Lt,this.backgroundColorMap=(Ve=St.backgroundColorMap)!=null?Ve:Lt=>Lt,this.getMacro=St.getMacro,console.assert(this.parent!==void 0||this.registers!==void 0)}makeID(){if(!this.atomIdsSettings)return;if(this.atomIdsSettings.overrideID)return this.atomIdsSettings.overrideID;if(typeof this.atomIdsSettings.seed!="number")return`${Date.now().toString(36).slice(-2)}${Math.floor(Math.random()*1e5).toString(36)}`;const i=this.atomIdsSettings.seed.toString(36);return this.atomIdsSettings.seed+=1,i}scale(i){return i*this.effectiveFontSize}get scalingFactor(){return this.parent?this.effectiveFontSize/this.parent.effectiveFontSize:1}get isDisplayStyle(){return this.mathstyle.id===xc||this.mathstyle.id===wu}get isCramped(){return this.mathstyle.cramped}get isTight(){return this.mathstyle.isTight}get metrics(){return this.mathstyle.metrics}get effectiveFontSize(){return Math.max(no[Math.max(1,this.size+this.mathstyle.sizeDelta)],this.minFontScale)}getRegister(i){var r;if((r=this.registers)!=null&&r[i])return this.registers[i];if(this.parent)return this.parent.getRegister(i)}getRegisterAsNumber(i){const r=this.getRegister(i);if(typeof r=="number")return r;if(typeof r=="string")return Number(r)}getRegisterAsGlue(i){var r;if((r=this.registers)!=null&&r[i]){const a=this.registers[i];return typeof a=="object"&&"glue"in a?a:typeof a=="object"&&"dimension"in a?{glue:{dimension:a.dimension}}:typeof a=="number"?{glue:{dimension:a}}:void 0}if(this.parent)return this.parent.getRegisterAsGlue(i)}getRegisterAsEm(i,r){return nf(this.getRegisterAsDimension(i),r)}getRegisterAsDimension(i){var r;if((r=this.registers)!=null&&r[i]){const a=this.registers[i];return typeof a=="object"&&"glue"in a?a.glue:typeof a=="object"&&"dimension"in a?a:typeof a=="number"?{dimension:a}:void 0}if(this.parent)return this.parent.getRegisterAsDimension(i)}setRegister(i,r){if(r===void 0){delete this.registers[i];return}this.registers[i]=r}evaluate(i){if(!i||!("register"in i))return i;let r=this;if("global"in i&&i.global)for(;r.parent;)r=r.parent;let a=1;"factor"in i&&i.factor!==1&&i.factor!==void 0&&(a=i.factor);const u=r.getRegister(i.register);if(u===void 0)return;if(typeof u=="string")return{string:Number(u).toString()+u};if(typeof u=="number")return{number:a*u};const p=r.evaluate(u);if(p!==void 0)return"string"in p?{string:Number(u).toString()+p.string}:"number"in p?{number:a*p.number}:"dimension"in p?f(P({},p),{dimension:a*p.dimension}):"glue"in p?f(P({},p),{glue:f(P({},p.glue),{dimension:a*p.glue.dimension}),shrink:p.shrink?f(P({},p.shrink),{dimension:a*p.shrink.dimension}):void 0,grow:p.grow?f(P({},p.grow),{dimension:a*p.grow.dimension}):void 0}):i}toDimension(i){const r=this.evaluate(i);return r===void 0?null:"dimension"in r?r:"glue"in r?r.glue:"number"in r?{dimension:r.number}:null}toEm(i,r){if(i===null)return 0;const a=this.toDimension(i);return a===null?0:wc(a,r)/ds}toNumber(i){if(i===null)return null;const r=this.evaluate(i);return r===void 0?null:"number"in r?r.number:"dimension"in r?r.dimension:"glue"in r?r.glue.dimension:"string"in r?Number(r.string):null}toColor(i){var r,a;if(i===null)return null;const u=this.evaluate(i);return u===void 0?null:"string"in u?(a=(r=this.colorMap)==null?void 0:r.call(this,u.string))!=null?a:u.string:null}toBackgroundColor(i){var r,a;if(i===null)return null;const u=this.evaluate(i);return u===void 0?null:"string"in u?(a=(r=this.backgroundColorMap)==null?void 0:r.call(this,u.string))!=null?a:u.string:null}},Ho=["body","above","below","superscript","subscript"];function lo(e){return typeof e=="string"&&Ho.includes(e)}function Eu(e){return e!==void 0&&Array.isArray(e)&&e.length===2}var ut=class wo{constructor(i){var r,a,u,p,m,b;this.type=i.type,typeof i.value=="string"&&(this.value=i.value),this.command=(a=(r=i.command)!=null?r:this.value)!=null?a:"",this.mode=(u=i.mode)!=null?u:"math",i.isFunction&&(this.isFunction=!0),i.limits&&(this.subsupPlacement=i.limits),this.style=P({},i.style),this.displayContainsHighlight=(p=i.displayContainsHighlight)!=null?p:!1,this.captureSelection=(m=i.captureSelection)!=null?m:!1,this.skipBoundary=(b=i.skipBoundary)!=null?b:!1,i.verbatimLatex!==void 0&&i.verbatimLatex!==null&&(this.verbatimLatex=i.verbatimLatex),i.args&&(this.args=i.args),i.body&&(this.body=i.body),this._changeCounter=0}static createBox(i,r,a){var u;if(!r)return null;const p=sf(r),m=[];for(const w of p){const E=w[0].style,I=fd(i,w,{style:{color:E.color,backgroundColor:E.backgroundColor,fontSize:E.fontSize}});I&&m.push(I)}if(m.length===0)return null;const b=((u=a==null?void 0:a.classes)!=null?u:"").trim();return m.length===1&&!b&&!(a!=null&&a.type)?m[0].wrap(i):new $t(m,{classes:b,type:a==null?void 0:a.type}).wrap(i)}static serialize(i,r){return Ss.serialize(i,r)}static commonAncestor(i,r){if(i===r||i.parent===r.parent)return i.parent;const a=new WeakSet;let{parent:u}=i;for(;u;)a.add(u),u=u.parent;for(u=r.parent;u;){if(a.has(u))return u;u=u.parent}console.assert(!!u)}static fromJson(i){return typeof i=="string"?new wo({type:"mord",value:i,mode:"math"}):new wo(i)}get latexMode(){return this.mode==="math"?"math":"text"}toJson(){const i={};if(this.type&&(i.type=this.type),this.mode!=="math"&&(i.mode=this.mode),this.command&&this.command!==this.value&&(i.command=this.command),this.value!==void 0&&(i.value=this.value),this.style&&Object.keys(this.style).length>0&&(i.style=P({},this.style)),this.verbatimLatex!==void 0&&(i.verbatimLatex=this.verbatimLatex),this.subsupPlacement&&(i.subsupPlacement=this.subsupPlacement),this.explicitSubsupPlacement&&(i.explicitSubsupPlacement=!0),this.isFunction&&(i.isFunction=!0),this.displayContainsHighlight&&(i.displayContainsHighlight=!0),this.isExtensibleSymbol&&(i.isExtensibleSymbol=!0),this.skipBoundary&&(i.skipBoundary=!0),this.captureSelection&&(i.captureSelection=!0),this.args&&(i.args=kc(this.args)),this._branches)for(const r of Object.keys(this._branches))this._branches[r]&&(i[r]=this._branches[r].filter(a=>a.type!=="first").map(a=>a.toJson()));return i.type==="mord"&&Object.keys(i).length===2&&"value"in i?i.value:i}get changeCounter(){return this.parent?this.parent.changeCounter:this._changeCounter}set isDirty(i){if(i){this.parent||this._changeCounter++,"verbatimLatex"in this&&(this.verbatimLatex=void 0),this._children=void 0;let{parent:r}=this;for(;r;)r.parent||r._changeCounter++,"verbatimLatex"in r&&(r.verbatimLatex=void 0),r._children=void 0,r=r.parent}}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):this.body&&this.command?on([ir(this.command,this.bodyToLatex(i)),this.supsubToLatex(i)]):this.body?on([this.bodyToLatex(i),this.supsubToLatex(i)]):!this.value||this.value==="\u200B"?"":this.command}bodyToLatex(i){var r;return Ss.serialize(this.body,f(P({},i),{defaultMode:(r=i.defaultMode)!=null?r:this.latexMode}))}aboveToLatex(i){return Ss.serialize(this.above,i)}belowToLatex(i){return Ss.serialize(this.below,i)}supsubToLatex(i){let r="";if(i=f(P({},i),{defaultMode:"math"}),this.branch("subscript")!==void 0){const a=Ss.serialize(this.subscript,i);a.length===0?r+="_{}":a.length===1?/^[0-9]$/.test(a)?r+=`_${a}`:r+=`_{${a}}`:r+=`_{${a}}`}if(this.branch("superscript")!==void 0){const a=Ss.serialize(this.superscript,i);a.length===0?r+="^{}":a.length===1?a==="\u2032"?r+="^\\prime ":a==="\u2033"?r+="^\\doubleprime ":/^[0-9]$/.test(a)?r+=`^${a}`:r+=`^{${a}}`:r+=`^{${a}}`}return r}get treeDepth(){let i=1,r=this.parent;for(;r;)r=r.parent,i+=1;return i}get inCaptureSelection(){let i=this;for(;i;){if(i.captureSelection)return!0;i=i.parent}return!1}get parentPrompt(){let i=this.parent;for(;i;){if(i.type==="prompt"&&!i.captureSelection)return i;i=i.parent}return null}branch(i){if(lo(i)&&this._branches)return this._branches[i]}get branches(){if(!this._branches)return[];const i=[];for(const r of Ho)this._branches[r]&&i.push(r);return i}createBranch(i){return console.assert(lo(i)),lo(i)?(this._branches?this._branches[i]||(this._branches[i]=[this.makeFirstAtom(i)]):this._branches={[i]:[this.makeFirstAtom(i)]},this.isDirty=!0,this._branches[i]):[]}get row(){return Eu(this.parentBranch)?this.parentBranch[0]:-1}get col(){return Eu(this.parentBranch)?this.parentBranch[1]:-1}get body(){var i;return(i=this._branches)==null?void 0:i.body}set body(i){this.setChildren(i,"body")}get superscript(){var i;return(i=this._branches)==null?void 0:i.superscript}set superscript(i){this.setChildren(i,"superscript")}get subscript(){var i;return(i=this._branches)==null?void 0:i.subscript}set subscript(i){this.setChildren(i,"subscript")}get above(){var i;return(i=this._branches)==null?void 0:i.above}set above(i){this.setChildren(i,"above")}get below(){var i;return(i=this._branches)==null?void 0:i.below}set below(i){this.setChildren(i,"below")}get computedStyle(){var i,r;const a=typeof this.style.verbatimColor=="string",u=typeof this.style.verbatimBackgroundColor=="string",p=P(P({},(r=(i=this.parent)==null?void 0:i.computedStyle)!=null?r:{}),this.style);return delete p.variant,delete p.variantStyle,u||delete p.verbatimBackgroundColor,a||delete p.verbatimColor,p}applyStyle(i){this.isDirty=!0,this.style=P(P({},this.style),i),this.style.fontFamily==="none"&&delete this.style.fontFamily,this.style.fontShape==="auto"&&delete this.style.fontShape,this.style.fontSeries==="auto"&&delete this.style.fontSeries,this.style.color==="none"&&(delete this.style.color,delete this.style.verbatimColor),this.style.backgroundColor==="none"&&(delete this.style.backgroundColor,delete this.style.verbatimBackgroundColor),this.style.fontSize==="auto"&&delete this.style.fontSize;for(const r of this.children)r.applyStyle(i)}getInitialBaseElement(){var i,r,a;return this.hasEmptyBranch("body")?this:(console.assert(((i=this.body)==null?void 0:i[0].type)==="first"),(a=(r=this.body[1])==null?void 0:r.getInitialBaseElement())!=null?a:this)}getFinalBaseElement(){return this.hasEmptyBranch("body")?this:this.body[this.body.length-1].getFinalBaseElement()}isCharacterBox(){return this.type==="leftright"||this.type==="genfrac"||this.type==="subsup"||this.type==="delim"||this.type==="array"||this.type==="surd"?!1:this.getFinalBaseElement().type==="mord"}hasEmptyBranch(i){const r=this.branch(i);return r?(console.assert(r.length>0),console.assert(r[0].type==="first"),r.length===1):!0}setChildren(i,r){var a;if(!i||(console.assert(lo(r)),!lo(r)))return;console.assert(((a=i[0])==null?void 0:a.type)!=="first");const u=[this.makeFirstAtom(r),...i];this._branches?this._branches[r]=u:this._branches={[r]:u};for(const p of i)p.parent=this,p.parentBranch=r;this.isDirty=!0}makeFirstAtom(i){const r=new wo({type:"first",mode:this.mode});return r.parent=this,r.parentBranch=i,r}addChild(i,r){console.assert(i.type!=="first"),this.createBranch(r).push(i),this.isDirty=!0,i.parent=this,i.parentBranch=r}addChildBefore(i,r){console.assert(r.parentBranch!==void 0);const a=this.createBranch(r.parentBranch);a.splice(a.indexOf(r),0,i),this.isDirty=!0,i.parent=this,i.parentBranch=r.parentBranch}addChildAfter(i,r){console.assert(r.parentBranch!==void 0);const a=this.createBranch(r.parentBranch);a.splice(a.indexOf(r)+1,0,i),this.isDirty=!0,i.parent=this,i.parentBranch=r.parentBranch}addChildren(i,r){const a=this.createBranch(r);for(const u of i)u.parent=this,u.parentBranch=r,a.push(u);this.isDirty=!0}addChildrenAfter(i,r){console.assert(i.length===0||i[0].type!=="first"),console.assert(r.parentBranch!==void 0);const a=this.createBranch(r.parentBranch);a.splice(a.indexOf(r)+1,0,...i),this.isDirty=!0;for(const u of i)u.parent=this,u.parentBranch=r.parentBranch;return i[i.length-1]}removeBranch(i){const r=this.branch(i);if(lo(i)&&(this._branches[i]=void 0),!r)return[];for(const a of r)a.parent=void 0,a.parentBranch=void 0;return console.assert(r[0].type==="first"),r.shift(),this.isDirty=!0,r}removeChild(i){if(console.assert(i.parent===this),i.type==="first")return;const r=this.branch(i.parentBranch),a=r.indexOf(i);console.assert(a>=0),r.splice(a,1),this.isDirty=!0,i.parent=void 0,i.parentBranch=void 0}get siblings(){return this.parent?this.parent.branch(this.parentBranch):[]}get firstSibling(){return this.siblings[0]}get lastSibling(){const{siblings:i}=this;return i[i.length-1]}get isFirstSibling(){return this===this.firstSibling}get isLastSibling(){return this===this.lastSibling}get hasNoSiblings(){return this.siblings.length===1}get leftSibling(){console.assert(this.parent!==void 0);const i=this.parent.branch(this.parentBranch);return i[i.indexOf(this)-1]}get rightSibling(){console.assert(this.parent!==void 0);const i=this.parent.branch(this.parentBranch);return i[i.indexOf(this)+1]}get hasChildren(){return!!(this._branches&&this.children.length>0)}get firstChild(){return console.assert(this.hasChildren),this.children[0]}get lastChild(){console.assert(this.hasChildren);const{children:i}=this;return i[i.length-1]}get children(){if(this._children)return this._children;if(!this._branches)return[];const i=[];for(const r of Ho)if(this._branches[r])for(const a of this._branches[r])i.push(...a.children),i.push(a);return this._children=i,i}render(i){if(this.type==="first"&&!i.atomIdsSettings)return null;const r=Me(this.command,this.mode);if(r!=null&&r.render)return r.render(this,i);const a=new fn({parent:i},this.style);let u=this.createBox(a,{classes:this.parent?"":"ML__base"});return u?(!this.subsupPlacement&&(this.superscript||this.subscript)&&(u=this.attachSupsub(a,{base:u})),u.wrap(a)):null}attachSupsub(i,r){var a;const u=r.base,p=this.superscript,m=this.subscript;if(!p&&!m)return u;let b=null,w=null;const E=(a=r.isCharacterBox)!=null?a:this.isCharacterBox();let I=0;if(p){const He=new fn({parent:i,mathstyle:"superscript"});b=wo.createBox(He,p),E||(I=u.height-i.metrics.supDrop*He.scalingFactor)}let N=0;if(m){const He=new fn({parent:i,mathstyle:"subscript"});w=wo.createBox(He,m),E||(N=u.depth+i.metrics.subDrop*He.scalingFactor)}let J;i.isDisplayStyle?J=i.metrics.sup1:i.isCramped?J=i.metrics.sup3:J=i.metrics.sup2;const oe=.5/ds/i.scalingFactor;let ge=null;if(w&&b){I=Math.max(I,J,b.depth+.25*i.metrics.xHeight),N=Math.max(N,i.metrics.sub2);const He=i.metrics.defaultRuleThickness;if(I-b.depth-(w.height-N)<4*He){N=4*He-(I-b.depth)+w.height;const Ve=.8*i.metrics.xHeight-(I-b.depth);Ve>0&&(I+=Ve,N-=Ve)}const Ft=this.isExtensibleSymbol&&u.italic?-u.italic:0;ge=new wr({individualShift:[{box:w,shift:N,marginLeft:Ft},{box:b,shift:-I}]}).wrap(i)}else w&&!b?(N=Math.max(N,i.metrics.sub1,w.height-.8*Ca),ge=new wr({shift:N,children:[{box:w,marginRight:oe,marginLeft:this.isCharacterBox()?-u.italic:0}]})):!w&&b&&(I=Math.max(I,J,b.depth+.25*Ca),ge=new wr({shift:-I,children:[{box:b,marginRight:oe}]}));return new $t([u,new $t(ge,{caret:this.caret,isSelected:this.isSelected,classes:"msubsup"})],{type:r.type})}attachLimits(i,r){const a=this.superscript?wo.createBox(new fn({parent:i,mathstyle:"superscript"},this.style),this.superscript):null,u=this.subscript?wo.createBox(new fn({parent:i,mathstyle:"subscript"},this.style),this.subscript):null;return!a&&!u?r.base.wrap(i):hd(i,f(P({},r),{above:a,below:u}))}bind(i,r){if(!r||i.isPhantom||this.value==="\u200B")return r;let a=this.parent;for(;a&&!a.captureSelection;)a=a.parent;return a!=null&&a.captureSelection||(this.id||(this.id=i.makeID()),r.atomID=this.id),r}createBox(i,r){var a,u,p,m;const b=(a=this.value)!=null?a:this.body,w=(u=r==null?void 0:r.boxType)!=null?u:vu(this.type);let E=(p=r==null?void 0:r.classes)!=null?p:"";this.mode==="text"&&(E+=" ML__text");const I=typeof b=="string"||b===void 0?new $t(b!=null?b:null,{type:w,isSelected:this.isSelected,mode:this.mode,maxFontSize:i.scalingFactor,style:f(P({variant:"normal"},this.style),{fontSize:Math.max(1,i.size+i.mathstyle.sizeDelta)}),letterShapeStyle:i.letterShapeStyle,classes:E}):(m=wo.createBox(i,b,{type:w,classes:E}))!=null?m:new $t(null);return i.isTight&&(I.isTight=!0),(this.mode!=="math"||this.style.variant==="main")&&(I.italic=0),I.right=I.italic,this.bind(i,I),this.caret&&!this.superscript&&!this.subscript&&(I.caret=this.caret),I}isDigit(){var i;return this.type==="mord"&&this.value?/^[\d,\.]$/.test(this.value):this.type==="group"&&((i=this.body)==null?void 0:i.length)===2?this.body[0].type==="first"&&this.body[1].value===",":!1}asDigit(){var i;return this.type==="mord"&&this.value&&/^[\d,\.]$/.test(this.value)?this.value:this.type==="group"&&((i=this.body)==null?void 0:i.length)===2&&this.body[0].type==="first"&&this.body[1].value===","?".":""}};function sf(e){let i;const r=[];let a=[];for(const u of e)if(!i&&!u.style)a.push(u);else{const p=u.computedStyle;i&&p.color===i.color&&p.backgroundColor===i.backgroundColor&&p.fontSize===i.fontSize?a.push(u):(a.length>0&&r.push(a),a=[u],i=p)}return a.length>0&&r.push(a),r}function fd(e,i,r){var a,u,p,m,b;if(!i||i.length===0)return null;const w=new fn({parent:e},r.style),E=!((a=w.atomIdsSettings)!=null&&a.groupNumbers);let I=[];if(i.length===1){const J=i[0],oe=J.render(w);oe&&(E&&J.isSelected&&oe.selected(!0),I=[oe])}else{let J="",oe=!0;for(const ge of i){(u=w.atomIdsSettings)!=null&&u.groupNumbers&&J&&(oe&&ge.isDigit()||!oe&&Wo(ge))&&(w.atomIdsSettings.overrideID=J);const He=ge.render(w);w.atomIdsSettings&&(w.atomIdsSettings.overrideID=void 0),He&&((p=w.atomIdsSettings)!=null&&p.groupNumbers&&((ge.isDigit()||Wo(ge))&&(!J||oe!==ge.isDigit())&&(oe=ge.isDigit(),J=(m=ge.id)!=null?m:""),J&&(!(ge.isDigit()||Wo(ge))||!ge.hasEmptyBranch("superscript")||!ge.hasEmptyBranch("subscript"))&&(J="")),E&&ge.isSelected&&He.selected(!0),I.push(He))}}if(I.length===0)return null;const N=new $t(I,f(P({isTight:w.isTight},r),{type:(b=r.type)!=null?b:"lift"}));return N.isSelected=I.every(J=>J.isSelected),N.wrap(w)}function Wo(e){return e.mode==="text"}function kc(e){return e.map(i=>i===null?"<null>":Array.isArray(i)&&i[0]instanceof ut?{atoms:i.map(r=>r.toJson())}:typeof i=="object"&&"group"in i?{group:i.group.map(r=>r.toJson())}:i)}var Pa=class Up extends ut{constructor(i,r,a){super({type:"text",command:i,mode:"text",displayContainsHighlight:!0}),this.value=r,this.verbatimLatex=r,this.applyStyle(a)}static fromJson(i){return new Up(i.command,i.value,i.style)}render(i){const r=this.createBox(i);return this.caret&&(r.caret=this.caret),r}_serialize(i){var r;return(r=this.verbatimLatex)!=null?r:bt("text",this.value.codePointAt(0))}};function O0(e,i){if(e.direction===i.direction){const r=e.ranges.length;if(i.ranges.length===r){let a=0;for(;a<r&&dd(e.ranges[a],i.ranges[a])==="equal";)a++;return a===r?"equal":"different"}}return"different"}function dd(e,i){return e[0]===i[0]&&e[1]===i[1]?"equal":"different"}function Kr(e){let i=1/0,r=-1/0;for(const a of e.ranges)i=Math.min(i,a[0],a[1]),r=Math.max(r,a[0],a[1]);return[i,r]}function pa(e){return typeof e=="number"&&!Number.isNaN(e)}function jo(e){return Array.isArray(e)&&e.length===2}function ku(e){return e!=null&&typeof e=="object"&&"ranges"in e&&Array.isArray(e.ranges)}function pd(e,i){const r=e.at(i);let a;if(r){a=r.mode;let u=r.parent;for(;!a&&u;)u&&(a=u.mode),u=u.parent}return a}function Tu(e,i){if(!i)return"";if(typeof i=="string")return i;if(!e||i.after===void 0)return i.value;let r=!1,a=!1,u=!1,p=!1,m=!1,b=!1,w=!1,E=!1,I=!1,N=!1,J=!1,oe=!1,ge=!1,He=!1,Ft=!1,Ve=e[0],St=0;for(;Ve!=null&&Ve.type&&/^(subsup|placeholder)$/.test(Ve.type);)St+=1,Ve=e[St];return r=!Ve||Ve.type==="first",Ve&&(He=Ve.mode==="text",a=!He&&Ve.type==="mord"&&me.test(Ve.value),u=!He&&Ve.type==="mord"&&/\d+$/.test(Ve.value),p=!He&&Ve.isFunction,m=Ve.type==="genfrac",b=Ve.type==="surd",w=Ve.type==="mbin",E=Ve.type==="mrel",I=Ve.type==="mop"||Ve.type==="operator"||Ve.type==="extensible-symbol",N=Ve.type==="mpunct"||Ve.type==="minner",J=Ve.type==="array",oe=Ve.type==="mopen",ge=Ve.type==="mclose"||Ve.type==="leftright",Ft=Ve.type==="space"),i.after.includes("nothing")&&r||i.after.includes("letter")&&a||i.after.includes("digit")&&u||i.after.includes("function")&&p||i.after.includes("frac")&&m||i.after.includes("surd")&&b||i.after.includes("binop")&&w||i.after.includes("relop")&&E||i.after.includes("operator")&&I||i.after.includes("punct")&&N||i.after.includes("array")&&J||i.after.includes("openfence")&&oe||i.after.includes("closefence")&&ge||i.after.includes("text")&&He||i.after.includes("space")&&Ft?i.value:""}function Tc(e,i,r){return r?Tu(e,r[i]):""}var Ac={"&":"\\&","%":"\\%",$:"\\$","''":"^{\\doubleprime}","'''":"^{\\prime\\prime\\prime}","''''":"^{\\prime\\prime\\prime\\prime}",alpha:"\\alpha",delta:"\\delta",Delta:"\\Delta",pi:"\\pi",Pi:"\\Pi",theta:"\\theta",Theta:"\\Theta",ii:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryI"},jj:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\imaginaryJ"},ee:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\exponentialE"},nabla:"\\nabla",grad:"\\nabla",del:"\\partial",deg:{after:"digit+space",value:"\\degree"},infty:"\\infty","\u221E":"\\infty",oo:{after:"nothing+digit+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\infty"},"\u2211":"\\sum",sum:"\\sum_{#?}^{#?}",int:"\\int_{#?}^{#?}",prod:"\\prod_{#?}^{#?}",sqrt:"\\sqrt{#?}","\u2206":"\\differentialD","\u2202":"\\differentialD",arcsin:"\\arcsin",arccos:"\\arccos",arctan:"\\arctan",arcsec:"\\arcsec",arccsc:"\\arccsc",arsinh:"\\arsinh",arcosh:"\\arcosh",artanh:"\\artanh",arcsech:"\\arcsech",arccsch:"\\arccsch",arg:"\\arg",ch:"\\ch",cosec:"\\cosec",cosh:"\\cosh",cot:"\\cot",cotg:"\\cotg",coth:"\\coth",csc:"\\csc",ctg:"\\ctg",cth:"\\cth",sec:"\\sec",sinh:"\\sinh",sh:"\\sh",tanh:"\\tanh",tg:"\\tg",th:"\\th",sin:"\\sin",cos:"\\cos",tan:"\\tan",lg:"\\lg",lb:"\\lb",log:"\\log",ln:"\\ln",exp:"\\exp",lim:"\\lim_{#?}",dx:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD x"},dy:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD y"},dt:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\differentialD t"},AA:"\\forall",EE:"\\exists","!EE":"\\nexists","&&":"\\land",xin:{after:"nothing+text+relop+punct+openfence+space",value:"x \\in"},sint:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\sin t"},in:{after:"nothing+letter+closefence",value:"\\in"},"!in":"\\notin",NN:"\\mathbb{N}",ZZ:"\\Z",QQ:"\\Q",RR:"\\R",CC:"\\C",xx:"\\times","+-":"\\pm","\u2260":"\\ne","!=":"\\ne","\u2265":"\\ge",">=":"\\ge","\u2264":"\\le","<=":"\\le","<<":"\\ll",">>":"\\gg","~~":"\\approx","\u2248":"\\approx","?=":"\\questeq","\xF7":"\\div","\xAC":"\\neg",":=":"\\coloneq","::":"\\Colon","(:":"\\langle",":)":"\\rangle",beta:"\\beta",chi:"\\chi",epsilon:"\\epsilon",varepsilon:"\\varepsilon",eta:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\eta"},gamma:"\\gamma",Gamma:"\\Gamma",iota:"\\iota",kappa:"\\kappa",lambda:"\\lambda",Lambda:"\\Lambda",mu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\mu"},nu:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\nu"},\u00B5:"\\mu",phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\phi"},Phi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Phi"},varphi:"\\varphi",psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\psi"},Psi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Psi"},rho:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\rho"},sigma:"\\sigma",Sigma:"\\Sigma",tau:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\tau"},vartheta:"\\vartheta",upsilon:"\\upsilon",xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space",value:"\\xi"},Xi:{after:"nothing+digit+function+frac+surd+binop+relop+punct+array+openfence+closefence+space+text",value:"\\Xi"},zeta:"\\zeta",omega:"\\omega",Omega:"\\Omega",\u03A9:"\\omega",forall:"\\forall",exists:"\\exists","!exists":"\\nexists",":.":"\\therefore",liminf:"\\liminf_{#?}",limsup:"\\limsup_{#?}",argmin:"\\operatorname*{arg~min}_{#?}",argmax:"\\operatorname*{arg~max}_{#?}",det:"\\det",mod:"\\bmod{#?}","(mod":"\\pmod{#?}",max:"\\max",min:"\\min",erf:"\\operatorname{erf}",erfc:"\\operatorname{erfc}",bessel:"\\operatorname{bessel}",mean:"\\operatorname{mean}",median:"\\operatorname{median}",fft:"\\operatorname{fft}",lcm:"\\operatorname{lcm}",gcd:"\\operatorname{gcd}",randomReal:"\\operatorname{randomReal}",randomInteger:"\\operatorname{randomInteger}",Re:"\\operatorname{Re}",Im:"\\operatorname{Im}",mm:{after:"nothing+digit+operator",value:"\\operatorname{mm}"},cm:{after:"nothing+digit+operator",value:"\\operatorname{cm}"},km:{after:"nothing+digit+operator",value:"\\operatorname{km}"},kg:{after:"nothing+digit+operator",value:"\\operatorname{kg}"},"...":"\\ldots","+...":"+\\cdots","-...":"-\\cdots","->...":"\\to\\cdots","-->...":"\\longrightarrow\\cdots","->":"\\to","|->":"\\mapsto","-->":"\\longrightarrow","<--":"\\longleftarrow","=>":"\\Rightarrow","==>":"\\Longrightarrow","<=>":"\\Leftrightarrow","<->":"\\leftrightarrow","(.)":"\\odot","(+)":"\\oplus","(/)":"\\oslash","(*)":"\\otimes","(-)":"\\ominus","||":"\\Vert","*":"\\cdot","**":"\\star","***":"\\ast","//":"\\slash","\\\\":"\\backslash",setminus:"\\backslash","|><":"\\ltimes","><|":"\\rtimes","|><|":"\\bowtie","-:":"\\div",divide:"\\div","@":"\\circ","^^":"\\wedge","^^^":"\\bigwedge",vv:"\\vee",vvv:"\\bigvee",nn:"\\cap",nnn:"\\bigcap",uu:"\\cup",uuu:"\\bigcup","-=":"\\equiv","~=":"\\cong",lt:"<","lt=":"\\leq",gt:">","gt=":"\\geq","-<":"\\prec","-lt":"\\prec","-<=":"\\preceq",">-=":"\\succeq",prop:"\\propto",diamond:"\\diamond",square:"\\square",iff:"\\iff",sub:"\\subset",sup:"\\supset",sube:"\\subseteq",supe:"\\supseteq",uarr:"\\uparrow",darr:"\\downarrow",rarr:"\\rightarrow",rArr:"\\Rightarrow",larr:"\\leftarrow",lArr:"\\Leftarrow",harr:"\\leftrightarrow",hArr:"\\Leftrightarrow",aleph:"\\aleph",and:"\\land",or:"\\lor",not:"\\neg","_|_":"\\bot",TT:"\\top","|--":"\\vdash","|==":"\\models","|__":"\\lfloor","__|":"\\rfloor","|~":"\\lceil","~|":"\\rceil",">->":"\\rightarrowtail","->>":"\\twoheadrightarrow",">->>":"\\twoheadrightarrowtail",frac:"\\frac{#?}{#?}",cbrt:"\\sqrt[3]{#?}",nthroot:"\\sqrt[#?]{#?}"};function Au(e,i){var r;let a=(r=i==null?void 0:i.format)!=null?r:"auto";return a==="auto"&&([a,e]=lf(e)),a==="ascii-math"?(e=e.replace(/\u2061/gu,""),e=e.replace(/\u3016/gu,"{"),e=e.replace(/\u3017/gu,"}"),e=e.replace(/([^\\])sinx/g,"$1\\sin x"),e=e.replace(/([^\\])cosx/g,"$1\\cos x "),e=e.replace(/\u2013/g,"-"),["ascii-math",os(e,{inlineShortcuts:i==null?void 0:i.inlineShortcuts})]):["latex",e]}function os(e,i){var r,a,u;if(!e)return"";let p=!1,m;const b=(r=i.inlineShortcuts)!=null?r:Ac;if(!p&&(e.startsWith("^")||e.startsWith("_"))&&(m=uo(e.slice(1),{inlineShortcuts:b,noWrap:!0}),e=e[0]+"{"+m.match+"}",e+=os(m.rest,i),p=!0),p||(m=e.match(/^(sqrt|\u221A)(.*)/),m&&(m=uo(m[2],{inlineShortcuts:b,noWrap:!0}),e="\\sqrt{"+((a=m.match)!=null?a:"\\placeholder{}")+"}",e+=os(m.rest,i),p=!0)),p||(m=e.match(/^(\\cbrt|\u221B)(.*)/),m&&(m=uo(m[2],{inlineShortcuts:b,noWrap:!0}),e="\\sqrt[3]{"+((u=m.match)!=null?u:"\\placeholder{}")+"}",e+=os(m.rest,i),p=!0)),p||(m=e.match(/^abs(.*)/),m&&(m=uo(m[1],{inlineShortcuts:b,noWrap:!0}),e="\\left|"+m.match+"\\right|",e+=os(m.rest,i),p=!0)),p||(m=e.match(/^["”“](.*?)["”“](.*)/),m&&(e="\\text{"+m[1]+"}",e+=os(m[2],i),p=!0)),p||(m=e.match(/^([^a-zA-Z\(\{\[\_\^\\\s"]+)(.*)/),m&&(e=af(m[1],b),e+=os(m[2],i),p=!0)),!p&&/^([fgh])[^a-zA-Z]/.test(e)&&(m=uo(e.slice(1),{inlineShortcuts:b,noWrap:!0}),e=e[1]==="("?e[0]+"\\left("+m.match+"\\right)":e[0]+m.match,e+=os(m.rest,i),p=!0),p||(m=e.match(/^([a-zA-Z]+)(.*)/),m&&(e=af(m[1],b),e+=os(m[2],i),p=!0)),!p)if(m=uo(e,{inlineShortcuts:b,noWrap:!0}),m.match&&m.rest[0]==="/"){const w=uo(m.rest.slice(1),{inlineShortcuts:b,noWrap:!0});w.match&&(e="\\frac{"+m.match+"}{"+w.match+"}"+os(w.rest,i)),p=!0}else m.match&&(e=e.startsWith("(")?"\\left("+m.match+"\\right)"+os(m.rest,i):m.match+os(m.rest,i),p=!0);return p||(m=e.match(/^(\s+)(.*)$/),m&&(e=" "+os(m[2],i),p=!0)),e}function uo(e,i){let r="";e=e.trim();let a=e,u=e.charAt(0),p={"(":")","{":"}","[":"]"}[u];if(p){let m=1,b=1;for(;b<e.length&&m>0;)e[b]===u&&m++,e[b]===p&&m--,b++;m===0?(i.noWrap&&u==="("?r=os(e.substring(1,b-1),i):(u==="{"&&p==="}"&&(u="\\{",p="\\}"),r="\\left"+u+os(e.substring(1,b-1),i)+"\\right"+p),a=e.slice(Math.max(0,b))):(r=e.substring(1,b),a="")}else{let m=e.match(/^([a-zA-Z]+)/);if(m){let b=Tc(null,e,i.inlineShortcuts);if(b)return b=b.replace("_{#?}",""),b=b.replace("^{#?}",""),{match:b,rest:e.slice(b.length)}}if(m=e.match(/^([a-zA-Z])/),m)return{match:m[1],rest:e.slice(1)};if(m=e.match(/^(-)?\d+(\.\d*)?/),m)return{match:m[0],rest:e.slice(m[0].length)};/^\\(left|right)/.test(e)||(m=e.match(/^(\\[a-zA-Z]+)/),m&&(a=e.slice(m[1].length),r=m[1]))}return{match:r,rest:a}}function af(e,i){let r=Tc(null,e,i);return r?(r=r.replace("_{#?}",""),r=r.replace("^{#?}",""),r+=" "):r=e,r}var of=[["\\[","\\]"],["\\(","\\)"],["$$","$$"],["$","$"],["\\begin{math}","\\end{math}"],["\\begin{displaymath}","\\end{displaymath}"],["\\begin{equation}","\\end{equation}"],["\\begin{equation*}","\\end{equation*}"]];function Lc(e){const i=e.trim();for(const r of of)if(i.startsWith(r[0])&&i.endsWith(r[1]))return[!0,i.substring(r[0].length,i.length-r[1].length)];return[!1,e]}function lf(e){if(e=e.trim(),e.length<=1)return["latex",e];let i;return[i,e]=Lc(e),i?["latex",e]:e.startsWith("`")&&e.endsWith("`")?(e=e.substring(1,e.length-1),["ascii-math",e]):e.includes("\\")?["latex",e]:/\$.+\$/.test(e)?["latex",`\\text{${e}}`]:[void 0,e]}var md="$$",gd="$$",_d=(e,i,r)=>(of.some(a=>i.startsWith(a[0])&&i.endsWith(a[1]))||(i=`${md} ${i} ${gd}`),i),uf=class id{constructor(i){id._modes[i]=this}static onPaste(i,r,a){var u;if(!r.contentEditable&&r.userSelect==="none")return r.model.announce("plonk"),!1;if(typeof a=="string"){const m=new DataTransfer;m.setData("text/plain",a),a=m}const p=new ClipboardEvent("paste",{clipboardData:a,cancelable:!0});return(u=r.host)!=null&&u.dispatchEvent(p)?id._modes[i].onPaste(r,a):!1}static copyToClipboard(i,r){if(!i.contentEditable&&i.userSelect==="none"){i.model.announce("plonk");return}const a=i.model,u=a.selectionIsCollapsed?[0,a.lastOffset]:Kr(a.selection),p=a.getValue(u,r);navigator.clipboard.writeText(p).then(()=>{},()=>i.model.announce("plonk"))}static onCopy(i,r){var a;if(!r.clipboardData)return;if(!i.contentEditable&&i.userSelect==="none"){i.model.announce("plonk");return}const u=i.model,p=u.selectionIsCollapsed?[0,u.lastOffset]:Kr(u.selection);let m=u.getAtoms(p);if(m.every(b=>b.mode==="text"||!b.mode))r.clipboardData.setData("text/plain",m.filter(b=>b instanceof Pa).map(b=>b.value).join(""));else if(m.every(b=>b.mode==="latex"))r.clipboardData.setData("text/plain",u.getAtoms(p,{includeChildren:!0}).map(b=>{var w;return(w=b.value)!=null?w:""}).join(""));else{let b;m.length===1&&m[0].verbatimLatex!==void 0?b=m[0].verbatimLatex:b=u.getValue(p,"latex-expanded"),r.clipboardData.setData("application/x-latex",b);try{r.clipboardData.setData("text/plain",i.options.onExport(i,b,p))}catch(w){}if(m.length===1){const w=m[0];(w.type==="root"||w.type==="group")&&(m=w.body.filter(E=>E.type!=="first"))}try{r.clipboardData.setData("application/json+mathlive",JSON.stringify(m.map(w=>w.toJson())))}catch(w){}if((a=window[Symbol.for("io.cortexjs.compute-engine")])!=null&&a.ComputeEngine){const w=window.MathfieldElement.computeEngine;if(w)try{const E=w.jsonSerializationOptions;w.jsonSerializationOptions={metadata:["latex"]};const I=w.parse(u.getValue(p,"latex-unstyled"));w.jsonSerializationOptions=E;const N=JSON.stringify(I.json);N&&r.clipboardData.setData("application/json",N)}catch(E){}}}r.preventDefault()}static insert(i,r,a={}){var u;const p=a.mode==="auto"?i.mode:(u=a.mode)!=null?u:i.mode;return id._modes[p].insert(i,r,a)}onPaste(i,r){return!1}insert(i,r,a){return!1}};uf._modes={};var jn=uf,vd=[{key:"left",command:"moveToPreviousChar"},{key:"right",command:"moveToNextChar"},{key:"up",command:"moveUp"},{key:"down",command:"moveDown"},{key:"shift+[ArrowLeft]",command:"extendSelectionBackward"},{key:"shift+[ArrowRight]",command:"extendSelectionForward"},{key:"shift+[ArrowUp]",command:"extendSelectionUpward"},{key:"shift+[ArrowDown]",command:"extendSelectionDownward"},{key:"[Backspace]",command:"deleteBackward"},{key:"alt+[Delete]",command:"deleteBackward"},{key:"[Delete]",command:"deleteForward"},{key:"alt+[Backspace]",command:"deleteForward"},{key:"alt+[ArrowLeft]",command:"moveToPreviousWord"},{key:"alt+[ArrowRight]",command:"moveToNextWord"},{key:"shift+alt+[ArrowLeft]",command:"extendToPreviousWord"},{key:"shift+alt+[ArrowRight]",command:"extendToNextWord"},{key:"ctrl+[ArrowLeft]",command:"moveToGroupStart"},{key:"ctrl+[ArrowRight]",command:"moveToGroupEnd"},{key:"shift+ctrl+[ArrowLeft]",command:"extendToGroupStart"},{key:"shift+ctrl+[ArrowRight]",command:"extendToGroupEnd"},{key:"[Home]",command:"moveToMathfieldStart"},{key:"cmd+[ArrowLeft]",command:"moveToMathfieldStart"},{key:"shift+[Home]",command:"extendToMathFieldStart"},{key:"shift+cmd+[ArrowLeft]",command:"extendToMathFieldStart"},{key:"[End]",command:"moveToMathfieldEnd"},{key:"cmd+[ArrowRight]",command:"moveToMathfieldEnd"},{key:"shift+[End]",command:"extendToMathFieldEnd"},{key:"shift+cmd+[ArrowRight]",command:"extendToMathFieldEnd"},{key:"[Pageup]",command:"moveToGroupStart"},{key:"[Pagedown]",command:"moveToGroupEnd"},{key:"[Tab]",command:"moveToNextGroup"},{key:"shift+[Tab]",command:"moveToPreviousGroup"},{key:"[Escape]",ifMode:"math",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"text",command:["switchMode","latex"]},{key:"[Escape]",ifMode:"latex",command:["complete","complete",{selectItem:"true"}]},{key:"\\",ifMode:"math",command:["switchMode","latex","\\"]},{key:"[IntlBackslash]",ifMode:"math",command:["switchMode","latex","\\"]},{key:"[Tab]",ifMode:"latex",command:["complete","accept-suggestion"]},{key:"[Return]",ifMode:"latex",command:"complete"},{key:"[Enter]",ifMode:"latex",command:"complete"},{key:"shift+[Escape]",ifMode:"latex",command:["complete","reject"]},{key:"[ArrowDown]",ifMode:"latex",command:"nextSuggestion"},{key:"[ArrowUp]",ifMode:"latex",command:"previousSuggestion"},{key:"ctrl+a",ifPlatform:"!macos",command:"selectAll"},{key:"cmd+a",command:"selectAll"},{key:"[Cut]",command:"cutToClipboard"},{key:"[Copy]",command:"copyToClipboard"},{key:"[Paste]",command:"pasteFromClipboard"},{key:"[Clear]",command:"deleteBackward"},{key:"[Undo]",command:"undo"},{key:"[Redo]",command:"redo"},{key:"[EraseEof]",command:"deleteToGroupEnd"},{key:"ctrl+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"cmd+x",ifPlatform:"ios",command:"cutToClipboard"},{key:"ctrl+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"cmd+c",ifPlatform:"ios",command:"copyToClipboard"},{key:"ctrl+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"cmd+v",ifPlatform:"ios",command:"pasteFromClipboard"},{key:"ctrl+z",ifPlatform:"!macos",command:"undo"},{key:"cmd+z",command:"undo"},{key:"ctrl+y",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+y",command:"redo"},{key:"shift+ctrl+z",ifPlatform:"!macos",command:"redo"},{key:"shift+cmd+z",command:"redo"},{key:"ctrl+b",ifPlatform:"macos",command:"moveToPreviousChar"},{key:"ctrl+f",ifPlatform:"macos",command:"moveToNextChar"},{key:"ctrl+p",ifPlatform:"macos",command:"moveUp"},{key:"ctrl+n",ifPlatform:"macos",command:"moveDown"},{key:"ctrl+a",ifPlatform:"macos",command:"moveToMathfieldStart"},{key:"ctrl+e",ifPlatform:"macos",command:"moveToMathfieldEnd"},{key:"shift+ctrl+b",ifPlatform:"macos",command:"extendSelectionBackward"},{key:"shift+ctrl+f",ifPlatform:"macos",command:"extendSelectionForward"},{key:"shift+ctrl+p",ifPlatform:"macos",command:"extendSelectionUpward"},{key:"shift+ctrl+n",ifPlatform:"macos",command:"extendSelectionDownward"},{key:"shift+ctrl+a",ifPlatform:"macos",command:"extendToMathFieldStart"},{key:"shift+ctrl+e",ifPlatform:"macos",command:"extendToMathFieldEnd"},{key:"alt+ctrl+b",ifPlatform:"macos",command:"moveToPreviousWord"},{key:"alt+ctrl+f",ifPlatform:"macos",command:"moveToNextWord"},{key:"shift+alt+ctrl+b",ifPlatform:"macos",command:"extendToPreviousWord"},{key:"shift+alt+ctrl+f",ifPlatform:"macos",command:"extendToNextWord"},{key:"ctrl+h",ifPlatform:"macos",command:"deleteBackward"},{key:"ctrl+d",ifPlatform:"macos",command:"deleteForward"},{key:"ctrl+l",ifPlatform:"macos",command:"scrollIntoView"},{key:"ctrl+[Digit2]",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"ctrl+[Digit5]",ifMode:"math",command:"moveToOpposite"},{key:"ctrl+[Digit6]",ifMode:"math",command:"moveToSuperscript"},{key:"ctrl+[Return]",ifMode:"math",command:"addRowAfter"},{key:"ctrl+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Return]",ifMode:"math",command:"addRowAfter"},{key:"cmd+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"alt+p",ifMode:"math",command:["insert","\\pi"]},{key:"alt+v",ifMode:"math",command:["insert","\\sqrt{#0}"]},{key:"alt+o",ifMode:"math",command:["insert","\\emptyset"]},{key:"alt+d",ifMode:"math",command:["insert","\\differentialD"]},{key:"shift+alt+o",ifMode:"math",command:["insert","\\varnothing"]},{key:"shift+alt+d",ifMode:"math",command:["insert","\\partial"]},{key:"alt+[Backslash]",ifMode:"math",command:["insert","\\backslash"]},{key:"[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+[NumpadDivide]",ifMode:"math",command:["insert","\\frac{#?}{#@}"]},{key:"shift+alt+k",command:"toggleKeystrokeCaption"},{key:"alt+[Space]",command:"toggleContextMenu"},{key:"alt+shift+[Space]",command:"toggleVirtualKeyboard"},{key:"alt+ctrl+[ArrowUp]",command:["speak","all",{withHighlighting:!1}]},{key:"alt+ctrl+[ArrowDown]",command:["speak","selection",{withHighlighting:!1}]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["switchMode","text","",""]},{key:"shift+alt+[KeyT]",ifMode:"math",command:["switchMode","text","",""]},{key:"shift+[Quote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"text",command:["switchMode","math","",""]},{key:"shift+alt+[KeyT]",ifMode:"text",command:["switchMode","math","",""]},{key:"/",ifMode:"math",command:["insert","\\frac{#@}{#?}"]},{key:"alt+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+shift+/",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","/"]},{key:"alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrack #0 \\right\\rbrack"]},{key:"ctrl+[Minus]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"moveToSubscript"},{key:"shift+alt+[BracketLeft]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\left\\lbrace #0 \\right\\rbrace"]},{key:"ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowAfter"},{key:"shift+ctrl+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"shift+cmd+;",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:"addRowBefore"},{key:"ctrl+[Backspace]",ifMode:"math",command:"removeRow"},{key:"cmd+[Backspace]",ifMode:"math",command:"removeRow"},{key:"alt+[Tab]",ifMode:"math",command:"addColumnAfter"},{key:"shift+alt+[Tab]",ifMode:"math",command:"addColumnBefore"},{key:"alt+[Enter]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Enter]",ifMode:"math",command:"addRowBefore"},{key:"alt+[Return]",ifMode:"math",command:"addRowAfter"},{key:"shift+alt+[Return]",ifMode:"math",command:"addRowBefore"},{key:"shift+[Backspace]",ifMode:"math",command:"removeColumn"},{key:"alt+[Digit5]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","$\\infty"]},{key:"alt+[Digit9]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","("]},{key:"alt+[Digit0]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert",")"]},{key:"alt+|",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","|"]},{key:"shift+[Backquote]",ifLayout:["apple.en-intl","windows.en-intl","linux.en"],ifMode:"math",command:["insert","\\~"]},{key:"[Backquote]",ifLayout:["windows.french","linux.french"],ifMode:"math",command:["insert","^2"]},{key:"[Backquote]",ifLayout:["windows.german","linux.german"],ifMode:"math",command:["insert","^"]},{key:"[IntlBackslash]",ifLayout:["apple.german"],ifMode:"math",command:["insert","^"]}],cf={"\\sqrt":["alt+v","ctrl+[Digit2]"],"\\pi":"alt+p","\\infty":"alt+[Digit5]","\\differentialD":"alt+d","\\partial":"shift+alt+d","\\frac":"Slash","\\emptyset":"alt+o","\\varnothing":"shift+alt+o","\\~":"~"};function co(e){var i;return((i=e.element)==null?void 0:i.mathfield)===e}function yd(e){var i,r;return(r=(i=e.querySelector(".ML__caret"))!=null?i:e.querySelector(".ML__text-caret"))!=null?r:e.querySelector(".ML__latex-caret")}function Ml(e){const i=yd(e);if(!i)return null;const r=i.getBoundingClientRect();return{x:r.right,y:r.bottom,height:r.height}}function bd(e){var i;if(!e.parent)return"root";let r=(i=e.parent.id)!=null?i:"";return r+=typeof e.parentBranch=="string"?"-"+e.parentBranch:`-${e.parentBranch[0]}/${e.parentBranch[0]}`,r}function Dc(e,i,r){if(!i)return null;const a=e.field.getBoundingClientRect(),u=i.right-i.left,p=i.bottom-i.top,m=Math.ceil(i.left-a.left+e.field.scrollLeft*r),b=Math.ceil(i.top-a.top);return{left:m,right:m+u,top:b,bottom:b+p}}function Cc(e){const i=e.getBoundingClientRect(),r=parseInt(getComputedStyle(e).marginRight),a={top:i.top-1,bottom:i.bottom,left:i.left,right:i.right-1+r};if(e.children.length===0||e.tagName.toUpperCase()==="SVG")return a;for(const u of e.children)if(u.nodeType===1&&"atomId"in u.dataset&&!u.classList.contains("pstrut")){const p=Cc(u);a.left=Math.min(a.left,p.left),a.right=Math.max(a.right,p.right),a.top=Math.min(a.top,p.top),a.bottom=Math.max(a.bottom,p.bottom)}return a}function ia(e,i){var r,a;if(!i.id)return null;let u=(a=(r=e.atomBoundsCache)==null?void 0:r.get(i.id))!=null?a:null;if(u!==null)return u;const p=e.field.querySelector(`[data-atom-id="${i.id}"]`);return u=p?Cc(p):null,e.atomBoundsCache&&(u?e.atomBoundsCache.set(i.id,u):e.atomBoundsCache.delete(i.id)),u!=null?u:null}function Hs(e,i,r){const a=new Map;for(const u of e.model.getAtoms(i,{includeChildren:!0})){if(r!=null&&r.excludeAtomsWithBackground&&u.style.backgroundColor)continue;const p=e.field,m=p.offsetWidth;let w=Math.floor(p.getBoundingClientRect().width)/m;w=isNaN(w)?1:w;const E=Dc(e,ia(e,u),w);if(E){const I=bd(u);if(a.has(I)){const N=a.get(I);a.set(I,{left:Math.min(N.left,E.left),right:Math.max(N.right,E.right),top:Math.min(N.top,E.top),bottom:Math.max(N.bottom,E.bottom)})}else a.set(I,E)}}return[...a.values()]}function Mc(e,i){return e.model.selection.ranges.reduce((r,a)=>r.concat(...Hs(e,a,i)),[])}function Ic(e,i){return e==="*"||i==="none"?!0:i==="same-origin"?!window.origin||e===window.origin:typeof i=="function"?i(e):!1}function Rc(e){let i=0,r=0;const a=e.offsetWidth,u=e.offsetHeight;for(;e instanceof HTMLElement;)i+=e.offsetTop,r+=e.offsetLeft,e=e.offsetParent;return new DOMRect(r,i,a,u)}var hf=`@keyframes ML__caret-blink {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0;
}
}
.ML__container {
display: inline-flex;
flex-flow: row;
justify-content: space-between;
align-items: flex-end;
min-height: 39px;
/* Need some room for the virtual keyboard toggle */
width: 100%;
/* Encourage browsers to consider allocating a hardware accelerated
layer for this element. */
isolation: isolate;
/* Prevent the browser from trying to interpret touch gestures in the field */
/* "Disabling double-tap to zoom removes the need for browsers to
delay the generation of click events when the user taps the screen." */
touch-action: none;
--_caret-color: var(--caret-color, hsl(var(--_hue), 40%, 49%));
--_selection-color: var(--selection-color, #000);
--_selection-background-color: var(--selection-background-color, hsl(var(--_hue), 70%, 85%));
--_text-highlight-background-color: var(--highlight-text, hsla(var(--_hue), 40%, 50%, 0.1));
--_contains-highlight-background-color: var(--contains-highlight-background-color, hsl(var(--_hue), 40%, 95%));
--_smart-fence-color: var(--smart-fence-color, currentColor);
--_smart-fence-opacity: var(--smart-fence-opacity, 0.5);
--_latex-color: var(--latex-color, hsl(var(--_hue), 80%, 40%));
--_correct-color: var(--correct-color, #10a000);
--_incorrect-color: var(--incorrect-color, #a01b00);
--_composition-background-color: var(--composition-background-color, #fff1c2);
--_composition-text-color: var(--composition-text-color, black);
--_composition-underline-color: var(--composition-underline-color, transparent);
}
/* This is the actual field content (formula) */
.ML__content {
display: flex;
align-items: center;
align-self: center;
position: relative;
overflow: hidden;
padding: 2px 3px 2px 1px;
width: 100%;
}
.ML__virtual-keyboard-toggle,
.ML__menu-toggle {
box-sizing: border-box;
display: flex;
align-self: center;
align-items: center;
flex-shrink: 0;
flex-direction: column;
justify-content: center;
width: 34px;
height: 34px;
padding: 0;
margin-right: 4px;
cursor: pointer;
/* Avoid some weird blinking with :hover */
border-radius: 8px;
border: 1px solid transparent;
transition: background 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
color: hsl(var(--_hue), 40%, 50%);
fill: currentColor;
background: transparent;
}
.ML__virtual-keyboard-toggle:hover,
.ML__menu-toggle:hover {
background: hsla(0, 0%, 70%, 0.3);
color: #333;
fill: currentColor;
}
.ML__virtual-keyboard-toggle > span,
.ML__menu-toggle > span {
display: flex;
align-self: center;
align-items: center;
}
/* The invisible element used to capture keyboard events. We're just trying
really hard to make sure it doesn't show. */
.ML__keyboard-sink {
display: inline-block;
resize: none;
outline: none;
border: none;
/* Need these for Microsoft Edge */
position: fixed;
clip: rect(0 0 0 0);
/* Need this to prevent iOS Safari from auto-zooming */
font-size: 1em;
font-family: KaTeX_Main;
line-height: 0.5;
/* On Chromium, if this is 0, no keyboard events are received */
}
[part="placeholder"] {
color: var(--neutral-400);
}
.ML__composition {
background: var(--_composition-background-color);
color: var(--_composition-text-color);
text-decoration: underline var(--_composition-underline-color);
}
.ML__caret::after {
content: '';
visibility: hidden;
width: 0;
display: inline-block;
height: 0.76em;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_caret-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.045em;
bottom: -0.05em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__text-caret::after {
content: '';
visibility: hidden;
width: 0;
display: inline-block;
height: 0.76em;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_caret-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.045em;
bottom: -0.05em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__latex-caret::after {
content: '';
visibility: hidden;
--_caret-width: clamp(2px, 0.08em, 10px);
border: none;
border-radius: calc(var(--_caret-width) / 2);
border-right: var(--_caret-width) solid var(--_latex-color);
margin-right: calc(-1 * var(--_caret-width));
position: relative;
left: -0.019em;
animation: ML__caret-blink 1.05s step-end forwards infinite;
}
.ML__focused .ML__latex-caret::after,
.ML__focused .ML__text-caret::after,
.ML__focused .ML__caret::after {
visibility: visible;
}
.ML__focused .ML__text {
background: var(--_text-highlight-background-color);
}
/* When using smartFence, the anticipated closing fence is displayed
with this style */
.ML__smart-fence__close {
opacity: var(--_smart-fence-opacity);
color: var(--_smart-fence-color);
}
.ML__selected,
.ML__focused .ML__selected .ML__contains-caret,
.ML__focused .ML__selected .ML__smart-fence__close,
.ML__focused .ML__selected .ML__placeholder {
color: var(--_selection-color);
opacity: 1;
}
.ML__selection {
box-sizing: border-box;
background: var(--_selection-background-color) !important;
}
.ML__contains-caret.ML__close,
.ML__contains-caret.ML__open,
.ML__contains-caret > .ML__close,
.ML__contains-caret > .ML__open,
.ML__contains-caret .ML__sqrt-sign,
.ML__contains-caret .ML__sqrt-line {
color: var(--_caret-color);
}
.ML__contains-highlight {
box-sizing: border-box;
background: transparent;
}
.ML__focused .ML__contains-highlight {
background: var(--_contains-highlight-background-color);
}
.ML__raw-latex {
font-family: 'Berkeley Mono', 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;
font-weight: 400;
font-size: 0.8em;
letter-spacing: -0.05em;
color: var(--_latex-color);
}
.ML__suggestion {
color: var(--neutral-500);
}
.ML__virtual-keyboard-toggle.is-visible.is-pressed:hover {
background: hsl(var(--_hue), 25%, 35%);
color: #fafafa;
fill: currentColor;
}
.ML__virtual-keyboard-toggle:focus {
outline: none;
border-radius: 8px;
border: 2px solid hsl(var(--_hue), 40%, 50%);
}
.ML__virtual-keyboard-toggle.is-pressed,
.ML__virtual-keyboard-toggle.is-active:hover,
.ML__virtual-keyboard-toggle.is-active {
background: hsl(var(--_hue), 25%, 35%);
color: #fafafa;
fill: currentColor;
}
/* Add an attribute 'data-tooltip' to automatically show a
tooltip over a element on hover.
*/
[data-tooltip] {
position: relative;
}
[data-tooltip]::after {
content: attr(data-tooltip);
position: absolute;
display: block;
z-index: 2;
pointer-events: none;
right: auto;
top: calc(-100% - 4px);
width: max-content;
max-width: 200px;
padding: 8px 8px;
border-radius: 4px;
background: #616161;
color: #fff;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
text-align: center;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-style: normal;
font-weight: 400;
font-size: 13px;
/* Phone */
opacity: 0;
transform: scale(0.5);
}
@media only screen and (max-width: 767px) {
[data-tooltip]::after {
padding: 8px 16px;
font-size: 16px;
}
}
menu [data-tooltip]::after {
left: 100%;
top: 0%;
}
menu .ML__base {
cursor: default;
}
/** Don't display if we're tracking, i.e. have the pointer down */
.tracking [data-tooltip]:hover::after {
/* Use visibility, not display. Display will remove the after from the DOM, and the override below will not work */
visibility: hidden;
}
/** But do display if tracking and inside a menu */
.tracking menu li[data-tooltip]:hover::after,
[data-tooltip]:hover::after {
visibility: visible;
opacity: 1;
transform: scale(1);
transition-property: opacity, scale;
transition-duration: 0.15s;
transition-delay: 1s;
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}
.ML__prompt {
border-radius: 2px;
}
.ML__editablePromptBox {
outline: 1px solid #acacac;
border-radius: 2px;
z-index: -1;
}
.ML__focusedPromptBox {
outline: highlight auto 1px;
}
.ML__lockedPromptBox {
background-color: rgba(142, 142, 141, 0.4);
z-index: -1;
}
.ML__correctPromptBox {
outline: 1px solid var(--_correct-color);
box-shadow: 0 0 5px var(--_correct-color);
}
.ML__incorrectPromptBox {
outline: 1px solid var(--_incorrect-color);
box-shadow: 0 0 5px var(--_incorrect-color);
}
.variant-submenu {
display: flex;
flex-direction: column;
padding: 8px;
}
.variant-submenu [part=menu-item] {
font-size: 2rem;
text-align: center;
margin: 0;
}
.insert-matrix-submenu {
display: grid;
padding: 8px;
align-content: center;
justify-content: center;
grid-template-columns: repeat(5, minmax(0, 1fr));
}
.insert-matrix-submenu [part=menu-item] {
font-size: 21px;
border: none;
border-radius: 0;
line-height: 21px;
text-align: center;
padding: 0;
margin: 0;
}
.border-submenu [part=menu-item] {
font-size: 2rem;
line-height: 1.2;
text-align: center;
}
.swatches-submenu {
--_swatch-size: 2rem;
--_columns: 4;
display: flex;
flex-flow: wrap;
padding: 8px;
max-width: calc(var(--_columns) * (var(--_swatch-size) + 18px) + 16px);
box-sizing: border-box;
}
.menu-swatch {
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: fit-content;
height: fit-content;
margin: 2px;
padding: 0;
background: var(--neutral-200);
}
.menu-swatch > .label {
padding: 0;
margin: 0;
line-height: 0;
}
.menu-swatch > .label > span {
display: inline-block;
margin: 6px;
min-width: var(--_swatch-size);
min-height: var(--_swatch-size);
border-radius: 50%;
}
.menu-swatch.active {
background: var(--neutral-100);
scale: 1.4;
}
.menu-swatch.active > .label > span {
border-radius: 2px;
}
.menu-swatch .ui-checkmark,
.menu-swatch .ui-mixedmark {
position: absolute;
margin: 0;
padding: 0;
color: white;
}
.menu-swatch.dark-contrast .ui-checkmark,
.menu-swatch.dark-contrast .ui-mixedmark {
color: #000;
}
`,qo=`.ML__container {
min-height: auto !important;
--_hue: var(--hue, 212);
--_placeholder-color: var(--placeholder-color, hsl(var(--_hue), 40%, 49%));
--_placeholder-opacity: var(--placeholder-opacity, 0.4);
--_text-font-family: var(--text-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif);
}
.ML__sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
.ML__is-inline {
display: inline-block;
}
.ML__base {
visibility: inherit;
display: inline-block;
position: relative;
cursor: text;
padding: 0;
margin: 0;
box-sizing: content-box;
border: 0;
outline: 0;
vertical-align: baseline;
font-weight: inherit;
font-family: inherit;
font-style: inherit;
text-decoration: none;
width: min-content;
}
.ML__strut,
.ML__strut--bottom {
display: inline-block;
min-height: 0.5em;
}
.ML__small-delim {
font-family: KaTeX_Main;
}
/* Text mode */
.ML__text {
font-family: var(--_text-font-family);
white-space: pre;
}
/* Use cmr for 'math upright' */
.ML__cmr {
font-family: KaTeX_Main;
font-style: normal;
}
.ML__mathit {
font-family: KaTeX_Math;
/* The KaTeX_Math font is italic by default, so the font-style below is only
useful when a fallback font is used
*/
font-style: italic;
}
.ML__mathbf {
font-family: KaTeX_Main;
font-weight: bold;
}
/* Lowercase greek symbols should stick to math font when \\mathbf is applied
to match TeX idiosyncratic behavior */
.lcGreek.ML__mathbf {
font-family: KaTeX_Math;
font-weight: normal;
}
.ML__mathbfit {
font-family: KaTeX_Math;
font-weight: bold;
font-style: italic;
}
.ML__ams {
font-family: KaTeX_AMS;
}
/* Blackboard */
.ML__bb {
font-family: KaTeX_AMS;
}
.ML__cal {
font-family: KaTeX_Caligraphic;
}
.ML__frak {
font-family: KaTeX_Fraktur;
}
.ML__tt {
font-family: KaTeX_Typewriter;
}
.ML__script {
font-family: KaTeX_Script;
}
.ML__sans {
font-family: KaTeX_SansSerif;
}
.ML__series_ul {
font-weight: 100;
}
.ML__series_el {
font-weight: 100;
}
.ML__series_l {
font-weight: 200;
}
.ML__series_sl {
font-weight: 300;
}
.ML__series_sb {
font-weight: 500;
}
.ML__bold,
.ML__boldsymbol {
font-weight: 700;
}
.ML__series_eb {
font-weight: 800;
}
.ML__series_ub {
font-weight: 900;
}
.ML__series_uc {
font-stretch: ultra-condensed;
}
.ML__series_ec {
font-stretch: extra-condensed;
}
.ML__series_c {
font-stretch: condensed;
}
.ML__series_sc {
font-stretch: semi-condensed;
}
.ML__series_sx {
font-stretch: semi-expanded;
}
.ML__series_x {
font-stretch: expanded;
}
.ML__series_ex {
font-stretch: extra-expanded;
}
.ML__series_ux {
font-stretch: ultra-expanded;
}
.ML__it {
font-style: italic;
}
.ML__shape_ol {
-webkit-text-stroke: 1px black;
text-stroke: 1px black;
color: transparent;
}
.ML__shape_sc {
font-variant: small-caps;
}
.ML__shape_sl {
font-style: oblique;
}
/* First level emphasis */
.ML__emph {
color: #bc2612;
}
/* Second level emphasis */
.ML__emph .ML__emph {
color: #0c7f99;
}
.ML__highlight {
color: #007cb2;
background: #edd1b0;
}
.ML__center {
text-align: center;
}
.ML__label_padding {
padding: 0 0.5em;
}
.ML__frac-line {
width: 100%;
min-height: 1px;
}
.ML__frac-line:after {
content: '';
display: block;
margin-top: max(-1px, -0.04em);
min-height: max(1px, 0.04em);
/* Ensure the line is visible when printing even if "turn off background images" is on*/
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
/* There's a bug since Chrome 62 where
sub-pixel border lines don't draw at some zoom
levels (110%, 90%).
Setting the min-height used to work around it, but that workaround
broke in Chrome 84 or so.
Setting the background (and the min-height) seems to work for now.
*/
background: currentColor;
box-sizing: content-box;
/* Vuetify sets the box-sizing to inherit
causes the fraction line to not draw at all sizes (see #26) */
/* On some versions of Firefox on Windows, the line fails to
draw at some zoom levels, but setting the transform triggers
the hardware accelerated path, which works */
transform: translate(0, 0);
}
.ML__sqrt {
display: inline-block;
}
.ML__sqrt-sign {
display: inline-block;
position: relative;
}
.ML__sqrt-line {
display: inline-block;
height: max(1px, 0.04em);
width: 100%;
}
.ML__sqrt-line:before {
content: '';
display: block;
margin-top: min(-1px, -0.04em);
min-height: max(1px, 0.04em);
/* Ensure the line is visible when printing even if "turn off background images" is on*/
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
background: currentColor;
/* On some versions of Firefox on Windows, the line fails to
draw at some zoom levels, but setting the transform triggers
the hardware accelerated path, which works */
transform: translate(0, 0);
}
.ML__sqrt-line:after {
border-bottom-width: 1px;
content: ' ';
display: block;
margin-top: -0.1em;
}
.ML__sqrt-index {
margin-left: 0.27777778em;
margin-right: -0.55555556em;
}
.ML__delim-size1 {
font-family: KaTeX_Size1;
}
.ML__delim-size2 {
font-family: KaTeX_Size2;
}
.ML__delim-size3 {
font-family: KaTeX_Size3;
}
.ML__delim-size4 {
font-family: KaTeX_Size4;
}
.ML__delim-mult .delim-size1 > span {
font-family: KaTeX_Size1;
}
.ML__delim-mult .delim-size4 > span {
font-family: KaTeX_Size4;
}
.ML__accent-body > span {
font-family: KaTeX_Main;
width: 0;
}
.ML__accent-vec {
position: relative;
left: 0.24em;
}
/** The markup for a LaTeX formula, either in an editable mathfield or
in a static display.
*/
.ML__latex {
display: inline-block;
direction: ltr;
text-align: left;
text-indent: 0;
text-rendering: auto;
font-family: KaTeX_Main, 'Times New Roman', serif;
font-style: normal;
font-size-adjust: none;
font-stretch: normal;
font-variant-caps: normal;
letter-spacing: normal;
line-height: 1.2;
word-wrap: normal;
word-spacing: normal;
white-space: nowrap;
text-shadow: none;
-webkit-user-select: none;
user-select: none;
width: min-content;
}
.ML__latex .style-wrap {
position: relative;
}
.ML__latex .mfrac {
display: inline-block;
}
.ML__latex .left-right {
display: inline-block;
}
.ML__latex .vlist-t {
display: inline-table;
table-layout: fixed;
border-collapse: collapse;
}
.ML__latex .vlist-r {
display: table-row;
}
.ML__latex .vlist {
display: table-cell;
vertical-align: bottom;
position: relative;
}
.ML__latex .vlist > span {
display: block;
height: 0;
position: relative;
}
.ML__latex .vlist > span > span {
display: inline-block;
}
.ML__latex .vlist > span > .pstrut {
overflow: hidden;
width: 0;
}
.ML__latex .vlist-t2 {
margin-right: -2px;
}
.ML__latex .vlist-s {
display: table-cell;
vertical-align: bottom;
font-size: 1px;
width: 2px;
min-width: 2px;
}
.ML__latex .msubsup {
text-align: left;
}
.ML__latex .negativethinspace {
display: inline-block;
margin-left: -0.16667em;
height: 0.71em;
}
.ML__latex .thinspace {
display: inline-block;
width: 0.16667em;
height: 0.71em;
}
.ML__latex .mediumspace {
display: inline-block;
width: 0.22222em;
height: 0.71em;
}
.ML__latex .thickspace {
display: inline-block;
width: 0.27778em;
height: 0.71em;
}
.ML__latex .enspace {
display: inline-block;
width: 0.5em;
height: 0.71em;
}
.ML__latex .quad {
display: inline-block;
width: 1em;
height: 0.71em;
}
.ML__latex .qquad {
display: inline-block;
width: 2em;
height: 0.71em;
}
.ML__latex .llap,
.ML__latex .rlap {
width: 0;
position: relative;
display: inline-block;
}
.ML__latex .llap > .inner,
.ML__latex .rlap > .inner {
position: absolute;
}
.ML__latex .llap > .fix,
.ML__latex .rlap > .fix {
display: inline-block;
}
.ML__latex .llap > .inner {
right: 0;
}
.ML__latex .rlap > .inner {
left: 0;
}
.ML__latex .rule {
display: inline-block;
border: solid 0;
position: relative;
box-sizing: border-box;
}
.ML__latex .overline .overline-line,
.ML__latex .underline .underline-line {
width: 100%;
}
.ML__latex .overline .overline-line:before,
.ML__latex .underline .underline-line:before {
content: '';
border-bottom-style: solid;
border-bottom-width: max(1px, 0.04em);
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
display: block;
}
.ML__latex .overline .overline-line:after,
.ML__latex .underline .underline-line:after {
border-bottom-style: solid;
border-bottom-width: max(1px, 0.04em);
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
content: '';
display: block;
margin-top: -1px;
}
.ML__latex .stretchy {
display: block;
position: absolute;
width: 100%;
left: 0;
overflow: hidden;
}
.ML__latex .stretchy:before,
.ML__latex .stretchy:after {
content: '';
}
.ML__latex .stretchy svg {
display: block;
position: absolute;
width: 100%;
height: inherit;
fill: currentColor;
stroke: currentColor;
fill-rule: nonzero;
fill-opacity: 1;
stroke-width: 1;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-dasharray: none;
stroke-dashoffset: 0;
stroke-opacity: 1;
}
.ML__latex .slice-1-of-2 {
display: inline-flex;
position: absolute;
left: 0;
width: 50.2%;
overflow: hidden;
}
.ML__latex .slice-2-of-2 {
display: inline-flex;
position: absolute;
right: 0;
width: 50.2%;
overflow: hidden;
}
.ML__latex .slice-1-of-3 {
display: inline-flex;
position: absolute;
left: 0;
width: 25.1%;
overflow: hidden;
}
.ML__latex .slice-2-of-3 {
display: inline-flex;
position: absolute;
left: 25%;
width: 50%;
overflow: hidden;
}
.ML__latex .slice-3-of-3 {
display: inline-flex;
position: absolute;
right: 0;
width: 25.1%;
overflow: hidden;
}
.ML__latex .slice-1-of-1 {
display: inline-flex;
position: absolute;
width: 100%;
left: 0;
overflow: hidden;
}
.ML__latex .nulldelimiter {
display: inline-block;
}
.ML__latex .op-group {
display: inline-block;
}
.ML__latex .op-symbol {
position: relative;
}
.ML__latex .op-symbol.small-op {
font-family: KaTeX_Size1;
}
.ML__latex .op-symbol.large-op {
font-family: KaTeX_Size2;
}
.ML__latex .mtable .vertical-separator {
display: inline-block;
min-width: 1px;
box-sizing: border-box;
}
.ML__latex .mtable .arraycolsep {
display: inline-block;
}
.ML__latex .mtable .col-align-m > .vlist-t {
text-align: center;
}
.ML__latex .mtable .col-align-c > .vlist-t {
text-align: center;
}
.ML__latex .mtable .col-align-l > .vlist-t {
text-align: left;
}
.ML__latex .mtable .col-align-r > .vlist-t {
text-align: right;
}
.ML__error {
display: inline-block;
background-image: radial-gradient(ellipse at center, hsl(341, 100%, 40%), rgba(0, 0, 0, 0) 70%);
background-color: hsla(341, 100%, 40%, 0.1);
background-repeat: repeat-x;
background-size: 3px 3px;
padding-bottom: 3px;
background-position: 0 100%;
}
.ML__error > .ML__error {
background: transparent;
padding: 0;
}
.ML__placeholder {
color: var(--_placeholder-color);
opacity: var(--_placeholder-opacity);
padding-left: 0.4ex;
padding-right: 0.4ex;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}
.ML__notation {
position: absolute;
box-sizing: border-box;
line-height: 0;
}
/* This class is used to implement the \`\\mathtip\` and \`\\texttip\` commands
For UI elements, see \`[data-ML__tooltip]\`
*/
.ML__tooltip-container {
position: relative;
transform: scale(0);
}
.ML__tooltip-container .ML__tooltip-content {
position: fixed;
display: inline-table;
visibility: hidden;
z-index: 2;
width: max-content;
max-width: 400px;
padding: 12px 12px;
border-radius: 8px;
background: #616161;
--_selection-color: #fff;
color: #fff;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
opacity: 0;
transition: opacity 0.15s cubic-bezier(0.4, 0, 1, 1);
}
.ML__tooltip-container .ML__tooltip-content .ML__text {
white-space: normal;
}
.ML__tooltip-container .ML__tooltip-content .ML__base {
display: contents;
}
.ML__tooltip-container:hover .ML__tooltip-content {
visibility: visible;
opacity: 1;
font-size: 0.75em;
transform: scale(1) translate(0, 3em);
}
`,Pc=`#mathlive-environment-popover.is-visible {
visibility: visible;
}
#mathlive-environment-popover {
--_environment-panel-height: var(--environment-panel-height, 70px);
--_accent-color: var(--accent-color, #aaa);
--_background: var(--environment-panel-background, #fff);
--_button-background: var(--environment-panel-button-background, white);
--_button-background-hover: var(--environment-panel-button-background-hover, #f5f5f7);
--_button-background-active: var(--environment-panel-button-background-active, #f5f5f7);
--_button-text: var(--environment-panel-button-text, #e3e4e8);
position: absolute;
width: calc(var(--_environment-panel-height) * 2);
height: var(--_environment-panel-height);
border-radius: 4px;
border: 1.5px solid var(--_accent-color);
background-color: var(--_background);
box-shadow: 0 0 30px 0 var(--environment-shadow, rgba(0, 0, 0, 0.4));
pointer-events: all;
visibility: hidden;
}
#mathlive-environment-popover .MLEP__array-buttons {
height: calc(var(--_environment-panel-height) * 5/4);
width: calc(var(--_environment-panel-height) * 5/4);
margin-left: calc(0px - var(--_environment-panel-height) * 0.16);
margin-top: calc(0px - var(--_environment-panel-height) * 0.19);
}
#mathlive-environment-popover .MLEP__array-buttons .font {
fill: white;
}
#mathlive-environment-popover .MLEP__array-buttons circle {
fill: #7f7f7f;
transition: fill 300ms;
}
#mathlive-environment-popover .MLEP__array-buttons .MLEP__array-insert-background {
fill-opacity: 1;
fill: var(--_background);
stroke: var(--_accent-color);
stroke-width: 3px;
}
#mathlive-environment-popover .MLEP__array-buttons line {
stroke: var(--_accent-color);
stroke-opacity: 0;
stroke-width: 40;
pointer-events: none;
transition: stroke-opacity 300ms;
stroke-linecap: round;
}
#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover circle {
fill: var(--_accent-color);
}
#mathlive-environment-popover .MLEP__array-buttons g[data-command]:hover line {
stroke-opacity: 1;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls {
height: 100%;
width: 50%;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options {
width: var(--_environment-panel-height);
height: var(--_environment-panel-height);
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-around;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg {
pointer-events: all;
margin-top: 2px;
width: calc(var(--_environment-panel-height) / 3 * 28 / 24);
height: calc(var(--_environment-panel-height) / 3 - 2px);
border-radius: calc(var(--_environment-panel-height) / 25);
background-color: var(--_button-background);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg:hover {
background-color: var(--_button-background-hover);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg line {
stroke: var(--_button-text);
stroke-width: 2;
stroke-linecap: round;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg rect,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg path {
fill-opacity: 0;
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active {
pointer-events: none;
background-color: var(--_button-background-active);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active path,
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active line {
stroke: var(--_accent-color);
}
#mathlive-environment-popover .MLEP__environment-delimiter-controls .MLEP__array-delimiter-options svg.active circle {
fill: var(--_accent-color);
}
`,xd=`/* The element that display info while in latex mode */
#mathlive-suggestion-popover {
background-color: rgba(97, 97, 97);
color: #fff;
text-align: center;
border-radius: 8px;
position: fixed;
z-index: 1;
display: none;
flex-direction: column;
justify-content: center;
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
}
#mathlive-suggestion-popover.top-tip::after {
content: '';
position: absolute;
top: -15px;
left: calc(50% - 15px);
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 15px solid rgba(97, 97, 97);
font-size: 1rem;
}
#mathlive-suggestion-popover.bottom-tip::after {
content: '';
position: absolute;
bottom: -15px;
left: calc(50% - 15px);
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 15px solid rgba(97, 97, 97);
font-size: 1rem;
}
#mathlive-suggestion-popover.is-animated {
transition: all 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
animation: ML__fade-in cubic-bezier(0, 0, 0.2, 1) 0.15s;
}
#mathlive-suggestion-popover.is-visible {
display: flex;
}
@keyframes ML__fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* The wrapper class for the entire content of the popover panel */
#mathlive-suggestion-popover ul {
display: flex;
flex-flow: column;
list-style: none;
margin: 0;
padding: 0;
align-items: flex-start;
max-height: 400px;
overflow-y: auto;
}
#mathlive-suggestion-popover li {
display: flex;
flex-direction: row;
justify-content: space-between;
margin: 8px;
padding: 8px;
width: calc(100% - 16px - 16px);
column-gap: 1em;
border-radius: 8px;
cursor: pointer;
/* Since the content can be clicked on, provide feedback on hover */
}
#mathlive-suggestion-popover li a {
color: #5ea6fd;
padding-top: 0.3em;
margin-top: 0.4em;
display: block;
}
#mathlive-suggestion-popover li a:hover {
color: #5ea6fd;
text-decoration: underline;
}
#mathlive-suggestion-popover li:hover,
#mathlive-suggestion-popover li.is-pressed,
#mathlive-suggestion-popover li.is-active {
background: rgba(255, 255, 255, 0.1);
}
/* The command inside a popover (inside a #mathlive-suggestion-popover) */
.ML__popover__command {
font-size: 1.6rem;
font-family: KaTeX_Main;
}
.ML__popover__current {
background: #5ea6fd;
color: #fff;
}
.ML__popover__latex {
font-family: 'IBM Plex Mono', 'Source Code Pro', Consolas, 'Roboto Mono', Menlo, 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace;
align-self: center;
}
/* The keyboard shortcuts for a symbol as displayed in the popover */
.ML__popover__keybinding {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 0.8em;
opacity: 0.7;
}
/* Style for the character that joins the modifiers of a keyboard shortcut
(usually a "+" sign)*/
.ML__shortcut-join {
opacity: 0.5;
}
`,wd=`/* The element that displays the keys as the user type them */
#mathlive-keystroke-caption-panel {
visibility: hidden;
/*min-width: 160px;*/
/*background-color: rgba(97, 97, 200, .95);*/
background: var(--secondary, hsl(var(--_hue), 19%, 26%));
border-color: var(--secondary-border, hsl(0, 0%, 91%));
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
text-align: center;
border-radius: 6px;
padding: 16px;
position: absolute;
z-index: 1;
display: flex;
flex-direction: row-reverse;
justify-content: center;
--keystroke: white;
--on-keystroke: #555;
--keystroke-border: #f7f7f7;
}
@media (prefers-color-scheme: dark) {
body:not([theme='light']) #mathlive-keystroke-caption-panel {
--keystroke: hsl(var(--_hue), 50%, 30%);
--on-keystroke: hsl(0, 0%, 98%);
--keystroke-border: hsl(var(--_hue), 50%, 25%);
}
}
body[theme='dark'] #mathlive-keystroke-caption-panel {
--keystroke: hsl(var(--_hue), 50%, 30%);
--on-keystroke: hsl(0, 0%, 98%);
--keystroke-border: hsl(var(--_hue), 50%, 25%);
}
#mathlive-keystroke-caption-panel > span {
min-width: 14px;
/*height: 8px;*/
margin: 0 8px 0 0;
padding: 4px;
background-color: var(--keystroke);
color: var(--on-keystroke);
fill: currentColor;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 1em;
border-radius: 6px;
border: 2px solid var(--keystroke-border);
/*box-shadow: 0 7px 14px rgba(0,0,0,0.25), 0 5px 5px rgba(0,0,0,0.22);*/
}
`,Lu=`.ML__keyboard {
--_keyboard-height: 0;
--_keyboard-zindex: var(--keyboard-zindex, 105);
--_accent-color: var(--keyboard-accent-color, #0c75d8);
--_background: var(--keyboard-background, #cacfd7);
--_border: var(--keyboard-border, #ddd);
--_padding-horizontal: var(--keyboard-padding-horizontal, 0px);
--_padding-top: var(--keyboard-padding-top, 5px);
--_padding-bottom: var(--keyboard-padding-bottom, 0px);
--_row-padding-left: var(--keyboard-row-padding-left, 0px);
--_row-padding-right: var(--keyboard-row-padding-right, 0px);
--_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);
--_toolbar-text-active: var(--keyboard-toolbar-text-active, var(--_accent-color));
--_toolbar-background: var(--keyboard-toolbar-background, transparent);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);
--_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);
--_toolbar-font-size: var(--keyboard-toolbar-font-size, '135%');
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);
--_keycap-background: var(--keycap-background, white);
--_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);
--_keycap-background-active: var(--keycap-background-active, var(--_accent-color));
--_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));
--_keycap-border: var(--keycap-border, #e5e6e9);
--_keycap-border-bottom: var(--keycap-border-bottom, #8d8f92);
--_keycap-text: var(--keycap-text, #000);
--_keycap-text-active: var(--keycap-text-active, #fff);
--_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));
--_keycap-text-pressed: var(--keycap-text-pressed, #fff);
--_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));
--_keycap-primary-background: var(--keycap-primary-background, var(--_accent-color));
--_keycap-primary-text: var(--keycap-primary-text, #ddd);
--_keycap-primary-background-hover: var(--keycap-primary-background-hover, #0d80f2);
--_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);
--_keycap-secondary-text: var(--keycap-secondary-text, #060707);
--_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);
--_keycap-height: var(--keycap-height, 60px);
/* Keycap width (incl. margin) */
--_keycap-max-width: var(--keycap-max-width, 100px);
--_keycap-gap: var(--keycap-gap, 8px);
--_keycap-font-size: var(--keycap-font-size, clamp(16px, 4cqw, 24px));
--_keycap-small-font-size: var(--keycap-small-font-size, calc(var(--keycap-font-size) * 0.8));
--_keycap-extra-small-font-size: var(--keycap-extra-small-font-size, calc(var(--keycap-font-size) / 1.42));
--_variant-panel-background: var(--variant-panel-background, #fff);
--_variant-keycap-text: var(--variant-keycap-text, var(--_keycap-text));
--_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
--_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
--_variant-keycap-length: var(--variant-keycap-length, 70px);
--_variant-keycap-font-size: var(--variant-keycap-font-size, 30px);
--_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 12px);
--_keycap-shift-font-size: var(--keycap-shift-font-size, 16px);
--_keycap-shift-color: var(--keycap-shift-color, var(--_accent-color));
--_box-placeholder-color: var(--box-placeholder-color, var(--_accent-color));
--_box-placeholder-pressed-color: var(--box-placeholder-pressed-color, var(--keycap-text-pressed));
}
.is-math-mode .MLK__rows .if-text-mode,
.is-text-mode .MLK__rows .if-math-mode {
display: none;
}
.if-can-undo,
.if-can-redo,
.if-can-copy,
.if-can-cut,
.if-can-paste {
opacity: 0.4;
pointer-events: none;
}
.can-undo .if-can-undo,
.can-redo .if-can-redo,
.can-copy .if-can-copy,
.can-cut .if-can-cut,
.can-paste .if-can-paste {
opacity: 1;
pointer-events: all;
}
body > .ML__keyboard {
position: fixed;
--_padding-bottom: calc(var(--keyboard-padding-bottom, 0px) + env(safe-area-inset-bottom, 0));
}
body > .ML__keyboard.is-visible > .MLK__backdrop {
box-shadow: 0 -5px 6px rgba(0, 0, 0, 0.08);
border-top: 1px solid var(--_border);
}
body > .ML__keyboard.backdrop-is-transparent.is-visible > .MLK__backdrop {
box-shadow: none;
border: none;
}
body > .ML__keyboard.is-visible.animate > .MLK__backdrop {
transition: 0.28s cubic-bezier(0, 0, 0.2, 1);
transition-property: transform, opacity;
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}
.ML__keyboard {
position: relative;
overflow: hidden;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: var(--_keyboard-zindex);
box-sizing: border-box;
outline: none;
border: none;
margin: 0;
padding: 0;
line-height: 1;
overflow-wrap: unset;
text-align: left;
vertical-align: baseline;
cursor: auto;
white-space: pre;
box-shadow: none;
opacity: 1;
transform: none;
pointer-events: none;
}
.ML__keyboard :where(div) {
box-sizing: border-box;
outline: none;
border: none;
margin: 0;
padding: 0;
line-height: 1;
overflow-wrap: unset;
text-align: left;
vertical-align: baseline;
cursor: auto;
white-space: pre;
box-shadow: none;
transform: none;
}
.MLK__backdrop {
position: absolute;
bottom: calc(-1 * var(--_keyboard-height));
width: 100%;
height: var(--_keyboard-height);
box-sizing: border-box;
padding-top: var(--_padding-top);
padding-bottom: var(--_padding-bottom);
padding-left: var(--_padding-horizontal);
padding-right: var(--_padding-horizontal);
opacity: 0;
visibility: hidden;
transform: translate(0, 0);
background: var(--_background);
}
.backdrop-is-transparent .MLK__backdrop {
background: transparent;
}
/* If a custom layout has a custom container/backdrop
(backdrop-is-transparent), make sure to let pointer event go through. */
.backdrop-is-transparent .MLK__plate {
background: transparent;
pointer-events: none;
}
/* If a custom layout has a custom container/backdrop, make sure to
allow pointer events on it. */
.backdrop-is-transparent .MLK__layer > div > div {
pointer-events: all;
}
.ML__keyboard.is-visible > .MLK__backdrop {
transform: translate(0, calc(-1 * var(--_keyboard-height)));
opacity: 1;
visibility: visible;
}
.caps-lock-indicator {
display: none;
width: 8px;
height: 8px;
background: #0cbc0c;
box-shadow: inset 0 0 4px 0 #13ca13, 0 0 4px 0 #a9ef48;
border-radius: 8px;
right: 8px;
top: 8px;
position: absolute;
}
.ML__keyboard.is-caps-lock .caps-lock-indicator {
display: block;
}
.ML__keyboard.is-caps-lock .shift {
background: var(--_keycap-background-active);
color: var(--_keycap-text-active);
}
.MLK__plate {
position: absolute;
top: var(--_padding-top);
left: var(--_padding-horizontal);
width: calc(100% - 2 * var(--_padding-horizontal));
margin: 0;
padding: 0;
box-sizing: border-box;
container-type: inline-size;
touch-action: none;
-webkit-user-select: none;
user-select: none;
pointer-events: all;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 16px;
/* Size of toolbar labels */
font-weight: 400;
text-shadow: none;
}
.ML__box-placeholder {
color: var(--_box-placeholder-color);
}
.MLK__tex {
font-family: KaTeX_Main, KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__tex-math {
font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
font-style: italic;
}
.MLK__layer {
display: none;
outline: none;
}
.MLK__layer.is-visible {
display: flex;
flex-flow: column;
}
/* Keyboard layouts are made or rows of keys... */
.MLK__rows {
--_keycap-width: min(var(--_keycap-max-width), 10cqw);
display: flex;
flex-flow: column;
align-items: center;
border-collapse: separate;
clear: both;
border: 0;
margin: 0;
margin-bottom: var(--_keycap-gap);
gap: var(--_keycap-gap);
/* If the styling include, e.g., some shadows, they will be
cut off by the overflow. In that case, set the padding to
compensate. */
padding-left: var(--_row-padding-left);
padding-right: var(--_row-padding-right);
overflow: visible;
touch-action: none;
}
.MLK__rows > .MLK__row {
display: flex;
flex-flow: row;
justify-content: center;
width: 100%;
gap: var(--_keycap-gap);
margin: 0;
padding: 0;
/* For the alignment of the text on some modifiers (e.g. shift) */
/* Extra spacing between two adjacent keys */
}
.MLK__rows > .MLK__row .tex {
font-family: KaTeX_Math, KaTeX_Main, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__rows > .MLK__row .tex-math {
font-family: KaTeX_Math, 'Cambria Math', 'Asana Math', OpenSymbol, Symbola, STIX, Times, serif !important;
}
.MLK__rows > .MLK__row .big-op {
font-size: calc(1.25 * var(--_keycap-font-size));
}
.MLK__rows > .MLK__row .small {
font-size: var(--_keycap-small-font-size);
}
.MLK__rows > .MLK__row .bottom {
justify-content: flex-end;
}
.MLK__rows > .MLK__row .left {
align-items: flex-start;
padding-left: 12px;
}
.MLK__rows > .MLK__row .right {
align-items: flex-end;
padding-right: 12px;
}
.MLK__rows > .MLK__row .w0 {
width: 0;
}
.MLK__rows > .MLK__row .w5 {
width: calc(0.5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w15 {
width: calc(1.5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w20 {
width: calc(2 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w40 {
width: calc(4 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .w50 {
width: calc(5 * var(--_keycap-width) - var(--_keycap-gap));
}
.MLK__rows > .MLK__row .MLK__keycap.w50 {
font-size: 80%;
padding-top: 10px;
font-weight: 100;
}
.MLK__rows > .MLK__row .separator {
background: transparent;
border: none;
pointer-events: none;
}
.MLK__rows > .MLK__row .horizontal-rule {
height: 6px;
margin-top: 3px;
margin-bottom: 0;
width: 100%;
border-radius: 0;
border-top: var(--_horizontal-rule);
}
.MLK__rows > .MLK__row .ghost {
background: var(--_toolbar-background);
border: none;
color: var(--_toolbar-text);
}
.MLK__rows > .MLK__row .ghost:hover {
background: var(--_toolbar-background-hover);
}
.MLK__rows > .MLK__row .bigfnbutton {
font-size: var(--_keycap-extra-small-font-size);
}
.MLK__rows > .MLK__row .shift,
.MLK__rows > .MLK__row .action {
color: var(--_keycap-secondary-text);
background: var(--_keycap-secondary-background);
border-color: var(--_keycap-secondary-border);
border-bottom-color: var(--_keycap-secondary-border-bottom);
line-height: 0.8;
font-size: min(1rem, var(--_keycap-small-font-size));
font-weight: 600;
padding: 8px 12px 8px 12px;
}
.MLK__rows > .MLK__row .shift:hover,
.MLK__rows > .MLK__row .action:hover {
background: var(--_keycap-secondary-background-hover);
}
.MLK__rows > .MLK__row .action.primary {
background: var(--_keycap-primary-background);
color: var(--_keycap-primary-text);
}
.MLK__rows > .MLK__row .action.primary:hover {
background: var(--_keycap-primary-background-hover);
color: var(--_keycap-primary-text);
}
.MLK__rows > .MLK__row .shift.selected,
.MLK__rows > .MLK__row .action.selected {
color: var(--_toolbar-text-active);
}
.MLK__rows > .MLK__row .shift.selected.is-pressed,
.MLK__rows > .MLK__row .action.selected.is-pressed,
.MLK__rows > .MLK__row .shift.selected.is-active,
.MLK__rows > .MLK__row .action.selected.is-active {
color: white;
}
.MLK__rows > .MLK__row .warning {
background: #cd0030;
color: white;
}
.MLK__rows > .MLK__row .warning svg.svg-glyph {
width: 24px;
height: 24px;
min-height: 24px;
}
/** A regular keycap
* Use the :where() pseudo-class to give it a very low specifity,
* so that it can be overriden by custom style.
*/
:where(.MLK__rows > .MLK__row div) {
display: flex;
flex-flow: column;
align-items: center;
justify-content: space-evenly;
width: calc(var(--_keycap-width) - var(--_keycap-gap));
height: var(--_keycap-height);
box-sizing: border-box;
padding: 0;
vertical-align: top;
text-align: center;
float: left;
color: var(--_keycap-text);
fill: currentColor;
font-size: var(--_keycap-font-size);
background: var(--_keycap-background);
border: 1px solid var(--_keycap-border);
border-bottom-color: var(--_keycap-border-bottom);
border-radius: 6px;
cursor: pointer;
touch-action: none;
/* Keys with a variants panel */
position: relative;
overflow: hidden;
-webkit-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
:where(.MLK__rows > .MLK__row div):hover {
overflow: visible;
background: var(--_keycap-background-hover);
}
:where(.MLK__rows > .MLK__row div) .ML__latex {
pointer-events: none;
touch-action: none;
}
:where(.MLK__rows > .MLK__row div) svg.svg-glyph {
margin: 8px 0;
width: 20px;
height: 20px;
min-height: 20px;
}
:where(.MLK__rows > .MLK__row div) svg.svg-glyph-lg {
margin: 8px 0;
width: 24px;
height: 24px;
min-height: 24px;
}
:where(.MLK__rows > .MLK__row div).MLK__tex-math {
font-size: 25px;
}
:where(.MLK__rows > .MLK__row div).is-pressed {
background: var(--_keycap-background-pressed);
color: var(--_keycap-text-pressed);
--_box-placeholder-color: var(--_box-placeholder-pressed-color);
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,
:where(.MLK__rows > .MLK__row div).action.is-active,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,
:where(.MLK__rows > .MLK__row div).action.is-pressed {
z-index: calc(var(--_keyboard-zindex) - 5);
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active aside,
:where(.MLK__rows > .MLK__row div).action.is-active aside,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed aside,
:where(.MLK__rows > .MLK__row div).action.is-pressed aside {
display: none;
}
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active .MLK__shift,
:where(.MLK__rows > .MLK__row div).action.is-active .MLK__shift,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed .MLK__shift,
:where(.MLK__rows > .MLK__row div).action.is-pressed .MLK__shift {
display: none;
}
:where(.MLK__rows > .MLK__row div).shift.is-pressed,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-pressed,
:where(.MLK__rows > .MLK__row div).action.is-pressed {
background: var(--_keycap-background-pressed);
color: var(--_keycap-text-pressed);
}
:where(.MLK__rows > .MLK__row div).shift.is-active,
:where(.MLK__rows > .MLK__row div).MLK__keycap.is-active,
:where(.MLK__rows > .MLK__row div).action.is-active {
background: var(--_keycap-background-active);
color: var(--_keycap-text-active);
--_box-placeholder-color: var(--_box-placeholder-pressed-color);
}
:where(.MLK__rows > .MLK__row div) small {
color: var(--_keycap-secondary-text);
}
:where(.MLK__rows > .MLK__row div) aside {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 10px;
line-height: 10px;
color: var(--_keycap-secondary-text);
}
/* Add an attribute 'data-tooltip' to display a tooltip on hover.
Note there are a different set of tooltip rules for the keyboard toggle
(it's in a different CSS tree) */
.ML__keyboard [data-tooltip] {
position: relative;
}
.ML__keyboard [data-tooltip]::after {
position: absolute;
display: inline-table;
content: attr(data-tooltip);
top: inherit;
bottom: 100%;
width: max-content;
max-width: 200px;
padding: 8px 8px;
background: #616161;
color: #fff;
text-align: center;
z-index: 2;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
border-radius: 2px;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
font-weight: 400;
font-size: 12px;
transition: all 0.15s cubic-bezier(0.4, 0, 1, 1) 1s;
opacity: 0;
transform: scale(0.5);
}
.ML__keyboard [data-tooltip]:hover {
position: relative;
}
.ML__keyboard [data-tooltip]:hover::after {
opacity: 1;
transform: scale(1);
}
.MLK__toolbar {
align-self: center;
display: flex;
flex-flow: row;
justify-content: space-between;
width: 100%;
max-width: 996px;
min-height: 32px;
/* Icons for undo/redo, etc. */
}
.MLK__toolbar svg {
height: 20px;
width: 20px;
}
.MLK__toolbar > .left {
position: relative;
display: flex;
justify-content: flex-start;
flex-flow: row;
}
.MLK__toolbar > .right {
display: flex;
justify-content: flex-end;
flex-flow: row;
}
.MLK__toolbar > div > div {
/* "button" in the toolbar */
display: flex;
align-items: center;
justify-content: center;
color: var(--_toolbar-text);
fill: currentColor;
background: var(--_toolbar-background);
font-size: var(--_toolbar-font-size);
padding: 4px 15px;
cursor: pointer;
width: max-content;
min-width: 42px;
min-height: 34px;
border: none;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 8px;
padding-top: 8px;
margin-top: 0;
margin-bottom: 4px;
margin-left: 4px;
margin-right: 4px;
border-radius: 8px;
box-shadow: none;
border-bottom: 2px solid transparent;
}
.MLK__toolbar > div > div:not(.disabled):not(.selected):hover {
background: var(--_toolbar-background-hover);
}
.MLK__toolbar > div > div.disabled svg,
.MLK__toolbar > div > div.disabled:hover svg,
.MLK__toolbar > div > div.disabled.is-pressed svg {
color: var(--_toolbar-text);
opacity: 0.2;
}
.MLK__toolbar > div > div:hover,
.MLK__toolbar > div > div:active,
.MLK__toolbar > div > div.is-pressed,
.MLK__toolbar > div > div.is-active {
color: var(--_toolbar-text-active);
}
.MLK__toolbar > div > div.selected {
color: var(--_toolbar-text-active);
background: var(--_toolbar-background-selected);
border-radius: 0;
border-bottom-color: var(--_toolbar-text-active);
padding-bottom: 4px;
margin-bottom: 8px;
}
/* This is the element that displays variants on press+hold */
.MLK__variant-panel {
visibility: hidden;
position: fixed;
display: flex;
flex-flow: row wrap-reverse;
justify-content: center;
align-content: center;
margin: 0;
padding: 0;
bottom: auto;
top: 0;
box-sizing: content-box;
transform: none;
z-index: calc(var(--_keyboard-zindex) + 1);
touch-action: none;
max-width: 350px;
background: var(--_variant-panel-background);
text-align: center;
border-radius: 6px;
padding: 6px;
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
transition: none;
}
.MLK__variant-panel.is-visible {
visibility: visible;
}
.MLK__variant-panel.compact {
--_variant-keycap-length: var(--variant-keycap-length, 50px);
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-aside-font-size: var(--variant-keycap-aside-font-size, 10px);
}
.MLK__variant-panel .item {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
font-size: var(--_variant-keycap-font-size);
height: var(--_variant-keycap-length);
width: var(--_variant-keycap-length);
margin: 0;
box-sizing: border-box;
border-radius: 5px;
border: 1px solid transparent;
background: transparent;
pointer-events: all;
cursor: pointer;
color: var(--_variant-keycap-text);
fill: currentColor;
}
@media (max-height: 412px) {
.MLK__variant-panel .item {
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-length: var(--variant-keycap-length, 50px);
}
}
.MLK__variant-panel .item .ML__latex {
pointer-events: none;
}
.MLK__variant-panel .item.is-active {
background: var(--_variant-keycap-background-active);
color: var(--_variant-keycap-text-active);
}
.MLK__variant-panel .item.is-pressed {
background: var(--_variant-keycap-background-pressed);
color: var(--_variant-keycap-text-pressed);
}
.MLK__variant-panel .item.small {
font-size: var(--_keycap-small-font-size);
}
.MLK__variant-panel .item.swatch-button {
box-sizing: border-box;
background: #fbfbfb;
}
.MLK__variant-panel .item.swatch-button > span {
display: inline-block;
margin: 6px;
width: calc(100% - 12px);
height: calc(100% - 12px);
border-radius: 50%;
}
.MLK__variant-panel .item.swatch-button:hover {
background: #f0f0f0;
}
.MLK__variant-panel .item.swatch-button:hover > span {
border-radius: 2px;
}
.MLK__variant-panel .item.box > div,
.MLK__variant-panel .item.box > span {
border: 1px dashed rgba(0, 0, 0, 0.24);
}
.MLK__variant-panel .item .warning {
min-height: 60px;
min-width: 60px;
background: #cd0030;
color: white;
padding: 5px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
}
.MLK__variant-panel .item .warning.is-pressed,
.MLK__variant-panel .item .warning.is-active {
background: red;
}
.MLK__variant-panel .item .warning svg.svg-glyph {
width: 50px;
height: 50px;
}
.MLK__variant-panel .item aside {
font-size: var(--_variant-keycap-aside-font-size);
line-height: 12px;
opacity: 0.78;
padding-top: 2px;
}
.MLK__keycap {
position: relative;
}
.MLK__shift {
display: block;
position: absolute;
right: 4px;
top: 4px;
font-size: var(--_keycap-shift-font-size);
color: var(--_keycap-shift-color);
}
.hide-shift .MLK__shift {
display: none;
}
@media (max-width: 414px) {
.MLK__variant-panel {
max-width: 350px;
--_variant-keycap-font-size: var(--variant-keycap-font-size, 24px);
--_variant-keycap-length: var(--variant-keycap-length, 50px);
}
}
/* @xs breakpoint: iPhone 5 */
@container (max-width: 414px) {
.MLK__rows {
--_keycap-gap: max(var(--_keycap-gap, 2px), 2px);
--_keycap-height: max(var(--_keycap-height), 42px);
--_keycap-width: min(min(var(--_keycap-max-width), 10cqw), 62px);
}
.MLK__toolbar > div > div {
font-size: 100%;
margin-left: 2px;
margin-right: 2px;
}
.MLK__rows .shift,
.MLK__rows .action {
font-size: 65%;
}
.MLK__rows .warning svg.svg-glyph {
width: 14px;
height: 14px;
min-height: 14px;
}
}
@container (max-width: 744px) {
.MLK__rows {
--_keycap-gap: max(var(--keycap-gap, 2px), 2px);
--_keycap-height: max(var(--keycap-height, 52px), 52px);
--_keycap-width: min(min(var(--_keycap-max-width), 10cqw), 62px);
}
.MLK__toolbar > div > div {
padding-left: 0;
padding-right: 0;
}
.MLK__tooltip::after {
padding: 8px 16px;
font-size: 16px;
}
.MLK__rows > .MLK__row > div.fnbutton {
font-size: 16px;
}
.MLK__rows > .MLK__row > div.bigfnbutton {
font-size: calc(var(--_keycap-extra-small-font-size) / 1.55);
}
.MLK__rows > .MLK__row > div.small {
font-size: 13px;
}
.MLK__rows > .MLK__row > div > aside {
display: none;
}
.MLK__shift {
display: none;
}
}
/* Medium breakpoint: larger phones */
@container (max-width: 768px) {
.MLK__rows {
--_keycap-height: max(var(--keycap-height, 42px), 42px);
}
.MLK__rows > .MLK__row > div > small {
font-size: 14px;
}
}
@media (max-height: 768px) {
.MLK__rows {
--_keycap-height: max(var(--keycap-height, 42px), 42px);
}
.MLK__rows > .MLK__row > div > small {
font-size: 14px;
}
}
@container (max-width: 1444px) {
.MLK__rows .if-wide {
display: none;
}
}
@media (prefers-color-scheme: dark) {
.ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0b5c9c);
--_background: var(--keyboard-background, #151515);
--_border: var(--keyboard-border, transparent);
--_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);
--keyboard-toolbar-background-hover: #303030;
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);
--_keycap-background: var(--keycap-background, #1f2022);
--_keycap-background-hover: var(--keycap-background-hover, #2f3032);
--_keycap-border: var(--_keycap-border, transparent);
--_keycap-border-bottom: var(--_keycap-border-bottom, transparent);
--_keycap-text: var(--keycap-text, #e3e4e8);
--_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);
--_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);
--keycap-secondary-border: transparent;
--keycap-secondary-border-bottom: transparent;
--_keycap-secondary-border: var(--keycap-secondary-border, transparent);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);
--_variant-panel-background: var(--variant-panel-background, #303030);
--_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);
}
}
/* Same as the media query, but with a class */
[theme='dark'] .ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0b5c9c);
--_background: var(--keyboard-background, #151515);
--_border: var(--keyboard-border, transparent);
--_toolbar-text: var(--keyboard-toolbar-text, #e3e4e8);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #303030);
--keyboard-toolbar-background-hover: #303030;
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #303030);
--_keycap-background: var(--keycap-background, #1f2022);
--_keycap-background-hover: var(--keycap-background-hover, #2f3032);
--_keycap-border: var(--_keycap-border, transparent);
--_keycap-border-bottom: var(--_keycap-border-bottom, transparent);
--_keycap-text: var(--keycap-text, #e3e4e8);
--_keycap-secondary-background: var(--keycap-secondary-background, #3d4144);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #4d5154);
--_keycap-secondary-text: var(--keycap-secondary-text, #e7ebee);
--keycap-secondary-border: transparent;
--keycap-secondary-border-bottom: transparent;
--_keycap-secondary-border: var(--keycap-secondary-border, transparent);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, transparent);
--_variant-panel-background: var(--variant-panel-background, #303030);
--_variant-keycap-text-active: var(--variant-keycap-text-active, #fff);
}
[theme='light'] .ML__keyboard {
--_accent-color: var(--keyboard-accent-color, #0c75d8);
--_background: var(--keyboard-background, #cacfd7);
--_border: var(--keyboard-border, #ddd);
--_toolbar-text: var(--keyboard-toolbar-text, #2c2e2f);
--_toolbar-background: var(--keyboard-toolbar-background, transparent);
--_toolbar-background-hover: var(--keyboard-toolbar-background-hover, #eee);
--_toolbar-background-selected: var(--keyboard-toolbar-background-selected, transparent);
--_horizontal-rule: var(--keyboard-horizontal-rule, 1px solid #fff);
--_keycap-background: var(--keycap-background, white);
--_keycap-background-hover: var(--keycap-background-hover, #f5f5f7);
--_keycap-background-active: var(--keycap-background-active, var(--_accent-color));
--_keycap-background-pressed: var(--keycap-background-pressed, var(--_accent-color));
--_keycap-border: var(--_keycap-border, #e5e6e9);
--_keycap-border-bottom: var(--_keycap-border-bottom, #8d8f92);
--_keycap-text: var(--keycap-text, #000);
--_keycap-text-active: var(--keycap-text-active, #fff);
--_keycap-text-hover: var(--keycap-text-hover, var(--_keycap-text));
--_keycap-text-pressed: var(--keycap-text-pressed, #fff);
--_keycap-shift-text: var(--keycap-shift-text, var(--_accent-color));
--_keycap-secondary-background: var(--keycap-secondary-background, #a0a9b8);
--_keycap-secondary-background-hover: var(--keycap-secondary-background-hover, #7d8795);
--_keycap-secondary-text: var(--keycap-secondary-text, #060707);
--_keycap-secondary-border: var(--keycap-secondary-border, #c5c9d0);
--_keycap-secondary-border-bottom: var(--keycap-secondary-border-bottom, #989da6);
--_variant-panel-background: var(--variant-panel-background, #fff);
--_variant-keycap-text: var(--variant-keycap-textvar, var(--_keycap-text));
--_variant-keycap-text-active: var(--variant-keycap-text-active, var(--_keycap-text-active));
--_variant-keycap-background-active: var(--variant-keycap-background-active, var(--_accent-color));
}
`,Sd=`:host {
--primary-color: #5898ff;
--primary-color-dimmed: #c0c0f0;
--primary-color-dark: var(--blue-500);
--primary-color-light: var(--blue-100);
--primary-color-reverse: #ffffff;
--secondary-color: #ff8a65;
--secondary-color-dimmed: #f0d5c5;
--secondary-color-dark: var(--orange-500);
--secondary-color-light: var(--orange-100);
--secondary-color-reverse: #ffffff;
--link-color: #5898ff;
--link-color-dimmed: #c5c5c5;
--link-color-dark: #121212;
--link-color-light: #e2e2e2;
--link-color-reverse: #ffffff;
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--neutral-100: #f5f5f5;
--neutral-200: #eeeeee;
--neutral-300: #e0e0e0;
--neutral-400: #bdbdbd;
--neutral-500: #9e9e9e;
--neutral-600: #757575;
--neutral-700: #616161;
--neutral-800: #424242;
--neutral-900: #212121;
--red-25: #fff8f7;
--red-50: #fff1ef;
--red-100: #ffeae6;
--red-200: #ffcac1;
--red-300: #ffa495;
--red-400: #ff7865;
--red-500: #f21c0d;
--red-600: #e50018;
--red-700: #d30024;
--red-800: #bd002c;
--red-900: #a1002f;
--orange-25: #fffbf8;
--orange-50: #fff7f1;
--orange-100: #fff3ea;
--orange-200: #ffe1c9;
--orange-300: #ffcca2;
--orange-400: #ffb677;
--orange-500: #fe9310;
--orange-600: #f58700;
--orange-700: #ea7c00;
--orange-800: #dc6d00;
--orange-900: #ca5b00;
--brown-25: #fff8ef;
--brown-50: #fff1df;
--brown-100: #ffe9ce;
--brown-200: #ebcca6;
--brown-300: #cdaf8a;
--brown-400: #af936f;
--brown-500: #856a47;
--brown-600: #7f5e34;
--brown-700: #78511f;
--brown-800: #6e4200;
--brown-900: #593200;
--yellow-25: #fffdf9;
--yellow-50: #fffcf2;
--yellow-100: #fffaec;
--yellow-200: #fff2ce;
--yellow-300: #ffe8ab;
--yellow-400: #ffdf85;
--yellow-500: #ffcf33;
--yellow-600: #f1c000;
--yellow-700: #dfb200;
--yellow-800: #c9a000;
--yellow-900: #ad8a00;
--lime-25: #f4ffee;
--lime-50: #e9ffdd;
--lime-100: #ddffca;
--lime-200: #a8fb6f;
--lime-300: #94e659;
--lime-400: #80d142;
--lime-500: #63b215;
--lime-600: #45a000;
--lime-700: #268e00;
--lime-800: #007417;
--lime-900: #005321;
--green-25: #f5fff5;
--green-50: #ebffea;
--green-100: #e0ffdf;
--green-200: #a7ffa7;
--green-300: #5afa65;
--green-400: #45e953;
--green-500: #17cf36;
--green-600: #00b944;
--green-700: #00a34a;
--green-800: #008749;
--green-900: #00653e;
--teal-25: #f3ffff;
--teal-50: #e6fffe;
--teal-100: #d9fffe;
--teal-200: #8dfffe;
--teal-300: #57f4f4;
--teal-400: #43e5e5;
--teal-500: #17cfcf;
--teal-600: #00c2c0;
--teal-700: #00b5b1;
--teal-800: #00a49e;
--teal-900: #009087;
--cyan-25: #f7fcff;
--cyan-50: #eff8ff;
--cyan-100: #e7f5ff;
--cyan-200: #c2e6ff;
--cyan-300: #95d5ff;
--cyan-400: #61c4ff;
--cyan-500: #13a7ec;
--cyan-600: #069eda;
--cyan-700: #0095c9;
--cyan-800: #0088b2;
--cyan-900: #0a7897;
--blue-25: #f7faff;
--blue-50: #eef5ff;
--blue-100: #e5f1ff;
--blue-200: #bfdbff;
--blue-300: #92c2ff;
--blue-400: #63a8ff;
--blue-500: #0d80f2;
--blue-600: #0077db;
--blue-700: #006dc4;
--blue-800: #0060a7;
--blue-900: #005086;
--indigo-25: #f8f7ff;
--indigo-50: #f1efff;
--indigo-100: #eae7ff;
--indigo-200: #ccc3ff;
--indigo-300: #ac99ff;
--indigo-400: #916aff;
--indigo-500: #63c;
--indigo-600: #5a21b2;
--indigo-700: #4e0b99;
--indigo-800: #3b0071;
--indigo-900: #220040;
--purple-25: #fbf7ff;
--purple-50: #f8f0ff;
--purple-100: #f4e8ff;
--purple-200: #e4c4ff;
--purple-300: #d49aff;
--purple-400: #c36aff;
--purple-500: #a219e6;
--purple-600: #9000c4;
--purple-700: #7c009f;
--purple-800: #600073;
--purple-900: #3d0043;
--magenta-25: #fff8fb;
--magenta-50: #fff2f6;
--magenta-100: #ffebf2;
--magenta-200: #ffcddf;
--magenta-300: #ffa8cb;
--magenta-400: #ff7fb7;
--magenta-500: #eb4799;
--magenta-600: #da3689;
--magenta-700: #c82179;
--magenta-800: #b00065;
--magenta-900: #8a004c;
}
@media (prefers-color-scheme: dark) {
:host {
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--semantic-bg-blue: var(--blue-25);
--semantic-bg-red: var(--red-25);
--semantic-bg-orange: var(--orange-25);
--semantic-bg-green: var(--green-25);
--neutral-100: #121212;
--neutral-200: #424242;
--neutral-300: #616161;
--neutral-400: #757575;
--neutral-500: #9e9e9e;
--neutral-600: #bdbdbd;
--neutral-700: #e0e0e0;
--neutral-800: #eeeeee;
--neutral-900: #f5f5f5;
}
}
:host([theme='dark']) {
--semantic-blue: var(--blue-700);
--semantic-red: var(--red-400);
--semantic-orange: var(--orange-400);
--semantic-green: var(--green-700);
--semantic-bg-blue: var(--blue-25);
--semantic-bg-red: var(--red-25);
--semantic-bg-orange: var(--orange-25);
--semantic-bg-green: var(--green-25);
--neutral-100: #121212;
--neutral-200: #424242;
--neutral-300: #616161;
--neutral-400: #757575;
--neutral-500: #9e9e9e;
--neutral-600: #bdbdbd;
--neutral-700: #e0e0e0;
--neutral-800: #eeeeee;
--neutral-900: #f5f5f5;
}
/* @media (prefers-color-scheme: dark) {
:host {
--label-color: #fff;
--active-label-color: #000;
--menu-bg: #525252;
--active-bg: #5898ff;
--active-bg-dimmed: #5c5c5c;
}
} */
:host {
--ui-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont,
'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji',
'Segoe UI Emoji', 'Segoe UI Symbol';
--ui-font-size: 14px;
--ui-line-height: 1.5;
--ui-letter-spacing: 0.007em;
--mono-font-family: 'Berkeley Mono', 'JetBrains Mono', 'IBM Plex Mono',
'Source Code Pro', Menlo, Monaco, 'Courier New', monospace;
--ui-layer-1: var(--neutral-100);
--ui-layer-2: var(--neutral-200);
--ui-layer-3: var(--neutral-300);
--ui-layer-4: var(--neutral-400);
--ui-layer-5: var(--neutral-500);
--ui-layer-6: var(--neutral-600);
--ui-border-color: var(--primary-color);
--ui-border-radius: 4px;
--ui-text: var(--neutral-900);
--ui-text-secondary: var(--neutral-700);
--ui-text-placeholder: var(--neutral-500);
--ui-text-muted: var(--neutral-300);
/** A field is a UI element in which a user can type data, for
* example an input or textarea element.
*/
--ui-field-bg: var(--neutral-100);
--ui-field-bg-hover: var(--neutral-100);
--ui-field-bg-disabled: var(--neutral-300);
--ui-field-bg-invalid: var(--red-100);
--ui-field-bg-focus: var(--neutral-100);
--ui-field-border: 0.5px solid var(--border-color);
--ui-field-border-hover: 0.5px solid var(--border-color);
--ui-field-border-disabled: 0.5px solid var(--border-color);
--ui-field-border-invalid: 0.5px solid var(--border-color);
--ui-field-border-focus: 0.5px solid var(--border-color);
--ui-menu-bg: var(--neutral-100);
--ui-menu-text: var(--neutral-900);
--ui-menu-bg-hover: var(--neutral-200);
--ui-menu-text-hover: var(--neutral-900);
/** The \`active\` state is used for the state of menu items
* when they are selected.
*/
--ui-menu-bg-active: var(--primary-color);
--ui-menu-text-active: var(--primary-color-reverse);
/** The \`active-muted\` set is used for the state of
* submenus when they are open.
*/
--ui-menu-bg-active-muted: var(--neutral-300);
--ui-menu-text-active-muted: var(--neutral-900);
/* --ui-menu-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.302),
0 2px 6px 2px rgba(60, 64, 67, 0.149); */
--ui-menu-shadow: 0 0 2px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 0, 0, 0.2);
--ui-menu-divider: 0.5px solid #c7c7c7;
/* var(--neutral-300); */
--ui-menu-z-index: 10000;
--page-bg: var(--neutral-100);
--content-bg: var(--neutral-200);
}
@media (prefers-color-scheme: dark) {
:host {
--ui-menu-bg: var(--neutral-200);
}
}
:host([theme='dark']) {
--ui-menu-bg: var(--neutral-200);
}
/* PingFang SC is a macOS font. Microsoft Yahei is a Windows font.
Noto is a Linux/Android font.
*/
:lang(zh-cn),
:lang(zh-sg),
:lang(zh-my),
:lang(zh) {
--ui-font-family: -apple-system, system-ui, 'PingFang SC', 'Hiragino Sans GB',
'Noto Sans CJK SC', 'Noto Sans SC', 'Noto Sans', 'Microsoft Yahei UI',
'Microsoft YaHei New', 'Microsoft Yahei', '\u5FAE\u8F6F\u96C5\u9ED1', SimSun, '\u5B8B\u4F53',
STXihei, '\u534E\u6587\u7EC6\u9ED1', sans-serif;
}
:lang(zh-tw),
:lang(zh-hk),
:lang(zh-mo) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans',
'Microsoft JhengHei UI', 'Microsoft JhengHei', '\u5FAE\u8EDF\u6B63\u9ED1\u9AD4', '\u65B0\u7D30\u660E\u9AD4',
'PMingLiU', '\u7D30\u660E\u9AD4', 'MingLiU', sans-serif;
}
:lang(ja),
:lang(ja-jp),
:lang(ja-jp-mac) {
--ui-font-family: -apple-system, system-ui, 'Hiragino Sans',
'Hiragino Kaku Gothic ProN', 'Noto Sans CJK JP', 'Noto Sans JP', 'Noto Sans',
'\u6E38\u30B4\u30B7\u30C3\u30AF', '\u6E38\u30B4\u30B7\u30C3\u30AF\u4F53', YuGothic, 'Yu Gothic', '\u30E1\u30A4\u30EA\u30AA', Meiryo,
'\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF', 'MS PGothic', sans-serif;
}
:lang(ko),
:lang(ko-kr),
:lang(ko-kr-std) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',
'Noto Sans', 'Malgun Gothic', '\uB9D1\uC740 \uACE0\uB515', 'Apple SD Gothic Neo',
'\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo', 'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif;
}
:lang(ko-kr-apple) {
--ui-font-family: -apple-system, system-ui, 'Noto Sans CJK KR', 'Noto Sans KR',
'Noto Sans', 'Apple SD Gothic Neo', '\uC560\uD50C SD \uC0B0\uB3CC\uACE0\uB515 Neo',
'Apple SD \uC0B0\uB3CC\uACE0\uB515 Neo', '\uB3CB\uC6C0', Dotum, sans-serif;
}
:lang(zh-cn),
:lang(zh-sg),
:lang(zh-my),
:lang(zh),
:lang(zh-tw),
:lang(zh-hk),
:lang(zh-mo),
:lang(ja),
:lang(ja-jp),
:lang(ja-jp-mac),
:lang(ko),
:lang(ko-kr),
:lang(ko-kr-std),
:lang(ko-kr-apple) {
--ui-font-size: 1rem;
--ui-line-height: 1.7;
--ui-letter-spacing: 0;
}
:dir(rtl) {
--ui-line-height: auto;
--ui-letter-spacing: 0;
}
`,Ed=`.ui-menu *,
.ui-menu ::before,
.ui-menu ::after {
box-sizing: border-box;
}
.ui-menu {
display: none;
color-scheme: light dark;
-webkit-user-select: none;
/* Important: Safari iOS doesn't respect user-select */
user-select: none;
cursor: default;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: rgba(0 0 0 0);
--active-label-color: #fff;
/* ui-menu-text-active */
--label-color: #121212;
/* ui-menu-text */
--menu-bg: #e2e2e2;
/* ui-menu-background */
--active-bg: #5898ff;
/* ui-menu-background-active */
--active-bg-dimmed: #c5c5c5;
/* ui-menu-background-active-muted */
}
/** Use the :where pseudo selector to make the specificity of the
* selector 0, so that it can be overridden by the user.
*/
:where(.ui-menu-container) {
position: absolute;
overflow: visible;
width: auto;
height: auto;
z-index: 10000;
border-radius: 8px;
background: var(--ui-menu-bg);
box-shadow: var(--ui-menu-shadow);
list-style: none;
padding: 6px 0 6px 0;
margin: 0;
user-select: none;
cursor: default;
color: var(--ui-menu-text);
font-weight: normal;
font-style: normal;
text-shadow: none;
text-transform: none;
letter-spacing: 0;
outline: none;
opacity: 1;
/* The [popover] elements have a 1px solid black border. Ugh. */
border: none;
width: fit-content;
height: fit-content;
}
:where(.ui-menu-container > li) {
display: flex;
flex-flow: row;
align-items: center;
padding: 1px 7px 1px 7px;
margin-top: 0;
margin-left: 6px;
margin-right: 6px;
border-radius: 4px;
white-space: nowrap;
position: relative;
outline: none;
fill: currentColor;
user-select: none;
cursor: default;
text-align: left;
color: inherit;
font-family: var(--ui-font-family);
font-size: var(--ui-font-size);
line-height: var(--ui-line-height);
letter-spacing: var(--ui-letter-spacing);
}
:where(.ui-menu-container > li > .label) {
appearance: none;
background: none;
outline: none;
width: 100%;
margin: 0;
padding: 1px 2px 1px 1px;
overflow: visible;
border: 1px solid transparent;
white-space: nowrap;
text-align: start;
}
:where(.ui-menu-container > li:has(.heading)) {
margin-top: 0.5em;
}
:where(.ui-menu-container > li > .label.heading) {
font-weight: bold;
opacity: 0.4;
}
:where(.ui-menu-container > li.indent > .label) {
margin-inline-start: 12px;
}
:where(.ui-menu-container > li > .label.indent) {
margin-inline-start: 12px;
}
:where(.ui-menu-container > li[role='divider']) {
border-bottom: 1px solid var(--ui-menu-divider);
border-radius: 0;
padding: 0;
margin-left: 15px;
margin-right: 15px;
padding-top: 5px;
margin-bottom: 5px;
width: calc(100% - 30px);
/** 100% - (margin-left + margin-right) */
}
:where(.ui-menu-container > li[aria-disabled='true']) {
opacity: 0.5;
}
:where(.ui-menu-container > li.active) {
background: var(--ui-menu-bg-active);
background: -apple-system-control-accent;
color: var(--ui-menu-text-active);
}
:where(.ui-menu-container > li.active.is-submenu-open) {
background: var(--ui-menu-bg-active-muted);
color: inherit;
}
:where(.ui-menu-container > li[aria-haspopup='true'] > .label) {
padding-inline-end: 0;
}
:where(.ui-menu-container > li[aria-haspopup='true'].active::after) {
color: var(--ui-menu-text-active);
}
/** Keyboard shortcut */
:where(.ui-menu-container > li > kbd) {
font-family: var(--ui-font-family);
margin-inline-start: 12px;
opacity: 0.4;
}
:where(.ui-menu-container > li.active > kbd) {
opacity: 0.85;
}
.ui-trailing-chevron {
display: flex;
margin-inline-start: 24px;
width: 10px;
height: 10px;
margin-bottom: 4px;
}
.ui-trailing-chevron:dir(rtl) {
transform: scaleX(-1);
}
.ui-checkmark {
display: flex;
margin-inline-end: -11px;
margin-inline-start: -4px;
margin-top: 2px;
width: 16px;
height: 16px;
}
.ui-mixedmark {
display: flex;
margin-inline-end: -11px;
margin-inline-start: -4px;
margin-top: 2px;
width: 16px;
height: 16px;
}
`,Os;function Fs(e){let i="";switch(e){case"mathfield-element":i=`
:host { display: inline-block; background-color: field; color: fieldtext; border-width: 1px; border-style: solid; border-color: #acacac; border-radius: 2px; padding:4px;}
:host([hidden]) { display: none; }
:host([disabled]), :host([disabled]:focus), :host([disabled]:focus-within) { outline: none; opacity: .5; }
:host(:focus), :host(:focus-within) {
outline: Highlight auto 1px; /* For Firefox */
outline: -webkit-focus-ring-color auto 1px;
}
:host([readonly]:focus), :host([readonly]:focus-within),
:host([read-only]:focus), :host([read-only]:focus-within) {
outline: none;
}
@media (hover: none) and (pointer: coarse) {
:host(:not(:focus)) :first-child { pointer-events: none !important; }
}`;break;case"core":i=qo;break;case"mathfield":i=hf;break;case"environment-popover":i=Pc;break;case"suggestion-popover":i=xd;break;case"keystroke-caption":i=wd;break;case"virtual-keyboard":i=Lu;break;case"ui":i=Sd;break;case"menu":i=Ed;break;default:debugger}return i}function ma(e){return Os||(Os={}),Os[e]||(Os[e]=new CSSStyleSheet,Os[e].replaceSync(Fs(e))),Os[e]}var ga;function _a(e){var i;if(!("adoptedStyleSheets"in document)){if(window.document.getElementById(`mathlive-style-${e}`))return;const r=window.document.createElement("style");r.id=`mathlive-style-${e}`,r.append(window.document.createTextNode(Fs(e))),window.document.head.appendChild(r);return}if(ga||(ga={}),((i=ga[e])!=null?i:0)!==0)ga[e]+=1;else{const r=ma(e);document.adoptedStyleSheets=[...document.adoptedStyleSheets,r],ga[e]=1}}function na(e){if("adoptedStyleSheets"in document&&ga!=null&&ga[e]&&(ga[e]-=1,ga[e]<=0)){const i=Os[e];document.adoptedStyleSheets=document.adoptedStyleSheets.filter(r=>r!==i)}}var Il=class zp extends ut{constructor(i){var r;super(f(P({},i),{type:"accent",body:(r=i.body)!=null?r:void 0})),i.accentChar?this.accent=i.accentChar:this.svgAccent=i==null?void 0:i.svgAccent,this.skipBoundary=!0,this.captureSelection=!0}static fromJson(i){return new zp(i)}toJson(){return f(P({},super.toJson()),{accentChar:this.accent,svgAccent:this.svgAccent})}render(i){var r;const a=new fn({parent:i,mathstyle:"cramp"},this.style),u=(r=ut.createBox(a,this.body))!=null?r:new $t("\u25A2",{style:this.style});let p=0;!this.hasEmptyBranch("body")&&this.body.length===2&&this.body[1].isCharacterBox()&&(p=u.skew);let m=Math.min(u.height,Ca),b;if(this.svgAccent)b=xu(this.svgAccent),m=a.metrics.bigOpSpacing1-m;else if(this.accent){const E=new $t(this.accent,{fontFamily:"Main-Regular"});E.italic=0;const I=this.accent===8407?" ML__accent-vec":"";b=new $t(new $t(E),{classes:"ML__accent-body"+I})}b=new wr({shift:0,children:[{box:new $t(u)},-m,{box:b,marginLeft:u.left+2*p,classes:["ML__center"]}]});const w=new $t(b,{type:"lift"});return this.caret&&(w.caret=this.caret),this.bind(a,w.wrap(a)),this.attachSupsub(a,{base:w})}},Zo={"(":")","{":"}","[":"]","|":"|","\\lbrace":"\\rbrace","\\lparen":"\\rparen","\\{":"\\}","\\langle":"\\rangle","\\lfloor":"\\rfloor","\\lceil":"\\rceil","\\vert":"\\vert","\\lvert":"\\rvert","\\Vert":"\\Vert","\\lVert":"\\rVert","\\lbrack":"\\rbrack","\\ulcorner":"\\urcorner","\\llcorner":"\\lrcorner","\\lgroup":"\\rgroup","\\lmoustache":"\\rmoustache"},Du=Object.fromEntries(Object.entries(Zo).map(([e,i])=>[i,e]));function va(e){var i;return(i={"[":91,"]":93,"(":40,")":41,"\\mid":8739,"|":8739,"\u2223":8739,"\u2225":8741,"\\|":8739,"\\{":123,"\\}":125,"\\lbrace":123,"\\rbrace":125,"\\lparen":40,"\\rparen":41,"\\lbrack":91,"\\rbrack":93,"\\vert":8739,"\\lvert":8739,"\\mvert":8739,"\\rvert":8739,"\\Vert":8741,"\\lVert":8741,"\\mVert":8741,"\\rVert":8741,"\\parallel":8741,"\\shortparallel":8741,"\\langle":10216,"\\rangle":10217,"\\lfloor":8970,"\\rfloor":8971,"\\lceil":8968,"\\rceil":8969,"\\ulcorner":9484,"\\urcorner":9488,"\\llcorner":9492,"\\lrcorner":9496,"\\lgroup":10222,"\\rgroup":10223,"\\lmoustache":9136,"\\rmoustache":9137,"\\surd":8730}[e])!=null?i:e.codePointAt(0)}function kd(e,i,r,a){var u;const m=new $t(va(e),{fontFamily:"Main-Regular",isSelected:a.isSelected,classes:"ML__small-delim "+((u=a.classes)!=null?u:"")}).wrap(i);return r&&m.setTop((1-i.scalingFactor)*ps),m}function Oc(e,i,r,a,u){var p,m;const b=new fn({parent:a,mathstyle:"textstyle"},u==null?void 0:u.style),w=new $t(va(e),{fontFamily:`Size${i}-Regular`,isSelected:u.isSelected,classes:((p=u.classes)!=null?p:"")+` ML__delim-size${i}`,type:(m=u.type)!=null?m:"ignore"}).wrap(b);return r&&w.setTop((1-b.scalingFactor)*ps),w}function ff(e,i,r,a,u){var p;let m,b,w,E;m=w=E=va(e),b=null;let I="Size1-Regular";e==="\\vert"||e==="\\lvert"||e==="\\rvert"||e==="\\mvert"||e==="\\mid"?w=m=E=8739:e==="\\Vert"||e==="\\lVert"||e==="\\rVert"||e==="\\mVert"||e==="\\|"?w=m=E=8741:e==="\\uparrow"?w=E=9168:e==="\\Uparrow"?w=E=8214:e==="\\downarrow"?m=w=9168:e==="\\Downarrow"?m=w=8214:e==="\\updownarrow"?(m=8593,w=9168,E=8595):e==="\\Updownarrow"?(m=8657,w=8214,E=8659):e==="["||e==="\\lbrack"?(m=9121,w=9122,E=9123,I="Size4-Regular"):e==="]"||e==="\\rbrack"?(m=9124,w=9125,E=9126,I="Size4-Regular"):e==="\\lfloor"||e==="\u230A"?(w=m=9122,E=9123,I="Size4-Regular"):e==="\\lceil"||e==="\u2308"?(m=9121,w=E=9122,I="Size4-Regular"):e==="\\rfloor"||e==="\u230B"?(w=m=9125,E=9126,I="Size4-Regular"):e==="\\rceil"||e==="\u2309"?(m=9124,w=E=9125,I="Size4-Regular"):e==="("||e==="\\lparen"?(m=9115,w=9116,E=9117,I="Size4-Regular"):e===")"||e==="\\rparen"?(m=9118,w=9119,E=9120,I="Size4-Regular"):e==="\\{"||e==="\\lbrace"?(m=9127,b=9128,E=9129,w=9130,I="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(m=9131,b=9132,E=9133,w=9130,I="Size4-Regular"):e==="\\lgroup"||e==="\u27EE"?(m=9127,E=9129,w=9130,I="Size4-Regular"):e==="\\rgroup"||e==="\u27EF"?(m=9131,E=9133,w=9130,I="Size4-Regular"):e==="\\lmoustache"||e==="\u23B0"?(m=9127,E=9133,w=9130,I="Size4-Regular"):e==="\\rmoustache"||e==="\u23B1"?(m=9131,E=9129,w=9130,I="Size4-Regular"):e==="\\surd"?(m=57345,E=9143,w=57344,I="Size4-Regular"):e==="\\ulcorner"?(m=9484,w=E=32):e==="\\urcorner"?(m=9488,w=E=32):e==="\\llcorner"?(E=9492,w=m=32):e==="\\lrcorner"&&(m=9496,w=m=32);const N=ro(m,I),J=N.height+N.depth,oe=ro(w,I),ge=oe.height+oe.depth,He=ro(E,I),Ft=He.height+He.depth;let Ve=0,St=1;if(b!==null){const Gr=ro(b,I);Ve=Gr.height+Gr.depth,St=2}const Kt=J+Ft+Ve,Lt=Math.max(0,Math.ceil((i-Kt)/(St*ge))),ai=Kt+Lt*St*ge;let yi=ps;r&&(yi=yi*a.scalingFactor);const fi=ai/2-yi,pn=.008,Bn=[];Bn.push({box:new $t(E,{fontFamily:I})}),Bn.push(-pn);const Ht=new $t(w,{fontFamily:I});if(b===null)for(let Gr=0;Gr<Lt;Gr++)Bn.push({box:Ht});else{for(let Gr=0;Gr<Lt;Gr++)Bn.push({box:Ht});Bn.push(-pn),Bn.push({box:new $t(b,{fontFamily:I})}),Bn.push(-pn);for(let Gr=0;Gr<Lt;Gr++)Bn.push({box:Ht})}Bn.push(-pn),Bn.push({box:new $t(m,{fontFamily:I})});let qs="";I==="Size1-Regular"?qs=" delim-size1":I==="Size4-Regular"&&(qs=" delim-size4");const Va=new wr({bottom:fi,children:Bn},{classes:qs});return new $t(Va,f(P({},u!=null?u:{}),{classes:((p=u==null?void 0:u.classes)!=null?p:"")+" ML__delim-mult"}))}var Bs=new Set(["(",")","\\lparen","\\rparen","[","]","\\lbrack","\\rbrack","\\{","\\}","\\lbrace","\\rbrace","\\lfloor","\\rfloor","\\lceil","\\rceil","\\surd","\u230A","\u230B","\u2308","\u2309"]),Td=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\mvert","\\mid","\\lgroup","\\rgroup","\\lmoustache","\\rmoustache","\u27EE","\u27EF","\u23B0","\u23B1"]),Fc=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),Cu=[0,1.2,1.8,2.4,3];function Ad(e,i,r,a){return e===void 0||e==="."?ho(r,a.classes):(e==="<"||e==="\\lt"||e==="\u27E8"?e="\\langle":(e===">"||e==="\\gt"||e==="\u27E9")&&(e="\\rangle"),Bs.has(e)||Fc.has(e)?Oc(e,i,!1,r,a):Td.has(e)?ff(e,Cu[i],!1,r,a):(console.assert(!1,"Unknown delimiter '"+e+"'"),null))}var df=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],Ld=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"stack"}],Dd=[{type:"small",mathstyle:"scriptscriptstyle"},{type:"small",mathstyle:"scriptstyle"},{type:"small",mathstyle:"textstyle"},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}];function Cd(e){return e.type==="small"?"Main-Regular":e.type==="large"?"Size"+e.size+"-Regular":(console.assert(e.type==="stack"),"Size4-Regular")}function pf(e,i,r,a){const u={"-4":0,"-3":1,0:2}[a.mathstyle.sizeDelta];for(let p=u;p<r.length&&r[p].type!=="stack";p++){const m=ro(e,Cd(r[p]));if(m.defaultMetrics)return{type:"small",mathstyle:"scriptstyle"};let b=m.height+m.depth;if(r[p].type==="small"&&(r[p].mathstyle==="scriptscriptstyle"?b*=Math.max(no[Math.max(1,a.size-2)],a.minFontScale):r[p].mathstyle==="scriptstyle"&&(b*=Math.max(no[Math.max(1,a.size-1)],a.minFontScale))),b>i)return r[p]}return r[r.length-1]}function ms(e,i,r,a,u,p){if(!i||i.length===0||i===".")return ho(u);i==="<"||i==="\\lt"?i="\\langle":(i===">"||i==="\\gt")&&(i="\\rangle");let m;Fc.has(i)?m=df:Bs.has(i)?m=Dd:m=Ld;const b=pf(va(i),r,m,u),w=new fn({parent:u,mathstyle:b.mathstyle},p==null?void 0:p.style);return b.type==="small"?kd(i,w,a,f(P({},p),{type:e})):b.type==="large"?Oc(i,b.size,a,w,f(P({},p),{type:e})):(console.assert(b.type==="stack"),ff(i,r,a,w,f(P({},p),{type:e})))}function ks(e,i,r,a,u,p){if(i===".")return ho(u,p==null?void 0:p.classes);const m=ps*u.scalingFactor,b=901,w=5/ds,E=Math.max(r-m,a+m),I=Math.max(E/500*b,2*E-w);return ms(e,i,I,!0,u,p)}function ho(e,i){const r=new $t(null,{classes:" nulldelimiter "+(i!=null?i:""),type:"ignore"});return r.width=e.getRegisterAsEm("nulldelimiterspace"),r.wrap(new fn({parent:e,mathstyle:"textstyle"}))}var ya=class Vp extends ut{constructor(i){var r;super({type:"placeholder",command:"\\placeholder",mode:(r=i==null?void 0:i.mode)!=null?r:"math",style:i==null?void 0:i.style}),this.captureSelection=!0}static fromJson(i){return new Vp(i)}toJson(){return super.toJson()}render(i){let r;return this.value=i.placeholderSymbol,typeof i.renderPlaceholder=="function"?r=i.renderPlaceholder(i):r=this.createBox(i),this.caret&&(r.classes+=" ML__placeholder-selected"),r}_serialize(i){return i.skipPlaceholders?"":"\\placeholder{}"}},mf=["matrix","matrix*","pmatrix","pmatrix*","bmatrix","bmatrix*","Bmatrix","Bmatrix*","vmatrix","vmatrix*","Vmatrix","Vmatrix*"],gf=["cases","dcases","rcases"],_f=["align","align*","aligned","gather","gathered","split"],Md=["array","subequations","eqnarray"];function fo(e){return Md.concat(_f).concat(gf).concat(mf).includes(e)}function Bc(e){return mf.includes(e)}function Id(e){return gf.includes(e)}function Rd(e){return _f.includes(e)}function Nc(e,i,r){let a=0;for(const E of r)"align"in E&&(a+=1);let u=0;const p=[];for(const E of i){let I=0;for(u=Math.max(u,Math.min(E.length,a));I<E.length;){const N=[],J=Math.min(E.length,I+a);for(;I<J;){const oe=E[I];oe.length===0?N.push([new ut({type:"first",mode:e.mode})]):oe[0].type!=="first"?N.push([new ut({type:"first",mode:e.mode}),...oe]):(console.assert(!oe.slice(1).some(ge=>ge.type==="first")),N.push(oe)),I+=1}p.push(N)}}p.length>0&&p[p.length-1].length===1&&p[p.length-1][0].length===1&&p[p.length-1][0][0].type==="first"&&p.pop();const m=[];for(const E of p){if(E.length!==u)for(let I=E.length;I<u;I++)E.push([new ut({type:"first",mode:e.mode}),new ya]);m.push(E)}let b=0,w=0;for(const E of m){w=0;for(const I of E){for(const N of I)N.parent=e,N.parentBranch=[b,w];w+=1}b+=1}return e.isDirty=!0,m}var Tn=class Gp extends ut{constructor(i,r,a,u={}){var p;super({type:"array"}),this.environmentName=i,this.rowGaps=a,u.mathstyleName&&(this.mathstyleName=u.mathstyleName),u.columns&&(u.columns.length===0?this.colFormat=[{align:"l"}]:this.colFormat=u.columns),this.colFormat||(this.colFormat=[{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"},{align:"l"}]),this.array=Nc(this,r,this.colFormat),u.leftDelim&&(this.leftDelim=u.leftDelim),u.rightDelim&&(this.rightDelim=u.rightDelim),u.arraycolsep!==void 0&&(this.arraycolsep=u.arraycolsep),this.colSeparationType=u.colSeparationType,u.arraystretch!==void 0&&(this.arraystretch=u.arraystretch),this.minColumns=(p=u.minColumns)!=null?p:1}static fromJson(i){return new Gp(i.environmentName,i.array,i.rowGaps,i)}toJson(){const i=f(P({},super.toJson()),{environmentName:this.environmentName,array:this.array.map(r=>r.map(a=>a.map(u=>u.toJson()))),rowGaps:this.rowGaps,columns:this.colFormat,colSeparationType:this.colSeparationType});return this.arraystretch!==void 0&&(i.arraystretch=this.arraystretch),this.arraycolsep!==void 0&&(i.arraycolsep=this.arraycolsep),this.leftDelim&&(i.leftDelim=this.leftDelim),this.rightDelim&&(i.rightDelim=this.rightDelim),i}branch(i){var r;if(Eu(i))return(r=this.array[i[0]][i[1]])!=null?r:void 0}createBranch(i){var r;return Eu(i)?(this.isDirty=!0,(r=this.branch(i))!=null?r:[]):[]}get rowCount(){return this.array.length}get colCount(){return this.array[0].length}get maxColumns(){return this.colFormat.filter(i=>!!i.align).length}removeBranch(i){if(lo(i))return super.removeBranch(i);const r=this.branch(i);return this.array[i[0]][i[1]]=void 0,r.forEach(a=>{a.parent=void 0,a.parentBranch=void 0}),console.assert(r[0].type==="first"),r.shift(),this.isDirty=!0,r}get hasChildren(){return this.children.length>0}get children(){const i=[];for(const r of this.array)for(const a of r)if(a)for(const u of a)i.push(...u.children),i.push(u);return[...i,...super.children]}render(i){var r,a,u,p,m,b;const w=new fn({parent:i,mathstyle:this.mathstyleName},this.style),E=w.getRegisterAsEm("arrayrulewidth"),I=w.getRegisterAsEm("arraycolsep"),N=w.getRegisterAsEm("doublerulesep"),J=(a=(r=this.arraystretch)!=null?r:w.getRegisterAsNumber("arraystretch"))!=null?a:1;let oe=typeof this.arraycolsep=="number"?this.arraycolsep:I;this.colSeparationType==="small"&&(oe=.2778*(new fn({parent:i,mathstyle:"scriptstyle"}).scalingFactor/i.scalingFactor));const ge=J*qh,He=.7*ge,Ft=.3*ge;let Ve=0;const St=[];let Kt=0;const Lt=this.array.length;for(let Hn=0;Hn<Lt;++Hn){const Er=this.array[Hn];Kt=Math.max(Kt,Er.length);const Hr=new fn({parent:w,mathstyle:this.mathstyleName},this.style);let Ga=He/Hr.scalingFactor,Ha=Ft/Hr.scalingFactor;const Wa={cells:[],height:0,depth:0,pos:0};for(const xa of Er){const P0=(u=ut.createBox(Hr,xa,{type:"ignore"}))!=null?u:new $t(null,{type:"ignore"});Ha=Math.max(Ha,P0.depth),Ga=Math.max(Ga,P0.height),Wa.cells.push(P0)}let ja=(p=nf(this.rowGaps[Hn]))!=null?p:0;ja>0&&(ja+=Ft,Ha=Math.max(Ha,ja),ja=0),Hn<Lt-1&&!Bc(this.environmentName)&&this.environmentName!=="cases"&&this.environmentName!=="array"&&(Ha+=w.getRegisterAsEm("jot")),Wa.height=Ga,Wa.depth=Ha,Ve+=Ga,Wa.pos=Ve,Ve+=Ha+ja,St.push(Wa)}const ai=Ve/2+ps,yi=[];for(let Hn=0;Hn<Kt;Hn++){const Er=[];for(const Hr of St){const Ga=Hr.cells[Hn];Ga.depth=Hr.depth,Ga.height=Hr.height,Er.push({box:Ga,shift:Hr.pos-ai})}Er.length>0&&yi.push(new wr({individualShift:Er}))}const fi=[];let pn=!1,Bn=!1,Ht=0,qs=!this.leftDelim;const{colFormat:Va}=this;for(const Hn of Va){if("align"in Hn&&Ht>=yi.length)break;if("align"in Hn)pn?fi.push(po(2*oe)):(Bn||qs)&&fi.push(po(oe)),fi.push(new $t(yi[Ht],{classes:"col-align-"+Hn.align})),Ht++,pn=!0,Bn=!1,qs=!1;else if("gap"in Hn){if(typeof Hn.gap=="number")fi.push(po(Hn.gap));else{const Er=Pd(i,St,ai,Hn.gap);Er&&fi.push(Er)}pn=!1,Bn=!1,qs=!1}else if("separator"in Hn){const Er=new $t(null,{classes:"vertical-separator"});Er.height=Ve,Er.setStyle("height",Ve,"em"),Er.setStyle("border-right",`${E}em ${Hn.separator} currentColor`),Er.setStyle("vertical-align",-(Ve-ai),"em");let Hr=0;Bn?Hr=N-E:pn&&(Hr=oe-E),Er.left=Hr,fi.push(Er),pn=!1,Bn=!0,qs=!1}}pn&&!this.rightDelim&&fi.push(po(oe));const aa=new $t(fi,{classes:"mtable"});if((!this.leftDelim||this.leftDelim===".")&&(!this.rightDelim||this.rightDelim==="."))return this.caret&&(aa.caret=this.caret),this.bind(i,aa);const Gr=aa.height,Zs=aa.depth,Cs=this.bind(i,new $t([this.bind(i,ks("open",(m=this.leftDelim)!=null?m:".",Gr,Zs,w,{isSelected:this.isSelected})),aa,this.bind(i,ks("close",(b=this.rightDelim)!=null?b:".",Gr,Zs,w,{isSelected:this.isSelected}))],{type:"ord"}));return Cs?(Cs.setStyle("display","inline-block"),this.caret&&(Cs.caret=this.caret),this.bind(i,this.attachSupsub(i,{base:Cs}))):null}_serialize(i){var r;const a=[];if(this.environmentName==="lines"?a.push("{\\displaylines"):a.push(`\\begin{${this.environmentName}}`),this.environmentName==="array"){if(a.push("{"),this.colFormat!==void 0)for(const u of this.colFormat)"align"in u&&typeof u.align=="string"?a.push(u.align):"separator"in u&&u.separator==="solid"?a.push("|"):"separator"in u&&u.separator==="dashed"&&a.push(":");a.push("}")}for(let u=0;u<this.array.length;u++){for(let p=0;p<this.array[u].length;p++)p>0&&a.push(" & "),a.push(ut.serialize(this.array[u][p],i));if(u<this.array.length-1){const p=this.rowGaps[u];p!=null&&p.dimension?a.push(`\\\\[${p.dimension} ${(r=p.unit)!=null?r:"pt"}] `):a.push("\\\\ ")}}return this.environmentName==="lines"?a.push("}"):a.push(`\\end{${this.environmentName}}`),on(a)}getCell(i,r){return this.array[i][r]}setCell(i,r,a){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.array[i][r]!==void 0);for(const p of this.array[i][r])p.parent=void 0,p.parentBranch=void 0;let u=a;(a.length===0||a[0].type!=="first")&&(u=[new ut({type:"first",mode:this.mode}),...a]),this.array[i][r]=u;for(const p of u)p.parent=this,p.parentBranch=[i,r];this.isDirty=!0}addRowBefore(i){console.assert(this.type==="array"&&Array.isArray(this.array));const r=[];for(let a=0;a<this.colCount;a++)r.push(Rl(this));this.array.splice(i,0,r);for(let a=i;a<this.rowCount;a++)for(let u=0;u<this.colCount;u++){const p=this.array[a][u];if(p)for(const m of p)m.parentBranch=[a,u]}this.isDirty=!0}addRowAfter(i){console.assert(this.type==="array"&&Array.isArray(this.array));const r=[];for(let a=0;a<this.colCount;a++)r.push(Rl(this));this.array.splice(i+1,0,r);for(let a=i+1;a<this.rowCount;a++)for(let u=0;u<this.colCount;u++){const p=this.array[a][u];if(p)for(const m of p)m.parentBranch=[a,u]}this.isDirty=!0}removeRow(i){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.rowCount>i);const r=this.array.splice(i,1);for(const a of r)for(const u of a)if(u)for(const p of u)p.parent=void 0,p.parentBranch=void 0;for(let a=i;a<this.rowCount;a++)for(let u=0;u<this.colCount;u++){const p=this.array[a][u];if(p)for(const m of p)m.parentBranch=[a,u]}this.isDirty=!0}addColumnBefore(i){console.assert(this.type==="array"&&Array.isArray(this.array));for(const r of this.array)r.splice(i,0,Rl(this));for(let r=0;r<this.rowCount;r++)for(let a=i;a<this.colCount;a++){const u=this.array[r][a];if(u)for(const p of u)p.parentBranch=[r,a]}this.isDirty=!0}addColumnAfter(i){console.assert(this.type==="array"&&Array.isArray(this.array));for(const r of this.array)r.splice(i+1,0,Rl(this));for(let r=0;r<this.rowCount;r++)for(let a=i+1;a<this.colCount;a++){const u=this.array[r][a];if(u)for(const p of u)p.parentBranch=[r,a]}this.isDirty=!0}addColumn(){this.addColumnAfter(this.colCount-1)}removeColumn(i){console.assert(this.type==="array"&&Array.isArray(this.array)&&this.colCount>i);for(const r of this.array){const a=r.splice(i,1);for(const u of a)if(u)for(const p of u)p.parent=void 0,p.parentBranch=void 0}for(let r=0;r<this.rowCount;r++)for(let a=i;a<this.colCount;a++){const u=this.array[r][a];if(u)for(const p of u)p.parentBranch=[r,a]}this.isDirty=!0}get cells(){const i=[];for(const r of this.array)for(const a of r)a&&i.push(a.filter(u=>u.type!=="first"));return i}};function Rl(e){const i=new ut({type:"first",mode:e.mode});i.parent=e;const r=new ya;return r.parent=e,[i,r]}function po(e){const i=new $t(null,{classes:"arraycolsep"});return i.width=e,i}function Pd(e,i,r,a){if(!a)return null;const u=[];for(const p of i){const m=ut.createBox(e,a,{type:"ignore"});m&&(m.depth=p.depth,m.height=p.height,u.push({box:m,shift:p.pos-r}))}return new wr({individualShift:u}).wrap(e)}var Oa=class Hp extends ut{constructor(i){super({mode:i.mode,command:i.command,style:i.style,body:i.body,type:"box"}),this.framecolor=i.framecolor,this.backgroundcolor=i.backgroundcolor,this.padding=i.padding,this.offset=i.offset,this.border=i.border}static fromJson(i){return new Hp(i)}toJson(){return f(P({},super.toJson()),{framecolor:this.framecolor,backgroundcolor:this.backgroundcolor,padding:this.padding,offset:this.offset,border:this.border})}render(i){var r,a,u,p;const m=ut.createBox(i,this.body,{type:"lift"});if(!m)return null;const b=i.toEm((r=this.offset)!=null?r:{dimension:0});m.depth+=b,m.setStyle("display","inline-block"),m.setStyle("position","relative"),m.setStyle("height",Math.floor(100*m.height+m.depth)/100,"em"),m.setStyle("vertical-align",-Math.floor(100*m.height)/100,"em");const w=new fn({parent:i},this.style),E=w.toEm((a=this.padding)!=null?a:{register:"fboxsep"}),I=new $t(null,{classes:"ML__box"});I.height=m.height+E,I.depth=m.depth+E,I.setStyle("box-sizing","border-box"),I.setStyle("position","absolute"),I.setStyle("top",-E+.3,"em"),I.setStyle("left",0),I.setStyle("height",I.height+I.depth,"em"),I.setStyle("width","100%"),this.backgroundcolor&&I.setStyle("background-color",(u=w.toColor(this.backgroundcolor))!=null?u:"transparent"),this.framecolor&&I.setStyle("border",`${w.getRegisterAsEm("fboxrule",2)}em solid ${(p=w.toColor(this.framecolor))!=null?p:"black"}`),this.border&&I.setStyle("border",this.border);const N=new $t([I,m],{type:"lift"});return N.setStyle("display","inline-block"),N.setStyle("position","relative"),N.setStyle("line-height",0),N.height=m.height+E+(b>0?b:0),N.depth=m.depth+E+(b<0?-b:0),N.setStyle("padding-left",E,"em"),N.setStyle("padding-right",E,"em"),N.setStyle("height",Math.floor(100*(m.height+m.depth+2*E+Math.abs(b)))/100,"em"),N.setStyle("margin-top",-E,"em"),N.setStyle("top",Math.floor(100*(m.depth-m.height+2*E-b))/100,"em"),N.setStyle("vertical-align",Math.floor(100*(m.depth+2*E))/100,"em"),this.caret&&(N.caret=this.caret),this.attachSupsub(i,{base:N})}_serialize(i){return i.skipStyles?on([this.bodyToLatex(i),this.supsubToLatex(i)]):super._serialize(i)}},Mu=class Wp extends ut{constructor(i,r){var a;super({type:"composition",mode:(a=r==null?void 0:r.mode)!=null?a:"math",value:i})}static fromJson(i){return new Wp(i.value,i)}toJson(){return super.toJson()}get computedStyle(){return{}}render(i){const r=new $t(this.value,{classes:"ML__composition",type:"composition"});return this.bind(i,r),this.caret&&(r.caret=this.caret),r}_serialize(i){return""}},mo=class jp extends ut{constructor(i){super({type:"error",value:i,command:i,mode:"math"}),this.verbatimLatex=i}static fromJson(i){return new jp(i.command)}toJson(){return super.toJson()}render(i){const r=this.createBox(i,{classes:"ML__error"});return this.caret&&(r.caret=this.caret),r}},$c=class qp extends ut{constructor(i,r,a){super({type:"group",mode:r,style:a}),this.body=i,this.boxType=i.length>1?"ord":"ignore",this.skipBoundary=!0,this.displayContainsHighlight=!1,i&&i.length===1&&i[0].command===","&&(this.captureSelection=!0)}static fromJson(i){return new qp(i.body,i.mode,i.style)}render(i){const r=ut.createBox(i,this.body,{type:this.boxType});return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):`{${this.bodyToLatex(i)}}`}},ur=class Zp extends ut{constructor(i,r,a){super({type:"leftright",style:a.style,displayContainsHighlight:!0}),this.variant=i,this.body=r,this.leftDelim=a.leftDelim,this.rightDelim=a.rightDelim}static fromJson(i){var r;return new Zp((r=i.variant)!=null?r:"",i.body,i)}toJson(){const i=super.toJson();return this.variant&&(i.variant=this.variant),this.leftDelim&&(i.leftDelim=this.leftDelim),this.rightDelim&&(i.rightDelim=this.rightDelim),i}_serialize(i){var r,a;const u=this.matchingRightDelim();return this.variant==="left...right"?on(["\\left",(r=this.leftDelim)!=null?r:".",this.bodyToLatex(i),"\\right",u]):this.variant==="mleft...mright"?on(["\\mleft",(a=this.leftDelim)!=null?a:".",this.bodyToLatex(i),"\\mright",u]):on([!this.leftDelim||this.leftDelim==="."?"":this.leftDelim,this.bodyToLatex(i),u])}matchingRightDelim(){var i,r;if(this.rightDelim&&this.rightDelim!=="?")return this.rightDelim;const a=(i=this.leftDelim)!=null?i:".";return(r=Zo[a])!=null?r:a}render(i){var r,a;const u=new fn({parent:i},this.style);console.assert(this.body!==void 0);const p=new fn({parent:i,mathstyle:"textstyle"},this.style),m=(r=ut.createBox(u,this.body,{type:"inner"}))!=null?r:new $t(null,{type:"inner"}),b=m.height/p.scalingFactor,w=m.depth/p.scalingFactor,E=[];if(this.leftDelim&&E.push(this.bind(p,ks("open",this.leftDelim,b,w,p,{isSelected:this.isSelected,classes:"ML__open"+(this.containsCaret?" ML__contains-caret":""),mode:this.mode,style:this.style}))),m&&(Kc(m.children,this,u,b,w),E.push(m)),this.rightDelim){let oe=this.containsCaret?" ML__contains-caret":"",ge=this.rightDelim;ge==="?"&&(u.smartFence?(ge=this.matchingRightDelim(),oe+=" ML__smart-fence__close"):ge="."),E.push(this.bind(p,ks("close",ge,b,w,p,{isSelected:this.isSelected,classes:oe+" ML__close",mode:this.mode,style:this.style})))}let I=this.variant==="mleft...mright";const N=this.leftSibling;N&&(!I&&N.isFunction&&(I=!0),!I&&N.type==="subsup"&&((a=N.leftSibling)!=null&&a.isFunction)&&(I=!0));const J=new $t(E,{type:I?"close":"inner",classes:"left-right"});return J.setStyle("margin-top",`${-m.depth}em`),J.setStyle("height",`${m.height+m.depth}em`),this.caret&&(J.caret=this.caret),this.bind(u,J.wrap(u))}};function Kc(e,i,r,a,u){if(e)for(let p=0;p<e.length;p++){const m=e[p];m.type==="middle"?(e[p]=i.bind(r,ks("inner",m.value,a,u,r,{isSelected:i.isSelected})),e[p].caret=m.caret,e[p].isSelected=m.isSelected,e[p].cssId=m.cssId,e[p].htmlData=m.htmlData,e[p].htmlStyle=m.htmlStyle,e[p].attributes=m.attributes,e[p].cssProperties=m.cssProperties):m.children&&Kc(m.children,i,r,a,u)}}var Iu=class Yp extends ut{constructor(i,r){var a;super({type:"macro",command:i,style:r.style}),this.body=r.body,r.captureSelection===void 0?r.args?this.captureSelection=!1:this.captureSelection=!0:this.captureSelection=r.captureSelection,this.macroArgs=r.args,this.expand=(a=r.expand)!=null?a:!1}static fromJson(i){return new Yp(i.command,i)}toJson(){const i=super.toJson();return this.expand&&(i.expand=!0),this.captureSelection!==void 0&&(i.captureSelection=this.captureSelection),this.macroArgs&&(i.args=this.macroArgs),i}_serialize(i){var r;return i.expandMacro&&this.expand?this.bodyToLatex(i):this.command+((r=this.macroArgs)!=null?r:"")}render(i){const r=ut.createBox(i,this.body);return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}},Ru=class Xp extends ut{constructor(){super({type:"macro-argument"})}static fromJson(i){return new Xp}toJson(){return super.toJson()}_serialize(i){return""}render(i){return null}},vf=class Jp extends ut{constructor(i,r,a=!1,u,p){var m;super({type:"prompt",mode:(m=p==null?void 0:p.mode)!=null?m:"math",style:p==null?void 0:p.style,command:"\\placeholder"}),this.body=u,this.correctness=r,this.placeholderId=i,this.locked=a,this.captureSelection=this.locked}static fromJson(i){return new Jp(i.placeholderId,i.correctness,i.locked,i.body,i)}toJson(){const i=super.toJson();return this.placeholderId&&(i.placeholderId=this.placeholderId),this.body||delete i.body,this.body&&(i.body=this.body.filter(r=>r.type!=="first").map(r=>r.toJson())),this.correctness&&(i.correctness=this.correctness),i.locked=this.locked,i}render(i){const r=new fn({parent:i}),a=r.getRegisterAsEm("fboxsep"),u=a,p=a,m=ut.createBox(i,this.body);if(!m)return null;m.height||(m.height=r.metrics.xHeight),m.setStyle("vertical-align",-m.height,"em"),this.correctness==="correct"?m.setStyle("color","var(--correct-color, var(--ML__correct-color))"):this.correctness==="incorrect"&&m.setStyle("color","var(--incorrect-color, var(--ML__incorrect-color))");const b=new $t(m,{type:"ord"});b.setStyle("display","inline-block"),b.setStyle("height",m.height+m.depth,"em"),b.setStyle("vertical-align",-p,"em");let w="ML__prompt ";this.locked?w+=" ML__lockedPromptBox ":w+=" ML__editablePromptBox ",this.correctness==="correct"?w+=" ML__correctPromptBox ":this.correctness==="incorrect"&&(w+=" ML__incorrectPromptBox "),this.containsCaret&&(w+=" ML__focusedPromptBox ");const E=new $t(null,{classes:w,attributes:{part:"prompt"}});E.height=b.height+p,E.depth=b.depth+p,E.width=b.width+2*u,E.setStyle("box-sizing","border-box"),E.setStyle("position","absolute"),E.setStyle("height",b.height+b.depth+2*p,"em"),u===0&&E.setStyle("width","100%"),u!==0&&(E.setStyle("width",`calc(100% + ${2*u}em)`),E.setStyle("top",a,"em"),E.setStyle("left",-u,"em")),(!this.body||this.body.length===1)&&(E.width=3*u,E.setStyle("width",`calc(100% + ${3*u}em)`),E.setStyle("left",-1.5*u,"em"));let I="";this.correctness==="incorrect"&&(I+='<line x1="3%" y1="97%" x2="97%" y2="3%" stroke-width="0.5" stroke="var(--incorrect-color, var(--ML__incorrect-color))" stroke-linecap="round" />'),I&&(E.svgOverlay=I);const N=new $t([E,b],{classes:"ML__prompt-atom"});return N.setStyle("position","relative"),N.setStyle("display","inline-block"),N.setStyle("line-height",0),N.height=b.height+p+.2,N.depth=b.depth+p,N.left=u,N.right=u,N.setStyle("height",b.height+p,"em"),N.setStyle("top",b.depth-b.height,"em"),N.setStyle("vertical-align",b.depth+p,"em"),N.setStyle("margin-left",.5,"em"),N.setStyle("margin-right",.5,"em"),this.caret&&(N.caret=this.caret),this.bind(r,this.attachSupsub(i,{base:N}))}_serialize(i){var r;const a=(r=this.bodyToLatex(i))!=null?r:"";if(i.skipPlaceholders)return a;let u="\\placeholder";return this.placeholderId&&(u+=`[${this.placeholderId}]`),this.correctness==="correct"?u+="[correct]":this.correctness==="incorrect"&&(u+="[incorrect]"),this.locked&&(u+="[locked]"),ir(u,a)}},Pl=class Qp extends ut{constructor(i){super({type:"subsup",style:i==null?void 0:i.style}),this.subsupPlacement="auto"}static fromJson(i){const r=new Qp(i);for(const a of Ho)i[a]&&r.setChildren(i[a],a);return r}render(i){var r;const a=new fn({parent:i,isPhantom:!0}),u=this.leftSibling,p=(r=u.render(a))!=null?r:new $t(null),m=new $t(null);return m.height=p.height,m.depth=p.depth,this.attachSupsub(i,{base:m,isCharacterBox:u.isCharacterBox(),type:"ignore"})}_serialize(i){return this.supsubToLatex(i)}};function Yo(e){return e?!/^(<$$>|<$>|<space>|<{>|<}>|#[0-9\?]|\\.+)$/.test(e):!1}var yf=class{constructor(e,i,r){this.errors=[],this.index=0,this.endCount=0;var a,u,p,m;r!=null||(r={}),this.tokens=e,this.context=i instanceof fn&&!(r!=null&&r.parseMode)&&!r.mathstyle?i:new fn({from:i,mathstyle:r.mathstyle},r.style),this.args=(a=r.args)!=null?a:void 0,this.smartFence=this.context.smartFence,this.parsingContext={parent:void 0,mathlist:[],style:(u=r.style)!=null?u:{},parseMode:(p=r.parseMode)!=null?p:"math",mathstyle:(m=r.mathstyle)!=null?m:"displaystyle",tabular:!1}}beginContext(e){var i,r,a;const u=this.parsingContext,p={parent:u,mathlist:[],style:P({},u.style),parseMode:(i=e==null?void 0:e.mode)!=null?i:u.parseMode,mathstyle:(r=e==null?void 0:e.mathstyle)!=null?r:u.mathstyle,tabular:(a=e==null?void 0:e.tabular)!=null?a:!1};this.parsingContext=p}endContext(){this.parsingContext=this.parsingContext.parent}onError(e){this.errors.push(P({before:Mr(this.tokens.slice(this.index,this.index+10)),after:Mr(this.tokens.slice(Math.max(0,this.index-10),this.index))},e))}get mathlist(){return this.parsingContext.mathlist}set mathlist(e){this.parsingContext.mathlist=e}get parseMode(){return this.parsingContext.parseMode}set parseMode(e){this.parsingContext.parseMode=e}get tabularMode(){return this.parsingContext.tabular}get style(){let e=this.parsingContext;for(;e;){if(e.style)return P({},e.style);e=e.parent}return{}}set style(e){this.parsingContext.style=e}end(){return this.endCount++,this.index>=this.tokens.length||this.endCount>1e3}next(){this.index+=1}get(){return this.endCount=0,this.index<this.tokens.length?this.tokens[this.index++]:""}peek(){return this.tokens[this.index]}match(e){return this.tokens[this.index]===e?(this.index++,!0):!1}lastSubsupAtom(){let e;return this.mathlist.length>0&&(e=this.mathlist[this.mathlist.length-1],e.type==="subsup"||e.subsupPlacement!==void 0)||(e=new Pl({style:this.style}),this.mathlist.push(e)),e}hasPattern(e){return e.test(this.tokens[this.index])}hasInfixCommand(){var e;const{index:i}=this;if(i<this.tokens.length&&this.tokens[i].startsWith("\\")){const r=Me(this.tokens[i],this.parseMode);return!r||r.definitionType==="symbol"||r.ifMode&&!r.ifMode.includes(this.parseMode)?!1:(e=r.infix)!=null?e:!1}return!1}matchColumnSeparator(){return!this.tabularMode||this.peek()!=="&"?!1:(this.index++,!0)}matchRowSeparator(){if(!this.tabularMode)return!1;const e=this.peek();return e!=="\\\\"&&e!=="\\cr"&&e!=="\\tabularnewline"?!1:(this.index++,!0)}placeholder(){var e;const i=(e=this.args)==null?void 0:e.call(this,"?");return i?Ur(i,{parseMode:this.parseMode,mathstyle:"textstyle"}):[new ya({mode:this.parseMode,style:this.style})]}skipWhitespace(){for(;this.match("<space>"););}skipUntilToken(e){let i=this.tokens[this.index];for(;i&&i!==e;)i=this.tokens[++this.index];i===e&&this.index++}skipFiller(){for(;this.match("\\relax")||this.match("<space>"););}matchKeyword(e){const i=this.index;let r=this.end(),a="";for(;!r;){const p=this.get();Yo(p)?(a+=p,r=this.end()||a.length>=e.length):r=!0}const u=e.toUpperCase()===a.toUpperCase();return u||(this.index=i),u}scanString(){let e="";for(;!this.end();){const i=this.peek();if(i==="]")return e;if(i==="<space>")e+=" ";else if(i.startsWith("\\"))this.onError({code:"unexpected-command-in-string"}),e+=i.substring(1);else if(Yo(i))e+=i;else return e;this.next()}return e}scanBalancedString(){let e="",i=this.end(),r=1;for(;!i;){const a=this.get();a==="<space>"?e+=" ":a==="<{>"?(e+="{",r+=1):a==="<}>"?(r-=1,r>0?e+="}":this.index-=1):a==="<$>"?e+="$":a==="<$$>"?e+="$$":e+=a,i=r===0||this.end()}return e}scanLiteralGroup(){var e;if(!this.match("<{>"))return"";let i="",r=1;for(;r>0&&!this.end();){const a=this.get();a==="<}>"?(r-=1,r>0&&(i+="}")):a==="<{>"?(r+=1,i+="{"):(/\\[a-zA-Z]+$/.test(i)&&/^[a-zA-Z]/.test(a)&&(i+=" "),i+=(e={"<space>":" ","<$$>":"$$","<$>":"$"}[a])!=null?e:a)}return i}scanNumber(e=!0){var i,r;let a=!1,u=this.peek();for(;u==="<space>"||u==="+"||u==="-";)this.get(),u==="-"&&(a=!a),u=this.peek();e=!!e;let p=10,m=/\d/;if(this.match("'"))p=8,m=/[0-7]/,e=!0;else if(this.match('"'))p=16,m=/[\dA-F]/,e=!0;else if(this.match("x"))p=16,m=/[\dA-Fa-f]/,e=!0;else if(this.match("`"))return u=this.get(),u?u.length===2&&u.startsWith("\\")?{number:(a?-1:1)*((i=u.codePointAt(1))!=null?i:0),base:"alpha"}:{number:(a?-1:1)*((r=u.codePointAt(0))!=null?r:0),base:"alpha"}:null;let b="";for(;this.hasPattern(m);)b+=this.get();if(!e&&(this.match(".")||this.match(",")))for(b+=".";this.hasPattern(m);)b+=this.get();const w=e?Number.parseInt(b,p):Number.parseFloat(b);return Number.isNaN(w)?null:{number:a?-w:w,base:p===16?"hexadecimal":p===8?"octal":"decimal"}}scanRegister(){var e;const i=this.index,r=this.scanNumber(!1);if(this.skipWhitespace(),this.match("\\relax"))return r;let a=!1;if(r===null)for(;;){const p=this.peek();if(p==="-")a=!a;else if(p!=="+")break;this.next(),this.skipWhitespace()}if(this.match("\\global")){this.skipWhitespace();const p=this.get();return p.startsWith("\\")?r?{register:p,global:!0,factor:(a?-1:1)*r.number}:a?{register:p,global:!0,factor:-1}:{register:p,global:!0}:(this.index=i,null)}let u=this.get();return u!=null&&u.startsWith("\\")?(u=u.substring(1),this.context.registers[u]?!a||r!==null?{register:u,factor:(a?-1:1)*((e=r==null?void 0:r.number)!=null?e:1)}:{register:u}:(this.index=i,null)):(this.index=i,null)}scanValue(){const e=this.scanRegister();if(e)return e;const i=this.index,r=this.scanGlueOrDimen();if(r&&("unit"in r||"glue"in r&&"unit"in r.glue))return r;this.index=i;const a=this.scanNumber();if(a)return a;if(this.end()||!Yo(this.peek()))return null;const u=this.scanString();return u.length>0?{string:u}:null}scanDimen(){const e=this.scanNumber(!1);if(e===null)return null;const i=e.number;this.skipWhitespace(),this.matchKeyword("true"),this.skipWhitespace();let r;return this.matchKeyword("pt")?r="pt":this.matchKeyword("mm")?r="mm":this.matchKeyword("cm")?r="cm":this.matchKeyword("ex")?r="ex":this.matchKeyword("px")?r="px":this.matchKeyword("em")?r="em":this.matchKeyword("bp")?r="bp":this.matchKeyword("dd")?r="dd":this.matchKeyword("pc")?r="pc":this.matchKeyword("in")?r="in":this.matchKeyword("mu")&&(r="mu"),r?{dimension:i,unit:r}:{dimension:i}}scanGlueOrDimen(){const e=this.scanDimen();if(e===null)return null;if(this.skipWhitespace(),this.match("\\relax"))return e;const i={glue:e};if(this.matchKeyword("plus")){const r=this.scanDimen();if(r)i.grow=r;else return i}if(this.skipWhitespace(),this.match("\\relax"))return i;if(this.skipWhitespace(),this.matchKeyword("minus")){const r=this.scanDimen();if(r)i.shrink=r;else return i}return!i.grow&&!i.shrink?e:i}scanColspec(){this.skipWhitespace();const e=[];for(;!this.end()&&!(this.peek()==="<}>"||this.peek()==="]");){const i=this.get();i==="c"||i==="r"||i==="l"?e.push({align:i}):i==="|"?e.push({separator:"solid"}):i===":"?e.push({separator:"dashed"}):i==="@"&&(this.match("<{>")&&(this.beginContext({mode:"math"}),e.push({gap:this.scan(r=>r==="<}>")}),this.endContext()),this.match("<}>")||this.onError({code:"unbalanced-braces"}))}return e}scanModeSet(){let e;if(this.match("\\(")&&(e="textstyle"),!e&&this.match("\\[")&&(e="displaystyle"),!e)return null;this.beginContext({mode:"math",mathstyle:e});const i=this.scan(r=>r===(e==="displaystyle"?"\\]":"\\)"));return this.match(e==="displaystyle"?"\\]":"\\)")||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanModeShift(){let e="";if(this.match("<$>")&&(e="<$>"),!e&&this.match("<$$>")&&(e="<$$>"),!e)return null;this.beginContext({mode:"math",mathstyle:"textstyle"});const i=this.scan(r=>r===e);return this.match(e)||this.onError({code:"unbalanced-mode-shift"}),this.endContext(),i}scanEnvironment(){if(!this.match("\\begin"))return null;const e=this.scanArgument("string");if(!e)return null;const i=ye(e);if(!i)return this.onError({code:"unknown-environment",arg:e}),null;const r=[];if(i.params)for(const b of i.params)if(b.isOptional)r.push(this.scanOptionalArgument(b.type));else{const w=this.scanArgument(b.type);w||this.onError({code:"missing-argument",arg:e}),r.push(w)}this.beginContext({tabular:i.tabular});const a=[],u=[];let p=[],m=!1;do if(this.end()&&(this.onError({code:"unbalanced-environment",arg:e}),m=!0),!m&&this.match("\\end")&&(this.scanArgument("string")!==e&&this.onError({code:"unbalanced-environment",arg:e}),m=!0),!m)if(this.matchColumnSeparator())p.push(this.mathlist),this.mathlist=[];else if(this.matchRowSeparator()){p.push(this.mathlist),this.mathlist=[];let b=null;this.skipWhitespace(),this.match("[")&&(b=this.scanDimen(),this.skipWhitespace(),this.match("]")),u.push(b!=null?b:{dimension:0}),a.push(p),p=[]}else this.mathlist.push(...this.scan(b=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline"].includes(b)));while(!m);return p.push(this.mathlist),p.length>0&&a.push(p),this.endContext(),i.createAtom(e,a,u,r)}scanExpression(){const e=this.mathlist;if(this.mathlist=[],this.parseExpression()){const i=this.mathlist;return this.mathlist=e,i}return this.mathlist=e,null}scan(e){this.beginContext(),e||(e=m=>m==="<}>");let i="",r=null,a=[],u=null;for(;!this.end()&&!e(this.peek());)this.hasInfixCommand()&&!i?(i=this.get(),r=Me(i,"math"),r&&(a=this.scanArguments(r)[1]),u=this.mathlist,this.mathlist=[]):this.parseExpression();let p;return i?(console.assert(!!r),a.unshift(this.mathlist),u&&a.unshift(u),p=[r.createAtom({command:i,args:a,style:this.style,mode:this.parseMode})]):p=this.mathlist,this.endContext(),p}scanGroup(){const e=this.index;if(!this.match("<{>"))return null;const i=this.scan(a=>a==="<}>");this.match("<}>")||this.onError({code:"unbalanced-braces"});const r=new $c(i,this.parseMode,this.style);return r.verbatimLatex=Mr(this.tokens.slice(e,this.index)),r}scanSmartFence(){if(this.skipWhitespace(),!this.match("("))return null;this.beginContext();let e=1;for(;!this.end()&&e!==0;)this.match("(")&&(e+=1),this.match(")")&&(e-=1),e!==0&&this.parseExpression();const i=new ur("",this.mathlist,{leftDelim:"(",rightDelim:e===0?")":"?"});return this.endContext(),i}scanDelim(){this.skipWhitespace();const e=this.peek();if(!e)return this.onError({code:"unexpected-end-of-string"}),null;if(!Yo(e)&&!e.startsWith("\\"))return null;this.next();const i=Me(e,"math");return i?i.definitionType==="function"&&i.ifMode&&!i.ifMode.includes(this.parseMode)?(this.onError({code:"unexpected-delimiter",arg:e}),null):i.definitionType==="symbol"&&(i.type==="mopen"||i.type==="mclose")||/^(\.|\?|\||<|>|\\vert|\\Vert|\\\||\\surd|\\uparrow|\\downarrow|\\Uparrow|\\Downarrow|\\updownarrow|\\Updownarrow|\\mid|\\mvert|\\mVert)$/.test(e)?e:(this.onError({code:"unexpected-delimiter",arg:e}),null):(this.onError({code:"unknown-command",arg:e}),null)}scanLeftRight(){var e;if(this.match("\\right"))return this.onError({code:"unbalanced-braces"}),new mo("\\right");if(this.match("\\mright"))return this.onError({code:"unbalanced-braces"}),new mo("\\mright");let i="\\right";if(!this.match("\\left")){if(!this.match("\\mleft"))return null;i="\\mright"}const r=this.scanDelim();if(!r)return this.onError({code:"unexpected-delimiter"}),new mo(i==="\\right"?"\\left":"\\mleft");for(this.beginContext();!this.end()&&!this.match(i);)this.parseExpression();const a=this.mathlist;this.endContext();const u=(e=this.scanDelim())!=null?e:".";return new ur(i==="\\right"?"left...right":"mleft...mright",a,{leftDelim:r,rightDelim:u,style:this.style})}parseSupSub(){if(this.parseMode!=="math")return!1;let e=this.peek();if(e!=="^"&&e!=="_"&&e!=="'")return!1;const i=this.lastSubsupAtom();for(;e==="^"||e==="_"||e==="'";)this.match("'")?this.match("'")?i.addChild(new ut({type:"mord",command:"\\doubleprime",mode:"math",value:"\u2032\u2032"}),"superscript"):i.addChild(new ut({type:"mord",command:"\\prime",mode:"math",value:"\u2032"}),"superscript"):(this.match("^")||this.match("_"))&&i.addChildren(Ie(this.scanArgument("expression")),e==="_"?"subscript":"superscript"),e=this.peek();return!0}parseLimits(){if(this.parseMode!=="math")return!1;const e=this.match("\\limits"),i=!e&&this.match("\\nolimits"),r=!i&&!e&&this.match("\\displaylimits");if(!e&&!i&&!r)return!1;const a=this.mathlist.length>0?this.mathlist[this.mathlist.length-1]:null;return a===null?!1:(a.explicitSubsupPlacement=!0,e&&(a.subsupPlacement="over-under"),i&&(a.subsupPlacement="adjacent"),r&&(a.subsupPlacement="auto"),!0)}scanArguments(e){if(!(e!=null&&e.params))return[void 0,[]];let i;const r=[];let a=e.infix?2:0;for(;a<e.params.length;){const u=e.params[a];u.type==="rest"?r.push(this.scan(p=>["<}>","&","\\end","\\cr","\\\\","\\tabularnewline","\\right"].includes(p))):u.isOptional?r.push(this.scanOptionalArgument(u.type)):u.type.endsWith("*")?i=u.type.slice(0,-1):r.push(this.scanArgument(u.type)),a+=1}return[i,r]}scanSymbolOrLiteral(){const e=this.peek();if(!e)return null;this.next();let i;if(Yo(e)){const r=Ss.createAtom(this.parseMode,e,P({},this.style));return r?[r]:null}if(i=this.scanMacro(e),i)return[i];if(e.startsWith("\\")){const r=Me(e,this.parseMode);if(!r)return this.onError({code:"unknown-command",arg:e}),[new mo(e)];if(r.definitionType==="symbol"){const a=P({},this.style);r.variant&&(a.variant=r.variant),i=new ut({type:r.type,command:e,style:a,value:String.fromCodePoint(r.codepoint),mode:this.parseMode,verbatimLatex:e})}else{if(r.applyMode||r.applyStyle||r.infix)return this.onError({code:"invalid-command",arg:e}),[new mo(e)];r.createAtom&&(i=r.createAtom({command:e,args:[],style:this.style,mode:this.parseMode}))}}return i?[i]:null}scanArgument(e){var i;this.skipFiller();const r=this.parseMode;if(e==="auto"&&(e=r),!this.match("<{>")){if(e==="string")return this.scanString();if(e==="value")return this.scanValue();if(e==="delim")return(i=this.scanDelim())!=null?i:".";if(e==="expression")return this.scanExpression();if(e==="math"){e!==r&&this.beginContext({mode:"math"});const u=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),u}if(e==="text"){e!==r&&this.beginContext({mode:"text"});const u=this.scanSymbolOrLiteral();return e!==r&&this.endContext(),u}return e==="balanced-string"||console.assert(!1),null}if(e==="text"){this.beginContext({mode:"text"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const u=this.mathlist;return this.endContext(),{group:u}}if(e==="math"){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const u=this.mathlist;return this.endContext(),{group:u}}let a=null;if(e==="expression"){this.beginContext({mode:"math"});do this.mathlist.push(...this.scan());while(!this.match("<}>")&&!this.end());const u=this.mathlist;return this.endContext(),{group:u}}return e==="string"?a=this.scanString():e==="balanced-string"?a=this.scanBalancedString():e==="colspec"?a=this.scanColspec():e==="value"&&(a=this.scanValue()),this.skipUntilToken("<}>"),a}scanOptionalArgument(e){if(e=e==="auto"?this.parseMode:e,this.skipFiller(),!this.match("["))return null;let i=null;for(;!this.end()&&!this.match("]");)if(e==="string")i=this.scanString();else if(e==="value")i=this.scanValue();else if(e==="colspec")i=this.scanColspec();else if(e==="bbox"){const r={},a=this.scanString().toLowerCase().trim().split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const u of a){const p=u.match(/^\s*([\d.]+)\s*([a-z]{2})/);if(p)r.padding={dimension:parseInt(p[1]),unit:p[2]};else{const m=u.match(/^\s*border\s*:\s*(.*)/);m?r.border=m[1]:r.backgroundcolor={string:u}}}i=r}else e==="math"&&(this.beginContext({mode:"math"}),i=this.mathlist.concat(this.scan(r=>r==="]")),this.endContext());return i}scanSymbolOrCommand(e){var i,r,a;if(e==="\\placeholder"){const b=this.scanOptionalArgument("string"),w=this.scanOptionalArgument("math"),E=ut.serialize(w,{defaultMode:"math"});let I=[],N;!N&&E==="correct"?N="correct":!N&&E==="incorrect"?N="incorrect":E!==""&&(I=w);const J=this.scanOptionalArgument("string")==="locked",oe=this.scanArgument("auto");let ge;return oe&&Array.isArray(oe)&&oe.length>0?ge=oe:oe&&typeof oe=="object"&&"group"in oe?ge=oe.group:ge=I,b?[new vf(b,N,J,ge!=null?ge:I,{mode:this.parseMode,style:this.style})]:[new ya({mode:this.parseMode,style:this.style})]}if(e==="\\renewcommand"||e==="\\newcommand"||e==="\\providecommand"||e==="\\def"){const b=this.index,w=this.scanLiteralGroup()||this.next();if(!w)return null;if(this.context.registers[w.substring(1)]){const E=this.scanArgument("string");E!==null&&(this.context.registers[w.substring(1)]=E);const I=on([e,Mr(this.tokens.slice(b,this.index))]);return[new ut({type:"text",value:"",verbatimLatex:I})]}}let u=this.scanMacro(e);if(u)return[u];const p=Me(e,this.parseMode);if(!p)return this.parseMode==="text"?(/[a-zA-Z]/.test((i=this.peek())!=null?i:"")&&(e+=" "),[...e].map(b=>new ut({type:"text",value:b,mode:"text",style:this.style}))):(this.onError({code:"unknown-command",arg:e}),[new mo(e)]);const m=this.index;if(p.definitionType==="symbol"){const b=P({},this.style);p.variant&&(b.variant=p.variant),u=new ut({type:p.type,command:e,style:b,value:String.fromCodePoint(p.codepoint),mode:this.parseMode})}else{if(p.ifMode&&!p.ifMode.includes(this.parseMode))return[];const b=this.parseMode;p.applyMode&&(this.parseMode=p.applyMode);let w,E=[];if(p.parse?E=p.parse(this):[w,E]=this.scanArguments(p),this.parseMode=b,p.applyMode&&!p.applyStyle&&!p.createAtom)return Ie(E[0]);if(p.infix)return this.onError({code:"too-many-infix-commands",arg:e}),null;if(typeof p.createAtom=="function")u=p.createAtom({command:e,args:E,style:this.style,mode:this.parseMode}),w&&(u.body=Ie(this.scanArgument(w)));else if(typeof p.applyStyle=="function"){const I=P(P({},this.style),p.applyStyle(e,E,this.context)),N=this.parseMode;if(p.applyMode&&(this.parseMode=p.applyMode),w){const J=this.style;this.style=I;const oe=this.scanArgument(w);return this.style=J,this.parseMode=N,Ie(oe)}this.style=I}else u=new ut({type:"mord",command:(r=p.command)!=null?r:e,style:P({},this.style),value:e,mode:(a=p.applyMode)!=null?a:this.parseMode})}if(!u)return null;if(u instanceof ut&&u.verbatimLatex===void 0&&!/^\\(llap|rlap|class|cssId|htmlData)$/.test(e)){const b=on([e,Mr(this.tokens.slice(m,this.index))]);b&&(u.verbatimLatex=b)}if(u.verbatimLatex===null&&(u.verbatimLatex=void 0),u.isFunction&&this.smartFence){const b=this.scanSmartFence();if(b)return[u,b]}return[u]}scanSymbolCommandOrLiteral(){const e=this.get();if(!e)return null;if(Yo(e)){const i=Ss.createAtom(this.parseMode,e,P({},this.style));if(!i)return null;if(i.isFunction&&this.smartFence){const r=this.scanSmartFence();if(r)return[i,r]}return[i]}return e.startsWith("\\")?this.scanSymbolOrCommand(e):e==="<space>"?this.parseMode==="text"?[new Pa(" "," ",this.style)]:null:(e==="<}>"?this.onError({latex:"",code:"unbalanced-braces"}):this.onError({latex:"",code:"unexpected-token",arg:e}),null)}scanMacro(e){var i;const r=this.context.getMacro(e);if(!r)return null;const a=this.index,u=r.args,p={"?":(i=this.args)==null?void 0:i.call(this,"?")};for(let m=1;m<=u;m++){let b=this.scanLiteralGroup();if(!b){const w=this.index;this.scanExpression(),b=Mr(this.tokens.slice(w,this.index))}p[m]=b}return new Iu(e,{expand:r.expand,captureSelection:r.captureSelection,args:a===this.index?null:Mr(this.tokens.slice(a,this.index)),style:this.parsingContext.style,body:Ur(r.def,{context:this.context,parseMode:this.parseMode,args:m=>p[m],mathstyle:this.parsingContext.mathstyle,style:this.parsingContext.style})})}parseExpression(){var e,i,r,a;let u=(a=(r=(i=(e=this.scanEnvironment())!=null?e:this.scanModeShift())!=null?i:this.scanModeSet())!=null?r:this.scanGroup())!=null?a:this.scanLeftRight();if(u===null){if(this.parseSupSub()||this.parseLimits())return!0;u=this.scanSymbolCommandOrLiteral()}return u?(Array.isArray(u)?this.mathlist.push(...u):this.mathlist.push(u),!0):!1}};function Ur(e,i){var r,a,u,p;const m=(r=i==null?void 0:i.args)!=null?r:void 0,b=new yf(zo(e,m),i==null?void 0:i.context,{args:m,mathstyle:(a=i==null?void 0:i.mathstyle)!=null?a:"displaystyle",parseMode:(u=i==null?void 0:i.parseMode)!=null?u:"math",style:(p=i==null?void 0:i.style)!=null?p:{}}),w=[];for(;!b.end();)w.push(...b.scan(()=>!1));return w}function bf(e,i){var r;const a=new yf(zo(e,null),i==null?void 0:i.context,{mathstyle:"displaystyle",parseMode:(r=i==null?void 0:i.parseMode)!=null?r:"math"});for(;!a.end();)a.scan();return a.errors}var Pu=class em extends ut{constructor(i,r){super({type:"chem"},{command:i,mode:"math"});const a=Xn.go(It.go(r,i==="\\pu"?"pu":"ce"),!1);this.body=Ur(a),this._verbatimLatex=i+"{"+r+"}",this.arg=r,this.captureSelection=!0}static fromJson(i){return new em(i.command,i.arg)}set verbatimLatex(i){}get verbatimLatex(){return this._verbatimLatex}toJson(){return f(P({},super.toJson()),{arg:this.arg})}render(i){const r=ut.createBox(i,this.body,{type:"inner"});return this.caret&&(r.caret=this.caret),this.bind(i,r)}_serialize(i){return console.assert(this.verbatimLatex!==void 0),this.verbatimLatex}};Se(["ce","pu"],"{chemformula:balanced-string}",{createAtom:e=>{var i;return new Pu(e.command,(i=e.args[0])!=null?i:"")}});var It={go:function(e,i){if(!e)return[];i===void 0&&(i="ce");var r="0",a={};a.parenthesisLevel=0,e=e.replace(/\n/g," "),e=e.replace(/[\u2212\u2013\u2014\u2010]/g,"-"),e=e.replace(/[\u2026]/g,"...");for(var u,p=10,m=[];;){u!==e?(p=10,u=e):p--;var b=It.stateMachines[i],w=b.transitions[r]||b.transitions["*"];e:for(var E=0;E<w.length;E++){var I=It.patterns.match_(w[E].pattern,e);if(I){for(var N=w[E].task,J=0;J<N.action_.length;J++){var oe;if(b.actions[N.action_[J].type_])oe=b.actions[N.action_[J].type_](a,I.match_,N.action_[J].option);else if(It.actions[N.action_[J].type_])oe=It.actions[N.action_[J].type_](a,I.match_,N.action_[J].option);else throw["MhchemBugA","mhchem bug A. Please report. ("+N.action_[J].type_+")"];It.concatArray(m,oe)}if(r=N.nextState||r,e.length>0){if(N.revisit||(e=I.remainder),!N.toContinue)break e}else return m}}if(p<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(e,i){if(i)if(Object.prototype.toString.call(i)==="[object Array]")for(var r=0;r<i.length;r++)e.push(i[r]);else e.push(i)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var i=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return i&&i[0]?{match_:i.slice(1),remainder:e.substr(i[0].length)}:null},"(-)(9)^(-9)":function(e){var i=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return i&&i[0]?{match_:i.slice(1),remainder:e.substr(i[0].length)}:null},"state of aggregation $":function(e){var i=It.patterns.findObserveGroups(e,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(i&&i.remainder.match(/^($|[\s,;\)\]\}])/))return i;var r=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return r?{match_:r[0],remainder:e.substr(r[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return It.patterns.findObserveGroups(e,"^{","","","}")},"^($...$)":function(e){return It.patterns.findObserveGroups(e,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return It.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(e){return It.patterns.findObserveGroups(e,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return It.patterns.findObserveGroups(e,"_{","","","}")},"_($...$)":function(e){return It.patterns.findObserveGroups(e,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return It.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(e){return It.patterns.findObserveGroups(e,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return It.patterns.findObserveGroups(e,"","{","}","")},"{(...)}":function(e){return It.patterns.findObserveGroups(e,"{","","","}")},"$...$":function(e){return It.patterns.findObserveGroups(e,"","$","$","")},"${(...)}$":function(e){return It.patterns.findObserveGroups(e,"${","","","}$")},"$(...)$":function(e){return It.patterns.findObserveGroups(e,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return It.patterns.findObserveGroups(e,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return It.patterns.findObserveGroups(e,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return It.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(e){return It.patterns.findObserveGroups(e,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return It.patterns.findObserveGroups(e,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(e){return It.patterns.findObserveGroups(e,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(e){return It.patterns.findObserveGroups(e,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(e){return It.patterns.findObserveGroups(e,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}0":function(e){return It.patterns.findObserveGroups(e,"\\color{","","","}")},"\\color{(...)}{(...)}1":function(e){return It.patterns.findObserveGroups(e,"\\color{","","","}","{","","","}")},"\\color(...){(...)}2":function(e){return It.patterns.findObserveGroups(e,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(e){return It.patterns.findObserveGroups(e,"\\ce{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){var i;if(i=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/),i)return{match_:i[0],remainder:e.substr(i[0].length)};var r=It.patterns.findObserveGroups(e,"","$","$","");return r&&(i=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),i)?{match_:i[0],remainder:e.substr(i[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var i=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return i?{match_:i[0],remainder:e.substr(i[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,i,r,a,u,p,m,b,w,E){var I=function(Ve,St){if(typeof St=="string")return Ve.indexOf(St)!==0?null:St;var Kt=Ve.match(St);return Kt?Kt[0]:null},N=function(Ve,St,Kt){for(var Lt=0;St<Ve.length;){var ai=Ve.charAt(St),yi=I(Ve.substr(St),Kt);if(yi!==null&&Lt===0)return{endMatchBegin:St,endMatchEnd:St+yi.length};if(ai==="{")Lt++;else if(ai==="}"){if(Lt===0)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];Lt--}St++}return Lt>0,null},J=I(e,i);if(J===null||(e=e.substr(J.length),J=I(e,r),J===null))return null;var oe=N(e,J.length,a||u);if(oe===null)return null;var ge=e.substring(0,a?oe.endMatchEnd:oe.endMatchBegin);if(p||m){var He=this.findObserveGroups(e.substr(oe.endMatchEnd),p,m,b,w);if(He===null)return null;var Ft=[ge,He.match_];return{match_:E?Ft.join(""):Ft,remainder:He.remainder}}else return{match_:ge,remainder:e.substr(oe.endMatchEnd)}},match_:function(e,i){var r=It.patterns.patterns[e];if(r===void 0)throw["MhchemBugP","mhchem bug P. Please report. ("+e+")"];if(typeof r=="function")return It.patterns.patterns[e](i);var a=i.match(r);if(a){var u;return a[2]?u=[a[1],a[2]]:a[1]?u=a[1]:u=a[0],{match_:u,remainder:i.substr(a[0].length)}}return null}},actions:{"a=":function(e,i){e.a=(e.a||"")+i},"b=":function(e,i){e.b=(e.b||"")+i},"p=":function(e,i){e.p=(e.p||"")+i},"o=":function(e,i){e.o=(e.o||"")+i},"q=":function(e,i){e.q=(e.q||"")+i},"d=":function(e,i){e.d=(e.d||"")+i},"rm=":function(e,i){e.rm=(e.rm||"")+i},"text=":function(e,i){e.text_=(e.text_||"")+i},insert:function(e,i,r){return{type_:r}},"insert+p1":function(e,i,r){return{type_:r,p1:i}},"insert+p1+p2":function(e,i,r){return{type_:r,p1:i[0],p2:i[1]}},copy:function(e,i){return i},rm:function(e,i){return{type_:"rm",p1:i||""}},text:function(e,i){return It.go(i,"text")},"{text}":function(e,i){var r=["{"];return It.concatArray(r,It.go(i,"text")),r.push("}"),r},"tex-math":function(e,i){return It.go(i,"tex-math")},"tex-math tight":function(e,i){return It.go(i,"tex-math tight")},bond:function(e,i,r){return{type_:"bond",kind_:r||i}},"color0-output":function(e,i){return{type_:"color0",color:i[0]}},ce:function(e,i){return It.go(i)},"1/2":function(e,i){var r=[];i.match(/^[+\-]/)&&(r.push(i.substr(0,1)),i=i.substr(1));var a=i.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return a[1]=a[1].replace(/\$/g,""),r.push({type_:"frac",p1:a[1],p2:a[2]}),a[3]&&(a[3]=a[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:a[3]})),r},"9,9":function(e,i){return It.go(i,"9,9")}},createTransitions:function(e){var i,r,a,u,p={};for(i in e)for(r in e[i])for(a=r.split("|"),e[i][r].stateArray=a,u=0;u<a.length;u++)p[a[u]]=[];for(i in e)for(r in e[i])for(a=e[i][r].stateArray||[],u=0;u<a.length;u++){var m=e[i][r];if(m.action_){m.action_=[].concat(m.action_);for(var b=0;b<m.action_.length;b++)typeof m.action_[b]=="string"&&(m.action_[b]={type_:m.action_[b]})}else m.action_=[];for(var w=i.split("|"),E=0;E<w.length;E++)if(a[u]==="*")for(var I in p)p[I].push({pattern:w[E],task:m});else p[a[u]].push({pattern:w[E],task:m})}return p},stateMachines:{}};It.stateMachines={ce:{transitions:It.createTransitions({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{}},space:{a:{nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". |* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}0":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(e,i){var r;if((e.d||"").match(/^[0-9]+$/)){var a=e.d;e.d=void 0,r=this.output(e),e.b=a}else r=this.output(e);return It.actions["o="](e,i),r},"d= kv":function(e,i){e.d=i,e.dType="kv"},"charge or bond":function(e,i){if(e.beginsWithBond){var r=[];return It.concatArray(r,this.output(e)),It.concatArray(r,It.actions.bond(e,i,"-")),r}else e.d=i},"- after o/d":function(e,i,r){var a=It.patterns.match_("orbital",e.o||""),u=It.patterns.match_("one lowercase greek letter $",e.o||""),p=It.patterns.match_("one lowercase latin letter $",e.o||""),m=It.patterns.match_("$one lowercase latin letter$ $",e.o||""),b=i==="-"&&(a&&a.remainder===""||u||p||m);b&&!e.a&&!e.b&&!e.p&&!e.d&&!e.q&&!a&&p&&(e.o="$"+e.o+"$");var w=[];return b?(It.concatArray(w,this.output(e)),w.push({type_:"hyphen"})):(a=It.patterns.match_("digits",e.d||""),r&&a&&a.remainder===""?(It.concatArray(w,It.actions["d="](e,i)),It.concatArray(w,this.output(e))):(It.concatArray(w,this.output(e)),It.concatArray(w,It.actions.bond(e,i,"-")))),w},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,i){return{type_:"state of aggregation",p1:It.go(i,"o")}},comma:function(e,i){var r=i.replace(/\s*$/,""),a=r!==i;return a&&e.parenthesisLevel===0?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(e,i,r){var a;if(!e.r)a=[],!e.a&&!e.b&&!e.p&&!e.o&&!e.q&&!e.d&&!r||(e.sb&&a.push({type_:"entitySkip"}),!e.o&&!e.q&&!e.d&&!e.b&&!e.p&&r!==2?(e.o=e.a,e.a=void 0):!e.o&&!e.q&&!e.d&&(e.b||e.p)?(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):e.o&&e.dType==="kv"&&It.patterns.match_("d-oxidation$",e.d||"")?e.dType="oxidation":e.o&&e.dType==="kv"&&!e.q&&(e.dType=void 0),a.push({type_:"chemfive",a:It.go(e.a,"a"),b:It.go(e.b,"bd"),p:It.go(e.p,"pq"),o:It.go(e.o,"o"),q:It.go(e.q,"pq"),d:It.go(e.d,e.dType==="oxidation"?"oxidation":"bd"),dType:e.dType}));else{var u;e.rdt==="M"?u=It.go(e.rd,"tex-math"):e.rdt==="T"?u=[{type_:"text",p1:e.rd||""}]:u=It.go(e.rd);var p;e.rqt==="M"?p=It.go(e.rq,"tex-math"):e.rqt==="T"?p=[{type_:"text",p1:e.rq||""}]:p=It.go(e.rq),a={type_:"arrow",r:e.r,rd:u,rq:p}}for(var m in e)m!=="parenthesisLevel"&&m!=="beginsWithBond"&&delete e[m];return a},"oxidation-output":function(e,i){var r=["{"];return It.concatArray(r,It.go(i,"oxidation")),r.push("}"),r},"frac-output":function(e,i){return{type_:"frac-ce",p1:It.go(i[0]),p2:It.go(i[1])}},"overset-output":function(e,i){return{type_:"overset",p1:It.go(i[0]),p2:It.go(i[1])}},"underset-output":function(e,i){return{type_:"underset",p1:It.go(i[0]),p2:It.go(i[1])}},"underbrace-output":function(e,i){return{type_:"underbrace",p1:It.go(i[0]),p2:It.go(i[1])}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:It.go(i[1])}},"r=":function(e,i){e.r=i},"rdt=":function(e,i){e.rdt=i},"rd=":function(e,i){e.rd=i},"rqt=":function(e,i){e.rqt=i},"rq=":function(e,i){e.rq=i},operator:function(e,i,r){return{type_:"operator",kind_:r||i}}}},a:{transitions:It.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},"$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:It.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"{text}"}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:It.createTransitions({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(e){if(e.text_){var i={type_:"text",p1:e.text_};for(var r in e)delete e[r];return i}}}},pq:{transitions:It.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{nextState:"!f",revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(e,i){return{type_:"state of aggregation subscript",p1:It.go(i,"o")}},"color-output":function(e,i){return{type_:"color",color1:i[0],color2:It.go(i[1],"pq")}}}},bd:{transitions:It.createTransitions({empty:{"*":{}},x$:{0:{nextState:"!f",revisit:!0}},formula$:{0:{nextState:"f",revisit:!0}},else:{0:{nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:"color-output"}},"\\color{(...)}0":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(e,i){return{type_:"color",color1:i[0],color2:It.go(i[1],"bd")}}}},oxidation:{transitions:It.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$|$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(e,i){return{type_:"roman numeral",p1:i||""}}}},"tex-math":{transitions:It.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(e){if(e.o){var i={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return i}}}},"tex-math tight":{transitions:It.createTransitions({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(e,i){e.o=(e.o||"")+"{"+i+"}"},output:function(e){if(e.o){var i={type_:"tex-math",p1:e.o};for(var r in e)delete e[r];return i}}}},"9,9":{transitions:It.createTransitions({empty:{"*":{}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:It.createTransitions({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(e,i){var r=[];return i[0]==="+-"||i[0]==="+/-"?r.push("\\pm "):i[0]&&r.push(i[0]),i[1]&&(It.concatArray(r,It.go(i[1],"pu-9,9")),i[2]&&(i[2].match(/[,.]/)?It.concatArray(r,It.go(i[2],"pu-9,9")):r.push(i[2])),(i[3]||i[4])&&(i[3]==="e"||i[4]==="*"?r.push({type_:"cdot"}):r.push({type_:"times"}))),i[5]&&r.push("10^{"+i[5]+"}"),r},"number^":function(e,i){var r=[];return i[0]==="+-"||i[0]==="+/-"?r.push("\\pm "):i[0]&&r.push(i[0]),It.concatArray(r,It.go(i[1],"pu-9,9")),r.push("^{"+i[2]+"}"),r},operator:function(e,i,r){return{type_:"operator",kind_:r||i}},space:function(){return{type_:"pu-space-1"}},output:function(e){var i,r=It.patterns.match_("{(...)}",e.d||"");r&&r.remainder===""&&(e.d=r.match_);var a=It.patterns.match_("{(...)}",e.q||"");if(a&&a.remainder===""&&(e.q=a.match_),e.d&&(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.d=e.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var u={d:It.go(e.d,"pu"),q:It.go(e.q,"pu")};e.o==="//"?i={type_:"pu-frac",p1:u.d,p2:u.q}:(i=u.d,u.d.length>1||u.q.length>1?i.push({type_:" / "}):i.push({type_:"/"}),It.concatArray(i,u.q))}else i=It.go(e.d,"pu-2");for(var p in e)delete e[p];return i}}},"pu-2":{transitions:It.createTransitions({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(e,i){e.rm+="^{"+i+"}"},space:function(){return{type_:"pu-space-2"}},output:function(e){var i=[];if(e.rm){var r=It.patterns.match_("{(...)}",e.rm||"");r&&r.remainder===""?i=It.go(r.match_,"pu"):i={type_:"rm",p1:e.rm}}for(var a in e)delete e[a];return i}}},"pu-9,9":{transitions:It.createTransitions({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(e){var i=[];if(e.text_=e.text_||"",e.text_.length>4){var r=e.text_.length%3;r===0&&(r=3);for(var a=e.text_.length-3;a>0;a-=3)i.push(e.text_.substr(a,3)),i.push({type_:"1000 separator"});i.push(e.text_.substr(0,r)),i.reverse()}else i.push(e.text_);for(var u in e)delete e[u];return i},"output-o":function(e){var i=[];if(e.text_=e.text_||"",e.text_.length>4){for(var r=e.text_.length-3,a=0;a<r;a+=3)i.push(e.text_.substr(a,3)),i.push({type_:"1000 separator"});i.push(e.text_.substr(a))}else i.push(e.text_);for(var u in e)delete e[u];return i}}}};var Xn={go:function(e,i){if(!e)return"";for(var r="",a=!1,u=0;u<e.length;u++){var p=e[u];typeof p=="string"?r+=p:(r+=Xn._go2(p),p.type_==="1st-level escape"&&(a=!0))}return!i&&!a&&r&&(r="{"+r+"}"),r},_goInner:function(e){return e&&Xn.go(e,!0)},_go2:function(e){var i;switch(e.type_){case"chemfive":i="";var r={a:Xn._goInner(e.a),b:Xn._goInner(e.b),p:Xn._goInner(e.p),o:Xn._goInner(e.o),q:Xn._goInner(e.q),d:Xn._goInner(e.d)};r.a&&(r.a.match(/^[+\-]/)&&(r.a="{"+r.a+"}"),i+=r.a+"\\,"),(r.b||r.p)&&(i+="{\\vphantom{X}}",i+="^{\\hphantom{"+(r.b||"")+"}}_{\\hphantom{"+(r.p||"")+"}}",i+="{\\vphantom{X}}",i+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(r.b||"")+"}}",i+="_{\\vphantom{2}\\llap{\\smash[t]{"+(r.p||"")+"}}}"),r.o&&(r.o.match(/^[+\-]/)&&(r.o="{"+r.o+"}"),i+=r.o),e.dType==="kv"?((r.d||r.q)&&(i+="{\\vphantom{X}}"),r.d&&(i+="^{"+r.d+"}"),r.q&&(i+="_{\\smash[t]{"+r.q+"}}")):e.dType==="oxidation"?(r.d&&(i+="{\\vphantom{X}}",i+="^{"+r.d+"}"),r.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+r.q+"}}")):(r.q&&(i+="{\\vphantom{X}}",i+="_{\\smash[t]{"+r.q+"}}"),r.d&&(i+="{\\vphantom{X}}",i+="^{"+r.d+"}"));break;case"rm":i="\\mathrm{"+e.p1+"}";break;case"text":e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(" ","~").replace("-","\\text{-}"),i="\\mathrm{"+e.p1+"}"):i="\\text{"+e.p1+"}";break;case"roman numeral":i="\\mathrm{"+e.p1+"}";break;case"state of aggregation":i="\\mskip2mu "+Xn._goInner(e.p1);break;case"state of aggregation subscript":i="\\mskip1mu "+Xn._goInner(e.p1);break;case"bond":if(i=Xn._getBond(e.kind_),!i)throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+e.kind_+")"];break;case"frac":var a="\\frac{"+e.p1+"}{"+e.p2+"}";i="\\mathchoice{\\textstyle"+a+"}{"+a+"}{"+a+"}{"+a+"}";break;case"pu-frac":var u="\\frac{"+Xn._goInner(e.p1)+"}{"+Xn._goInner(e.p2)+"}";i="\\mathchoice{\\textstyle"+u+"}{"+u+"}{"+u+"}{"+u+"}";break;case"tex-math":i=e.p1+" ";break;case"frac-ce":i="\\frac{"+Xn._goInner(e.p1)+"}{"+Xn._goInner(e.p2)+"}";break;case"overset":i="\\overset{"+Xn._goInner(e.p1)+"}{"+Xn._goInner(e.p2)+"}";break;case"underset":i="\\underset{"+Xn._goInner(e.p1)+"}{"+Xn._goInner(e.p2)+"}";break;case"underbrace":i="\\underbrace{"+Xn._goInner(e.p1)+"}_{"+Xn._goInner(e.p2)+"}";break;case"color":i="{\\color{"+e.color1+"}{"+Xn._goInner(e.color2)+"}}";break;case"color0":i="\\color{"+e.color+"}";break;case"arrow":var p={rd:Xn._goInner(e.rd),rq:Xn._goInner(e.rq)},m=Xn._getArrow(e.r);p.rd||p.rq?e.r==="<=>"||e.r==="<=>>"||e.r==="<<=>"||e.r==="<-->"?(m="\\long"+m,p.rd&&(m="\\overset{"+p.rd+"}{"+m+"}"),p.rq&&(e.r==="<-->"?m="\\underset{\\lower2mu{"+p.rq+"}}{"+m+"}":m="\\underset{\\lower6mu{"+p.rq+"}}{"+m+"}"),m=" {}\\mathrel{"+m+"}{} "):(p.rq&&(m+="[{"+p.rq+"}]"),m+="{"+p.rd+"}",m=" {}\\mathrel{\\x"+m+"}{} "):m=" {}\\mathrel{\\long"+m+"}{} ",i=m;break;case"operator":i=Xn._getOperator(e.kind_);break;case"1st-level escape":i=e.p1+" ";break;case"space":i=" ";break;case"entitySkip":i="~";break;case"pu-space-1":i="~";break;case"pu-space-2":i="\\mkern3mu ";break;case"1000 separator":i="\\mkern2mu ";break;case"commaDecimal":i="{,}";break;case"comma enumeration L":i="{"+e.p1+"}\\mkern6mu ";break;case"comma enumeration M":i="{"+e.p1+"}\\mkern3mu ";break;case"comma enumeration S":i="{"+e.p1+"}\\mkern1mu ";break;case"hyphen":i="\\text{-}";break;case"addition compound":i="\\,{\\cdot}\\,";break;case"electron dot":i="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":i="{\\times}";break;case"prime":i="\\prime ";break;case"cdot":i="\\cdot ";break;case"tight cdot":i="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":i="\\times ";break;case"circa":i="{\\sim}";break;case"^":i="uparrow";break;case"v":i="downarrow";break;case"ellipsis":i="\\ldots ";break;case"/":i="/";break;case" / ":i="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return i},_getArrow:function(e){switch(e){case"->":return"rightarrow";case"\u2192":return"rightarrow";case"\u27F6":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<-->":return"leftrightarrows";case"<=>":return"rightleftharpoons";case"\u21CC":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(e){switch(e){case"-":return"{-}";case"1":return"{-}";case"=":return"{=}";case"2":return"{=}";case"#":return"{\\equiv}";case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(e){switch(e){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":return" {}\\approx{} ";case"$\\approx$":return" {}\\approx{} ";case"v":return" \\downarrow{} ";case"(v)":return" \\downarrow{} ";case"^":return" \\uparrow{} ";case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}};function xf(e){}function Od(e){}var Uc=class tm extends ut{constructor(i){super(f(P({},i),{type:"delim"})),this.value=i.delim,this.size=i.size}static fromJson(i){return new tm(i)}toJson(){return f(P({},super.toJson()),{delim:this.value,size:this.size})}render(i){return new $t(this.value,{type:"middle"})}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):ir(this.command,this.value)}},wf=class im extends ut{constructor(i){super(f(P({},i),{type:"sizeddelim",value:i.delim})),this.delimType=i.delimType,this.size=i.size}static fromJson(i){return new im(i)}toJson(){return f(P({},super.toJson()),{delim:this.value,size:this.size,delimType:this.delimType})}render(i){let r=Ad(this.value,this.size,i,{classes:{open:"mopen",close:"mclose"}[this.delimType],type:this.delimType,isSelected:this.isSelected});return r?(r=this.bind(i,r),this.caret&&(r.caret=this.caret),r):null}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);return r!=null&&r.serialize?r.serialize(this,i):ir(this.command,this.value)}},Xo=class nm extends ut{constructor(i,r,a,u){var p,m;super({type:"enclose",command:i,style:u.style}),this.body=r,this.backgroundcolor=u.backgroundcolor,a.updiagonalarrow&&(a.updiagonalstrike=!1),a.box&&(a.left=!1,a.right=!1,a.bottom=!1,a.top=!1),this.notation=a,this.shadow=(p=u.shadow)!=null?p:"none",this.strokeWidth=(m=u.strokeWidth)!=null?m:"0.06em",this.strokeWidth||(this.strokeWidth="0.06em"),this.strokeStyle=u.strokeStyle,this.svgStrokeStyle=u.svgStrokeStyle,this.strokeColor=u.strokeColor,this.borderStyle=u.borderStyle,this.padding=u.padding,this.captureSelection=!1}static fromJson(i){return new nm(i.command,i.body,i.notation,i)}toJson(){return f(P({},super.toJson()),{notation:this.notation,shadow:this.shadow,strokeWidth:this.strokeWidth,strokeStyle:this.strokeStyle,svgStrokeStyle:this.svgStrokeStyle,strokeColor:this.strokeColor,borderStyle:this.borderStyle,padding:this.padding})}_serialize(i){var r;if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const a=Me(this.command,this.mode);if(a!=null&&a.serialize)return a.serialize(this,i);let u=(r=this.command)!=null?r:"";if(this.command==="\\enclose"){u+="{"+Object.keys(this.notation).join(" ")+"}";let p="",m="";this.backgroundcolor&&this.backgroundcolor!=="transparent"&&(p+=m+'mathbackground="'+this.backgroundcolor+'"',m=","),this.shadow&&this.shadow!=="auto"&&(p+=m+'shadow="'+this.shadow+'"',m=","),this.strokeWidth||this.strokeStyle!=="solid"?(p+=m+this.borderStyle,m=","):this.strokeColor&&this.strokeColor!=="currentColor"&&(p+=m+'mathcolor="'+this.strokeColor+'"',m=","),p&&(u+=`[${p}]`)}return ir(u,this.bodyToLatex(i))}render(i){const r=new fn({parent:i},this.style),a=ut.createBox(r,this.body);if(!a)return null;const u=zc(this.borderStyle),p=r.toEm(!this.padding||this.padding==="auto"?{register:"fboxsep"}:{string:this.padding});a.setStyle("position","relative"),a.setStyle("display","inline-block"),a.setStyle("top",p,"em"),a.setStyle("height",a.height+a.depth,"em"),a.setStyle("width",a.width,"em");const m=new $t(null,{classes:"ML__notation"});let b=a.height+a.depth+2*p;const w=a.width+2*p;let E="";if(this.notation.horizontalstrike&&(E+=this.line(3,50,97,50)),this.notation.verticalstrike&&(E+=this.line(50,3,50,97)),this.notation.updiagonalstrike&&(E+=this.line(3,97,97,3)),this.notation.downdiagonalstrike&&(E+=this.line(3,3,97,97)),this.notation.updiagonalarrow){E+=this.line(p.toString(),(p+a.depth+a.height).toString(),(p+a.width).toString(),p.toString());const ge=.03*Math.sqrt(w*w+b*b)*1,He=a.width*ge,Ft=(a.depth+a.height)*ge,Ve=p+a.width;let St=p;St+Ft-.4*He<0&&(St=.4*He-Ft),E+='<polygon points="',E+=`${Ve},${St} ${Ve-He-.4*Ft},${St+Ft-.4*He} `,E+=`${Ve-.7*He},${St+.7*Ft} ${Ve-He+.4*Ft},${St+Ft+.4*He} `,E+=`${Ve},${St}`,E+=`" stroke='none' fill="${this.strokeColor}"`,E+="/>"}let I=0;if(this.notation.phasorangle){const J=Vc(r),oe=(a.height+a.depth+2*J+p).toString(),ge=(a.height+a.depth)/2;E+=this.line(p.toString(),oe,(p+ge+a.width).toString(),oe),E+=this.line(p.toString(),oe,(p+ge).toString(),(p-J).toString()),b+=J,I=ge,a.left+=b/2-p}if(this.notation.longdiv){const J=Vc(r);b+=J,E+=this.line(p.toString(),p.toString(),(p+a.width).toString(),p.toString());const oe=.3;I=oe+J,a.left+=oe+J,a.setTop(p+J),E+='<path d="',E+=`M ${p} ${p} a${oe} ${(a.depth+a.height+2*J)/2}, 0, 1, 1, 0 ${a.depth+a.height+2*J} "`,E+=` stroke-width="${Sf(r)}" stroke="${this.strokeColor}" fill="none"`,E+="/>"}if(m.width=a.width+2*p+I,m.height=a.height+p,m.depth=a.depth+p,m.setStyle("box-sizing","border-box"),m.setStyle("left",`calc(-${u} / 2 )`),m.setStyle("height",`${Math.floor(100*b)/100}em`),m.setStyle("top",`calc(${u} / 2 )`),this.backgroundcolor&&m.setStyle("background-color",this.backgroundcolor),this.notation.box&&m.setStyle("border","1px solid red"),this.notation.actuarial&&(m.setStyle("border-top",this.borderStyle),m.setStyle("border-right",this.borderStyle)),this.notation.madruwb&&(m.setStyle("border-bottom",this.borderStyle),m.setStyle("border-right",this.borderStyle)),this.notation.roundedbox&&(m.setStyle("border-radius","8px"),m.setStyle("border",this.borderStyle)),this.notation.circle&&(m.setStyle("border-radius","50%"),m.setStyle("border",this.borderStyle)),this.notation.top&&m.setStyle("border-top",this.borderStyle),this.notation.left&&m.setStyle("border-left",this.borderStyle),this.notation.right&&m.setStyle("border-right",this.borderStyle),this.notation.bottom&&m.setStyle("border-bottom",this.borderStyle),E){let J="";this.shadow==="auto"&&(J+="filter: drop-shadow(0 0 .5px rgba(255, 255, 255, .7)) drop-shadow(1px 1px 2px #333)"),this.shadow!=="none"&&(J+=`filter: drop-shadow(${this.shadow})`),J+=` stroke-width="${this.strokeWidth}" stroke="${this.strokeColor}"`,J+=' stroke-linecap="round"',this.svgStrokeStyle&&(J+=` stroke-dasharray="${this.svgStrokeStyle}"`),m.svgStyle=J,m.svgOverlay=E}const N=new $t([m,a]);return N.setStyle("position","relative"),N.setStyle("vertical-align",p,"em"),N.setStyle("height",`${Math.floor(100*(a.height+a.depth+2*p))/100}em`),N.setStyle("display","inline-block"),N.height=m.height,N.depth=m.depth,N.width=m.width-2*p,N.left=p,N.right=p,this.caret&&(N.caret=this.caret),N.wrap(r)}line(i,r,a,u){return`<line x1="${Ou(i)}" y1="${Ou(r)}" x2="${Ou(a)}" y2="${Ou(u)}" vector-effect="non-scaling-stroke"></line>`}};function Ou(e){return typeof e=="number"?`${Math.floor(100*e)/100}%`:e}function zc(e){if(!e)return"1px";const i=e.match(/([0-9][a-zA-Z\%]+)/);return i===null?"1px":i[1]}function Sf(e){return(Math.floor(100*e.metrics.sqrtRuleThickness/e.scalingFactor)/100/10).toString()+"em"}function Vc(e){const i=e.isDisplayStyle?Ca:e.metrics.defaultRuleThickness;return e.metrics.defaultRuleThickness+e.scalingFactor*i/4}var Jo=class rm extends ut{constructor(i,r,a){var u,p;super(f(P({},a),{type:"genfrac",displayContainsHighlight:!0})),this.above=i,this.below=r,this.hasBarLine=(u=a==null?void 0:a.hasBarLine)!=null?u:!0,this.continuousFraction=(p=a==null?void 0:a.continuousFraction)!=null?p:!1,this.numerPrefix=a==null?void 0:a.numerPrefix,this.denomPrefix=a==null?void 0:a.denomPrefix,this.mathstyleName=a==null?void 0:a.mathstyleName,this.leftDelim=a==null?void 0:a.leftDelim,this.rightDelim=a==null?void 0:a.rightDelim,this.fractionNavigationOrder=a==null?void 0:a.fractionNavigationOrder}static fromJson(i){return new rm(i.above,i.below,i)}toJson(){const i={};return this.continuousFraction&&(i.continuousFraction=!0),this.numerPrefix&&(i.numerPrefix=this.numerPrefix),this.denomPrefix&&(i.denomPrefix=this.denomPrefix),this.leftDelim&&(i.leftDelim=this.leftDelim),this.rightDelim&&(i.rightDelim=this.rightDelim),this.hasBarLine||(i.hasBarLine=!1),this.mathstyleName&&(i.mathstyleName=this.mathstyleName),this.fractionNavigationOrder&&(i.fractionNavigationOrder=this.fractionNavigationOrder),P(P({},super.toJson()),i)}get children(){if(this._children)return this._children;const i=[];if(this.fractionNavigationOrder==="denominator-numerator"){for(const r of this.below)i.push(...r.children),i.push(r);for(const r of this.above)i.push(...r.children),i.push(r)}else{for(const r of this.above)i.push(...r.children),i.push(r);for(const r of this.below)i.push(...r.children),i.push(r)}return this._children=i,i}render(i){var r,a;const u=new fn({parent:i,mathstyle:this.mathstyleName},this.style),p=u.metrics,m=new fn({parent:u,mathstyle:this.continuousFraction?"":"numerator"},this.style),b=this.numerPrefix?new $t([new $t(this.numerPrefix),ut.createBox(m,this.above)],{isTight:m.isTight,type:"ignore"}):(r=ut.createBox(m,this.above,{type:"ignore"}))!=null?r:new $t(null,{type:"ignore"}),w=new fn({parent:u,mathstyle:this.continuousFraction?"":"denominator"},this.style),E=this.denomPrefix?new $t([new $t(this.denomPrefix),ut.createBox(w,this.below,{type:"ignore"})]):(a=ut.createBox(w,this.below,{type:"ignore"}))!=null?a:new $t(null,{type:"ignore"}),I=this.hasBarLine?p.defaultRuleThickness:0;let N,J=0,oe;u.isDisplayStyle?(N=m.metrics.num1,J=I>0?3*I:7*I,oe=w.metrics.denom1):(I>0?(N=m.metrics.num2,J=I):(N=m.metrics.num3,J=3*p.defaultRuleThickness),oe=w.metrics.denom2);const ge=[];this.isSelected&&ge.push("ML__selected");const He=b.depth,Ft=E.height;let Ve;if(I<=0){const fi=N-He-(Ft-oe);fi<J&&(N+=(J-fi)/2,oe+=(J-fi)/2),Ve=new wr({individualShift:[{box:b,shift:-N,classes:[...ge,"ML__center"]},{box:E,shift:oe,classes:[...ge,"ML__center"]}]}).wrap(u)}else{const fi=new $t(null,{classes:"ML__frac-line",mode:this.mode,style:this.style});fi.softWidth=Math.max(b.width,E.width),fi.height=I/2,fi.depth=I/2;const pn=ps+I/2;N<J+He+pn&&(N=J+He+pn);const Bn=ps-I/2;oe<J+Ft-Bn&&(oe=J+Ft-Bn),Ve=new wr({individualShift:[{box:E,shift:oe,classes:[...ge,"ML__center"]},{box:fi,shift:-Bn,classes:ge},{box:b,shift:-N,classes:[...ge,"ML__center"]}]}).wrap(u)}const St=u.isDisplayStyle?p.delim1:p.delim2,Kt=this.leftDelim?this.bind(i,ms("open",this.leftDelim,St,!0,i,{style:this.style,mode:this.mode,isSelected:this.isSelected})):ho(u,"open");let Lt=null;this.continuousFraction?Lt=new $t(null,{type:"close"}):this.rightDelim?Lt=this.bind(i,ms("close",this.rightDelim,St,!0,i,{style:this.style,mode:this.mode,isSelected:this.isSelected})):Lt=ho(u,"close");const ai=new $t([Kt,Ve,Lt],{isTight:u.isTight,type:"inner",classes:"mfrac"}),yi=this.bind(i,ai);return this.caret&&(yi.caret=this.caret),this.attachSupsub(i,{base:yi})}},Tr=class sm extends ut{constructor(i,r){var a;super({type:"latex",value:i,mode:"latex"}),this.isSuggestion=(a=r==null?void 0:r.isSuggestion)!=null?a:!1,this.isError=!1}static fromJson(i){const r=new sm(i.value);return i.isSuggestion&&(r.isSuggestion=!0),i.isError&&(r.isError=!0),r}toJson(){const i={};return this.isSuggestion&&(i.isSuggestion=!0),this.isError&&(i.isError=!0),P({type:"latex",value:this.value},i)}get computedStyle(){return{}}render(i){const r=new $t(this.value,{classes:this.isSuggestion?"ML__suggestion":this.isError?"ML__error":"",type:"latex",maxFontSize:1});return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}},Qo=class am extends ut{constructor(i){super({type:"latexgroup",mode:"latex"}),this.body=[...i].map(r=>new Tr(r)),this.skipBoundary=!1}static fromJson(i){return new am("")}toJson(){return super.toJson()}render(i){const r=ut.createBox(i,this.body);return r?(this.caret&&(r.caret=this.caret),this.bind(i,r)):null}_serialize(i){var r,a;return(a=(r=this.body)==null?void 0:r.map(u=>u.value).join(""))!=null?a:""}},Ol=class om extends ut{constructor(i,r){super(f(P({},r),{type:"extensible-symbol",isFunction:r==null?void 0:r.isFunction})),this.value=i,this.variant=r==null?void 0:r.variant,this.subsupPlacement=r==null?void 0:r.limits}static fromJson(i){return new om(i.symbol,i)}toJson(){const i=super.toJson();return this.variant&&(i.variant=this.variant),this.subsupPlacement&&(i.limits=this.subsupPlacement),this.isExtensibleSymbol&&(i.isExtensibleSymbol=!0),this.value&&(i.symbol=this.value),i}render(i){var r;const a=i.isDisplayStyle&&this.value!=="\\smallint",u=new $t(this.value,{fontFamily:a?"Size2-Regular":"Size1-Regular",classes:"op-symbol "+(a?"large-op":"small-op"),type:"op",maxFontSize:i.scalingFactor,isSelected:this.isSelected});if(!u)return null;u.right=u.italic;const p=(u.height-u.depth)/2-ps*i.scalingFactor,m=u.italic;u.setTop(p);let b=u;if(this.superscript||this.subscript){const w=(r=this.subsupPlacement)!=null?r:"auto";b=w==="over-under"||w==="auto"&&i.isDisplayStyle?this.attachLimits(i,{base:u,baseShift:p,slant:m}):this.attachSupsub(i,{base:u})}return new $t(this.bind(i,b),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(i)}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=[];return a.push(this.command),this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&a.push("\\limits"),this.subsupPlacement==="adjacent"&&a.push("\\nolimits"),this.subsupPlacement==="auto"&&a.push("\\displaylimits")),a.push(this.supsubToLatex(i)),on(a)}},go=class lm extends ut{constructor(i){const r=i.body;super(f(P({},i),{type:"overlap",body:typeof r=="string"?[new ut({value:r})]:r,style:i==null?void 0:i.style})),this.skipBoundary=!0,this.align=i==null?void 0:i.align,this.boxType=i==null?void 0:i.boxType}static fromJson(i){return new lm(i)}toJson(){const i={};return this.align&&(i.align=this.align),this.boxType&&(i.boxType=this.boxType),P(P({},super.toJson()),i)}render(i){const r=ut.createBox(i,this.body,{classes:"inner"});return r?(this.caret&&(r.caret=this.caret),this.bind(i,new $t([r,new $t(null,{classes:"fix"})],{classes:this.align==="right"?"rlap":"llap",type:this.boxType}))):null}},Ns=class um extends ut{constructor(i){var r,a,u,p;super({type:"overunder",command:i.command,style:i.style,mode:i.mode,body:i.body,skipBoundary:(r=i.skipBoundary)!=null?r:!0}),this.subsupPlacement=i.supsubPlacement,this.svgAbove=i.svgAbove,this.svgBelow=i.svgBelow,this.svgBody=i.svgBody,this.above=i.above,this.below=i.below,this.boxType=(a=i.boxType)!=null?a:"ord",this.paddedBody=(u=i.paddedBody)!=null?u:!1,this.paddedLabels=(p=i.paddedLabels)!=null?p:!1}static fromJson(i){return new um(i)}toJson(){const i=super.toJson();return this.skipBoundary||(i.skipBoundary=!1),this.subsupPlacement&&(i.subsupPlacement=this.subsupPlacement),this.svgAbove&&(i.svgAbove=this.svgAbove),this.svgBelow&&(i.svgBelow=this.svgBelow),this.svgBody&&(i.svgBody=this.svgBody),this.boxType!=="ord"&&(i.boxType=this.boxType),this.paddedBody&&(i.paddedBody=!0),this.paddedLabels&&(i.paddedLabels=!0),i}render(i){let r=this.svgBody?xu(this.svgBody):ut.createBox(i,this.body,{type:"ignore"});const a=new fn({parent:i,mathstyle:"scriptstyle"},this.style);let u=null;this.svgAbove?u=xu(this.svgAbove):this.above&&(u=ut.createBox(a,this.above,{type:"ignore"}));let p=null;this.svgBelow?p=xu(this.svgBelow):this.below&&(p=ut.createBox(a,this.below,{type:"ignore"})),this.paddedBody&&(r=new $t([ho(i,"open"),r,ho(i,"close")],{type:"ignore"}));let m=Fu(i,{base:r,above:u,below:p,type:this.boxType==="bin"||this.boxType==="rel"?this.boxType:"ord",paddedAboveBelow:this.paddedLabels});return m?(this.subsupPlacement==="over-under"?m=this.attachLimits(i,{base:m,type:m.type}):m=this.attachSupsub(i,{base:m}),this.caret&&(m.caret=this.caret),this.bind(i,m)):null}};function Fu(e,i){if(!i.base)return null;if(!i.above&&!i.below){const b=new $t(i.base,{type:i.type});return b.setStyle("position","relative"),b}let r=0;i.above&&(r=e.metrics.bigOpSpacing5);let a=null;const u=i.base,p=0,m=["ML__center"];if(i.paddedAboveBelow&&m.push("ML__label_padding"),i.below&&i.above){const b=e.metrics.bigOpSpacing5+i.below.height+i.below.depth+u.depth+p;a=new wr({bottom:b,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:m},{box:u,classes:["ML__center"]},r,{box:i.above,classes:m},e.metrics.bigOpSpacing5]})}else i.below?a=new wr({top:u.height-p,children:[e.metrics.bigOpSpacing5,{box:i.below,classes:m},{box:u,classes:["ML__center"]}]}):i.above&&(a=new wr({bottom:u.depth+p,children:[{box:u,classes:["ML__center"]},r,{box:i.above,classes:m},e.metrics.bigOpSpacing5]}));return new $t(a,{type:i.type})}var Fl=class cm extends ut{constructor(i){var r,a,u,p;super(f(P({},i),{type:"phantom"})),this.captureSelection=!0,this.isInvisible=(r=i.isInvisible)!=null?r:!1,this.smashDepth=(a=i.smashDepth)!=null?a:!1,this.smashHeight=(u=i.smashHeight)!=null?u:!1,this.smashWidth=(p=i.smashWidth)!=null?p:!1}static fromJson(i){return new cm(i)}toJson(){const i={};return this.isInvisible&&(i.isInvisible=!0),this.smashDepth&&(i.smashDepth=!0),this.smashHeight&&(i.smashHeight=!0),this.smashWidth&&(i.smashWidth=!0),P(P({},super.toJson()),i)}render(i){const r=new fn({parent:i,isPhantom:!0});if(!this.smashDepth&&!this.smashHeight&&!this.smashWidth)return console.assert(this.isInvisible),ut.createBox(r,this.body,{classes:"inner"});const a=ut.createBox(this.isInvisible?r:i,this.body);if(!a)return null;if(this.smashWidth){const u=new $t(null,{classes:"fix"});return new $t([a,u],{classes:"rlap"}).wrap(i)}if(!this.smashHeight&&!this.smashDepth)return a;if(this.smashHeight&&(a.height=0),this.smashDepth&&(a.depth=0),a.children)for(const u of a.children)this.smashHeight&&(u.height=0),this.smashDepth&&(u.depth=0);return new wr({firstBaseline:[{box:a}]},{type:a.type}).wrap(i)}},el=class hm extends ut{constructor(i){var r;super(P({type:"spacing"},i)),this.width=i==null?void 0:i.width,this._braced=(r=i==null?void 0:i.braced)!=null?r:!1}static fromJson(i){return new hm(i)}toJson(){const i=super.toJson();return this.width!==void 0&&(i.width=this.width),this._braced&&(i.braced=!0),i}render(i){var r;if(this.command==="space")return new $t(this.mode==="math"?null:" ");let a;if(this.width!==void 0)a=new $t(null,{classes:"mspace"}),a.left=i.toEm(this.width);else{const u=(r={"\\qquad":"qquad","\\quad":"quad","\\enspace":"enspace","\\;":"thickspace","\\:":"mediumspace","\\>":"mediumspace","\\,":"thinspace","\\!":"negativethinspace"}[this.command])!=null?r:"mediumspace";a=new $t(null,{classes:u})}return a=this.bind(i,a),this.caret&&(a.caret=this.caret),a}_serialize(i){var r;if(!i.expandMacro&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const a=Me(this.command,this.mode);if(a!=null&&a.serialize)return a.serialize(this,i);const u=(r=this.command)!=null?r:"";return this.width===void 0?u:this._braced&&!("register"in this.width)?`${u}{${Yn(this.width)}}`:`${u}${Yn(this.width)}`}},Gc=class fm extends ut{constructor(i){var r;super(f(P({},i),{type:"surd",mode:(r=i.mode)!=null?r:"math",style:i.style,displayContainsHighlight:!0,body:i.body})),this.above=i.index}static fromJson(i){return new fm(f(P({},i),{index:i.above}))}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=this.command,u=this.bodyToLatex(i);return this.above&&!this.hasEmptyBranch("above")?ir(`${a}[${this.aboveToLatex(i)}]`,u):/^[0-9]$/.test(u)?`${a}${u}`:ir(a,u)}get children(){if(this._children)return this._children;const i=[];if(this.above)for(const r of this.above)i.push(...r.children),i.push(r);if(this.body)for(const r of this.body)i.push(...r.children),i.push(r);return this._children=i,i}render(i){var r;const a=new fn({parent:i,mathstyle:"cramp"},this.style),u=(r=ut.createBox(a,this.body,{type:"inner"}))!=null?r:new $t(null),p=a.scalingFactor,m=a.metrics.defaultRuleThickness/p,b=i.isDisplayStyle?Ca:m,w=new $t(null,{classes:"ML__sqrt-line",style:this.style});w.height=m,w.softWidth=u.width;let E=p*(m+b/4);const N=Math.max(p*2*b,u.height+u.depth)+E+m,J=new fn({parent:i},this.style),oe=this.bind(J,new $t(ms("inner","\\surd",N,!1,J,{isSelected:this.isSelected}),{isSelected:this.isSelected,classes:"ML__sqrt-sign",style:this.style}));if(!oe)return null;const ge=oe.height+oe.depth-m;ge>u.height+u.depth+E&&(E=(E+ge-(u.height+u.depth))/2),oe.setTop(oe.height-u.height-E);const He=this.bind(i,new wr({firstBaseline:[{box:new $t(u)},E-2*m,{box:w},m]})),Ft=ut.createBox(new fn({parent:i,mathstyle:"scriptscriptstyle"}),this.above,{type:"ignore"});if(!Ft){const Kt=new $t([oe,He],{classes:this.containsCaret?"ML__contains-caret":"",type:"inner"});return Kt.setStyle("display","inline-block"),Kt.setStyle("height",Kt.height+Kt.depth,"em"),this.caret&&(Kt.caret=this.caret),this.bind(i,Kt)}const Ve=new wr({shift:-.6*(Math.max(oe.height,He.height)-Math.max(oe.depth,He.depth)),children:[{box:Ft}]}),St=new $t([new $t(Ve,{classes:"ML__sqrt-index",type:"ignore"}),oe,He],{type:"inner",classes:this.containsCaret?"ML__contains-caret":""});return St.height=oe.height,St.depth=oe.depth,this.caret&&(St.caret=this.caret),this.bind(i,St)}},Fd=class extends $t{constructor(e){super(null,{type:"skip"}),this._width=e}toMarkup(){return`<span style="display:inline-block;width:${Math.ceil(this.width*100)/100}em"></span>`}};function Bl(e,i){if(!e.parent)return;const r=e.parent.children,a=r.indexOf(e);let u=a-1;for(;u>=0&&r[u].type==="ignore";)u-=1;if(u<0&&e.parent.parent&&e.parent.type==="lift"){Bl(e.parent,i);return}a>0&&r[a-1].type==="skip"?r[a-1].width+=i:r.splice(a,0,new Fd(i))}var Bd={ord:{op:3,bin:4,rel:5,inner:3},op:{ord:3,op:3,rel:5,inner:3},bin:{ord:4,op:4,open:4,inner:4},rel:{ord:5,op:5,open:5,inner:5},close:{op:3,bin:4,rel:5,inner:3},punct:{ord:3,op:3,rel:3,open:3,punct:3,inner:3},inner:{ord:3,op:3,bin:4,rel:5,open:3,punct:3,inner:3}},Nd={ord:{op:3},op:{ord:3,op:3},close:{op:3},inner:{op:3}};function $d(e){tl(e,(i,r)=>{r.type==="bin"&&(!i||/^(middle|bin|op|rel|open|punct)$/.test(i.type))&&(r.type="ord"),(i==null?void 0:i.type)==="bin"&&/^(rel|close|punct)$/.test(r.type)&&(i.type="ord"),r.type!=="ignore"&&(i=r)})}function Nl(e,i){if(!e.children)return e;const r=e.children;$d(r);const a=i.getRegisterAsEm("thinmuskip"),u=i.getRegisterAsEm("medmuskip"),p=i.getRegisterAsEm("thickmuskip");return tl(r,(m,b)=>{var w,E,I;if(!m)return;const N=m.type,J=b.isTight?(w=Nd[N])!=null?w:null:(E=Bd[N])!=null?E:null,oe=(I=J==null?void 0:J[b.type])!=null?I:null;oe===3&&Bl(b,a),oe===4&&Bl(b,u),oe===5&&Bl(b,p)}),e}function tl(e,i,r=void 0){if(!e)return r;e=[...e];for(const a of e)a.type==="lift"?r=tl(a.children,i,r):a.type==="ignore"?tl(a.children,i):(i(r,a),tl(a.children,i),r=a);return r}var Hc=class dm extends ut{constructor(i){super({type:"tooltip",command:i.command,mode:i.mode,style:i.style,body:i.body,displayContainsHighlight:!0}),this.tooltip=new ut({type:"root",mode:i.content,body:i.tooltip,style:{}}),this.skipBoundary=!0,this.captureSelection=!1}static fromJson(i){return new dm(f(P({},i),{tooltip:Fa(i.tooltip)}))}toJson(){var i;const r=(i=this.tooltip.body)==null?void 0:i.filter(a=>a.type!=="first").map(a=>a.toJson());return f(P({},super.toJson()),{tooltip:r})}render(i){const r=ut.createBox(new fn,this.body);if(!r)return null;const a=new fn({parent:i,mathstyle:"displaystyle"},{fontSize:gc}),u=yu(Nl(new $t(this.tooltip.render(a),{classes:"ML__tooltip-content"}),a)),p=new $t([u,r],{classes:"ML__tooltip-container"});return this.caret&&(p.caret=this.caret),this.bind(i,p)}},_o=class pm extends ut{constructor(i,r){super(f(P({},r),{type:"operator",isFunction:r==null?void 0:r.isFunction})),this.value=i,this.variant=r==null?void 0:r.variant,this.variantStyle=r==null?void 0:r.variantStyle,this.subsupPlacement=r==null?void 0:r.limits}static fromJson(i){return new pm(i.symbol,i)}toJson(){const i=super.toJson();return this.variant&&(i.variant=this.variant),this.variantStyle&&(i.variantStyle=this.variantStyle),this.subsupPlacement&&(i.limits=this.subsupPlacement),this.value&&(i.symbol=this.value),i}render(i){var r;const a=new $t(this.value,{type:"op",mode:"math",maxFontSize:i.scalingFactor,style:{variant:this.variant,variantStyle:this.variantStyle},isSelected:this.isSelected,letterShapeStyle:i.letterShapeStyle});let u=a;if(this.superscript||this.subscript){const p=(r=this.subsupPlacement)!=null?r:"auto";u=p==="over-under"||p==="auto"&&i.isDisplayStyle?this.attachLimits(i,{base:a}):this.attachSupsub(i,{base:a})}return new $t(this.bind(i,u),{type:"op",caret:this.caret,isSelected:this.isSelected,classes:"op-group"}).wrap(i)}_serialize(i){if(!(i.expandMacro||i.skipStyles||i.skipPlaceholders)&&typeof this.verbatimLatex=="string")return this.verbatimLatex;const r=Me(this.command,this.mode);if(r!=null&&r.serialize)return r.serialize(this,i);const a=[this.command];return this.explicitSubsupPlacement&&(this.subsupPlacement==="over-under"&&a.push("\\limits"),this.subsupPlacement==="adjacent"&&a.push("\\nolimits"),this.subsupPlacement==="auto"&&a.push("\\displaylimits")),a.push(this.supsubToLatex(i)),on(a)}};function Fa(e){if(k(e))return e.map(a=>Fa(a));if(typeof e=="string")return ut.fromJson(e);e=P({},e);for(const a of Ho)e[a]&&(e[a]=Fa(e[a]));e.args&&(e.args=Kd(e.args)),e.array&&(e.array=Fa(e.array));const i=e.type;let r;i==="accent"&&(r=Il.fromJson(e)),i==="array"&&(r=Tn.fromJson(e)),i==="box"&&(r=Oa.fromJson(e)),i==="chem"&&(r=Pu.fromJson(e)),i==="composition"&&(r=Mu.fromJson(e)),i==="delim"&&(r=Uc.fromJson(e)),i==="enclose"&&(r=Xo.fromJson(e)),i==="error"&&(r=mo.fromJson(e)),i==="extensible-symbol"&&(r=Ol.fromJson(e)),i==="genfrac"&&(r=Jo.fromJson(e)),i==="group"&&(r=$c.fromJson(e)),i==="latex"&&(r=Tr.fromJson(e)),i==="latexgroup"&&(r=Qo.fromJson(e)),i==="leftright"&&(r=ur.fromJson(e)),i==="macro"&&(r=Iu.fromJson(e)),i==="macro-argument"&&(r=Ru.fromJson(e)),i==="operator"&&(r=_o.fromJson(e)),i==="overlap"&&(r=go.fromJson(e)),i==="overunder"&&(r=Ns.fromJson(e)),i==="placeholder"&&(r=ya.fromJson(e)),i==="prompt"&&(r=vf.fromJson(e)),i==="phantom"&&(r=Fl.fromJson(e)),i==="sizeddelim"&&(r=wf.fromJson(e)),i==="spacing"&&(r=el.fromJson(e)),i==="subsup"&&(r=Pl.fromJson(e)),i==="surd"&&(r=Gc.fromJson(e)),i==="text"&&(r=Pa.fromJson(e)),i==="tooltip"&&(r=Hc.fromJson(e)),r||(console.assert(!i||["first","mbin","mrel","mclose","minner","mop","mopen","mord","mpunct","root","space"].includes(i),`MathLive 0.98.5: an unexpected atom type "${i}" was encountered. Add new atom constructors to \`fromJson()\` in "atom.ts"`),r=ut.fromJson(e));for(const a of Ho)e[a]&&r.setChildren(e[a],a);return e.verbatimLatex!==void 0&&(r.verbatimLatex=e.verbatimLatex),e.subsupPlacement&&(r.subsupPlacement=e.subsupPlacement),e.explicitSubsupPlacement&&(r.explicitSubsupPlacement=!0),e.isFunction&&(r.isFunction=!0),e.isExtensibleSymbol&&(r.isExtensibleSymbol=!0),e.skipBoundary&&(r.skipBoundary=!0),e.captureSelection&&(r.captureSelection=!0),r}function Kd(e){if(e&&Array.isArray(e))return e.map(i=>i==="<null>"?null:typeof i=="object"&&"group"in i?{group:i.group.map(r=>Fa(r))}:typeof i=="object"&&"atoms"in i?i.atoms.map(r=>Fa(r)):i)}var Ef={main:["Main-Regular","ML__cmr"],"main-italic":["Main-Italic","ML__cmr ML__it"],"main-bold":["Main-Bold","ML__cmr ML__bold"],"main-bolditalic":["Main-BoldItalic","ML__cmr ML__bold ML__it"],normal:["Main-Regular","ML__cmr"],"normal-bold":["Main-Bold","ML__mathbf"],"normal-italic":["Math-Italic","ML__mathit"],"normal-bolditalic":["Math-BoldItalic","ML__mathbfit"],ams:["AMS-Regular","ML__ams"],"ams-bold":["AMS-Regular","ML__ams"],"ams-italic":["AMS-Regular","ML__ams"],"ams-bolditalic":["AMS-Regular","ML__ams"],"sans-serif":["SansSerif-Regular","ML__sans"],"sans-serif-bold":["SansSerif-Regular","ML__sans ML__bold"],"sans-serif-italic":["SansSerif-Regular","ML__sans"],"sans-serif-bolditalic":["SansSerif-Regular","ML__sans"],calligraphic:["Caligraphic-Regular","ML__cal"],"calligraphic-bold":["Caligraphic-Regular","ML__cal ML__bold"],"calligraphic-italic":["Caligraphic-Regular","ML__cal ML__it"],"calligraphic-bolditalic":["Caligraphic-Regular","ML__cal ML__bold ML__it"],script:["Script-Regular","ML__script"],"script-bold":["Script-Regular","ML__script ML__bold"],"script-italic":["Script-Regular","ML__script ML__it"],"script-bolditalic":["Script-Regular","ML__script ML__bold ML__it"],fraktur:["Fraktur-Regular","ML__frak"],"fraktur-bold":["Fraktur-Regular","ML__frak"],"fraktur-italic":["Fraktur-Regular","ML__frak"],"fraktur-bolditalic":["Fraktur-Regular","ML__frak"],monospace:["Typewriter-Regular","ML__tt"],"monospace-bold":["Typewriter-Regular","ML__tt ML__bold"],"monospace-italic":["Typewriter-Regular","ML__tt ML__it"],"monospace-bolditalic":["Typewriter-Regular","ML__tt ML__bold ML__it"],"double-struck":["AMS-Regular","ML__bb"],"double-struck-bold":["AMS-Regular","ML__bb"],"double-struck-italic":["AMS-Regular","ML__bb"],"double-struck-bolditalic":["AMS-Regular","ML__bb"]},Wc={"double-struck":/^[A-Z ]$/,script:/^[A-Z ]$/,calligraphic:/^[\dA-Z ]$/,fraktur:/^[\dA-Za-z ]$|^[!"#$%&'()*+,\-./:;=?[]^]$/,monospace:/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/,"sans-serif":/^[\dA-Za-z ]$|^[!"&'()*+,\-./:;=?@[\]^_~\u0131\u0237\u0393\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A8\u03A9]$/},jc=/^[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5]$/,Ud=/^[\u0393|\u0394\u0398\u039B\u039E\u03A0\u03A3\u03A5\u03A6\u03A8\u03A9]$/,zd=[/^[a-z]$/,/^[A-Z]$/,jc,Ud],Vd={iso:["it","it","it","it"],tex:["it","it","it","up"],french:["it","up","up","up"],upright:["up","up","up","up"]},Gd=class extends Ss{constructor(){super("math")}createAtom(e,i,r){var a,u,p,m;if(i===null)return new ut({type:"mord",mode:"math",command:e,value:e,style:r});const b=window.MathfieldElement.isFunction((a=i.command)!=null?a:e);if(i.definitionType==="symbol"){const E=new ut({type:(u=i.type)!=null?u:"mord",mode:"math",command:(p=i.command)!=null?p:e,value:String.fromCodePoint(i.codepoint),style:r});return b&&(E.isFunction=!0),e.startsWith("\\")&&(E.verbatimLatex=e),E}const w=new ut({type:"mord",mode:"math",command:(m=i.command)!=null?m:e,value:e,style:r});return b&&(w.isFunction=!0),e.startsWith("\\")&&(w.verbatimLatex=e),w}serialize(e,i){const r=qc(e,f(P({},i),{defaultMode:"math"}));return r.length===0||i.defaultMode!=="text"?r:["$ ",...r," $"]}getFont(e,i){console.assert(i.variant!==void 0);let{variant:r}=i,{variantStyle:a}=i;r==="normal"&&!a&&/[\u00A3\u0131\u0237]/.test(e.value)&&(r="main",a="italic"),r==="normal"&&!a&&e.value.length===1&&zd.forEach((b,w)=>{var E;b.test(e.value)&&Vd[(E=i.letterShapeStyle)!=null?E:"tex"][w]==="it"&&(a="italic")}),a==="up"&&(a=void 0);const u=a?r+"-"+a:r;console.assert(Ef[u]!==void 0);const[p,m]=Ef[u];return Wc[r]&&!Wc[r].test(e.value)?(e.value=ze(e.value,r,a),null):(jc.test(e.value)&&(e.classes+=" lcGreek"),m&&(e.classes+=" "+m),p)}};function qc(e,i){const{parent:r}=e[0],a=kf(r);return Ma(e,"variant").map(u=>{const p=kf(u[0]);let m="";p&&p!==a&&(m={calligraphic:"\\mathcal",fraktur:"\\mathfrak","double-struck":"\\mathbb",script:"\\mathscr",monospace:"\\mathtt","sans-serif":"\\mathsf",normal:"\\mathrm","normal-italic":"\\mathnormal","normal-bold":"\\mathbf","normal-bolditalic":"\\mathbfit",ams:"","ams-italic":"\\mathit","ams-bold":"\\mathbf","ams-bolditalic":"\\mathbfit",main:"","main-italic":"\\mathit","main-bold":"\\mathbf","main-bolditalic":"\\mathbfit"}[p],console.assert(m!==void 0));const b=on(u.map(w=>w._serialize(i)));return m?ir(m,b):b})}function kf(e){if(!e)return"";const{style:i}=e;if(i.variant===void 0)return"";let r=i.variant;return!["calligraphic","fraktur","double-struck","script","monospace","sans-serif"].includes(i.variant)&&i.variantStyle&&i.variantStyle!=="up"&&(r+="-"+i.variantStyle),r}new Gd;function Bu(e,i){return e.map(r=>r._serialize(i))}function Hd(e,i){return Ma(e,"fontShape").map(r=>{const a=Bu(r,i),{fontShape:u}=r[0].style;let p="";return u==="it"&&(p="\\textit"),u==="sl"&&(p="\\textsl"),u==="sc"&&(p="\\textsc"),u==="n"&&(p="\\textup"),!p&&u?`{${ir("\\fontshape",u)}${on(a)}}`:p?ir(p,on(a)):on(a)})}function Wd(e,i){return Ma(e,"fontSeries").map(r=>{const a=Hd(r,i),{fontSeries:u}=r[0].style;let p="";return u==="b"&&(p="\\textbf"),u==="l"&&(p="\\textlf"),u==="m"&&(p="\\textmd"),u&&!p?`{${ir("\\fontseries",u)}${on(a)}}`:p?ir(p,on(a)):on(a)})}function jd(e,i){return Ma(e,"fontSize").map(r=>{var a,u;const p=Wd(r,i),m=(u=["","\\tiny","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"][(a=r[0].style.fontSize)!=null?a:""])!=null?u:"";return m?`${m} ${on(p)}`:on(p)})}function qd(e,i,r){return Ma(e,"fontFamily").map(a=>{var u,p;const m=jd(a,i),b=(p={roman:"textrm",monospace:"texttt","sans-serif":"textsf"}[(u=a[0].style.fontFamily)!=null?u:""])!=null?p:"";return b?`\\${b}{${on(m)}}`:a[0].style.fontFamily?`{\\fontfamily{${a[0].style.fontFamily}} ${on(m)}}`:r?`\\text{${on(m)}}`:on(m)})}var Zc={roman:"","sans-serif":"ML__sans",monospace:"ML__tt"},Tf=class extends Ss{constructor(){super("text")}createAtom(e,i,r){return i&&i.definitionType==="symbol"?new Pa(e,String.fromCodePoint(i.codepoint),r!=null?r:{}):null}serialize(e,i){return qd(e,f(P({},i),{defaultMode:"text"}),i.defaultMode!=="text")}getFont(e,i){var r,a,u,p,m;const{fontFamily:b}=i;if(Zc[b]?e.classes+=" "+Zc[b]:b&&e.setStyle("font-family",b),i.fontShape&&(e.classes+=" ",e.classes+=(r={it:"ML__it",sl:"ML__shape_sl",sc:"ML__shape_sc",ol:"ML__shape_ol"}[i.fontShape])!=null?r:""),i.fontSeries){const w=i.fontSeries.match(/(.?[lbm])?(.?[cx])?/);w&&(e.classes+=" ",e.classes+=(u={ul:"ML__series_ul",el:"ML__series_el",l:"ML__series_l",sl:"ML__series_sl",m:"",sb:"ML__series_sb",b:"ML__bold",eb:"ML__series_eb",ub:"ML__series_ub"}[(a=w[1])!=null?a:""])!=null?u:"",e.classes+=" ",e.classes+=(m={uc:"ML__series_uc",ec:"ML__series_ec",c:"ML__series_c",sc:"ML__series_sc",n:"",sx:"ML__series_sx",x:"ML__series_x",ex:"ML__series_ex",ux:"ML__series_ux"}[(p=w[2])!=null?p:""])!=null?m:"")}return"Main-Regular"}};new Tf;var Nu=class extends Ss{constructor(){super("latex")}createAtom(e){return new Tr(e)}serialize(e,i){return e.filter(r=>r instanceof Tr&&!r.isSuggestion).map(r=>r.value)}getFont(){return null}};new Nu;var Zd={id:"dvorak",locale:"en",displayName:"Dvorak",virtualLayout:"dvorak",platform:"",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["x","X","\u2248","\u02DB"],KeyC:["j","J","\u2206","\xD4"],KeyD:["e","E","\xB4","\xB4"],KeyE:[".",">","\u2265","\u02D8"],KeyF:["u","U","\xA8","\xA8"],KeyG:["i","I","\u02C6","\u02C6"],KeyH:["d","D","\u2202","\xCE"],KeyI:["c","C","\xE7","\xC7"],KeyJ:["h","H","\u02D9","\xD3"],KeyK:["t","T","\u2020","\u02C7"],KeyL:["n","N","\u02DC","\u02DC"],KeyM:["m","M","\xB5","\xC2"],KeyN:["b","B","\u222B","\u0131"],KeyO:["r","R","\xAE","\u2030"],KeyP:["l","L","\xAC","\xD2"],KeyQ:["'",'"',"\xE6","\xC6"],KeyR:["p","P","\u03C0","\u220F"],KeyS:["o","O","\xF8","\xD8"],KeyT:["y","Y","\xA5","\xC1"],KeyU:["g","G","\xA9","\u02DD"],KeyV:["k","K","\u02DA","\uF8FF"],KeyW:[",","<","\u2264","\xAF"],KeyX:["q","Q","\u0153","\u0152"],KeyY:["f","F","\u0192","\xCF"],KeyZ:[";",":","\u2026","\xDA"],Digit1:["1","!","\xA1","\u2044"],Digit2:["2","@","\u2122","\u20AC"],Digit3:["3","#","\xA3","\u2039"],Digit4:["4","$","\xA2","\u203A"],Digit5:["5","%","\u221E","\uFB01"],Digit6:["6","^","\xA7","\uFB02"],Digit7:["7","&","\xB6","\u2021"],Digit8:["8","*","\u2022","\xB0"],Digit9:["9","(","\xAA","\xB7"],Digit0:["0",")","\xBA","\u201A"],Space:[" "," "," "," "],Minus:["[","{","\u201C","\u201D"],Equal:["]","}","\u2018","\u2019"],BracketLeft:["/","?","\xF7","\xBF"],BracketRight:["=","+","\u2260","\xB1"],Backslash:["\\","|","\xAB","\xBB"],Semicolon:["s","S","\xDF","\xCD"],Quote:["-","_","\u2013","\u2014"],Backquote:["`","~","`","`"],Comma:["w","W","\u2211","\u201E"],Period:["v","V","\u221A","\u25CA"],Slash:["z","Z","\u03A9","\xB8"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["\xA7","\xB1","\xA7","\xB1"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},$l={id:"apple.en-intl",displayName:"English (international)",virtualLayout:"qwerty",platform:"apple",locale:"en",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\u222B","\u0131"],KeyC:["c","C","\xE7","\xC7"],KeyD:["d","D","\u2202","\xCE"],KeyE:["e","E","\xB4","\xB4"],KeyF:["f","F","\u0192","\xCF"],KeyG:["g","G","\xA9","\u02DD"],KeyH:["h","H","\u02D9","\xD3"],KeyI:["i","I","\u02C6","\u02C6"],KeyJ:["j","J","\u2206","\xD4"],KeyK:["k","K","\u02DA","\uF8FF"],KeyL:["l","L","\xAC","\xD2"],KeyM:["m","M","\xB5","\xC2"],KeyN:["n","N","\u02DC","\u02DC"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\u0153","\u0152"],KeyR:["r","R","\xAE","\u2030"],KeyS:["s","S","\xDF","\xCD"],KeyT:["t","T","\u2020","\u02C7"],KeyU:["u","U","\xA8","\xA8"],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\u2211","\u201E"],KeyX:["x","X","\u2248","\u02DB"],KeyY:["y","Y","\xA5","\xC1"],KeyZ:["z","Z","\u03A9","\xB8"],Digit1:["1","!","\xA1","\u2044"],Digit2:["2","@","\u2122","\u20AC"],Digit3:["3","#","\xA3","\u2039"],Digit4:["4","$","\xA2","\u203A"],Digit5:["5","%","\u221E","\uFB01"],Digit6:["6","^","\xA7","\uFB02"],Digit7:["7","&","\xB6","\u2021"],Digit8:["8","*","\u2022","\xB0"],Digit9:["9","(","\xAA","\xB7"],Digit0:["0",")","\xBA","\u201A"],Space:[" "," "," "," "],Minus:["-","_","\u2013","\u2014"],Equal:["=","+","\u2260","\xB1"],BracketLeft:["[","{","\u201C","\u201D"],BracketRight:["]","}","\u2018","\u2019"],Backslash:["\\","|","\xAB","\xBB"],Semicolon:[";",":","\u2026","\xDA"],Quote:["'",'"',"\xE6","\xC6"],Backquote:["`","\u02DC","`","`"],Comma:[",","<","\u2264","\xAF"],Period:[".",">","\u2265","\u02D8"],Slash:["/","?","\xF7","\xBF"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[".",".",".","."],IntlBackslash:["\xA7","\xB1","\xA7","\xB1"],NumpadEqual:["=","=","=","="],AudioVolumeUp:["","=","","="]}},$u={id:"windows.en-intl",displayName:"English (international)",platform:"windows",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","\xE1","\xC1"],KeyB:["b","B","",""],KeyC:["c","C","\xA9","\xA2"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\xE9","\xC9"],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","\xED","\xCD"],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","\xF8","\xD8"],KeyM:["m","M","\xB5",""],KeyN:["n","N","\xF1","\xD1"],KeyO:["o","O","\xF3","\xD3"],KeyP:["p","P","\xF6","\xD6"],KeyQ:["q","Q","\xE4","\xC4"],KeyR:["r","R","\xAE",""],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\xFE","\xDE"],KeyU:["u","U","\xFA","\xDA"],KeyV:["v","V","",""],KeyW:["w","W","\xE5","\xC5"],KeyX:["x","X","",""],KeyY:["y","Y","\xFC","\xDC"],KeyZ:["z","Z","\xE6","\xC6"],Digit1:["1","!","\xA1","\xB9"],Digit2:["2","@","\xB2",""],Digit3:["3","#","\xB3",""],Digit4:["4","$","\xA4","\xA3"],Digit5:["5","%","\u20AC",""],Digit6:["6","^","\xBC",""],Digit7:["7","&","\xBD",""],Digit8:["8","*","\xBE",""],Digit9:["9","(","\u2018",""],Digit0:["0",")","\u2019",""],Space:[" "," ","",""],Minus:["-","_","\xA5",""],Equal:["=","+","\xD7","\xF7"],BracketLeft:["[","{","\xAB",""],BracketRight:["]","}","\xBB",""],Backslash:["\\","|","\xAC","\xA6"],Semicolon:[";",":","\xB6","\xB0"],Quote:["'",'"',"\xB4","\xA8"],Backquote:["`","~","",""],Comma:[",","<","\xE7","\xC7"],Period:[".",">","",""],Slash:["/","?","\xBF",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["\\","|","",""]}},Kl={id:"linux.en",displayName:"English",platform:"linux",virtualLayout:"qwerty",locale:"en",score:0,mapping:{KeyA:["a","A","a","A"],KeyB:["b","B","b","B"],KeyC:["c","C","c","C"],KeyD:["d","D","d","D"],KeyE:["e","E","e","E"],KeyF:["f","F","f","F"],KeyG:["g","G","g","G"],KeyH:["h","H","h","H"],KeyI:["i","I","i","I"],KeyJ:["j","J","j","J"],KeyK:["k","K","k","K"],KeyL:["l","L","l","L"],KeyM:["m","M","m","M"],KeyN:["n","N","n","N"],KeyO:["o","O","o","O"],KeyP:["p","P","p","P"],KeyQ:["q","Q","q","Q"],KeyR:["r","R","r","R"],KeyS:["s","S","s","S"],KeyT:["t","T","t","T"],KeyU:["u","U","u","U"],KeyV:["v","V","v","V"],KeyW:["w","W","w","W"],KeyX:["x","X","x","X"],KeyY:["y","Y","y","Y"],KeyZ:["z","Z","z","Z"],Digit1:["1","!","1","!"],Digit2:["2","@","2","@"],Digit3:["3","#","3","#"],Digit4:["4","$","4","$"],Digit5:["5","%","5","%"],Digit6:["6","^","6","^"],Digit7:["7","&","7","&"],Digit8:["8","*","8","*"],Digit9:["9","(","9","("],Digit0:["0",")","0",")"],Space:[" "," "," "," "],Minus:["-","_","-","_"],Equal:["=","+","=","+"],BracketLeft:["[","{","[","{"],BracketRight:["]","}","]","}"],Backslash:["\\","|","\\","|"],Semicolon:[";",":",";",":"],Quote:["'",'"',"'",'"'],Backquote:["`","~","`","~"],Comma:[",","<",",","<"],Period:[".",">",".",">"],Slash:["/","?","/","?"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}},Yd={id:"apple.french",locale:"fr",displayName:"French",platform:"apple",virtualLayout:"azerty",score:0,mapping:{KeyA:["q","Q","\u2021","\u03A9"],KeyB:["b","B","\xDF","\u222B"],KeyC:["c","C","\xA9","\xA2"],KeyD:["d","D","\u2202","\u2206"],KeyE:["e","E","\xEA","\xCA"],KeyF:["f","F","\u0192","\xB7"],KeyG:["g","G","\uFB01","\uFB02"],KeyH:["h","H","\xCC","\xCE"],KeyI:["i","I","\xEE","\xEF"],KeyJ:["j","J","\xCF","\xCD"],KeyK:["k","K","\xC8","\xCB"],KeyL:["l","L","\xAC","|"],KeyM:[",","?","\u221E","\xBF"],KeyN:["n","N","~","\u0131"],KeyO:["o","O","\u0153","\u0152"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["a","A","\xE6","\xC6"],KeyR:["r","R","\xAE","\u201A"],KeyS:["s","S","\xD2","\u2211"],KeyT:["t","T","\u2020","\u2122"],KeyU:["u","U","\xBA","\xAA"],KeyV:["v","V","\u25CA","\u221A"],KeyW:["z","Z","\xC2","\xC5"],KeyX:["x","X","\u2248","\u2044"],KeyY:["y","Y","\xDA","\u0178"],KeyZ:["w","W","\u2039","\u203A"],Digit1:["&","1","\uF8FF","\xB4"],Digit2:["\xE9","2","\xEB","\u201E"],Digit3:['"',"3","\u201C","\u201D"],Digit4:["'","4","\u2018","\u2019"],Digit5:["(","5","{","["],Digit6:["\xA7","6","\xB6","\xE5"],Digit7:["\xE8","7","\xAB","\xBB"],Digit8:["!","8","\xA1","\xDB"],Digit9:["\xE7","9","\xC7","\xC1"],Digit0:["\xE0","0","\xF8","\xD8"],Space:[" "," "," "," "],Minus:[")","\xB0","}","]"],Equal:["-","_","\u2014","\u2013"],BracketLeft:["^","\xA8","\xF4","\xD4"],BracketRight:["$","*","\u20AC","\xA5"],Backslash:["`","\xA3","@","#"],Semicolon:["m","M","\xB5","\xD3"],Quote:["\xF9","%","\xD9","\u2030"],Backquote:["<",">","\u2264","\u2265"],Comma:[";",".","\u2026","\u2022"],Period:[":","/","\xF7","\\"],Slash:["=","+","\u2260","\xB1"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",".",",","."],IntlBackslash:["@","#","\u2022","\u0178"],NumpadEqual:["=","=","=","="]}},Xd={id:"windows.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"windows",score:0,mapping:{KeyA:["q","Q","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:[",","?","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["a","A","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["z","Z","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["w","W","",""],Digit1:["&","1","",""],Digit2:["\xE9","2","~",""],Digit3:['"',"3","#",""],Digit4:["'","4","{",""],Digit5:["(","5","[",""],Digit6:["-","6","|",""],Digit7:["\xE8","7","`",""],Digit8:["_","8","\\",""],Digit9:["\xE7","9","^",""],Digit0:["\xE0","0","@",""],Space:[" "," ","",""],Minus:[")","\xB0","]",""],Equal:["=","+","}",""],BracketLeft:["^","\xA8","",""],BracketRight:["$","\xA3","\xA4",""],Backslash:["*","\xB5","",""],Semicolon:["m","M","",""],Quote:["\xF9","%","",""],Backquote:["\xB2","","",""],Comma:[";",".","",""],Period:[":","/","",""],Slash:["!","\xA7","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}},Jd={id:"linux.french",locale:"fr",displayName:"French",virtualLayout:"azerty",platform:"linux",score:0,mapping:{KeyA:["q","Q","@","\u03A9"],KeyB:["b","B","\u201D","\u2019"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\xA2"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0309","\u031B"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:[",","?","\u0301","\u030B"],KeyN:["n","N","n","N"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["a","A","\xE6","\xC6"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201C","\u2018"],KeyW:["z","Z","\xAB","<"],KeyX:["x","X","\xBB",">"],KeyY:["y","Y","\u2190","\xA5"],KeyZ:["w","W","\u0142","\u0141"],Digit1:["&","1","\xB9","\xA1"],Digit2:["\xE9","2","~","\u215B"],Digit3:['"',"3","#","\xA3"],Digit4:["'","4","{","$"],Digit5:["(","5","[","\u215C"],Digit6:["-","6","|","\u215D"],Digit7:["\xE8","7","`","\u215E"],Digit8:["_","8","\\","\u2122"],Digit9:["\xE7","9","^","\xB1"],Digit0:["\xE0","0","@","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:[")","\xB0","]","\xBF"],Equal:["=","+","}","\u0328"],BracketLeft:["\u0302","\u0308","\u0308","\u030A"],BracketRight:["$","\xA3","\xA4","\u0304"],Backslash:["*","\xB5","\u0300","\u0306"],Semicolon:["m","M","\xB5","\xBA"],Quote:["\xF9","%","\u0302","\u030C"],Backquote:["\xB2","~","\xAC","\xAC"],Comma:[";",".","\u2500","\xD7"],Period:[":","/","\xB7","\xF7"],Slash:["!","\xA7","\u0323","\u0307"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"]}},Af={id:"apple.german",locale:"de",displayName:"German",virtualLayout:"qwertz",platform:"apple",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\u222B","\u2039"],KeyC:["c","C","\xE7","\xC7"],KeyD:["d","D","\u2202","\u2122"],KeyE:["e","E","\u20AC","\u2030"],KeyF:["f","F","\u0192","\xCF"],KeyG:["g","G","\xA9","\xCC"],KeyH:["h","H","\xAA","\xD3"],KeyI:["i","I","\u2044","\xDB"],KeyJ:["j","J","\xBA","\u0131"],KeyK:["k","K","\u2206","\u02C6"],KeyL:["l","L","@","\uFB02"],KeyM:["m","M","\xB5","\u02D8"],KeyN:["n","N","~","\u203A"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\xAB","\xBB"],KeyR:["r","R","\xAE","\xB8"],KeyS:["s","S","\u201A","\xCD"],KeyT:["t","T","\u2020","\u02DD"],KeyU:["u","U","\xA8","\xC1"],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\u2211","\u201E"],KeyX:["x","X","\u2248","\xD9"],KeyY:["z","Z","\u03A9","\u02C7"],KeyZ:["y","Y","\xA5","\u2021"],Digit1:["1","!","\xA1","\xAC"],Digit2:["2",'"',"\u201C","\u201D"],Digit3:["3","\xA7","\xB6","#"],Digit4:["4","$","\xA2","\xA3"],Digit5:["5","%","[","\uFB01"],Digit6:["6","&","]","^"],Digit7:["7","/","|","\\"],Digit8:["8","(","{","\u02DC"],Digit9:["9",")","}","\xB7"],Digit0:["0","=","\u2260","\xAF"],Space:[" "," "," "," "],Minus:["\xDF","?","\xBF","\u02D9"],Equal:["\xB4","`","'","\u02DA"],BracketLeft:["\xFC","\xDC","\u2022","\xB0"],BracketRight:["+","*","\xB1","\uF8FF"],Backslash:["#","'","\u2018","\u2019"],Semicolon:["\xF6","\xD6","\u0153","\u0152"],Quote:["\xE4","\xC4","\xE6","\xC6"],Backquote:["<",">","\u2264","\u2265"],Comma:[",",";","\u221E","\u02DB"],Period:[".",":","\u2026","\xF7"],Slash:["-","_","\u2013","\u2014"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadDecimal:[",",",",".","."],IntlBackslash:["^","\xB0","\u201E","\u201C"],NumpadEqual:["=","=","=","="]}},Lf={id:"windows.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","\xB5",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","@",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["z","Z","",""],KeyZ:["y","Y","",""],Digit1:["1","!","",""],Digit2:["2",'"',"\xB2",""],Digit3:["3","\xA7","\xB3",""],Digit4:["4","$","",""],Digit5:["5","%","",""],Digit6:["6","&","",""],Digit7:["7","/","{",""],Digit8:["8","(","[",""],Digit9:["9",")","]",""],Digit0:["0","=","}",""],Space:[" "," ","",""],Minus:["\xDF","?","\\","\u1E9E"],Equal:["\xB4","`","",""],BracketLeft:["\xFC","\xDC","",""],BracketRight:["+","*","~",""],Backslash:["#","'","",""],Semicolon:["\xF6","\xD6","",""],Quote:["\xE4","\xC4","",""],Backquote:["^","\xB0","",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","|",""]}},Df={id:"linux.german",locale:"de",displayName:"German",platform:"windows",virtualLayout:"qwertz",score:0,mapping:{KeyA:["a","A","\xE6","\xC6"],KeyB:["b","B","\u201C","\u2018"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\u20AC"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0323","\u0307"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:["m","M","\xB5","\xBA"],KeyN:["n","N","\u201D","\u2019"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["q","Q","@","\u03A9"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\u017F","\u1E9E"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201E","\u201A"],KeyW:["w","W","\u0142","\u0141"],KeyX:["x","X","\xAB","\u2039"],KeyY:["z","Z","\u2190","\xA5"],KeyZ:["y","Y","\xBB","\u203A"],Digit1:["1","!","\xB9","\xA1"],Digit2:["2",'"',"\xB2","\u215B"],Digit3:["3","\xA7","\xB3","\xA3"],Digit4:["4","$","\xBC","\xA4"],Digit5:["5","%","\xBD","\u215C"],Digit6:["6","&","\xAC","\u215D"],Digit7:["7","/","{","\u215E"],Digit8:["8","(","[","\u2122"],Digit9:["9",")","]","\xB1"],Digit0:["0","=","}","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["\xDF","?","\\","\xBF"],Equal:["\u0301","\u0300","\u0327","\u0328"],BracketLeft:["\xFC","\xDC","\u0308","\u030A"],BracketRight:["+","*","~","\xAF"],Backslash:["#","'","\u2019","\u0306"],Semicolon:["\xF6","\xD6","\u030B","\u0323"],Quote:["\xE4","\xC4","\u0302","\u030C"],Backquote:["\u0302","\xB0","\u2032","\u2033"],Comma:[",",";","\xB7","\xD7"],Period:[".",":","\u2026","\xF7"],Slash:["-","_","\u2013","\u2014"],PrintScreen:["","","",""],PageUp:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",",","",","],IntlBackslash:["<",">","|","\u0331"],AltRight:["\r","\r","\r","\r"],MetaRight:[".",".",".","."]}},Qd={id:"apple.spanish",locale:"es",displayName:"Spanish ISO",platform:"apple",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","\xE5","\xC5"],KeyB:["b","B","\xDF",""],KeyC:["c","C","\xA9"," "],KeyD:["d","D","\u2202","\u2206"],KeyE:["e","E","\u20AC","\u20AC"],KeyF:["f","F","\u0192","\uFB01"],KeyG:["g","G","\uF8FF","\uFB02"],KeyH:["h","H","\u2122"," "],KeyI:["i","I"," "," "],KeyJ:["j","J","\xB6","\xAF"],KeyK:["k","K","\xA7","\u02C7"],KeyL:["l","L"," ","\u02D8"],KeyM:["m","M","\xB5","\u02DA"],KeyN:["n","N"," ","\u02D9"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\u03C0","\u220F"],KeyQ:["q","Q","\u0153","\u0152"],KeyR:["r","R","\xAE"," "],KeyS:["s","S","\u222B"," "],KeyT:["t","T","\u2020","\u2021"],KeyU:["u","U"," "," "],KeyV:["v","V","\u221A","\u25CA"],KeyW:["w","W","\xE6","\xC6"],KeyX:["x","X","\u2211","\u203A"],KeyY:["y","Y","\xA5"," "],KeyZ:["z","Z","\u03A9","\u2039"],Digit1:["1","!","|","\u0131"],Digit2:["2",'"',"@","\u02DD"],Digit3:["3","\xB7","#","\u2022"],Digit4:["4","$","\xA2","\xA3"],Digit5:["5","%","\u221E","\u2030"],Digit6:["6","&","\xAC"," "],Digit7:["7","/","\xF7","\u2044"],Digit8:["8","(","\u201C","\u2018"],Digit9:["9",")","\u201D","\u2019"],Digit0:["0","=","\u2260","\u2248"],Space:[" "," "," "," "],Minus:["'","?","\xB4","\xB8"],Equal:["\xA1","\xBF","\u201A","\u02DB"],BracketLeft:["`","^","[","\u02C6"],BracketRight:["+","*","]","\xB1"],Backslash:["\xE7","\xC7","}","\xBB"],Semicolon:["\xF1","\xD1","~","\u02DC"],Quote:["\xB4","\xA8","{","\xAB"],Backquote:["<",">","\u2264","\u2265"],Comma:[",",";","\u201E",""],Period:[".",":","\u2026","\u2026"],Slash:["-","_","\u2013","\u2014"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],Numpad1:["1","1","1","1"],Numpad2:["2","2","2","2"],Numpad3:["3","3","3","3"],Numpad4:["4","4","4","4"],Numpad5:["5","5","5","5"],Numpad6:["6","6","6","6"],Numpad7:["7","7","7","7"],Numpad8:["8","8","8","8"],Numpad9:["9","9","9","9"],Numpad0:["0","0","0","0"],NumpadDecimal:[",",",",",",","],IntlBackslash:["\xBA","\xAA","\\","\xB0"]}},e0={id:"windows.spanish",locale:"es",displayName:"Spanish",platform:"windows",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","",""],KeyB:["b","B","",""],KeyC:["c","C","",""],KeyD:["d","D","",""],KeyE:["e","E","\u20AC",""],KeyF:["f","F","",""],KeyG:["g","G","",""],KeyH:["h","H","",""],KeyI:["i","I","",""],KeyJ:["j","J","",""],KeyK:["k","K","",""],KeyL:["l","L","",""],KeyM:["m","M","",""],KeyN:["n","N","",""],KeyO:["o","O","",""],KeyP:["p","P","",""],KeyQ:["q","Q","",""],KeyR:["r","R","",""],KeyS:["s","S","",""],KeyT:["t","T","",""],KeyU:["u","U","",""],KeyV:["v","V","",""],KeyW:["w","W","",""],KeyX:["x","X","",""],KeyY:["y","Y","",""],KeyZ:["z","Z","",""],Digit1:["1","!","|",""],Digit2:["2",'"',"@",""],Digit3:["3","\xB7","#",""],Digit4:["4","$","~",""],Digit5:["5","%","\u20AC",""],Digit6:["6","&","\xAC",""],Digit7:["7","/","",""],Digit8:["8","(","",""],Digit9:["9",")","",""],Digit0:["0","=","",""],Space:[" "," ","",""],Minus:["'","?","",""],Equal:["\xA1","\xBF","",""],BracketLeft:["`","^","[",""],BracketRight:["+","*","]",""],Backslash:["\xE7","\xC7","}",""],Semicolon:["\xF1","\xD1","",""],Quote:["\xB4","\xA8","{",""],Backquote:["\xBA","\xAA","\\",""],Comma:[",",";","",""],Period:[".",":","",""],Slash:["-","_","",""],NumpadDivide:["/","/","",""],NumpadMultiply:["*","*","",""],NumpadSubtract:["-","-","",""],NumpadAdd:["+","+","",""],IntlBackslash:["<",">","",""]}},t0={id:"linux.spanish",locale:"es",displayName:"Spanish",platform:"linux",virtualLayout:"qwerty",score:0,mapping:{KeyA:["a","A","\xE6","\xC6"],KeyB:["b","B","\u201D","\u2019"],KeyC:["c","C","\xA2","\xA9"],KeyD:["d","D","\xF0","\xD0"],KeyE:["e","E","\u20AC","\xA2"],KeyF:["f","F","\u0111","\xAA"],KeyG:["g","G","\u014B","\u014A"],KeyH:["h","H","\u0127","\u0126"],KeyI:["i","I","\u2192","\u0131"],KeyJ:["j","J","\u0309","\u031B"],KeyK:["k","K","\u0138","&"],KeyL:["l","L","\u0142","\u0141"],KeyM:["m","M","\xB5","\xBA"],KeyN:["n","N","n","N"],KeyO:["o","O","\xF8","\xD8"],KeyP:["p","P","\xFE","\xDE"],KeyQ:["q","Q","@","\u03A9"],KeyR:["r","R","\xB6","\xAE"],KeyS:["s","S","\xDF","\xA7"],KeyT:["t","T","\u0167","\u0166"],KeyU:["u","U","\u2193","\u2191"],KeyV:["v","V","\u201C","\u2018"],KeyW:["w","W","\u0142","\u0141"],KeyX:["x","X","\xBB",">"],KeyY:["y","Y","\u2190","\xA5"],KeyZ:["z","Z","\xAB","<"],Digit1:["1","!","|","\xA1"],Digit2:["2",'"',"@","\u215B"],Digit3:["3","\xB7","#","\xA3"],Digit4:["4","$","~","$"],Digit5:["5","%","\xBD","\u215C"],Digit6:["6","&","\xAC","\u215D"],Digit7:["7","/","{","\u215E"],Digit8:["8","(","[","\u2122"],Digit9:["9",")","]","\xB1"],Digit0:["0","=","}","\xB0"],Enter:["\r","\r","\r","\r"],Escape:["\x1B","\x1B","\x1B","\x1B"],Backspace:["\b","\b","\b","\b"],Tab:[" ",""," ",""],Space:[" "," "," "," "],Minus:["'","?","\\","\xBF"],Equal:["\xA1","\xBF","\u0303","~"],BracketLeft:["\u0300","\u0302","[","\u030A"],BracketRight:["+","*","]","\u0304"],Backslash:["\xE7","\xC7","}","\u0306"],Semicolon:["\xF1","\xD1","~","\u030B"],Quote:["\u0301","\u0308","{","{"],Backquote:["\xBA","\xAA","\\","\\"],Comma:[",",";","\u2500","\xD7"],Period:[".",":","\xB7","\xF7"],Slash:["-","_","\u0323","\u0307"],NumpadDivide:["/","/","/","/"],NumpadMultiply:["*","*","*","*"],NumpadSubtract:["-","-","-","-"],NumpadAdd:["+","+","+","+"],NumpadEnter:["\r","\r","\r","\r"],Numpad1:["","1","","1"],Numpad2:["","2","","2"],Numpad3:["","3","","3"],Numpad4:["","4","","4"],Numpad5:["","5","","5"],Numpad6:["","6","","6"],Numpad7:["","7","","7"],Numpad8:["","8","","8"],Numpad9:["","9","","9"],Numpad0:["","0","","0"],NumpadDecimal:["",".","","."],IntlBackslash:["<",">","|","\xA6"],NumpadEqual:["=","=","=","="],NumpadComma:[".",".",".","."],NumpadParenLeft:["(","(","(","("],NumpadParenRight:[")",")",")",")"]}};function Cf(e){const i=e.split("+"),r={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:i.pop()};return i.includes("shift")&&(r.shift=!0),i.includes("alt")&&(r.alt=!0),i.includes("ctrl")&&(r.ctrl=!0),i.includes("cmd")&&(r.cmd=!0),i.includes("win")&&(r.win=!0),i.includes("meta")&&(r.meta=!0),r}function il(e){let i="";return e.shift&&(i+="shift+"),e.alt&&(i+="alt+"),e.ctrl&&(i+="ctrl+"),e.cmd&&(i+="cmd+"),e.win&&(i+="win+"),e.meta&&(i+="meta+"),i+e.key}var Yc={enter:"[Enter]",escape:"[Escape]",backspace:"[Backspace]",tab:"[Tab]",space:"[Space]",pausebreak:"[Pause]",insert:"[Insert]",home:"[Home]",pageup:"[PageUp]",delete:"[Delete]",end:"[End]",pagedown:"[PageDown]",right:"[ArrowRight]",left:"[ArrowLeft]",down:"[ArrowDown]",up:"[ArrowUp]",numpad0:"[Numpad0]",numpad1:"[Numpad1]",numpad2:"[Numpad2]",numpad3:"[Numpad3]",numpad4:"[Numpad4]",numpad5:"[Numpad5]",numpad6:"[Numpad6]",numpad7:"[Numpad7]",numpad8:"[Numpad8]",numpad9:"[Numpad9]",numpad_divide:"[NumpadDivide]",numpad_multiply:"[NumpadMultiply]",numpad_subtract:"[NumpadSubtract]",numpad_add:"[NumpadAdd]",numpad_decimal:"[NumpadDecimal]",numpad_separator:"[NumpadComma]",capslock:"[Capslock]",f1:"[F1]",f2:"[F2]",f3:"[F3]",f4:"[F4]",f5:"[F5]",f6:"[F6]",f7:"[F7]",f8:"[F8]",f9:"[F9]",f10:"[F10]",f11:"[F11]",f12:"[F12]",f13:"[F13]",f14:"[F14]",f15:"[F15]",f16:"[F16]",f17:"[F17]",f18:"[F18]",f19:"[F19]"},nl=[],vo;function Xc(){switch(H()){case"macos":case"ios":return"apple";case"windows":return"windows"}return"linux"}function Ir(e){(!e.platform||e.platform===Xc())&&nl.push(e)}function h(e,i){var r;const a={shift:!1,alt:!1,cmd:!1,win:!1,meta:!1,ctrl:!1,key:""};if(!e)return a;for(const[u,p]of Object.entries(i.mapping)){if(p[0]===e)return a.key=`[${u}]`,a;if(p[1]===e)return a.shift=!0,a.key=`[${u}]`,a;if(p[2]===e)return a.alt=!0,a.key=`[${u}]`,a;if(p[3]===e)return a.shift=!0,a.alt=!0,a.key=`[${u}]`,a}return a.key=(r=Yc[e])!=null?r:"",a}function t(e){if(e.code)return e;const i=Object.entries(o().mapping);let r=!1,a=!1,u="";for(let p=0;p<4;p++){for(const[m,b]of i)if(b[p]===e.key){u=m,p===3?(r=!0,a=!0):p===2?r=!0:p===1&&(a=!0);break}if(u)break}return new KeyboardEvent(e.type,f(P({},e),{altKey:r,shiftKey:a,code:u}))}function n(e){var i,r;if(!e||e.key==="Unidentified"||e.key==="Dead")return;const a=e.shiftKey&&e.altKey?3:e.altKey?2:e.shiftKey?1:0;for(const u of nl)((i=u.mapping[e.code])==null?void 0:i[a])===e.key?u.score+=1:(r=u.mapping[e.code])!=null&&r[a]&&(u.score=0);nl.sort((u,p)=>p.score-u.score)}function s(e){vo=nl.find(i=>e.startsWith(i.locale))}function o(){return vo!=null?vo:nl[0]}function l(){switch(Xc()){case"apple":return $l;case"windows":return $u;case"linux":return Kl}return $l}switch(Xc()){case"apple":Ir($l),Ir(Yd),Ir(Qd),Ir(Af);break;case"windows":Ir($u),Ir(Xd),Ir(e0),Ir(Lf);break;case"linux":Ir(Kl),Ir(Jd),Ir(t0),Ir(Df);break}Ir(Zd);function c(e){var i;const r=/macos|ios/.test(H()),a=e.split("+");let u="";for(const p of a)u&&(u+=r?"\u2009":'<span class="ML__shortcut-join">+</span>'),p.startsWith("[Key")?u+=p.slice(4,5):p.startsWith("Key")?u+=p.slice(3,4):p.startsWith("[Digit")?u+=p.slice(6,7):p.startsWith("Digit")?u+=p.slice(5,6):u+=(i={cmd:"\u2318",meta:r?"\u2318":"Ctrl",shift:r?"\u21E7":"Shift",alt:r?"\u2325":"Alt",ctrl:r?"\u2303":"Ctrl","\n":r?"\u23CE":"Return","[return]":r?"\u23CE":"Return","[enter]":r?"\u2324":"Enter","[tab]":r?"\u21E5":"Tab","[escape]":"Esc","[backspace]":r?"\u232B":"Backspace","[delete]":r?"\u2326":"Del","[pageup]":r?"\u21DE":"Page Up","[pagedown]":r?"\u21DF":"Page Down","[home]":r?"\u2912":"Home","[end]":r?"\u2913":"End","[space]":"Space","[equal]":"=","[minus]":"-","[comma]":",","[slash]":"/","[backslash]":"\\","[bracketleft]":"[","[bracketright]":"]",semicolon:";",period:".",comma:",",minus:"-",equal:"=",quote:"'",backslash:"\\",intlbackslash:"\\",backquote:"`",slash:"/",numpadmultiply:"* &#128290;",numpaddivide:"/ &#128290;",numpadsubtract:"- &#128290;",numpadadd:"+ &#128290;",numpaddecimal:". &#128290;",numpadcomma:", &#128290;",help:"help",left:"\u21E0",up:"\u21E1",right:"\u21E2",down:"\u21E3","[arrowleft]":"\u21E0","[arrowup]":"\u21E1","[arrowright]":"\u21E2","[arrowdown]":"\u21E3"}[p.toLowerCase()])!=null?i:p.toUpperCase();return u}function d(e){if(e instanceof MouseEvent||e instanceof PointerEvent)return{x:e.clientX,y:e.clientY};if(e instanceof TouchEvent){const i=[...e.touches].reduce((a,u)=>({x:a.x+u.clientX,y:a.y+u.clientY}),{x:0,y:0}),r=e.touches.length;return{x:i.x/r,y:i.y/r}}}function _(e){const i={alt:!1,control:!1,shift:!1,meta:!1};return(e instanceof MouseEvent||e instanceof PointerEvent||e instanceof TouchEvent||e instanceof KeyboardEvent)&&(e.altKey&&(i.alt=!0),e.ctrlKey&&(i.control=!0),e.metaKey&&(i.meta=!0),e.shiftKey&&(i.shift=!0)),i}function g(e,i){return!e&&i||e&&!i?!1:!e||!i?!0:e.alt===i.alt&&e.control===i.control&&e.shift===i.shift&&e.meta===i.meta}var v=new Set(["Backquote","Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","Minus","Equal","IntlYen","KeyQ","KeyW","KeyE","KeyR","KeyT","KeyY","KeyU","KeyI","KeyO","KeyP","BracketLeft","BracketRight","Backslash","KeyA","KeyS","KeyD","KeyF","KeyG","KeyH","KeyJ","KeyK","KeyL","Semicolon","Quote","IntlBackslash","KeyZ","KeyX","KeyC","KeyV","KeyB","KeyN","KeyM","Comma","Period","Slash","IntlRo","Space","Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","NumpadAdd","NumpadComma","NumpadDecimal","NumpadDivide","NumpadEqual","NumpadHash","NumpadMultiply","NumpadParenLeft","NumpadParenRight","NumpadStar","NumpadSubstract"]);function y(e){return e.ctrlKey||e.metaKey||["Dead","Process"].includes(e.key)?!1:e.code===""?!0:v.has(e.code)}function x(){var e;let i=document.activeElement;for(;(e=i==null?void 0:i.shadowRoot)!=null&&e.activeElement;)i=i.shadowRoot.activeElement;return i}var L=class So{static get scrim(){return So._scrim||(So._scrim=new So),So._scrim}static open(i){So.scrim.open(i)}static close(){So.scrim.close()}static get state(){return So.scrim.state}static get element(){return So.scrim.element}constructor(i){var r,a;this.lightDismiss=(r=i==null?void 0:i.lightDismiss)!=null?r:!0,this.translucent=(a=i==null?void 0:i.translucent)!=null?a:!1,this.state="closed"}get element(){if(this._element)return this._element;const i=document.createElement("div");return i.setAttribute("role","presentation"),i.style.position="fixed",i.style.contain="content",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.zIndex="var(--scrim-zindex, 10099)",i.style.outline="none",this.translucent?(i.style.background="rgba(255, 255, 255, .2)",i.style.backdropFilter="contrast(40%)"):i.style.background="transparent",this._element=i,i}open(i){var r;if(this.state!=="closed")return;this.state="opening",this.onDismiss=i==null?void 0:i.onDismiss,this.savedActiveElement=x();const{element:a}=this;((r=i==null?void 0:i.root)!=null?r:document.body).appendChild(a),a.addEventListener("click",this),document.addEventListener("touchmove",this,!1),document.addEventListener("scroll",this,!1);const u=window.innerWidth-document.documentElement.clientWidth;this.savedMarginRight=document.body.style.marginRight,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden";const p=Number.parseFloat(getComputedStyle(document.body).marginRight);document.body.style.marginRight=`${p+u}px`,i!=null&&i.child&&a.append(i.child),this.state="open"}close(){var i,r,a,u;if(this.state!=="open"){console.assert(this.element.parentElement!==null);return}this.state="closing",typeof this.onDismiss=="function"&&this.onDismiss(),this.onDismiss=void 0;const{element:p}=this;p.removeEventListener("click",this),document.removeEventListener("touchmove",this,!1),document.removeEventListener("scroll",this,!1),p.remove(),document.body.style.overflow=(i=this.savedOverflow)!=null?i:"",document.body.style.marginRight=(r=this.savedMarginRight)!=null?r:"",x()!==this.savedActiveElement&&((u=(a=this.savedActiveElement)==null?void 0:a.focus)==null||u.call(a)),p.innerHTML="",this.state="closed"}handleEvent(i){this.lightDismiss&&(i.target===this._element&&i.type==="click"?(this.close(),i.preventDefault(),i.stopPropagation()):i.target===document&&(i.type==="touchmove"||i.type==="scroll")&&(this.close(),i.preventDefault(),i.stopPropagation()))}};function M(e,i,r){let a=null,u=null,p=!1,m=!1,b=!1;const w=new AbortController,E=w.signal;return e.addEventListener("keydown",I=>{if(p||I.key==="Process"||I.code==="CapsLock"||/(Control|Meta|Alt|Shift)(Left|Right)/.test(I.code)){a=null;return}a=I,u=null,r.onKeystroke(I)?e.textContent="":a=null},{capture:!0,signal:E}),e.addEventListener("keypress",I=>{p||(a&&u&&r.onKeystroke(a),u=I)},{capture:!0,signal:E}),e.addEventListener("compositionstart",I=>{e.textContent="",p=!0,r.onCompositionStart(I.data)},{capture:!0,signal:E}),e.addEventListener("compositionupdate",I=>{p&&r.onCompositionUpdate(I.data)},{capture:!0,signal:E}),e.addEventListener("compositionend",I=>{e.textContent="",p&&(p=!1,r.onCompositionEnd(I.data))},{capture:!0,signal:E}),e.addEventListener("beforeinput",I=>I.stopImmediatePropagation(),{signal:E}),e.addEventListener("input",I=>{var N;if(!p&&(e.textContent="",I.inputType!=="insertCompositionText")){if(I.inputType==="insertFromPaste"){I.preventDefault(),I.stopPropagation();return}r.onInput((N=I.data)!=null?N:""),I.preventDefault(),I.stopPropagation()}},{signal:E}),e.addEventListener("paste",I=>{e.focus({preventScroll:!0}),e.textContent="",r.onPaste(I)||I.preventDefault(),I.stopImmediatePropagation()},{signal:E}),e.addEventListener("cut",I=>r.onCut(I),{capture:!0,signal:E}),e.addEventListener("copy",I=>r.onCopy(I),{capture:!0,signal:E}),e.addEventListener("blur",I=>{var N,J;if(((J=(N=I.relatedTarget)==null?void 0:N._mathfield)==null?void 0:J.element)===i){e.focus({preventScroll:!0}),I.preventDefault(),I.stopPropagation();return}const oe=L.state;if(oe==="open"||oe==="opening"){I.preventDefault(),I.stopPropagation();return}if(I.relatedTarget===I.target.getRootNode().host){I.preventDefault(),I.stopPropagation();return}b||m||(b=!0,a=null,u=null,r.onBlur(),b=!1)},{capture:!0,signal:E}),e.addEventListener("focus",I=>{b||m||(m=!0,r.onFocus(),m=!1)},{capture:!0,signal:E}),{dispose:()=>w.abort(),cancelComposition:()=>{p&&(e.blur(),requestAnimationFrame(()=>e.focus({preventScroll:!0})))},blur:()=>{typeof e.blur=="function"&&e.blur()},focus:()=>{!m&&typeof e.focus=="function"&&e.focus({preventScroll:!0})},hasFocus:()=>x()===e,setAriaLabel:I=>e.setAttribute("aria-label",I),setValue:I=>{var N;e.textContent=I,e.style.left="-1000px",(N=window.getSelection())==null||N.selectAllChildren(e)},moveTo:(I,N)=>{e.style.top=`${N}px`,e.style.left=`${I}px`}}}function B(e){var i;if(!e||!y(e))return"";let r;return e.key==="Unidentified"&&e.target&&(r=e.target.value),r=(i=r!=null?r:e.key)!=null?i:e.code,/^(Dead|Return|Enter|Tab|Escape|Delete|PageUp|PageDown|Home|End|Help|ArrowLeft|ArrowRight|ArrowUp|ArrowDown)$/.test(r)&&(r=""),r}function F(e){e=t(e);const i=[];return e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.altKey&&i.push("alt"),e.shiftKey&&i.push("shift"),i.length===0?`[${e.code}]`:(i.push(`[${e.code}]`),i.join("+"))}function W(e){if(C()){const i=H(),r=e.startsWith("!"),a=e.endsWith(i);if(r&&!a||!r&&a)return!0}return e==="!other"?!1:e==="other"}function _e(e,i,r){if(e.length===0)return"";const a=il(Cf(F(r))),u=il({key:r.key,shift:r.shiftKey,alt:r.altKey,ctrl:r.ctrlKey,meta:r.metaKey||r.ctrlKey&&/macos|ios/.test(H()),cmd:!1,win:!1});for(let p=e.length-1;p>=0;p--)if((e[p].key===a||e[p].key===u)&&(!e[p].ifMode||e[p].ifMode===i))return e[p].command;return""}function ce(e){let i=e;return k(i)&&(i=i.length>0?i[0]+"("+i.slice(1).join("")+")":""),i}function Pe(e,i){let r=[];if(typeof i=="string"){const p=cf[i];k(p)?r=p.slice():p&&r.push(p)}const a=ce(i),u=new RegExp("^"+a.replace("\\","\\\\").replace("|","\\|").replace("*","\\*").replace("$","\\$").replace("^","\\^")+"([^*a-zA-Z]|$)");for(const p of e)u.test(ce(p.command))&&r.push(p.key);return r.map(c)}function Ue(e,i){if(e.ifPlatform&&!/^!?(macos|windows|android|ios|chromeos|other)$/.test(e.ifPlatform))throw new Error(`Unexpected platform "${e.ifPlatform}" for keybinding ${e.key}`);if(e.ifLayout!==void 0&&(i.score===0||!e.ifLayout.includes(i.id)))return;const r=Cf(e.key);let a=e.ifPlatform;if(r.cmd){if(a&&a!=="macos"&&a!=="ios")throw new Error('Unexpected "cmd" modifier with platform "'+a+`"
"cmd" modifier can only be used with macOS or iOS platform.`);a||(a=H()==="ios"?"ios":"macos"),r.win=!1,r.cmd=!1,r.meta=!0}if(r.win){if(a&&a!=="windows")throw new Error('Unexpected "win" modifier with platform "'+a+`"
"win" modifier can only be used with Windows platform.`);a="windows",r.win=!1,r.cmd=!1,r.meta=!0}if(a&&!W(a))return;if(/^\[.+\]$/.test(r.key))return f(P({},e),{key:il(r)});const u=h(r.key,i);if(!u)return f(P({},e),{key:il(r)});if(u.shift&&r.shift||u.alt&&r.alt)throw new Error(`The keybinding ${e.key} (${dt(e.command)}) is conflicting with the key combination ${il(u)} using the ${i.displayName} keyboard layout`);return u.shift=u.shift||r.shift,u.alt=u.alt||r.alt,u.meta=r.meta,u.ctrl=r.ctrl,f(P({},e),{key:il(u)})}function dt(e){if(Array.isArray(e)){const i=[...e];return i.shift()+"("+i.map(r=>typeof r=="string"?`"${r}"`:r.toString()).join(", ")+")"}return e}function $e(e,i){const r=[],a=[];for(const u of e)try{const p=Ue(u,i);if(!p)continue;const m=a.find(b=>b.key===p.key&&b.ifMode===p.ifMode);if(m)throw new Error(`Ambiguous key binding ${u.key} (${dt(u.command)}) matches ${m.key} (${dt(m.command)}) with the ${i.displayName} keyboard layout`);a.push(p)}catch(p){p instanceof Error&&r.push(p.message)}return[a,r]}var Qe=class extends jn{constructor(){super("latex")}createAtom(e){return new Tr(e)}onPaste(e,i){if(!i)return!1;const r=typeof i=="string"?i:i.getData("application/x-latex")||i.getData("text/plain");return r&&e.model.contentWillChange({inputType:"insertFromPaste",data:r})?(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r)&&(e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),Ii(e)),e.startRecording(),!0):!1}insert(e,i,r){if(!e.contentWillChange({data:i,inputType:"insertText"}))return!1;r||(r={}),r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder");const{silenceNotifications:a}=e;r.silenceNotifications&&(e.silenceNotifications=!0);const u=e.silenceNotifications;e.silenceNotifications=!0,r.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(Kr(e.selection)):r.insertionMode==="replaceAll"?(e.root.setChildren([],"body"),e.position=0):r.insertionMode==="insertBefore"?e.collapseSelection("backward"):r.insertionMode==="insertAfter"&&e.collapseSelection("forward");const p=[];for(const w of i)Fe.test(w)&&p.push(new Tr(w));let m=e.at(e.position);if(m instanceof Qo&&(m=m.lastChild),!(m.parent instanceof Qo)){const w=new Qo("");m.parent.addChildAfter(w,m),m=w.firstChild}const b=m.parent.addChildrenAfter(p,m);return e.silenceNotifications=u,r.selectionMode==="before"||(r.selectionMode==="item"?e.setSelection(e.anchor,e.offsetOf(b)):b&&(e.position=e.offsetOf(b))),e.contentDidChange({data:i,inputType:"insertText"}),e.silenceNotifications=a,!0}};function et(e){return e.atoms.find(i=>i.type==="latexgroup")}function Be(e){var i,r;const a=e.atoms.find(u=>u.type==="latexgroup");return a?(r=(i=a.body)==null?void 0:i.filter(u=>u.type==="latex"))!=null?r:[]:[]}function Tt(e,i){var r;let a=0,u=!1;const p=Number.isFinite(i==null?void 0:i.before)?(r=i==null?void 0:i.before)!=null?r:0:e.lastOffset;for(;a<=p&&!u;){const w=e.at(a);u=w instanceof Tr&&w.isSuggestion,u||a++}if(!u)return[void 0,void 0];let m=a,b=!1;for(;m<=p&&!b;){const w=e.at(m);b=!(w instanceof Tr&&w.isSuggestion),b||m++}return[a-1,m-1]}new Qe;function ti(e){const i=Be(e.model).filter(r=>r.isSuggestion);if(i.length!==0){e.model.position=e.model.offsetOf(i[0].leftSibling);for(const r of i)r.parent.removeChild(r)}}function hi(e,i){var r;const{model:a}=e;ti(e);for(const I of Be(a))I.isError=!1;if(!a.selectionIsCollapsed||e.options.popoverPolicy==="off"){Yt(e);return}const u=[];let p=a.at(a.position);for(;p&&p instanceof Tr&&/^[a-zA-Z\*]$/.test(p.value);)p=p.leftSibling;if(p&&p instanceof Tr&&p.value==="\\")for(u.push(p),p=p.rightSibling;p&&p instanceof Tr&&/^[a-zA-Z\*]$/.test(p.value);)u.push(p),p=p.rightSibling;const m=u.map(I=>I.value).join(""),b=Oe(e,m);if(b.length===0){if(/^\\[a-zA-Z\*]+$/.test(m))for(const I of u)I.isError=!0;Yt(e);return}const w=(r=i==null?void 0:i.atIndex)!=null?r:0;e.suggestionIndex=w<0?b.length-1:w%b.length;const E=b[e.suggestionIndex];if(E!==m){const I=u[u.length-1];I.parent.addChildrenAfter([...E.slice(m.length-E.length)].map(N=>new Tr(N,{isSuggestion:!0})),I),Ls(e,{interactive:!0})}Si(e,b)}function Ti(e){const[i,r]=Tt(e,{before:e.position});if(i===void 0||r===void 0)return!1;let a=!1;return e.getAtoms([i,r]).forEach(u=>{u.isSuggestion&&(u.isSuggestion=!1,a=!0)}),a}function ci(e,i="accept",r){var a,u;Yt(e);const p=et(e.model);if(!p)return!1;if(i==="accept-suggestion"||i==="accept-all"){const E=Be(e.model).filter(I=>I.isSuggestion);if(E.length!==0){for(const I of E)I.isSuggestion=!1;e.model.position=e.model.offsetOf(E[E.length-1])}if(i==="accept-suggestion")return E.length!==0}const b=Be(e.model).filter(E=>!E.isSuggestion).map(E=>E.value).join(""),w=p.leftSibling;return p.parent.removeChild(p),e.model.position=e.model.offsetOf(w),e.switchMode((a=r==null?void 0:r.mode)!=null?a:"math"),i==="reject"||(jn.insert(e.model,b,{selectionMode:(u=r==null?void 0:r.selectItem)!=null&&u?"item":"placeholder",format:"latex",mode:"math"}),e.snapshot(),e.model.announce("replacement"),e.switchMode("math")),!0}function Zt(e){var i;let r=document.getElementById(e);return r?r.dataset.refcount=Number(Number.parseInt((i=r.dataset.refcount)!=null?i:"0")+1).toString():(r=document.createElement("div"),r.setAttribute("aria-hidden","true"),r.dataset.refcount="1",r.id=e,document.body.append(r)),r}function xi(e){var i;const r=document.getElementById(e);if(!r)return;const a=Number.parseInt((i=r.getAttribute("data-refcount"))!=null?i:"0");a<=1?r.remove():r.dataset.refcount=Number(a-1).toString()}function li(e,i){const r=new fn({from:e.context}),a=new ut({mode:"math",type:"root",body:Ur(i,{context:r})}),u=yu(Nl(new $t(a.render(r),{classes:"ML__base"}),r));return bu(u,{classes:"ML__latex"}).toMarkup()}function Si(e,i){var r;if(i.length===0){Yt(e);return}let a="";for(const[p,m]of i.entries()){const b=m,w=li(e,m),E=Pe(e.keybindings,b).join("<br>");a+=`<li role="button" data-command="${b}" ${p===e.suggestionIndex?"class=ML__popover__current":""}><span class="ML__popover__latex">${b}</span><span class="ML__popover__command">${w}</span>`,E&&(a+=`<span class="ML__popover__keybinding">${E}</span>`),a+="</li>"}const u=hn(e,`<ul>${a}</ul>`);Ui()&&((r=u.querySelector(".ML__popover__current"))==null||r.scrollIntoView({block:"nearest",inline:"nearest"})),setTimeout(()=>{var p;u&&!Ui()&&(u.classList.add("is-visible"),Qt(e),(p=u.querySelector(".ML__popover__current"))==null||p.scrollIntoView({block:"nearest",inline:"nearest"}))},32)}function Ui(){const e=document.getElementById("mathlive-suggestion-popover");return e?e.classList.contains("is-visible"):!1}function Qt(e,i){var r;if(!e.element||e.element.mathfield!==e||!Ui())return;if(((r=e.model.at(e.model.position))==null?void 0:r.type)!=="latex"){Yt(e);return}if(i!=null&&i.deferred){setTimeout(()=>Qt(e),32);return}const a=Ml(e.field);if(!a)return;const u=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,p=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,m=window.innerWidth-document.documentElement.clientWidth,b=window.innerHeight-document.documentElement.clientHeight,w=window.mathVirtualKeyboard.boundingRect.height,E=document.getElementById("mathlive-suggestion-popover");a.x+E.offsetWidth/2>p-m?E.style.left=`${p-E.offsetWidth-m}px`:a.x-E.offsetWidth/2<0?E.style.left="0":E.style.left=`${a.x-E.offsetWidth/2}px`;const I=a.y-a.height;u-b-w-a.y<I?(E.classList.add("ML__popover--reverse-direction"),E.classList.remove("top-tip"),E.classList.add("bottom-tip"),E.style.top=`${a.y-a.height-E.offsetHeight-15}px`):(E.classList.remove("ML__popover--reverse-direction"),E.classList.add("top-tip"),E.classList.remove("bottom-tip"),E.style.top=`${a.y+15}px`)}function Yt(e){e.suggestionIndex=0;const i=document.getElementById("mathlive-suggestion-popover");i&&(i.classList.remove("is-visible"),i.innerHTML="")}function hn(e,i){let r=document.getElementById("mathlive-suggestion-popover");return r||(r=Zt("mathlive-suggestion-popover"),_a("suggestion-popover"),_a("core"),r.addEventListener("pointerdown",a=>a.preventDefault()),r.addEventListener("click",a=>{let u=a.target;for(;u&&!u.dataset.command;)u=u.parentElement;u&&(ci(e,"reject"),jn.insert(e.model,u.dataset.command,{selectionMode:"placeholder",format:"latex",mode:"math"}),e.dirty=!0,e.focus())})),r.innerHTML=window.MathfieldElement.createHTML(i),r}function Fn(){document.getElementById("mathlive-suggestion-popover")&&(xi("mathlive-suggestion-popover"),na("suggestion-popover"),na("core"))}function dn(){const e=String(new Error().stack).replace(/^Error.*\n/,"").split(`
`);if(e.length===0)return console.error(`Can't use relative paths to specify assets location because the sourcefile location could not be determined (unexpected stack trace format "${new Error().stack}").`),"";let i=e[1],r=i.match(/http.*\.ts[\?:]/);return r&&(i=e[2]),r=i.match(/(https?:.*):[0-9]+:[0-9]+/),r||(r=i.match(/at (.*(\.ts))[\?:]/),r||(r=i.match(/at (.*(\.mjs|\.js))[\?:]/))),r?r[1]:(console.error(e),console.error(`Can't use relative paths to specify assets location because the source file location could not be determined (unexpected location "${i}").`),"")}var _n=null,Xr,zr,gs=((zr=(Xr=globalThis==null?void 0:globalThis.document)==null?void 0:Xr.currentScript)==null?void 0:zr.src)||dn();function Ws(e){return cl(this,null,function*(){if(/^(?:[a-z+]+:)?\/\//i.test(e))return new URL(e).href;if(_n===null)try{const i=yield fetch(gs,{method:"HEAD"});i.status===200&&(_n=i.url)}catch(i){console.error(`Invalid URL "${e}" (relative to "${gs}")`)}return new URL(e,_n!=null?_n:gs).href})}function yo(e,i,r={}){return new FontFace(e,`url(${i}.woff2) format('woff2')`,r)}var Ts="not-loaded";function Jc(){return cl(this,null,function*(){return Ts="not-loaded",rl()})}function rl(){return cl(this,null,function*(){var e;if(Ts!=="not-loaded")return;if(Ts="loading",(e=getComputedStyle(document.documentElement).getPropertyValue("--ML__static-fonts"))!=null?e:!1){Ts="ready";return}if(document.body.classList.remove("ML__fonts-did-not-load"),"fonts"in document){const r=["KaTeX_Main","KaTeX_Math","KaTeX_AMS","KaTeX_Caligraphic","KaTeX_Fraktur","KaTeX_SansSerif","KaTeX_Script","KaTeX_Typewriter","KaTeX_Size1","KaTeX_Size2","KaTeX_Size3","KaTeX_Size4"],a=Array.from(document.fonts).map(m=>m.family);if(r.every(m=>a.includes(m))){Ts="ready";return}if(!window.MathfieldElement.fontsDirectory){Ts="not-loaded";return}const u=yield Ws(window.MathfieldElement.fontsDirectory);if(!u){document.body.classList.add("ML__fonts-did-not-load"),Ts="error";return}const p=[["KaTeX_Main-Regular"],["KaTeX_Main-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_Main-Bold",{weight:"bold"}],["KaTeX_Main-Italic",{style:"italic"}],["KaTeX_Math-Italic",{style:"italic"}],["KaTeX_Math-BoldItalic",{style:"italic",weight:"bold"}],["KaTeX_AMS-Regular"],["KaTeX_Caligraphic-Regular"],["KaTeX_Caligraphic-Bold",{weight:"bold"}],["KaTeX_Fraktur-Regular"],["KaTeX_Fraktur-Bold",{weight:"bold"}],["KaTeX_SansSerif-Regular"],["KaTeX_SansSerif-Bold",{weight:"bold"}],["KaTeX_SansSerif-Italic",{style:"italic"}],["KaTeX_Script-Regular"],["KaTeX_Typewriter-Regular"],["KaTeX_Size1-Regular"],["KaTeX_Size2-Regular"],["KaTeX_Size3-Regular"],["KaTeX_Size4-Regular"]].map(m=>yo(m[0].replace(/-[a-zA-Z]+$/,""),`${u}/${m[0]}`,m[1]));try{(yield Promise.all(p.map(b=>{try{return b.load()}catch(w){}}))).forEach(b=>document.fonts.add(b)),Ts="ready";return}catch(m){console.error(`MathLive 0.98.5: The math fonts could not be loaded from "${u}"`,{cause:m}),document.body.classList.add("ML__fonts-did-not-load")}Ts="error"}})}function F0(e){let i=0;for(let r=0;r<e.length;r++)i=i*31+e.charCodeAt(r),i=i|0;return Math.abs(i)}function Ii(e,i){e&&(e.dirty||(e.dirty=!0,requestAnimationFrame(()=>{co(e)&&e.dirty&&(e.atomBoundsCache=new Map,Ls(e,i),e.atomBoundsCache=void 0)})))}function ns(e,i){var r;i=i!=null?i:{};const a=new fn({from:f(P({},e.context),{atomIdsSettings:{seed:i.forHighlighting?F0(ut.serialize([e.model.root],{expandMacro:!1,defaultMode:e.options.defaultMode})):"random",groupNumbers:(r=i.forHighlighting)!=null?r:!1},letterShapeStyle:e.options.letterShapeStyle}),mathstyle:e.options.defaultMode==="inline-math"?"textstyle":"displaystyle"}),u=e.model.root.render(a);return bu(Nl(u,a),{classes:e.hasEditablePrompts?"ML__latex ML__prompting":"ML__latex",attributes:{translate:"no","aria-hidden":"true"}})}function As(e,i){const{model:r}=e;r.root.caret=void 0,r.root.isSelected=!1,r.root.containsCaret=!0;for(const u of r.atoms)u.caret=void 0,u.isSelected=!1,u.containsCaret=!1;if(r.selectionIsCollapsed){const u=r.at(r.position);u.caret=e.model.mode;let p=u.parent;for(;p;)p.containsCaret=!0,p=p.parent}else{const u=r.getAtoms(r.selection,{includeChildren:!0});for(const p of u)p.isSelected=!0}return ns(e,i).toMarkup()}function Ls(e,i){if(!co(e))return;i!=null||(i={});const r=e.element.querySelector("[part=virtual-keyboard-toggle]");r&&(r.style.display=e.hasEditableContent?"":"none");const a=e.field;if(!a)return;const u=e.isSelectionEditable&&e.hasFocus(),p=a.classList.contains("ML__focused");p&&!u?a.classList.remove("ML__focused"):!p&&u&&a.classList.add("ML__focused");let m=As(e,i);const b=e.element.querySelector("[part=menu-toggle]");if(b&&(e.model.atoms.length<=1||e.disabled||e.readOnly&&!e.hasEditableContent||e.userSelect==="none"?b.style.display="none":b.style.display=""),e.model.atoms.length<=1){const w=e.options.contentPlaceholder;w&&(m+=`<span part=placeholder class="ML__content-placeholder">${Vr(w)}</span>`)}a.innerHTML=window.MathfieldElement.createHTML(m),_s(e,i.interactive),e.dirty=!1}function _s(e,i){const r=e.field;if(!r)return;for(const b of r.querySelectorAll(".ML__selection, .ML__contains-highlight"))b.remove();!(i!=null&&i)&&Ts!=="error"&&Ts!=="ready"&&setTimeout(()=>{Ts==="ready"?_s(e):setTimeout(()=>_s(e),128)},32);const a=e.model,u=r.offsetWidth,p=r.getBoundingClientRect().width;let m=Math.floor(p)/u;if(m=isNaN(m)?1:m,a.selectionIsCollapsed){Qt(e,{deferred:!0});let b=a.at(a.position);for(;b&&b.type!=="prompt"&&!(b.containsCaret&&b.displayContainsHighlight);)b=b.parent;if(b!=null&&b.containsCaret&&b.displayContainsHighlight){const w=Dc(e,ia(e,b),m);if(w){w.left/=m,w.right/=m,w.top/=m,w.bottom/=m;const E=document.createElement("div");E.classList.add("ML__contains-highlight"),E.style.position="absolute",E.style.left=`${w.left+1}px`,E.style.top=`${Math.ceil(w.top)}px`,E.style.width=`${Math.ceil(w.right-w.left)}px`,E.style.height=`${Math.ceil(w.bottom-w.top)}px`,r.insertBefore(E,r.childNodes[0])}}return}for(const b of sl(Mc(e,{excludeAtomsWithBackground:!0}))){b.left/=m,b.right/=m,b.top/=m,b.bottom/=m;const w=document.createElement("div");w.classList.add("ML__selection"),w.style.position="absolute",w.style.left=`${b.left}px`,w.style.top=`${b.top}px`,w.style.width=`${Math.ceil(b.right-b.left)}px`,w.style.height=`${Math.ceil(b.bottom-b.top-1)}px`,r.insertBefore(w,r.childNodes[0])}}function sl(e){let i=[];for(const r of e){let a=!1;for(const u of i)if(r.left===u.left&&r.right===u.right&&r.top===u.top&&r.bottom===u.bottom){a=!0;break}a||i.push(r)}e=i,i=[];for(const r of e){let a=0;for(const u of e)if(r.left>=u.left&&r.right<=u.right&&r.top>=u.top&&r.bottom<=u.bottom&&(a+=1,a>1))break;a===1&&i.push(r)}return i}var Ba=3,js;function Jr(e,i){i=P({target:"mathfield",canUndo:!1,audioFeedback:void 0,changeContent:!1,changeSelection:!1},i!=null?i:{}),js||(js={});for(const r of Object.keys(e))console.assert(!js[r],"Selector already defined: ",r),js[r]=f(P({},i),{fn:e[r]})}function Ku(e){let i;if(Array.isArray(e)){if(e[0]==="performWithFeedback")return Ku(e[1]);i=e[0]}else i=e;return i=i.replace(/-\w/g,r=>r[1].toUpperCase()),js[i]}function ra(e){var i;return(i=Ku(e))==null?void 0:i.target}function Mf(e,i){var r;if(!i)return!1;let a,u=[],p=!1,m=!1;k(i)?(a=i[0],u=i.slice(1)):a=i,a=a.replace(/-\w/g,E=>E[1].toUpperCase());const b=js[a],w=b==null?void 0:b.target;if(w==="model"){if(!e.isSelectionEditable&&(b!=null&&b.changeContent))return e.model.announce("plonk"),!1;/^(delete|add)/.test(a)&&(a!=="deleteBackward"&&e.flushInlineShortcutBuffer(),e.snapshot(a)),/^complete/.test(a)||ti(e),js[a].fn(e.model,...u),hi(e),m=!0,p=!0}else if(w==="virtual-keyboard")m=(r=window.mathVirtualKeyboard.executeCommand(i))!=null?r:!1,p=!0;else if(js[a]){if(!e.isSelectionEditable&&(b!=null&&b.changeContent))return e.model.announce("plonk"),!1;/^(undo|redo)/.test(a)&&e.flushInlineShortcutBuffer(),m=js[a].fn(e,...u),p=!0}else throw new Error(`Unknown command "${a}"`);return w!=="virtual-keyboard"&&(!e.model.selectionIsCollapsed||b!=null&&b.changeSelection&&i!=="deleteBackward")&&(e.flushInlineShortcutBuffer(),b!=null&&b.changeContent||e.stopCoalescingUndo(),e.defaultStyle={}),m&&Ii(e),p}function i0(e,i){var r;if(!e)return!1;e.focus(),Mp.keypressVibration&&Q()&&navigator.vibrate(Ba);const a=Ku(i);window.MathfieldElement.playSound((r=a==null?void 0:a.audioFeedback)!=null?r:"keypress");const u=e.executeCommand(i);return e.scrollIntoView(),u}Jr({performWithFeedback:(e,i)=>i0(e,i)});function If(e){return hi(e,{atIndex:e.suggestionIndex+1}),!1}function Rf(e){return hi(e,{atIndex:e.suggestionIndex-1}),!1}Jr({complete:ci},{target:"mathfield",audioFeedback:"return",canUndo:!0,changeContent:!0,changeSelection:!0}),Jr({nextSuggestion:If,previousSuggestion:Rf},{target:"mathfield",audioFeedback:"keypress",changeSelection:!0});var Na="mathlive#virtual-keyboard-message";function n0(e){var i;return e.type!=="message"?!1:((i=e.data)==null?void 0:i.type)===Na}var ym=class mm{constructor(){this.targetOrigin=window.origin,this.originValidator="none",this._boundingRect=new DOMRect(0,0,0,0),this._isShifted=!1,window.addEventListener("message",this),this.sendMessage("proxy-created"),this.listeners={}}static get singleton(){return this._singleton||(this._singleton=new mm),this._singleton}set alphabeticLayout(i){this.sendMessage("update-setting",{alphabeticLayout:i})}set layouts(i){this.sendMessage("update-setting",{layouts:i})}get normalizedLayouts(){return[]}set editToolbar(i){this.sendMessage("update-setting",{editToolbar:i})}set actionKeycap(i){this.sendMessage("update-setting",{actionKeycap:i})}set shiftKeycap(i){this.sendMessage("update-setting",{shiftKeycap:i})}set backspaceKeycap(i){this.sendMessage("update-setting",{backspaceKeycap:i})}set tabKeycap(i){this.sendMessage("update-setting",{tabKeycap:i})}set container(i){throw new Error("Container inside an iframe cannot be changed")}show(i){this.sendMessage("show",i)}hide(i){this.sendMessage("hide",i)}get isShifted(){return this._isShifted}get visible(){return this._boundingRect.height>0}set visible(i){i?this.show():this.hide()}get boundingRect(){return this._boundingRect}executeCommand(i){return this.sendMessage("execute-command",{command:i}),!0}updateToolbar(i){this.sendMessage("update-toolbar",i)}update(i){this.sendMessage("update-setting",i)}connect(){this.sendMessage("connect")}disconnect(){this.sendMessage("disconnect")}addEventListener(i,r,a){this.listeners[i]||(this.listeners[i]=new Set),this.listeners[i].has(r)||this.listeners[i].add(r)}dispatchEvent(i){return!this.listeners[i.type]||this.listeners[i.type].size===0?!0:(this.listeners[i.type].forEach(r=>{typeof r=="function"?r(i):r==null||r.handleEvent(i)}),!i.defaultPrevented)}removeEventListener(i,r,a){this.listeners[i]&&this.listeners[i].delete(r)}handleEvent(i){if(n0(i)){if(!Ic(i.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${i.origin}) cannot be handled`,"SecurityError");this.handleMessage(i.data)}}handleMessage(i){const{action:r}=i;if(r==="execute-command"){const{command:a}=i;ra(a)==="virtual-keyboard"&&this.executeCommand(a);return}if(r==="synchronize-proxy"){this._boundingRect=i.boundingRect,this._isShifted=i.isShifted;return}if(r==="geometry-changed"){this._boundingRect=i.boundingRect,this.dispatchEvent(new Event("geometrychange"));return}}sendMessage(i,r={}){if(!window.top)throw new DOMException("A frame does not have access to the top window and can\u2018t communicate with the keyboard. Review virtualKeyboardTargetOrigin and originValidator on mathfields embedded in an iframe","SecurityError");window.top.postMessage(P({type:Na,action:i},r),this.targetOrigin)}},B0={numeric:{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",rows:[[{latex:"x",shift:"y",variants:["y","z","t","r","x^2","x^n","x^{#?}","x_n","x_i","x_{#?}",{latex:"f(#?)",class:"small"},{latex:"g(#?)",class:"small"}]},{latex:"n",shift:"a",variants:["i","j","p","k","a","u"]},"[separator-5]","[7]","[8]","[9]","[/]","[separator-5]",{latex:"\\exponentialE",shift:"\\ln",variants:["\\exp","\\times 10^{#?}","\\ln","\\log_{10}","\\log"]},{latex:"\\imaginaryI",variants:["\\Re","\\Im","\\imaginaryJ","\\Vert #0 \\Vert"]},{latex:"\\pi",shift:"\\sin",variants:["\\prod",{latex:"\\theta",aside:"theta"},{latex:"\\rho",aside:"rho"},{latex:"\\tau",aside:"tau"},"\\sin","\\cos","\\tan"]}],[{label:"<",latex:"<",class:"hide-shift",shift:{latex:"\\le",label:"\u2264"}},{label:">",latex:">",class:"hide-shift",shift:{latex:"\\ge",label:"\u2265"}},"[separator-5]","[4]","[5]","[6]","[*]","[separator-5]",{class:"hide-shift",latex:"#@^2}",shift:"#@^{\\prime}}"},{latex:"#@^{#0}}",class:"hide-shift",shift:"#@_{#?}"},{class:"hide-shift",latex:"\\sqrt{#0}",shift:{latex:"\\sqrt[#0]{#?}}"}}],["[(]","[)]","[separator-5]","[1]","[2]","[3]","[-]","[separator-5]",{latex:"\\int^{\\infty}_{0}\\!#?\\,\\mathrm{d}x",class:"small hide-shift",shift:"\\int",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{class:"hide-shift",latex:"\\forall",shift:"\\exists"},{label:"[backspace]",width:1}],[{label:"[shift]",width:2},"[separator-5]","[0]","[.]","[=]","[+]","[separator-5]","[left]","[right]",{label:"[action]",width:1}]]},greek:{label:"&alpha;&beta;&gamma;",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.greek",rows:[[{label:"<i>&#x03c6;</i>",class:"MLK__tex hide-shift",insert:"\\varphi",aside:"phi var.",shift:"\\Phi"},{label:"<i>&#x03c2;</i>",class:"MLK__tex hide-shift",insert:"\\varsigma",aside:"sigma var.",shift:"\\Sigma"},{label:"<i>&#x03f5;</i>",class:"MLK__tex hide-shift",insert:"\\epsilon",aside:"espilon",shift:'\\char"0190'},{label:"<i>&rho;</i>",class:"MLK__tex hide-shift",insert:"\\rho",aside:"rho",shift:'\\char"3A1'},{label:"<i>&tau;</i>",class:"MLK__tex hide-shift",insert:"\\tau",aside:"tau",shift:'\\char"3A4'},{label:"<i>&upsilon;</i>",class:"MLK__tex hide-shift",insert:"\\upsilon",aside:"upsilon",shift:"\\Upsilon"},{label:"<i>&theta;</i>",class:"MLK__tex hide-shift",insert:"\\theta",aside:"theta",shift:"\\Theta"},{label:"<i>&iota;</i>",class:"MLK__tex hide-shift",insert:"\\iota",aside:"iota",shift:'\\char"399'},{label:"<i>&omicron;</i>",class:"MLK__tex hide-shift",insert:"\\omicron",aside:"omicron",shift:'\\char"39F'},{label:"<i>&pi;</i>",class:"MLK__tex hide-shift",insert:"\\pi",aside:"pi",shift:"\\Pi"}],["[separator-5]",{label:"<i>&alpha;</i>",class:"MLK__tex hide-shift",insert:"\\alpha",aside:"alpha",shift:'\\char"391'},{label:"<i>&sigma;</i>",class:"MLK__tex hide-shift",insert:"\\sigma",aside:"sigma",shift:"\\Sigma"},{label:"<i>&delta;</i>",class:"MLK__tex hide-shift",insert:"\\delta",aside:"delta",shift:"\\Delta"},{latex:"\\phi",class:"MLK__tex hide-shift",insert:"\\phi",aside:"phi",shift:"\\Phi"},{label:"<i>&gamma;</i>",class:"MLK__tex hide-shift",insert:"\\gamma",aside:"gamma",shift:"\\Gamma"},{label:"<i>&eta;</i>",class:"MLK__tex hide-shift",insert:"\\eta",aside:"eta",shift:'\\char"397'},{label:"<i>&xi;</i>",class:"MLK__tex hide-shift",insert:"\\xi",aside:"xi",shift:"\\Xi"},{label:"<i>&kappa;</i>",class:"MLK__tex hide-shift",insert:"\\kappa",aside:"kappa",shift:"\\Kappa"},{label:"<i>&lambda;</i>",class:"MLK__tex hide-shift",insert:"\\lambda",aside:"lambda",shift:"\\Lambda"},"[separator-5]"],["[shift]",{label:"<i>&zeta;</i>",class:"MLK__tex hide-shift",insert:"\\zeta",aside:"zeta",shift:'\\char"396'},{label:"<i>&chi;</i>",class:"MLK__tex hide-shift",insert:"\\chi",aside:"chi",shift:'\\char"3A7'},{label:"<i>&psi;</i>",class:"MLK__tex hide-shift",insert:"\\psi",aside:"zeta",shift:"\\Psi"},{label:"<i>&omega;</i>",class:"MLK__tex hide-shift",insert:"\\omega",aside:"omega",shift:"\\Omega"},{label:"<i>&beta;</i>",class:"MLK__tex hide-shift",insert:"\\beta",aside:"beta",shift:'\\char"392'},{label:"<i>&nu;</i>",class:"MLK__tex hide-shift",insert:"\\nu",aside:"nu",shift:'\\char"39D'},{label:"<i>&mu;</i>",class:"MLK__tex hide-shift",insert:"\\mu",aside:"mu",shift:'\\char"39C'},"[backspace]"],["[separator]",{label:"<i>&#x03b5;</i>",class:"MLK__tex",insert:"\\varepsilon",aside:"espilon var."},{label:"<i>&#x03d1;</i>",class:"MLK__tex",insert:"\\vartheta",aside:"theta var."},{label:"<i>&#x3f0;</i>",class:"MLK__tex",insert:"\\varkappa",aside:"kappa var."},{label:"<i>&#x03d6;</i>",class:"MLK__tex",insert:"\\varpi",aside:"pi var."},{label:"<i>&#x03f1;</i>",class:"MLK__tex",insert:"\\varrho",aside:"rho var."},"[left]","[right]","[action]"]]},symbols:{label:"&infin;\u2260\u2208",labelClass:"MLK__tex",tooltip:"keyboard.tooltip.symbols",rows:[[{latex:"\\sin",shift:"\\sin^{-1}",variants:[{class:"small",latex:"\\sinh"},{class:"small",latex:"\\sin^{-1}"},{class:"small",latex:"\\arsinh"}]},"\\ln",{latex:"\\mathrm{abs}",insert:"\\mathrm{abs}\\left(#0\\right)"},{latex:"\\rarr",shift:"\\rArr",variants:[{latex:"\\implies",aside:"implies"},{latex:"\\to",aside:"to"},"\\dashv",{latex:"\\roundimplies",aside:"round implies"}]},{latex:"\\exists",variants:["\\nexists"],shift:"\\nexists"},{latex:"\\in",shift:"\\notin",variants:["\\notin","\\owns"]},"\\cup",{latex:"\\overrightarrow{#@}",shift:"\\overleftarrow{#@}",variants:["\\overleftarrow{#@}","\\bar{#@}","\\vec{#@}","\\hat{#@}","\\check{#@}","\\dot{#@}","\\ddot{#@}","\\mathring{#@}","\\breve{#@}","\\acute{#@}","\\tilde{#@}","\\grave{#@}"]},{class:"small",latex:"\\lim_{#?}",shift:"\\lim_{x\\to\\infty}",variants:[{class:"small",latex:"\\liminf_{#?}"},{class:"small",latex:"\\limsup_{#?}"}]},"\\exponentialE"],[{latex:"\\cos",shift:"\\cos^{-1}",variants:[{class:"small",latex:"\\cosh"},{class:"small",latex:"\\cos^{-1}"},{class:"small",latex:"\\arcosh"}]},{latex:"\\log",shift:"\\log_{10}",variants:["\\log_{#0}","\\log_{10}"]},"\\left\\vert#0\\right\\vert",{latex:"\\larr",shift:"\\lArr",variants:[{latex:"\\impliedby",aside:"implied by"},{latex:"\\gets",aside:"gets"},"\\lArr","\\vdash",{latex:"\\models",aside:"models"}]},{latex:"\\forall",shift:"\\lnot",variants:[{latex:"\\land",aside:"and"},{latex:"\\lor",aside:"or"},{latex:"\\oplus",aside:"xor"},{latex:"\\lnot",aside:"not"},{latex:"\\downarrow",aside:"nor"},{latex:"\\uparrow",aside:"nand"},{latex:"\\curlywedge",aside:"nor"},{latex:"\\bar\\curlywedge",aside:"nand"}]},{latex:"\\ni",shift:"\\not\\owns"},"\\cap",{latex:"\\overline{#@}",shift:"\\underline{#@}",variants:["\\overbrace{#@}","\\overlinesegment{#@}","\\overleftrightarrow{#@}","\\overrightarrow{#@}","\\overleftarrow{#@}","\\overgroup{#@}","\\underbrace{#@}","\\underlinesegment{#@}","\\underleftrightarrow{#@}","\\underrightarrow{#@}","\\underleftarrow{#@}","\\undergroup{#@}"]},{class:"hide-shift",latex:"\\int",shift:"\\iint",variants:[{latex:"\\int_{#?}^{#?}",class:"small"},{latex:"\\int",class:"small"},{latex:"\\smallint",class:"small"},{latex:"\\iint",class:"small"},{latex:"\\iiint",class:"small"},{latex:"\\oint",class:"small"},"\\intop","\\iiint","\\oiint","\\oiiint","\\intclockwise","\\varointclockwise","\\ointctrclockwise","\\intctrclockwise"]},{latex:"\\pi",shift:"\\tau",variants:["\\tau"]}],[{latex:"\\tan",shift:"\\tan^{-1}",variants:[{class:"small",latex:"\\tanh"},{class:"small",latex:"\\tan^{-1}"},{class:"small",latex:"\\artanh"},{class:"small",latex:"\\arctan"},{class:"small",latex:"\\arctg"},{class:"small",latex:"\\tg"}]},{latex:"\\exp",insert:"\\exp\\left(#0\\right)",variants:["\\exponentialE^{#0}"]},"\\left\\Vert#0\\right\\Vert",{latex:"\\lrArr",shift:"\\leftrightarrow",variants:[{latex:"\\iff",aside:"if and only if"},"\\leftrightarrow","\\leftrightarrows","\\Leftrightarrow",{latex:"^\\biconditional",aside:"biconditional"}]},{latex:"\\vert",shift:"!"},{latex:"#@^{\\complement}",aside:"complement",variants:[{latex:"\\setminus",aside:"set minus"},{latex:"\\smallsetminus",aside:"small set minus"}]},{latex:"\\subset",shift:"\\subseteq",variants:["\\subset","\\subseteq","\\subsetneq","\\varsubsetneq","\\subsetneqq","\\nsubset","\\nsubseteq","\\supset","\\supseteq","\\supsetneq","\\supsetneqq","\\nsupset","\\nsupseteq"]},{latex:"#@^{\\prime}",shift:"#@^{\\doubleprime}",variants:["#@^{\\doubleprime}","#@\\degree"]},{latex:"\\mathrm{d}",shift:"\\partial",variants:["\\mathrm{d}x",{latex:"\\dfrac{\\mathrm{d}}{\\mathrm{d} x}",class:"small"},{latex:"\\frac{\\partial}{\\partial x}",class:"small"},"\\partial"]},{latex:"\\infty",variants:["\\aleph_0","\\aleph_1","\\omega","\\mathfrak{m}"]}],[{label:"[shift]",width:2},{class:"box",latex:",",shift:";",variants:[";","?"]},{class:"box",latex:"\\colon",shift:"\\Colon",variants:[{latex:"\\Colon",aside:"such that",class:"box"},{latex:":",aside:"ratio",class:"box"},{latex:"\\vdots",aside:"",class:"box"},{latex:"\\ddots",aside:"",class:"box"},{latex:"\\ldotp",aside:"low dot",class:"box"},{latex:"\\cdotp",aside:"center dot",class:"box"},{latex:"\\ldots",aside:"low ellipsis",class:"box"},{latex:"\\cdots",aside:"center ellipsis",class:"box"},{latex:"\\therefore",aside:"therefore",class:"box"},{latex:"\\because",aside:"because",class:"box"}]},{class:"box",latex:"\\cdot",aside:"centered dot",shift:"\\ast",variants:["\\circ","\\bigcirc","\\bullet","\\odot","\\oslash","\\circledcirc","\\ast","\\star","\\times","\\doteq","\\doteqdot"]},"[separator]","[left]","[right]",{label:"[backspace]",width:1,class:"action hide-shift"},{label:"[action]",width:1}]]},compact:{label:"compact",rows:[["[+]","[-]","[*]","[/]","[=]","[.]","[(]","[)]","\\sqrt{#0}","#@^{#?}"],["[1]","[2]","[3]","[4]","[5]","[6]","[7]","[8]","[9]","[0]"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]},minimalist:{label:"minimalist",layers:[{style:`
.minimalist-backdrop {
display: flex;
justify-content: center;
}
.minimalist-container {
--keycap-height: 40px;
--keycap-max-width: 53px;
--keycap-small-font-size: 12px;
background: var(--keyboard-background);
padding: 20px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border: 1px solid var(--keyboard-border);
box-shadow: 0 0 32px rgb(0 0 0 / 30%);
}
`,backdrop:"minimalist-backdrop",container:"minimalist-container",rows:[["+","-","\\times",{latex:"\\frac{#@}{#0}",class:"small"},"=","[.]","(",")",{latex:"\\sqrt{#0}",class:"small"},{latex:"#@^{#?}",class:"small"}],["1","2","3","4","5","6","7","8","9","0"],["[hr]"],["[undo]","[redo]","[separator]","[separator]","[separator]","[left]","[right]",{label:"[backspace]",class:"action hide-shift"},"[hide-keyboard]"]]}]},"numeric-only":{label:"123",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.numeric",id:"numeric-only",rows:[["7","8","9","[separator]",{label:"[backspace]",width:2}],["4","5","6","[separator]","[separator]","[separator]"],["1","2","3","[separator]","[separator]","[separator]"],["0",{label:"[.]",variants:[]},"-","[separator]","[left]","[right]"]]}},Pf={0:["\\varnothing","\\infty"],1:["\\frac{1}{#@}","#@^{-1}","\\times 10^{#?}","\\phi","\\imaginaryI"],2:["\\frac{1}{2}","#@^2","\\sqrt2","\\exponentialE"],3:["\\frac{1}{3}","#@^3","\\sqrt3","\\pi"],4:["\\frac{1}{4}","#@^4"],5:["\\frac{1}{5}","#@^5","\\sqrt5"],6:["\\frac{1}{6}","#@^6"],7:["\\frac{1}{7}","#@^7"],8:["\\frac{1}{8}","#@^8"],9:["\\frac{1}{9}","#@^9"],".":[".",",",";","\\colon"],",":["{,}",".",";","\\colon"],a:[{latex:"\\aleph",aside:"aleph"},{latex:"\\forall",aside:"for all"},"\xE0","\xE1","\xE2","\xE4","\xE6"],b:[{latex:"\\beth",aside:"beth"}],c:[{latex:"\\C",aside:"set of complex numbers"},"\xE7"],d:[{latex:"\\daleth",aside:"daleth"}],e:[{latex:"\\exponentialE",aside:"exponential e"},{latex:"\\exists",aside:"there is"},{latex:"\\nexists",aside:"there isn\u2019t"},"\xE8","\xE9","\xEA","\xEB"],g:[{latex:"\\gimel",aside:"gimel"}],h:[{latex:"\\hbar",aside:"h bar"},{latex:"\\hslash",aside:"h slash"}],i:[{latex:"\\imaginaryI",aside:"imaginary i"},"\xEC","\xED","\xEE","\xEF"],j:[{latex:"\\imaginaryJ",aside:"imaginary j"}],l:[{latex:"\\ell",aside:"ell"}],n:[{latex:"\\mathbb{N}",aside:"set of natural numbers"},"\xF1"],o:["\xF8","\u0153","\xF2","\xF3","\xF4","\xF6","\u0153"],p:[{latex:"\\mathbb{P}",aside:"set of primes"}],q:[{latex:"\\mathbb{Q}",aside:"set of rational numbers"}],r:[{latex:"\\mathbb{R}",aside:"set of real numbers"}],u:["\xF9","\xFA","\xFB","\xFC"],z:[{latex:"\\mathbb{Z}",aside:"set of integers"}],y:["\xFD","\xFF"],space:[{latex:'\\char"203A\\!\\char"2039',insert:"\\!",aside:"negative thin space<br>\u207B\xB3\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\,\\char"2039',insert:"\\,",aside:"thin space<br>\xB3\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\:\\char"2039',insert:"\\:",aside:"medium space<br>\u2074\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\;\\char"2039',insert:"\\;",aside:"thick space<br>\u2075\u29F8\u2081\u2088 em"},{latex:'\\char"203A\\ \\char"2039',insert:"\\ ",aside:"\u2153 em"},{latex:'\\char"203A\\enspace\\char"2039',insert:"\\enspace",aside:"\xBD em"},{latex:'\\char"203A\\quad\\char"2039',insert:"\\quad",aside:"1 em"},{latex:'\\char"203A\\qquad\\char"2039',insert:"\\qquad",aside:"2 em"}]},Qc;function N0(e,i){var r,a,u;const p=al.singleton;if(!p)return;const m=Uu(e),b=(a=(r=p.getKeycap(m==null?void 0:m.id))==null?void 0:r.variants)!=null?a:"";if(typeof b=="string"&&!$0(b)||Array.isArray(b)&&b.length===0){i==null||i();return}const w={};let E="";for(const He of xm(b)){const Ft=U0(He),Ve=Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);w[Ve]=Ft;const[St,Kt]=Of(Ft);E+=`<div id=${Ve} class="item ${Kt}">${St}</div>`}const I=document.createElement("div");I.setAttribute("aria-hidden","true"),I.className="MLK__variant-panel",I.style.height="auto";const N=Object.keys(w).length;let J=5;N===1?J=1:N===2||N===4?J=2:N===3||N===5||N===6?J=3:N>=7&&N<14&&(J=4),I.style.width=`calc(var(--variant-keycap-length) * ${J} + 12px)`,I.innerHTML=Mp.createHTML(E),L.open({root:(u=p==null?void 0:p.container)==null?void 0:u.querySelector(".ML__keyboard"),child:I}),Qc=new AbortController;const{signal:oe}=Qc,ge=e==null?void 0:e.getBoundingClientRect();if(ge){ge.top-I.clientHeight<0&&(I.style.width="auto",N<=6?I.style.height="56px":N<=12?I.style.height="108px":N<=18?I.style.height="205px":I.classList.add("compact"));const He=Math.max(0,Math.min(window.innerWidth-I.offsetWidth,(ge.left+ge.right-I.offsetWidth)/2)),Ft=ge.top-I.clientHeight+5;I.style.transform=`translate(${He}px, ${Ft}px)`,I.classList.add("is-visible"),requestAnimationFrame(()=>{I.addEventListener("pointerup",Ve=>{const St=Uu(Ve.target);!(St!=null&&St.id)||!w[St.id]||(r0(w[St.id]),eh(),i==null||i(),Ve.preventDefault())},{capture:!0,passive:!1,signal:oe}),I.addEventListener("pointerenter",Ve=>{const St=Uu(Ve.target);!(St!=null&&St.id)||!w[St.id]||St.classList.add("is-active")},{capture:!0,signal:oe}),I.addEventListener("pointerleave",Ve=>{const St=Uu(Ve.target);!(St!=null&&St.id)||!w[St.id]||St.classList.remove("is-active")},{capture:!0,signal:oe}),window.addEventListener("pointercancel",()=>{eh(),i==null||i()},{signal:oe}),window.addEventListener("pointerup",()=>{eh(),i==null||i()},{signal:oe})})}}function eh(){Qc==null||Qc.abort(),Qc=null,L.state==="open"&&L.close()}function bm(e){if(e==="foreground-color"){const i=[];for(const r of Object.keys(se))i.push({class:"swatch-button",label:'<span style="border: 3px solid '+se[r]+'"></span>',command:["applyStyle",{color:r}]});return i}if(e==="background-color"){const i=[];for(const r of Object.keys(Te))i.push({class:"swatch-button",label:'<span style="background:'+Te[r]+'"></span>',command:["applyStyle",{backgroundColor:r}]});return i}}function $0(e){return Pf[e]!==void 0}function xm(e){var i;return typeof e!="string"?e:(Pf[e]||(Pf[e]=(i=bm(e))!=null?i:[]),Pf[e])}function wm(e){return typeof e=="string"?e:Object.entries(e).map(([i,r])=>`${i}:${r} !important`).join(";")}function Sm(e){return Object.keys(e).map(i=>`${i} {${wm(e[i])}}`).join("")}function th(e){if(!e)return"";const i=new fn,r=new ut({mode:"math",type:"root",body:Ur(e,{context:i,args:u=>u==="@"?"{\\class{ML__box-placeholder}{\\blacksquare}}":"\\placeholder{}"})}),a=yu(Nl(new $t(r.render(i),{classes:"ML__base"}),i));return bu(a,{classes:"ML__latex"}).toMarkup()}function ih(e){var i;if(Array.isArray(e))return e.map(a=>ih(a)).flat();const r=typeof e=="string"?{markup:e}:e;return"rows"in r&&Array.isArray(r.rows)&&(r.rows=r.rows.map(a=>a.map(u=>U0(u)))),(i=r.id)!=null||(r.id="ML__layer_"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36)),[r]}function Em(){var e,i;let a=window.mathVirtualKeyboard.alphabeticLayout;if(a==="auto"){const b=o();b&&(a=b.virtualLayout),(!a||a==="auto")&&(a=(e={fr:"azerty",be:"azerty",al:"qwertz",ba:"qwertz",cz:"qwertz",de:"qwertz",hu:"qwertz",sk:"qwertz",ch:"qwertz"}[$.locale.slice(0,2)])!=null?e:"qwerty")}const u={qwerty:["qwertyuiop"," asdfghjkl ","^zxcvbnm~"],azerty:["azertyuiop","qsdfghjklm","^ wxcvbn ~"],qwertz:["qwertzuiop"," asdfghjkl ","^yxcvbnm~"],dvorak:["^ pyfgcrl ","aoeuidhtns","qjkxbmwvz~"],colemak:[" qwfpgjluy ","arstdhneio","^zxcvbkm~"]},p=(i=u[a])!=null?i:u.qwerty,m=a==="azerty"?[[{label:"1",variants:"1"},{label:"2",shift:{latex:"\xE9"},variants:"2"},{label:"3",shift:{latex:"\xF9"},variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{label:"(",latex:"("},variants:"5"},{label:"6",shift:{label:")",latex:")"},variants:"6"},{label:"7",shift:{latex:"\xE8"},variants:"7"},{label:"8",shift:{latex:"\xEA"},variants:"8"},{label:"9",shift:{latex:"\xE7"},variants:"9"},{label:"0",shift:{latex:"\xE0"},variants:"0"}]]:[[{label:"1",variants:"1"},{label:"2",variants:"2"},{label:"3",variants:"3"},{label:"4",variants:"4"},{label:"5",shift:{latex:"\\frac{#@}{#?}"},variants:"5"},{label:"6",shift:{latex:"#@^#?"},variants:"6"},{label:"7",variants:"7"},{label:"8",shift:{latex:"\\times"},variants:"8"},{label:"9",shift:{label:"(",latex:"("},variants:"9"},{label:"0",shift:{label:")",latex:")"},variants:"0"}]];for(const b of p){const w=[];for(const E of b)/[a-z]/.test(E)?w.push({label:E,class:"hide-shift",shift:{label:E.toUpperCase()},variants:$0(E)?E:void 0}):E==="~"?a!=="dvorak"?w.push("[backspace]"):w.push({label:"[backspace]",width:1}):E==="^"?w.push("[shift]"):E===" "&&w.push("[separator-5]");m.push(w)}return m.push(["[-]","[+]","[=]",{label:" ",width:1.5},{label:",",shift:";",variants:".",class:"hide-shift"},"[.]","[left]","[right]",{label:"[action]",width:1.5}]),{label:"abc",labelClass:"MLK__tex-math",tooltip:"keyboard.tooltip.alphabetic",layers:ih({rows:m})}}function K0(e){if(e==="alphabetic")return Em();if(typeof e=="string")return console.assert(B0[e]!==void 0,`MathLive 0.98.5: unknown keyboard layout "${e}"`),K0(B0[e]);let i;if("rows"in e&&Array.isArray(e.rows)){console.assert(!("layers"in e||"markup"in e),'MathLive 0.98.5: when providing a "rows" property, "layers" and "markup" are ignored');const u=e,{rows:p}=u,m=R(u,["rows"]);i=f(P({},m),{layers:ih({rows:e.rows})})}else if("markup"in e&&typeof e.markup=="string"){const u=e,{markup:p}=u,m=R(u,["markup"]);i=f(P({},m),{layers:ih(e.markup)})}else i=P({},e),"layers"in e?i.layers=ih(e.layers):console.error('MathLive 0.98.5: provide either a "rows", "markup" or "layers" property');let r=!1,a=!1;for(const u of i.layers)if(u.rows)for(const p of u.rows.flat()){zu(p)&&(r=!0);const m=p.command;typeof m=="string"&&["undo","redo","cut","copy","paste"].includes(m)&&(a=!0)}return(!("displayShiftedKeycaps"in e)||e.displayShiftedKeycaps===void 0)&&(i.displayShiftedKeycaps=r),(!("displayEditToolbar"in e)||e.displayEditToolbar===void 0)&&(i.displayEditToolbar=!a),i}function km(e,i){var r,a;let u='<div class="left">';if(e.normalizedLayouts.length>1)for(const[p,m]of e.normalizedLayouts.entries()){const b=m,w=[p===i?"selected":"layer-switch"];b.tooltip&&w.push("MLK__tooltip"),b.labelClass&&w.push(...b.labelClass.split(" ")),u+=`<div class="${w.join(" ")}"`,b.tooltip&&(u+=" data-tooltip='"+((r=V(b.tooltip))!=null?r:b.tooltip)+"' "),p!==i&&(u+=`data-layer="${b.layers[0].id}"`),u+=`>${(a=b.label)!=null?a:"untitled"}</div>`}return u+="</div>",u}function Tm(e,i){let r="";if(e.editToolbar==="none")return"";const u=[];i.selectionIsCollapsed?u.push("undo","redo","pasteFromClipboard"):u.push("cutToClipboard","copyToClipboard","pasteFromClipboard");const p={undo:`<div class='action ${i.canUndo===!1?"disabled":""}'
data-command='"undo"'
data-tooltip='${V("tooltip.undo")}'>
<svg><use xlink:href='#svg-undo' /></svg>
</div>`,redo:`<div class='action ${i.canRedo===!1?"disabled":""}'
data-command='"redo"'
data-tooltip='${V("tooltip.redo")}'>
<svg><use xlink:href='#svg-redo' /></svg>
</div>`,cutToClipboard:`
<div class='action'
data-command='"cutToClipboard"'
data-tooltip='${V("tooltip.cut to clipboard")}'>
<svg><use xlink:href='#svg-cut' /></svg>
</div>
`,copyToClipboard:`
<div class='action'
data-command='"copyToClipboard"'
data-tooltip='${V("tooltip.copy to clipboard")}'>
<svg><use xlink:href='#svg-copy' /></svg>
</div>
`,pasteFromClipboard:`
<div class='action'
data-command='"pasteFromClipboard"'
data-tooltip='${V("tooltip.paste from clipboard")}'>
<svg><use xlink:href='#svg-paste' /></svg>
</div>
`};return r+=u.map(m=>p[m]).join(""),r}function Am(e){for(const i of e)Lm(i)}function Lm(e){const i=al.singleton;if(!i)return;const r={};if(!e.id){if(e.hasAttribute("data-label")&&(r.label=e.dataset.label),e.hasAttribute("data-latex")&&(r.latex=e.dataset.latex),e.hasAttribute("data-key")&&(r.key=e.dataset.key),e.hasAttribute("data-insert")&&(r.insert=e.dataset.insert),e.hasAttribute("data-variants")&&(r.variants=e.dataset.variants),e.hasAttribute("data-aside")&&(r.aside=e.dataset.aside),e.className&&(r.class=e.className),!r.label&&!r.latex&&!r.key&&!r.insert&&(r.latex=e.innerText,r.label=e.innerHTML),e.hasAttribute("data-command"))try{r.command=JSON.parse(e.dataset.command)}catch(a){}e.id=i.registerKeycap(r)}if(!e.innerHTML){const[a,u]=Of(r);e.innerHTML=window.MathfieldElement.createHTML(a)}}function Dm(){_a("virtual-keyboard"),_a("core"),rl()}function Cm(){na("core"),na("virtual-keyboard")}var Mm=`<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-delete-backward" viewBox="0 0 576 512">
<path d="M432.1 208.1L385.9 256L432.1 303C442.3 312.4 442.3 327.6 432.1 336.1C423.6 346.3 408.4 346.3 399 336.1L352 289.9L304.1 336.1C295.6 346.3 280.4 346.3 271 336.1C261.7 327.6 261.7 312.4 271 303L318.1 256L271 208.1C261.7 199.6 261.7 184.4 271 175C280.4 165.7 295.6 165.7 304.1 175L352 222.1L399 175C408.4 165.7 423.6 165.7 432.1 175C442.3 184.4 442.3 199.6 432.1 208.1V208.1zM512 64C547.3 64 576 92.65 576 128V384C576 419.3 547.3 448 512 448H205.3C188.3 448 172 441.3 160 429.3L9.372 278.6C3.371 272.6 0 264.5 0 256C0 247.5 3.372 239.4 9.372 233.4L160 82.75C172 70.74 188.3 64 205.3 64L512 64zM528 128C528 119.2 520.8 112 512 112H205.3C201 112 196.9 113.7 193.9 116.7L54.63 256L193.9 395.3C196.9 398.3 201 400 205.3 400H512C520.8 400 528 392.8 528 384V128z"/>
</symbol>
<symbol id="svg-shift" viewBox="0 0 384 512">
<path d="M2.438 252.3C7.391 264.2 19.06 272 32 272h80v160c0 26.51 21.49 48 48 48h64C250.5 480 272 458.5 272 432v-160H352c12.94 0 24.61-7.797 29.56-19.75c4.953-11.97 2.219-25.72-6.938-34.88l-160-176C208.4 35.13 200.2 32 192 32S175.6 35.13 169.4 41.38l-160 176C.2188 226.5-2.516 240.3 2.438 252.3zM192 86.63L313.4 224H224v208H160V224H70.63L192 86.63z"/>
</symbol>
<symbol id="svg-commit" viewBox="0 0 512 512">
<path d="M135 432.1l-128-128C2.344 300.3 0 294.2 0 288s2.344-12.28 7.031-16.97l128-128c9.375-9.375 24.56-9.375 33.94 0s9.375 24.56 0 33.94L81.94 264H464v-208C464 42.75 474.8 32 488 32S512 42.75 512 56V288c0 13.25-10.75 24-24 24H81.94l87.03 87.03c9.375 9.375 9.375 24.56 0 33.94S144.4 442.3 135 432.1z"/>
</symbol>
<symbol id="circle-plus" viewBox="0 0 512 512"><path d="M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM232 344c0 13.3 10.7 24 24 24s24-10.7 24-24V280h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H280V168c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H168c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"/></symbol>
<symbol id="svg-command" viewBox="0 0 640 512">
<path d="M34.495 36.465l211.051 211.05c4.686 4.686 4.686 12.284 0 16.971L34.495 475.535c-4.686 4.686-12.284 4.686-16.97 0l-7.071-7.07c-4.686-4.686-4.686-12.284 0-16.971L205.947 256 10.454 60.506c-4.686-4.686-4.686-12.284 0-16.971l7.071-7.07c4.686-4.687 12.284-4.687 16.97 0zM640 468v-10c0-6.627-5.373-12-12-12H300c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h328c6.627 0 12-5.373 12-12z"/>
</symbol>
<symbol id="svg-undo" viewBox="0 0 512 512">
<path d="M20 8h10c6.627 0 12 5.373 12 12v110.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H180c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V20c0-6.627 5.373-12 12-12z"/>
</symbol>
<symbol id="svg-redo" viewBox="0 0 512 512">
<path d="M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z"/>
</symbol>
<symbol id="svg-arrow-left" viewBox="0 0 320 512">
<path d="M206.7 464.6l-183.1-191.1C18.22 267.1 16 261.1 16 256s2.219-11.97 6.688-16.59l183.1-191.1c9.152-9.594 24.34-9.906 33.9-.7187c9.625 9.125 9.938 24.37 .7187 33.91L73.24 256l168 175.4c9.219 9.5 8.906 24.78-.7187 33.91C231 474.5 215.8 474.2 206.7 464.6z"/>
</symbol>
<symbol id="svg-arrow-right" viewBox="0 0 320 512">
<path d="M113.3 47.41l183.1 191.1c4.469 4.625 6.688 10.62 6.688 16.59s-2.219 11.97-6.688 16.59l-183.1 191.1c-9.152 9.594-24.34 9.906-33.9 .7187c-9.625-9.125-9.938-24.38-.7187-33.91l168-175.4L78.71 80.6c-9.219-9.5-8.906-24.78 .7187-33.91C88.99 37.5 104.2 37.82 113.3 47.41z"/>
</symbol>
<symbol id="svg-tab" viewBox="0 0 448 512">
<path d="M32 217.1c0-8.8 7.2-16 16-16h144v-93.9c0-7.1 8.6-10.7 13.6-5.7l143.5 143.1c6.3 6.3 6.3 16.4 0 22.7L205.6 410.4c-5 5-13.6 1.5-13.6-5.7v-93.9H48c-8.8 0-16-7.2-16-16v-77.7m-32 0v77.7c0 26.5 21.5 48 48 48h112v61.9c0 35.5 43 53.5 68.2 28.3l143.6-143c18.8-18.8 18.8-49.2 0-68L228.2 78.9c-25.1-25.1-68.2-7.3-68.2 28.3v61.9H48c-26.5 0-48 21.6-48 48zM436 64h-8c-6.6 0-12 5.4-12 12v360c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12V76c0-6.6-5.4-12-12-12z"/>
</symbol>
<symbol id="svg-paste" viewBox="0 0 512 512"><path d="M160 32c11.6 0 21.3 8.2 23.5 19.2C185 58.6 191.6 64 199.2 64H208c8.8 0 16 7.2 16 16V96H96V80c0-8.8 7.2-16 16-16h8.8c7.6 0 14.2-5.4 15.7-12.8C138.7 40.2 148.4 32 160 32zM64 64h2.7C65 69 64 74.4 64 80V96c0 17.7 14.3 32 32 32H224c17.7 0 32-14.3 32-32V80c0-5.6-1-11-2.7-16H256c17.7 0 32 14.3 32 32h32c0-35.3-28.7-64-64-64H210.6c-9-18.9-28.3-32-50.6-32s-41.6 13.1-50.6 32H64C28.7 32 0 60.7 0 96V384c0 35.3 28.7 64 64 64H192V416H64c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32zM288 480c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32h96v56c0 22.1 17.9 40 40 40h56V448c0 17.7-14.3 32-32 32H288zM416 165.3L474.7 224H424c-4.4 0-8-3.6-8-8V165.3zM448 512c35.3 0 64-28.7 64-64V235.9c0-12.7-5.1-24.9-14.1-33.9l-59.9-59.9c-9-9-21.2-14.1-33.9-14.1H288c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H448z"/></symbol>
<symbol id="svg-cut" viewBox="0 0 512 512"><path d="M485.6 444.2L333.6 314.9C326.9 309.2 326.1 299.1 331.8 292.4C337.5 285.6 347.6 284.8 354.4 290.5L506.4 419.8C513.1 425.5 513.9 435.6 508.2 442.4C502.5 449.1 492.4 449.9 485.6 444.2zM485.7 67.76C492.5 62.07 502.5 62.94 508.2 69.69C513.9 76.45 513.1 86.55 506.3 92.24L208.5 343.1C218.3 359.7 224 379.2 224 400C224 461.9 173.9 512 112 512C50.14 512 0 461.9 0 400C0 338.1 50.14 288 112 288C141.5 288 168.4 299.4 188.4 318.1L262.2 256L188.4 193.9C168.4 212.6 141.5 224 112 224C50.14 224 0 173.9 0 112C0 50.14 50.14 0 112 0C173.9 0 224 50.14 224 112C224 132.8 218.3 152.3 208.5 168.9L287 235.1L485.7 67.76zM32 112C32 156.2 67.82 192 112 192C156.2 192 192 156.2 192 112C192 67.82 156.2 32 112 32C67.82 32 32 67.82 32 112zM112 480C156.2 480 192 444.2 192 400C192 355.8 156.2 320 112 320C67.82 320 32 355.8 32 400C32 444.2 67.82 480 112 480z"/></symbol>
<symbol id="svg-copy" viewBox="0 0 512 512"><path d="M272 416C263.2 416 256 423.2 256 432V448c0 17.67-14.33 32-32 32H64c-17.67 0-32-14.33-32-32V192c0-17.67 14.33-32 32-32h112C184.8 160 192 152.8 192 144C192 135.2 184.8 128 176 128H63.99c-35.35 0-64 28.65-64 64l.0098 256C0 483.3 28.65 512 64 512h160c35.35 0 64-28.65 64-64v-16C288 423.2 280.8 416 272 416zM502.6 86.63l-77.25-77.25C419.4 3.371 411.2 0 402.7 0H288C252.7 0 224 28.65 224 64v256c0 35.35 28.65 64 64 64h160c35.35 0 64-28.65 64-64V109.3C512 100.8 508.6 92.63 502.6 86.63zM416 45.25L466.7 96H416V45.25zM480 320c0 17.67-14.33 32-32 32h-160c-17.67 0-32-14.33-32-32V64c0-17.67 14.33-32 32-32h96l.0026 64c0 17.67 14.33 32 32 32H480V320z"/>
</symbol>
<symbol id="svg-angle-double-right" viewBox="0 0 512 512"><path d="M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z"/>
</symbol>
<symbol id="svg-angle-double-left" viewBox="0 0 512 512"><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z"/>
</symbol>
<symbol id="svg-trash" viewBox="0 0 448 512">
<path d="M336 64l-33.6-44.8C293.3 7.1 279.1 0 264 0h-80c-15.1 0-29.3 7.1-38.4 19.2L112 64H24C10.7 64 0 74.7 0 88v2c0 3.3 2.7 6 6 6h26v368c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V96h26c3.3 0 6-2.7 6-6v-2c0-13.3-10.7-24-24-24h-88zM184 32h80c5 0 9.8 2.4 12.8 6.4L296 64H152l19.2-25.6c3-4 7.8-6.4 12.8-6.4zm200 432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V96h320v368zm-176-44V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm-80 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zm160 0V156c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v264c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12z"/>
</symbol>
<symbol id="svg-keyboard-down" viewBox="0 0 576 512"><path d="M64 48c-8.8 0-16 7.2-16 16V240c0 8.8 7.2 16 16 16H512c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64zM0 64C0 28.7 28.7 0 64 0H512c35.3 0 64 28.7 64 64V240c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM159 359c9.4-9.4 24.6-9.4 33.9 0l95 95 95-95c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9L305 505c-4.5 4.5-10.6 7-17 7s-12.5-2.5-17-7L159 393c-9.4-9.4-9.4-24.6 0-33.9zm1-167c0-8.8 7.2-16 16-16H400c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V192zM120 88h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H120c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H200c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H280c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16zm64 16c0-8.8 7.2-16 16-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H360c-8.8 0-16-7.2-16-16V104zm96-16h16c8.8 0 16 7.2 16 16v16c0 8.8-7.2 16-16 16H440c-8.8 0-16-7.2-16-16V104c0-8.8 7.2-16 16-16z"/></symbol>
</svg>`;function Im(e){e.resetKeycapRegistry(),Dm();const i=document.createElement("div");i.className="ML__keyboard";const r=document.createElement("div");r.className="MLK__plate",r.innerHTML=window.MathfieldElement.createHTML(Mm+e.normalizedLayouts.map((m,b)=>Rm(e,m,b)).join(""));const a=document.createElement("div");a.className="MLK__backdrop",a.appendChild(r),i.appendChild(a),i.addEventListener("pointerdown",Om,{passive:!1});const u=i.querySelectorAll(".ML__edit-toolbar");if(u)for(const m of u)m.addEventListener("click",b=>{var w,E;let I=b.target,N="";for(;I&&!N;)N=(w=I==null?void 0:I.getAttribute("data-command"))!=null?w:"",I=(E=I==null?void 0:I.parentElement)!=null?E:null;N&&e.executeCommand(JSON.parse(N))});Am(i.querySelectorAll(".MLK__keycap, .action, .fnbutton, .bigfnbutton"));const p=i.querySelectorAll(".MLK__layer");console.assert(p.length>0,"No virtual keyboards available");for(const m of p)m.addEventListener("pointerdown",b=>b.preventDefault());return e.currentLayer=e.latentLayer,i}function Rm(e,i,r){const a=[];if(!("layers"in i))return"";for(const u of i.layers)a.push(`<div tabindex="-1" class="MLK__layer" id="${u.id}">`),(e.normalizedLayouts.length>1||i.displayEditToolbar)&&(a.push("<div class='MLK__toolbar' role='toolbar'>"),a.push(km(e,r)),i.displayEditToolbar&&a.push('<div class="ML__edit-toolbar right"></div>'),a.push("</div>")),a.push(Pm(e,u)),a.push("</div>");return a.join("")}function Pm(e,i){if(typeof i=="string")return i;let r="";if(typeof i.style=="string"?r+=`<style>${i.style}</style>`:typeof i.style=="object"&&(r+=`<style>${Sm(i.style)}</style>`),i.backdrop&&(r+=`<div class='${i.backdrop}'>`),i.container&&(r+=`<div class='${i.container}'>`),i.rows){r+="<div class=MLK__rows>";for(const a of i.rows){r+="<div dir='ltr' class=MLK__row>";for(const u of a)if(u){const p=e.registerKeycap(u),[m,b]=Of(u);/(^|\s)separator/.test(b)?r+=`<div class="${b}"`:r+=`<div tabindex="-1" id="${p}" class="${b}"`,u.tooltip&&(r+=` data-tooltip="${u.tooltip}"`),r+=`>${m}</div>`}r+="</div>"}r+="</div>"}else i.markup&&(r+=i.markup);return i.container&&(r+="</div>"),i.backdrop&&(r+="</div>"),r}function Of(e,i={shifted:!1}){var r,a,u,p,m,b,w;let E="",I=(r=e.class)!=null?r:"";if(i.shifted&&zu(e)&&(I+=" is-active"),i.shifted&&"shift"in e)typeof e.shift=="string"?E=th(e.shift):typeof e.shift=="object"&&(E=e.shift.label?e.shift.label:(a=th(e.shift.latex||e.shift.insert||"")||e.shift.key)!=null?a:""),typeof e.shift=="object"&&(I=(p=(u=e.shift.class)!=null?u:e.class)!=null?p:"");else{if(E=e.label?e.label:(m=th(e.latex||e.insert||"")||e.key)!=null?m:"",e.shift){let N;typeof e.shift=="string"?N=th(e.shift):e.shift.label?N=e.shift.label:N=(b=th(e.shift.latex||e.shift.insert||"")||e.shift.key)!=null?b:"",E+=`<span class="MLK__shift">${N}</span>`}e.aside&&(E+=`<aside>${e.aside}</aside>`)}return e.layer&&!/layer-switch/.test(I)&&(I+=" layer-switch"),/(^|\s)(separator|action|shift|fnbutton|bigfnbutton)($|\s)/.test(I)||(I+=" MLK__keycap"),!/\bw[0-9]+\b/.test(I)&&e.width&&(I+=(w={0:" w0",.5:" w5",1.5:" w15",2:" w20",5:" w50"}[e.width])!=null?w:""),[E,I||"MLK__keycap"]}var Ul={"[left]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-left /></svg>",command:["performWithFeedback","moveToPreviousChar"],shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-left /></svg>",command:["performWithFeedback","extendSelectionBackward"]}},"[right]":{class:"action hide-shift",label:"<svg class=svg-glyph><use xlink:href=#svg-arrow-right /></svg>",command:["performWithFeedback","moveToNextChar"],shift:{label:"<svg class=svg-glyph><use xlink:href=#svg-angle-double-right /></svg>",command:["performWithFeedback","extendSelectionForward"]}},"[up]":{class:"action hide-shift",label:"\u2191",command:["performWithFeedback","moveUp"],shift:{label:"\u219F",command:["performWithFeedback","extendSelectionUpward"]}},"[down]":{class:"action hide-shift",label:"\u2193",command:["performWithFeedback","moveDown"],shift:{label:"\u21A1",command:["performWithFeedback","extendSelectionDownward"]}},"[return]":{class:"action hide-shift",command:["performWithFeedback","commit"],shift:{command:["performWithFeedback","addRowAfter"]},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[action]":{class:"action hide-shift",command:["performWithFeedback","commit"],shift:{label:"<svg class=svg-glyph><use xlink:href=#circle-plus /></svg>",command:["performWithFeedback","addRowAfter"]},width:1.5,label:"<svg class=svg-glyph><use xlink:href=#svg-commit /></svg>"},"[hr]":{class:"separator horizontal-rule"},"[hide-keyboard]":{class:"action",command:["hideVirtualKeyboard"],width:1.5,label:"<svg class=svg-glyph-lg><use xlink:href=#svg-keyboard-down /></svg>"},"[.]":{variants:".",command:["performWithFeedback","insertDecimalSeparator"],shift:",",class:"big-op hide-shift",label:"."},"[,]":{variants:",",command:["performWithFeedback","insertDecimalSeparator"],shift:".",class:"big-op hide-shift",label:","},"[+]":{variants:[{latex:"\\sum_{#0}^{#0}",class:"small"},"\\oplus"],latex:"+",label:"+",class:"big-op hide-shift",shift:{latex:"\\sum",insert:"\\sum",class:"small"}},"[-]":{variants:["\\pm","\\ominus"],latex:"-",label:"&#x2212;",shift:"\\pm",class:"big-op hide-shift"},"[/]":{class:"big-op hide-shift",shift:{class:"",latex:"\\frac{1}{#@}"},variants:["/","\\div","\\%","\\oslash"],latex:"\\frac{#@}{#?}",label:"&divide;"},"[*]":{variants:[{latex:"\\prod_{#0}^{#0}",class:"small"},"\\otimes","\\cdot"],latex:"\\cdot",label:"&times;",shift:{latex:"\\times"},class:"big-op hide-shift"},"[=]":{variants:["\\neq","\\equiv","\\varpropto","\\thickapprox","\\lt","\\gt","\\le","\\ge"],latex:"=",label:"=",shift:{label:"\u2260",latex:"\\ne"},class:"big-op hide-shift"},"[backspace]":{class:"action bottom right hide-shift",width:1.5,command:["performWithFeedback","deleteBackward"],label:"<svg class=svg-glyph><use xlink:href=#svg-delete-backward /></svg>",shift:{class:"action warning",label:"<svg class=svg-glyph><use xlink:href=#svg-trash /></svg>",command:"deleteAll"}},"[undo]":{class:"ghost if-can-undo",command:"undo",label:"<svg class=svg-glyph><use xlink:href=#svg-undo /></svg>",tooltip:"tooltip.undo"},"[redo]":{class:"ghost if-can-redo",command:"redo",label:"<svg class=svg-glyph><use xlink:href=#svg-redo /></svg>",tooltip:"tooltip.redo"},"[(]":{variants:[{latex:"\\lbrack",key:"["},"\\langle","\\lfloor","\\lceil",{latex:"\\lbrace",key:"{"}],key:"(",label:"(",shift:{label:"[",key:"["},class:"hide-shift"},"[)]":{variants:[{latex:"\\rbrack",key:"]"},"\\rangle","\\rfloor","\\rceil",{latex:"\\rbrace",key:"]"}],key:")",label:")",shift:{label:"]",latex:"\\rbrack"},class:"hide-shift"},"[0]":{variants:"0",latex:"0",label:"0",shift:"\\infty",class:"hide-shift"},"[1]":{variants:"1",latex:"1",label:"1",shift:"#@^{-1}",class:"hide-shift"},"[2]":{variants:"2",latex:"2",label:"2",shift:"#@^2",class:"hide-shift"},"[3]":{variants:"3",latex:"3",label:"3",shift:"#@^3",class:"hide-shift"},"[4]":{variants:"4",latex:"4",label:"4",shift:"#@^4",class:"hide-shift"},"[5]":{variants:"5",latex:"5",label:"5",shift:"#@^5",class:"hide-shift"},"[6]":{variants:"6",latex:"6",label:"6",shift:"#@^6",class:"hide-shift"},"[7]":{variants:"7",latex:"7",label:"7",shift:"#@^7",class:"hide-shift"},"[8]":{variants:"8",latex:"8",label:"8",shift:"#@^8",class:"hide-shift"},"[9]":{variants:"9",latex:"9",label:"9",shift:"#@^9",class:"hide-shift"},"[separator-5]":{class:"separator",width:.5},"[separator]":{class:"separator"},"[separator-10]":{class:"separator"},"[separator-15]":{class:"separator",width:1.5},"[separator-20]":{class:"separator",width:2},"[separator-50]":{class:"separator",width:5},"[shift]":{class:"shift bottom left",width:1.5,label:"<span class=caps-lock-indicator></span><svg class=svg-glyph><use xlink:href=#svg-shift /></svg>"},"[foreground-color]":{variants:"foreground-color",command:["applyStyle",{color:"red"}],label:"<span style='border-radius: 50%;width:22px;height:22px; border: 3px solid #cc2428; box-sizing: border-box'>"},"[background-color]":{variants:"background-color",command:["applyStyle",{backgroundColor:"yellow"}],label:"<span style='border-radius: 50%;width:22px;height:22px; background:#fff590; box-sizing: border-box'></span>"}};function U0(e){var i;if(typeof e=="string"){if(e==="[.]"&&window.MathfieldElement.decimalSeparator===","&&(e="[,]"),!Ul[e])return{latex:e};e={label:e}}let r;return"label"in e&&e.label&&Ul[e.label]&&(r=f(P(P({},Ul[e.label]),e),{label:Ul[e.label].label})),"key"in e&&e.key&&Ul[e.key]&&(r=f(P(P({},Ul[e.key]),e),{key:Ul[e.key].key})),r?(r.command==="insertDecimalSeparator"&&(r.label=(i=window.MathfieldElement.decimalSeparator)!=null?i:"."),e.label==="[action]"&&(r=P(P({},r),window.mathVirtualKeyboard.actionKeycap)),e.label==="[shift]"&&(r=P(P({},r),window.mathVirtualKeyboard.shiftKeycap)),e.label==="[backspace]"&&(r=P(P({},r),window.mathVirtualKeyboard.backspaceKeycap)),e.label==="[tab]"&&(r=P(P({},r),window.mathVirtualKeyboard.tabKeycap)),r):e}var nh;function Om(e){var i;if(e.button!==0)return;const r=al.singleton;if(!r)return;let a=e.target;for(;a&&!a.getAttribute("data-layer");)a=a.parentElement;if(a){r.currentLayer=(i=a.getAttribute("data-layer"))!=null?i:"",e.preventDefault();return}const u=Uu(e.target);if(!(u!=null&&u.id))return;const p=r.getKeycap(u.id);if(!p)return;console.assert(e.type==="pointerdown");const m=new AbortController,b=m.signal;u.classList.add("is-pressed"),u.addEventListener("pointerenter",Ff(m),{capture:!0,signal:b}),u.addEventListener("pointerleave",Ff(m),{capture:!0,signal:b}),u.addEventListener("pointercancel",Ff(m),{signal:b}),u.addEventListener("pointerup",Ff(m),{signal:b}),zu(p)&&(u.classList.add("is-active"),r.shiftPressCount++),p.variants&&(nh&&clearTimeout(nh),nh=setTimeout(()=>{u.classList.contains("is-pressed")&&(u.classList.remove("is-pressed"),u.classList.add("is-active"),e.target&&"releasePointerCapture"in e.target&&e.target.releasePointerCapture(e.pointerId),N0(u,()=>{m.abort(),u==null||u.classList.remove("is-active")}))},300)),e.preventDefault()}function Ff(e){return i=>{const r=Uu(i.target);if(!(r!=null&&r.id))return;const a=al.singleton;if(!a)return;const u=a.getKeycap(r.id);if(u){if(i.type==="pointerenter"&&i.target===r&&i.isPrimary&&r.classList.add("is-pressed"),i.type==="pointercancel"){r.classList.remove("is-pressed"),zu(u)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted)),e.abort();return}if(i.type==="pointerleave"&&i.target===r){r.classList.remove("is-pressed"),zu(u)&&(a.shiftPressCount--,r.classList.toggle("is-active",a.isShifted));return}if(i.type==="pointerup"){nh&&clearTimeout(nh),zu(u)?r.classList.toggle("is-active",a.isShifted):r.classList.contains("is-pressed")&&(r.classList.remove("is-pressed"),a.isShifted&&u.shift?typeof u.shift=="string"?a.executeCommand(["insert",u.shift,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]):r0(u.shift):r0(u),a.shiftPressCount===1&&!i.shiftKey&&(a.shiftPressCount=0)),e.abort(),i.preventDefault();return}}}}function r0(e){var i;let r=e.command;!r&&e.insert&&(r=["insert",e.insert,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),!r&&e.key&&(r=["typedText",e.key,{focus:!0,feedback:!0,simulateKeystroke:!0}]),!r&&e.latex&&(r=["insert",e.latex,{focus:!0,feedback:!0,scrollIntoView:!0,mode:"math",format:"latex"}]),r||(r=["typedText",e.label,{focus:!0,feedback:!0,simulateKeystroke:!0}]),(i=al.singleton)==null||i.executeCommand(r)}function Fm(e){if(e.nodeType!==1)return!1;const i=e.classList;return i.contains("MLK__keycap")||i.contains("shift")||i.contains("action")||i.contains("fnbutton")||i.contains("bigfnbutton")}function Uu(e){if(!e)return;let i=e;for(;i&&!Fm(i);)i=i.parentElement;return i!=null?i:void 0}function zu(e){return!!e.class&&/(^|\s)shift($|\s)/.test(e.class)}var al=class gm{constructor(){this.originalContainerBottomPadding=null,this.keycapRegistry={},this._shiftPressCount=0;var i,r,a;this.targetOrigin=window.origin,this.originValidator="none",this._alphabeticLayout="auto",this._layouts=Object.freeze(["default"]),this._editToolbar="default",this._container=(r=(i=window.document)==null?void 0:i.body)!=null?r:null,this._visible=!1,this._rebuilding=!1,this.observer=new ResizeObserver(u=>{this.adjustBoundingRect(),this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect})}),this.listeners={};try{(a=window.top)==null||a.addEventListener("message",this)}catch(u){window.addEventListener("message",this)}document.body.addEventListener("focusin",u=>{const p=u.target;p!=null&&p.isConnected&&setTimeout(()=>{const m=z0();m&&!m.readOnly&&m.mathVirtualKeyboardPolicy==="auto"&&O()&&this.show({animate:!0})},300)}),document.addEventListener("focusout",u=>{u.target.mathVirtualKeyboardPolicy!=="manual"&&setTimeout(()=>{z0()||this.hide()},300)})}get currentLayer(){var i,r,a;return(a=(r=(i=this._element)==null?void 0:i.querySelector(".MLK__layer.is-visible"))==null?void 0:r.id)!=null?a:""}set currentLayer(i){var r;if(!this._element){this.latentLayer=i;return}let a=i?this._element.querySelector(`#${i}.MLK__layer`):null;a||(a=this._element.querySelector(".MLK__layer")),a&&((r=this._element.querySelector(".MLK__layer.is-visible"))==null||r.classList.remove("is-visible"),a.classList.add("is-visible")),this.render()}get shiftPressCount(){return this._shiftPressCount}set shiftPressCount(i){var r;this._shiftPressCount=i>2||i<0?0:i,(r=this._element)==null||r.classList.toggle("is-caps-lock",this.shiftPressCount===2),this.render()}get isShifted(){return this._shiftPressCount>0}resetKeycapRegistry(){this.keycapRegistry={}}registerKeycap(i){const r="ML__k"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36);return this.keycapRegistry[r]=i,r}getKeycap(i){return i?this.keycapRegistry[i]:void 0}getLayer(i){const r=this.normalizedLayouts;for(const a of r)for(const u of a.layers)if(u.id===i)return u}get alphabeticLayout(){return this._alphabeticLayout}set alphabeticLayout(i){this._alphabeticLayout=i,this.rebuild()}get actionKeycap(){return this._actionKeycap}set actionKeycap(i){this._actionKeycap=typeof i=="string"?{label:i}:i}get shiftKeycap(){return this._shiftKeycap}set shiftKeycap(i){this._shiftKeycap=typeof i=="string"?{label:i}:i}get backspaceKeycap(){return this._backspaceKeycap}set backspaceKeycap(i){this._backspaceKeycap=typeof i=="string"?{label:i}:i}get tabKeycap(){return this._tabKeycap}set tabKeycap(i){this._tabKeycap=typeof i=="string"?{label:i}:i}get layouts(){return this._layouts}set layouts(i){this.updateNormalizedLayouts(i),this.rebuild()}updateNormalizedLayouts(i){const r=Array.isArray(i)?[...i]:[i],a=r.findIndex(u=>u==="default");a>=0&&r.splice(a,1,"numeric","symbols","alphabetic","greek"),this._layouts=Object.freeze(r),this._normalizedLayouts=r.map(u=>K0(u))}get normalizedLayouts(){return this._normalizedLayouts||this.updateNormalizedLayouts(this._layouts),this._normalizedLayouts}get editToolbar(){return this._editToolbar}set editToolbar(i){this._editToolbar=i,this.rebuild()}get container(){return this._container}set container(i){this._container=i,this.rebuild()}static get singleton(){if(this._singleton===void 0)try{this._singleton=new gm}catch(i){this._singleton=null}return this._singleton}get style(){return this._style}addEventListener(i,r,a){this.listeners[i]||(this.listeners[i]=new Set),this.listeners[i].has(r)||this.listeners[i].add(r)}dispatchEvent(i){return!this.listeners[i.type]||this.listeners[i.type].size===0?!0:(this.listeners[i.type].forEach(r=>{typeof r=="function"?r(i):r==null||r.handleEvent(i)}),!i.defaultPrevented)}removeEventListener(i,r,a){this.listeners[i]&&this.listeners[i].delete(r)}get element(){return this._element}set element(i){var r;this._element!==i&&((r=this._element)==null||r.remove(),this._element=i)}get visible(){return this._visible}set visible(i){i?this.show():this.hide()}get boundingRect(){var i;if(!this._visible)return new DOMRect;const r=(i=this._element)==null?void 0:i.getElementsByClassName("MLK__plate")[0];return r?r.getBoundingClientRect():new DOMRect}adjustBoundingRect(){var i,r;const a=this.boundingRect.height;if(this.container===document.body){(i=this._element)==null||i.style.setProperty("--_keyboard-height",`calc(${a}px + var(--_padding-top) + var(--_padding-bottom) + env(safe-area-inset-bottom, 0))`);const u=a-1;this.container.style.paddingBottom=this.originalContainerBottomPadding?`calc(${this.originalContainerBottomPadding} + ${u}px)`:`${u}px`}else(r=this._element)==null||r.style.setProperty("--_keyboard-height",`${a}px`)}rebuild(){if(this._rebuilding||!this._element)return;this._rebuilding=!0;const i=this.currentLayer;requestAnimationFrame(()=>{this._rebuilding=!1,this._element&&(this._element.remove(),this._element=void 0),this.visible&&(this.buildAndAttachElement(),this.currentLayer=i,this.render(),this.adjustBoundingRect(),this._element.classList.add("is-visible"))})}render(){if(!this._element)return;const i=this.getLayer(this.currentLayer);this._element.classList.toggle("backdrop-is-transparent",!!(i&&(i.backdrop||i.container)));const r=this._element.querySelectorAll(".MLK__layer.is-visible .MLK__keycap, .MLK__layer.is-visible .action, .fnbutton, .MLK__layer.is-visible .bigfnbutton, .MLK__layer.is-visible .shift");if(r)for(const a of r){const u=this.getKeycap(a.id);if(u){const[p,m]=Of(u,{shifted:this.isShifted});a.innerHTML=window.MathfieldElement.createHTML(p),a.className=m}}}show(i){var r;if(this._visible)return;const a=this.container;if(a&&window.mathVirtualKeyboard&&this.stateWillChange(!0)){if(this._element||(this.buildAndAttachElement(),this.adjustBoundingRect()),!this._visible){const u=this._element.getElementsByClassName("MLK__plate")[0];if(u&&this.observer.observe(u),a===window.document.body){const p=a.style.paddingBottom;this.originalContainerBottomPadding=p;const m=u.offsetHeight-1;a.style.paddingBottom=p?`calc(${p} + ${m}px)`:`${m}px`}window.addEventListener("mouseup",this),window.addEventListener("blur",this),window.addEventListener("keydown",this,{capture:!0}),window.addEventListener("keyup",this,{capture:!0}),(r=this._element)==null||r.classList.toggle("is-caps-lock",this.shiftPressCount===2),this.currentLayer=this.latentLayer}this._visible=!0,i!=null&&i.animate?requestAnimationFrame(()=>{this._element&&(this._element.classList.add("animate"),this._element.addEventListener("transitionend",()=>{var u;return(u=this._element)==null?void 0:u.classList.remove("animate")},{once:!0}),this._element.classList.add("is-visible"),this.stateChanged())}):(this._element.classList.add("is-visible"),this.stateChanged())}}hide(i){var r;const a=this.container;if(a&&this._visible&&this.stateWillChange(!1)){if(this._visible=!1,this._element){this.latentLayer=this.currentLayer;const u=this._element.getElementsByClassName("MLK__plate")[0];u&&this.observer.unobserve(u),window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("keydown",this,{capture:!0}),window.removeEventListener("keyup",this,{capture:!0}),window.removeEventListener("contextmenu",this,{capture:!0}),eh(),Cm(),(r=this._element)==null||r.remove(),this._element=void 0,this.originalContainerBottomPadding!==null&&(a.style.paddingBottom=this.originalContainerBottomPadding)}this.stateChanged()}}get height(){var i,r;return(r=(i=this.element)==null?void 0:i.offsetHeight)!=null?r:0}buildAndAttachElement(){var i;console.assert(!this.element),this.element=Im(this),window.addEventListener("contextmenu",this,{capture:!0}),this.element.addEventListener("contextmenu",r=>{r.shiftKey||((r.ctrlKey||r.button===2)&&N0(r.target),r.preventDefault(),r.stopPropagation())},{capture:!0}),(i=this.container)==null||i.appendChild(this.element)}handleEvent(i){if(n0(i)){if(!Ic(i.origin,this.originValidator))throw new DOMException(`Message from unknown origin (${i.origin}) cannot be handled`,"SecurityError");i.data.action==="disconnect"?this.connectedMathfieldWindow=void 0:i.data.action!=="update-setting"&&i.data.action!=="proxy-created"&&i.data.action!=="execute-command"&&(console.assert(i.source!==void 0),this.connectedMathfieldWindow=i.source),this.handleMessage(i.data,i.source)}if(this._element)switch(i.type){case"mouseup":case"blur":document.body.style.userSelect="",this.shiftPressCount=0;break;case"contextmenu":i.button!==2&&i.preventDefault();break;case"keydown":{i.key==="Shift"&&!i.repeat&&(this.shiftPressCount=1);break}case"keyup":{(i.key==="Shift"||!i.getModifierState("Shift")&&this.shiftPressCount!==2)&&(this.shiftPressCount=0);break}}}handleMessage(i,r){const{action:a}=i;if(a==="execute-command"){const{command:u}=i,p=ra(u);if(window.top!==void 0&&p!=="virtual-keyboard")return;this.executeCommand(u);return}if((a==="connect"||a==="show")&&this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},r),a!=="disconnect"&&window===window.top){if(a==="show"){typeof i.animate!="undefined"?this.show({animate:i.animate}):this.show();return}if(a==="hide"){typeof i.animate!="undefined"?this.hide({animate:i.animate}):this.hide();return}if(a==="update-setting"){i.alphabeticLayout&&(this.alphabeticLayout=i.alphabeticLayout),i.layouts&&(this.layouts=i.layouts),i.editToolbar&&(this.editToolbar=i.editToolbar);return}if(a==="proxy-created"){this.sendMessage("synchronize-proxy",{boundingRect:this.boundingRect,alphabeticLayout:this._alphabeticLayout,layouts:this._layouts,editToolbar:this._editToolbar},r);return}}}sendMessage(i,r,a){if(a||(a=this.connectedMathfieldWindow),this.targetOrigin===null||this.targetOrigin==="null"||a===window){window.dispatchEvent(new MessageEvent("message",{source:window,data:P({type:Na,action:i},r)}));return}if(a)a.postMessage(P({type:Na,action:i},r),{targetOrigin:this.targetOrigin});else if(r.command&&this.dispatchEvent(new CustomEvent("math-virtual-keyboard-command",{detail:r.command})),i==="execute-command"&&Array.isArray(r.command)&&r.command[0]==="insert"){const u=r.command[1].split("");for(const p of u)this.dispatchEvent(new KeyboardEvent("keydown",{key:p,bubbles:!0})),this.dispatchEvent(new KeyboardEvent("keyup",{key:p,bubbles:!0}))}}stateWillChange(i){return this.dispatchEvent(new CustomEvent("before-virtual-keyboard-toggle",{detail:{visible:i},bubbles:!0,cancelable:!0,composed:!0}))}stateChanged(){this.dispatchEvent(new Event("virtual-keyboard-toggle")),this._visible||(this.dispatchEvent(new Event("geometrychange")),this.sendMessage("geometry-changed",{boundingRect:this.boundingRect}))}focus(){this.sendMessage("focus",{})}blur(){this.sendMessage("blur",{})}updateToolbar(i){const r=this._element;if(!r)return;r.classList.toggle("is-math-mode",i.mode==="math"),r.classList.toggle("is-text-mode",i.mode==="text"),r.classList.toggle("can-undo",i.canUndo),r.classList.toggle("can-redo",i.canRedo),r.classList.toggle("can-copy",!i.selectionIsCollapsed),r.classList.toggle("can-copy",!i.selectionIsCollapsed),r.classList.toggle("can-paste",!0);const a=r.querySelectorAll(".ML__edit-toolbar");if(a)for(const u of a)u.innerHTML=Tm(this,i)}update(i){this._style=i.style,this.updateToolbar(i)}connect(){this.connectedMathfieldWindow=window}disconnect(){this.connectedMathfieldWindow=void 0}executeCommand(i){let r,a=[],u=ra(i);return k(i)?(r=i[0],r==="performWithFeedback"&&(i=i.slice(1),u=ra(i)),a=i.slice(1)):r=i,r=r.replace(/-\w/g,p=>p[1].toUpperCase()),u==="virtual-keyboard"?js[r].fn(void 0,...a):(this.sendMessage("execute-command",{command:i}),!1)}dispose(){window.removeEventListener("mouseup",this),window.removeEventListener("blur",this),window.removeEventListener("message",this)}};function z0(){var e,i;let r=x(),a=null;for(;r;){if("host"in r&&((i=(e=r.host)==null?void 0:e.tagName)==null?void 0:i.toLowerCase())==="math-field"){a=r.host;break}r=r.parentNode}return a}if(C()&&!("mathVirtualKeyboard"in window))if(window===window.top){const e=al.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>e})}else Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>ym.singleton,configurable:!0});function Bf(e){const i={};for(const r of Object.keys(e))switch(r){case"scriptDepth":const a=e.scriptDepth;if(k(a))i.scriptDepth=[a[0],a[1]];else if(typeof a=="number")i.scriptDepth=[a,a];else if(typeof a=="string"){const[p,m]=a.split(",").map(b=>parseInt(b.trim()));i.scriptDepth=[p,m]}else throw new TypeError("Unexpected value for scriptDepth");break;case"mathVirtualKeyboardPolicy":let u=e.mathVirtualKeyboardPolicy.toLowerCase();if(u==="sandboxed"){if(window!==window.top){const p=al.singleton;Object.defineProperty(window,"mathVirtualKeyboard",{get:()=>p})}u="manual"}i.mathVirtualKeyboardPolicy=u;break;case"letterShapeStyle":e.letterShapeStyle==="auto"?$.locale.startsWith("fr")?i.letterShapeStyle="french":i.letterShapeStyle="tex":i.letterShapeStyle=e.letterShapeStyle;break;case"defaultMode":["text","math","inline-math"].includes(e.defaultMode)?i.defaultMode=e.defaultMode:(console.error('MathLive 0.98.5: valid values for defaultMode are "text", "math" or "inline-math"'),i.defaultMode="math");break;case"macros":i.macros=Le(e.macros);break;default:k(e[r])?i[r]=[...e[r]]:typeof e[r]=="object"&&!(e[r]instanceof Element)&&r!=="computeEngine"?i[r]=P({},e[r]):i[r]=e[r]}return i}function zl(e,i){let r;typeof i=="string"?r=[i]:i===void 0?r=Object.keys(e):r=i;const a={};for(const u of r)e[u]===null?a[u]=null:k(e[u])?a[u]=[...e[u]]:typeof e[u]=="object"&&!(e[u]instanceof Element)&&u!=="computeEngine"?a[u]=P({},e[u]):a[u]=e[u];return typeof i=="string"?a[i]:a}function Nf(){return{readOnly:!1,defaultMode:"math",macros:{},registers:{},colorMap:Ke,backgroundColorMap:Rt,letterShapeStyle:$.locale.startsWith("fr")?"french":"tex",minFontScale:0,smartMode:!1,smartFence:!0,smartSuperscript:!0,scriptDepth:[1/0,1/0],removeExtraneousParentheses:!0,isImplicitFunction:e=>["\\sin","\\cos","\\tan","\\arcsin","\\arccos","\\arctan","\\arcsec","\\arccsc","\\arsinh","\\arcosh","\\artanh","\\arcsech","\\arccsch","\\arg","\\ch","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\sec","\\sinh","\\sh","\\tanh","\\tg","\\th","\\lg","\\lb","\\log","\\ln"].includes(e),mathModeSpace:"",placeholderSymbol:"\u25A2",contentPlaceholder:"",popoverPolicy:"auto",environmentPopoverPolicy:"off",keybindings:vd,inlineShortcuts:Ac,inlineShortcutTimeout:0,mathVirtualKeyboardPolicy:"auto",virtualKeyboardTargetOrigin:window==null?void 0:window.origin,originValidator:"none",onInlineShortcut:()=>"",onScrollIntoView:null,onExport:_d,value:""}}function V0(e){return e.defaultMode==="inline-math"?"math":e.defaultMode}function ol(e,i){!e||!i||(k(e)?e.forEach(r=>ol(r,i)):typeof e=="object"&&!e.style.color&&!e.style.backgroundColor&&!e.style.fontFamily&&!e.style.fontShape&&!e.style.fontSeries&&!e.style.fontSize&&!e.style.variant&&!e.style.variantStyle&&(e.applyStyle(i),ol(e.body,i),ol(e.above,i),ol(e.below,i),ol(e.subscript,i),ol(e.superscript,i)))}function s0(e,i,r,a){function u(m,b){for(const w of p)if(w.style[m]!==b)return!1;return!0}if(i=e.normalizeRange(i),i[0]===i[1])return!1;const p=e.getAtoms(i,{includeChildren:!0});a.operation==="toggle"&&(r.color&&u("color",r.color)&&(r.color="none",delete r.verbatimColor),r.backgroundColor&&u("backgroundColor",r.backgroundColor)&&(r.backgroundColor="none",delete r.verbatimBackgroundColor),r.fontFamily&&u("fontFamily",r.fontFamily)&&(r.fontFamily="none"),r.fontSeries&&u("fontSeries",r.fontSeries)&&(r.fontSeries="auto"),r.fontShape&&u("fontShape",r.fontShape)&&(r.fontShape="auto"),r.fontSize&&u("fontSize",r.fontSize)&&(r.fontSize=gc),r.variant&&u("variant",r.variant)&&(r.variant="normal"),r.variantStyle&&u("variantStyle",r.variantStyle)&&(r.variantStyle=""));for(const m of p)m.applyStyle(r);return!0}function Bm(e,i){const r=e.at(e.position);if(r.type==="composition")r.value=i;else{const{caret:a}=r;r.caret=void 0;const u=new Mu(i,{mode:r.mode});u.caret=a,r.parent.addChildAfter(u,r),e.position+=1}}function Nm(e){const i=e.at(e.position);i.type==="composition"&&(i.parent.removeChild(i),e.position-=1)}jt(["math","displaymath"],sa),jt("center",sa),Se("displaylines","",{parse:e=>{const i=[];let r=[];e.beginContext({tabular:!0});do{if(e.end()||e.match("<}>"))break;e.matchColumnSeparator()||e.matchRowSeparator()?(i.push([r]),r=[]):r.push(...e.scan(a=>["<}>","&","\\cr","\\\\","\\tabularnewline"].includes(a)))}while(!0);return e.endContext(),i.push([r]),i},createAtom:e=>new Tn("lines",e.args,[],{leftDelim:".",rightDelim:".",columns:[{align:"l"}]})}),gt("array","{columns:colspec}",(e,i,r,a)=>new Tn(e,a0(i),r,{columns:a[0],mathstyleName:"textstyle"})),gt(["equation","equation*","subequations"],"",(e,i,r)=>new Tn(e,a0(i),r,{columns:[{align:"c"}]})),gt(["multline","multline*"],"",sa),gt(["align","align*","aligned","eqnarray"],"",sa),gt("split","",sa),gt(["gather","gathered"],"",sa),gt(["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],"[columns:colspec]",sa),gt(["smallmatrix","smallmatrix*"],"[columns:colspec]",sa),gt(["cases","dcases","rcases"],"",sa);function $m(e){for(const i of e)for(const r of i)if(r.length>0)return!1;return!0}function a0(e,i=1){return $m(e)?Array(i).fill([[new ut({type:"first"}),new ya]]):e.map(r=>r.length===0?[[new ut({type:"first"})]]:r.map(a=>a.length===0?[new ut({type:"first"})]:(a[0].type!=="first"&&a.unshift(new ut({type:"first"})),a)))}function sa(e,i=[[[]]],r=[],a=[]){switch(i=a0(i,["split","align","align*","aligned","eqnarray"].includes(e)?2:1),e){case"math":return new Tn(e,i,r,{mathstyleName:"textstyle"});case"displaymath":return new Tn(e,i,r,{mathstyleName:"textstyle"});case"center":return new Tn(e,i,r,{columns:[{align:"c"}]});case"multline":case"multline*":return new Tn(e,i,r,{columns:[{align:"m"}],leftDelim:".",rightDelim:"."});case"split":return new Tn(e,i,r,{columns:[{align:"r"},{align:"l"}],minColumns:2});case"gather":case"gathered":return new Tn(e,i,r,{columns:[{gap:.25},{align:"c"},{gap:0}]});case"pmatrix":case"pmatrix*":return new Tn(e,i,r,{mathstyleName:"textstyle",leftDelim:"(",rightDelim:")",columns:Vl(a[0])});case"bmatrix":case"bmatrix*":return new Tn(e,i,r,{mathstyleName:"textstyle",leftDelim:"[",rightDelim:"]",columns:Vl(a[0])});case"Bmatrix":case"Bmatrix*":return new Tn(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\lbrace",rightDelim:"\\rbrace",columns:Vl(a[0])});case"vmatrix":case"vmatrix*":return new Tn(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\vert",rightDelim:"\\vert",columns:Vl(a[0])});case"Vmatrix":case"Vmatrix*":return new Tn(e,i,r,{mathstyleName:"textstyle",leftDelim:"\\Vert",rightDelim:"\\Vert",columns:Vl(a[0])});case"matrix":case"matrix*":return new Tn(e,i,r,{mathstyleName:"textstyle",leftDelim:".",rightDelim:".",columns:Vl(a==null?void 0:a[0])});case"smallmatrix":case"smallmatrix*":return new Tn(e,i,r,{mathstyleName:"scriptstyle",columns:Vl(a==null?void 0:a[0]),colSeparationType:"small",arraystretch:.5});case"cases":case"dcases":return new Tn(e,i,r,{mathstyleName:e==="dcases"?"displaystyle":"textstyle",arraystretch:1.2,leftDelim:"\\lbrace",rightDelim:".",columns:[{align:"l"},{gap:1},{align:"l"}]});case"rcases":return new Tn(e,i,r,{arraystretch:1.2,leftDelim:".",rightDelim:"\\rbrace",columns:[{align:"l"},{gap:1},{align:"l"}]});case"lines":return new Tn(e,i,r,{leftDelim:".",rightDelim:".",columns:[{align:"l"}]});case"align":case"align*":case"aligned":case"eqnarray":{let u=0;for(const b of i)u=Math.max(u,b.length);const p=[{gap:0},{align:"r"},{gap:.25},{align:"l"}];let m=2;for(;m<u;)p.push({gap:1},{align:"r"},{gap:.25},{align:"l"}),m+=2;return p.push({gap:0}),new Tn(e,i,r,{arraycolsep:0,columns:p,minColumns:2})}}return new Tn(e,i,r,{mathstyleName:"textstyle"})}function Vl(e){return e!=null?e:[{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"},{align:"c"}]}function Km(e,i){let r=e.at(e.position);for(;r&&!(r.parent instanceof Tn);)r=r.parent;if(r&&r.type==="array"&&r.environmentName,!r||!(r.parent instanceof Tn)){const a=e.at(e.position);if(r=a,!r.parent.parent){let u=e.extractAtoms([e.position,e.lastOffset]),p=e.extractAtoms([0,e.position]);p.length===0&&(p=Uf()),u.length===0&&(u=Uf());let m;return i.endsWith("column")?(m=sa("split",[[p,u]]),e.root=m,Gl(m,0,0)?Hl(e,m,0,0):Gl(m,0,1)?Hl(e,m,0,1):e.position=e.offsetOf(a)):(m=sa("lines",[[p],[u]]),e.root=m,Gl(m,0,0)?Hl(e,m,0,0):Gl(m,1,0)?Hl(e,m,1,0):e.position=e.offsetOf(a)),[void 0,[0,0]]}if(r.parent instanceof ur){const u=r.parent;let p=e.extractAtoms([e.position,e.offsetOf(u.lastChild)]),m=e.extractAtoms([e.offsetOf(u.firstChild),e.position]);m.length===0&&(m=Uf()),p.length===0&&(p=Uf());let b="pmatrix";const w=u.leftDelim,E=u.rightDelim;w==="("&&(E===")"||E==="?")?b="pmatrix":(w==="["||w==="\\lbrack")&&(E==="]"||E==="\\rbrack"||E==="?")?b="bmatrix":w==="\\vert"&&E==="\\vert"?b="vmatrix":w==="\\Vert"&&E==="\\Vert"?b="Vmatrix":(w==="{"||w==="\\lbrace")&&(E==="."||E==="?")&&(b="cases");const I=sa(b,i.endsWith("column")?[[m,p]]:[[m],[p]]);return u.parent.addChildBefore(I,u),u.parent.removeChild(u),Gl(I,0,0)?Hl(e,I,0,0):i.endsWith("column")?Gl(I,0,1)?Hl(e,I,0,1):e.position=e.offsetOf(r):Gl(I,1,0)?Hl(e,I,1,0):e.position=e.offsetOf(r),[void 0,[0,0]]}}return r&&r.parent instanceof Tn?[r.parent,r.parentBranch]:[void 0,[0,0]]}function Gl(e,i,r){const a=e.getCell(i,r);return!a||a.length!==2?!1:a[1].type==="placeholder"}function Um(e,i,r,a){const u=i.getCell(r,a);return u?[e.offsetOf(u[0]),e.offsetOf(u[u.length-1])]:-1}function Hl(e,i,r,a){const u=Um(e,i,r,a);typeof u!="number"&&e.setSelection(u)}function $f(e,i,r,a,u){const p=i.getCell(r,a);p&&e.setPositionHandlingPlaceholder(e.offsetOf(p[u==="start"?0:p.length-1]))}function Kf(e,i){const[r,[a,u]]=Km(e,i);if(r)switch(i){case"after row":r.addRowAfter(a),$f(e,r,a+1,0,"end");break;case"after column":if(r.maxColumns<=r.colCount){e.announce("plonk");return}r.addColumnAfter(u),$f(e,r,a,u+1,"end");break;case"before row":r.addRowBefore(a),$f(e,r,a,0,"start");break;case"before column":if(r.maxColumns<=r.colCount){e.announce("plonk");return}r.addColumnBefore(u),$f(e,r,a,u,"start");break}}function G0(e){return e.contentWillChange({inputType:"insertText"})?(Kf(e,"after row"),e.contentDidChange({inputType:"insertText"}),!0):!1}function zm(e){return e.contentWillChange({inputType:"insertText"})?(Kf(e,"before row"),e.contentDidChange({inputType:"insertText"}),!0):!1}function H0(e){return e.contentWillChange({inputType:"insertText"})?(Kf(e,"after column"),e.contentDidChange({inputType:"insertText"}),!0):!1}function Vm(e){return e.contentWillChange({inputType:"insertText"})?(Kf(e,"before column"),e.contentDidChange({inputType:"insertText"}),!0):!1}function W0(e,i){if(!e.contentWillChange({}))return!1;e.mathfield.snapshot();let r=".",a=".";switch(i){case"pmatrix":case"pmatrix*":r="(",a=")";break;case"bmatrix":case"bmatrix*":r="[",a="]";break;case"Bmatrix":case"Bmatrix*":r="\\lbrace",a="\\rbrace";break;case"vmatrix":case"vmatrix*":r="\\vert",a="\\vert";break;case"Vmatrix":case"Vmatrix*":r="\\Vert",a="\\Vert";break;case"matrix":case"matrix*":r=".",a=".";break;case"cases":case"dcases":r="\\lbrace";break;case"rcases":a="\\rbrace";break}const u=e.at(e.position),p=u.type==="array"?u:e.parentEnvironment;return p.environmentName=i,p.leftDelim=r,p.rightDelim=a,e.contentDidChange({}),!0}function j0(e,i){let r=e.at(e.position);for(;r&&!(Array.isArray(r.parentBranch)&&r.parent instanceof Tn);)r=r.parent;if(Array.isArray(r==null?void 0:r.parentBranch)&&(r==null?void 0:r.parent)instanceof Tn){const a=r.parent,u=r.parentBranch;let p;switch(i){case"row":if(a.rowCount>1){a.removeRow(u[0]);const m=a.getCell(Math.max(0,u[0]-1),u[1]);p=e.offsetOf(m[m.length-1])}break;case"column":if(a.colCount>a.minColumns){a.removeColumn(u[1]);const m=a.getCell(u[0],Math.max(0,u[1]-1));p=e.offsetOf(m[m.length-1])}break}p&&e.setPositionHandlingPlaceholder(p)}}function Gm(e){return e.contentWillChange({inputType:"deleteContent"})?(j0(e,"row"),e.contentDidChange({inputType:"deleteContent"}),!0):!1}function Hm(e){return e.contentWillChange({inputType:"deleteContent"})?(j0(e,"column"),e.contentDidChange({inputType:"deleteContent"}),!0):!1}Jr({addRowAfter:G0,addColumnAfter:H0,addRowBefore:zm,addColumnBefore:Vm,removeRow:Gm,removeColumn:Hm,setEnvironment:W0},{target:"model",canUndo:!0,changeContent:!0,changeSelection:!0});function Uf(){return[new ya]}var q0=class _m{constructor(i){this.recording=!1,this.model=i,this.reset()}reset(){this.stack=[],this.index=-1,this.lastOp=""}startRecording(){this.recording=!0}stopRecording(){this.recording=!1}canUndo(){return this.index-1>=0}canRedo(){return this.stack.length-1>this.index}stopCoalescing(i){i&&this.index>=0&&(this.stack[this.index].selection=i),this.lastOp=""}undo(){return this.canUndo()?(this.model.setState(this.stack[this.index-1],{silenceNotifications:!1,type:"undo"}),this.index-=1,this.lastOp="",!0):!1}redo(){return this.canRedo()?(this.index+=1,this.model.setState(this.stack[this.index],{silenceNotifications:!1,type:"redo"}),this.lastOp="",!0):!1}pop(){this.canUndo()&&(this.stack.splice(this.index,this.stack.length-this.index),this.index-=1)}snapshot(i){return this.recording?(i&&i===this.lastOp&&this.pop(),this.stack.splice(this.index+1,this.stack.length-this.index-1),this.stack.push(this.model.getState()),this.index+=1,this.stack.length>_m.maximumDepth&&(this.stack.shift(),this.index-=1),this.lastOp=i!=null?i:"",!0):!1}};q0.maximumDepth=1e3;var Wm=q0;function o0(e,i,r){if(e.at(i).mode!=="text")return i;const a=r==="backward"?-1:1;let u;if(Ye.test(e.at(i).value)){let p=i,m;do m=e.at(p).mode==="text"&&Ye.test(e.at(p).value),p+=a;while(e.at(p)&&m);u=e.at(p)?p-2*a:p-a}else if(/\s/.test(e.at(i).value)){let p=i;for(;e.at(p)&&e.at(p).mode==="text"&&/\s/.test(e.at(p).value);)p+=a;if(!e.at(p))u=p-a;else{let m=!0;do m=e.at(p).mode==="text"&&!/\s/.test(e.at(p).value),p+=a;while(e.at(p)&&m);u=e.at(p)?p-2*a:p-a}}else{let p=i;for(;e.at(p)&&e.at(p).mode==="text"&&!/\s/.test(e.at(p).value);)p+=a;u=e.at(p)?p:p-a;let m=!0;for(;e.at(p)&&m;)m=e.at(p).mode==="text"&&/\s/.test(e.at(p).value),m&&(u=p),p+=a;u=e.at(p)?p-2*a:p-a}return u-(a>0?0:1)}function Vu(e,i,r){var a,u,p,m,b,w,E;const I=e.position;(a=r==null?void 0:r.extend)!=null&&a||e.collapseSelection(i);let N=e.at(e.position);if(i==="forward"&&(N.type==="subsup"?(N=N.rightSibling,N||(N=e.at(e.position+1))):N=e.at(e.position+1)),!N)return e.announce("plonk"),!1;let J=e.offsetOf(N);if(N instanceof Pa)J=o0(e,J,i);else if(N instanceof Tr)if(N.isSuggestion)for(console.assert(i==="forward");N&&N instanceof Tr;)N.isSuggestion=!1,J=e.offsetOf(N),N=N.rightSibling;else if(i==="forward"){if(N=N.rightSibling,!N||!(N instanceof Tr))return e.announce("plonk"),!1;for(;N&&N instanceof Tr&&/[a-zA-Z\*]/.test(N.value);)J=e.offsetOf(N),N=N.rightSibling}else{if(N=N.leftSibling,!N||!(N instanceof Tr))return e.announce("plonk"),!1;for(;N&&N instanceof Tr&&/[a-zA-Z\*]/.test(N.value);)J=e.offsetOf(N),N=N.leftSibling}else if(i==="forward"&&N.type==="mopen"){let oe=0;do N.type==="mopen"?oe+=1:N.type==="mclose"&&(oe-=1),N=N.rightSibling;while(!N.isLastSibling&&oe!==0);J=e.offsetOf(N.leftSibling)}else if(i==="backward"&&N.type==="mclose"){let oe=0;do N.type==="mopen"?oe+=1:N.type==="mclose"&&(oe-=1),N=N.leftSibling;while(!N.isFirstSibling&&oe!==0);J=e.offsetOf(N)}else if(i==="backward")if(N.type==="first")for(;J>0&&N.type==="first";)J-=1,N=e.at(J);else{const oe=N.type;N.type==="subsup"&&(J=e.offsetOf(e.at(J).leftSibling)),J-=1;let ge=(u=e.at(J))==null?void 0:u.type;for(;J>=0&&ge===oe;)((p=e.at(J))==null?void 0:p.type)==="subsup"?J=e.offsetOf(e.at(J).leftSibling):J-=1,ge=e.at(J).type}else{const{type:oe}=N;let ge=(m=e.at(J))==null?void 0:m.type;const{lastOffset:He}=e;for(;J<=He&&(ge===oe||ge==="subsup");){for(;((b=e.at(J).rightSibling)==null?void 0:b.type)==="subsup";)J=e.offsetOf(e.at(J).rightSibling);J+=1,ge=(w=e.at(J))==null?void 0:w.type}J-=1}if((E=r==null?void 0:r.extend)!=null&&E){if(!e.setSelection(e.anchor,J))return e.announce("plonk"),!1}else{if(J===e.position)return e.announce("plonk"),!1;e.position=J}return e.announce("move",I),e.mathfield.stopCoalescingUndo(),!0}function $a(e,i,r){var a,u;if(r=r!=null?r:{extend:!1},e.mathfield.adoptStyle=i==="backward"?"right":"left",i!=="forward"){const[b,w]=Tt(e);b!==void 0&&w!==void 0&&e.deleteAtoms([b,w])}if(i==="upward")return qm(e,r);if(i==="downward")return Zm(e,r);if(r.extend){let b=zf(e,e.position,i);b<0&&(b=0),b>e.lastOffset&&(b=e.lastOffset);const w=e.setSelection(e.anchor,b);return e.mathfield.stopCoalescingUndo(),w}if(e.selectionIsPlaceholder){e.collapseSelection(i);const b=$a(e,i);return e.mathfield.stopCoalescingUndo(),b}let p=e.position;const m=p;if(e.collapseSelection(i)?(p=e.position,Z0(e,p)||(p=zf(e,p,i))):p=zf(e,p,i),p<0||p>e.lastOffset){let b=!0;return e.silenceNotifications||(b=(u=(a=e.mathfield.host)==null?void 0:a.dispatchEvent(new CustomEvent("move-out",{detail:{direction:i},cancelable:!0,bubbles:!0,composed:!0})))!=null?u:!0),b&&e.announce("plonk"),b}return e.setPositionHandlingPlaceholder(p),e.mathfield.stopCoalescingUndo(),e.announce("move",m),!0}function zf(e,i,r){return i=i+(r==="forward"?1:-1),i<0||i>e.lastOffset||Z0(e,i)?i:zf(e,i,r)}function Z0(e,i){var r;const a=e.at(i);let u=a.parent;for(;u&&!u.inCaptureSelection;)u=u.parent;return!(u!=null&&u.inCaptureSelection||(r=a.parent)!=null&&r.skipBoundary&&(!a.isFirstSibling&&a.isLastSibling||a.type==="first")||e.mathfield.hasEditablePrompts&&!a.parentPrompt)}function jm(e,i,r){let a=1/0,u=0;for(;u<i.length;u++){const p=Rc(e.getHTMLElement(i[u])).right,m=Math.abs(r-p);if(m<=a)a=m;else break}return i[u-1]}function Vf(e,i,r,a,u){const p=e.mathfield.hasEditablePrompts,m=p?r.filter(E=>E.type==="prompt"&&!E.captureSelection):r,b=Rc(e.mathfield.getHTMLElement(i)).right,w=e.offsetOf(jm(e.mathfield,m,b))-(p?1:0);if(a){const[E,I]=e.selection.ranges[0];let N;w<(u==="up"?E:I)?N={ranges:[[w,I]],direction:"backward"}:N={ranges:[[E,w]],direction:"forward"},e.setSelection(N)}else e.setPositionHandlingPlaceholder(w);e.announce(`move ${u}`)}function qm(e,i){var r,a;const u=(r=i==null?void 0:i.extend)!=null?r:!1;u||e.collapseSelection("backward");const p=()=>{var w,E;let I=!0;return e.silenceNotifications||(I=(E=(w=e.mathfield.host)==null?void 0:w.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"upward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?E:!0),e.announce(I?"plonk":"line"),I},m=e.at(e.position);let b=m;for(;b&&b.parentBranch!=="below"&&!(Array.isArray(b.parentBranch)&&b.parent instanceof Tn);)b=b.parent;if(Array.isArray(b==null?void 0:b.parentBranch)&&b.parent instanceof Tn){const w=b.parent;if(b.parentBranch[0]<1)return p();const E=b.parentBranch[0]-1,I=w.array[E][b.parentBranch[1]];if(!I.some(J=>J.type==="prompt"&&!J.captureSelection)&&e.mathfield.hasEditablePrompts)return p();Vf(e,m,I,u,"up")}else if(b){const w=(a=b.parent.branch("above"))!=null?a:b.parent.createBranch("above");if(!w.some(I=>I.type==="prompt"&&I.placeholderId)&&e.mathfield.hasEditablePrompts)return p();Vf(e,m,w,u,"up")}else return p();return e.mathfield.stopCoalescingUndo(),!0}function Zm(e,i){var r,a;const u=(r=i==null?void 0:i.extend)!=null?r:!1;u||e.collapseSelection("forward");const p=()=>{var w,E;let I=!0;return e.silenceNotifications||(I=(E=(w=e.mathfield.host)==null?void 0:w.dispatchEvent(new CustomEvent("move-out",{detail:{direction:"downward"},cancelable:!0,bubbles:!0,composed:!0})))!=null?E:!0),e.announce(I?"plonk":"line"),I},m=e.at(e.position);let b=m;for(;b&&b.parentBranch!=="above"&&!(Array.isArray(b.parentBranch)&&b.parent instanceof Tn);)b=b.parent;if(Array.isArray(b==null?void 0:b.parentBranch)&&b.parent instanceof Tn){const w=b.parent;if(b.parentBranch[0]+1>w.array.length-1)return p();const E=b.parentBranch[0]+1,I=w.array[E][b.parentBranch[1]];if(!I.some(J=>J.type==="prompt"&&!J.captureSelection)&&e.mathfield.hasEditablePrompts)return p();Vf(e,m,I,u,"down")}else if(b){const w=(a=b.parent.branch("below"))!=null?a:b.parent.createBranch("below");if(!w.some(I=>I.type==="prompt")&&e.mathfield.hasEditablePrompts)return p();Vf(e,m,w,u,"down")}else return p();return!0}function Y0(e){const i=e.position,r=e.at(i).parent;return r!=null&&r.parent?(e.position=e.offsetOf(r),e.mathfield.stopCoalescingUndo(),e.announce("move",i),!0):(e.announce("plonk"),!1)}function Ym(e){let i=0,r=e.at(e.position),a=!1;for(;r;)(!r.hasEmptyBranch("superscript")||!r.hasEmptyBranch("subscript"))&&(i+=1),r.hasEmptyBranch("superscript")?r.hasEmptyBranch("subscript")||(a=!1):a=!0,r=r.parent;return a?i:0}function Xm(e){let i=0,r=e.at(e.position),a=!1;for(;r;)(!r.hasEmptyBranch("superscript")||!r.hasEmptyBranch("subscript"))&&(i+=1),r.hasEmptyBranch("superscript")?r.hasEmptyBranch("subscript")||(a=!0):a=!1,r=r.parent;return a?i:0}function X0(e){var i;if(e.collapseSelection(),Ym(e)>=e.mathfield.options.scriptDepth[1])return e.announce("plonk"),!1;let r=e.at(e.position);return r.subsupPlacement===void 0&&(((i=r.rightSibling)==null?void 0:i.type)!=="subsup"&&r.parent.addChildAfter(new Pl({style:r.computedStyle}),r),r=r.rightSibling),r.createBranch("superscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(r.superscript[0]))),!0}function J0(e){var i;if(e.collapseSelection(),Xm(e)>=e.mathfield.options.scriptDepth[0])return e.announce("plonk"),!1;let r=e.at(e.position);return r.subsupPlacement===void 0&&(((i=e.at(e.position+1))==null?void 0:i.type)!=="subsup"&&r.parent.addChildAfter(new Pl({style:e.at(e.position).computedStyle}),r),r=e.at(e.position+1)),r.createBranch("subscript"),e.setSelection(e.getSiblingsRange(e.offsetOf(r.subscript[0]))),!0}function Jm(){function e(w){const E=[],I=[];return[...w.querySelectorAll(`input, select, textarea, a[href], button,
[tabindex], audio[controls], video[controls],
[contenteditable]:not([contenteditable="false"]), details>summary`)].filter(i).forEach((J,oe)=>{const ge=a(J);ge===0?E.push(J):I.push({documentOrder:oe,tabIndex:ge,node:J})}),I.sort((J,oe)=>J.tabIndex===oe.tabIndex?J.documentOrder-oe.documentOrder:J.tabIndex-oe.tabIndex).map(J=>J.node).concat(E)}function i(w){return!(!r(w)||u(w)||a(w)<0)}function r(w){return!(w.disabled||w.type==="hidden"&&w.tagName.toUpperCase()==="INPUT"||b(w))}function a(w){var E;const I=Number.parseInt((E=w.getAttribute("tabindex"))!=null?E:"NaN",10);return Number.isNaN(I)?w.contentEditable==="true"||(w.nodeName==="AUDIO"||w.nodeName==="VIDEO")&&w.getAttribute("tabindex")===null?0:w.tabIndex:I}function u(w){return w.tagName.toUpperCase()==="INPUT"&&w.type==="radio"&&!m(w)}function p(w,E){for(const I of w)if(I.checked&&I.form===E)return I;return null}function m(w){var E;if(!w.name)return!0;const N=((E=w.form)!=null?E:w.ownerDocument).querySelectorAll('input[type="radio"][name="'+w.name+'"]'),J=p(N,w.form);return!J||J===w}function b(w){if(!C()||w===document.activeElement||w.contains(document.activeElement))return!1;if(getComputedStyle(w).visibility==="hidden")return!0;const E=w.getBoundingClientRect();if(E.width===0||E.height===0)return!0;for(;w;){if(getComputedStyle(w).display==="none")return!0;w=w.parentElement}return!1}return C()?e(document.body):[]}function vs(e,i,r="forward"){const a=e.position;if(Array.isArray(i)){const u=e.offsetOf(i[0]),p=e.offsetOf(i[i.length-1]);return r==="forward"?e.setSelection(u,p):e.setSelection(p,u),e.announce("move",a),e.mathfield.stopCoalescingUndo(),!0}return r==="forward"?vs(e,[i.leftSibling,i]):vs(e,[i,i.leftSibling])}function ba(e,i){const r=e.position;if(typeof i=="number"&&(i=e.at(i)),i.type==="prompt")e.setSelection(e.offsetOf(i.firstChild),e.offsetOf(i.lastChild));else{const a=e.offsetOf(i);i.type==="placeholder"?e.setSelection(a-1,a):e.position=a}return e.announce("move",r),e.mathfield.stopCoalescingUndo(),!0}function Gf(e,i,r=!0){var a,u;const p=i==="forward"?1:-1;e.at(e.anchor).type==="placeholder"&&$a(e,i);let m;const b=e.at(e.anchor).parentPrompt;b?i==="forward"?m=e.offsetOf(b)+1:m=e.offsetOf(b.leftSibling):m=Math.max(e.position+p,0);const w=l0(e,m,i);if(!w||i==="forward"&&e.offsetOf(w)<m||i==="backward"&&e.offsetOf(w)>m){if(!r||!((u=(a=e.mathfield.host)==null?void 0:a.dispatchEvent(new CustomEvent("move-out",{detail:{direction:i},cancelable:!0,bubbles:!0,composed:!0})))==null||u))return e.announce("plonk"),!1;const I=Jm();if(!document.activeElement||I.length<=1)return e.announce("plonk"),!1;let N=I.indexOf(document.activeElement)+p;return N<0&&(N=I.length-1),N>=I.length&&(N=0),I[N].focus(),e.mathfield.stopCoalescingUndo(),!0}return ba(e,w),!0}function l0(e,i=0,r="forward"){return e.findAtom(a=>a.type==="placeholder"||a.type==="prompt"||!e.mathfield.readOnly&&a.treeDepth>2&&a.isFirstSibling&&a.isLastSibling,i,r)}Jr({moveToOpposite:e=>{const i={superscript:"subscript",subscript:"superscript",above:"below",below:"above"},r=e.at(e.position),{parent:a}=r;if(!a)return e.announce("plonk"),!1;const u=r.parentBranch;let p;if(typeof u=="string"&&(p=i[u]),!p){const b=r.subsupPlacement?J0(e):X0(e);return e.mathfield.stopCoalescingUndo(),b}a.branch(p)||a.createBranch(p);const m=e.setSelection(e.getBranchRange(e.offsetOf(a),p));return e.mathfield.stopCoalescingUndo(),m},moveBeforeParent:e=>{const{parent:i}=e.at(e.position);return i?(e.position=e.offsetOf(i),e.mathfield.stopCoalescingUndo(),!0):(e.announce("plonk"),!1)},moveAfterParent:e=>Y0(e),moveToNextChar:e=>$a(e,"forward"),moveToPreviousChar:e=>$a(e,"backward"),moveUp:e=>$a(e,"upward"),moveDown:e=>$a(e,"downward"),moveToNextWord:e=>Vu(e,"forward"),moveToPreviousWord:e=>Vu(e,"backward"),moveToGroupStart:e=>{const i=e.offsetOf(e.at(e.position).firstSibling);return i===e.position?(e.announce("plonk"),!1):(e.position=i,e.mathfield.stopCoalescingUndo(),!0)},moveToGroupEnd:e=>{const i=e.offsetOf(e.at(e.position).lastSibling);return i===e.position?(e.announce("plonk"),!1):(e.position=i,e.mathfield.stopCoalescingUndo(),!0)},moveToNextGroup:e=>{var i,r,a,u;if(e.position===e.lastOffset&&e.anchor===e.lastOffset)return Gf(e,"forward");const p=e.at(e.position);if(p.mode==="text"){if(e.selectionIsCollapsed){let J=p;for(;J&&J.mode==="text";)J=J.leftSibling;let oe=p;for(;((i=oe.rightSibling)==null?void 0:i.mode)==="text";)oe=oe.rightSibling;if(J&&oe)return vs(e,[J,oe])}if(p.rightSibling.mode==="text"){let J=p;for(;J&&J.mode==="text";)J=J.rightSibling;return J?(ba(e,(r=J.leftSibling)!=null?r:J),e.mathfield.switchMode("math"),!0):ba(e,e.lastOffset)}}const b=e.at(e.anchor).parentPrompt,w=b?e.offsetOf(b)+1:Math.max(e.position+1,0),E=l0(e,w,"forward");if(E)return ba(e,E);const I=Q0(e,p,J=>J.type==="leftright"||J.type==="text","forward");if(I){if(I.mode==="text"){let J=I;for(;J&&J.mode==="text";)J=J.rightSibling;return vs(e,[(a=I.leftSibling)!=null?a:I,(u=J.leftSibling)!=null?u:J])}return vs(e,I)}const N=p.parent;if(N){if(N.type==="leftright"||N.type==="surd")return vs(e,N);if(p.parentBranch==="superscript"&&N.subscript)return vs(e,N.subscript);if(p.parentBranch==="above"&&N.below)return vs(e,N.below);if(p.parentBranch==="superscript"||p.parentBranch==="subscript")return ba(e,N);if(p.parentBranch==="above"||p.parentBranch==="below")return vs(e,N)}return ba(e,e.lastOffset)},moveToPreviousGroup:e=>{var i;if(e.position===0&&e.anchor===0)return Gf(e,"backward");let r=e.at(e.position);const a=r.mode;if(a==="text"){if(e.selectionIsCollapsed){let b=r;for(;b&&b.mode==="text";)b=b.leftSibling;let w=r;for(;((i=w.rightSibling)==null?void 0:i.mode)==="text";)w=w.rightSibling;if(b&&w)return vs(e,[b,w])}for(;r&&r.mode==="text";)r=r.leftSibling;return r?ba(e,r):ba(e,0)}const u=e.at(e.anchor).parentPrompt,p=u?e.offsetOf(u.leftSibling):Math.max(e.position-1,0),m=l0(e,p,"backward");if(m)return ba(e,m);if(a==="math"){const b=Q0(e,r,E=>E.type==="leftright"||E.type==="text","backward");if(b){if(b.mode==="text"){let E=b;for(;E&&E.mode==="text";)E=E.leftSibling;return vs(e,[b,E])}return vs(e,b)}const w=r.parent;if(w){if(w.type==="leftright"||w.type==="surd")return vs(e,w);if(r.parentBranch==="subscript"&&w.superscript)return vs(e,w.superscript);if(r.parentBranch==="below"&&w.above)return vs(e,w.above);if(r.parentBranch==="superscript"||r.parentBranch==="subscript")return ba(e,w);if(r.parentBranch==="above"||r.parentBranch==="below")return vs(e,w)}return ba(e,0)}return!1},moveToMathfieldStart:e=>e.selectionIsCollapsed&&e.position===0?(e.announce("plonk"),!1):(e.position=0,e.mathfield.stopCoalescingUndo(),!0),moveToMathfieldEnd:e=>e.selectionIsCollapsed&&e.position===e.lastOffset?(e.announce("plonk"),!1):(e.position=e.lastOffset,e.mathfield.stopCoalescingUndo(),!0),moveToSuperscript:X0,moveToSubscript:J0},{target:"model",changeSelection:!0}),Jr({moveToNextPlaceholder:e=>Gf(e,"forward"),moveToPreviousPlaceholder:e=>Gf(e,"backward")},{target:"model",changeSelection:!0,audioFeedback:"return"});function Q0(e,i,r,a){if(a==="forward"){let p=i.rightSibling;for(;p&&!r(p);)p=p.rightSibling;return p}let u=i.leftSibling;for(;u&&!r(u);)u=u.leftSibling;return u}function Hf(e,i,r){typeof i=="function"&&(r=i,i=1/0),i===void 0&&(i=1/0);let a=e.position,u=!1,p="";for(;!u;){const m=e.at(a);u=i===0||m===void 0||m.type==="first"||m.mode!=="math"||!(m.type&&/mord|mpunct|operator/.test(m.type)||m.type==="mop"&&/[a-zA-Z ]+/.test(m.value))||!m.hasEmptyBranch("superscript")||!m.hasEmptyBranch("subscript")||typeof r=="function"&&!r(m),u||(m.mode="text",m.command=m.value,m.verbatimLatex=void 0,p+=m.value),a-=1,i-=1}e.contentDidChange({data:p,inputType:"insertText"})}function Wl(e,i,r){typeof i=="function"&&(r=i,i=1/0),i===void 0&&(i=1/0);let a=e.position,u=!1;const p=[];for(;!u;){const m=e.at(a);u=i===0||!m||m.type==="first"||m.isFirstSibling||m.mode!=="text"||m.value===" "||typeof r=="function"&&!r(m),u||(p.push(ut.serialize([m],{defaultMode:"math"})),m.mode="math"),a-=1,i-=1}u0(e),e.contentDidChange({data:on(p),inputType:"insertText"})}function u0(e){var i;let r=e.position-1;for(;r>=0&&((i=e.at(r))==null?void 0:i.mode)==="math";)r-=1;if(!(r<0)&&e.at(r).mode==="text"&&e.at(r).value===" "&&e.at(r-1).mode==="math"){e.at(r-1).parent.removeChild(e.at(r-1));const a=e.silenceNotifications;e.silenceNotifications=!0,e.position-=1,e.silenceNotifications=a,e.contentDidChange({inputType:"deleteContent"})}}function Qm(e){let i="",r=e.position,a=!1;for(;!a;){const u=e.at(r);a=!(u&&(u.mode==="text"||u.mode==="math"&&u.type&&/mord|mpunct/.test(u.type))),a||(i=u.value+i),r-=1}return i}function eg(e,i,r){const{model:a}=e;if(a.mode==="latex"||!a.at(a.position).isLastSibling||!r||!y(r))return!1;const u=B(r);if(!a.selectionIsCollapsed)return!!(e.model.mode==="text"&&/[/_^]/.test(u));const p=Qm(a)+u;if(e.model.mode==="text"){if(i==="Esc"||/[/\\]/.test(u))return!0;if(/[\^_]/.test(u))return/(^|\s)[a-zA-Z][^_]$/.test(p)&&Wl(a,1),!0;const m={")":"(","}":"{","]":"["}[u],{parent:b}=a.at(a.position);if(m&&b instanceof ur&&b.leftDelim===m)return!0;if(/(^|[^a-zA-Z])(a|I) $/.test(p))return!1;if(/[$€£₤₺¥¤฿¢₡₧₨₹₩₱]/u.test(u))return!0;if(/(^|[^a-zA-Z'])[a-zA-Z] $/.test(p))return Wl(a,1),!1;if(/\D\.[^\d\s]$/.test(p)){Wl(a,1);const w=a.at(a.position);return w.value="\u22C5",w.style.variant="normal",w.command="\\cdot",w.verbatimLatex=void 0,a.contentDidChange({data:"\\cdot",inputType:"insertText"}),!0}if(/(^|\s)[a-zA-Z][^a-zA-Z]$/.test(p)||/\.\d$/.test(p)||/\([\d+\-.]$/.test(p))return Wl(a,1),!0;if(/\([a-z][,;]$/.test(p))return Wl(a,2),!0;if(/[\d+\-=><*|]$/.test(u))return u0(a),!0}else{if(i==="[Space]")return Hf(a,void 0,m=>/[a-z][:,;.]$/.test(m.value)),!0;if(/[a-zA-Z]{3,}$/.test(p)&&!/(dxd|abc|xyz|uvw)$/.test(p))return Hf(a,void 0,m=>/[a-zA-Z]/.test(m.value)),!0;if(/(^|\W)(if)$/i.test(p))return Hf(a,1),!0;if(/(\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5){3,}$/u.test(p)&&!/(αβγ)$/.test(p))return Hf(a,void 0,m=>/(:|,|;|.|\u0393|\u0394|\u0398|\u039B|\u039E|\u03A0|\u03A3|\u03A5|\u03A6|\u03A8|\u03A9|[\u03B1-\u03C9]|\u03D1|\u03D5|\u03D6|\u03F1|\u03F5)/u.test(m.value)),!0;if(u==="?"||u==="."&&!/[\d-+]\.$/.test(p))return!0}return!1}function tg(e,i){if(!e.isSelectionEditable||!e.keystrokeCaptionVisible)return;const r=ep(),a=e.element.getBoundingClientRect();r.style.left=`${a.left}px`,r.style.top=`${a.top-64}px`,r.innerHTML=window.MathfieldElement.createHTML("<span>"+(c(i)||i)+"</span>"+r.innerHTML),r.style.visibility="visible",setTimeout(()=>{r.childNodes.length>0&&r.childNodes[r.childNodes.length-1].remove(),r.childNodes.length===0&&(r.style.visibility="hidden")},3e3)}function ig(e){if(e.keystrokeCaptionVisible=!e.keystrokeCaptionVisible,e.keystrokeCaptionVisible){const i=ep();i.innerHTML=""}else{const i=Zt("mathlive-keystroke-caption-panel");i.style.visibility="hidden"}return!1}function ep(){const e=document.getElementById("mathlive-keystroke-caption-panel");return e||(_a("keystroke-caption"),_a("core"),Zt("mathlive-keystroke-caption-panel"))}function ng(){document.getElementById("mathlive-keystroke-caption-panel")&&(xi("mathlive-keystroke-caption-panel"),na("core"),na("keystroke-caption"))}function tp(e,i){var r,a,u;const{model:p}=e,m=F(i);if(i.isTrusted){n(i);const oe=o();e.keyboardLayout!==oe.id&&(e.keyboardLayout=oe.id,e._keybindings=void 0)}if(clearTimeout(e.inlineShortcutBufferFlushTimer),e.inlineShortcutBufferFlushTimer=0,tg(e,m),i.isTrusted&&i.defaultPrevented)return e.flushInlineShortcutBuffer(),!1;let b,w="",E;const I=e.inlineShortcutBuffer;if(e.isSelectionEditable){if(p.mode==="math")if(m==="[Backspace]")I.pop();else if(!y(i))e.flushInlineShortcutBuffer();else{const oe=B(i),ge=[...(a=(r=I[I.length-1])==null?void 0:r.keystrokes)!=null?a:[],oe];I.push({state:p.getState(),keystrokes:ge,leftSiblings:rg(e)});let He=0,Ft="";for(;!b&&He<ge.length;)E=I.length-(ge.length-He),Ft=ge.slice(He).join(""),b=Tc(I[E].leftSiblings,Ft,e.options.inlineShortcuts),!b&&/^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(Ft)&&(b=e.options.onInlineShortcut(e,Ft)),He+=1;e.flushInlineShortcutBuffer({defer:!0})}e.options.smartMode&&(b?e.switchMode("math"):eg(e,m,i)&&(e.switchMode({math:"text",text:"math"}[p.mode]),w=""))}if(!b){if(w||(w=_e(e.keybindings,p.mode,i)),!w&&(m==="[Enter]"||m==="[Return]")){let oe=!1;return p.contentWillChange({inputType:"insertLineBreak"})&&(e.host&&(oe=!e.host.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),oe||i.preventDefault&&(i.preventDefault(),i.stopPropagation()),p.contentDidChange({inputType:"insertLineBreak"})),oe}if((!w||m==="[Space]")&&p.mode==="math"){if(m==="[Space]"){if(e.adoptStyle="none",e.flushInlineShortcutBuffer(),e.options.mathModeSpace)return jn.insert(p,e.options.mathModeSpace,{format:"latex",mode:"math"}),e.snapshot("insert-space"),w="",e.dirty=!0,e.scrollIntoView(),i.preventDefault&&(i.preventDefault(),i.stopPropagation()),!1;const oe=p.at(p.position+1),ge=p.at(p.position-1);if((oe==null?void 0:oe.mode)==="text"||(ge==null?void 0:ge.mode)==="text")return jn.insert(p," ",{mode:"text"}),e.snapshot("insert-space"),e.dirty=!0,e.scrollIntoView(),!1}(u=p.at(p.position))!=null&&u.isDigit()&&window.MathfieldElement.decimalSeparator===","&&B(i)===","&&(w="insertDecimalSeparator")}}if(!b&&!w){if(p.mathfield.smartFence){if(h0(p,B(i),e.effectiveStyle))return e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}else{const{parent:oe}=p.at(p.position);if(oe instanceof ur&&oe.rightDelim==="?"&&p.at(p.position).isLastSibling&&/^[)}\]|]$/.test(m))return e.snapshot(),oe.isDirty=!0,oe.rightDelim=m,p.position+=1,p.selectionDidChange(),p.contentDidChange({data:B(i),inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1;if(!p.selectionIsCollapsed){const ge=B(i);if(ge==="("||ge==="{"||ge==="["){const He={"(":"(","{":"\\lbrace","[":"\\lbrack"}[ge],Ft={"(":")","{":"\\rbrace","[":"\\rbrack"}[ge],[Ve,St]=Kr(p.selection);return e.snapshot(),p.position=St,jn.insert(p,Ft,{format:"latex"}),p.position=Ve,jn.insert(p,He,{format:"latex"}),p.setSelection(Ve+1,St+1),p.contentDidChange({data:ge,inputType:"insertText"}),e.snapshot("insert-fence"),e.dirty=!0,e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}}}return!0}const N=p.at(Math.max(p.position,p.anchor)),{parent:J}=N;if(w==="moveAfterParent"&&(J==null?void 0:J.type)==="leftright"&&N.isLastSibling&&e.options.smartFence&&h0(p,".",e.defaultStyle)&&(w="",Ii(e)),e.keyboardDelegate.cancelComposition(),w)e.executeCommand(w);else if(b){const oe=e.effectiveStyle;p.setState(I[E].state);const ge=I[I.length-1].keystrokes;for(const He of ge)jn.insert(p,He,{silenceNotifications:!0,style:oe});e.snapshot("insert-shortcut"),p.setState(I[E].state),p.deferNotifications({content:!0,selection:!0,data:b,type:"insertText"},()=>(jn.insert(p,b,{format:"latex",style:oe}),u0(e.model),b.endsWith(" ")&&(e.switchMode("text"),jn.insert(p," ",{style:oe,mode:"text"})),e.snapshot(),p.selectionIsCollapsed||e.flushInlineShortcutBuffer(),!0)),e.dirty=!0,p.announce("replacement")}return e.scrollIntoView(),i.preventDefault&&i.preventDefault(),!1}function c0(e,i,r){const{model:a}=e;if(!e.isSelectionEditable){a.announce("plonk");return}r!=null||(r={}),r.focus&&e.focus(),r.feedback&&window.MathfieldElement.playSound("keypress"),typeof r.mode=="string"&&(e.switchMode(r.mode),e.snapshot());let u=Jh(i);const p=window.mathVirtualKeyboard;if(p!=null&&p.isShifted&&(u=typeof u=="string"?u.toUpperCase():u.map(w=>w.toUpperCase())),r.simulateKeystroke){let w=!0;for(const E of u)tp(e,new KeyboardEvent("keypress",{key:E}))&&(w=!1);if(w)return}const m=a.at(a.position),b=P(P({},m.computedStyle),e.defaultStyle);if(a.selectionIsCollapsed||(a.deleteAtoms(Kr(a.selection)),e.snapshot("delete")),a.mode==="latex")a.deferNotifications({content:!0,selection:!0,data:i,type:"insertText"},()=>{ti(e);for(const w of u)jn.insert(a,w);e.snapshot("insert-latex"),hi(e)});else if(a.mode==="text"){for(const w of u)jn.insert(a,w,{style:b});e.snapshot("insert-text")}else if(a.mode==="math")for(const w of u)sg(e,w,b,m);e.dirty=!0,e.scrollIntoView()}function rg(e){const i=e.model,r=[];let a=i.at(Math.min(i.position,i.anchor));for(;a.type!=="first";)r.push(a),a=a.leftSibling;return r}function sg(e,i,r,a){const u=e.model;let p={"^":"moveToSuperscript",_:"moveToSubscript"," ":"moveAfterParent"}[i];if(i===" "&&e.options.mathModeSpace&&(p=["insert",e.options.mathModeSpace]),p){e.executeCommand(p);return}if(/\d/.test(i)&&e.options.smartSuperscript&&a.parentBranch==="superscript"&&a.parent.type!=="mop"&&a.parent.type!=="operator"&&a.parent.type!=="extensible-symbol"&&a.hasNoSiblings){ag(u),jn.insert(u,i,{style:r}),e.snapshot(),Y0(u),e.snapshot();return}if(/[a-zA-Z0-9]/.test(i)&&e.adoptStyle!=="none"){const m=e.adoptStyle==="left"?a:a.parent?a.rightSibling:null;(m==null?void 0:m.type)==="mord"&&/[a-zA-Z0-9]/.test(m.value)&&(r=P({},r),m.style.variant&&(r.variant=m.style.variant),m.style.variantStyle&&(r.variantStyle=m.style.variantStyle))}jn.insert(u,i,{style:r}),e.snapshot(`insert-${u.at(u.position).type}`)}function ag(e){e.selectionIsCollapsed||(e.deleteAtoms(Kr(e.selection)),e.mathfield.snapshot("delete"))}function h0(e,i,r){if(!i||e.mode!=="math")return!1;const a=e.at(e.position),{parent:u}=a,p={"(":"(",")":")","{":"\\lbrace","}":"\\rbrace","[":"\\lbrack","]":"\\rbrack","|":"|"}[i];if(!p)return!1;const m=Du[p],b=Zo[p];if(!e.selectionIsCollapsed){e.mathfield.snapshot();const[w,E]=Kr(e.selection),I=e.extractAtoms([w,E]),N=u.addChildrenAfter([new ur("left...right",I,{leftDelim:p,rightDelim:b})],e.at(w));return e.setSelection(e.offsetOf(N.firstChild),e.offsetOf(N.lastChild)),e.mathfield.snapshot("insert-fence"),e.contentDidChange({data:p,inputType:"insertText"}),!0}if(p==="|"){const w=u instanceof ur?u.leftDelim+u.rightDelim:"";if(w==="\\lbrace\\rbrace"||w==="\\{\\}"||w==="\\lbrace?")return e.mathfield.snapshot(),jn.insert(e,"\\,\\middle\\vert\\,",{format:"latex",style:r}),e.mathfield.snapshot("insert-fence"),e.contentDidChange({data:p,inputType:"insertText"}),!0}if(b){if(u instanceof ur&&u.firstChild===a&&(u.leftDelim==="?"||u.leftDelim==="."))return u.leftDelim=p,u.isDirty=!0,e.mathfield.snapshot(),e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;if(!(u instanceof ur)){let N=a;for(;N&&!(N.type==="mclose"&&N.value===b);)N=N.rightSibling;if(N){e.mathfield.snapshot();const J=e.extractAtoms([e.offsetOf(a),e.offsetOf(N)]);return J.pop(),u.addChildrenAfter([new ur("left...right",J,{leftDelim:p,rightDelim:b})],a),e.position=e.offsetOf(u.firstChild)+1,e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}}const w=e.offsetOf(a.lastSibling);let E;for(E=e.position;E<=w;E++){const N=e.at(E);if(N instanceof ur&&(N.leftDelim==="?"||N.leftDelim===".")&&ip(p,N.rightDelim))break}const I=e.at(E);if(E<=w&&I instanceof ur){I.leftDelim=p,e.mathfield.snapshot();let N=e.extractAtoms([e.position,E-1]);return N=N.filter(J=>J.type!=="first"),I.addChildren(N,I.parentBranch),e.position+=1,e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}if(u instanceof ur&&(u.leftDelim==="?"||u.leftDelim===".")&&ip(p,u.rightDelim)){u.isDirty=!0,u.leftDelim=p,e.mathfield.snapshot();const N=e.extractAtoms([e.offsetOf(a.firstSibling),e.position]);for(const J of N)u.parent.addChildBefore(J,u);return e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}if(!(u instanceof ur&&u.leftDelim==="|")){if(e.mathfield.snapshot(),jn.insert(e,`\\left${p}\\right?`,{format:"latex",style:r}),a.lastSibling.type!=="first"){const N=e.offsetOf(a.lastSibling),J=e.extractAtoms([e.position,N]);e.at(e.position).body=J,e.position-=1}return e.mathfield.snapshot("insert-fence"),!0}}if(m){let w=a;for(;w;){if(w.type==="mopen"&&w.value===m){e.mathfield.snapshot();const oe=w.leftSibling,ge=e.extractAtoms([e.offsetOf(w.leftSibling),e.offsetOf(a)]);ge.shift();const He=new ur("left...right",ge,{leftDelim:m,rightDelim:p});return u.addChildrenAfter([He],oe),e.position=e.offsetOf(He),e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0}w=w.leftSibling}if(u instanceof ur&&a.isLastSibling&&f0(u.leftDelim,p))return e.mathfield.snapshot(),u.isDirty=!0,u.rightDelim=p,e.position+=1,e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;const E=e.offsetOf(a.firstSibling);let I;for(I=e.position;I>=E;I--){const oe=e.at(I);if(oe instanceof ur&&(oe.rightDelim==="?"||oe.rightDelim===".")&&f0(oe.leftDelim,p))break}const N=e.at(I);if(I>=E&&N instanceof ur)return e.mathfield.snapshot(),N.rightDelim=p,N.addChildren(e.extractAtoms([I,e.position]),N.parentBranch),e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;if(u instanceof ur&&(u.rightDelim==="?"||u.rightDelim===".")&&f0(u.leftDelim,p))return e.mathfield.snapshot(),u.isDirty=!0,u.rightDelim=p,u.parent.addChildren(e.extractAtoms([e.position,e.offsetOf(a.lastSibling)]),u.parentBranch),e.position=e.offsetOf(u),e.contentDidChange({data:p,inputType:"insertText"}),e.mathfield.snapshot("insert-fence"),!0;const J=u.parent;return J instanceof ur&&(J.rightDelim==="?"||J.rightDelim===".")&&e.at(e.position).isLastSibling?(e.position=e.offsetOf(J),h0(e,p,r)):!1}return!1}function f0(e,i){return e?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e)?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i):Zo[e]===i:!0}function ip(e,i){return i?[")","\\rparen","}","\\}","\\rbrace","]","\\rbrack"].includes(i)?["(","\\lparen","{","\\{","\\lbrace","[","\\lbrack"].includes(e):Du[i]===e:!0}Jr({undo:e=>(e.undo(),!0),redo:e=>(e.redo(),!0),scrollIntoView:e=>(e.scrollIntoView(),!0),scrollToStart:e=>(e.field.scroll(0,0),!0),scrollToEnd:e=>{const i=e.field.getBoundingClientRect();return e.field.scroll(i.left-window.scrollX,0),!0},toggleKeystrokeCaption:ig,toggleContextMenu:e=>{const i=e.toggleContextMenu();return i||e.model.announce("plonk"),i},plonk:e=>(e.model.announce("plonk"),!0),switchMode:(e,i,r,a)=>(e.switchMode(i,r,a),!0),insert:(e,i,r)=>e.insert(i,r),typedText:(e,i,r)=>(c0(e,i,r),!0),insertDecimalSeparator:e=>{const i=e.model;return i.mode==="math"&&window.MathfieldElement.decimalSeparator===","&&i.at(Math.max(i.position,i.anchor)).isDigit()?(e.insert("{,}",{format:"latex"}),e.snapshot("insert-mord"),!0):(e.insert("."),!0)},commit:e=>{var i;return e.model.contentWillChange({inputType:"insertLineBreak"})&&((i=e.host)==null||i.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),e.model.contentDidChange({inputType:"insertLineBreak"})),!0},insertPrompt:(e,i,r)=>{const a=e.getPrompts();let u="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36),p=0;for(;a.includes(u)&&p<100;){if(p===99)return console.error("could not find a unique ID after 100 tries"),!1;u="prompt-"+Date.now().toString(36).slice(-2)+Math.floor(Math.random()*1e5).toString(36),p++}return e.insert(`\\placeholder[${i!=null?i:u}]{}`,r),!0}}),Jr({copyToClipboard:e=>(e.focus(),e.model.selectionIsCollapsed&&e.select(),"queryCommandSupported"in document&&document.queryCommandSupported("copy")?document.execCommand("copy"):e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("copy",{bubbles:!0,composed:!0})),!1)},{target:"mathfield"}),Jr({cutToClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("cut")?document.execCommand("cut"):e.element.querySelector(".ML__keyboard-sink").dispatchEvent(new ClipboardEvent("cut",{bubbles:!0,composed:!0})),!0),pasteFromClipboard:e=>(e.focus(),"queryCommandSupported"in document&&document.queryCommandSupported("paste")?(document.execCommand("paste"),!0):(navigator.clipboard.readText().then(i=>{i&&e.model.contentWillChange({inputType:"insertFromPaste",data:i})?(e.stopCoalescingUndo(),e.stopRecording(),e.insert(i,{mode:e.model.mode})&&(hi(e),e.startRecording(),e.snapshot("paste"),e.model.contentDidChange({inputType:"insertFromPaste"}),Ii(e))):e.model.announce("plonk"),e.startRecording()}),!0))},{target:"mathfield",canUndo:!0,changeContent:!0,changeSelection:!0});function og(e,i){e.flushInlineShortcutBuffer(),e.stopCoalescingUndo();const r=d0(e,i),{model:a}=e;return a.selectionIsCollapsed?(e.defaultStyle.fontSeries&&r.fontSeries===e.defaultStyle.fontSeries&&(r.fontSeries="auto"),r.fontShape&&r.fontShape===e.defaultStyle.fontShape&&(r.fontShape="auto"),r.color&&r.color===e.defaultStyle.color&&(r.color="none"),r.backgroundColor&&r.backgroundColor===e.defaultStyle.backgroundColor&&(r.backgroundColor="none"),r.fontSize&&r.fontSize===e.defaultStyle.fontSize&&(r.fontSize="auto"),e.defaultStyle=P(P({},e.defaultStyle),r)):e.model.deferNotifications({content:!0,type:"insertText"},()=>{a.selection.ranges.forEach(u=>s0(a,u,r,{operation:"toggle"})),e.snapshot("style-change")}),!0}Jr({applyStyle:og},{target:"mathfield",canUndo:!0,changeContent:!0});function d0(e,i){var r,a,u,p,m,b,w,E,I,N;const J={};if(typeof i.color=="string"){const ge=(a=e.colorMap((r=i.color)!=null?r:i.verbatimColor))!=null?a:"none";ge!==i.color&&(J.verbatimColor=(u=i.verbatimColor)!=null?u:i.color),J.color=ge}if(typeof i.backgroundColor=="string"){const ge=(m=e.backgroundColorMap((p=i.backgroundColor)!=null?p:i.verbatimBackgroundColor))!=null?m:"none";ge!==i.backgroundColor&&(J.verbatimBackgroundColor=(b=i.verbatimBackgroundColor)!=null?b:i.backgroundColor),J.backgroundColor=ge}typeof i.fontFamily=="string"&&(J.fontFamily=i.fontFamily),typeof i.series=="string"&&(J.fontSeries=i.series),typeof i.fontSeries=="string"&&(J.fontSeries=i.fontSeries.toLowerCase()),J.fontSeries&&(J.fontSeries=(w={bold:"b",medium:"m",normal:"m"}[J.fontSeries])!=null?w:J.fontSeries),typeof i.shape=="string"&&(J.fontShape=i.shape),typeof i.fontShape=="string"&&(J.fontShape=i.fontShape.toLowerCase()),J.fontShape&&(J.fontShape=(E={italic:"it",up:"n",upright:"n",normal:"n"}[J.fontShape])!=null?E:J.fontShape),i.variant&&(J.variant=i.variant.toLowerCase()),i.variantStyle&&(J.variantStyle=i.variantStyle.toLowerCase());const oe=(I=i.size)!=null?I:i.fontSize;return typeof oe=="number"?J.fontSize=Math.max(1,Math.min(10,oe)):typeof oe=="string"&&(J.fontSize=(N={size1:1,size2:2,size3:3,size4:4,size5:5,size6:6,size7:7,size8:8,size9:9,size10:10}[oe.toLowerCase()])!=null?N:{tiny:1,scriptsize:2,footnotesize:3,small:4,normal:5,normalsize:5,large:6,Large:7,LARGE:8,huge:9,Huge:10}[oe]),J}function p0(e){let[i,r]=Kr(e.selection);if(i=np(e,i,"backward"),r=np(e,r,"forward"),i===r){const a=e.at(i);if(a.type==="leftright")return e.setSelection(e.offsetOf(a.firstChild)-1,r);if(a.type==="first"&&(a.parent.type==="leftright"||a.parent.type==="surd"))return e.setSelection(i-1,e.offsetOf(a.parent.lastChild)+1);e.setSelection(i-1,r)}else e.setSelection(i,r);return!0}function np(e,i,r){var a,u,p;let m=e.at(i);if(!m)return i;const b=r==="forward"?1:-1;if(m.mode==="text"){for(;m&&!(m.mode!=="text"||!Ye.test(m.value));)i+=b,m=e.at(i);return r==="backward"?i-1:i}if(m.mode==="latex"){if(/[a-zA-Z\*]/.test(m.value))if(r==="backward")for(;m&&m.mode==="latex"&&m.value!=="\\"&&/[a-zA-Z]/.test(m.value);)i+=b,m=e.at(i);else for(;m&&m.mode==="latex"&&/[a-zA-Z\*]/.test(m.value);)i+=b,m=e.at(i);else if(m.value==="{"){if(r==="forward"){for(;m&&m.mode==="latex"&&m.value!=="}";)i+=b,m=e.at(i);return i}return i-1}else if(m.value==="}"){if(r==="backward"){for(;m&&m.mode==="latex"&&m.value!=="{";)i+=b,m=e.at(i);return i-1}return i}return i-1}if(m.mode==="math"){if(m.isDigit()){for(;(a=e.at(i+b))!=null&&a.isDigit();)i+=b;return r==="backward"?i-1:i}if(m.style.variant||m.style.variantStyle){let w=(u=e.at(i))==null?void 0:u.style;for(;w&&w.variant===m.style.variant&&w.variantStyle===m.style.variantStyle;)w=(p=e.at(i+b))==null?void 0:p.style,i+=b;return r==="backward"?i-1:i}return i}return i}Jr({selectGroup:e=>{const i=p0(e);return i||e.announce("plonk"),i},selectAll:e=>e.setSelection(0,e.lastOffset),extendSelectionForward:e=>$a(e,"forward",{extend:!0}),extendSelectionBackward:e=>$a(e,"backward",{extend:!0}),extendToNextWord:e=>Vu(e,"forward",{extend:!0}),extendToPreviousWord:e=>Vu(e,"backward",{extend:!0}),extendSelectionUpward:e=>$a(e,"upward",{extend:!0}),extendSelectionDownward:e=>$a(e,"downward",{extend:!0}),extendToNextBoundary:e=>Vu(e,"forward",{extend:!0}),extendToPreviousBoundary:e=>Vu(e,"backward",{extend:!0}),extendToGroupStart:e=>{const i=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).firstSibling));return i||e.announce("plonk"),i},extendToGroupEnd:e=>{const i=e.setSelection(e.anchor,e.offsetOf(e.at(e.position).lastSibling));return i||e.announce("plonk"),i},extendToMathFieldStart:e=>{const i=e.setSelection(e.anchor,0);return i||e.announce("plonk"),i},extendToMathFieldEnd:e=>{const i=e.setSelection(e.anchor,e.lastOffset);return i||e.announce("plonk"),i}},{target:"model",changeSelection:!0});var jl=null,rh=0,Wf=class oa{static start(i,r,a,u){var p;oa.element=i,(p=oa.controller)==null||p.abort(),oa.controller=new AbortController;const m={signal:oa.controller.signal};"PointerEvent"in window?(i.addEventListener("pointermove",a,m),i.addEventListener("pointerup",u,m),i.addEventListener("pointercancel",u,m),m0(r)&&(oa.pointerId=r.pointerId,i.setPointerCapture(r.pointerId))):(window.addEventListener("mousemove",a,m),window.addEventListener("blur",u,m),window.addEventListener("mouseup",u,m))}static stop(){var i;(i=oa.controller)==null||i.abort(),oa.controller=void 0,typeof oa.pointerId=="number"&&(oa.element.releasePointerCapture(oa.pointerId),oa.pointerId=void 0)}};function m0(e){return e!==null&&globalThis.PointerEvent!==void 0&&e instanceof PointerEvent}function rp(e,i){var r;if(i.buttons>1)return;e.atomBoundsCache=new Map;const a=e;let u,p=!1,m=!1,b="none",w=!1,E=!1;const I=i.clientX,N=i.clientY,J=Date.now(),oe=a.field,ge=setInterval(()=>{w?oe.scroll({top:0,left:oe.scrollLeft-16}):E&&oe.scroll({top:0,left:oe.scrollLeft+16})},32);function He(){Wf.stop(),p=!1,clearInterval(ge),e.element.classList.remove("tracking"),i&&i.preventDefault()}function Ft(St){if(!a.hasFocus()){He();return}const Kt=St.clientX,Lt=St.clientY,ai=m0(St)&&St.pointerType==="touch"?20:5;if(Date.now()<J+500&&Math.abs(I-Kt)<ai&&Math.abs(N-Lt)<ai){St.preventDefault(),St.stopPropagation();return}const yi=oe.getBoundingClientRect();E=Kt>yi.right,w=Kt<yi.left;let fi=u;m0(St)&&(St.isPrimary||(fi=sh(a,St.clientX,St.clientY,{bias:0})));const pn=sh(a,Kt,Lt,{bias:Kt<=I?Kt===I?0:-1:1});fi>=0&&pn>=0&&(a.model.extendSelectionTo(fi,pn),Ii(e)),m&&p0(a.model)}jl&&Math.abs(jl.x-I)<5&&Math.abs(jl.y-N)<5&&Date.now()<jl.time+500?(rh+=1,jl.time=J):(jl={x:I,y:N,time:J},rh=1);const Ve=oe.getBoundingClientRect();if(I>=Ve.left&&I<=Ve.right&&N>=Ve.top&&N<=Ve.bottom){if(e.flushInlineShortcutBuffer(),e.adoptStyle="left",u=sh(e,I,N,{bias:0}),u>=0){if(e.element.classList.add("tracking"),i.shiftKey){const St=e.model.selectionIsCollapsed;e.model.extendSelectionTo(e.model.anchor,u),Ti(e.model)||St?b="all":b="selection"}else e.model.at(u).type==="placeholder"?(e.model.setSelection(u-1,u),b="selection"):((r=e.model.at(u).rightSibling)==null?void 0:r.type)==="placeholder"?(e.model.setSelection(u,u+1),b="selection"):(e.model.position=u,Ti(e.model)?b="all":b="selection");e.defaultStyle={},i.detail===3||rh>2?(He(),(i.detail===3||rh===3)&&(e.model.selection={ranges:[[0,e.model.lastOffset]]},b="all")):p||(p=!0,Wf.start(oe,i,Ft,He),(i.detail===2||rh===2)&&(m=!0,p0(e.model),b="all"))}e.hasFocus()||(b="none",e.focus({preventScroll:!0}))}else jl=null;e.stopCoalescingUndo(),b!=="none"&&(e.model.selectionIsCollapsed&&(b="all"),Ii(e)),i.preventDefault()}function lg(e,i,r){if(e>=r.left&&e<=r.right&&i>=r.top&&i<=r.bottom)return 0;const a=e-(r.left+r.right)/2,u=i-(r.top+r.bottom)/2;return a*a+u*u}function sp(e,i,r,a,u){if(!r.id)return[1/0,null];if(i.has(r.id))return i.get(r.id);const p=ia(e,r);if(!p)return[1/0,null];let m=[1/0,null];if(r.hasChildren&&!r.captureSelection&&a>=p.left&&a<=p.right)for(const b of r.children){const w=sp(e,i,b,a,u);w[0]<=m[0]&&(m=w)}return m[1]||(m=[lg(a,u,p),r]),i.set(r.id,m),m}function ug(e,i,r){const[,a]=sp(e,new Map,e.model.root,i,r);return a}function sh(e,i,r,a){var u;const p=e.field.querySelector(".ML__latex").getBoundingClientRect();if(!p)return 0;if(i>p.right||r>p.bottom+8)return e.model.lastOffset;if(i<p.left||r<p.top-8)return 0;a=a!=null?a:{},a.bias=(u=a.bias)!=null?u:0;let m=ug(e,i,r);const b=[];let w=m;for(;w;)b.unshift(w),w=w.parent;for(const I of b)if(I.captureSelection){m=I;break}let E=e.model.offsetOf(m);if(E<0)return-1;if(m.leftSibling)if(a.bias===0&&m.type!=="placeholder"){const I=ia(e,m);I&&i<(I.left+I.right)/2&&(E=e.model.offsetOf(m.leftSibling))}else a.bias<0&&(E=e.model.offsetOf(m.leftSibling));return E}var cg=class extends jn{constructor(){super("math")}onPaste(e,i){if(!i||!e.model.contentWillChange({data:typeof i=="string"?i:null,dataTransfer:typeof i=="string"?null:i,inputType:"insertFromPaste"}))return!1;let r="",a="auto",u=typeof i!="string"?i.getData("application/json+mathlive"):"";if(u)try{const p=JSON.parse(u);if(p&&Array.isArray(p)){e.snapshot();const m=Fa(p),{model:b}=e;b.selectionIsCollapsed||b.deleteAtoms(Kr(b.selection));const w=b.at(b.position);if(w.parent instanceof Tn){console.assert(w.parentBranch!==void 0);const E=[];let I=[];m[0].type==="first"&&m.shift(),m[m.length-1].type==="first"&&m.pop();for(const ge of m)ge.type==="first"&&I.length>0?(E.push(I),I=[ge]):I.push(ge);I.length>0&&E.push(I);let N=Number(w.parentBranch[0]),J=Number(w.parentBranch[1]);const oe=w.parent.maxColumns;for(;w.parent.colCount-J<E.length&&w.parent.colCount<oe;)w.parent.addColumn();w.parent.addChildrenAfter(E[0],w);for(let ge=1;ge<E.length;ge++)J++,J>=oe&&(J=0,w.parent.addRowAfter(N),N++),w.parent.setCell(N,J,E[ge])}else w.parent.addChildrenAfter(m.filter(E=>E.type!=="first"),w);return b.position=b.offsetOf(m[m.length-1]),b.contentDidChange({inputType:"insertFromPaste"}),Ii(e),!0}}catch(p){}if(u=typeof i!="string"?i.getData("application/json"):"",u&&window.MathfieldElement.computeEngine)try{const p=JSON.parse(u);if(typeof p=="object"&&"latex"in p&&p.latex&&(r=p.latex),!r){const m=window.MathfieldElement.computeEngine.box(p);m&&!m.has("Error")&&(r=m.latex)}r||(a="latex")}catch(p){}if(!r&&typeof i!="string"&&(r=i.getData("application/x-latex"),r&&(a="latex")),r||(r=typeof i=="string"?i:i.getData("text/plain")),r){let p;return[p,r]=Lc(r),a==="auto"&&p&&(a="latex"),e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r,{format:a})&&(e.startRecording(),e.snapshot("paste"),Ii(e)),e.startRecording(),!0}return!1}insert(e,i,r){var a,u;const p=typeof i=="string"?i:(u=(a=window.MathfieldElement.computeEngine)==null?void 0:a.box(i).latex)!=null?u:"";if(!r.silenceNotifications&&!e.contentWillChange({data:p,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");const{silenceNotifications:m}=e;r.silenceNotifications&&(e.silenceNotifications=!0);const b=e.silenceNotifications;e.silenceNotifications=!0;const w={"?":"\\placeholder{}","@":"\\placeholder{}"};w[0]=r.insertionMode==="replaceAll"?"":e.getValue(e.selection,"latex-unstyled"),r.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(Kr(e.selection)):r.insertionMode==="replaceAll"?(e.root.setChildren([],"body"),e.position=0):r.insertionMode==="insertBefore"?e.collapseSelection("backward"):r.insertionMode==="insertAfter"&&e.collapseSelection("forward"),!e.at(e.position).isLastSibling&&e.at(e.position+1).type==="placeholder"?e.deleteAtoms([e.position,e.position+1]):e.at(e.position).type==="placeholder"&&e.deleteAtoms([e.position-1,e.position]);let E=-1;w[0]?w["@"]=w[0]:typeof i=="string"&&/(^|[^\\])#@/.test(i)&&(E=fg(e),E>=0&&(w["@"]=e.getValue(E,e.position,"latex"))),w[0]||(w[0]=w["?"]);let I=!1;const N=Kt=>(I=!0,w[Kt]);let[J,oe]=ap(e,i,N,r);if(!oe)return!1;const ge=oe.length===1&&oe[0].type==="genfrac";ge&&E>=0&&typeof e.mathfield.options.isImplicitFunction=="function"&&e.mathfield.options.isImplicitFunction(e.at(e.position).command)?(w["@"]=w["?"],I=!1,[J,oe]=ap(e,i,N,r)):E>=0&&e.deleteAtoms([E,e.position]);const{parent:He}=e.at(e.position),Ft=He.hasEmptyBranch("body");if(ge&&J!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&He instanceof ur&&He.leftDelim==="("&&Ft){const Kt=He.parent,Lt=He.parentBranch;Kt.removeChild(He),Kt.setChildren(oe,Lt)}const Ve=e.at(e.position);Ve.parent.addChildrenAfter(oe,Ve),J==="latex"&&typeof i=="string"&&(He==null?void 0:He.type)==="root"&&Ft&&!I&&(He.verbatimLatex=i),e.silenceNotifications=b;const St=oe[oe.length-1];if(r.selectionMode==="placeholder"){const Kt=oe.flatMap(Lt=>[Lt,...Lt.children]).find(Lt=>Lt.type==="placeholder");if(Kt){const Lt=e.offsetOf(Kt);e.setSelection(Lt-1,Lt),e.announce("move")}else St&&(e.position=e.offsetOf(St))}else r.selectionMode==="before"||(r.selectionMode==="after"?St&&(e.position=e.offsetOf(St)):r.selectionMode==="item"&&e.setSelection(e.anchor,e.offsetOf(St)));return e.contentDidChange({data:p,inputType:"insertText"}),e.silenceNotifications=m,!0}};function ap(e,i,r,a){var u;let p,m=[];if(typeof i!="string"||a.format==="math-json"){const b=window.MathfieldElement.computeEngine;if(!b)return["math-json",[]];[p,i]=["latex",b.box(i).latex],m=Ur(i,{context:e.mathfield.context})}else typeof i=="string"&&a.format==="ascii-math"?([p,i]=Au(i,{format:"ascii-math",inlineShortcuts:e.mathfield.options.inlineShortcuts}),m=Ur(i,{context:e.mathfield.context}),p!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&jf(m)):(a.format==="auto"||(u=a.format)!=null&&u.startsWith("latex"))&&(a.format==="auto"&&([p,i]=Au(i,{format:"auto",inlineShortcuts:e.mathfield.options.inlineShortcuts})),a.format==="latex"&&([,i]=Lc(i)),m=Ur(i,{context:e.mathfield.context,args:r}),a.format!=="latex"&&e.mathfield.options.removeExtraneousParentheses&&jf(m));return ol(m,a.style),[p!=null?p:"latex",m]}function hg(e){if(!e||(console.assert(e[0].type==="first"),e.length>1))return null;const i=e[0];return i instanceof ur&&i.leftDelim==="("&&i.rightDelim===")"?i.removeBranch("body"):null}function jf(e){if(e){for(let i=0;e[i];i++){const r=e[i];if(r instanceof ur&&r.leftDelim==="("){let a=0,u=0,p=0;for(let m=0;r.body[m];m++)r.body[m].type==="genfrac"&&(a++,u=m),p++;p===0&&a===1&&(e[i]=r.body[u])}}for(const i of e){for(const r of i.branches)if(!i.hasEmptyBranch(r)){jf(i.branch(r));const a=hg(i.branch(r));a&&i.setChildren(a,r)}if(i instanceof Tn)for(const r of i.cells)jf(r)}}}function fg(e){let i=e.at(e.position);if(i.mode==="text"){for(;!i.isFirstSibling&&i.mode==="text";)i=i.leftSibling;return e.offsetOf(i)}const r=i;let a=!1;if(i.type==="mclose"){const u=Du[i.value];for(;!i.isFirstSibling&&!(i.type==="mopen"&&i.value===u);)i=i.leftSibling;i.isFirstSibling||(i=i.leftSibling),a=!0}else i.type==="leftright"&&(i=i.leftSibling,a=!0);if(a)for(;!i.isFirstSibling&&(i.isFunction||op(i));)i=i.leftSibling;else{const u=[];for(;!i.isFirstSibling&&(op(i)||u.length>0);)i.type==="mclose"&&u.unshift(i.value),i.type==="mopen"&&u.length>0&&i.value===Du[u[0]]&&u.shift(),i=i.leftSibling}return r===i?-1:e.offsetOf(i)}function op(e){return e.isDigit()?!0:e.type&&/^(mord|surd|subsup|leftright|mop|mclose)$/.test(e.type)?!e.isExtensibleSymbol:!1}new cg;var dg=class extends jn{constructor(){super("text")}onPaste(e,i){if(!i)return!1;const r=typeof i=="string"?i:i.getData("text/plain");return r&&e.model.contentWillChange({inputType:"insertFromPaste",data:r})?(e.stopCoalescingUndo(),e.stopRecording(),this.insert(e.model,r)&&(e.model.contentDidChange({inputType:"insertFromPaste"}),e.startRecording(),e.snapshot("paste"),Ii(e)),e.startRecording(),!0):!1}insert(e,i,r={}){if(!e.contentWillChange({data:i,inputType:"insertText"}))return!1;r.insertionMode||(r.insertionMode="replaceSelection"),r.selectionMode||(r.selectionMode="placeholder"),r.format||(r.format="auto");const{silenceNotifications:a}=e;r.silenceNotifications&&(e.silenceNotifications=!0);const u=e.silenceNotifications;e.silenceNotifications=!0,r.insertionMode==="replaceSelection"&&!e.selectionIsCollapsed?e.deleteAtoms(Kr(e.selection)):r.insertionMode==="replaceAll"?(e.root.setChildren([],"body"),e.position=0):r.insertionMode==="insertBefore"?e.collapseSelection("backward"):r.insertionMode==="insertAfter"&&e.collapseSelection("forward");const p=pg(i,e.mathfield.context);if(ol(p,r.style),!p)return!1;const m=e.at(e.position),b=m.parent.addChildrenAfter(p,m);return e.silenceNotifications=u,r.selectionMode==="before"||(r.selectionMode==="item"?e.setSelection(e.anchor,e.offsetOf(b)):b&&(e.position=e.offsetOf(b))),e.contentDidChange({data:i,inputType:"insertText"}),e.silenceNotifications=a,!0}};function pg(e,i){return e=e.replace(/\\/g,"\\textbackslash "),e=e.replace(/#/g,"\\#"),e=e.replace(/\$/g,"\\$"),e=e.replace(/%/g,"\\%"),e=e.replace(/&/g,"\\&"),e=e.replace(/_/g,"\\_"),e=e.replace(/{/g,"\\textbraceleft "),e=e.replace(/}/g,"\\textbraceright "),e=e.replace(/lbrace/g,"\\textbraceleft "),e=e.replace(/rbrace/g,"\\textbraceright "),e=e.replace(/\^/g,"\\textasciicircum "),e=e.replace(/~/g,"\\textasciitilde "),e=e.replace(/£/g,"\\textsterling "),Ur(e,{context:i,parseMode:"text"})}new dg;function Ka(e){return{value:e.model.getValue(),selectionIsCollapsed:e.model.selectionIsCollapsed,canUndo:e.canUndo(),canRedo:e.canRedo(),style:e.selectionStyle,mode:e.model.mode}}var Jn=4,Ds=20,Rr=2*(Ds+Jn),qf=(e,i)=>`
<line x1="${e+Ds}" y1="${i+Ds}"
x2="${e>i?e+Ds:7*Ds+10*Jn}"
y2="${e<i?i+Ds:7*Ds+10*Jn}"/>
<svg id="plus" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<path class="font" d="m33.33,20c0,1.84-1.49,3.34-3.33,3.34h-6.67v6.66c0,1.84-1.49,3.34-3.33,3.34s-3.34-1.5-3.34-3.34v-6.66h-6.66c-1.84,0-3.34-1.5-3.34-3.34s1.5-3.33,3.34-3.33h6.66v-6.67c0-1.84,1.5-3.33,3.34-3.33s3.33,1.49,3.33,3.33v6.67h6.67c1.84,0,3.33,1.49,3.33,3.33Z"/>
</svg>`,lp=(e,i)=>`
<line x1="${e+Ds}" y1="${i+Ds}"
x2="${e>i?e+Ds:7*Ds+10*Jn}"
y2="${e<i?i+Ds:7*Ds+10*Jn}"/>
<svg id="minus" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<path class="font" d="m33.33,20c0,1.84-1.49,3.33-3.33,3.33H10c-1.84,0-3.34-1.49-3.34-3.33s1.5-3.34,3.34-3.34h20c1.84,0,3.33,1.5,3.33,3.34Z"/>
</svg>`,Zf=(e,i,r)=>`
<svg id="arrow" viewBox="0 0 40 40" x="${e}" y="${i}" width="40" height="40">
<circle class="cls-2" cx="20" cy="20" r="20"/>
<g transform="rotate(${r})" transform-origin="20 20">
<path class="font" d="m17.7,7.23h4.6c.52,0,.94.42.94.94v13.82c0,.52.42.94.94.94h3.39c.83,0,1.25,1.01.66,1.6l-7.56,7.56c-.37.37-.96.37-1.32,0l-7.56-7.56c-.59-.59-.17-1.6.66-1.6h3.39c.52,0,.94-.42.94-.94v-13.82c0-.52.42-.94.94-.94Z"/>
</g>
</svg>`,mg=`
<svg class="MLEP__array-buttons" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox=
"-2 -2 ${8*Ds+10*Jn+5} ${8*Ds+10*Jn+5}">
<rect
class="MLEP__array-insert-background rows"
x="0"
y="${Rr+Jn}"
height="${3*Rr}"
width="${Rr}"
rx="${Rr/2}"/>
<rect
class="MLEP__array-insert-background columns"
x="${Rr+Jn}"
y="0"
height="${Rr}"
width="${3*Rr}"
rx="${Rr/2}"/>
<g data-command='"moveDown"'>
${Zf(2*(Jn+Rr),2*Jn+3*Rr,0)}
</g>
<g data-command='"moveUp"'>
${Zf(2*(Jn+Rr),2*Jn+Rr,180)}
</g>
<g data-command='"moveToNextWord"'>
${Zf(2*Jn+3*Rr,2*(Jn+Rr),-90)}
</g>
<g data-command='"moveToPreviousWord"'>
${Zf(2*Jn+Rr,2*(Jn+Rr),90)}
</g>
<g>
<g data-command='"addColumnBefore"'>
${qf(2*Jn+Rr,Jn)}
</g>
<g data-command='"removeColumn"'>
${lp(2*Jn+2*Rr,Jn)}
</g>
<g data-command='"addColumnAfter"'>
${qf(2*Jn+3*Rr,Jn)}
</g>
<g data-command='"addRowBefore"'>
${qf(Jn,2*Jn+Rr)}
</g>
<g data-command='"removeRow"'>
${lp(Jn,2*Jn+2*Rr)}
</g>
<g data-command='"addRowAfter"'>
${qf(Jn,2*Jn+3*Rr)}
</g>
</svg>`,gg=e=>`
<svg id="matrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","matrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/></svg>`,_g=e=>`
<svg id="pmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","pmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4c-3.96,4.6-3.96,11.4,0,16"/>
<path class="cls-2" d="m22,4c3.96,4.6,3.96,11.4,0,16"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/></svg>`,up=e=>`
<svg id="Bmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","Bmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>
<path class="cls-2" d="m22,4c1.1,0,2,.9,2,2v3c0,1.66.9,3,2,3-1.1,0-2,1.34-2,3v3c0,1.1-.9,2-2,2"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
</svg>`,vg=e=>`
<svg id="bmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","bmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m6,4h-3v16h3"/>
<path class="cls-2" d="m22,4h3v16h-3"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
</svg>`,yg=e=>`
<svg id="vmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","vmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
<line class="cls-2" x1="4" y1="4" x2="4" y2="20"/>
<line class="cls-2" x1="24" y1="4" x2="24" y2="20"/>
</svg>`,bg=e=>`
<svg id="Vmatrix" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="-3.5 -3 35 30"
data-command='["setEnvironment","Vmatrix"]'>
<rect class="cls-1" width="28" height="24"/>
<circle cx="10" cy="8" r="1"/>
<circle cx="14" cy="12" r="1"/>
<circle cx="18" cy="16" r="1"/>
<line class="cls-2" x1="6" y1="4" x2="6" y2="20"/>
<line class="cls-2" x1="22" y1="4" x2="22" y2="20"/>
<line class="cls-2" x1="2" y1="4" x2="2" y2="20"/>
<line class="cls-2" x1="26" y1="4" x2="26" y2="20"/>
</svg>`,xg=e=>`
<svg id="cases" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","cases"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m10,4c-1.1,0-2,.9-2,2v3c0,1.66-.9,3-2,3,1.1,0,2,1.34,2,3v3c0,1.1.9,2,2,2"/>
<circle cx="13" cy="8" r="1"/>
<circle cx="13" cy="16" r="1"/>
<circle cx="21" cy="8" r="1"/>
<circle cx="21" cy="16" r="1"/>
</svg>`,wg=e=>`
<svg id="rcases" class="${e}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 24"
data-command='["setEnvironment","rcases"]'>
<rect class="cls-1" width="28" height="24"/>
<path class="cls-2" d="m18,20c1.1,0,2-.9,2-2v-3c0-1.66.9-3,2-3-1.1,0-2-1.34-2-3v-3c0-1.1-.9-2-2-2"/>
<circle cx="15" cy="8" r="1"/>
<circle cx="15" cy="16" r="1"/>
<circle cx="7" cy="8" r="1"/>
<circle cx="7" cy="16" r="1"/>
</svg>`,g0={matrix:gg,pmatrix:_g,bmatrix:vg,Bmatrix:up,vmatrix:yg,Vmatrix:bg},_0={cases:xg,rcases:wg,Bmatrix:up};function Sg(e){var i,r;const a=(i=e.model.parentEnvironment)==null?void 0:i.array;if(!a)return;let u=0;a.forEach(ge=>{(!u||ge.length>u)&&(u=ge.length)});let p=document.getElementById("mathlive-environment-popover");p||(p=Zt("mathlive-environment-popover"),_a("environment-popover"),_a("core"),p.setAttribute("aria-hidden","true"));let m;const b=p.querySelector(".MLEP__environment-controls");b?m=b:(m=document.createElement("div"),p.innerHTML="",p.appendChild(m)),m.className="MLEP__environment-controls",m.style.display="flex",m.style.width="100%",m.style.height="100%",m.style.boxSizing="border-box",m.innerHTML=mg;let w=[],E="";const I=e.model.parentEnvironment.environmentName;if(Bc(I)){const ge=kg(I);E=g0[ge]("active");const He=g0,{[ge]:Ft}=He,Ve=R(He,[ie(ge)]);w=Object.values(Ve).map(St=>St("inactive"))}else if(Id(I)){const ge=Tg(I);E=_0[ge]("active");const He=_0,{[ge]:Ft}=He,Ve=R(He,[ie(ge)]);w=Object.values(Ve).map(St=>St("inactive"))}else Rd(I)&&(E=g0.matrix("active"),w=Object.values(_0).map(ge=>ge("inactive")));const N=document.createElement("div");N.className="MLEP__environment-delimiter-controls",N.style.display="flex",N.style.flexDirection="column",N.innerHTML=`
<div class='MLEP__array-delimiter-options'>
${E}
${w.join("")}
</div>`,E&&m.appendChild(N),m.querySelectorAll("[data-command]").forEach(ge=>{const He=ge.dataset.command;let Ft=He;try{Ft=JSON.parse(He)}catch(Ve){}ge.addEventListener("mousedown",Ve=>Ve.preventDefault()),Ft&&ge.addEventListener("click",()=>e.executeCommand(Ft))});const oe=(r=e.field)==null?void 0:r.getBoundingClientRect();oe&&(p.style.top=`${window.scrollY+(oe.top-p.clientHeight-15)}px`,p.style.left=`${oe.left+20}px`,p.classList.add("is-visible"))}function v0(){const e=document.getElementById("mathlive-environment-popover");e==null||e.classList.remove("is-visible")}function Eg(){document.getElementById("mathlive-environment-popover")&&(xi("mathlive-environment-popover"),na("environment-popover"),na("core"))}function Yf(e){if(!e.hasFocus())return;let i=!1;if(e.model.mode==="math"){const r=e.model.parentEnvironment;if(r!=null&&r.array&&fo(r.environmentName)){const a=e.options.environmentPopoverPolicy;i=a==="auto"||a==="on"}}i?Sg(e):v0()}function kg(e){return e.replace("*","")}function Tg(e){return e==="dcases"?"cases":e}function cp(e){const i=getComputedStyle(e).direction;return i==="ltr"||i==="rtl"?i:"ltr"}function hp(e,i,r){return i==="left"||i==="leading"&&r==="ltr"||i==="trailing"&&r==="rtl"?e.left:e.right}function y0(e,i,r,a){return r==="middle"?e-i/2:r==="start"&&a==="rtl"||r==="end"&&a==="ltr"||r==="top"||r==="right"?Math.max(0,e-i):e}function Ag(e,i,r,a){return r==="middle"?e-i/2:r==="start"&&a==="ltr"||r==="end"&&a==="rtl"||r==="top"||r==="right"?e:e-i}function Lg(e,i){var r,a,u;const p=(r=cp(e))!=null?r:"ltr";e.style.position="fixed",e.style.left="",e.style.top="",e.style.right="",e.style.bottom="",e.style.height="",e.style.width="";const m=e.getBoundingClientRect(),b=Number.isFinite(i.maxHeight)?Math.min(i.maxHeight,window.innerHeight):window.innerHeight;let w=Math.min(b,(a=i.height)!=null?a:m.height),E=y0(i.location.y,w,i.verticalPos,p);E+w>window.innerHeight-8&&(i.alternateLocation?(E=y0(i.alternateLocation.y,w,i.verticalPos,p),E+w>window.innerHeight-8&&(E=void 0)):E=void 0),Number.isFinite(E)||(E=Math.max(8,window.innerHeight-8-w),8+w>window.innerHeight-8&&(e.style.bottom="8px")),w=Math.min(E+w,window.innerHeight-8)-E;const I=Number.isFinite(i.maxWidth)?Math.min(i.maxWidth,window.innerWidth):window.innerWidth;let N=Math.min(I,(u=i.width)!=null?u:m.width),J=y0(i.location.x,N,i.horizontalPos,p);J+N>window.innerWidth-8&&(i.alternateLocation?(J=Ag(i.alternateLocation.x,N,i.verticalPos,p),J+N>window.innerWidth-8&&(J=void 0)):J=void 0),Number.isFinite(J)||(J=Math.max(8,window.innerWidth-8-N),8+N>window.innerWidth-8&&(e.style.right="8px")),N=Math.min(J+N,window.innerWidth-8)-J,p==="rtl"?e.style.right=`${Math.ceil(window.innerWidth-J-N).toString()}px`:e.style.left=`${Math.ceil(J).toString()}px`,e.style.top=`${Math.ceil(E).toString()}px`,w!==m.height&&(e.style.height=`${Math.ceil(w).toString()}px`),N!==m.width&&(e.style.width=`${Math.ceil(N).toString()}px`)}function Dg(e,i){return Math.hypot(i.x-e.x,i.y-e.y)}function Gu(e){return"submenu"in e}function Ua(e){return"type"in e&&e.type==="command"||"onMenuSelect"in e||"id"in e}function b0(e){return"type"in e&&e.type==="divider"}function x0(e){return"type"in e&&e.type==="heading"}var fp={};function w0(e){let i=fp[e];if(!i){let r;switch(e){case"checkmark":r=`<span aria-hidden="true" class="ui-checkmark"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"></path></svg>
</span>`;break;case"trailing-chevron":r='<span aria-hidden="true" class="ui-trailing-chevron"><svg focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"></path></svg></span>';break;case"mixedmark":r='<span aria-hidden="true" class="ui-mixedmark"><svg xmlns="http://www.w3.org/2000/svg" width="16" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-13.3 10.7-24 24-24H488c13.3 0 24 10.7 24 24s-10.7 24-24 24H24c-13.3 0-24-10.7-24-24z"/></svg></span>'}if(r){const a=document.createElement("template");a.innerHTML=r,fp[e]=a,i=a}}if(i){if("content"in i)return i.content.cloneNode(!0);const r=document.createElement("svg");return r.innerHTML=i.innerHTML,r}}var dp=80,pp=class{constructor(e,i){this._element=null;var r;this.parentMenu=i,this._declaration=e,Gu(e)?(this.type="submenu",this.submenu=new mp(e.submenu,{parentMenu:i,submenuClass:e.submenuClass,columnCount:e.columnCount})):this.type=(r=e.type)!=null?r:"command",this.hasCheck=Ua(e)&&e.checked!==void 0}get rootMenu(){return this.parentMenu.rootMenu}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}dispose(){var e,i;(e=this._abortController)==null||e.abort(),this._abortController=void 0,(i=this._element)==null||i.remove(),this._element=null,this.submenu&&this.submenu.dispose(),this.submenu=void 0}get menuItem(){return this._declaration}get label(){var e;return(e=this._label)!=null?e:""}set label(e){e===void 0&&(e=""),e!==this._label&&(this._label=e,this.dirty=!0)}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.dirty=!0)}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.element&&(e?this.element.removeAttribute("aria-disabled"):this.element.setAttribute("aria-disabled","true")),this.dirty=!0}get checked(){return this._checked}set checked(e){this._checked=e,this.dirty=!0}get tooltip(){return this._tooltip}set tooltip(e){e!==this._tooltip&&(this._tooltip=e,this.dirty=!0)}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){e!==this._ariaLabel&&(this._ariaLabel=e,this.dirty=!0)}get active(){var e,i;return(i=(e=this.element)==null?void 0:e.classList.contains("active"))!=null?i:!1}set active(e){this.element&&this.element.classList.toggle("active",e)}updateState(e){var i,r,a;const u=this._declaration;if(b0(u)){this.enabled=!1,this.checked=!1;return}x0(u)&&(this.enabled=!1,this.checked=!1,this.visible=!0),Ua(u)&&(this.checked=Ua(u)&&((i=Hu(u.checked,e))!=null?i:!1)),(Ua(u)||Gu(u))&&(this.enabled=(r=Hu(u.enabled,e))!=null?r:!0,this.visible=(a=Hu(u.visible,e))!=null?a:!0,this.visible&&this.enabled&&this.submenu&&(this.submenu.updateState(e),this.submenu.visible||(this.visible=!1))),(Ua(u)||x0(u)||Gu(u))&&(this.label=Hu(u.label,e),this.tooltip=Hu(u.tooltip,e),this.ariaLabel=Hu(u.ariaLabel,e)),this._element&&this.updateElement()}set dirty(e){console.assert(e===!0),e&&this.parentMenu&&(this.parentMenu.dirty=!0)}updateElement(){if(!this.visible||!this.element)return;const e=this.element;e.textContent="",this.enabled?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true"),this.checked===!0?(e.setAttribute("aria-checked","true"),e.append(w0("checkmark"))):this.checked==="mixed"?(e.setAttribute("aria-checked","mixed"),e.append(w0("mixedmark"))):e.removeAttribute("aria-checked"),this.ariaLabel&&e.setAttribute("aria-label",this.ariaLabel);const i=document.createElement("span");if(i.className=this.parentMenu.hasCheck?"label indent":"label",this.type==="heading"&&i.classList.add("heading"),i.innerHTML=this.label,e.append(i),this._tooltip&&e.setAttribute("data-tooltip",this._tooltip),Ua(this._declaration)&&this._declaration.keyboardShortcut){const r=document.createElement("kbd");r.innerHTML=c(this._declaration.keyboardShortcut),e.append(r)}this.type==="submenu"&&e.append(w0("trailing-chevron"))}get element(){if(this._element)return this._element;if(b0(this._declaration)){const r=document.createElement("li");return r.setAttribute("part","menu-divider"),r.setAttribute("role","divider"),this._element=r,r}const e=document.createElement("li");this._element=e,(Ua(this._declaration)||x0(this._declaration)||Gu(this._declaration))&&this._declaration.class&&(e.className=this._declaration.class),e.setAttribute("part","menu-item"),e.setAttribute("tabindex","-1"),this.hasCheck?e.setAttribute("role","menuitemcheckbox"):e.setAttribute("role","menuitem"),this.type==="submenu"&&(e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"));const i=this.abortController.signal;return e.addEventListener("pointerenter",this,{signal:i}),e.addEventListener("pointerleave",this,{signal:i}),e.addEventListener("pointerup",this,{signal:i}),e.addEventListener("click",this,{signal:i}),this._element}dispatchSelect(){if(!Ua(this._declaration))return;const e=new CustomEvent("menu-select",{cancelable:!0,bubbles:!0,detail:{modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data}});this.parentMenu.dispatchEvent(e)&&typeof this._declaration.onMenuSelect=="function"&&this._declaration.onMenuSelect({modifiers:this.rootMenu.modifiers,id:this._declaration.id,data:this._declaration.data})}handleEvent(e){var i;if(!(!this.visible||!this.enabled)){if(e.type==="click"){this.rootMenu.state==="modal"&&this.select(),e.stopPropagation(),e.preventDefault();return}if(e.type==="pointerenter"){const r=e;this.rootMenu.cancelDelayedOperation(),this.parentMenu.isSubmenuOpen&&((i=this.parentMenu.activeMenuItem)!=null&&i.movingTowardSubmenu(r))?this.rootMenu.scheduleOperation(()=>{this.parentMenu.activeMenuItem=this,this.openSubmenu()}):(this.parentMenu.activeMenuItem=this,this.openSubmenu({withDelay:!0}));return}if(e.type==="pointerleave"){this.rootMenu.activeSubmenu===this.parentMenu&&(this.parentMenu.activeMenuItem=null);return}if(e.type==="pointerup"){this.rootMenu.state!=="modal"&&this.select(),e.stopPropagation(),e.preventDefault();return}}}select(){if(this.rootMenu.cancelDelayedOperation(),this.type==="submenu"){this.openSubmenu();return}this.active=!1,setTimeout(()=>{this.active=!0,setTimeout(()=>{this.rootMenu.hide(),this.dispatchSelect()},dp)},dp)}openSubmenu(e){var i;if(this.type!=="submenu"||!this.element)return;if((i=e==null?void 0:e.withDelay)!=null&&i){this.rootMenu.scheduleOperation(()=>this.openSubmenu());return}const r=this.element.getBoundingClientRect(),a=cp(this.element);this.submenu.show({container:this.rootMenu.element.parentNode,location:{x:hp(r,"trailing",a),y:r.top-4},alternateLocation:{x:hp(r,"leading",a),y:r.top-4}})}movingTowardSubmenu(e){if(!this.element||this.type!=="submenu")return!1;const i=this.rootMenu.lastMoveEvent;if(!i)return!1;const r=e.timeStamp-i.timeStamp;if(r>500)return!1;const a=e.clientX-i.clientX;if(Cg(a,i.clientY-e.clientY,r)<=.2)return!1;let p="right";if(this.submenu.element){const m=this.submenu.element.getBoundingClientRect(),b=this.element.getBoundingClientRect();m.left<b.left+b.width/2&&(p="left")}return p==="right"?a>0:a<0}};function Cg(e,i,r){return Math.hypot(e,i)/r}function Hu(e,i){return e===void 0||typeof e!="function"?e:(i!=null||(i={alt:!1,control:!1,shift:!1,meta:!1}),e(i))}var mp=class Qu{constructor(i,r){this._element=null,this._activeMenuItem=null,this._dirty=!0;var a,u;this.parentMenu=(a=r==null?void 0:r.parentMenu)!=null?a:null,this._submenuClass=r==null?void 0:r.submenuClass,this.columnCount=(u=r==null?void 0:r.columnCount)!=null?u:1,this.isSubmenuOpen=!1,this.menuItems=i}get children(){return this._menuItems}set menuItems(i){const r=this.parentMenu;this.dispose(),this.parentMenu=r,i=[...i],this._menuItems=i.map(a=>a.onCreate?a.onCreate(a,this):new pp(a,this)),this.hasCheck=void 0,this.dirty=!0}dispose(){var i;this.hide(),this._element&&this._element.remove(),this._abortController&&this._abortController.abort(),(i=this._menuItems)==null||i.forEach(r=>r.dispose()),this._menuItems=[],this._activeMenuItem=null,this.parentMenu=null}handleEvent(i){if(i.type==="wheel"&&this._element){const r=i;this._element.scrollBy(0,r.deltaY),i.stopPropagation()}}dispatchEvent(i){return this.rootMenu.dispatchEvent(i)}get rootMenu(){return this.parentMenu.rootMenu}updateState(i){var r,a,u;this._menuItems.forEach(E=>E.updateState(i));const p=this.hasCheck;this.hasCheck=this._menuItems.some(E=>E.visible&&E.hasCheck),this.hasCheck!==p&&this._menuItems.forEach(E=>E.updateState(i));let m,b=0;for(const E of this._menuItems)E.type==="heading"?(m&&b===0&&(m.visible=!1),m=E,b=0):E.type==="divider"&&m?(m.visible=b>0,m=void 0,b=0):m&&E.visible&&(b+=1);m&&(m.visible=b>0);let w=!0;for(const E of this._menuItems)E.type==="divider"?(E.visible=!w,w=!0):E.visible&&(w=!1);(r=this.activeMenuItem)!=null&&r.visible||(this.activeMenuItem=null),!((a=this.activeMenuItem)!=null&&a.enabled)&&((u=this.activeMenuItem)==null?void 0:u.type)==="submenu"&&this._activeMenuItem.submenu.hide(),this._dirty=!1}get enabled(){return this.updateIfDirty(),this._menuItems.some(i=>i.type!=="divider"&&i.visible&&i.enabled)}get visible(){return this.updateIfDirty(),this._menuItems.some(i=>i.type!=="divider"&&i.visible)}set dirty(i){console.assert(i===!0),this._dirty!==i&&i&&this.parentMenu&&(this._dirty=!0,this.parentMenu.dirty=!0)}updateIfDirty(){this._dirty&&this.updateState(this.rootMenu.modifiers)}updateElement(){var i;if(this._element){this._element.textContent="";for(const{element:r,visible:a}of this._menuItems)r&&a&&this._element.append(r);(i=this._element.querySelector("li:first-of-type"))==null||i.setAttribute("tabindex","0")}}get element(){if(this._element)return this._element;const i=document.createElement("menu");i.setAttribute("role","menu"),i.setAttribute("tabindex","-1"),i.setAttribute("aria-orientation","vertical"),i.setAttribute("part","ui-menu-container"),this._submenuClass&&i.classList.add(this._submenuClass),i.classList.add("ui-menu-container"),this._abortController||(this._abortController=new AbortController);const r=this._abortController.signal;return i.addEventListener("focus",this,{signal:r}),i.addEventListener("wheel",this,{passive:!0,signal:r}),this._element=i,this.updateElement(),i}get activeMenuItem(){return this._activeMenuItem}set activeMenuItem(i){var r,a,u,p;if(this.rootMenu.cancelDelayedOperation(),i!==this._activeMenuItem){if(this.activeMenuItem){const m=this.activeMenuItem;m.active=!1,(r=m.submenu)==null||r.hide()}if(!((a=i==null?void 0:i.visible)==null||a)){this._activeMenuItem=null;return}this._activeMenuItem=i,i&&(i.active=!0)}i?(u=i.element)==null||u.focus({preventScroll:!0}):(p=this._element)==null||p.focus({preventScroll:!0})}get firstMenuItem(){this.updateIfDirty();let i=0,r=!1;const a=this._menuItems;for(;!r&&i<=a.length-1;){const u=a[i];r=u.type!=="divider"&&u.visible&&u.enabled,i+=1}return r?a[i-1]:null}get lastMenuItem(){this.updateIfDirty();const i=this._menuItems;let r=i.length-1,a=!1;for(;!a&&r>=0;){const u=i[r];a=u.type!=="divider"&&u.visible&&u.enabled,r-=1}return a?i[r+1]:null}nextMenuItem(i){if(i===0)return this._activeMenuItem;if(!this._activeMenuItem)return i>0?this.firstMenuItem:this.lastMenuItem;if(!this.firstMenuItem||!this.lastMenuItem||!this._activeMenuItem)return null;this.updateIfDirty();const r=this._menuItems.indexOf(this.firstMenuItem),a=this._menuItems.indexOf(this.lastMenuItem);let u=this._menuItems.indexOf(this._activeMenuItem),p=1;for(;u>=r&&u<=a;){u+=i>0?1:-1;const m=this._menuItems[u];if(!m)break;if(m.visible&&m.enabled){if(p===Math.abs(i))return this._menuItems[u];p+=1}}return i>0?this.lastMenuItem:this.firstMenuItem}getMenuItemColumn(i){this.updateIfDirty();const a=this._menuItems.filter(u=>u.visible&&u.enabled).indexOf(i);return a<0?-1:a%this.columnCount}static get collator(){return Qu._collator||(Qu._collator=new Intl.Collator(void 0,{usage:"search",sensitivity:"base"})),Qu._collator}findMenuItem(i){var r;this.updateIfDirty();const a=this._menuItems.filter(b=>b.type!=="divider"&&b.visible&&b.enabled);if(a.length===0)return null;const u=Math.max(...a.map(b=>b.label.length))-i.length;if(u<0)return null;let p=null,m=0;for(;m<u&&!p;)p=(r=a.find(b=>Qu.collator.compare(i,b.label.substring(m,i.length))===0))!=null?r:null,m++;return p}show(i){return!this.visible||!i.container?!1:(this.updateElement(),i.container.appendChild(this.element),K()&&(this.element.popover="manual",this.element.showPopover()),i.location&&Lg(this.element,{location:i.location,alternateLocation:i.alternateLocation,verticalPos:"bottom",horizontalPos:"start"}),this.element.focus({preventScroll:!0}),this.parentMenu&&(this.parentMenu.openSubmenu=this),!0)}hide(){var i,r,a,u,p;this.openSubmenu=null,this.activeMenuItem=null,this.parentMenu&&(this.parentMenu.openSubmenu=null),K()&&((i=this._element)!=null&&i.popover)&&this.element.hidePopover(),(a=(r=this.parentMenu)==null?void 0:r.element)==null||a.focus(),(p=(u=this._element)==null?void 0:u.parentNode)==null||p.removeChild(this._element)}set openSubmenu(i){var r,a,u,p;const m=i!==null;((r=this.activeMenuItem)==null?void 0:r.type)==="submenu"&&((a=this.activeMenuItem.element)==null||a.setAttribute("aria-expanded",m.toString())),(p=(u=this.activeMenuItem)==null?void 0:u.element)==null||p.classList.toggle("is-submenu-open",m),this.isSubmenuOpen=m}},gp=class vm extends mp{constructor(i,r){var a;super(i),this.state="closed",this.typingBufferResetTimer=0,this.hysteresisTimer=0,this._updating=!1,this._host=(a=r==null?void 0:r.host)!=null?a:null,this.isDynamic=i.some(_p),this._modifiers={shift:!1,control:!1,alt:!1,meta:!1},this.typingBuffer="",this.state="closed"}get modifiers(){return this._modifiers}set modifiers(i){g(this._modifiers,i)||(this._modifiers=i,this.dirty=!0)}get activeSubmenu(){let i=this;for(;i.isSubmenuOpen;)i=i.activeMenuItem.submenu;return i}set dirty(i){this._updating||(console.assert(i===!0),this._dirty!==i&&(this._dirty=!0,i&&setTimeout(()=>{this.updateState(this.modifiers),this.updateElement()})))}updateState(i){this._updating=!0,this.modifiers=i!=null?i:this.modifiers,super.updateState(this.modifiers),this._updating=!1}handleKeyupEvent(i){this.isDynamic&&(this.modifiers=_(i)),i.stopImmediatePropagation()}handleKeydownEvent(i){var r,a,u;if(i.key==="Tab"||i.key==="Escape"){this.hide();return}this.isDynamic&&(this.modifiers=_(i));let p=!0;const m=this.activeSubmenu,b=m.activeMenuItem;switch(i.key){case" ":case"Space":case"Return":case"Enter":b==null||b.select(_(i));break;case"ArrowRight":if((b==null?void 0:b.type)==="submenu")b.select(_(i)),this.activeSubmenu.activeMenuItem=this.activeSubmenu.firstMenuItem;else if(!b)m.activeMenuItem=m.firstMenuItem;else{const w=(r=m.getMenuItemColumn(b))!=null?r:-1;if(w>=0&&w<((a=m.columnCount)!=null?a:1)-1){const E=m.nextMenuItem(1);E&&(m.activeMenuItem=E)}}break;case"ArrowLeft":if(m===this.rootMenu)b||(m.activeMenuItem=m.firstMenuItem);else if((b&&(u=m.getMenuItemColumn(b))!=null?u:-1)<=0||!b){m.hide();const E=m.parentMenu.activeMenuItem;if(E){const{element:I}=E;I==null||I.focus(),I==null||I.classList.remove("is-submenu-open")}}else{const E=m.nextMenuItem(-1);E&&(m.activeMenuItem=E)}break;case"ArrowDown":m.activeMenuItem=m.nextMenuItem(m.columnCount);break;case"ArrowUp":m.activeMenuItem=m.nextMenuItem(-m.columnCount);break;case"Home":case"PageUp":m.activeMenuItem=m.firstMenuItem;break;case"End":case"PageDown":m.activeMenuItem=m.lastMenuItem;break;case"Backspace":if(this.typingBuffer&&(this.typingBuffer=this.typingBuffer.slice(0,-1),this.typingBuffer)){clearTimeout(this.typingBufferResetTimer);const w=m.findMenuItem(this.typingBuffer);w&&(m.activeMenuItem=w),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}break;default:if(y(i)){isFinite(this.typingBufferResetTimer)&&clearTimeout(this.typingBufferResetTimer),this.typingBuffer+=i.key;const w=m.findMenuItem(this.typingBuffer);w&&(m.activeMenuItem=w),this.typingBufferResetTimer=setTimeout(()=>{this.typingBuffer=""},500)}else p=!1}p&&(i.preventDefault(),i.stopPropagation())}handleEvent(i){if(i.type==="keydown")this.handleKeydownEvent(i);else if(i.type==="keyup")this.handleKeyupEvent(i);else if(i.type==="pointermove")this.lastMoveEvent=i;else if(i.type==="pointerup"&&i.target===this.scrim)Number.isFinite(this.rootMenu._openTimestamp)&&Date.now()-this.rootMenu._openTimestamp<120?this.state="modal":this.state==="modal"&&this.hide();else if(i.type==="contextmenu"){i.preventDefault(),i.stopPropagation();return}super.handleEvent(i)}dispatchEvent(i){return this._host?this._host.dispatchEvent(i):!0}get scrim(){return L.element}connectScrim(i){const r=this.scrim;r.addEventListener("pointerup",this),r.addEventListener("contextmenu",this),r.addEventListener("keydown",this),r.addEventListener("keyup",this),r.addEventListener("pointermove",this),L.open({root:i,onDismiss:()=>this.hide()})}disconnectScrim(){const i=this.scrim;i.removeEventListener("pointerup",this),i.removeEventListener("contextmenu",this),i.removeEventListener("keydown",this),i.removeEventListener("keyup",this),i.removeEventListener("pointermove",this),L.state==="open"&&L.scrim.close()}get rootMenu(){return this}show(i){return this._onDismiss=i==null?void 0:i.onDismiss,i!=null&&i.modifiers&&(this.modifiers=i.modifiers),this.updateState(),this.connectScrim(i==null?void 0:i.target),super.show(f(P({},i),{container:this.scrim}))?(this._openTimestamp=Date.now(),this.state="open",!0):(this.disconnectScrim(),!1)}hide(){this.cancelDelayedOperation(),this.state!==void 0&&(this.state!=="closed"&&(this.activeMenuItem=null,L.element.parentElement.focus(),super.hide(),this.state="closed",this.disconnectScrim()),this._onDismiss&&(this._onDismiss(),this._onDismiss=void 0))}scheduleOperation(i){this.cancelDelayedOperation();const r=vm.SUBMENU_DELAY;if(r<=0){i();return}this.hysteresisTimer=setTimeout(()=>{this.hysteresisTimer=0,i()},r)}cancelDelayedOperation(){this.hysteresisTimer&&(clearTimeout(this.hysteresisTimer),this.hysteresisTimer=0)}};gp.SUBMENU_DELAY=120;var Mg=gp;function _p(e){return b0(e)?!1:typeof e.label=="function"||typeof e.ariaLabel=="function"||typeof e.tooltip=="function"||(Ua(e)||Gu(e))&&(typeof e.enabled=="function"||typeof e.visible=="function")||Ua(e)&&typeof e.checked=="function"?!0:Gu(e)?e.submenu.some(_p):!1}var Xf=class{};Xf.DELAY=300,Xf.MAX_DISTANCE=10;function Ig(e){return new Promise((i,r)=>{const a=d(e);a||i(!1);let u=a;const p=setTimeout(()=>{m.abort(),i(Dg(u,a)<Xf.MAX_DISTANCE)},Xf.DELAY),m=new AbortController,b=m.signal;for(const w of["pointermove","pointerup","pointercancel"])window.addEventListener(w,E=>{if(E.type==="pointerup"||E.type==="pointercancel")clearTimeout(p),m.abort(),i(!1);else if(E.type==="pointermove"){const I=d(E);I&&(u=I)}},{passive:!0,signal:b})})}function vp(e,i,r){return cl(this,null,function*(){if(e.type==="contextmenu"){const a=e;if(r.show({target:i,location:d(a),modifiers:_(a)}))return e.preventDefault(),e.stopPropagation(),!0}if(e.type==="keydown"){const a=e;if(a.code==="ContextMenu"||a.code==="F10"&&a.shiftKey){const u=i==null?void 0:i.getBoundingClientRect();if(u&&r.show({target:i,location:{x:Math.ceil(u.left+u.width/2),y:Math.ceil(u.top+u.height/2)},modifiers:_(a)}))return e.preventDefault(),e.stopPropagation(),!0}}if(e.type==="pointerdown"&&e.pointerType!=="mouse"&&e.button===0){let a=e.target;for(;a&&i!==a;)a=a.parentNode;if(!a||!r.visible)return!1;const u=d(e);if(yield Ig(e))return r.state!=="closed"?!1:(r.show({target:i,location:u}),!0)}return!1})}var yp={acute:714,grave:715,dot:729,ddot:168,mathring:730,tilde:126,bar:713,breve:728,check:711,hat:94,vec:8407};Se(Object.keys(yp),"{body:auto}",{createAtom:e=>new Il(f(P({},e),{body:Ie(e.args[0]),accentChar:yp[e.command.slice(1)]}))}),Se(["widehat","widecheck","widetilde"],"{body:auto}",{createAtom:e=>{const i=vt(Ie(e.args[0]));return new Il(f(P({},e),{body:Ie(e.args[0]),svgAccent:e.command.slice(1)+(i.length>5?"4":["1","1","2","2","3","3"][i.length])}))}}),Se(["overarc","overparen","wideparen"],"{body:auto}",{createAtom:e=>new Il(f(P({},e),{body:Ie(e.args[0]),svgAccent:"overarc"}))}),Se(["underarc","underparen"],"{body:auto}",{createAtom:e=>new Ns(f(P({},e),{body:Ie(e.args[0]),svgBelow:"underarc"}))}),Se("utilde","{body:auto}",{createAtom:e=>{const i=Ie(e.args[0]),r=vt(i),a="widetilde"+(r.length>5?"4":["1","1","2","2","3","3"][r.length]);return new Ns(f(P({},e),{body:i,svgBelow:a,boxType:Vo(i)}))}}),Se("^","{:string}",{createAtom:e=>{var i;return new ut(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={a:"\xE2",e:"\xEA",i:"\xEE",o:"\xF4",u:"\xFB",A:"\xC2",E:"\xCA",I:"\xCE",O:"\xD4",U:"\xDB"}[e.args[0]])!=null?i:"^"}))}}),Se("`","{:string}",{createAtom:e=>{var i;return new ut(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={a:"\xE0",e:"\xE8",i:"\xEC",o:"\xF2",u:"\xF9",A:"\xC0",E:"\xC8",I:"\xCC",O:"\xD2",U:"\xD9"}[e.args[0]])!=null?i:"`"}))}}),Se("'","{:string}",{createAtom:e=>{var i;return new ut(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={a:"\xE1",e:"\xE9",i:"\xED",o:"\xF3",u:"\xFA",A:"\xC1",E:"\xC9",I:"\xCD",O:"\xD3",U:"\xDA"}[e.args[0]])!=null?i:"'"}))}}),Se('"',"{:string}",{createAtom:e=>{var i,r;return new ut(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(i=e.args)!=null&&i[0]?(r={a:"\xE4",e:"\xEB",i:"\xEF",o:"\xF6",u:"\xFC",A:"\xC4",E:"\xCB",I:"\xCB",O:"\xD6",U:"\xDC"}[e.args[0]])!=null?r:'"'+e.args[0]:'"'}))}}),Se(".","{:string}",{createAtom:e=>{var i,r;return new ut(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(i=e.args)!=null&&i[0]?(r={a:"\u0227",e:"\u0117",i:"\u0307i",o:"\u022F",u:"\u0307u",A:"\u0226",E:"\u0116",I:"\u0130",O:"\u022E",U:"\u0307U"}[e.args[0]])!=null?r:"."+e.args[0]:"."}))}}),Se("=","{:string}",{createAtom:e=>{var i,r;return new ut(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:(i=e.args)!=null&&i[0]?(r={a:"\u0101",e:"\u0113",i:"\u012B",o:"\u014D",u:"\u016B",A:"\u0100",E:"\u0112",I:"\u012A",O:"\u014C",U:"\u016A"}[e.args[0]])!=null?r:"="+e.args[0]:"="}))}}),Se("~","{:string}",{createAtom:e=>{var i;return new ut(f(P({type:"mord"},e),{isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={n:"\xF1",N:"\xD1",a:"\xE3",o:"\xF5",A:"\xC3",O:"\xD5"}[e.args[0]])!=null?i:"\xB4"}))}}),Se("c","{:string}",{createAtom:e=>{var i;return new ut(f(P({},e),{type:"mord",isFunction:!1,limits:"adjacent",value:e.args[0]&&(i={c:"\xE7",C:"\xC7"}[e.args[0]])!=null?i:""}))}}),Se("enclose","{notation:string}[style:string]{body:auto}",{createAtom:e=>{var i,r;const a=e.args,u={strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",backgroundcolor:"transparent",padding:"auto",shadow:"none",svgStrokeStyle:void 0,borderStyle:void 0,style:(i=e.style)!=null?i:{}};if(a[1]){const m=a[1].split(/,(?![^(]*\)(?:(?:[^(]*\)){2})*[^"]*$)/);for(const b of m){const w=b.match(/\s*(\S+)\s+(\S+)\s+(.*)/);if(w)u.strokeWidth=w[1],u.strokeStyle=w[2],u.strokeColor=w[3];else{const E=b.match(/\s*([a-z]*)\s*=\s*"(.*)"/);E&&(E[1]==="mathbackground"?u.backgroundcolor=E[2]:E[1]==="mathcolor"?u.strokeColor=E[2]:E[1]==="padding"?u.padding=E[2]:E[1]==="shadow"&&(u.shadow=E[2]))}}u.strokeStyle==="dashed"?u.svgStrokeStyle="5,5":u.strokeStyle==="dotted"&&(u.svgStrokeStyle="1,5")}u.borderStyle=`${u.strokeWidth} ${u.strokeStyle} ${u.strokeColor}`;const p={};return((r=a[0])!=null?r:"").split(/[, ]/).filter(m=>m.length>0).forEach(m=>{p[m.toLowerCase()]=!0}),new Xo(e.command,Ie(a[2]),p,u)}}),Se("cancel","{body:auto}",{createAtom:e=>{var i;return new Xo(e.command,Ie(e.args[0]),{updiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),Se("bcancel","{body:auto}",{createAtom:e=>{var i;return new Xo(e.command,Ie(e.args[0]),{downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),Se("xcancel","{body:auto}",{createAtom:e=>{var i;return new Xo(e.command,Ie(e.args[0]),{updiagonalstrike:!0,downdiagonalstrike:!0},{strokeColor:"currentColor",strokeWidth:"",strokeStyle:"solid",borderStyle:"1px solid currentColor",backgroundcolor:"transparent",padding:"auto",shadow:"none",style:(i=e.style)!=null?i:{}})}}),Se(["overrightarrow","overleftarrow","Overrightarrow","overleftharpoon","overrightharpoon","overleftrightarrow","overlinesegment","overgroup"],"{:auto}",{createAtom:e=>{var i;return new Ns(f(P({},e),{body:Ie((i=e.args)==null?void 0:i[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgAbove:e.command.slice(1)}))}}),Se("overbrace","{:auto}",{createAtom:e=>new Ns(f(P({},e),{body:Ie(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgAbove:e.command.slice(1)}))}),Se(["underrightarrow","underleftarrow","underleftrightarrow","underlinesegment","undergroup"],"{:auto}",{createAtom:e=>new Ns(f(P({},e),{body:Ie(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"rel",svgBelow:e.command.slice(1)}))}),Se(["underbrace"],"{:auto}",{createAtom:e=>new Ns(f(P({},e),{body:Ie(e.args[0]),skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,boxType:"ord",svgBelow:e.command.slice(1)}))}),Se(["xrightarrow","longrightarrow","xleftarrow","longleftarrow","xRightarrow","xLeftarrow","xleftharpoonup","xleftharpoondown","xrightharpoonup","xrightharpoondown","xlongequal","xtwoheadleftarrow","xtwoheadrightarrow","xleftrightarrow","longleftrightarrow","xLeftrightarrow","xrightleftharpoons","longrightleftharpoons","xleftrightharpoons","xhookleftarrow","xhookrightarrow","xmapsto","xtofrom","xleftrightarrows","longleftrightarrows","xRightleftharpoons","longRightleftharpoons","xLeftrightharpoons","longLeftrightharpoons"],"[:auto]{:auto}",{createAtom:e=>{var i,r,a,u,p;return new Ns(f(P({},e),{svgBody:e.command.slice(1),above:((r=Ie((i=e.args)==null?void 0:i[1]))==null?void 0:r.length)===0?void 0:Ie((a=e.args)==null?void 0:a[1]),below:(p=Ie((u=e.args)==null?void 0:u[0]))!=null?p:null,skipBoundary:!1,supsubPlacement:"over-under",paddedBody:!0,paddedLabels:!0,boxType:"rel"}))},serialize:(e,i)=>e.command+(e.hasEmptyBranch("below")?"":`[${e.belowToLatex(i)}]`)+`{${e.aboveToLatex(i)}}${e.supsubToLatex(i)}`}),Se(["arccos","arcsin","arctan","arctg","arcctg","arg","ch","cos","cosh","cot","cotg","coth","ctg","cth","csc","cosec","deg","dim","exp","gcd","hom","inf","ker","lb","lg","ln","log","Pr","sec","sh","sin","sinh","sup","tan","tanh","tg","th","arcsec","arccsc","arsinh","arcosh","artanh","arcsech","arccsch"],"",{isFunction:!0,ifMode:"math",createAtom:e=>new _o(e.command.slice(1),f(P({},e),{limits:"adjacent",isFunction:!0,variant:"main",variantStyle:"up"}))}),Se(["liminf","limsup"],"",{ifMode:"math",createAtom:e=>new _o({"\\liminf":"lim inf","\\limsup":"lim sup"}[e.command],f(P({},e),{limits:"over-under",variant:"main"}))}),Se(["lim","mod"],"",{ifMode:"math",createAtom:e=>new _o(e.command.slice(1),f(P({},e),{limits:"over-under",variant:"main"}))}),Se(["det","max","min"],"",{ifMode:"math",isFunction:!0,createAtom:e=>new _o(e.command.slice(1),f(P({},e),{limits:"over-under",isFunction:!0,variant:"main"}))}),Se(["ang"],"{:math}",{ifMode:"math",createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>`\\ang{${e.bodyToLatex(i)}}`,render:(e,i)=>{const r=e.createBox(i),a=r.caret;r.caret=void 0;const u=new $t("\xB0",{style:f(P({},e.style),{variant:"normal",variantStyle:"up"})});return new $t([r,u],{type:"inner",isSelected:e.isSelected,caret:a})}}),Se("sqrt","[index:auto]{radicand:expression}",{ifMode:"math",createAtom:e=>new Gc(f(P({},e),{body:Ie(e.args[1]),index:e.args[0]?Ie(e.args[0]):void 0}))}),Se(["frac","dfrac","tfrac","cfrac","binom","dbinom","tbinom"],"{:expression}{:expression}",{ifMode:"math",createAtom:e=>{const i=P({},e),r=e.command,a=e.args;switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":i.hasBarLine=!0;break;case"\\atopfrac":i.hasBarLine=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":i.hasBarLine=!1,i.leftDelim="(",i.rightDelim=")";break;case"\\cfrac":i.hasBarLine=!0,i.continuousFraction=!0;break;default:}switch(r){case"\\dfrac":case"\\dbinom":i.mathstyleName="displaystyle";break;case"\\tfrac":case"\\tbinom":i.mathstyleName="textstyle";break;default:}return new Jo(a[0]?Ie(a[0]):[new ya],a[1]?Ie(a[1]):[new ya],i)},serialize:(e,i)=>{const r=e.aboveToLatex(i),a=e.belowToLatex(i);return/^[0-9]$/.test(r)&&/^[0-9]$/.test(a)?`${e.command}${r}${a}`:ir(e.command,r,a)}}),Se(["brace","brack"],"",{infix:!0,createAtom:e=>new Jo(Ie(e.args[0]),Ie(e.args[1]),f(P({},e),{hasBarLine:!1,leftDelim:e.command==="\\brace"?"\\lbrace":"\\lbrack",rightDelim:e.command==="\\brace"?"\\rbrace":"\\rbrack"})),serialize:(e,i)=>on([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),Se(["over","atop","choose"],"",{infix:!0,createAtom:e=>{let i,r;const a=e.args;return e.command==="\\choose"&&(i="(",r=")"),new Jo(Ie(a[0]),Ie(a[1]),f(P({},e),{hasBarLine:e.command==="\\over",leftDelim:i,rightDelim:r}))},serialize:(e,i)=>on([e.aboveToLatex(i),e.command,e.belowToLatex(i)])}),Se(["overwithdelims","atopwithdelims"],"{numer:auto}{denom:auto}{left-delim:delim}{right-delim:delim}",{infix:!0,createAtom:e=>{var i,r;const a=e.args;return new Jo(Ie(a[0]),Ie(a[1]),f(P({},e),{leftDelim:(i=a[2])!=null?i:".",rightDelim:(r=a[3])!=null?r:".",hasBarLine:!1}))},serialize:(e,i)=>`${e.aboveToLatex(i)} ${e.command}${e.leftDelim}${e.rightDelim}${e.belowToLatex(i)}`}),Se("pdiff","{numerator}{denominator}",{ifMode:"math",createAtom:e=>new Jo(Ie(e.args[0]),Ie(e.args[1]),f(P({},e),{hasBarLine:!0,numerPrefix:"\u2202",denomPrefix:"\u2202"}))}),Se(["sum","prod","bigcup","bigcap","coprod","bigvee","bigwedge","biguplus","bigotimes","bigoplus","bigodot","bigsqcup","intop"],"",{ifMode:"math",createAtom:e=>new Ol({coprod:"\u2210",bigvee:"\u22C1",bigwedge:"\u22C0",biguplus:"\u2A04",bigcap:"\u22C2",bigcup:"\u22C3",intop:"\u222B",prod:"\u220F",sum:"\u2211",bigotimes:"\u2A02",bigoplus:"\u2A01",bigodot:"\u2A00",bigsqcup:"\u2A06",smallint:"\u222B"}[e.command.slice(1)],f(P({},e),{limits:"auto",variant:"main"}))}),Se("smallint","",{ifMode:"math",createAtom:e=>new _o("\u222B",f(P({},e),{limits:"adjacent",variant:"main"}))});var bp={int:"\u222B",iint:"\u222C",iiint:"\u222D",oint:"\u222E",oiint:"\u222F",oiiint:"\u2230",intclockwise:"\u2231",varointclockwise:"\u2232",ointctrclockwise:"\u2233",intctrclockwise:"\u2A11",sqcup:"\u2294",sqcap:"\u2293",uplus:"\u228E",wr:"\u2240",amalg:"\u2A3F",Cap:"\u22D2",Cup:"\u22D3",doublecap:"\u22D2",doublecup:"\u22D3"};Se(Object.keys(bp),"",{ifMode:"math",createAtom:e=>{const i=e.command,r=bp[i.slice(1)];return new Ol(r,f(P({},e),{limits:"adjacent",variant:{"\u22D2":"ams","\u22D3":"ams"}[r]}))}}),Se(["Re","Im"],"",{ifMode:"math",createAtom:e=>new _o({"\\Re":"\u211C","\\Im":"\u2111"}[e.command],f(P({},e),{limits:"adjacent",isFunction:!0,variant:"fraktur"}))}),Se("middle","{:delim}",{ifMode:"math",createAtom:e=>{var i;return new Uc(f(P({},e),{delim:(i=e.args[0])!=null?i:"|",size:1}))}}),Se("the","{:value}",{createAtom:e=>new ut(f(P({},e),{captureSelection:!0,verbatimLatex:null})),render:(e,i)=>{var r;const a=new fn({parent:i},e.style);let u="";e.isSelected&&(u+=" ML__selected");const p=a.evaluate(e.args[0]);return new $t(((r=Yn(p))!=null?r:"").split("").map(m=>new $t(m,{type:"ord",classes:u,mode:e.mode,isSelected:e.isSelected,style:P({variant:"main"},e.style)})),{type:"lift",style:e.style,caret:e.caret,isSelected:e.isSelected,classes:u}).wrap(a)},serialize:e=>{var i;return`\\the${(i=Yn(e.args[0]))!=null?i:"\\relax"}`}}),Se("mathtip","{:auto}{:math}",{createAtom:e=>new Hc(f(P({},e),{body:Ie(e.args[0]),tooltip:Ie(e.args[1]),content:"math"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${ut.serialize([e.tooltip],f(P({},i),{defaultMode:"math"}))}}`}),Se("texttip","{:auto}{:text}",{createAtom:e=>new Hc(f(P({},e),{body:Ie(e.args[0]),tooltip:Ie(e.args[1]),content:"text"})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\texttip{${e.bodyToLatex(i)}}{${ut.serialize([e.tooltip],f(P({},i),{defaultMode:"text"}))}}`}),Se("error","{:math}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>`\\error{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__error"})}),Se("ensuremath","{:math}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>`${e.command}{${e.bodyToLatex(f(P({},i),{defaultMode:"math"}))}}`}),Se("color","{:value}",{applyStyle:(e,i,r)=>{var a,u;return{verbatimColor:(a=Yn(i[0]))!=null?a:void 0,color:r.toColor((u=i[0])!=null?u:{string:"red"})}}}),Se("textcolor","{:value}{content:auto*}",{applyStyle:(e,i,r)=>{var a,u;return{verbatimColor:(a=Yn(i[0]))!=null?a:void 0,color:r.toColor((u=i[0])!=null?u:{string:"red"})}}}),Se("boxed","{content:math}",{createAtom:e=>new Oa(f(P({},e),{body:Ie(e.args[0]),framecolor:{string:"black"}}))}),Se("colorbox","{:value}{:text*}",{applyStyle:(e,i,r)=>{var a,u;return{verbatimBackgroundColor:(a=Yn(i[0]))!=null?a:void 0,backgroundColor:r.toBackgroundColor((u=i[0])!=null?u:{string:"yellow"})}}}),Se("fcolorbox","{frame-color:value}{background-color:value}{content:text}",{applyMode:"text",createAtom:e=>{var i,r;return new Oa(f(P({},e),{body:Ie(e.args[2]),framecolor:(i=e.args[0])!=null?i:{string:"blue"},backgroundcolor:(r=e.args[1])!=null?r:{string:"yellow"}}))},serialize:(e,i)=>{var r,a;return i.skipStyles?e.bodyToLatex(f(P({},i),{defaultMode:"text"})):ir(e.command,(r=Yn(e.framecolor))!=null?r:"",(a=Yn(e.backgroundcolor))!=null?a:"",e.bodyToLatex(f(P({},i),{defaultMode:"text"})))}}),Se("bbox","[:bbox]{body:auto}",{createAtom:e=>{var i;const r=e.args[0],a=Ie(e.args[1]);return r?new Oa(f(P({},e),{body:a,padding:r.padding,border:r.border,backgroundcolor:(i=r.backgroundcolor)!=null?i:void 0})):new Oa(f(P({},e),{body:a}))},serialize:(e,i)=>{var r,a;if(i.skipStyles)return e.bodyToLatex(i);let u=e.command;if(Number.isFinite(e.padding)||e.border!==void 0||e.backgroundcolor!==void 0){const p=[];e.padding&&p.push((r=Yn(e.padding))!=null?r:""),e.border&&p.push(`border: ${e.border}`),e.backgroundcolor&&p.push((a=Yn(e.backgroundcolor))!=null?a:""),u+=`[${p.join(",")}]`}return ir(u,e.bodyToLatex(i))}}),Se(["displaystyle","textstyle","scriptstyle","scriptscriptstyle"],"{:rest}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[0])})),render:(e,i)=>{const r=new fn({parent:i,mathstyle:e.command.slice(1)},e.style),a=ut.createBox(r,e.body,{type:"lift"});return e.caret&&(a.caret=e.caret),e.bind(i,a)},serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{${on([e.command,e.bodyToLatex(i)])}}`}),Se(["tiny","scriptsize","footnotesize","small","normalsize","large","Large","LARGE","huge","Huge"],"",{applyStyle:e=>({fontSize:{"\\tiny":1,"\\scriptsize":2,"\\footnotesize":3,"\\small":4,"\\normalsize":5,"\\large":6,"\\Large":7,"\\LARGE":8,"\\huge":9,"\\Huge":10}[e]})}),Se("fontseries","{:string}",{ifMode:"text",applyStyle:(e,i)=>{var r;return{fontSeries:(r=i[0])!=null?r:"auto"}}}),Se("fontshape","{:string}",{ifMode:"text",applyStyle:(e,i)=>{var r;return{fontShape:(r=i[0])!=null?r:"auto"}}}),Se("fontfamily","{:string}",{ifMode:"text",applyStyle:(e,i)=>{var r;return{fontFamily:(r=i[0])!=null?r:"roman"}}}),Se("selectfont","",{ifMode:"text",applyStyle:()=>({})}),Se("bf","{:rest}",{applyStyle:()=>({fontSeries:"b",fontShape:"n",fontFamily:"roman"})}),Se(["boldsymbol","bm"],"{:math}",{applyMode:"math",createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>`${e.command}{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__boldsymbol"})}),Se("bold","{:math*}",{applyMode:"math",applyStyle:()=>({variantStyle:"bold"})}),Se("bfseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),Se("mdseries","{:rest}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),Se("upshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),Se("slshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),Se("scshape","{:rest}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),Se("textbf","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"b"})}),Se("textmd","{:text*}",{applyMode:"text",applyStyle:()=>({fontSeries:"m"})}),Se("textup","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n"})}),Se("textnormal","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"n",fontSeries:"m"})}),Se("textsl","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sl"})}),Se("textit","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"it"})}),Se("textsc","{:text*}",{applyMode:"text",applyStyle:()=>({fontShape:"sc"})}),Se("textrm","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"roman"})}),Se("textsf","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"sans-serif"})}),Se("texttt","{:text*}",{applyMode:"text",applyStyle:()=>({fontFamily:"monospace"})}),Se("mathbf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"bold"})}),Se("mathit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"italic"})}),Se("mathnormal","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"italic"})}),Se("mathbfit","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"main",variantStyle:"bolditalic"})}),Se("mathrm","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"normal",variantStyle:"up"})}),Se("mathsf","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"sans-serif",variantStyle:"up"})}),Se("mathtt","{:math*}",{applyMode:"math",applyStyle:()=>({variant:"monospace",variantStyle:"up"})}),Se("it","{:rest}",{applyStyle:()=>({fontSeries:"m",fontShape:"it",fontFamily:"roman",variantStyle:"italic"})}),Se("rmfamily","",{applyStyle:()=>({fontFamily:"roman"})}),Se("sffamily","",{applyStyle:()=>({fontFamily:"sans-serif"})}),Se("ttfamily","",{applyStyle:()=>({fontFamily:"monospace"})}),Se(["Bbb","mathbb"],"{:math*}",{applyStyle:()=>({variant:"double-struck",variantStyle:"up"})}),Se(["frak","mathfrak"],"{:math*}",{applyStyle:()=>({variant:"fraktur",variantStyle:"up"})}),Se("mathcal","{:math*}",{applyStyle:()=>({variant:"calligraphic",variantStyle:"up"})}),Se("mathscr","{:math*}",{applyStyle:()=>({variant:"script",variantStyle:"up"})}),Se("mbox","{:text}",{ifMode:"math",createAtom:e=>new ut(f(P({},e),{type:"mord",body:Ie(e.args[0]),mode:"math"})),serialize:(e,i)=>ir("\\mbox",e.bodyToLatex(f(P({},i),{defaultMode:"text"})))}),Se("text","{:text}",{ifMode:"math",applyMode:"text"}),Se(["class","htmlClass"],"{name:string}{content:auto}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>!e.args[0]||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`,render:(e,i)=>{var r;return e.createBox(i,{classes:(r=e.args[0])!=null?r:""})}}),Se(["cssId","htmlId"],"{id:string}{content:auto}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.cssId=(r=e.args[0])!=null?r:"",a}}),Se("htmlData","{data:string}{content:auto}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`\\htmlData{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.htmlData=(r=e.args[0])!=null?r:"",a}}),Se(["style","htmlStyle"],"{data:string}{content:auto}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>{var r;return!((r=e.args)!=null&&r[0])||i.skipStyles?e.bodyToLatex(i):`${e.command}{${e.args[0]}}{${e.bodyToLatex(i)}}`},render:(e,i)=>{var r;const a=e.createBox(i);return a.htmlStyle=(r=e.args[0])!=null?r:"",a}}),Se("em","{:rest}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[0])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`{\\em ${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})}),Se("emph","{:auto}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[1])})),serialize:(e,i)=>i.skipStyles?e.bodyToLatex(i):`\\emph{${e.bodyToLatex(i)}}`,render:(e,i)=>e.createBox(i,{classes:"ML__emph",boxType:"lift"})});var xp={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}};Se(["bigl","Bigl","biggl","Biggl","bigr","Bigr","biggr","Biggr","bigm","Bigm","biggm","Biggm","big","Big","bigg","Bigg"],"{:delim}",{createAtom:e=>{var i;return new wf(f(P({},e),{delim:(i=e.args[0])!=null?i:".",size:xp[e.command].size,delimType:xp[e.command].mclass}))}}),Se(["hspace","hspace*"],"{width:value}",{createAtom:e=>{var i;return new el(f(P({},e),{width:(i=e.args[0])!=null?i:{dimension:0}}))}}),Se(["mkern","kern","mskip","hskip","mspace"],"{width:value}",{createAtom:e=>{var i;return new el(f(P({},e),{width:(i=e.args[0])!=null?i:{dimension:0}}))}}),Se("mathchoice","{:math}{:math}{:math}{:math}",{createAtom:e=>new ut(e),render:(e,i)=>{let r=0;const a=i.mathstyle.id;(a===Su||a===so)&&(r=1),(a===Go||a===Es)&&(r=2),(a===Ia||a===$r)&&(r=3);const u=Ie(e.args[r]);return ut.createBox(i,u)},serialize:(e,i)=>`\\mathchoice{${ut.serialize(e.args[0],i)}}{${ut.serialize(e.args[1],i)}}{${ut.serialize(e.args[2],i)}}{${ut.serialize(e.args[3],i)}}`}),Se("mathop","{:auto}",{createAtom:e=>new ut(f(P({},e),{type:"mop",body:Ie(e.args[0]),limits:"over-under",isFunction:!0,captureSelection:!0})),render:(e,i)=>{var r;let a=ut.createBox(i,e.body);if(e.superscript||e.subscript){const u=(r=e.subsupPlacement)!=null?r:"auto";a=u==="over-under"||u==="auto"&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return new $t(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,i)=>{const r=[ir(e.command,e.bodyToLatex(i))];return e.explicitSubsupPlacement&&(e.subsupPlacement==="over-under"&&r.push("\\limits"),e.subsupPlacement==="adjacent"&&r.push("\\nolimits"),e.subsupPlacement==="auto"&&r.push("\\displaylimits")),r.push(e.supsubToLatex(i)),on(r)}}),Se(["mathbin","mathrel","mathopen","mathclose","mathpunct","mathord","mathinner"],"{:auto}",{createAtom:e=>new ut(f(P({},e),{type:{"\\mathbin":"mbin","\\mathrel":"mrel","\\mathopen":"mopen","\\mathclose":"mclose","\\mathpunct":"mpunct","\\mathord":"mord","\\mathinner":"minner"}[e.command],body:Ie(e.args[0])}))}),Se(["operatorname","operatorname*"],"{operator:math}",{createAtom:e=>{const i=Ie(e.args[0]).map(r=>{var a;return r.type!=="first"&&(r.type="mord",r.value=(a={"\u2217":"*","\u2212":"-"}[r.value])!=null?a:r.value,r.isFunction=!1,!r.style.variant&&!r.style.variantStyle&&(r.style.variant="main",r.style.variantStyle="up")),r});return new ut(f(P({},e),{type:"mop",body:i,isFunction:!0,limits:e.command==="\\operatorname"?"adjacent":"over-under"}))},render:(e,i)=>{var r;let a=ut.createBox(i,e.body);if(e.superscript||e.subscript){const u=(r=e.subsupPlacement)!=null?r:"auto";a=u==="over-under"||u==="auto"&&i.isDisplayStyle?e.attachLimits(i,{base:a}):e.attachSupsub(i,{base:a})}return e.caret&&(a.caret=e.caret),new $t(e.bind(i,a),{type:"op",isSelected:e.isSelected,classes:"op-group"})},serialize:(e,i)=>{const r=[ir(e.command,e.bodyToLatex(i))];return e.explicitSubsupPlacement&&(e.subsupPlacement==="over-under"&&r.push("\\limits"),e.subsupPlacement==="adjacent"&&r.push("\\nolimits"),e.subsupPlacement==="auto"&&r.push("\\displaylimits")),r.push(e.supsubToLatex(i)),on(r)}}),Se(["char","unicode"],"{charcode:value}",{createAtom:e=>new ut(f(P({},e),{type:e.mode==="text"?"text":"mord"})),serialize:e=>{var i;return`${e.command}${Yn((i=e.args[0])!=null?i:{number:10067,base:"hexadecimal"})}`},render:(e,i)=>{let r=i.evaluate(e.args[0]);return(!r||!("number"in r))&&(r={number:10067,base:"hexadecimal"}),e.value=String.fromCodePoint(r.number),e.createBox(i)}}),Se("rule","[raise:value]{width:value}{thickness:value}",{createAtom:e=>new ut(e),render:(e,i)=>{var r,a,u;const p=new fn({parent:i,mathstyle:"textstyle"},e.style),m=p.toEm((r=e.args[0])!=null?r:{dimension:0}),b=p.toEm((a=e.args[1])!=null?a:{dimension:10}),w=p.toEm((u=e.args[2])!=null?u:{dimension:10}),E=new $t(null,{classes:"rule",type:"ord"});return E.width=b,E.height=w+m,E.depth=-m,E.setStyle("border-right-width",b,"em"),E.setStyle("border-top-width",w,"em"),E.setStyle("border-color",e.style.color),E.setStyle("vertical-align",m,"em"),e.isSelected&&E.setStyle("opacity","50%"),e.bind(p,E),e.caret&&(E.caret=e.caret),E.wrap(i)},serialize:e=>`\\rule${e.args[0]?`[${Yn(e.args[0])}]`:""}{${Yn(e.args[1])}}{${Yn(e.args[2])}}`}),Se(["overline","underline"],"{:auto}",{createAtom:e=>new ut(f(P({},e),{body:Ie(e.args[0])})),render:(e,i)=>{const r=e.command.substring(1),a=new fn({parent:i,mathstyle:"cramp"},e.style),u=ut.createBox(a,e.body);if(!u)return null;const p=a.metrics.defaultRuleThickness/a.scalingFactor,m=new $t(null,{classes:r+"-line"});m.height=p,m.maxFontSize=p*1.125*a.scalingFactor;let b;return r==="overline"?b=new wr({shift:0,children:[{box:u},3*p,{box:m},p]}):b=new wr({top:u.height,children:[p,{box:m},3*p,{box:u}]}),e.caret&&(b.caret=e.caret),new $t(b,{classes:r,type:"ignore"})}}),Se("overset","{:auto}{base:auto}",{createAtom:e=>{const i=Ie(e.args[1]);return new Ns(f(P({},e),{above:Ie(e.args[0]),body:i,skipBoundary:!1,boxType:Vo(i)}))},serialize:(e,i)=>ir(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),Se("underset","{:auto}{base:auto}",{createAtom:e=>{const i=Ie(e.args[1]);return new Ns(f(P({},e),{below:Ie(e.args[0]),body:i,skipBoundary:!1,boxType:Vo(i)}))},serialize:(e,i)=>ir(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),Se("overunderset","{above:auto}{below:auto}{base:auto}",{createAtom:e=>{const i=Ie(e.args[2]);return new Ns(f(P({},e),{above:Ie(e.args[0]),below:Ie(e.args[1]),body:i,skipBoundary:!1,boxType:Vo(i)}))},serialize:(e,i)=>ir(e.command,e.belowToLatex(i),e.bodyToLatex(i))}),Se(["stackrel","stackbin"],"[below:auto]{above:auto}{base:auto}",{createAtom:e=>new Ns(f(P({},e),{body:Ie(e.args[2]),above:Ie(e.args[1]),below:Ie(e.args[0]),skipBoundary:!1,boxType:e.command==="\\stackrel"?"rel":"bin"})),serialize:(e,i)=>ir(e.command,e.aboveToLatex(i),e.bodyToLatex(i))}),Se("smash","[:string]{:auto}",{createAtom:e=>{var i,r,a,u;return new Fl(f(P({},e),{body:Ie(e.args[1]),smashHeight:(r=(i=e.args[0])==null?void 0:i.includes("t"))!=null?r:!0,smashDepth:(u=(a=e.args[0])==null?void 0:a.includes("b"))!=null?u:!0}))}}),Se(["vphantom"],"{:auto}",{createAtom:e=>new Fl(f(P({},e),{body:Ie(e.args[0]),isInvisible:!0,smashWidth:!0}))}),Se(["hphantom"],"{:auto}",{createAtom:e=>new Fl(f(P({},e),{body:Ie(e.args[0]),isInvisible:!0,smashHeight:!0,smashDepth:!0}))}),Se(["phantom"],"{:auto}",{createAtom:e=>new Fl(f(P({},e),{body:Ie(e.args[0]),isInvisible:!0}))}),Se("not","{:math}",{createAtom:e=>{const i=Ie(e.args[0]);return i.length===0?new ut(f(P({},e),{type:"mrel",value:"\uE020"})):new ut(f(P({},e),{body:[new go(f(P({},e),{body:"\uE020",align:"right"})),...i],captureSelection:!0}))},serialize:(e,i)=>{const r=e.args[0],a=r&&typeof r=="object"&&"group"in r;return e.value!=="\uE020"?a?`\\not{${ut.serialize(r.group,i)}}`:`\\not${ut.serialize(r,i)}`:a?"\\not{}":"\\not"},render:(e,i)=>{if(e.value)return e.createBox(i);const a=e.args[0]&&typeof e.args[0]=="object"&&"group"in e.args[0]?"ord":Vo(Ie(e.args[0])),u=ut.createBox(i,e.body,{type:a});return e.caret&&(u.caret=e.caret),e.bind(i,u)}}),Se(["ne","neq"],"",{createAtom:e=>new ut(f(P({},e),{type:"mrel",body:[new go(f(P({},e),{body:"\uE020",align:"right",boxType:"rel"})),new ut(f(P({},e),{value:"="}))],captureSelection:!0})),serialize:e=>e.command}),Se("rlap","{:auto}",{createAtom:e=>new go(f(P({},e),{body:Ie(e.args[0]),align:"right"}))}),Se("llap","{:auto}",{createAtom:e=>new go(f(P({},e),{body:Ie(e.args[0]),align:"left"}))}),Se("mathrlap","{:math}",{createAtom:e=>new go(f(P({},e),{body:Ie(e.args[0]),align:"left"}))}),Se("mathllap","{:math}",{createAtom:e=>new go(f(P({},e),{body:Ie(e.args[0]),align:"left"}))}),Se("raisebox","{:value}{:text}",{createAtom:e=>{var i;return new Oa(f(P({},e),{body:Ie(e.args[1]),padding:{dimension:0},offset:(i=e.args[0])!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r;return ir("\\raisebox",(r=Yn(e.offset))!=null?r:"0pt",e.bodyToLatex(i))}}),Se("raise","{:value}{:auto}",{createAtom:e=>{var i;return new Oa(f(P({},e),{body:Ie(e.args[1]),padding:{dimension:0},offset:(i=e.args[0])!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r;return ir("\\raise",(r=Yn(e.offset))!=null?r:"0pt",e.bodyToLatex(i))}}),Se("lower","{:value}{:auto}",{createAtom:e=>{var i;return new Oa(f(P({},e),{body:Ie(e.args[1]),padding:{dimension:0},offset:(i=Rn(e.args[0],-1))!=null?i:{dimension:0}}))},serialize:(e,i)=>{var r,a;return ir("\\lower",(a=Yn(Rn((r=e.offset)!=null?r:{dimension:0},-1)))!=null?a:"0pt",e.bodyToLatex(i))}}),Xe("0123456789/@.?!"),Y(65,90),Y(97,122),Xe([["\\forall",8704],["\\exists",8707],["\\nexists",8708,"mord","ams"],["\\mid",8739,"mrel"],["\\top",8868],["\\bot",8869]]),Xe([["\\#",35],["\\&",38],["\\parallelogram",9649],["\\spadesuit",9824],["\\heartsuit",9825],["\\diamondsuit",9826],["\\clubsuit",9827],["\\flat",9837],["\\natural",9838],["\\sharp",9839]]),Xe([["\\backslash",92],["\\nabla",8711],["\\partial",8706],["\\ell",8467],["\\hbar",8463],["\\Q",81,"mord","double-struck"],["\\C",67,"mord","double-struck"],["\\P",80,"mord","double-struck"],["\\pounds",163],["\\euro",8364]]),Xe([["\\rightarrow",8594],["\\to",8594],["\\leftarrow",8592],["\\gets",8592],["\\Rightarrow",8658],["\\Leftarrow",8656],["\\longrightarrow",10230],["\\longleftarrow",10229],["\\Longrightarrow",10233],["\\implies",10233],["\\Longleftarrow",10232],["\\impliedby",10232],["\\longleftrightarrow",10231],["\\biconditional",10231],["\\Longleftrightarrow",10234],["\\mapsto",8614],["\\longmapsto",10236],["\\uparrow",8593],["\\downarrow",8595],["\\Uparrow",8657],["\\Downarrow",8659],["\\updownarrow",8597],["\\Updownarrow",8661],["\\hookrightarrow",8618],["\\hookleftarrow",8617],["\\rightharpoonup",8640],["\\leftharpoonup",8636],["\\rightharpoondown",8641],["\\leftharpoondown",8637],["\\searrow",8600],["\\nearrow",8599],["\\swarrow",8601],["\\nwarrow",8598],["\\originalof",8886],["\\laplace",8886],["\\imageof",8887],["\\Laplace",8887]],"mrel"),Xe([["\\mapsfrom",8612,"mrel"],["\\Mapsfrom",10502,"mrel"],["\\MapsTo",10503,"mrel"],["\\Yup",8516,"mord"],["\\lightning",8623,"mrel"],["\\leftarrowtriangle",8701,"mrel"],["\\rightarrowtriangle",8702,"mrel"],["\\leftrightarrowtriangle",8703,"mrel"],["\\boxdot",8865,"mbin"],["\\bigtriangleup",9651,"mbin"],["\\bigtriangledown",9661,"mbin"],["\\boxbar",9707,"mbin"],["\\Lbag",10181,"mopen"],["\\Rbag",10182,"mclose"],["\\llbracket",10214,"mopen"],["\\rrbracket",10215,"mclose"],["\\longmapsfrom",10235,"mrel"],["\\Longmapsfrom",10237,"mrel"],["\\Longmapsto",10238,"mrel"],["\\boxslash",10692,"mbin"],["\\boxbslash",10693,"mbin"],["\\boxast",10694,"mbin"],["\\boxcircle",10695,"mbin"],["\\boxbox",10696,"mbin"],["\\fatsemi",10783,"mop"],["\\leftslice",10918,"mrel"],["\\rightslice",10919,"mrel"],["\\interleave",10996,"mbin"],["\\biginterleave",11004,"mop"],["\\sslash",11005,"mbin"],["\\talloblong",11006,"mbin"]]),Xe([["\\lbrace",123,"mopen"],["\\rbrace",125,"mclose"],["\\lparen",40,"mopen"],["\\rparen",41,"mclose"],["\\langle",10216,"mopen"],["\\rangle",10217,"mclose"],["\\lfloor",8970,"mopen"],["\\rfloor",8971,"mclose"],["\\lceil",8968,"mopen"],["\\rceil",8969,"mclose"],["\\vert",8739],["\\lvert",8739,"mopen"],["\\rvert",8739,"mclose"],["\\|",8741],["\\Vert",8741],["\\mVert",8741],["\\lVert",8741,"mopen"],["\\rVert",8741,"mclose"],["\\lbrack",91,"mopen"],["\\rbrack",93,"mclose"],["\\{",123,"mopen"],["\\}",125,"mclose"],["(",40,"mopen"],[")",41,"mclose"],["[",91,"mopen"],["]",93,"mclose"],["\\ulcorner",9484,"mopen","ams"],["\\urcorner",9488,"mclose","ams"],["\\llcorner",9492,"mopen","ams"],["\\lrcorner",9496,"mclose","ams"],["\\lgroup",10222,"mopen"],["\\rgroup",10223,"mclose"],["\\lmoustache",9136,"mopen"],["\\rmoustache",9137,"mclose"]]),Xe([["\\dashrightarrow",8674],["\\dashleftarrow",8672],["\\Rrightarrow",8667],["\\Lleftarrow",8666],["\\leftrightarrows",8646],["\\rightleftarrows",8644],["\\curvearrowright",8631],["\\curvearrowleft",8630],["\\rightrightarrows",8649],["\\leftleftarrows",8647],["\\upuparrows",8648],["\\downdownarrows",8650],["\\vartriangle",9651],["\\triangleq",8796],["\\vartriangleleft",8882],["\\trianglelefteq",8884],["\\ntriangleleft",8938],["\\ntrianglelefteq",8940],["\\vartriangleright",8883],["\\trianglerighteq",8885],["\\ntriangleright",8939],["\\ntrianglerighteq",8941],["\\blacktriangleleft",9664],["\\blacktriangleright",9654],["\\leftarrowtail",8610],["\\rightarrowtail",8611],["\\looparrowright",8620],["\\looparrowleft",8619],["\\twoheadleftarrow",8606],["\\twoheadrightarrow",8608],["\\twoheadrightarrowtail",10518],["\\rightleftharpoons",8652],["\\leftrightharpoons",8651],["\\Rsh",8625],["\\Lsh",8624],["\\circlearrowright",8635],["\\circlearrowleft",8634],["\\restriction",8638],["\\upharpoonright",8638],["\\upharpoonleft",8639],["\\downharpoonright",8642],["\\downharpoonleft",8643],["\\rightsquigarrow",8669],["\\leadsto",8669],["\\leftrightsquigarrow",8621],["\\multimap",8888],["\\nleftarrow",8602],["\\nrightarrow",8603],["\\nRightarrow",8655],["\\nLeftarrow",8653],["\\nleftrightarrow",8622],["\\nLeftrightarrow",8654],["\\nvrightarrow",8696],["\\nvtwoheadrightarrow",10496],["\\nvrightarrowtail",10516],["\\nvtwoheadrightarrowtail",10519],["\\shortparallel",8741],["\\nless",8814],["\\nleqslant",57360],["\\lneq",10887],["\\lneqq",8808],["\\nleqq",57361],["\\lvertneqq",57356],["\\lnsim",8934],["\\lnapprox",10889],["\\nprec",8832],["\\npreceq",8928],["\\precnsim",8936],["\\precnapprox",10937],["\\nsim",8769],["\\nshortmid",57350],["\\nmid",8740],["\\nvdash",8876],["\\nvDash",8877],["\\ngtr",8815],["\\ngeqslant",57359],["\\ngeqq",57358],["\\gneq",10888],["\\gneqq",8809],["\\gvertneqq",57357],["\\gnsim",8935],["\\gnapprox",10890],["\\nsucc",8833],["\\nsucceq",8929],["\\succnsim",8937],["\\succnapprox",10938],["\\ncong",8774],["\\nshortparallel",57351],["\\nparallel",8742],["\\nVDash",8879],["\\nsupseteqq",57368],["\\supsetneq",8843],["\\varsupsetneq",57371],["\\supsetneqq",10956],["\\varsupsetneqq",57369],["\\nVdash",8878],["\\precneqq",10933],["\\succneqq",10934],["\\nsubseteqq",57366],["\\leqslant",10877],["\\geqslant",10878],["\\gtrsim",8819],["\\approxeq",8778],["\\thickapprox",8776],["\\lessapprox",10885],["\\gtrapprox",10886],["\\precapprox",10935],["\\succapprox",10936],["\\thicksim",8764],["\\succsim",8831],["\\precsim",8830],["\\backsim",8765],["\\eqsim",8770],["\\backsimeq",8909],["\\lesssim",8818],["\\nleq",8816],["\\ngeq",8817],["\\smallsmile",8995],["\\smallfrown",8994],["\\leqq",8806],["\\eqslantless",10901],["\\lll",8920],["\\lessgtr",8822],["\\lesseqgtr",8922],["\\lesseqqgtr",10891],["\\risingdotseq",8787],["\\fallingdotseq",8786],["\\subseteqq",10949],["\\Subset",8912],["\\sqsubset",8847],["\\preccurlyeq",8828],["\\curlyeqprec",8926],["\\vDash",8872],["\\Vvdash",8874],["\\bumpeq",8783],["\\Bumpeq",8782],["\\geqq",8807],["\\eqslantgtr",10902],["\\ggg",8921],["\\gtrless",8823],["\\gtreqless",8923],["\\gtreqqless",10892],["\\supseteqq",10950],["\\Supset",8913],["\\sqsupset",8848],["\\succcurlyeq",8829],["\\curlyeqsucc",8927],["\\Vdash",8873],["\\shortmid",8739],["\\between",8812],["\\pitchfork",8916],["\\varpropto",8733],["\\backepsilon",8717],["\\llless",8920],["\\gggtr",8921],["\\doteqdot",8785],["\\Doteq",8785],["\\eqcirc",8790],["\\circeq",8791],["\\therefore",8756],["\\because",8757]],"mrel","ams"),Xe([["+",43],["-",8722],["\u2212",8722],["\\pm",177],["\\mp",8723],["*",8727],["\\times",215],["\\div",247],["\\divides",8739],["\\cdot",8901],["\\cap",8745],["\\cup",8746],["\\setminus",8726],["\\land",8743],["\\wedge",8743],["\\lor",8744],["\\vee",8744],["\\circ",8728],["\\bigcirc",9711],["\\bullet",8729],["\\oplus",8853],["\\ominus",8854],["\\otimes",8855],["\\odot",8857],["\\oslash",8856],["\\bigtriangleup",9651],["\\bigtriangledown",9661],["\\triangleleft",9667],["\\triangleright",9657],["\\And",38],["\\dagger",8224],["\\dag",8224],["\\ddag",8225],["\\ddagger",8225],["\\ast",8727],["\\star",8902],["\\bigstar",9733],["\\diamond",8900]],"mbin"),Xe([["\\lhd",8882],["\\rhd",8883],["\\lessdot",8918],["\\gtrdot",8919],["\\ltimes",8905],["\\rtimes",8906],["\\leftthreetimes",8907],["\\rightthreetimes",8908],["\\intercal",8890],["\\dotplus",8724],["\\doublebarwedge",10846],["\\divideontimes",8903],["\\centerdot",8901],["\\smallsetminus",8726],["\\barwedge",8892],["\\veebar",8891],["\\nor",8891],["\\curlywedge",8911],["\\curlyvee",8910],["\\boxminus",8863],["\\boxplus",8862],["\\boxtimes",8864],["\\boxdot",8865],["\\circleddash",8861],["\\circledast",8859],["\\circledcirc",8858],["\\unlhd",8884],["\\unrhd",8885]],"mbin","ams"),Xe([["\\surd",8730],["\\infty",8734],["\\prime",8242],["\\doubleprime",8243],["\\angle",8736],["`",8216],["\\$",36],["\\%",37],["\\_",95],["\\alpha",945],["\\beta",946],["\\gamma",947],["\\delta",948],["\\epsilon",1013],["\\varepsilon",949],["\\zeta",950],["\\eta",951],["\\theta",952],["\\vartheta",977],["\\iota",953],["\\kappa",954],["\\varkappa",1008,"mord","ams"],["\\lambda",955],["\\mu",956],["\\nu",957],["\\xi",958],["\\omicron",111],["\\pi",960],["\\varpi",982],["\\rho",961],["\\varrho",1009],["\\sigma",963],["\\varsigma",962],["\\tau",964],["\\phi",981],["\\varphi",966],["\\upsilon",965],["\\chi",967],["\\psi",968],["\\omega",969],["\\Gamma",915],["\\Delta",916],["\\Theta",920],["\\Lambda",923],["\\Xi",926],["\\Pi",928],["\\Sigma",931],["\\Upsilon",933],["\\Phi",934],["\\Psi",936],["\\Omega",937],["\\digamma",989,"mord","ams"],["\\emptyset",8709]]),Xe([["=",61],["<",60],["\\lt",60],[">",62],["\\gt",62],["\\le",8804],["\\leq",8804],["\\ge",8805],["\\geq",8805],["\\ll",8810],["\\gg",8811],["\\coloneq",8788],["\\coloneqq",8788],["\\colonequals",8788],["\\measeq",8797],["\\eqdef",8798],["\\questeq",8799],[":",58],["\\cong",8773],["\\equiv",8801],["\\prec",8826],["\\preceq",10927],["\\succ",8827],["\\succeq",10928],["\\perp",8869],["\\propto",8733],["\\Colon",8759],["\\smile",8995],["\\frown",8994],["\\sim",8764],["\\doteq",8784],["\\bowtie",8904],["\\Join",8904],["\\asymp",8781],["\\sqsubseteq",8849],["\\sqsupseteq",8850],["\\approx",8776],["\\~",126],["\\leftrightarrow",8596],["\\Leftrightarrow",8660],["\\models",8872],["\\vdash",8866],["\\dashv",8867],["\\roundimplies",10608],["\\in",8712],["\\notin",8713],["\\ni",8715],["\\owns",8715],["\\subset",8834],["\\supset",8835],["\\subseteq",8838],["\\supseteq",8839],["\\differencedelta",8710],["\\mvert",8739],["\\parallel",8741],["\\simeq",8771]],"mrel"),Xe([["\\lnot",172],["\\neg",172],["\\triangle",9651],["\\subsetneq",8842],["\\varsubsetneq",57370],["\\subsetneqq",10955],["\\varsubsetneqq",57367],["\\nsubset",8836],["\\nsupset",8837],["\\nsubseteq",8840],["\\nsupseteq",8841]],"mrel","ams"),Xe([["\\wp",8472],["\\aleph",8501]]),Xe([["\\blacktriangle",9650],["\\hslash",8463],["\\Finv",8498],["\\Game",8513],["\\eth",240],["\\mho",8487],["\\Bbbk",107],["\\yen",165],["\\square",9633],["\\Box",9633],["\\blacksquare",9632],["\\circledS",9416],["\\circledR",174],["\\triangledown",9661],["\\blacktriangledown",9660],["\\checkmark",10003],["\\diagup",9585],["\\measuredangle",8737],["\\sphericalangle",8738],["\\backprime",8245],["\\backdoubleprime",8246],["\\Diamond",9674],["\\lozenge",9674],["\\blacklozenge",10731],["\\varnothing",8709],["\\complement",8705],["\\maltese",10016],["\\beth",8502],["\\daleth",8504],["\\gimel",8503]],"mord","ams"),Xe([["\\ ",160],["~",160]],"space"),Se(["!",",",":",";",">","enskip","enspace","quad","qquad"],"",{createAtom:e=>new el(e)}),Se("space","",{createAtom:e=>new el(e)}),Xe([["\\colon",58],["\\cdotp",8901],["\\vdots",8942,"mord"],["\\ldotp",46],[",",44],[";",59]],"mpunct"),Xe([["\\cdots",8943],["\\ddots",8945],["\\ldots",8230],["\\mathellipsis",8230]],"minner"),Xe([["\\/",47],["|",8739,"mord"],["\\imath",305],["\\jmath",567],["\\degree",176],["'",8242],['"',8221]]);var wp="<mo>&#x2061;</mo>",Jf="<mo>&#8290;</mo>";function Qf(e){return e.replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Gn(e,i){return!e||!i.generateID?"":` extid="${e}"`}function Rg(e,i,r){var a,u,p,m,b,w,E,I,N,J,oe;let ge=!1;i=i!=null?i:e.atoms.length;let He="",Ft="",Ve=e.atoms[e.index];const St=(u=(a=Ve.style)==null?void 0:a.variant)!=null?u:"",Kt=(m=(p=Ve.style)==null?void 0:p.variantStyle)!=null?m:"";let Lt="";if(St||Kt){const yi=ze(Ve.value,(b=Ve.style)==null?void 0:b.variant,(w=Ve.style)==null?void 0:w.variantStyle);if(yi!==Ve.value)return e.index+=1,He=`<mi${Gn(Ve.id,r)}>${yi}</mi>`,bo(He,e,r)||(e.mathML+=He,e.lastType="mi"),!0;Lt=(E={upnormal:"normal",boldnormal:"bold",italicmain:"italic",bolditalicmain:"bold-italic","updouble-struck":"double-struck","double-struck":"double-struck",boldfraktur:"bold-fraktur",calligraphic:"script",upcalligraphic:"script",script:"script",boldscript:"bold-script",boldcalligraphic:"bold-script",fraktur:"fraktur","upsans-serif":"sans-serif","boldsans-serif":"bold-sans-serif","italicsans-serif":"sans-serif-italic","bolditalicsans-serif":"sans-serif-bold-italic",monospace:"monospace"}[Kt+St])!=null?E:"",Lt=` mathvariant="${Lt}"`}const ai={"\\exponentialE":"&#x02147;","\\imaginaryI":"&#x2148;","\\differentialD":"&#x2146;","\\capitalDifferentialD":"&#x2145;","\\alpha":"&#x03b1;","\\pi":"&#x03c0;","\\infty":"&#x221e;","\\forall":"&#x2200;","\\nexists":"&#x2204;","\\exists":"&#x2203;","\\hbar":"\u210F","\\cdotp":"\u22C5","\\ldots":"\u2026","\\cdots":"\u22EF","\\ddots":"\u22F1","\\vdots":"\u22EE","\\ldotp":"."};if(Ve.command==="!")return e.index+=1,He="<mo>!</mo>",bo(He,e,r)||(e.mathML+=He,e.lastType="mo"),!0;if(ai[Ve.command]){e.index+=1;let yi=`<mi${Gn(Ve.id,r)}${Lt}>${ai[Ve.command]}</mi>`;return(e.lastType==="mi"||e.lastType==="mn"||e.lastType==="mtext"||e.lastType==="fence")&&(yi=Jf+yi),bo(yi,e,r)||(e.mathML+=yi,e.lastType="mi"),!0}if(Ve.command==="\\operatorname")Ft=Wu(Ve.body),e.index+=1;else if(St||Kt)for(;e.index<i&&(Ve.type==="mord"||Ve.type==="macro")&&!Ve.isDigit()&&St===((N=(I=Ve.style)==null?void 0:I.variant)!=null?N:"")&&Kt===((oe=(J=Ve.style)==null?void 0:J.variantStyle)!=null?oe:"");)Ft+=Wu([Ve]),e.index+=1,Ve=e.atoms[e.index];else(Ve.type==="mord"||Ve.type==="macro")&&!Ve.isDigit()&&(Ft+=Wu([Ve]),e.index+=1);if(Ft.length>0){ge=!0,He=`<mi${Lt}>${Ft}</mi>`;const yi=e.lastType;He.endsWith(">f</mi>")||He.endsWith(">g</mi>")?(He+=wp,e.lastType="applyfunction"):e.lastType=/^<mo>(.*)<\/mo>$/.test(He)?"mo":"mi",bo(He,e,r)||((yi==="mi"||yi==="mn"||yi==="mtext"||yi==="fence")&&(He=Jf+He),e.mathML+=He)}return ge}function Pg(e){return e.index<e.atoms.length&&e.atoms[e.index].superscript&&e.atoms[e.index].type==="subsup"}function Og(e){let i=-1,r=e.index,a=!1,u=!1;for(;r<e.atoms.length&&!a&&!u;){const p=e.atoms[r];a=!p.isDigit(),u=!a&&p.superscript!==void 0,r++}return u&&(i=r-1),i}function bo(e,i,r){var a;let u=i.atoms[i.index-1];if(!u)return!1;if(!u.superscript&&!u.subscript)if(((a=i.atoms[i.index])==null?void 0:a.type)==="subsup")u=i.atoms[i.index],i.index+=1;else return!1;const p=i.lastType;i.lastType="";const m=An(u.superscript,r);i.lastType="";const b=An(u.subscript,r);if(i.lastType=p,!m&&!b)return!1;let w="";return m&&b?w=`<msubsup>${e}${b}${m}</msubsup>`:m?w=`<msup>${e}${m}</msup>`:b&&(w=`<msub>${e}${b}</msub>`),i.mathML+=w,i.lastType="",!0}function Fg(e,i,r){i=i!=null?i:e.atoms.length;const a=e.index;let u="";for(;e.index<i&&e.atoms[e.index].mode==="text";)u+=e.atoms[e.index].value?e.atoms[e.index].value:" ",e.index+=1;return u.length>0?(e.mathML+=`<mtext ${Gn(e.atoms[a].id,r)}>${u}</mtext>`,e.lastType="mtext",!0):!1}function Bg(e,i,r){i=i!=null?i:e.atoms.length;const a=e.index;let u="",p=Og(e);for(p>=0&&p<i&&(i=p);e.index<i&&e.atoms[e.index].isDigit();)u+=e.atoms[e.index].asDigit(),e.index+=1;return u.length<=0?!1:(u="<mn"+Gn(e.atoms[a].id,r)+">"+u+"</mn>",p<0&&Pg(e)&&(p=e.index,e.index+=1),bo(u,e,r)||(e.mathML+=u,e.lastType="mn"),!0)}function Ng(e,i,r){let a=!1;i=i!=null?i:e.atoms.length;let u="",p="";if(e.index<i&&e.atoms[e.index].type==="mopen"){let m=!1,b=0;const w=e.index;let E=-1,I=w+1;for(;I<i&&!m;)e.atoms[I].type==="mopen"?b+=1:e.atoms[I].type==="mclose"&&(b-=1),b===-1&&(m=!0,E=I),I+=1;m&&(u="<mrow>",u+=ql(e.atoms[w],r),u+=An(e.atoms,r,w+1,E),u+=ql(e.atoms[E],r),u+="</mrow>",e.index=E+1,(e.lastType==="mi"||e.lastType==="mn"||e.lastType==="mfrac"||e.lastType==="fence")&&(e.mathML+=Jf),bo(u,e,r)&&(a=!0,e.lastType="",u=""),p="fence")}return u.length>0&&(a=!0,e.mathML+=u,e.lastType=p),a}function $g(e,i,r){let a=!1;i=i!=null?i:e.atoms.length;let u="",p="";const m=e.atoms[e.index];if(!m)return!1;const b={"\\ne":"&ne;","\\neq":"&neq;","\\pm":"&#177;","\\times":"&#215;","\\colon":":","\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lbrack":"[","\\rbrack":"]","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"};if(b[m.command]){e.index+=1;const w=`<mo${Gn(m.id,r)}>${b[m.command]}</mo>`;return bo(w,e,r)||(e.mathML+=w,e.lastType="mo"),!0}if(e.index<i&&(m.type==="mbin"||m.type==="mrel"))u+=S0(e.atoms[e.index],r),e.index+=1,p="mo";else if(e.index<i&&(m.type==="mop"||m.type==="operator"||m.type==="extensible-symbol")){if(m.subsupPlacement==="over-under"&&(m.superscript||m.subscript)){const w=ql(m,r);return m.superscript&&m.subscript?(u+="<munderover>"+w,u+=An(m.subscript,r),u+=An(m.superscript,r),u+="</munderover>"):m.superscript?(u+="<mover>"+w,u+=An(m.superscript,r),u+="</mover>"):m.subscript&&(u+="<munder>"+w,u+=An(m.subscript,r),u+="</munder>"),e.mathML+=u,e.lastType="mo",e.index+=1,!0}{const w=e.atoms[e.index],E=w.value==="\\operatorname",I=E?'<mi class="MathML-Unit"'+Gn(w.id,r)+">"+Wu(w.value)+"</mi>":ql(w,r);u+=I,!E&&!/^<mo>(.*)<\/mo>$/.test(I)?(u+=wp,p="applyfunction"):p=E?"mi":"mo"}(e.lastType==="mi"||e.lastType==="mn")&&!/^<mo>(.*)<\/mo>$/.test(u)&&(u=Jf+u),e.index+=1}return u.length>0&&(a=!0,bo(u,e,r)||(e.mathML+=u,e.lastType=p)),a}function An(e,i,r,a){i!=null||(i={});const u={atoms:[],index:r!=null?r:0,mathML:"",lastType:""};if(typeof e=="number"||typeof e=="boolean")u.mathML=e.toString();else if(typeof e=="string")u.mathML=e;else if(e instanceof ut)u.mathML=S0(e,i);else if(Array.isArray(e)){u.atoms=e;let p=0;for(a=a||(e?e.length:0);u.index<a;)if(Fg(u,a,i)||Bg(u,a,i)||Rg(u,a,i)||$g(u,a,i)||Ng(u,a,i))p+=1;else if(u.index<a){let m=S0(u.atoms[u.index],i);u.lastType==="mn"&&m.length>0&&u.atoms[u.index].type==="genfrac"&&(m="<mo>&#x2064;</mo>"+m),u.atoms[u.index].type==="genfrac"?u.lastType="mfrac":u.lastType="",u.index+=1,bo(m,u,i)?p+=1:m.length>0&&(u.mathML+=m,p+=1)}p>1&&(u.mathML="<mrow>"+u.mathML+"</mrow>")}return u.mathML}function ql(e,i){let r="";const a=Wu(e.value);return a&&(r="<mo"+Gn(e.id,i)+">"+a+"</mo>"),r}function Wu(e){if(!e)return"";if(typeof e=="string")return Qf(e);if(!Array.isArray(e)&&typeof e.body=="string")return Qf(e.body);let i="";for(const r of e)typeof r.value=="string"&&(i+=r.value);return Qf(i)}function S0(e,i){var r,a,u,p,m,b,w,E,I,N,J,oe,ge,He,Ft,Ve,St,Kt,Lt,ai,yi,fi;if(e.mode==="text")return`<mi${Gn(e.id,i)}>${e.value}</mi>`;const pn={widehat:"^",widecheck:"\u02C7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",longleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",longrightarrow:"\u2192",underbrace:"\u23DF",overbrace:"\u23DE",overgroup:"\u23E0",undergroup:"\u23E1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21D2",xRightarrow:"\u21D2",overleftharpoon:"\u21BC",xleftharpoonup:"\u21BC",overrightharpoon:"\u21C0",xrightharpoonup:"\u21C0",xLeftarrow:"\u21D0",xLeftrightarrow:"\u21D4",xhookleftarrow:"\u21A9",xhookrightarrow:"\u21AA",xmapsto:"\u21A6",xrightharpoondown:"\u21C1",xleftharpoondown:"\u21BD",xrightleftharpoons:"\u21CC",longrightleftharpoons:"\u21CC",xleftrightharpoons:"\u21CB",xtwoheadleftarrow:"\u219E",xtwoheadrightarrow:"\u21A0",xlongequal:"=",xtofrom:"\u21C4",xleftrightarrows:"\u21C4",xRightleftharpoons:"\u21CC",longRightleftharpoons:"\u21CC",xLeftrightharpoons:"\u21CB",longLeftrightharpoons:"\u21CB"},Bn={"\\!":-3/18,"\\ ":6/18,"\\,":3/18,"\\:":4/18,"\\>":4/18,"\\;":5/18,"\\enspace":.5,"\\quad":1,"\\qquad":2,"\\enskip":.5};let Ht="",qs="",Va,aa,Gr,Zs,Cs,Hn;const{command:Er}=e;if(e.command==="\\error")return`<merror${Gn(e.id,i)}>${An(e.body,i)}</merror>`;const Hr={"\\vert":"|","\\Vert":"\u2225","\\mid":"\u2223","\\lbrack":"[","\\rbrack":"]","\\{":"{","\\}":"}","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"\u27E8","\\rangle":"\u27E9","\\lfloor":"\u230A","\\rfloor":"\u230B","\\lceil":"\u2308","\\rceil":"\u2309"},Ga={"\\vec":"&#x20d7;","\\acute":"&#x00b4;","\\grave":"&#x0060;","\\dot":"&#x02d9;","\\ddot":"&#x00a8;","\\tilde":"&#x007e;","\\bar":"&#x00af;","\\breve":"&#x02d8;","\\check":"&#x02c7;","\\hat":"&#x005e;"};switch(e.type){case"first":break;case"group":case"root":Ht=An(e.body,i);break;case"array":if((e.leftDelim&&e.leftDelim!=="."||e.rightDelim&&e.rightDelim!==".")&&(Ht+="<mrow>",e.leftDelim&&e.leftDelim!=="."&&(Ht+="<mo>"+(Hr[e.leftDelim]||e.leftDelim)+"</mo>")),Ht+="<mtable",e.colFormat){for(Ht+=' columnalign="',Gr=0;Gr<e.colFormat.length;Gr++)e.colFormat[Gr].align&&(Ht+={l:"left",c:"center",r:"right"}[e.colFormat[Gr].align]+" ");Ht+='"'}for(Ht+=">",aa=0;aa<e.array.length;aa++){for(Ht+="<mtr>",Va=0;Va<e.array[aa].length;Va++)Ht+="<mtd>"+An(e.array[aa][Va],i)+"</mtd>";Ht+="</mtr>"}Ht+="</mtable>",(e.leftDelim&&e.leftDelim!=="."||e.rightDelim&&e.rightDelim!==".")&&(e.rightDelim&&e.rightDelim!=="."&&(Ht+="<mo>"+(Hr[e.leftDelim]||e.rightDelim)+"</mo>"),Ht+="</mrow>");break;case"genfrac":(e.leftDelim||e.rightDelim)&&(Ht+="<mrow>"),e.leftDelim&&e.leftDelim!=="."&&(Ht+="<mo"+Gn(e.id,i)+">"+(Hr[e.leftDelim]||e.leftDelim)+"</mo>"),e.hasBarLine?(Ht+="<mfrac>",Ht+=An(e.above,i)||"<mi>&nbsp;</mi>",Ht+=An(e.below,i)||"<mi>&nbsp;</mi>",Ht+="</mfrac>"):(Ht+="<mtable"+Gn(e.id,i)+">",Ht+="<mtr>"+An(e.above,i)+"</mtr>",Ht+="<mtr>"+An(e.below,i)+"</mtr>",Ht+="</mtable>"),e.rightDelim&&e.rightDelim!=="."&&(Ht+="<mo"+Gn(e.id,i)+">"+(Hr[e.rightDelim]||e.rightDelim)+"</mo>"),(e.leftDelim||e.rightDelim)&&(Ht+="</mrow>");break;case"surd":e.hasEmptyBranch("above")?(Ht+="<msqrt"+Gn(e.id,i)+">",Ht+=An(e.body,i),Ht+="</msqrt>"):(Ht+="<mroot"+Gn(e.id,i)+">",Ht+=An(e.body,i),Ht+=An(e.above,i),Ht+="</mroot>");break;case"leftright":const Ha=e,Wa=Ha.leftDelim;Ht="<mrow>",Wa&&Wa!=="."&&(Ht+=`<mo${Gn(e.id,i)}>${(r=Hr[Wa])!=null?r:Wa}</mo>`),e.body&&(Ht+=An(e.body,i));const ja=Ha.matchingRightDelim();ja&&ja!=="."&&(Ht+=`<mo${Gn(e.id,i)}>${(a=Hr[ja])!=null?a:ja}</mo>`),Ht+="</mrow>";break;case"sizeddelim":case"delim":Ht+=`<mo${Gn(e.id,i)}>${Hr[e.value]||e.value}</mo>`;break;case"accent":Ht+='<mover accent="true"'+Gn(e.id,i)+">",Ht+=An(e.body,i),Ht+="<mo>"+(Ga[Er]||e.accent)+"</mo>",Ht+="</mover>";break;case"line":case"overlap":break;case"overunder":Cs=e.above,Zs=e.below,(e.svgAbove||Cs)&&(e.svgBelow||Zs)?Hn=e.body:Cs&&Cs.length>0?(Hn=e.body,(p=(u=e.body)==null?void 0:u[0])!=null&&p.below?(Zs=e.body[0].below,Hn=e.body[0].body):((b=(m=e.body)==null?void 0:m[0])==null?void 0:b.type)==="first"&&((E=(w=e.body)==null?void 0:w[1])!=null&&E.below)&&(Zs=e.body[1].below,Hn=e.body[1].body)):Zs&&Zs.length>0&&(Hn=e.body,(N=(I=e.body)==null?void 0:I[0])!=null&&N.above?(Cs=e.body[0].above,Hn=e.body[0].body):((oe=(J=e.body)==null?void 0:J[0])==null?void 0:oe.type)==="first"&&((He=(ge=e.body)==null?void 0:ge[1])!=null&&He.above)&&(Cs=e.body[1].overscript,Hn=e.body[1].body)),(e.svgAbove||Cs)&&(e.svgBelow||Zs)?(Ht+=`<munderover ${Gn(e.id,i)}>`,Ht+=(Ft=pn[e.svgBody])!=null?Ft:An(Hn,i),Ht+=(Ve=pn[e.svgBelow])!=null?Ve:An(Zs,i),Ht+=(St=pn[e.svgAbove])!=null?St:An(Cs,i),Ht+="</munderover>"):e.svgAbove||Cs?(Ht+=`<mover ${Gn(e.id,i)}>`+((Kt=pn[e.svgBody])!=null?Kt:An(Hn,i)),Ht+=(Lt=pn[e.svgAbove])!=null?Lt:An(Cs,i),Ht+="</mover>"):(e.svgBelow||Zs)&&(Ht+=`<munder ${Gn(e.id,i)}>`+((ai=pn[e.svgBody])!=null?ai:An(Hn,i)),Ht+=(yi=pn[e.svgBelow])!=null?yi:An(Zs,i),Ht+="</munder>");break;case"placeholder":Ht+="?";break;case"mord":{Ht=typeof e.value=="string"?e.value:Er,Er==="\\char"?Ht="&#x"+("000000"+e.args[0].number.toString(16)).slice(-4)+";":Ht.length>0&&Ht.startsWith("\\")&&(typeof e.value=="string"&&e.value.charCodeAt(0)>255?Ht="&#x"+("000000"+e.value.charCodeAt(0).toString(16)).slice(-4)+";":typeof e.value=="string"?Ht=e.value.charAt(0):(console.error("Did not expect this"),Ht=""));const xa=/\d/.test(Ht)?"mn":"mi";Ht=`<${xa}${Gn(e.id,i)}>${Qf(Ht)}</${xa}>`;break}case"mbin":case"mrel":case"minner":Ht=ql(e,i);break;case"mpunct":Ht='<mo separator="true"'+Gn(e.id,i)+">"+Er+"</mo>";break;case"mop":case"operator":case"extensible-symbol":e.body!=="\u200B"&&(Ht="<mo"+Gn(e.id,i)+">",Ht+=Er==="\\operatorname"?e.body:Er||e.body,Ht+="</mo>");break;case"box":Ht='<menclose notation="box"',e.backgroundcolor&&(Ht+=' mathbackground="'+e.backgroundcolor+'"'),Ht+=Gn(e.id,i)+">"+An(e.body,i)+"</menclose>";break;case"spacing":Ht+='<mspace width="'+((fi=Bn[Er])!=null?fi:0)+'em"/>';break;case"enclose":Ht='<menclose notation="';for(const xa in e.notation)Object.prototype.hasOwnProperty.call(e.notation,xa)&&e.notation[xa]&&(Ht+=qs+xa,qs=" ");Ht+=Gn(e.id,i)+'">'+An(e.body,i)+"</menclose>";break;case"prompt":Ht='<menclose notation="roundexbox""">'+An(e.body,i)+"</menclose>";break;case"space":Ht+="&nbsp;";break;case"subsup":break;case"phantom":break;case"composition":break;case"rule":break;case"chem":break;case"mopen":Ht+=ql(e,i);break;case"mclose":Ht+=ql(e,i);break;case"macro":{const xa=e.command+Wu(e.macroArgs);xa&&(Ht+=`<mo ${Gn(e.id,i)}>${xa}</mo>`)}break;case"latexgroup":Ht+=An(e.body,i);break;case"latex":Ht+="<mtext"+Gn(e.id,i)+">"+e.value+"</mtext>";break;case"tooltip":Ht+=An(e.body,i);break;case"text":Ht+=`<mtext ${Gn(e.id,i)}x>${e.value}</mtext>`;break;default:if(e.command==="\\displaystyle")return`<mrow ${Gn(e.id,i)} displaystyle="true">${An(e.body,i)}</mrow>`;if(e.command==="\\textstyle")return`<mrow ${Gn(e.id,i)} displaystyle="false">${An(e.body,i)}</mrow>`;console.info("Unexpected element in conversion to MathML:",e)}return Ht}var ju={"\\alpha":"alpha ","\\mu":"mew ","\\sigma":"sigma ","\\pi":"pie ","\\imaginaryI":"imaginary eye ","\\imaginaryJ":"imaginary jay ","\\sum":"Summation ","\\prod":"Product ","+":"plus ","-":"minus ",";":'<break time="150ms"/> semi-colon <break time="150ms"/>',",":'<break time="150ms"/> comma <break time="150ms"/>',"|":'<break time="150ms"/>Vertical bar<break time="150ms"/>',"(":'<break time="150ms"/>Open paren. <break time="150ms"/>',")":'<break time="150ms"/> Close paren. <break time="150ms"/>',"=":"equals ","<":"is less than ","\\lt":"is less than ","<=":"is less than or equal to ","\\le":"is less than or equal to ","\\gt":"is greater than ",">":"is greater than ","\\pm":"plus or minus","\\mp":"minus or plus","\\ge":"is greater than or equal to ","\\geq":"is greater than or equal to ","\\leq":"is less than or equal to ","\\ne":"is not equal to ","\\neq":"is not equal to ","!":"factorial ","\\sin":"sine ","\\cos":"cosine ","\u200B":"","\u2212":"minus ",":":'<break time="150ms"/> such that <break time="200ms"/> ',"\\colon":'<break time="150ms"/> such that <break time="200ms"/> ',"\\hbar":"etch bar ","\\iff":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\Longleftrightarrow":'<break time="200ms"/>if, and only if, <break time="200ms"/>',"\\land":"and ","\\lor":"or ","\\neg":"not ","\\div":"divided by ","\\forall":"for all ","\\exists":"there exists ","\\nexists":"there does not exists ","\\in":"element of ","\\N":'the set <break time="150ms"/><say-as interpret-as="character">n</say-as>',"\\C":'the set <break time="150ms"/><say-as interpret-as="character">c</say-as>',"\\Z":'the set <break time="150ms"/><say-as interpret-as="character">z</say-as>',"\\Q":'the set <break time="150ms"/><say-as interpret-as="character">q</say-as>',"\\infty":"infinity ","\\nabla":"nabla ","\\partial":"partial derivative of ","\\cdot":"times ","\\cdots":"dot dot dot ","\\Rightarrow":"implies ","\\lparen":'<break time="150ms"/>open paren<break time="150ms"/>',"\\rparen":'<break time="150ms"/>close paren<break time="150ms"/>',"\\lbrace":'<break time="150ms"/>open brace<break time="150ms"/>',"\\{":'<break time="150ms"/>open brace<break time="150ms"/>',"\\rbrace":'<break time="150ms"/>close brace<break time="150ms"/>',"\\}":'<break time="150ms"/>close brace<break time="150ms"/>',"\\langle":'<break time="150ms"/>left angle bracket<break time="150ms"/>',"\\rangle":'<break time="150ms"/>right angle bracket<break time="150ms"/>',"\\lfloor":'<break time="150ms"/>open floor<break time="150ms"/>',"\\rfloor":'<break time="150ms"/>close floor<break time="150ms"/>',"\\lceil":'<break time="150ms"/>open ceiling<break time="150ms"/>',"\\rceil":'<break time="150ms"/>close ceiling<break time="150ms"/>',"\\vert":'<break time="150ms"/>vertical bar<break time="150ms"/>',"\\mvert":'<break time="150ms"/>divides<break time="150ms"/>',"\\lvert":'<break time="150ms"/>left vertical bar<break time="150ms"/>',"\\rvert":'<break time="150ms"/>right vertical bar<break time="150ms"/>',"\\lbrack":'<break time="150ms"/> open square bracket <break time="150ms"/>',"\\rbrack":'<break time="150ms"/> close square bracket <break time="150ms"/>',mm:"millimeters",cm:"centimeters",km:"kilometers",kg:"kilograms"},E0={array:"array",matrix:"matrix",pmatrix:"parenthesis matrix",bmatrix:"square brackets matrix",Bmatrix:"braces matrix",vmatrix:"bars matrix",Vmatrix:"double bars matrix","matrix*":"matrix",smallmatrix:"small matrix"};function Kg(e){let i="";return e.startsWith("\\")&&(i=" "+e.replace("\\","")+" "),i}function ah(e){let i=0;if(k(e))for(const r of e)r.type!=="first"&&(i+=1);return i===1}function Ug(e){if(k(e)){for(const i of e)if(i.type!=="first"&&i.id)return i.id.toString()}return""}function Sp(e){let i="";if(k(e))for(const r of e)r.type!=="first"&&typeof r.value=="string"&&(i+=r.value);return i}function zg(e){return e?e.map(i=>i.value).join(""):""}function ln(e,i){var r,a,u,p,m;function b(I){return window.MathfieldElement.textToSpeechMarkup?/[a-z]/.test(I)?` <say-as interpret-as="character">${I}</say-as>`:/[A-Z]/.test(I)?`capital <say-as interpret-as="character">${I.toLowerCase()}</say-as>`:I:/[a-z]/.test(I)?" '"+I.toUpperCase()+"'":/[A-Z]/.test(I)?" 'capital "+I.toUpperCase()+"'":I}function w(I){return"<emphasis>"+I+"</emphasis>"}if(!i)return"";let E="";if(k(i)){let I=!1,N=!1;for(let J=0;J<i.length;J++)i[J].type!=="first"&&(i[J].mode!=="text"&&(N=!1),J<i.length-2&&i[J].type==="mopen"&&i[J+2].type==="mclose"&&i[J+1].type==="mord"?(E+=" of ",E+=w(ln(e,i[J+1])),J+=2):i[J].mode==="text"?N?E+=(r=i[J].value)!=null?r:" ":(N=!0,E+=ln("text",i[J])):i[J].isDigit()?I?E+=i[J].asDigit():(I=!0,E+=ln(e,i[J])):(I=!1,E+=ln(e,i[J])))}else if(i.mode==="text")i.id&&e==="math"&&(E+='<mark name="'+i.id.toString()+'"/>'),E+=i.value;else{i.id&&e==="math"&&(E+='<mark name="'+i.id.toString()+'"/>');let I="",N="",J="",oe=!1;const{command:ge}=i;switch(ge){case"\\vec":return"vector "+ln(e,i.body);case"\\acute":return ln(e,i.body)+" acute";case"\\grave":return ln(e,i.body)+" grave";case"\\dot":return"dot over"+ln(e,i.body);case"\\ddot":return"double dot over"+ln(e,i.body);case"\\mathring":return"ring over"+ln(e,i.body);case"\\tilde":case"\\widetilde":return"tilde over"+ln(e,i.body);case"\\bar":return ln(e,i.body)+" bar";case"\\breve":return ln(e,i.body)+" breve";case"\\check":case"\\widecheck":return"check over "+ln(e,i.body);case"\\hat":case"\\widehat":return"hat over"+ln(e,i.body);case"\\overarc":case"\\overparen":case"\\wideparen":return"arc over "+ln(e,i.body);case"\\underarc":case"\\underparen":return"arc under "+ln(e,i.body)}switch(i.type){case"prompt":const He=i.body.length>1?'start input . <break time="500ms"/> '+ln(e,i.body)+'. <break time="500ms"/> end input':"blank";E+=' <break time="300ms"/> '+He+'. <break time="700ms"/>'+((a=i.correctness)!=null?a:"")+' . <break time="700ms"/> ';break;case"array":const Ft=i.array,Ve=i.environmentName;if(Object.keys(E0).includes(Ve)){E+=` begin ${E0[Ve]} `;for(let Lt=0;Lt<Ft.length;Lt++){Lt>0&&(E+=","),E+=` row ${Lt+1} `;for(let ai=0;ai<Ft[Lt].length;ai++)ai>0&&(E+=","),E+=` column ${ai+1}: `,E+=ln("math",Ft[Lt][ai])}E+=` end ${E0[Ve]} `}break;case"group":ge==="\\ne"?E+=" not equal ":(ge==="\\not"&&(E+=" not "),E+=ln("math",i.body));break;case"root":E+=ln("math",i.body);break;case"genfrac":if(I=ln("math",i.above),N=ln("math",i.below),ah(i.above)&&ah(i.below)){const ai={"1/2":" half ","1/3":" one third ","2/3":" two third","1/4":" one quarter ","3/4":" three quarter ","1/5":" one fifth ","2/5":" two fifths ","3/5":" three fifths ","4/5":" four fifths ","1/6":" one sixth ","5/6":" five sixths ","1/8":" one eight ","3/8":" three eights ","5/8":" five eights ","7/8":" seven eights ","1/9":" one ninth ","2/9":" two ninths ","4/9":" four ninths ","5/9":" five ninths ","7/9":" seven ninths ","8/9":" eight ninths "}[Sp(i.above)+"/"+Sp(i.below)];ai?E=ai:E+=I+" over "+N}else E+=' the fraction <break time="150ms"/>'+I+' over <break time="150ms"/>'+N+'.<break time="150ms"/> End fraction.<break time="150ms"/>';break;case"surd":if(J=ln("math",i.body),i.hasEmptyBranch("above"))E+=ah(i.body)?" the square root of "+J+" , ":' the square root of <break time="200ms"/>'+J+'. <break time="200ms"/> End square root';else{let Lt=ln("math",i.above);Lt=Lt.trim();const ai=Lt.replace(/<mark([^/]*)\/>/g,"");ai==="3"?E+=' the cube root of <break time="200ms"/>'+J+'. <break time="200ms"/> End cube root':ai==="n"?E+=' the nth root of <break time="200ms"/>'+J+'. <break time="200ms"/> End root':E+=' the root with index: <break time="200ms"/>'+Lt+', of <break time="200ms"/>'+J+'. <break time="200ms"/> End root'}break;case"leftright":{const Lt=i;E+=(u=Lt.leftDelim?ju[Lt.leftDelim]:void 0)!=null?u:Lt.leftDelim,E+=ln("math",i.body),E+=(p=Lt.rightDelim?ju[Lt.rightDelim]:void 0)!=null?p:Lt.rightDelim}break;case"rule":break;case"overunder":break;case"overlap":break;case"macro":const St=ge.replace(/^\\/g,""),Kt=Wt()[St];Kt&&(Kt!=null&&Kt.expand?E+=ln("math",i.body):E+=`${St} `);break;case"placeholder":E+="placeholder ";break;case"delim":case"sizeddelim":case"mord":case"minner":case"mbin":case"mrel":case"mpunct":case"mopen":case"mclose":{if(ge==="\\mathbin"||ge==="\\mathrel"||ge==="\\mathopen"||ge==="\\mathclose"||ge==="\\mathpunct"||ge==="\\mathord"||ge==="\\mathinner"){E=ln(e,i.body);break}let Lt=i.isDigit()?i.asDigit():i.value,ai=i.command;if((i.type==="delim"||i.type==="sizeddelim")&&(ai=i.value,Lt=ai),e==="text")E+=Lt;else{if(i.type==="mbin"&&(E+='<break time="150ms"/>'),Lt){const yi=ju[Lt]||(ai?ju[ai.trim()]:"");if(yi)E+=" "+yi;else{const fi=ai?Kg(ai.trim()):"";E+=fi||b(Lt)}}else E+=ln("math",i.body);i.type==="mbin"&&(E+='<break time="150ms"/>')}break}case"mop":case"operator":case"extensible-symbol":if(i.value!=="\u200B"){const Lt=i.command;if(Lt==="\\sum")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let ai=ln("math",i.superscript);ai=ai.trim();let yi=ln("math",i.subscript);yi=yi.trim(),E+=' the summation from <break time="200ms"/>'+yi+'<break time="200ms"/> to <break time="200ms"/>'+ai+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(i.hasEmptyBranch("subscript"))E+=" the summation of";else{let ai=ln("math",i.subscript);ai=ai.trim(),E+=' the summation from <break time="200ms"/>'+ai+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(Lt==="\\prod")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let ai=ln("math",i.superscript);ai=ai.trim();let yi=ln("math",i.subscript);yi=yi.trim(),E+=' the product from <break time="200ms"/>'+yi+'<break time="200ms"/> to <break time="200ms"/>'+ai+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(i.hasEmptyBranch("subscript"))E+=" the product of ";else{let ai=ln("math",i.subscript);ai=ai.trim(),E+=' the product from <break time="200ms"/>'+ai+'<break time="200ms"/> of <break time="150ms"/>',oe=!0}else if(Lt==="\\int")if(!i.hasEmptyBranch("superscript")&&!i.hasEmptyBranch("subscript")){let ai=ln("math",i.superscript);ai=ai.trim();let yi=ln("math",i.subscript);yi=yi.trim(),E+=' the integral from <break time="200ms"/>'+w(yi)+'<break time="200ms"/> to <break time="200ms"/>'+w(ai)+' <break time="200ms"/> of ',oe=!0}else E+=' the integral of <break time="200ms"/> ';else if(typeof i.value=="string"){const ai=(m=ju[i.value])!=null?m:i.command?ju[i.command]:void 0;E+=ai||" "+i.value}else i.command&&(i.command==="\\mathop"?E+=ln("math",i.body):i.command==="\\operatorname"?E+=zg(i.body):E+=i.command.startsWith("\\")?" "+i.command.slice(1):" "+i.command)}break;case"enclose":J=ln("math",i.body),E+=" crossed out "+J+". End crossed out.";break;case"space":case"spacing":break}if(!oe&&!i.hasEmptyBranch("superscript")){let He=ln(e,i.superscript);He=He.trim();const Ft=He.replace(/<[^>]*>/g,"");if(ah(i.superscript)){if(e==="math"){const Ve=Ug(i.superscript);Ve&&(E+='<mark name="'+Ve+'"/>')}Ft==="\u2032"?E+=" prime ":Ft==="2"?E+=" squared ":Ft==="3"?E+=" cubed ":Number.isNaN(Number.parseInt(Ft))?E+=" to the "+He+"; ":E+=' to the <say-as interpret-as="ordinal">'+Ft+"</say-as> power; "}else Number.isNaN(Number.parseInt(Ft))?E+=" raised to the "+He+"; ":E+=' raised to the <say-as interpret-as="ordinal">'+Ft+"</say-as> power; "}if(!oe&&!i.hasEmptyBranch("subscript")){let He=ln("math",i.subscript);He=He.trim(),E+=ah(i.subscript)?" sub "+He:" subscript "+He+". End subscript. "}}return E}function qu(e){var i,r;if(window.MathfieldElement.textToSpeechRules==="sre"&&("sre"in window||"SRE"in window)){const u=An(e);if(u){window.MathfieldElement.textToSpeechMarkup&&(window.MathfieldElement.textToSpeechRulesOptions=(i=window.MathfieldElement.textToSpeechRulesOptions)!=null?i:{},window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{markup:window.MathfieldElement.textToSpeechMarkup}),window.MathfieldElement.textToSpeechRulesOptions.markup==="ssml"&&(window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{markup:"ssml_step"})),window.MathfieldElement.textToSpeechRulesOptions=f(P({},window.MathfieldElement.textToSpeechRulesOptions),{rate:window.MathfieldElement.speechEngineRate}));const p=(r=window.SRE)!=null?r:window.sre.System.getInstance();window.MathfieldElement.textToSpeechRulesOptions&&p.setupEngine(window.MathfieldElement.textToSpeechRulesOptions);let m="";try{m=p.toSpeech(u)}catch(b){console.error("MathLive 0.98.5: `SRE.toSpeech()` runtime error",b)}return m}return""}let a=ln("math",e);if(window.MathfieldElement.textToSpeechMarkup==="ssml"){let u="";window.MathfieldElement.speechEngineRate&&(u='<prosody rate="'+window.MathfieldElement.speechEngineRate+'">'),a='<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><amazon:auto-breaths>'+u+"<p><s>"+a+"</s></p>"+(u?"</prosody>":"")+"</amazon:auto-breaths></speak>"}else window.MathfieldElement.textToSpeechMarkup==="mac"&&H()==="macos"?a=a.replace(/<mark([^/]*)\/>/g,"").replace(/<emphasis>/g,"[[emph+]]").replace(/<\/emphasis>/g,"").replace(/<break time="(\d*)ms"\/>/g,"[[slc $1]]").replace(/<say-as[^>]*>/g,"").replace(/<\/say-as>/g,""):a=a.replace(/<[^>]*>/g,"").replace(/\s{2,}/g," ");return a}var oh={"\\ne":"\u2260","\\neq":"\u2260","\u2212":"-","-":"-","\\alpha":"alpha","\\beta":"beta","\\gamma":"gamma","\\delta":"delta","\\epsilon":"epsilon","\\varepsilon":"varepsilon","\\zeta":"zeta","\\eta":"eta","\\theta":"theta","\\vartheta":"vartheta","\\iota":"iota","\\kappa":"kappa","\\lambda":"lambda","\\mu":"mu","\\nu":"nu","\\xi":"xi","\\pi":"pi","\\rho":"rho","\\sigma":"sigma","\\tau":"tau","\\upsilon":"upsilon","\\phi":"phi","\\varphi":"varphi","\\chi":"chi","\\psi":"psi","\\omega":"omega","\\Gamma":"Gamma","\\Delta":"Delta","\\Theta":"Theta","\\Lambda":"Lambda","\\Xi":"Xi","\\Pi":"Pi","\\Sigma":"Sigma","\\Phi":"Phi","\\Psi":"Psi","\\Omega":"Omega","\\exponentialE":"e","\\imaginaryI":"i","\\imaginaryJ":"j","\\!":" ","\\,":" ","\\:":" ","\\>":" ","\\;":" ","\\enskip":" ","\\enspace":" ","\\qquad":" ","\\quad":" ","\\infty":"oo"},lh={"\\pm":"+-","\\colon":":","\\vert":"|","\\Vert":"||","\\mid":"|","\\lbrack":"[","\\rbrack":"]","\\lbrace":"{","\\rbrace":"}","\\lparen":"(","\\rparen":")","\\langle":"(:","\\rangle":":)","\\sum":" sum ","\\prod":" prod ","\\bigcap":" nnn ","\\bigcup":" uuu ","\\int":" int ","\\oint":" oint ","\\ge":">=","\\le":"<=","\\ne":"!=","\\neq":"!=","\\lt":"<","\\gt":">","\\gets":"<-","\\to":"->","\\land":" and ","\\lor":" or ","\\lnot":" not ","\\forall":" AA ","\\exists":" EE ","\\in":" in ","\\notin":" !in ","\\mapsto":"|->","\\implies":"=>","\\iff":"<=>","\\cdot":"*","\\ast":"**","\\star":"***","\\times":"xx","\\div":"-:","\\ltimes":"|><","\\rtimes":"><|","\\bowtie":"|><|","\\circ":"@"};function Vg(e){let i="";for(const r of e){const a=i[i.length-1];a!==void 0&&/\d/.test(a)&&/^\d/.test(r)&&(i+=" "),i+=r}return i}function Sr(e){var i,r,a,u,p,m,b,w,E,I,N,J,oe;if(!e)return"";if(k(e)){if(e.length===0)return"";if(e[0].mode==="latex")return e.map(Sr).join("");if(e[0].mode==="text"){let Kt=0,Lt="";for(;((i=e[Kt])==null?void 0:i.mode)==="text";)Lt+=e[Kt].body?Sr(e[Kt].body):e[Kt].value,Kt++;return`"${Lt}" ${Sr(e.slice(Kt))}`}let Ve=0;const St=[];for(;e[Ve]&&e[Ve].mode==="math";){let Kt="";for(;e[Ve]&&e[Ve].type==="mord"&&/\d/.test(e[Ve].value);)Kt+=e[Ve++].value;Kt?St.push(Kt):St.push(Sr(e[Ve++]))}return St.push(Sr(e.slice(Ve))),Vg(St)}if(e.mode==="text")return`"${e.value}"`;let ge="";const{command:He}=e;let Ft;if(He==="\\placeholder")return`(${Sr(e.body)})`;switch(e.type){case"accent":const Ve={"\\vec":"vec","\\dot":"dot","\\ddot":"ddot","\\bar":"bar","\\hat":"hat","\\acute":"acute;","\\grave":"grave","\\tilde":"tilde","\\breve":"breave","\\check":"check"}[He];ge=`${Ve!=null?Ve:""} ${Sr(e.body)} `;break;case"first":return"";case"latexgroup":return e.body.map(fi=>fi.value).join("");case"group":case"root":ge=(r=oh[He])!=null?r:Sr(e.body);break;case"genfrac":{const fi=e;(fi.leftDelim||fi.rightDelim)&&(ge=fi.leftDelim==="."||!fi.leftDelim?"{:":fi.leftDelim),fi.hasBarLine?(ge+="(",ge+=Sr(fi.above),ge+=")/(",ge+=Sr(fi.below),ge+=")"):(ge+="("+Sr(fi.above)+"),",ge+="("+Sr(fi.below)+")"),(fi.leftDelim||fi.rightDelim)&&(ge+=fi.rightDelim==="."||!fi.rightDelim?"{:":fi.rightDelim)}break;case"surd":ge+=e.hasEmptyBranch("above")?"sqrt("+Sr(e.body)+")":"root("+Sr(e.above)+")("+Sr(e.body)+")";break;case"latex":ge=e.value;break;case"leftright":{const fi=e,pn=fi.leftDelim;ge+=pn==="."||!pn?"{:":pn,ge+=Sr(fi.body);const Bn=fi.matchingRightDelim();ge+=Bn==="."||!Bn?":}":Bn}break;case"sizeddelim":case"delim":ge=e.value;break;case"overlap":break;case"overunder":break;case"mord":ge=(u=(a=oh[He])!=null?a:He)!=null?u:typeof e.value=="string"?e.value:"",ge.startsWith("\\")&&(ge+=" "),Ft=He?He.match(/{?\\char"([\dabcdefABCDEF]+)}?/):null,Ft?ge=String.fromCodePoint(Number.parseInt("0x"+Ft[1])):ge.length>0&&ge.startsWith("\\")&&(ge=typeof e.value=="string"?e.value.charAt(0):e.command),ge=Gg(ge,e.style);break;case"mbin":case"mrel":case"minner":ge=(m=(p=oh[He])!=null?p:lh[He])!=null?m:e.value;break;case"mopen":case"mclose":ge=e.value;break;case"mpunct":ge=(b=lh[He])!=null?b:He;break;case"mop":case"operator":case"extensible-symbol":e.value!=="\u200B"&&(lh[He]?ge=lh[He]:ge=He==="\\operatorname"?Sr(e.body):(w=e.value)!=null?w:He,ge+=" ");break;case"array":const St=e.array,Kt=e.environmentName,Lt=(E={bmatrix:["[","]"],"bmatrix*":["[","]"]}[Kt])!=null?E:["(",")"],ai=[];for(const fi of St){const pn=[];for(const Bn of fi)pn.push(Lt[0]+Sr(Bn)+Lt[1]);ai.push(pn.join(","))}const yi=(I={bmatrix:["[","]"],"bmatrix*":["[","]"],cases:["{",":}"]}[Kt])!=null?I:["(",")"];ge=yi[0]+ai.join(",")+yi[1];break;case"box":break;case"spacing":ge=(N=oh[He])!=null?N:" ";break;case"enclose":ge="("+Sr(e.body)+")";break;case"space":ge=" ";break;case"subsup":ge="";break;case"macro":ge=(oe=(J=oh[He])!=null?J:lh[He])!=null?oe:Sr(e.body);break}if(!e.hasEmptyBranch("subscript")){ge+="_";const Ve=Sr(e.subscript);ge+=Ve.length!==1?`(${Ve})`:Ve}if(!e.hasEmptyBranch("superscript")){ge+="^";const Ve=Sr(e.superscript);ge+=Ve.length!==1?`(${Ve})`:Ve}return ge}function Gg(e,i){if(!i)return e;let r=e;return i.variant==="double-struck"&&(r=`bbb "${r}"`),i.variant==="script"&&(r=`cc "${r}"`),i.variant==="fraktur"&&(r=`fr "${r}"`),i.variant==="sans-serif"&&(r=`sf "${r}"`),i.variant==="monospace"&&(r=`tt "${r}"`),i.variantStyle==="bold"&&(r=`bb "${r}"`),i.color?`color({${i.color}})(${r})`:r}function Vr(e,i){var r,a;i!=null||(i={}),i.mathstyle=(r=i.mathstyle)!=null?r:"displaystyle";const u=new fn({from:f(P({},Ec()),{renderPlaceholder:()=>new $t(160,{maxFontSize:1}),letterShapeStyle:(a=i==null?void 0:i.letterShapeStyle)!=null?a:"tex"}),mathstyle:i.mathstyle}),m=new ut({mode:"math",type:"root",body:Ur(e,{context:u,parseMode:"math",mathstyle:i.mathstyle})}).render(u);return m?(yu(Nl(m,u)),bu(m,{classes:"ML__latex"}).toMarkup()):""}function P1(e){return bf(e,{context:Ec()})}function Hg(e,i={}){return An(Ur(e,{parseMode:"math",args:()=>"",mathstyle:"displaystyle"}),i)}function Wg(e){const i=Ur(e,{parseMode:"math",mathstyle:"displaystyle"});return qu(i)}var ed;function jg(e){var i,r;if(!ed){const a=(i=globalThis[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:i.ComputeEngine;a?ed=new a:console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`)}return(r=ed==null?void 0:ed.box(e).latex)!=null?r:""}function O1(e,i="math"){return Sr(new ut({type:"root",body:Ur(e,{parseMode:i})}))}function F1(e){return Au(e,{format:"ascii-math"})[1]}function k0(e){if(typeof e=="string"){const i=qg(e);if(!i)throw new Error(`Invalid color: ${e}`);return i}return"C"in e?Yg(e):"a"in e?Ep(e):e}function Zu(e){return e<0?0:e>255?255:Math.round(e)}function qg(e){if(!e||e[0]!=="#")return;e=e.slice(1);let i;return e.length<=4?(i={r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16)},e.length===4&&(i.a=parseInt(e[3]+e[3],16)/255)):(i={r:parseInt(e[0]+e[1],16),g:parseInt(e[2]+e[3],16),b:parseInt(e[4]+e[5],16)},e.length===8&&(i.a=parseInt(e[6]+e[7],16)/255)),i&&typeof i.a=="undefined"&&(i.a=1),i}function T0(e){const[i,r,a]=[e.L,e.C,e.H],u=a*Math.PI/180,p={L:i,a:r*Math.cos(u),b:r*Math.sin(u)};return e.alpha!==void 0&&(p.alpha=e.alpha),p}function Zg(e){const[i,r,a]=[e.L,e.a,e.b],u=Math.sqrt(r*r+a*a),m=Math.atan2(a,r)*180/Math.PI,b={L:i,C:u,H:m};return e.alpha!==void 0&&(b.alpha=e.alpha),b}function A0(e){const[i,r,a]=[e.L,e.a,e.b],u=Math.pow(.9999999984505198*i+.39633779217376786*r+.2158037580607588*a,3),p=Math.pow(1.00000000888176*i-.10556134232365635*r-.0638541747717059*a,3),m=Math.pow(i*1.000000054672411-.0894841820949657*r-1.2914855378640917*a,3),b=4.076741661347994*u-3.307711590408193*p+.230969928729428*m,w=-1.2684380040921763*u+2.6097574006633715*p-.3413193963102197*m,E=-.004196086541837188*u-.7034186144594493*p+1.7076147009309444*m,I=N=>{const J=Math.abs(N);return J<=.0031308?N*12.92:(Math.sign(N)||1)*(1.055*Math.pow(J,1/2.4)-.055)};return[I(b),I(w),I(E)]}function L0(e){const[i,r,a]=e;return i>=0&&i<=1&&r>=0&&r<=1&&a>=0&&a<=1}function D0(e,i){let[r,a,u]=e;return r=Zu(r*255),a=Zu(a*255),u=Zu(u*255),i!==void 0?{r,g:a,b:u,alpha:i}:{r,g:a,b:u}}function Ep(e){let[i,r,a]=A0(e);if(L0([i,r,a]))return D0([i,r,a],e.alpha);const u=Zg(e);if(u.C=0,[i,r,a]=A0(T0(u)),!L0([i,r,a]))return D0([i,r,a],e.alpha);let p=0,m=e.L,b=(p+m)/2;u.C=b;const w=.36/Math.pow(2,12);for(;m-p>w;)b=(p+m)/2,u.C=b,[i,r,a]=A0(T0(u)),L0([i,r,a])?p=b:m=b;return D0([i,r,a],e.alpha)}function Yg(e){return Ep(T0(e))}function kp(e,i){const r=k0(e),a=k0(i),u=.56,p=.57,m=.62,b=.65,w=.022,E=1.414,I=.1,N=5e-4,J=1.14,oe=.027,ge=1.14,He=.027;function Ft(fi){return fi>=w?fi:fi+wa(w-fi,E)}function Ve(fi){return(fi<0?-1:1)*Math.pow(Math.abs(fi),2.4)}const St=Ft(Ve(a.r/255)*.2126729+Ve(a.g/255)*.7151522+Ve(a.b/255)*.072175),Kt=Ft(Ve(r.r/255)*.2126729+Ve(r.g/255)*.7151522+Ve(r.b/255)*.072175);let Lt,ai,yi;return Math.abs(Kt-St)<N?ai=0:Kt>St?(Lt=wa(Kt,u)-wa(St,p),ai=Lt*J):(Lt=wa(Kt,b)-wa(St,m),ai=Lt*ge),Math.abs(ai)<I?yi=0:ai>0?yi=ai-He:yi=ai+oe,yi*100}function Tp(e,i,r){r!=null||(r="#fff"),i!=null||(i="#000");const a=kp(e,r),u=kp(e,i);return Math.abs(a)>Math.abs(u)?r:i}function Xg(e){const i=k0(e);let r=((1<<24)+(Zu(i.r)<<16)+(Zu(i.g)<<8)+Zu(i.b)).toString(16).slice(1);return i.alpha!==void 0&&i.alpha<1&&(r+=("00"+Math.round(i.alpha*255).toString(16)).slice(-2)),r[0]===r[1]&&r[2]===r[3]&&r[4]===r[5]&&r[6]===r[7]&&(r=r[0]+r[2]+r[4]+(i.alpha!==void 0&&i.alpha<1?r[6]:"")),"#"+r}function nr(e){const i=Ap(e);let r="";for(const a of i){if(typeof a.value!="string")return"";r+=a.value}return r}function Ap(e){const r=e.model.selection.ranges;return r.length!==1?[]:e.model.getAtoms(r[0])}function Jg(e,i){const r=Ap(e);if(r.length!==1)return!1;const a=Wc[i];return a?!!a.test(r[0].value):!1}function Qg(e,i){return nr(e).length>0}function e1(e){return[C0(e,"double-struck","mathbb","tooltip.blackboard"),C0(e,"fraktur","mathfrak","tooltip.fraktur"),C0(e,"calligraphic","mathcal","tooltip.caligraphic"),M0(e,"up","mathrm","tooltip.roman-upright"),M0(e,"bold","mathbf","tooltip.bold"),M0(e,"italic","mathit","tooltip.italic")]}function t1(e){return[{label:()=>Vr(`\\vec{${nr(e)}}`),visible:()=>nr(e).length===1,onMenuSelect:()=>e.insert("\\vec{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\overrightarrow{${nr(e)}}`),visible:()=>nr(e).length>0,onMenuSelect:()=>e.insert("\\overrightarrow{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\overleftarrow{${nr(e)}}`),visible:()=>nr(e).length>0,onMenuSelect:()=>e.insert("\\overleftarrow{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\dot{${nr(e)}}`),visible:()=>nr(e).length===1,onMenuSelect:()=>e.insert("\\dot{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\ddot{${nr(e)}}`),visible:()=>nr(e).length===1,onMenuSelect:()=>e.insert("\\ddot{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\bar{${nr(e)}}`),visible:()=>nr(e).length===1,onMenuSelect:()=>e.insert("\\bar{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\overline{${nr(e)}}`),visible:()=>nr(e).length>0,onMenuSelect:()=>e.insert("\\overline{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\overgroup{${nr(e)}}`),visible:()=>nr(e).length>0,onMenuSelect:()=>e.insert("\\overgroup{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\overbrace{${nr(e)}}`),visible:()=>nr(e).length>0,onMenuSelect:()=>e.insert("\\overbrace{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\underline{${nr(e)}}`),visible:()=>nr(e).length>0,onMenuSelect:()=>e.insert("\\underline{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\undergroup{${nr(e)}}`),visible:()=>nr(e).length>0,onMenuSelect:()=>e.insert("\\undergroup{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\underbrace{${nr(e)}}`),visible:()=>nr(e).length>0,onMenuSelect:()=>e.insert("\\underbrace{#@}",{selectionMode:"item"})}]}function i1(e){return[{label:()=>Vr(`\\boxed{${e.getValue(e.model.selection)}}}`),onMenuSelect:()=>e.insert("\\boxed{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\bbox[5px, border: 2px solid red]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px solid red]{#@}",{selectionMode:"item"})},{label:()=>Vr(`\\bbox[5px, border: 2px dashed black]{${e.getValue(e.model.selection)}}`),onMenuSelect:()=>e.insert("\\bbox[5px, border: 2px dashed black]{#@}",{selectionMode:"item"})}]}function n1(e){const i=[];for(const r of Object.keys(Te))i.push({class:(Xg(Tp(Te[r]))==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${Te[r]} "></span>`,ariaLabel:()=>{var a;return(a=V(r))!=null?a:r},checked:()=>{var a;return{some:"mixed",all:!0}[(a=e.queryStyle({backgroundColor:r}))!=null?a:!1]},onMenuSelect:()=>{e.applyStyle({backgroundColor:r},{operation:"toggle"}),e.adoptStyle="none"}});return i}function r1(e){const i=[];for(const r of Object.keys(se))i.push({class:(Tp(se[r])==="#000"?"dark-contrast":"light-contrast")+" menu-swatch",label:`<span style="background:${se[r]} "></span>`,ariaLabel:()=>{var a;return(a=V(r))!=null?a:r},checked:()=>{var a;return{some:"mixed",all:!0}[(a=e.queryStyle({color:r}))!=null?a:!1]},onMenuSelect:()=>{e.applyStyle({color:r},{operation:"toggle"}),e.adoptStyle="none"}});return i}var s1=class extends pp{constructor(e,i,r,a){super(e,i),this.row=r,this.col=a}set active(e){const i=this.parentMenu.children;if(e)for(const r of i)r.element.classList.toggle("active",r.row<=this.row&&r.col<=this.col);else for(const r of i)r.element.classList.remove("active")}};function a1(e){const i=[];for(let r=1;r<=5;r++)for(let a=1;a<=5;a++)i.push({onCreate:(u,p)=>new s1(u,p,r,a),label:"\u2610",tooltip:()=>V("tooltip.row-by-col",r,a),data:{row:r,col:a},onMenuSelect:()=>{e.insert(`\\begin{pmatrix}${Array(r).fill(Array(a).fill("#?").join(" & ")).join("\\\\")}\\end{pmatrix}`,{selectionMode:"item"})}});return i}function o1(e){return[{label:()=>V("menu.array.add row above"),id:"add-row-above",onMenuSelect:()=>e.executeCommand("addRowBefore"),visible:()=>Zl(e)},{label:()=>V("menu.array.add row below"),id:"add-row-below",onMenuSelect:()=>e.executeCommand("addRowAfter"),visible:()=>Zl(e)},{label:()=>V("menu.array.add column before"),id:"add-column-before",onMenuSelect:()=>e.executeCommand("addColumnBefore"),visible:()=>Zl(e),enabled:()=>{const i=e.model.parentEnvironment;if(!i)return!1;const[r,a]=u1(e);return r<i.maxColumns}},{label:()=>V("menu.array.add column after"),id:"add-column-after",onMenuSelect:()=>e.executeCommand("addColumnAfter"),visible:()=>Zl(e)},{type:"divider"},{label:()=>V("menu.array.delete row"),id:"delete-row",onMenuSelect:()=>e.executeCommand("removeRow"),visible:()=>Zl(e)},{label:()=>V("menu.array.delete column"),id:"delete-column",onMenuSelect:()=>e.executeCommand("removeColumn"),visible:()=>Zl(e)},{type:"divider"},{label:()=>V("menu.borders"),visible:()=>(l1(e)||Zl(e))&&e.isSelectionEditable,submenu:[{label:" \u22F1 ",id:"environment-no-border",onMenuSelect:()=>uh(e,"matrix")},{label:"(\u22F1)",id:"environment-parentheses",onMenuSelect:()=>uh(e,"pmatrix")},{label:"[\u22F1]",id:"environment-brackets",onMenuSelect:()=>uh(e,"bmatrix")},{label:"|\u22F1|",id:"environment-bar",onMenuSelect:()=>uh(e,"vmatrix")},{label:"{\u22F1}",id:"environment-braces",onMenuSelect:()=>uh(e,"Bmatrix")}],submenuClass:"border-submenu"},{type:"divider"},{label:()=>V("menu.insert matrix"),id:"insert-matrix",visible:()=>e.isSelectionEditable,submenu:a1(e),submenuClass:"insert-matrix-submenu",columnCount:5},{label:()=>V("menu.mode"),id:"mode",visible:()=>e.isSelectionEditable&&e.model.selectionIsCollapsed,submenu:[{label:()=>V("menu.mode-math"),id:"mode-math",onMenuSelect:()=>{ci(e,"accept-all"),e.executeCommand(["switchMode","math"])},checked:()=>e.model.mode==="math"},{label:()=>V("menu.mode-text"),id:"mode-text",onMenuSelect:()=>{ci(e,"accept-all"),e.executeCommand(["switchMode","text"])},checked:()=>e.model.mode==="text"},{label:()=>V("menu.mode-latex"),id:"mode-latex",onMenuSelect:()=>e.executeCommand(["switchMode","latex"]),checked:()=>e.model.mode==="latex"}]},{type:"divider"},{label:()=>V("menu.font-style"),id:"variant",visible:()=>e.isSelectionEditable,submenu:e1(e),submenuClass:"variant-submenu"},{label:()=>V("menu.color"),id:"color",visible:()=>e.isSelectionEditable,submenu:r1(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>V("menu.background-color"),id:"background-color",visible:()=>e.isSelectionEditable,submenu:n1(e),columnCount:4,submenuClass:"swatches-submenu"},{label:()=>V("menu.accent"),id:"accent",visible:()=>e.isSelectionEditable,submenu:t1(e),submenuClass:"variant-submenu"},{label:()=>V("menu.decoration"),id:"decoration",visible:()=>e.isSelectionEditable&&nr(e).length>0,submenu:i1(e),submenuClass:"variant-submenu"},{type:"divider"},{label:()=>V("menu.evaluate"),id:"ce-evaluate",visible:()=>e.isSelectionEditable&&window.MathfieldElement.computeEngine!==null,onMenuSelect:()=>{const i=c1(e);if(!i){e.model.announce("plonk");return}e.model.selectionIsCollapsed?(e.model.position=e.model.lastOffset,e.insert(`=${i}`,{insertionMode:"insertAfter",selectionMode:"item"})):e.insert(i,{insertionMode:"replaceSelection",selectionMode:"item"})}},{label:()=>V("menu.simplify"),id:"ce-simplify",visible:()=>e.isSelectionEditable&&window.MathfieldElement.computeEngine!==null,onMenuSelect:()=>{var i,r;if(e.model.selectionIsCollapsed){const a=(i=e.expression)==null?void 0:i.simplify();if(e.model.position=e.model.lastOffset,!a){e.model.announce("plonk");return}e.insert(`=${a.latex}`,{insertionMode:"insertAfter",selectionMode:"item"})}else{const a=(r=window.MathfieldElement.computeEngine)==null?void 0:r.parse(e.getValue(e.model.selection)).simplify();if(!a){e.model.announce("plonk");return}e.insert(a.latex,{insertionMode:"replaceSelection",selectionMode:"item"})}}},{label:()=>{var i;if(window.MathfieldElement.computeEngine===null)return"";const r=(i=e.expression)==null?void 0:i.unknowns[0];return r?V("menu.solve-for",Vr(r)):V("menu.solve")},id:"ce-solve",visible:()=>{var i;return e.isSelectionEditable&&window.MathfieldElement.computeEngine!==null&&((i=e.expression)==null?void 0:i.unknowns.length)===1&&e.expression.unknowns[0]!=="Nothing"},onMenuSelect:()=>{var i;const r=e.expression,a=r==null?void 0:r.unknowns[0],u=(i=r.solve(a))==null?void 0:i.map(p=>{var m;return(m=p.simplify().latex)!=null?m:""});if(!u){e.model.announce("plonk");return}e.insert(`${a}=${u.length===1?u[0]:"\\left\\lbrace"+(u==null?void 0:u.join(", "))+"\\right\\rbrace"}`,{insertionMode:"replaceAll",selectionMode:"item"})}},{type:"divider"},{label:()=>V("menu.cut"),onMenuSelect:()=>e.executeCommand("cutToClipboard"),visible:()=>!e.options.readOnly&&e.isSelectionEditable,keyboardShortcut:"meta+X"},{label:()=>V("menu.copy"),id:"copy",submenu:[{label:()=>V("menu.copy-as-latex"),id:"copy-latex",onMenuSelect:()=>jn.copyToClipboard(e,"latex"),keyboardShortcut:"meta+C"},{label:()=>V("menu.copy-as-ascii-math"),id:"copy-ascii-math",onMenuSelect:()=>jn.copyToClipboard(e,"ascii-math")},{label:()=>V("menu.copy-as-mathml"),id:"copy-math-ml",onMenuSelect:()=>jn.copyToClipboard(e,"math-ml")}]},{label:()=>V("menu.paste"),id:"paste",onMenuSelect:()=>e.executeCommand("pasteFromClipboard"),visible:()=>e.hasEditableContent,keyboardShortcut:"meta+V"},{label:()=>V("menu.select-all"),id:"select-all",keyboardShortcut:"meta+A",onMenuSelect:()=>e.executeCommand("selectAll")}]}function Zl(e){var i;return!!((i=e.model.parentEnvironment)!=null&&i.array)}function l1(e){return e.model.at(e.model.position).type==="array"}function u1(e){var i;const r=(i=e.model.parentEnvironment)==null?void 0:i.array;return r?[r.length,r.reduce((a,u)=>Math.max(a,u.length),0)]:[0,0]}function uh(e,i){ti(e),e.flushInlineShortcutBuffer(),W0(e.model,i),Ii(e)}function c1(e){var i,r;let a;if(e.model.selectionIsCollapsed?a=(i=window.MathfieldElement.computeEngine)==null?void 0:i.parse(e.getValue(),{canonical:!1}):a=(r=window.MathfieldElement.computeEngine)==null?void 0:r.parse(e.getValue(e.model.selection),{canonical:!1}),!a)return"";let u=a.evaluate();return u.isSame(a)&&(u=a.N()),u.latex}function C0(e,i,r,a){return{label:()=>Vr(`\\${r}{${nr(e)}}`),tooltip:()=>{var u;return(u=V(a))!=null?u:a},visible:()=>Jg(e,i),checked:()=>{var u;return{some:"mixed",all:!0}[(u=e.queryStyle({variant:i}))!=null?u:!1]},onMenuSelect:()=>{e.applyStyle({variant:i},{operation:"toggle"}),e.adoptStyle="none"}}}function M0(e,i,r,a){return{label:()=>Vr(`\\${r}{${nr(e)}}`),tooltip:()=>{var u;return(u=V(a))!=null?u:a},visible:()=>Qg(e,i),checked:()=>{var u;return{some:"mixed",all:!0}[(u=e.queryStyle({variantStyle:i}))!=null?u:!1]},onMenuSelect:()=>{e.applyStyle({variantStyle:i},{operation:"toggle"}),e.adoptStyle="none"}}}function Yu(e,i){return e+qu(i)}Jr({speak:(e,i,r)=>h1(e,i,r)},{target:"mathfield"});function h1(e,i,r){var a,u;r=r!=null?r:{withHighlighting:!1};const{model:p}=e;function m(I){let N=null;switch(I){case"all":N=p.root;break;case"selection":N=p.getAtoms(p.selection);break;case"left":{N=p.getAtoms(p.offsetOf(p.at(p.position).leftSibling),p.position);break}case"right":{N=p.getAtoms(p.position,p.offsetOf(p.at(p.position).rightSibling));break}case"group":N=p.getAtoms(p.getSiblingsRange(p.position));break;case"parent":{const{parent:J}=p.at(p.position);J!=null&&J.parent?N=J:N=p.root;break}default:N=p.root}return N}function b(I){let N="";switch(I){case"all":console.log("Internal failure: speak all failed");break;case"selection":N="no selection";break;case"left":N="at start";break;case"right":N="at end";break;case"group":console.log("Internal failure: speak group failed");break;case"parent":N="no parent";break;default:console.log('unknown speak_ param value: "'+I+'"');break}return N}const w=m(i);if(w===null)return(u=(a=window.MathfieldElement).speakHook)==null||u.call(a,b(i)),!1;(r.withHighlighting||window.MathfieldElement.speechEngine==="amazon")&&(window.MathfieldElement.textToSpeechMarkup=window.sre&&window.MathfieldElement.textToSpeechRules==="sre"?"ssml_step":"ssml");const E=qu(w);return C()&&r.withHighlighting?(ul().readAloudMathfield=e,Ls(e,{forHighlighting:!0}),window.MathfieldElement.readAloudHook&&window.MathfieldElement.readAloudHook(e.field,E)):window.MathfieldElement.speakHook&&window.MathfieldElement.speakHook(E),!1}function f1(e){var i,r;if(!C()){console.log("Speak:",e);return}if(!window.MathfieldElement.speechEngine||window.MathfieldElement.speechEngine==="local"){const a=new SpeechSynthesisUtterance(e);window.speechSynthesis.speak(a)}else if(window.MathfieldElement.speechEngine==="amazon")if(!("AWS"in window))console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");else{const a=new window.AWS.Polly({apiVersion:"2016-06-10"}),u={OutputFormat:"mp3",VoiceId:(i=window.MathfieldElement.speechEngineVoice)!=null?i:"Joanna",Engine:["Amy","Emma","Brian","Ivy","Joanna","Kendra","Kimberly","Salli","Joey","Justin","Matthew"].includes((r=window.MathfieldElement.speechEngineVoice)!=null?r:"Joanna")?"neural":"standard",Text:e,TextType:"ssml"};a.synthesizeSpeech(u,(p,m)=>{if(p)console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${p}`);else if(m!=null&&m.AudioStream){const b=new Uint8Array(m.AudioStream),w=new Blob([b.buffer],{type:"audio/mpeg"}),E=URL.createObjectURL(w);new Audio(E).play().catch(N=>console.log(N))}else console.log("polly.synthesizeSpeech():",m)})}else window.MathfieldElement.speechEngine==="google"&&console.error("MathLive 0.98.5: The Google speech engine is not supported yet. Please come again.")}function Lp(e){var i;let r;if(e.parent.type==="prompt")e.parentBranch==="body"&&(r="prompt");else if(e.parentBranch==="body")r=e.type&&(i={enclose:"cross out",leftright:"delimiter",surd:"square root",root:"math field",mop:"operator",first:"first"}[e.type])!=null?i:"parent";else if(e.parent.type==="genfrac"){if(e.parentBranch==="above")return"numerator";if(e.parentBranch==="below")return"denominator"}else e.parent.type==="surd"?e.parentBranch==="above"&&(r="index"):e.parentBranch==="superscript"?r="superscript":e.parentBranch==="subscript"&&(r="subscript");return r||console.log("unknown relationship"),r!=null?r:"parent"}function d1(e,i,r,a){let u="";if(i==="plonk")window.MathfieldElement.playSound("plonk"),e.flushInlineShortcutBuffer();else if(i==="delete")u=Yu("deleted: ",a);else if(i==="focus"||i.includes("move"))u=p1(e.model,r)+(e.model.selectionIsCollapsed?"":"selected: ")+m1(e.model);else if(i==="replacement")u=Yu("",e.model.at(e.model.position));else if(i==="line"){const p=Yu("",e.model.root);e.keyboardDelegate.setAriaLabel(p)}else u=a?Yu(i+" ",a):i;if(u){const p=e.ariaLiveText.textContent.includes("\xA0")?" \u202F ":" \xA0 ";e.ariaLiveText.textContent=u+p}}function p1(e,i){if(Number.isNaN(i))return"";const r=e.at(i);if(!r||r.treeDepth<=e.at(e.position).treeDepth)return"";let a="",u=r.parent;const p=e.at(e.position).parent;for(;u!==e.root&&u!==p;)a+=`out of ${Lp(u)};`,u=u.parent;return a}function m1(e){if(!e.selectionIsCollapsed)return Yu("",e.getAtoms(e.selection));let i="";const r=e.at(e.position),a=Lp(r);return r.isFirstSibling&&(i=(a?"start of "+a:"unknown")+": "),r.isLastSibling?r.isFirstSibling||(i+=a?"end of "+a:"unknown"):i+=Yu("",r),i}var g1=class{constructor(e,i,r){this.mathfield=e,this.mode=i,this.silenceNotifications=!1,this._selection={ranges:[[0,0]],direction:"none"},this._anchor=0,this._position=0,this.root=r}dispose(){this.mathfield=void 0}getState(){const e={ranges:[...this._selection.ranges]};return this.selection.direction&&this.selection.direction!=="none"&&(e.direction=this.selection.direction),{content:this.root.toJson(),selection:e,mode:this.mode}}setState(e,i){var r;const a=this.silenceNotifications;this.silenceNotifications=(r=i==null?void 0:i.silenceNotifications)!=null?r:!0;let u={};if((i==null?void 0:i.type)==="undo"&&(u={inputType:"historyUndo"}),(i==null?void 0:i.type)==="redo"&&(u={inputType:"historyRedo"}),this.contentWillChange(u)){const p=this.silenceNotifications;this.silenceNotifications=!0,this.mode=e.mode,this.root=Fa(e.content),this.selection=e.selection,this.silenceNotifications=p,this.contentDidChange(u)}this.silenceNotifications=a}get atoms(){return this.root.children}get selection(){return this._selection}set selection(e){this.setSelection(e)}setSelection(e,i){return!this.mathfield.contentEditable&&this.mathfield.userSelect==="none"?!1:this.deferNotifications({selection:!0},()=>{var r,a,u;const p=this.normalizeSelection(e,i);if(p===void 0)throw new TypeError("Invalid selection");if(p.ranges.length===1&&p.ranges[0][0]===p.ranges[0][1]){const I=p.ranges[0][0];if(!this.mathfield.dirty&&!((r=this.at(I))!=null&&r.parentPrompt)&&this.mathfield.hasEditablePrompts){if((a=this.at(I-1))!=null&&a.parentPrompt){this._anchor=this.normalizeOffset(I-1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}if((u=this.at(I+1))!=null&&u.parentPrompt){this._anchor=this.normalizeOffset(I+1),this._position=this._anchor,this._selection=this.normalizeSelection(this._anchor);return}this._anchor=0,this._position=0,this._selection={ranges:[[0,0]]};return}this._anchor=I,this._position=I,this._selection=p;return}const m=Kr(p);p.direction==="backward"?[this._position,this._anchor]=m:[this._anchor,this._position]=m;const b=this.at(m[0]+1),w=this.at(m[1]),E=ut.commonAncestor(b,w);(E==null?void 0:E.type)==="array"&&b.parent===E&&w.parent===E?this._selection={ranges:[m],direction:p.direction}:this._selection={ranges:[m],direction:p.direction},console.assert(this._position>=0&&this._position<=this.lastOffset)})}setPositionHandlingPlaceholder(e){var i;const r=this.at(e);(r==null?void 0:r.type)==="placeholder"?this.setSelection(e-1,e):((i=r==null?void 0:r.rightSibling)==null?void 0:i.type)==="placeholder"?this.setSelection(e,e+1):this.position=e,r instanceof Tr&&r.isSuggestion&&(r.isSuggestion=!1),this.mathfield.stopCoalescingUndo()}get position(){return this._position}set position(e){this.setSelection(e,e)}get anchor(){return this._anchor}get selectionIsCollapsed(){return this._anchor===this._position}get selectionIsPlaceholder(){return Math.abs(this._anchor-this._position)===1?this.at(Math.max(this._anchor,this._position)).type==="placeholder":!1}collapseSelection(e="forward"){return this._anchor===this._position?!1:(e==="backward"?this.position=Math.min(this._anchor,this._position):this.position=Math.max(this._anchor,this._position),!0)}get lastOffset(){return this.atoms.length-1}at(e){return this.atoms[e]}offsetOf(e){return this.atoms.indexOf(e)}getSiblingsRange(e){const i=this.at(e),{parent:r}=i;if(!r)return[0,this.lastOffset];const a=i.parent.branch(i.parentBranch);return[this.offsetOf(a[0]),this.offsetOf(a[a.length-1])]}getBranchRange(e,i){const r=this.at(e).branch(i);return[this.offsetOf(r[0]),this.offsetOf(r[r.length-1])]}getAtoms(e,i,r){let a=r!=null?r:{};if(ku(e)){if(a=i!=null?i:{},e.ranges.length>1)return e.ranges.reduce((E,I)=>[...E,...this.getAtoms(I,a)],[]);e=e.ranges[0]}let u,p;if(pa(e)){if(u=e,!pa(i))return[];p=i}else[u,p]=e,a=i!=null?i:{};if(!Number.isFinite(u))return[];a.includeChildren===void 0&&(a.includeChildren=!1),u<0&&(u=this.lastOffset-u+1),p<0&&(p=this.lastOffset-p+1);const m=Math.min(u,p)+1,b=Math.max(u,p);if(!a.includeChildren&&m===1&&b===this.lastOffset)return[this.root];let w=[];for(let E=m;E<=b;E++){const I=this.atoms[E];Dp(this,I,m,b)&&w.push(I)}return a.includeChildren||(w=w.filter(E=>{let I=!1,{parent:N}=E;for(;N&&!I;)I=Dp(this,N,m,b),N=N.parent;return!I})),w}getAllAtoms(e=0){const i=[],r=this.lastOffset;for(let a=e;a<=r;a++)i.push(this.atoms[a]);for(let a=0;a<e;a++)i.push(this.atoms[a]);return i}findAtom(e,i=0,r="forward"){let a;const u=this.lastOffset;if(r==="forward"){for(let p=i;p<=u;p++)if(a=this.atoms[p],e(a))return a;for(let p=0;p<i;p++)if(a=this.atoms[p],e(a))return a;return}for(let p=i;p>=0;p--)if(a=this.atoms[p],e(a))return a;for(let p=u;p>i;p--)if(a=this.atoms[p],e(a))return a}extractAtoms(e){let i=this.getAtoms(e);if(i.length===1&&!i[0].parent)if(i[0].type==="root")i=[...i[0].body],i.shift();else return i=this.root.cells.flat(),this.root=new ut({type:"root",body:[]}),i;for(const r of i)r.parent.removeChild(r);return i}deleteAtoms(e){this.extractAtoms(e),this.position=e[0]}atomToString(e,i){const r=i!=null?i:"latex";if(r.startsWith("latex"))return ut.serialize([e],{expandMacro:r==="latex-expanded",skipStyles:r==="latex-unstyled",skipPlaceholders:r==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode});if(r==="math-ml")return An(e);if(r==="spoken")return qu(e);if(r==="spoken-text"){const a=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="";const u=qu(e);return window.MathfieldElement.textToSpeechMarkup=a,u}if(r==="spoken-ssml"||r==="spoken-ssml-with-highlighting"){const a=window.MathfieldElement.textToSpeechMarkup;window.MathfieldElement.textToSpeechMarkup="ssml";const u=qu(e);return window.MathfieldElement.textToSpeechMarkup=a,u}return r==="ascii-math"?Sr(e):(console.error(`MathLive 0.98.5: Unexpected format "${r}`),"")}getValue(e,i,r){if(e===void 0)return this.atomToString(this.root,"latex");if(typeof e=="string"&&e!=="math-json")return this.atomToString(this.root,e);let a,u;if(pa(e)&&pa(i)?(a=[this.normalizeRange([e,i])],u=r):jo(e)?(a=[this.normalizeRange(e)],u=i):ku(e)?(a=e.ranges,u=i):(a=[this.normalizeRange([0,-1])],u=e),u!=null||(u="latex"),u==="math-json"){if(!window.MathfieldElement.computeEngine)return window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`),'["Error", "compute-engine-not-available"]';const p=this.getValue({ranges:a},"latex-unstyled");try{const m=window.MathfieldElement.computeEngine.parse(p);return JSON.stringify(m.json)}catch(m){return JSON.stringify(["Error",`'${m.toString()}'`])}}if(u.startsWith("latex")){const p={expandMacro:u==="latex-expanded",skipStyles:u==="latex-unstyled",skipPlaceholders:u==="latex-without-placeholders",defaultMode:this.mathfield.options.defaultMode};return on(a.map(m=>ut.serialize(this.getAtoms(m),p)))}return a.map(p=>this.getAtoms(p).map(m=>this.atomToString(m,u)).join("")).join("")}extendSelectionTo(e,i){return!this.mathfield.contentEditable&&this.mathfield.userSelect==="none"?!1:this.deferNotifications({selection:!0},()=>{const r=this.normalizeRange([e,i]);let[a,u]=r,{parent:p}=this.at(u);if(p&&(p.type==="genfrac"||p.type==="subsup"))for(;p!==this.root&&I0(this,p,[a,u]);)u=this.offsetOf(p),p=p.parent;for(p=this.at(a).parent;p!==this.root&&I0(this,p,[a,u]);)a=this.offsetOf(p.leftSibling),p=p.parent;if(p=this.at(u).parent,(p==null?void 0:p.type)==="genfrac")for(;p!==this.root&&I0(this,p,[a,u]);)u=this.offsetOf(p),console.assert(u>=0),p=p.parent;this._position=this.normalizeOffset(i),this._selection={ranges:[[a,u]],direction:"none"}})}announce(e,i,r=[]){var a,u;((u=(a=this.mathfield.host)==null?void 0:a.dispatchEvent(new CustomEvent("announce",{detail:{command:e,previousPosition:i,atoms:r},cancelable:!0,bubbles:!0,composed:!0})))!=null?u:!0)&&d1(this.mathfield,e,i,r)}deferNotifications(e,i){const r=this._selection,a=this._anchor,u=this._position,p=this.silenceNotifications;this.silenceNotifications=!0;const m=this.root.changeCounter;i();const b=this.root.changeCounter!==m,w=a!==this._anchor||u!==this._position||O0(this._selection,r)==="different";return this.silenceNotifications=p,e.content&&b&&this.contentDidChange({inputType:e.type}),e.selection&&w&&this.selectionDidChange(),b||w}normalizeOffset(e){return e>0?e=Math.min(e,this.lastOffset):e<0&&(e=this.lastOffset+e+1),e}normalizeRange(e){let[i,r]=e;return i=this.normalizeOffset(i),r=this.normalizeOffset(r),i<r?[i,r]:[r,i]}normalizeSelection(e,i){var r;let a;if(pa(e)){const u=this.normalizeOffset(e);if(pa(i)){const p=this.normalizeOffset(i);a=u<=p?{ranges:[[u,p]],direction:"none"}:{ranges:[[p,u]],direction:"backward"}}else a={ranges:[[u,u]],direction:"none"}}else if(jo(e)){const u=this.normalizeOffset(e[0]),p=this.normalizeOffset(e[1]);a=u<=p?{ranges:[[u,p]],direction:"none"}:{ranges:[[p,u]],direction:"backward"}}else ku(e)&&(a={ranges:e.ranges.map(u=>this.normalizeRange(u)),direction:(r=e.direction)!=null?r:"none"});return console.assert(a!==void 0),a}get parentEnvironment(){let e=this.at(this.position).parent;if(e){for(;e.parent&&e.type!=="array";)e=e.parent;if(e.type==="array")return e}}get cell(){var e;let i=this.at(this.position);if(i){for(;i&&((e=i.parent)==null?void 0:e.type)!=="array";)i=i.parent;if(!(!(i!=null&&i.parent)||i.parent.type!=="array"))return i.parentBranch}}contentWillChange(e={}){if(this.silenceNotifications||!this.mathfield)return!0;const i=this.silenceNotifications;this.silenceNotifications=!0;const r=this.mathfield.onContentWillChange(e);return this.silenceNotifications=i,r}contentDidChange(e){var i;if(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this.mathfield)),this.silenceNotifications||!this.mathfield.host||!this.mathfield)return;const r=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.host.dispatchEvent(new InputEvent("input",f(P({},e),{data:e.data?e.data:(i=e.inputType)!=null?i:"",bubbles:!0,composed:!0}))),this.silenceNotifications=r}selectionDidChange(){if(!this.mathfield||(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this.mathfield)),this.silenceNotifications))return;const e=this.silenceNotifications;this.silenceNotifications=!0,this.mathfield.onSelectionDidChange(),this.silenceNotifications=e}};function Dp(e,i,r,a){const u=e.offsetOf(i);if(u<r||u>a)return!1;if(!i.hasChildren)return!0;const p=e.offsetOf(i.firstChild);if(p>=r&&p<=a){const m=e.offsetOf(i.lastChild);if(m>=r&&m<=a)return!0}return!1}function I0(e,i,r){if(!(i!=null&&i.hasChildren))return!1;const[a,u]=r,p=e.offsetOf(i.firstChild),m=e.offsetOf(i.lastChild);return p>=a&&p<=u&&m>=p&&m<=u}function ch(e,i,r,a){var u,p,m,b,w,E;const I=r.parent;if(I&&r instanceof ur){const N=!a&&i==="forward"||a==="body"&&i==="backward";let J=N?e.offsetOf(r.firstChild):e.offsetOf(r.lastChild);return N?r.rightDelim!=="?"&&r.rightDelim!=="."?(r.leftDelim=".",r.isDirty=!0):(I.addChildrenAfter(r.removeBranch("body"),r),I.removeChild(r),J--):r.leftDelim!=="?"&&r.leftDelim!=="."?(r.rightDelim=".",r.isDirty=!0):(I.addChildrenAfter(r.removeBranch("body"),r),I.removeChild(r),J--),e.position=J,!0}if(I&&r.type==="surd"){if(i==="forward"&&!a||i==="backward"&&a==="body"){const N=r.leftSibling;r.hasChildren&&I.addChildrenAfter(r.removeBranch("body"),r),I.removeChild(r),e.position=e.offsetOf(N)}else i==="forward"&&a==="body"?e.position=e.offsetOf(r):!a&&i==="backward"?r.hasChildren?e.position=e.offsetOf(r.lastChild):(e.position=Math.max(0,e.offsetOf(r)-1),I.removeChild(r)):a==="above"&&(r.hasEmptyBranch("above")&&r.removeBranch("above"),i==="backward"?e.position=e.offsetOf(r.leftSibling):e.position=e.offsetOf(r.body[0]));return!0}if(I&&(r.type==="box"||r.type==="enclose")){const N=a&&i==="backward"||!a&&i==="forward"?r.leftSibling:r.lastChild;return I.addChildrenAfter(r.removeBranch("body"),r),I.removeChild(r),e.position=e.offsetOf(N),!0}if(r.type==="genfrac"||r.type==="overunder"){if(!a)return r.type==="overunder"&&r.hasEmptyBranch("body")||r.type==="genfrac"&&r.hasEmptyBranch("below")&&r.hasEmptyBranch("above")?!1:(e.position=e.offsetOf(i==="forward"?r.firstChild:r.lastChild),!0);const N=hh.fractionNavigationOrder==="numerator-denominator"?"above":"below",J=N==="above"?"below":"above";if(I&&(i==="forward"&&a===N||i==="backward"&&a===J)){const oe=r.removeBranch(N),ge=r.removeBranch(J);return I.addChildrenAfter([...oe,...ge],r),I.removeChild(r),e.position=e.offsetOf(oe.length>0?oe[oe.length-1]:ge[0]),!0}return i==="backward"?e.position=e.offsetOf(r.leftSibling):e.position=e.offsetOf(r),!0}if(r.isExtensibleSymbol||r.type==="subsup"){if(!a&&i==="forward")return!1;if(!a){if(r.subscript||r.superscript){const N=i==="forward"?(m=(u=r.superscript)==null?void 0:u[0])!=null?m:(p=r.subscript)==null?void 0:p[0]:(E=(b=r.subscript)==null?void 0:b[0].lastSibling)!=null?E:(w=r.superscript)==null?void 0:w[0].lastSibling;return N&&(e.position=e.offsetOf(N)),!0}return!1}if(!r.hasChildren&&r.type==="subsup"){const N=i==="forward"?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);return r.parent.removeChild(r),e.position=N,!0}if(a==="superscript")if(i==="backward"){const N=e.offsetOf(r.firstChild)-1;console.assert(N>=0),e.position=N}else r.subscript?e.position=e.offsetOf(r.subscript[0]):e.position=e.offsetOf(r);else a==="subscript"&&(i==="backward"&&r.superscript?e.position=e.offsetOf(r.superscript[0].lastSibling):i==="backward"?e.position=e.offsetOf(r.firstChild)-1:e.position=e.offsetOf(r));if(a&&r.hasEmptyBranch(a)&&(r.removeBranch(a),r.type==="subsup"&&!r.subscript&&!r.superscript)){const N=i==="forward"?e.offsetOf(r):Math.max(0,e.offsetOf(r)-1);r.parent.removeChild(r),e.position=N}return!0}if((I==null?void 0:I.type)==="genfrac"&&!a&&r.type!=="first"){let N=e.offsetOf(r.leftSibling);return I.removeChild(r),I.hasEmptyBranch("above")&&I.hasEmptyBranch("below")?(N=e.offsetOf(I.leftSibling),I.parent.removeChild(I),e.announce("delete",void 0,[I]),e.position=N,!0):(e.announce("delete",void 0,[r]),e.position=N,!0)}if(i==="backward"&&((I==null?void 0:I.command)==="\\ln"||(I==null?void 0:I.command)==="\\log")&&r.parentBranch!=="body"){const N=e.offsetOf(I.leftSibling);return I.parent.removeChild(I),e.announce("delete",void 0,[I]),e.position=N,!0}return!1}function _1(e){return!e.mathfield.isSelectionEditable||!e.contentWillChange({inputType:"deleteContentBackward"})?!1:e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentBackward"},()=>{let i=e.at(e.position);if(!(i&&ch(e,"backward",i))){if(i!=null&&i.isFirstSibling){if(ch(e,"backward",i.parent,i.parentBranch))return;i=null}if(!i){e.announce("plonk");return}e.position=e.offsetOf(i.leftSibling),i.parent.removeChild(i),e.announce("delete",void 0,[i])}}):za(e,Kr(e.selection),"deleteContentBackward")}function v1(e){return!e.mathfield.isSelectionEditable||!e.contentWillChange({inputType:"deleteContentForward"})?!1:e.selectionIsCollapsed?e.deferNotifications({content:!0,selection:!0,type:"deleteContentForward"},()=>{var i,r;let a=e.at(e.position).rightSibling;if(a&&ch(e,"forward",a))return;if(a){if(e.at(e.position).isLastSibling&&ch(e,"forward",a.parent,a.parentBranch))return}else{if(a=e.at(e.position),a.isLastSibling&&ch(e,"forward",a.parent,a.parentBranch))return;a=void 0}if(e.position===e.lastOffset||!a){e.announce("plonk");return}a.parent.removeChild(a);let u=(i=e.at(e.position))==null?void 0:i.rightSibling;for(;(u==null?void 0:u.type)==="subsup";)u.parent.removeChild(u),u=(r=e.at(e.position))==null?void 0:r.rightSibling;e.announce("delete",void 0,[a])}):za(e,Kr(e.selection),"deleteContentForward")}function za(e,i,r){const a=e.getAtoms(i);if(a.length>0&&a[0].parent){let u=a[0].parent.firstChild;u.type==="first"&&(u=u.rightSibling);const p=a[a.length-1].parent.lastChild;let m=a[0];m.type==="first"&&(m=m.rightSibling);const b=a[a.length-1];if(m===u&&b===p){const w=a[0].parent;w.parent&&w.type!=="prompt"&&(i=[e.offsetOf(w.leftSibling),e.offsetOf(w)])}if(a.length===1&&a[0].type==="placeholder"&&a[0].parent.type==="genfrac"){const w=a[0].parent,E=a[0].parentBranch==="below"?"above":"below",I=e.offsetOf(w.leftSibling);return e.deferNotifications({content:!0,selection:!0,type:r},()=>{var N,J;const oe=w.removeBranch(E);if(oe.length===1&&oe[0].type==="placeholder")(J=w.parent)==null||J.removeChild(w),e.position=Math.max(0,I);else{const ge=w.parent.addChildrenAfter(oe,w);(N=w.parent)==null||N.removeChild(w),e.position=e.offsetOf(ge)}})}}return e.deferNotifications({content:!0,selection:!0,type:r},()=>e.deleteAtoms(i))}Jr({deleteAll:e=>e.contentWillChange({inputType:"deleteContent"})&&za(e,[0,-1],"deleteContent"),deleteForward:e=>v1(e),deleteBackward:e=>_1(e),deleteNextWord:e=>e.contentWillChange({inputType:"deleteWordForward"})&&za(e,[e.anchor,o0(e,e.position,"forward")],"deleteWordForward"),deletePreviousWord:e=>e.contentWillChange({inputType:"deleteWordBackward"})&&za(e,[e.anchor,o0(e,e.position,"backward")],"deleteWordBackward"),deleteToGroupStart:e=>e.contentWillChange({inputType:"deleteSoftLineBackward"})&&za(e,[e.anchor,e.offsetOf(e.at(e.position).firstSibling)],"deleteSoftLineBackward"),deleteToGroupEnd:e=>e.contentWillChange({inputType:"deleteSoftLineForward"})&&za(e,[e.anchor,e.offsetOf(e.at(e.position).lastSibling)],"deleteSoftLineForward"),deleteToMathFieldStart:e=>e.contentWillChange({inputType:"deleteHardLineBackward"})&&za(e,[e.anchor,0],"deleteHardLineBackward"),deleteToMathFieldEnd:e=>e.contentWillChange({inputType:"deleteHardLineForward"})&&za(e,[e.anchor,-1],"deleteHardLineForward")},{target:"model",audioFeedback:"delete",canUndo:!0,changeContent:!0,changeSelection:!0});var y1=`<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox="0 0 576 512" role="img" aria-label="${V("tooltip.toggle virtual keyboard")}"><path d="M528 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h480c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.823-7.177 16-16 16H48c-8.823 0-16-7.177-16-16V112c0-8.823 7.177-16 16-16h480c8.823 0 16 7.177 16 16v288zM168 268v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-336 80v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm384 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zM120 188v-24c0-6.627-5.373-12-12-12H84c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm96 0v-24c0-6.627-5.373-12-12-12h-24c-6.627 0-12 5.373-12 12v24c0 6.627 5.373 12 12 12h24c6.627 0 12-5.373 12-12zm-96 152v-8c0-6.627-5.373-12-12-12H180c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h216c6.627 0 12-5.373 12-12z"/></svg>`,b1=`<svg xmlns="http://www.w3.org/2000/svg" style="height: 18px;" viewBox="0 0 448 512" role="img" aria-label="${V("tooltip.menu")}"><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg>`,x1=class{constructor(e,i){this.focusBlurInProgress=!1;var r,a,u;this.options=P(f(P({},Nf()),{macros:Wt(),registers:da()}),Bf(i)),this.eventController=new AbortController;const p=this.eventController.signal;i.eventSink&&(this.host=i.eventSink),this.element=e,e.mathfield=this,this.blurred=!0,this.keystrokeCaptionVisible=!1,this.suggestionIndex=0,this.inlineShortcutBuffer=[],this.inlineShortcutBufferFlushTimer=0,this.defaultStyle={},this.adoptStyle="left",this.options.defaultMode==="inline-math"?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline"),this.dirty=!1;let m=(a=(r=i.value)!=null?r:this.element.textContent)!=null?a:"";m=m.trim();const b=V0(this.options),w=new ut({type:"root",mode:b,body:Ur(m,{context:this.context})});this.model=new g1(this,b,w),this.undoManager=new Wm(this.model);const E=[];if(E.push("<span contenteditable=true aria-multiline=false part=keyboard-sink class=ML__keyboard-sink autocapitalize=off autocomplete=off autocorrect=off spellcheck=false inputmode=none tabindex=0></span>"),E.push('<span part=container class=ML__container aria-hidden=true style="visibility:hidden">'),E.push("<span part=content class=ML__content>"),E.push(As(this)),E.push("</span>"),window.mathVirtualKeyboard&&(E.push(`<div part=virtual-keyboard-toggle class=ML__virtual-keyboard-toggle role=button ${this.hasEditableContent?"":'style="display:none;"'} data-l10n-tooltip="tooltip.toggle virtual keyboard">`),E.push(y1),E.push("</div>")),E.push('<div part=menu-toggle class=ML__menu-toggle role=button data-l10n-tooltip="tooltip.menu">'),E.push(b1),E.push("</div>"),E.push("</span>"),E.push("<span class=ML__sr-only>"),E.push("<span role=status aria-live=assertive aria-atomic=true></span>"),E.push("</span>"),this.element.innerHTML=window.MathfieldElement.createHTML(E.join("")),!this.element.children){console.error("%cMathLive 0.98.5: Something went wrong and the mathfield could not be created.%c\nIf you are using Vue, this may be because you are using the runtime-only build of Vue. Make sure to include `runtimeCompiler: true` in your Vue configuration. There may a warning from Vue in the log above.","color:red;font-family:system-ui;font-size:1.2rem;font-weight:bold","color:inherit;font-family:system-ui;font-size:inherit;font-weight:inherit");return}this._l10Subscription=$.subscribe(()=>$.update(this.element)),$.update(this.element),this.field=this.element.querySelector("[part=content]"),this.field.addEventListener("click",N=>N.stopImmediatePropagation(),{capture:!1,signal:p}),this.field.addEventListener("wheel",this,{passive:!1,signal:p}),"PointerEvent"in window?this.field.addEventListener("pointerdown",this,{signal:p}):this.field.addEventListener("mousedown",this,{signal:p}),(u=this.element.querySelector("[part=virtual-keyboard-toggle]"))==null||u.addEventListener("click",()=>{window.mathVirtualKeyboard.visible?window.mathVirtualKeyboard.hide():(window.mathVirtualKeyboard.show({animate:!0}),window.mathVirtualKeyboard.update(Ka(this)))},{signal:p}),this._menu=new Mg(o1(this),{host:this.host}),this.field.addEventListener("contextmenu",this,{signal:p});const I=this.element.querySelector("[part=menu-toggle]");I==null||I.addEventListener("pointerdown",N=>{if(N.currentTarget!==I||this._menu.state!=="closed")return;this.element.classList.add("tracking");const J=I.getBoundingClientRect();this._menu.modifiers=_(N),this._menu.show({target:I,location:{x:J.left,y:J.bottom},onDismiss:()=>this.element.classList.remove("tracking")}),N.preventDefault(),N.stopPropagation()},{signal:p}),(this.model.atoms.length<=1||this.disabled||this.readOnly&&!this.hasEditableContent||this.userSelect==="none")&&(I.style.display="none"),this.ariaLiveText=this.element.querySelector("[role=status]"),this.keyboardDelegate=M(this.element.querySelector(".ML__keyboard-sink"),this.element,this),window.addEventListener("resize",this,{signal:p}),document.addEventListener("scroll",this,{signal:p}),this.resizeObserver=new ResizeObserver(()=>Ii(this)),this.resizeObserver.observe(this.field),window.mathVirtualKeyboard.addEventListener("virtual-keyboard-toggle",this,{signal:p}),vo&&!$.locale.startsWith(vo.locale)&&s($.locale),Ts!=="ready"&&document.fonts.ready.then(()=>_s(this)),e.querySelector("[part=container]").style.removeProperty("visibility"),this.undoManager.startRecording(),this.undoManager.snapshot("set-value")}get defaultStyle(){return this._defaultStyle}set defaultStyle(e){this._defaultStyle=e}get effectiveStyle(){if(this.adoptStyle==="none")return this.defaultStyle;const e=this.model.at(this.model.position),i=this.adoptStyle==="right"?e.rightSibling:e;if(!i)return this.defaultStyle;if(i.type==="group"){const r=i.branch("body");return!r||r.length<2?{}:this.adoptStyle==="right"?r[1].computedStyle:r[r.length-1].computedStyle}return i.computedStyle}connectToVirtualKeyboard(){this.connectedToVirtualKeyboard||(this.connectedToVirtualKeyboard=!0,window.addEventListener("message",this,{signal:this.eventController.signal}),window.mathVirtualKeyboard.connect(),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),Yf(this))}disconnectFromVirtualKeyboard(){this.connectedToVirtualKeyboard&&(window.removeEventListener("message",this),window.mathVirtualKeyboard.disconnect(),this.connectedToVirtualKeyboard=!1,v0())}showMenu(e){var i,r;const a=(r=(i=e==null?void 0:e.location)!=null?i:Ml(this.field))!=null?r:void 0,u=e==null?void 0:e.modifiers,p=this.element.querySelector("[part=container]");return this._menu.show({target:p,location:a,modifiers:u})}get colorMap(){return e=>{var i,r,a;return(a=(r=(i=this.options).colorMap)==null?void 0:r.call(i,e))!=null?a:Ke(e)}}get backgroundColorMap(){return e=>{var i,r,a,u,p,m;return(m=(p=(r=(i=this.options).backgroundColorMap)==null?void 0:r.call(i,e))!=null?p:(u=(a=this.options).colorMap)==null?void 0:u.call(a,e))!=null?m:Rt(e)}}get smartFence(){var e;return(e=this.options.smartFence)!=null?e:!1}get readOnly(){var e;return(e=this.options.readOnly)!=null?e:!1}get disabled(){var e,i;return(i=(e=this.host)==null?void 0:e.disabled)!=null?i:!1}get contentEditable(){return this.host?this.host.getAttribute("contenteditable")!=="false":!1}get userSelect(){if(!this.host)return"";const e=getComputedStyle(this.host);return e.getPropertyValue("user-select")||e.getPropertyValue("-webkit-user-select")}get hasEditableContent(){return this.disabled||!this.contentEditable?!1:!this.readOnly||this.hasEditablePrompts}get hasEditablePrompts(){return this.readOnly&&!this.disabled&&this.contentEditable&&this.model.findAtom(e=>e.type==="prompt"&&!e.locked)!==void 0}get isSelectionEditable(){if(this.disabled||!this.contentEditable)return!1;if(!this.readOnly)return!0;const e=this.model.at(this.model.anchor),i=this.model.at(this.model.position),r=ut.commonAncestor(e,i);return!!((r==null?void 0:r.type)==="prompt"||r!=null&&r.parentPrompt)}get letterShapeStyle(){var e;return(e=this.options.letterShapeStyle)!=null?e:"tex"}get minFontScale(){return this.options.minFontScale}get selectionStyle(){if(this.model.selectionIsCollapsed)return this.effectiveStyle;const e=this.model.getAtoms(this.model.selection);if(e.length===0)return{};const i=P({},e[0].style);for(const r of e)for(const[a,u]of Object.entries(r.style))i[a]!==u&&delete i[a];return i}queryStyle(e){const i=d0(this,e);"verbatimColor"in i&&delete i.verbatimColor,"verbatimBackgroundColor"in i&&delete i.verbatimBackgroundColor;const r=Object.keys(i).length;if(r===0)return"all";if(r>1){for(const w of Object.keys(i)){const E=this.queryStyle({[w]:i[w]});if(E==="none")return"none";if(E==="some")return"some"}return"all"}const a=Object.keys(i)[0],u=i[a];if(this.model.selectionIsCollapsed)return this.effectiveStyle[a]===u?"all":"none";const p=this.model.getAtoms(this.model.selection,{includeChildren:!0});let m=p.length;if(m===0)return"none";let b=0;for(const w of p){if(w.type==="first"){m-=1;continue}w.style[a]===u&&(b+=1)}return b===0?"none":b===m?"all":"some"}get keybindings(){var e,i;if(this._keybindings)return this._keybindings;const[r,a]=$e(this.options.keybindings,(e=o())!=null?e:l());return((i=o())==null?void 0:i.score)>0&&(this._keybindings=r,a.length>0&&console.error("MathLive 0.98.5: Invalid keybindings for current keyboard layout",a)),r}get menu(){return this._menu}setOptions(e){var i;this.options=P(P({},this.options),Bf(e)),this._keybindings=void 0,this.options.defaultMode==="inline-math"?this.element.classList.add("ML__is-inline"):this.element.classList.remove("ML__is-inline");let r=this.options.defaultMode;r==="inline-math"&&(r="math"),((i=this.model.root.firstChild)==null?void 0:i.mode)!==r&&(this.model.root.firstChild.mode=r),this.options.readOnly&&this.hasFocus()&&window.mathVirtualKeyboard.visible&&this.executeCommand("hideVirtualKeyboard");const a=ut.serialize([this.model.root],{expandMacro:!1,defaultMode:this.options.defaultMode});("macros"in e||this.model.getValue()!==a)&&jn.insert(this.model,a,{insertionMode:"replaceAll",selectionMode:"after",format:"latex",silenceNotifications:!0,mode:"math"}),("value"in e||"macros"in e||"registers"in e||"colorMap"in e||"backgroundColorMap"in e||"letterShapeStyle"in e||"minFontScale"in e||"readOnly"in e||"placeholderSymbol"in e)&&Ii(this)}getOptions(e){return zl(this.options,e)}getOption(e){return zl(this.options,e)}handleEvent(e){return cl(this,null,function*(){var i;if(co(this)){if(n0(e)){if(!Ic(e.origin,(i=this.options.originValidator)!=null?i:"none"))throw new DOMException(`Message from unknown origin (${e.origin}) cannot be handled`,"SecurityError");const{action:r}=e.data;if(r==="execute-command"){const a=e.data.command;if(ra(a)==="virtual-keyboard")return;this.executeCommand(a)}else r==="update-state"||(r==="focus"?this.focus({preventScroll:!0}):r==="blur"&&this.blur());return}switch(e.type){case"focus":this.onFocus();break;case"blur":this.onBlur();break;case"mousedown":this.userSelect!=="none"&&rp(this,e);break;case"pointerdown":this.userSelect!=="none"&&(rp(this,e),e.shiftKey===!1&&(yield vp(e,this.element.querySelector("[part=container]"),this._menu))&&Wf.stop());break;case"contextmenu":this.userSelect!=="none"&&e.shiftKey===!1&&(yield vp(e,this.element.querySelector("[part=container]"),this._menu))&&Wf.stop();break;case"virtual-keyboard-toggle":this.hasFocus()&&Yf(this);break;case"resize":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>co(this)&&this.onGeometryChange());break;case"scroll":this.geometryChangeTimer&&cancelAnimationFrame(this.geometryChangeTimer),this.geometryChangeTimer=requestAnimationFrame(()=>co(this)&&this.onGeometryChange());break;case"wheel":this.onWheel(e);break;default:console.warn("Unexpected event type",e.type)}}})}dispose(){if(!co(this))return;$.unsubscribe(this._l10Subscription),this.keyboardDelegate.dispose(),this.keyboardDelegate=void 0,this.eventController.abort(),this.eventController=void 0,this.resizeObserver.disconnect(),window.mathVirtualKeyboard.removeEventListener("virtual-keyboard-toggle",this),this.disconnectFromVirtualKeyboard(),this.model.dispose();const e=this.element;delete e.mathfield,this.element=void 0,this.host=void 0,this.field=void 0,this.ariaLiveText=void 0,ng(),Fn(),Eg()}flushInlineShortcutBuffer(e){if(e!=null||(e={defer:!1}),!e.defer){this.inlineShortcutBuffer=[],clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=0;return}this.options.inlineShortcutTimeout>0&&(clearTimeout(this.inlineShortcutBufferFlushTimer),this.inlineShortcutBufferFlushTimer=setTimeout(()=>this.flushInlineShortcutBuffer(),this.options.inlineShortcutTimeout))}executeCommand(e){return ra(e)==="virtual-keyboard"?(this.focus({preventScroll:!0}),window.mathVirtualKeyboard.executeCommand(e),requestAnimationFrame(()=>window.mathVirtualKeyboard.update(Ka(this))),!1):Mf(this,e)}get errors(){return bf(this.model.getValue(),{context:this.context})}getValue(e,i,r){return this.model.getValue(e,i,r)}setValue(e,i){var r;i=i!=null?i:{mode:"math"},i.insertionMode===void 0&&(i.insertionMode="replaceAll"),(i.format===void 0||i.format==="auto")&&(i.format="latex"),(i.mode===void 0||i.mode==="auto")&&(i.mode=(r=pd(this.model,this.model.position))!=null?r:"math");const a=this.undoManager.canUndo();jn.insert(this.model,e,i)&&(Ii(this),a||this.undoManager.reset(),this.undoManager.snapshot("set-value"))}get expression(){const e=window.MathfieldElement.computeEngine;return e?e.box(e.parse(this.model.getValue("latex-unstyled"))):(console.error("MathLive 0.98.5: no compute engine available. Make sure the Compute Engine library is loaded."),null)}scrollIntoView(){var e;if(!this.element)return;if(this.host){if(this.options.onScrollIntoView)this.options.onScrollIntoView(this);else if(this.host.scrollIntoView({block:"nearest",inline:"nearest"}),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.container===window.document.body){const a=window.mathVirtualKeyboard.boundingRect,u=this.host.getBoundingClientRect();u.bottom>a.top&&((e=window.document.scrollingElement)==null||e.scrollBy(0,u.bottom-a.top+8))}}this.dirty&&Ls(this,{interactive:!0});const i=this.field.getBoundingClientRect();let r=null;if(this.model.selectionIsCollapsed)r=Ml(this.field);else{const a=Mc(this);if(a.length>0){let u=-1/0,p=-1/0;for(const m of a)m.right>u&&(u=m.right),m.top<p&&(p=m.top);r={x:u+i.left-this.field.scrollLeft,y:p+i.top-this.field.scrollTop,height:0}}}if(this.host&&r){const a=this.host.getBoundingClientRect(),u=r.y;let p=this.host.scrollTop;u<a.top?p=u-a.top+this.host.scrollTop:u>a.bottom&&(p=u-a.bottom+this.host.scrollTop+r.height),this.host.scroll({top:p,left:0})}if(r){const a=r.x-window.scrollX;let u=this.field.scrollLeft;a<i.left?u=a-i.left+this.field.scrollLeft-20:a>i.right&&(u=a-i.right+this.field.scrollLeft+20),this.field.scroll({top:this.field.scrollTop,left:u})}}insert(e,i){return typeof e!="string"||e.length===0&&((i==null?void 0:i.insertionMode)==="insertBefore"||(i==null?void 0:i.insertionMode)==="insertAfter")||e.length===0&&this.model.selectionIsCollapsed?!1:(this.flushInlineShortcutBuffer(),i=i!=null?i:{mode:"math"},i.focus&&this.focus(),i.feedback&&(window.MathfieldElement.keypressVibration&&Q()&&navigator.vibrate(Ba),window.MathfieldElement.playSound("keypress")),e==="\\\\"?G0(this.model):e==="&"?H0(this.model):this.model.selectionIsCollapsed?jn.insert(this.model,e,P({style:this.model.at(this.model.position).computedStyle},i)):jn.insert(this.model,e,i),this.snapshot(`insert-${this.model.at(this.model.position).type}`),Ii(this),i.scrollIntoView&&this.scrollIntoView(),!0)}switchMode(e,i="",r=""){var a;if(this.model.mode===e||!this.hasEditableContent||!this.contentEditable||this.disabled)return;const u=this.model.mode;if(this.model.mode=e,!((a=this.host)!=null&&a.dispatchEvent(new Event("mode-change",{bubbles:!0,composed:!0,cancelable:!0})))){this.model.mode=u;return}const p=this.model.mode,{model:m}=this;m.deferNotifications({content:!!r||!!i,selection:!0,type:"insertText"},()=>{let b=!1;if(this.flushInlineShortcutBuffer(),this.stopCoalescingUndo(),i&&e!=="latex"){const w=Ur(i,{context:this.context,parseMode:e});m.collapseSelection("forward");const E=m.at(m.position);m.position=m.offsetOf(E.parent.addChildrenAfter(w,E)),b=!0}if(this.model.mode=e,e==="latex"){let w=m.selectionIsCollapsed;ci(this,"accept");let E,I=m.at(m.position);if(w)E="\\";else{const J=Kr(m.selection);E=this.model.getValue(J,"latex");const oe=this.model.extractAtoms(J);oe.length===1&&oe[0].type==="placeholder"&&(E=i,w=!0),I=m.at(J[0])}const N=new Qo(E);I.parent.addChildAfter(N,I),w?m.position=m.offsetOf(N.lastChild):m.setSelection(m.offsetOf(N.firstChild),m.offsetOf(N.lastChild))}else Be(m).forEach(w=>{w.isError=!1});if(r){const w=Ur(r,{context:this.context,parseMode:p});m.collapseSelection("forward");const E=m.at(m.position);m.position=m.offsetOf(E.parent.addChildrenAfter(w,E)),b=!0}return Ii(this),this.undoManager.snapshot(e==="latex"?"insert-latex":"insert"),b}),this.model.mode=e,window.mathVirtualKeyboard.update(Ka(this))}hasFocus(){return!this.blurred}focus(e){var i;this.hasFocus()||(this.keyboardDelegate.focus(),this.connectToVirtualKeyboard(),this.onFocus(),this.model.announce("line")),(i=e==null?void 0:e.preventScroll)!=null&&i||this.scrollIntoView()}blur(){this.disconnectFromVirtualKeyboard(),this.hasFocus()&&this.keyboardDelegate.blur()}select(){this.model.selection={ranges:[[0,this.model.lastOffset]]},this.focus()}applyStyle(e,i={}){var r,a;const u={operation:"set",silenceNotifications:!1};jo(i)?u.range=i:(i.operation==="toggle"&&(u.operation="toggle"),u.range=i.range,u.silenceNotifications=(r=i.silenceNotifications)!=null?r:!1);const p=d0(this,e),m=(a=u.operation)!=null?a:"set";if(u.range===void 0&&this.model.selectionIsCollapsed){if(m==="set"){this.defaultStyle=P(P({},this.defaultStyle),p);return}const b=P({},this.defaultStyle);for(const w of Object.keys(p))b[w]===p[w]?(w==="color"&&delete b.verbatimColor,w==="backgroundColor"&&delete b.verbatimBackgroundColor,delete b[w]):b[w]=p[w];this.defaultStyle=b;return}this.model.deferNotifications({content:!u.silenceNotifications,type:"insertText"},()=>{if(u.range===void 0)for(const b of this.model.selection.ranges)s0(this.model,b,p,{operation:m});else s0(this.model,u.range,p,{operation:m})}),Ii(this)}toggleContextMenu(){var e;return this._menu.visible?this._menu.state==="open"?(this._menu.hide(),!0):(this._menu.show({target:this.element.querySelector("[part=container]"),location:(e=this.getCaretPoint())!=null?e:void 0,onDismiss:()=>{var i;return(i=this.element)==null?void 0:i.focus()}}),!0):!1}getCaretPoint(){const e=Ml(this.field);return e?{x:e.x,y:e.y}:null}setCaretPoint(e,i){const r=sh(this,e,i,{bias:0});if(r<0)return!1;const a=this.model.position;return this.model.position=r,this.model.announce("move",a),Ii(this),!0}getPrompt(e){const i=this.model.findAtom(r=>r.type==="prompt"&&r.placeholderId===e);return console.assert(i!==void 0,"MathLive 0.98.5: no prompts with matching ID found"),i}getPromptValue(e,i){const r=this.getPrompt(e);if(!r)return"";const a=this.model.offsetOf(r.firstChild),u=this.model.offsetOf(r.lastChild);return this.model.getValue(a,u,i)}getPrompts(e){return this.model.getAllAtoms().filter(i=>i.type!=="prompt"?!1:e?!(e.id&&i.placeholderId!==e.id||e.locked&&i.locked!==e.locked||e.correctness==="undefined"&&i.correctness||e.correctness&&i.correctness!==e.correctness):!0).map(i=>i.placeholderId)}setPromptValue(e,i,r){if(i!==void 0){const a=this.getPrompt(e);if(!a){console.error(`MathLive 0.98.5: unknown prompt ${e}`);return}const u=this.model.getBranchRange(this.model.offsetOf(a),"body");this.model.setSelection(u),this.insert(i,f(P({},r),{insertionMode:"replaceSelection"}))}r!=null&&r.silenceNotifications&&(this.valueOnFocus=this.getValue()),Ii(this)}setPromptState(e,i,r){const a=this.getPrompt(e);if(!a){console.error(`MathLive 0.98.5: unknown prompt ${e}`);return}i==="undefined"?a.correctness=void 0:typeof i=="string"&&(a.correctness=i),typeof r=="boolean"&&(a.locked=r,a.captureSelection=r),Ii(this)}getPromptState(e){const i=this.getPrompt(e);return i?[i.correctness,i.locked]:(console.error(`MathLive 0.98.5: unknown prompt ${e}`),[void 0,!0])}getPromptRange(e){const i=this.getPrompt(e);return i?this.model.getBranchRange(this.model.offsetOf(i),"body"):(console.error(`MathLive 0.98.5: unknown prompt ${e}`),[0,0])}canUndo(){return this.undoManager.canUndo()}canRedo(){return this.undoManager.canRedo()}popUndoStack(){this.undoManager.pop()}snapshot(e){var i;this.undoManager.snapshot(e)&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),(i=this.host)==null||i.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"snapshot"}})))}stopCoalescingUndo(){this.undoManager.stopCoalescing(this.model.selection)}stopRecording(){this.undoManager.stopRecording()}startRecording(){this.undoManager.startRecording()}undo(){var e;this.undoManager.undo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),(e=this.host)==null||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}redo(){var e;this.undoManager.redo()&&(window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),(e=this.host)==null||e.dispatchEvent(new CustomEvent("undo-state-change",{bubbles:!0,composed:!0,detail:{type:"undo"}})))}resetUndo(){var e;(e=this.undoManager)==null||e.reset()}onSelectionDidChange(){var e,i;const r=this.model;this.keyboardDelegate.setValue(r.getValue(this.model.selection,"latex-expanded"));{const a=r.at(r.position),u=(e=a.mode)!=null?e:V0(this.options);this.model.mode!==u&&(this.model.mode==="latex"?(ci(this,"accept",{mode:u}),r.position=r.offsetOf(a)):this.switchMode(u))}(i=this.host)==null||i.dispatchEvent(new Event("selection-change",{bubbles:!0,composed:!0})),window.mathVirtualKeyboard.visible&&window.mathVirtualKeyboard.update(Ka(this)),Yf(this)}onContentWillChange(e){var i,r,a;return(a=(r=this.host)==null?void 0:r.dispatchEvent(new InputEvent("beforeinput",f(P({},e),{data:e.data?e.data:(i=e.inputType)!=null?i:"",cancelable:!0,bubbles:!0,composed:!0}))))!=null?a:!0}onFocus(){this.focusBlurInProgress||!this.blurred||(this.focusBlurInProgress=!0,this.blurred=!1,this.keyboardDelegate.focus(),this.stopCoalescingUndo(),Ls(this,{interactive:!0}),this.valueOnFocus=this.model.getValue(),this.hasEditablePrompts&&!this.model.at(this.model.anchor).parentPrompt&&this.executeCommand("moveToNextPlaceholder"),this.focusBlurInProgress=!1)}onBlur(){var e,i,r;if(this.focusBlurInProgress||this.blurred)return;this.focusBlurInProgress=!0,this.stopCoalescingUndo(),this.blurred=!0,this.ariaLiveText.textContent="",Yt(this),this.model.getValue()!==this.valueOnFocus&&((e=this.host)==null||e.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))),this.disconnectFromVirtualKeyboard(),(i=this.host)==null||i.dispatchEvent(new Event("blur",{bubbles:!1,composed:!0})),(r=this.host)==null||r.dispatchEvent(new UIEvent("focusout",{bubbles:!0,composed:!0})),Ii(this),this.focusBlurInProgress=!1,v0();const a=new AbortController,u=a.signal;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&document.addEventListener("visibilitychange",()=>{co(this)&&document.visibilityState==="visible"&&this.focus({preventScroll:!0})},{once:!0,signal:u})},{once:!0,signal:u}),setTimeout(()=>a.abort(),100)}onInput(e){c0(this,e)}onKeystroke(e){return tp(this,e)}onCompositionStart(e){this.model.deleteAtoms(Kr(this.model.selection));const i=Ml(this.field);i&&requestAnimationFrame(()=>{Ls(this),this.keyboardDelegate.moveTo(i.x,i.y-i.height)})}onCompositionUpdate(e){Bm(this.model,e),Ii(this)}onCompositionEnd(e){Nm(this.model),c0(this,e,{simulateKeystroke:!0})}onCut(e){if(!this.isSelectionEditable){this.model.announce("plonk");return}this.model.contentWillChange({inputType:"deleteByCut"})&&(this.stopCoalescingUndo(),jn.onCopy(this,e),za(this.model,Kr(this.model.selection),"deleteByCut"),this.snapshot("cut"),Ii(this))}onCopy(e){jn.onCopy(this,e)}onPaste(e){let i=this.isSelectionEditable;return i&&(i=jn.onPaste(this.model.at(this.model.position).mode,this,e.clipboardData)),i||this.model.announce("plonk"),e.preventDefault(),e.stopPropagation(),i}onGeometryChange(){this._menu.hide(),Qt(this),Yf(this)}onWheel(e){const i=5*e.deltaX;if(!Number.isFinite(i)||i===0)return;const r=this.field;i<0&&r.scrollLeft===0||i>0&&r.offsetWidth+r.scrollLeft>=r.scrollWidth||(r.scrollBy({top:0,left:i}),e.preventDefault(),e.stopPropagation())}getHTMLElement(e){let i=e;for(;!i.id&&i.hasChildren;)i=e.children[0];return this.field.querySelector(`[data-atom-id="${i.id}"]`)}get context(){var e,i;return{registers:(e=this.options.registers)!=null?e:{},smartFence:this.smartFence,letterShapeStyle:this.letterShapeStyle,minFontScale:this.minFontScale,placeholderSymbol:(i=this.options.placeholderSymbol)!=null?i:"\u25A2",colorMap:r=>this.colorMap(r),backgroundColorMap:r=>this.backgroundColorMap(r),getMacro:r=>rt(r,this.options.macros),atomIdsSettings:{seed:"random",groupNumbers:!1}}}};function Cp(e){if(e&&(e.classList.remove("ML__highlight"),e.children))for(const i of e.children)Cp(i)}function R0(e,i){var r;e&&(!i||((r=e.dataset)==null?void 0:r.atomId)===i?(e.classList.add("ML__highlight"),e.children&&e.children.length>0&&[...e.children].forEach(a=>{a instanceof HTMLElement&&R0(a)})):(e.classList.remove("ML__highlight"),e.children&&e.children.length>0&&[...e.children].forEach(a=>{a instanceof HTMLElement&&R0(a,i)})))}function w1(e,i){var r;if(!C())return;if(window.MathfieldElement.speechEngine!=="amazon"){console.error("MathLive 0.98.5: Use Amazon TTS Engine for synchronized highlighting"),typeof window.MathfieldElement.speakHook=="function"&&window.MathfieldElement.speakHook(i);return}if(!window.AWS){console.error("MathLive 0.98.5: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");return}const a=new window.AWS.Polly({apiVersion:"2016-06-10"}),u={OutputFormat:"json",VoiceId:(r=window.MathfieldElement.speechEngineVoice)!=null?r:"Joanna",Engine:"standard",Text:i,TextType:"ssml",SpeechMarkTypes:["ssml"]};ul().readAloudElement=e,a.synthesizeSpeech(u,(p,m)=>{if(p){console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech()\` error: ${p}`);return}if(!(m!=null&&m.AudioStream)){console.log("polly.synthesizeSpeech():",m);return}const b=new TextDecoder("utf-8").decode(new Uint8Array(m.AudioStream));ul().readAloudMarks=b.split(`
`).map(w=>w?JSON.parse(w):{}),ul().readAloudTokens=[];for(const w of ul().readAloudMarks)w.value&&ul().readAloudTokens.push(w.value);ul().readAloudCurrentMark="",u.OutputFormat="mp3",u.SpeechMarkTypes=[],a.synthesizeSpeech(u,(w,E)=>{if(w){console.trace(`MathLive 0.98.5: \`polly.synthesizeSpeech("${i}") error:${w}`);return}if(!(E!=null&&E.AudioStream))return;const I=new Uint8Array(E.AudioStream),N=new Blob([I.buffer],{type:"audio/mpeg"}),J=URL.createObjectURL(N),oe=ul();oe.readAloudAudio?oe.readAloudAudio.pause():(oe.readAloudAudio=new Audio,oe.readAloudAudio.addEventListener("ended",()=>{const ge=oe.readAloudMathfield;oe.readAloudStatus="ended",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),ge?(Ls(ge),oe.readAloudElement=null,oe.readAloudMathfield=null,oe.readAloudTokens=[],oe.readAloudMarks=[],oe.readAloudCurrentMark=""):Cp(oe.readAloudElement)}),oe.readAloudAudio.addEventListener("timeupdate",()=>{let ge="";const He=oe.readAloudAudio.currentTime*1e3+100;for(const Ft of oe.readAloudMarks)Ft.time<He&&(ge=Ft.value);oe.readAloudCurrentMark!==ge&&(oe.readAloudCurrentToken=ge,ge&&ge===oe.readAloudFinalToken?oe.readAloudAudio.pause():(oe.readAloudCurrentMark=ge,R0(oe.readAloudElement,oe.readAloudCurrentMark)))})),oe.readAloudAudio.src=J,oe.readAloudStatus="playing",document.body.dispatchEvent(new Event("read-aloud-status-change",{bubbles:!0,composed:!0})),oe.readAloudAudio.play()})})}C()||console.error('MathLive 0.98.5: this version of the MathLive library is for use in the browser. A subset of the API is available on the server side in the "mathlive-ssr" library. If using server side rendering (with React for example) you may want to do a dynamic import of the MathLive library inside a `useEffect()` call.');var yn=new WeakMap,S1=.5,ll={letterShapeStyle:"mf.letterShapeStyle = ...",horizontalSpacingScale:'Removed. Use `"thinmuskip"`, `"medmuskip"`, and `"thickmuskip"` registers ',macros:"mf.macros = ...",registers:"mf.registers = ...",backgroundColorMap:"mf.backgroundColorMap = ...",colorMap:"mf.colorMap = ...",enablePopover:"mf.popoverPolicy = ...",mathModeSpace:"mf.mathModeSpace = ...",placeholderSymbol:"mf.placeholderSymbol = ...",readOnly:"mf.readOnly = ...",removeExtraneousParentheses:"mf.removeExtraneousParentheses = ...",scriptDepth:"mf.scriptDepth = ...",smartFence:"mf.smartFence = ...",smartMode:"mf.smartMode = ...",smartSuperscript:"mf.smartSuperscript = ...",inlineShortcutTimeout:"mf.inlineShortcutTimeout = ...",inlineShortcuts:"mf.inlineShortcuts = ...",keybindings:"mf.keybindings = ...",virtualKeyboardMode:"mf.mathVirtualKeyboardPolicy = ...",customVirtualKeyboardLayers:"mathVirtualKeyboard.layers = ...",customVirtualKeyboards:"mathVirtualKeyboard.layouts = ...",keypressSound:"mathVirtualKeyboard.keypressSound = ...",keypressVibration:"mathVirtualKeyboard.keypressVibration = ...",plonkSound:"mathVirtualKeyboard.plonkSound = ...",virtualKeyboardContainer:"mathVirtualKeyboard.container = ...",virtualKeyboardLayout:"mathVirtualKeyboard.alphabeticLayout = ...",virtualKeyboardTheme:"No longer supported",virtualKeyboardToggleGlyph:"No longer supported",virtualKeyboardToolbar:"mathVirtualKeyboard.editToolbar = ...",virtualKeyboards:"Use `mathVirtualKeyboard.layouts`",speechEngine:"`MathfieldElement.speechEngine`",speechEngineRate:"`MathfieldElement.speechEngineRate`",speechEngineVoice:"`MathfieldElement.speechEngineVoice`",textToSpeechMarkup:"`MathfieldElement.textToSpeechMarkup`",textToSpeechRules:"`MathfieldElement.textToSpeechRules`",textToSpeechRulesOptions:"`MathfieldElement.textToSpeechRulesOptions`",readAloudHook:"`MathfieldElement.readAloudHook`",speakHook:"`MathfieldElement.speakHook`",computeEngine:"`MathfieldElement.computeEngine`",fontsDirectory:"`MathfieldElement.fontsDirectory`",soundsDirectory:"`MathfieldElement.soundsDirectory`",createHTML:"`MathfieldElement.createHTML`",onExport:"`MathfieldElement.onExport`",onInlineShortcut:"`MathfieldElement.onInlineShortcut`",onScrollIntoView:"`MathfieldElement.onScrollIntoView`",locale:"MathfieldElement.locale = ...",strings:"MathfieldElement.strings = ...",decimalSeparator:"MathfieldElement.decimalSeparator = ...",fractionNavigationOrder:"MathfieldElement.fractionNavigationOrder = ..."},Qr=class Yl extends HTMLElement{static get formAssociated(){return Xu()}static get optionsAttributes(){return{"default-mode":"string","letter-shape-style":"string","min-font-scale":"number","popover-policy":"string","math-mode-space":"string","read-only":"boolean","remove-extraneous-parentheses":"on/off","smart-fence":"on/off","smart-mode":"on/off","smart-superscript":"on/off","inline-shortcut-timeout":"string","script-depth":"string",placeholder:"string","virtual-keyboard-target-origin":"string","math-virtual-keyboard-policy":"string"}}static get observedAttributes(){return[...Object.keys(this.optionsAttributes),"contenteditable","disabled","readonly","read-only"]}static get fontsDirectory(){return this._fontsDirectory}static set fontsDirectory(i){i!==this._fontsDirectory&&(this._fontsDirectory=i,Jc())}get fontsDirectory(){throw new Error("Use MathfieldElement.fontsDirectory instead")}set fontsDirectory(i){throw new Error("Use MathfieldElement.fontsDirectory instead")}static get soundsDirectory(){return this._soundsDirectory}static set soundsDirectory(i){this._soundsDirectory=i,this.audioBuffers={}}get soundsDirectory(){throw new Error("Use MathfieldElement.soundsDirectory instead")}set soundsDirectory(i){throw new Error("Use MathfieldElement.soundsDirectory instead")}static get keypressSound(){return this._keypressSound}static set keypressSound(i){var r,a,u;this.audioBuffers={},i===null?this._keypressSound={spacebar:null,return:null,delete:null,default:null}:typeof i=="string"?this._keypressSound={spacebar:i,return:i,delete:i,default:i}:typeof i=="object"&&"default"in i&&(this._keypressSound={spacebar:(r=i.spacebar)!=null?r:i.default,return:(a=i.return)!=null?a:i.default,delete:(u=i.delete)!=null?u:i.default,default:i.default})}static get plonkSound(){return this._plonkSound}static set plonkSound(i){this.audioBuffers={},this._plonkSound=i}static get audioContext(){return this._audioContext||(this._audioContext=new AudioContext),this._audioContext}static get speechEngine(){return this._speechEngine}static set speechEngine(i){this._speechEngine=i}static get speechEngineRate(){return this._speechEngineRate}static set speechEngineRate(i){this._speechEngineRate=i}static get speechEngineVoice(){return this._speechEngineVoice}static set speechEngineVoice(i){this._speechEngineVoice=i}static get textToSpeechMarkup(){return this._textToSpeechMarkup}static set textToSpeechMarkup(i){this._textToSpeechMarkup=i}static get textToSpeechRules(){return this._textToSpeechRules}static set textToSpeechRules(i){this._textToSpeechRules=i}static get textToSpeechRulesOptions(){return this._textToSpeechRulesOptions}static set textToSpeechRulesOptions(i){this._textToSpeechRulesOptions=i}static get locale(){return $.locale}static set locale(i){i==="auto"&&(i=navigator.language.slice(0,5)),$.locale=i}get locale(){throw new Error("Use MathfieldElement.locale instead")}set locale(i){throw new Error("Use MathfieldElement.locale instead")}static get strings(){return $.strings}static set strings(i){$.merge(i)}get strings(){throw new Error("Use MathfieldElement.strings instead")}set strings(i){throw new Error("Use MathfieldElement.strings instead")}static get decimalSeparator(){return this._decimalSeparator}static set decimalSeparator(i){this._decimalSeparator=i,this._computeEngine&&(this._computeEngine.latexOptions.decimalMarker=this.decimalSeparator===","?"{,}":".")}get decimalSeparator(){throw new Error("Use MathfieldElement.decimalSeparator instead")}set decimalSeparator(i){throw new Error("Use MathfieldElement.decimalSeparator instead")}static get computeEngine(){var i,r;if(this._computeEngine===void 0){const a=(i=window[Symbol.for("io.cortexjs.compute-engine")])==null?void 0:i.ComputeEngine;if(!a)return null;this._computeEngine=new a,this._computeEngine&&this.decimalSeparator===","&&(this._computeEngine.latexOptions.decimalMarker="{,}")}return(r=this._computeEngine)!=null?r:null}static set computeEngine(i){this._computeEngine=i}get computeEngine(){throw new Error("Use MathfieldElement.computeEngine instead")}set computeEngine(i){throw new Error("Use MathfieldElement.computeEngine instead")}static get isFunction(){return typeof this._isFunction!="function"?()=>!1:this._isFunction}static set isFunction(i){this._isFunction=i}static loadSound(i){return cl(this,null,function*(){delete this.audioBuffers[i];let r="";switch(i){case"keypress":r=this._keypressSound.default;break;case"return":r=this._keypressSound.return;break;case"spacebar":r=this._keypressSound.spacebar;break;case"delete":r=this._keypressSound.delete;break;case"plonk":r=this.plonkSound;break}if(typeof r!="string")return;r=r.trim();const a=this.soundsDirectory;if(!(a==null||a==="null"||r==="none"||r==="null"))try{const p=yield(yield fetch(yield Ws(`${a}/${r}`))).arrayBuffer(),m=yield this.audioContext.decodeAudioData(p);this.audioBuffers[i]=m}catch(u){}})}static playSound(i){return cl(this,null,function*(){if((this.audioContext.state==="suspended"||this.audioContext.state==="interrupted")&&(yield this.audioContext.resume()),this.audioBuffers[i]||(yield this.loadSound(i)),!this.audioBuffers[i])return;const r=this.audioContext.createBufferSource();r.buffer=this.audioBuffers[i];const a=this.audioContext.createGain();a.gain.value=S1,r.connect(a).connect(this.audioContext.destination),r.start()})}constructor(i){if(super(),i){const r=[];for(const a of Object.keys(i))if(ll[a])if(ll[a].startsWith("mf."))if(ll[a].startsWith(`mf.${a}`))r.push(`Option \`${a}\` cannot be used as a constructor option. Use ${ll[a]}`);else{const u=ll[a].match(/([a-zA-Z]+) =/);r.push(`Option \`${a}\` has been renamed \`${u[1]}\``)}else r.push(`Option \`${a}\` cannot be used as a constructor option. Use ${ll[a]}`);if(r.length>0){console.group("%cMathLive 0.98.5: %cInvalid Options","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn("Some of the options passed to `new MathfieldElement(...)` are invalid. \n See https://cortexjs.io/mathlive/changelog/ for details.");for(const a of r)console.warn(a);console.groupEnd()}}if(Xu()&&(this._internals=this.attachInternals(),this._internals.role="math",this._internals.ariaLabel="math input field",this._internals.ariaMultiLine="false"),this.attachShadow({mode:"open",delegatesFocus:!0}),this.shadowRoot&&"adoptedStyleSheets"in this.shadowRoot){this.shadowRoot.adoptedStyleSheets=[ma("core"),ma("mathfield"),ma("mathfield-element"),ma("ui"),ma("menu")],this.shadowRoot.appendChild(document.createElement("span"));const r=document.createElement("slot");r.style.display="none",this.shadowRoot.appendChild(r)}else this.shadowRoot.innerHTML="<style>"+Fs("core")+Fs("mathfield")+Fs("mathfield-element")+Fs("ui")+Fs("menu")+'</style><span></span><slot style="display:none"></slot>';i&&this._setOptions(i),this.shadowRoot.addEventListener("slotchange",()=>{var r;const a=this.shadowRoot.querySelector("slot:not([name])");this.value=(r=a==null?void 0:a.assignedNodes().map(u=>u.nodeType===3?u.textContent:"").join("").trim())!=null?r:""})}showMenu(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.showMenu(i))!=null?a:!1}get mathVirtualKeyboard(){throw new Error("The `mathVirtualKeyboard` property is not available on the MathfieldElement. Use `window.mathVirtualKeyboard` instead.")}onPointerDown(){window.addEventListener("pointerup",i=>{var r;i.target===this&&!((r=this._mathfield)!=null&&r.disabled)&&this.dispatchEvent(new MouseEvent("click",{altKey:i.altKey,button:i.button,buttons:i.buttons,clientX:i.clientX,clientY:i.clientY,ctrlKey:i.ctrlKey,metaKey:i.metaKey,movementX:i.movementX,movementY:i.movementY,relatedTarget:i.relatedTarget,screenX:i.screenX,screenY:i.screenY,shiftKey:i.shiftKey}))},{once:!0})}getPromptValue(i,r){var a,u;return(u=(a=this._mathfield)==null?void 0:a.getPromptValue(i,r))!=null?u:""}setPromptValue(i,r,a){var u;(u=this._mathfield)==null||u.setPromptValue(i,r,a)}getPromptRange(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.getPromptRange(i))!=null?a:null}getPrompts(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.getPrompts(i))!=null?a:[]}get form(){var i;return(i=this._internals)==null?void 0:i.form}get name(){var i;return(i=this.getAttribute("name"))!=null?i:""}get type(){return this.localName}get mode(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.model.mode)!=null?r:this.defaultMode==="text"?"text":"math"}set mode(i){var r;(r=this._mathfield)==null||r.switchMode(i)}get expression(){if(this._mathfield)return window[Symbol.for("io.cortexjs.compute-engine")]?this._mathfield.expression:(console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`),null)}set expression(i){var r,a;if(!this._mathfield)return;const u=(a=(r=Yl.computeEngine)==null?void 0:r.box(i).latex)!=null?a:null;u!==null&&this._mathfield.setValue(u),window[Symbol.for("io.cortexjs.compute-engine")]||console.error(`MathLive 0.98.5: The CortexJS Compute Engine library is not available.
Load the library, for example with:
import "https://unpkg.com/@cortex-js/compute-engine?module"`)}get errors(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.errors)!=null?r:[]}_getOptions(i){return this._mathfield?zl(this._mathfield.options,i):yn.has(this)?P({},zl(P(P({},Nf()),Bf(yn.get(this).options)),i)):null}getOptions(i){return console.warn("%cMathLive 0.98.5: %cDeprecated Usage%c\n `mf.getOptions()` is deprecated. Read the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._mathfield?zl(this._mathfield.options,i):yn.has(this)?zl(P(P({},Nf()),Bf(yn.get(this).options)),i):null}reflectAttributes(){const i=Nf(),r=this._getOptions();Object.keys(Yl.optionsAttributes).forEach(a=>{const u=xo(a);Yl.optionsAttributes[a]==="on/off"?i[u]!==r[u]?this.setAttribute(a,r[u]?"on":"off"):this.removeAttribute(a):i[u]!==r[u]&&(Yl.optionsAttributes[a]==="boolean"?r[u]?this.setAttribute(a,""):this.removeAttribute(a):(typeof r[u]=="string"||typeof r[u]=="number")&&this.setAttribute(a,r[u].toString()))})}getOption(i){return console.warn("%cMathLive 0.98.5: %cDeprecated Usage%c\n `mf.getOption()` is deprecated. Read the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem","color: inherit, font-size: 1rem"),this._getOptions([i])[i]}_getOption(i){return this._getOptions([i])[i]}_setOptions(i){if(this._mathfield)this._mathfield.setOptions(i);else if(yn.has(this)){const r=P(P({},yn.get(this).options),i);yn.set(this,f(P({},yn.get(this)),{selection:{ranges:r.readOnly?[[0,0]]:[[0,-1]]},options:r}))}else yn.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:i,menuItems:void 0});this.reflectAttributes()}setOptions(i){console.group("%cMathLive 0.98.5: %cDeprecated Usage","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),console.warn(" `mf.setOptions()` is deprecated. Set the property directly on the mathfield instead.\n See https://cortexjs.io/mathlive/changelog/ for details.");for(const r of Object.keys(i))ll[r]&&console.warn(`\`mf.setOptions({${r}:...})\` -> ${ll[r]}`);console.groupEnd(),this._setOptions(i)}executeCommand(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.executeCommand(i))!=null?a:!1}getValue(i,r,a){var u,p;if(this._mathfield)return this._mathfield.model.getValue(i,r,a);if(yn.has(this)){let m,b,w;if(ku(i)?([m,b]=i.ranges[0],w=r):jo(i)?([m,b]=i,w=r):pa(i)&&pa(r)?(m=i,b=r,w=a):(m=0,b=-1,w=i),(w===void 0||w==="latex")&&m===0&&b===-1)return(p=(u=yn.get(this).value)!=null?u:this.textContent)!=null?p:""}return""}setValue(i,r){if(this._mathfield&&i!==void 0){r!=null||(r={silenceNotifications:!0,mode:"math"}),this._mathfield.setValue(i,r);return}if(yn.has(this)){const u=yn.get(this).options;yn.set(this,{value:i,selection:{ranges:[[-1,-1]],direction:"forward"},options:u,menuItems:void 0});return}const a=fh(this);yn.set(this,{value:i,selection:{ranges:[[-1,-1]],direction:"forward"},options:a,menuItems:void 0})}hasFocus(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.hasFocus())!=null?r:!1}focus(){var i;(i=this._mathfield)==null||i.focus()}blur(){var i;(i=this._mathfield)==null||i.blur()}select(){var i;(i=this._mathfield)==null||i.select()}insert(i,r){var a,u;return(u=(a=this._mathfield)==null?void 0:a.insert(i,r))!=null?u:!1}applyStyle(i,r){var a;return(a=this._mathfield)==null?void 0:a.applyStyle(i,r)}queryStyle(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.queryStyle(i))!=null?a:"none"}get caretPoint(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.getCaretPoint())!=null?r:null}set caretPoint(i){var r;i&&((r=this._mathfield)==null||r.setCaretPoint(i.x,i.y))}setCaretPoint(i,r){var a,u;return(u=(a=this._mathfield)==null?void 0:a.setCaretPoint(i,r))!=null?u:!1}offsetFromPoint(i,r,a){return this._mathfield?sh(this._mathfield,i,r,a):-1}hitboxFromOffset(i){if(!this._mathfield)return null;const r=this._mathfield.model.at(i);if(!r)return null;const a=ia(this._mathfield,r);return a?new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top):null}resetUndo(){var i;(i=this._mathfield)==null||i.resetUndo()}canUndo(){return this._mathfield?this._mathfield.canUndo():!1}canRedo(){return this._mathfield?this._mathfield.canRedo():!1}handleEvent(i){var r,a,u,p;L.state==="closed"&&((a=(r=this._mathfield)==null?void 0:r.menu)==null?void 0:a.state)==="closed"&&(i.type==="pointerdown"&&this.onPointerDown(),i.type==="focus"&&((u=this._mathfield)==null||u.focus()),i.type==="blur"&&((p=this._mathfield)==null||p.blur()))}connectedCallback(){var i,r,a,u;const p=window.getComputedStyle(this),m=this.shadowRoot,b=p.userSelect!=="none";if(b)m.host.addEventListener("pointerdown",this,!0);else{const I=m.querySelector("span");I.style.pointerEvents="none"}m.host.addEventListener("focus",this,!0),m.host.addEventListener("blur",this,!0),Xu()||(this.hasAttribute("role")||this.setAttribute("role","math"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","math input field"),this.setAttribute("aria-multiline","false")),b&&!this.hasAttribute("contenteditable")&&this.setAttribute("contenteditable","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const w=m.querySelector("slot:not([name])");if(w)try{this._style=w.assignedElements().filter(I=>I.tagName.toLowerCase()==="style").map(I=>I.textContent).join("")}catch(I){console.error(I)}if(this._style){const I=document.createElement("style");I.textContent=this._style,m.appendChild(I)}let E="";if(this.hasAttribute("value")?E=this.getAttribute("value"):E=(i=w==null?void 0:w.assignedNodes().map(I=>I.nodeType===3?I.textContent:"").join("").trim())!=null?i:"",this._mathfield=new x1(m.querySelector(":host > span"),f(P({},(a=(r=yn.get(this))==null?void 0:r.options)!=null?a:fh(this)),{eventSink:this,value:E})),!yn.has(this)){this.upgradeProperty("disabled"),this.upgradeProperty("readonly");for(const I of Object.keys(Yl.optionsAttributes))this.upgradeProperty(xo(I))}if(!((u=this._mathfield)!=null&&u.model)){this._mathfield=null;return}if(yn.has(this)){const I=this._mathfield,N=yn.get(this),J=N.menuItems;I.model.deferNotifications({content:!1,selection:!1},()=>{const oe=N.value;oe!==void 0&&I.setValue(oe),I.model.selection=N.selection,yn.delete(this)}),J&&(this.menuItems=J)}window.queueMicrotask(()=>{this.isConnected&&this.dispatchEvent(new Event("mount",{cancelable:!1,bubbles:!0,composed:!0}))}),rl()}disconnectedCallback(){var i,r;if(this.shadowRoot.host.removeEventListener("pointerdown",this,!0),!this._mathfield)return;window.queueMicrotask(()=>this.dispatchEvent(new Event("unmount",{cancelable:!1,bubbles:!0,composed:!0})));const a=zl(this._mathfield.options,Object.keys(Yl.optionsAttributes).map(u=>xo(u)));yn.set(this,{value:this._mathfield.getValue(),selection:this._mathfield.model.selection,menuItems:(r=(i=this._mathfield.menu)==null?void 0:i.menuItems)!=null?r:void 0,options:a}),this._mathfield.dispose(),this._mathfield=null}upgradeProperty(i){if(this.hasOwnProperty(i)){const r=this[i];delete this[i],(i==="readonly"||i==="read-only")&&(i="readOnly"),this[i]=r}}attributeChangedCallback(i,r,a){if(r===a)return;const u=a!==null;switch(i){case"contenteditable":Ii(this._mathfield);break;case"disabled":this.disabled=u;break;case"read-only":case"readonly":this.readOnly=u;break;default:}}get readonly(){return this.hasAttribute("readonly")||this.hasAttribute("read-only")}set readonly(i){const r=!!i;r?(this.setAttribute("readonly",""),Xu()?this._internals.ariaReadOnly="true":this.setAttribute("aria-readonly","true"),this.setAttribute("aria-readonly","true")):(Xu()?this._internals.ariaReadOnly="false":this.removeAttribute("aria-readonly"),this.removeAttribute("readonly"),this.removeAttribute("read-only")),this._setOptions({readOnly:r})}get disabled(){return this.hasAttribute("disabled")}set disabled(i){var r;const a=!!i;a?this.setAttribute("disabled",""):this.removeAttribute("disabled"),Xu()?this._internals.ariaDisabled=a?"true":"false":this.setAttribute("aria-disabled",a?"true":"false"),a&&((r=this._mathfield)!=null&&r.hasFocus)&&window.mathVirtualKeyboard.visible&&this._mathfield.executeCommand("hideVirtualKeyboard")}get value(){return this.getValue()}set value(i){this.setValue(i)}get defaultMode(){return this._getOption("defaultMode")}set defaultMode(i){this._setOptions({defaultMode:i})}get macros(){return this._getOption("macros")}set macros(i){this._setOptions({macros:i})}get registers(){const i=this;return new Proxy({},{get:(r,a)=>{if(typeof a=="string")return i._getOption("registers")[a]},set(r,a,u){return typeof a!="string"?!1:(i._setOptions({registers:f(P({},i._getOption("registers")),{[a]:u})}),!0)}})}set registers(i){this._setOptions({registers:i})}get colorMap(){return this._getOption("colorMap")}set colorMap(i){this._setOptions({colorMap:i})}get backgroundColorMap(){return this._getOption("backgroundColorMap")}set backgroundColorMap(i){this._setOptions({backgroundColorMap:i})}get letterShapeStyle(){return this._getOption("letterShapeStyle")}set letterShapeStyle(i){this._setOptions({letterShapeStyle:i})}get minFontScale(){return this._getOption("minFontScale")}set minFontScale(i){this._setOptions({minFontScale:i})}get smartMode(){return this._getOption("smartMode")}set smartMode(i){this._setOptions({smartMode:i})}get smartFence(){return this._getOption("smartFence")}set smartFence(i){this._setOptions({smartFence:i})}get smartSuperscript(){return this._getOption("smartSuperscript")}set smartSuperscript(i){this._setOptions({smartSuperscript:i})}get scriptDepth(){return this._getOption("scriptDepth")}set scriptDepth(i){this._setOptions({scriptDepth:i})}get removeExtraneousParentheses(){return this._getOption("removeExtraneousParentheses")}set removeExtraneousParentheses(i){this._setOptions({removeExtraneousParentheses:i})}get mathModeSpace(){return this._getOption("mathModeSpace")}set mathModeSpace(i){this._setOptions({mathModeSpace:i})}get placeholderSymbol(){return this._getOption("placeholderSymbol")}set placeholderSymbol(i){this._setOptions({placeholderSymbol:i})}get popoverPolicy(){return this._getOption("popoverPolicy")}set popoverPolicy(i){this._setOptions({popoverPolicy:i})}get environmentPopoverPolicy(){return this._getOption("environmentPopoverPolicy")}set environmentPopoverPolicy(i){this._setOptions({environmentPopoverPolicy:i})}get menuItems(){var i,r,a;return this._mathfield?(i=this._mathfield.menu._menuItems.map(u=>u.menuItem))!=null?i:[]:(a=(r=yn.get(this))==null?void 0:r.menuItems)!=null?a:[]}set menuItems(i){var r;if(this._mathfield){const a=(r=this._mathfield.element)==null?void 0:r.querySelector("[part=menu-toggle]");a&&(a.style.display=i.length===0?"none":""),this._mathfield.menu.menuItems=i}yn.has(this)?yn.set(this,f(P({},yn.get(this)),{menuItems:i})):yn.set(this,{value:void 0,selection:{ranges:[[0,0]]},options:fh(this),menuItems:i})}get mathVirtualKeyboardPolicy(){return this._getOption("mathVirtualKeyboardPolicy")}set mathVirtualKeyboardPolicy(i){this._setOptions({mathVirtualKeyboardPolicy:i})}get inlineShortcuts(){return this._getOption("inlineShortcuts")}set inlineShortcuts(i){this._setOptions({inlineShortcuts:i})}get inlineShortcutTimeout(){return this._getOption("inlineShortcutTimeout")}set inlineShortcutTimeout(i){this._setOptions({inlineShortcutTimeout:i})}get keybindings(){return this._getOption("keybindings")}set keybindings(i){this._setOptions({keybindings:i})}get onInlineShortcut(){return this._getOption("onInlineShortcut")}set onInlineShortcut(i){this._setOptions({onInlineShortcut:i})}get onScrollIntoView(){return this._getOption("onScrollIntoView")}set onScrollIntoView(i){this._setOptions({onScrollIntoView:i})}get onExport(){return this._getOption("onExport")}set onExport(i){this._setOptions({onExport:i})}get readOnly(){return this._getOption("readOnly")}set readOnly(i){this._setOptions({readOnly:i})}get isSelectionEditable(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.isSelectionEditable)!=null?r:!1}setPromptState(i,r,a){var u;(u=this._mathfield)==null||u.setPromptState(i,r,a)}getPromptState(i){var r,a;return(a=(r=this._mathfield)==null?void 0:r.getPromptState(i))!=null?a:[void 0,!0]}get virtualKeyboardTargetOrigin(){return this._getOption("virtualKeyboardTargetOrigin")}set virtualKeyboardTargetOrigin(i){this._setOptions({virtualKeyboardTargetOrigin:i})}get selection(){return this._mathfield?this._mathfield.model.selection:yn.has(this)?yn.get(this).selection:{ranges:[[0,0]],direction:"forward"}}set selection(i){if(typeof i=="number"&&(i={ranges:[[i,i]]}),this._mathfield){this._mathfield.model.selection=i,Ii(this._mathfield);return}if(yn.has(this)){yn.set(this,f(P({},yn.get(this)),{selection:i}));return}yn.set(this,{value:void 0,selection:i,options:fh(this),menuItems:void 0})}get selectionIsCollapsed(){const i=this.selection;return i.ranges.length===1&&i.ranges[0][0]===i.ranges[0][1]}get position(){return this._mathfield?this._mathfield.model.position:yn.has(this)?yn.get(this).selection.ranges[0][0]:0}set position(i){if(this._mathfield&&(this._mathfield.model.position=i,Ii(this._mathfield)),yn.has(this)){yn.set(this,f(P({},yn.get(this)),{selection:{ranges:[[i,i]]}}));return}yn.set(this,{value:void 0,selection:{ranges:[[i,i]]},options:fh(this),menuItems:void 0})}getOffsetDepth(i){var r,a;return this._mathfield?((a=(r=this._mathfield.model.at(i))==null?void 0:r.treeDepth)!=null?a:2)-2:0}get lastOffset(){var i,r;return(r=(i=this._mathfield)==null?void 0:i.model.lastOffset)!=null?r:-1}};Qr.version="0.98.5",Qr._fontsDirectory="./fonts",Qr._soundsDirectory="./sounds",Qr.keypressVibration=!0,Qr._keypressSound={spacebar:"keypress-spacebar.wav",return:"keypress-return.wav",delete:"keypress-delete.wav",default:"keypress-standard.wav"},Qr._plonkSound="plonk.wav",Qr.audioBuffers={},Qr.createHTML=e=>e,Qr._speechEngineRate="100%",Qr._speechEngineVoice="Joanna",Qr._textToSpeechMarkup="",Qr._textToSpeechRules="mathlive",Qr._textToSpeechRulesOptions={},Qr.speakHook=f1,Qr.readAloudHook=w1,Qr._decimalSeparator=".",Qr.fractionNavigationOrder="numerator-denominator",Qr._isFunction=e=>{var i,r;const a=window.MathfieldElement.computeEngine;return(r=(i=a==null?void 0:a.parse(e).domain)==null?void 0:i.isFunction)!=null?r:!1};var hh=Qr;function xo(e){return e.replace(/[^a-zA-Z\d]+(.)/g,(i,r)=>r.toUpperCase())}function fh(e){const i={readOnly:!1},r=hh.optionsAttributes;return Object.keys(r).forEach(a=>{if(e.hasAttribute(a)){const u=e.getAttribute(a);a==="placeholder"?i.contentPlaceholder=u!=null?u:"":r[a]==="boolean"?i[xo(a)]=!0:r[a]==="on/off"?u==="on"?i[xo(a)]=!0:u==="off"?i[xo(a)]=!1:i[xo(a)]=void 0:r[a]==="number"?i[xo(a)]=Number.parseFloat(u!=null?u:"0"):i[xo(a)]=u}}),i}function Xu(){return!(!("ElementInternals"in window)||!HTMLElement.prototype.attachInternals||!("role"in window.ElementInternals.prototype))}var Mp=hh,Ip,Rp,Pp,Op;if(C()&&!((Ip=window.customElements)!=null&&Ip.get("math-field"))){(Pp=window[Rp=Symbol.for("io.cortexjs.mathlive")])!=null||(window[Rp]={});const e=window[Symbol.for("io.cortexjs.mathlive")];e.version="0.98.5",window.MathfieldElement=hh,(Op=window.customElements)==null||Op.define("math-field",hh)}function E1(e,i,r){let a=r,u=0;const p=e.length;for(;a<i.length;){const m=i[a];if(u<=0&&i.slice(a,a+p)===e)return a;m==="\\"?a++:m==="{"?u++:m==="}"&&u--,a++}return-1}function td(e,i,r,a,u="latex"){const p=[];for(const m of e)if(m.type==="text"){const b=m.data;let w=!0,E=0,I;I=b.indexOf(i),I!==-1&&(E=I,E>0&&p.push({type:"text",data:b.slice(0,E)}),w=!1);let N=!1;for(;!N;){if(w){if(I=b.indexOf(i,E),I===-1){N=!0;break}E!==I&&p.push({type:"text",data:b.slice(E,I)}),E=I}else{if(I=E1(r,b,E+i.length),I===-1){N=!0;break}let J=b.slice(E+i.length,I);u==="ascii-math"&&([,J]=Au(J,{format:"ascii-math"})),p.push({type:"math",data:J,rawData:b.slice(E,I+r.length),mathstyle:a}),E=I+r.length}w=!w}E<b.length&&p.push({type:"text",data:b.slice(E)})}else p.push(m);return p}function Fp(e,i,r){let a=[{type:"text",data:e}];return i!=null&&i.inline&&i.inline.forEach(([u,p])=>{a=td(a,u,p,"textstyle")}),i!=null&&i.display&&i.display.forEach(([u,p])=>{a=td(a,u,p,"displaystyle")}),r!=null&&r.inline&&r.inline.forEach(([u,p])=>{a=td(a,u,p,"textstyle","ascii-math")}),r!=null&&r.display&&r.display.forEach(([u,p])=>{a=td(a,u,p,"displaystyle","ascii-math")}),a}function k1(e,i){const r=document.createElement("span");r.setAttribute("translate","no");try{const a="<math xmlns='http://www.w3.org/1998/Math/MathML'>"+i.renderToMathML(e)+"</math>";r.innerHTML=window.MathfieldElement.createHTML(a)}catch(a){console.error(`MathLive 0.98.5: Could not convert "${e}"' to MathML with ${a}`),r.textContent=e}return r.className="ML__sr-only",r}function T1(e,i,r,a){try{const u=i.renderToMarkup(e,{mathstyle:r,format:"html"}),p=document.createElement("span");return p.dataset.latex=e,p.style.display=r==="displaystyle"?"flex":"inline-flex",p.setAttribute("aria-hidden","true"),p.setAttribute("translate","no"),p.innerHTML=window.MathfieldElement.createHTML(u),p}catch(u){if(console.error("Could not parse'"+e+"' with ",u),a)return document.createTextNode(e)}return null}function Ju(e,i,r,a){var u;const p=T1(e,r,i||"textstyle",a),m=(u=r.renderAccessibleContent)!=null?u:"";if(p&&/\b(mathml|speakable-text)\b/i.test(m)){const b=document.createElement("span");if(/\bmathml\b/i.test(m)&&r.renderToMathML&&b.append(k1(e,r)),/\bspeakable-text\b/i.test(m)&&r.renderToSpeakableText){const w=document.createElement("span");w.setAttribute("translate","no");const E=r.renderToSpeakableText(e);w.innerHTML=window.MathfieldElement.createHTML(E),w.className="ML__sr-only",b.append(w)}return b.append(p),b}return p}function A1(e,i){var r,a,u;let p=null;if((r=i.TeX)!=null&&r.processEnvironments&&/^\s*\\begin/.test(e)){p=document.createDocumentFragment();const m=Ju(e,"",i,!0);m&&p.appendChild(m)}else{if(!e.trim())return null;const m=Fp(e,(a=i.TeX)==null?void 0:a.delimiters,(u=i.asciiMath)==null?void 0:u.delimiters);if(m.length===1&&m[0].type==="text")return null;p=document.createDocumentFragment();for(const b of m)if(b.type==="text")p.appendChild(document.createTextNode(b.data));else{const w=Ju(b.data,b.mathstyle==="textstyle"?"textstyle":"displaystyle",i,!0);w&&p.appendChild(w)}}return p}function Bp(e,i){var r,a,u,p,m,b,w,E,I,N,J,oe,ge,He,Ft,Ve;if(e.childNodes.length===1&&e.childNodes[0].nodeType===3){const St=(r=e.childNodes[0].textContent)!=null?r:"";if((a=i.TeX)!=null&&a.processEnvironments&&/^\s*\\begin/.test(St)){e.textContent="";const Lt=Ju(St,"",i,!0);Lt&&e.append(Lt);return}const Kt=Fp(St,(u=i.TeX)==null?void 0:u.delimiters,(p=i.asciiMath)==null?void 0:p.delimiters);if(Kt.length===1&&Kt[0].type==="math"){e.textContent="";const Lt=Ju(Kt[0].data,Kt[0].mathstyle==="textstyle"?"textstyle":"displaystyle",i,!0);Lt&&e.append(Lt);return}if(Kt.length===1&&Kt[0].type==="text")return}for(let St=e.childNodes.length-1;St>=0;St--){const Kt=e.childNodes[St];if(Kt.nodeType===3){const Lt=A1((m=Kt.textContent)!=null?m:"",i);Lt&&(St+=Lt.childNodes.length-1,Kt.replaceWith(Lt))}else if(Kt.nodeType===1){const Lt=Kt,ai=Kt.nodeName.toLowerCase();if(ai==="script"){const yi=Kt;let fi;if((b=i.processScriptTypePattern)!=null&&b.test(yi.type))fi=(w=yi.textContent)!=null?w:"";else if((E=i.processMathJSONScriptTypePattern)!=null&&E.test(yi.type))try{fi=(N=i.serializeToLatex)==null?void 0:N.call(i,JSON.parse((I=yi.textContent)!=null?I:""))}catch(pn){console.error(pn)}if(fi){let pn="textstyle";for(const Ht of yi.type.split(";")){const[qs,Va]=Ht.toLowerCase().split("=");qs.trim()==="mode"&&(pn=Va.trim()==="display"?"displaystyle":"textstyle")}const Bn=Ju(fi,pn,i,!0);Bn&&yi.parentNode.replaceChild(Bn,yi)}}else if(((oe=(J=i.processClassPattern)==null?void 0:J.test(Lt.className))!=null?oe:!1)||!((He=(ge=i.skipTags)==null?void 0:ge.includes(ai))!=null&&He||(Ve=(Ft=i.ignoreClassPattern)==null?void 0:Ft.test(Lt.className))!=null&&Ve))if(e.childNodes.length===1&&e.childNodes[0].nodeType===3){const fi=e.textContent;e.textContent="";const pn=Ju(fi!=null?fi:"","displaystyle",i,!0);pn&&e.append(pn)}else Bp(Lt,i)}}}var L1={skipTags:["math-field","noscript","style","textarea","pre","code","annotation","annotation-xml"],processScriptType:"math/tex",processMathJSONScriptType:"math/json",ignoreClass:"tex2jax_ignore",processClass:"tex2jax_process",renderAccessibleContent:"mathml",asciiMath:{delimiters:{inline:[["`","`"]]}},TeX:{processEnvironments:!0,delimiters:{inline:[["\\(","\\)"]],display:[["$$","$$"],["\\[","\\]"]]}}};function D1(e,i){var r,a,u,p;try{const m=P(P({},L1),i);m.ignoreClassPattern=new RegExp((r=m.ignoreClass)!=null?r:""),m.processClassPattern=new RegExp((a=m.processClass)!=null?a:""),m.processScriptTypePattern=new RegExp((u=m.processScriptType)!=null?u:""),m.processMathJSONScriptTypePattern=new RegExp((p=m.processMathJSONScriptType)!=null?p:""),rl(),_a("core"),Bp(e,m)}catch(m){m instanceof Error?console.error("renderMathInElement(): "+m.message):console.error("renderMathInElement(): Could not render math for element",e)}}function C1(e,i){const r=al.singleton;return r?(r.show(),eh(),r.currentLayer=i,r.render(),r.focus(),!0):!1}function M1(){const e=window.mathVirtualKeyboard;return e.visible?e.hide({animate:!0}):e.show({animate:!0}),!1}Jr({switchKeyboardLayer:C1,toggleVirtualKeyboard:M1,hideVirtualKeyboard:()=>(window.mathVirtualKeyboard.hide({animate:!0}),!1),showVirtualKeyboard:()=>(window.mathVirtualKeyboard.show({animate:!0}),!1)},{target:"virtual-keyboard"});function ul(){var e,i;return(i=globalThis[e=Symbol.for("io.cortexjs.mathlive")])!=null||(globalThis[e]={}),globalThis[Symbol.for("io.cortexjs.mathlive")]}function B1(){return console.warn("%cMathLive 0.98.5: %cmakeSharedVirtualKeyboard() is deprecated. \n Use `window.mathVirtualKeyboard` to access the virtual keyboard instance.\n See https://cortexjs.io/mathlive/changelog/ for details.","color:#12b; font-size: 1.1rem","color:#db1111; font-size: 1.1rem"),window.mathVirtualKeyboard}function N1(e){R1(document.body,e)}function I1(e){if(typeof e=="string"){const i=document.getElementById(e);if(i===null)throw new Error(`The element with ID "${e}" could not be found.`);return i}return typeof e=="string"?null:e}function R1(e,i){var r,a,u,p;const m=I1(e);if(!m)return;const b=i!=null?i:{};(r=b.renderToMarkup)!=null||(b.renderToMarkup=Vr),(a=b.renderToMathML)!=null||(b.renderToMathML=Hg),(u=b.renderToSpeakableText)!=null||(b.renderToSpeakableText=Wg),(p=b.serializeToLatex)!=null||(b.serializeToLatex=jg),D1(m,b)}var $1={mathlive:"0.98.5"}}}]);
}());